Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
66 changes: 65 additions & 1 deletion tests/hrx-backend-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Case> & 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 {
Expand Down