build: a LoRA-declined fused GEMM owns no weight and is not a reference-kernel op

Found on Qwen3.8-27B fp8: the 64 declined gemm_nt_q_gated folds tripped the reference-kernel gate,
and as unresolved readers of gate_up they would have told the planner the weight cannot live on the
card.
This commit is contained in:
baKon committed 2026-10-16 20:52:09 -05:00
1 parent 63e6d01394
commit be4ebdc3af
3 files changed
+12

No files matched your search

+7
View File
@@ -725,6 +725,13 @@ rad_op Builder::decl_op(const char* opname, const RadParam* p, int n_p,
none.miss[d] = "declined: its weight is a runtime-LoRA target, and a fused GEMM has no "
"output for the adapter's delta (the plugin runs the unfused chain)";
oi.bands.assign(1, none);
oi.lora_declined = true;
/* AND IT OWNS NO WEIGHT. The planner, the layout pass and the weight-use bookkeeping all
* read an op's weights, and an op with no kernel anywhere would tell the planner the weight
* cannot be read on the card -- moving the gate_up the unfused chain multiplies on the card
* off it. The op stays in the list, by name, so the sizing declare lines up. */
oi.weights.clear();
oi.weight_opd.clear();
prog_.ops.push_back(std::move(oi));
op_bufs_.emplace_back();
return RAD_NULL_HANDLE;
+1
View File
@@ -38,6 +38,7 @@ int rad_reference_ops(const Program& p, std::vector<std::string>* out) {
int n = 0;
for (size_t i = 1; i < p.ops.size(); ++i) {
const OpInfo& oi = p.ops[i];
if (oi.lora_declined) continue; /* never handed out, so never issued (rad_builder.cpp) */
bool real = false;
for (const Band& b : oi.bands)
for (int d = 0; d < RAD_N_DOMAINS && !real; ++d)
+4
View File
@@ -271,6 +271,10 @@ struct OpInfo {
* plugin op. `lora_site`: on a targeted gemm, its row in Program::lora_sites; -1 otherwise. */
int32_t anchor = -1;
int32_t lora_site = -1;
/* Declined at declare because runtime LoRA targets its weight (a fused GEMM no delta can follow):
* recorded unresolved on purpose, its handle never handed to the plugin, so it is never issued
* and the reference-kernel gate does not count it. */
bool lora_declined = false;
};
struct KVGroupInfo {