feat(sampler): port linear MTP coupling and cooperative verify upstream

Port GitHub PRs #12 and #13 onto Codeberg upstream main, retaining upstream kernel-chain handling. Include the source Clang target-attribute fixes required by the host build; omit the KFD header workaround and unrelated fork work.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
committed 2026-10-22 22:58:08 +02:00
1 parent 123c439684
commit d912c694f3
37 files changed
+3730 -23

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
/* plugin/spechub/ref_spechub.cpp -- the two coupling ops on the host.
*
* ONE ROW AT A TIME, in the same order and with the same arithmetic as the kernel: these functions
* call the very same abi/rad_spechub.h helpers the device launch is built from, so an op and its
* reference cannot drift. What they add is the row loop and the same eligibility gate.
*
* This is the oracle rad-kbench checks the device rows against, and the only implementation a
* machine with no card can run.
*/
#include "spechub.h"
int rad_ref_mtp_couple_propose(const RadArgs* a, RadStream) {
RadMtpCoupleProposeCall c{};
const int rc = rad_mtp_couple_propose_args(a, &c);
if (rc != RAD_OK) return rc;
for (int64_t row = 0; row < c.M; ++row) rad_mtp_couple_propose_row(c, row);
return RAD_OK;
}
int rad_ref_mtp_couple_verify(const RadArgs* a, RadStream) {
RadMtpCoupleVerifyCall c{};
const int rc = rad_mtp_couple_verify_args(a, &c);
if (rc != RAD_OK) return rc;
for (int64_t row = 0; row < c.M; ++row) rad_mtp_couple_verify_row(c, row);
return RAD_OK;
}