Skip to content

Commit 6478051

Browse files
committed
Enable fused GDN probing on ROCm
Remove the fork-local CUDA-only prefilter so fused Gated Delta Net follows the upstream scheduler capability probe. Keep MUSA excluded through backend support and add a plumbing regression test for ROCm probing.
1 parent 76e84ef commit 6478051

2 files changed

Lines changed: 15 additions & 23 deletions

File tree

src/llama-context.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -680,29 +680,6 @@ void llama_context::sched_reserve() {
680680
cparams.auto_fa = false;
681681
}
682682

683-
if (cparams.auto_fgdn) {
684-
// Fused GDN kernels are only tested on NVIDIA CUDA. Disable on ROCm/MUSA/other.
685-
bool have_cuda_gpu = false;
686-
for (auto & backend : backends) {
687-
auto * dev = ggml_backend_get_device(backend.get());
688-
if (dev && ggml_backend_dev_type(dev) == GGML_BACKEND_DEVICE_TYPE_GPU) {
689-
ggml_backend_reg_t reg = ggml_backend_dev_backend_reg(dev);
690-
const char * reg_name = ggml_backend_reg_name(reg);
691-
if (reg_name && strncmp(reg_name, "CUDA", 4) == 0) {
692-
have_cuda_gpu = true;
693-
}
694-
break;
695-
}
696-
}
697-
698-
if (!have_cuda_gpu) {
699-
cparams.fused_gdn_ar = false;
700-
cparams.fused_gdn_ch = false;
701-
cparams.auto_fgdn = false;
702-
LLAMA_LOG_INFO("%s: fused Gated Delta Net disabled (non-CUDA backend)\n", __func__);
703-
}
704-
}
705-
706683
if (cparams.auto_fgdn) {
707684
LLAMA_LOG_INFO("%s: resolving fused Gated Delta Net support:\n", __func__);
708685

tests/test-dflash-plumbing.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,21 @@ int main(int argc, char ** argv) {
591591
delta_net_base.find("ggml_gated_delta_net_tree(ctx0, q, k, v, g, b, s, tree_parent_ids, persist_inter)") != std::string::npos &&
592592
delta_net_base.find("cb(result, \"fgdn_tree\", il)") != std::string::npos,
593593
"DeltaNet must preserve the DDTree tree-aware GDN path for single-sequence multi-token verification batches");
594+
{
595+
const std::string fgdn_resolve = slice_between(
596+
context_cpp,
597+
"if (cparams.auto_fgdn) {\n LLAMA_LOG_INFO(\"%s: resolving fused Gated Delta Net support:",
598+
" cparams.auto_fgdn = false;");
599+
ok &= expect(fgdn_resolve.find("graph_reserve(1, n_seqs, n_outputs, mctx.get(), true)") != std::string::npos &&
600+
fgdn_resolve.find("device_gdn != device_kv") != std::string::npos,
601+
"fused GDN auto mode must rely on scheduler capability/device-placement probing");
602+
ok &= expect(context_cpp.find("fused Gated Delta Net disabled (non-CUDA backend)") == std::string::npos &&
603+
context_cpp.find("have_cuda_gpu") == std::string::npos,
604+
"fused GDN must not be disabled before probing just because the backend is ROCm");
605+
ok &= expect(cuda_cpp.find("case GGML_OP_GATED_DELTA_NET:") != std::string::npos &&
606+
cuda_cpp.find("#ifdef GGML_USE_MUSA\n return false;\n#else\n return true;\n#endif // GGML_USE_MUSA") != std::string::npos,
607+
"CUDA/HIP backend support must keep GATED_DELTA_NET enabled for ROCm while excluding MUSA");
608+
}
594609
ok &= expect(qwen35.find("const bool tree_mode = (tree_parent_ids != nullptr && n_seq_tokens > 1 && n_seqs == 1") != std::string::npos &&
595610
qwen35.find("ggml_ssm_conv_tree(ctx0, conv_input, conv_kernel, tree_parent_ids)") != std::string::npos &&
596611
qwen35.find("conv_output_silu = conv_output_proper;") != std::string::npos,

0 commit comments

Comments
 (0)