From 5ed732e99867bf1a9b75456f31338e53216ed3f0 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Fri, 13 Nov 2026 22:30:07 -0400 Subject: [PATCH] tests: hrx-backend-test labels the 22 cases the HIP add-on's matchers take (engine#2392) With a HIP add-on built in and active, 22 host cases fail because an add-on matcher takes a node whose Loom-path plan the case asserts. The add-on's ids are hashed by design (a licensing property), so kernel-name checks cannot apply. Each case now carries a known-fail reason naming its mechanism (add-on plans the node, reads the weight stored, C1, Q8_1 gate/up plane), with the runner's rule kept: a labelled case must fail and a pass is an error. Nothing is labelled without the add-on or with GGML_HRX_DISABLE_DISPATCH=hip. (hrx-backend-test-loom). Co-Authored-By: Claude Opus 5.5 --- tests/CMakeLists.txt | 2 ++ tests/hrx-backend-test.cpp | 66 +++++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a635b8e7b1f5..df60cabaf5c0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -491,6 +491,8 @@ if (TARGET ggml-hrx) # our line's hrx-backend-test takes case names as its only arguments (no test_runner::Suite flags) add_test(NAME hrx-backend-test COMMAND hrx-backend-test) if (GGML_HRX_HIP_ADDON_DIR) + # engine#2392: hrx-backend-test labels the cases the add-on's own matchers take (hip_addon_known_fail) + target_compile_definitions(hrx-backend-test PRIVATE GGML_HRX_HIP_ADDON) # engine#2392: with a HIP add-on built in, its matchers claim nodes whose Loom-path plan many host cases # assert, so an add-on build otherwise never checks the Loom path at all. This runs the same suite with every # add-on registration (all named hip.*) switched off; measured 87/0 host, 14/14 device at 5006d9308. diff --git a/tests/hrx-backend-test.cpp b/tests/hrx-backend-test.cpp index 3a4f5289b943..d3ce69c5a244 100644 --- a/tests/hrx-backend-test.cpp +++ b/tests/hrx-backend-test.cpp @@ -15514,10 +15514,74 @@ struct Case { }; +// engine#2392: with a HIP add-on built in and active, its matchers take nodes whose Loom-path plan these cases assert. +// Each is labelled with the mechanism that makes it fail there, and keeps the runner's known-fail rule (it must fail, +// a pass is an error), so a label is retired on purpose. The Loom path stays asserted by hrx-backend-test-loom, the +// same binary with GGML_HRX_DISABLE_DISPATCH=hip.; nothing is labelled there or in a build without the add-on. +static bool hip_addon_dispatch_active() { +#ifdef GGML_HRX_HIP_ADDON + const char * disabled = std::getenv("GGML_HRX_DISABLE_DISPATCH"); + return disabled == nullptr || std::strstr(disabled, "hip.") == nullptr; +#else + return false; +#endif +} + +static const char * hip_addon_known_fail(const char * name) { + // the add-on's own kernels plan the node: its ids are hashed by design, and its plan shape is its own + static const char * kPlan = "#2392 add-on plans this node"; + // the add-on's dense kernels take no weight_format and read the weight stored; the trade is the owner's + static const char * kLayout = "#2392 add-on reads the weight stored"; + static const struct { + const char * name; + const char * reason; + } kLabels[] = { + { "qwen_flash_attention_dispatch", kPlan }, + { "qwen_attention_postprocess_dispatch", kPlan }, + { "qwen_matmul_dispatch", kPlan }, + { "gdn_native_projection_pair_dispatch", kPlan }, + { "common_mul_mat_id_swiglu_dispatch", kPlan }, + { "common_mul_mat_id_postops_dispatch", kPlan }, + { "qwen_routed_gate_up_dispatch", kPlan }, + // hip.dense_prefill.mm takes the producer, so no Loom publisher writes the alternate + { "tiled_matmul_alternate_publish", kPlan }, + // the add-on's few-token kernel takes the tied weight instead of the Loom kquant kernel + { "tied_weight_few_tokens_keeps_kquant.q4_k.tokens6", kPlan }, + { "tied_weight_few_tokens_keeps_kquant.q4_k.tokens8", kPlan }, + // C1: the norm publishes a q8 alternate no dispatch reads, and the add-on consumer takes no f16 one + { "rmsnorm_binary_f16_output", "#2392 C1 add-on consumer reads neither alternate" }, + // hip.moe_tokens.* publishes the routed gate/up plane as Q8_1, not as f16 at 2^-6 + { "qwen_weighted_reduce_next_rmsnorm_q8_publication", "#2392 add-on gate/up plane is Q8_1" }, + { "packed_layout_follows_weight.q4_k.file_mapped", kLayout }, + { "packed_layout_follows_weight.q4_k.uploaded", kLayout }, + { "packed_layout_follows_weight.q4_k.file_mapped.tokens6", kLayout }, + { "packed_layout_follows_weight.q4_k.file_mapped.stored_copy", kLayout }, + { "packed_layout_follows_weight.q6_k.file_mapped", kLayout }, + { "packed_layout_follows_weight.q6_k.uploaded", kLayout }, + { "packed_layout_follows_weight.q6_k.file_mapped.tokens8", kLayout }, + { "packed_layout_follows_weight.q6_k.file_mapped.tokens12", kLayout }, + { "packed_layout_follows_weight.q6_k.file_mapped.stored_copy", kLayout }, + { "packed_layout_follows_weight.q6_k.file_mapped.stored_copy.tokens12", kLayout }, + }; + if (!hip_addon_dispatch_active()) { + return nullptr; + } + for (const auto & label : kLabels) { + if (std::strcmp(label.name, name) == 0) { + return label.reason; + } + } + return nullptr; +} + static int run_cases(const char * label, const std::vector & cases) { std::printf("%s: %zu case(s)\n", label, cases.size()); size_t passed = 0, failed = 0, known = 0, unexpected = 0; - for (const Case & test : cases) { + for (const Case & listed : cases) { + Case test = listed; + if (test.known_fail == nullptr) { + test.known_fail = hip_addon_known_fail(test.name); + } bool ok = true; std::string where; try {