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
9 changes: 8 additions & 1 deletion tests/hrx-backend-test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "dispatch_registration/common/dispatch-moe-routing-layout.h" // engine#2381: one layout, not two
#include "testing_suite.h"
#include "ggml-cpu.h"
#include "backend-buffer-binding.h"
Expand Down Expand Up @@ -357,7 +358,13 @@ static std::vector<int32_t> make_qwen_partition_table_reference(const std::vecto
if (row_count > 32) {
row_count = 32;
}
const int32_t descriptor = static_cast<int32_t>(expert) | (partition << 9) | ((row_count - 1) << 15);
// engine#2381: share the router's own layout instead of re-deriving it. The router emits the Qwen layout
// (shift 7/13) at <= 128 experts because that is what the qwen3_moe routed kernels decode; hard-coding the
// common layout (9/15) here made every entry of a 128-expert table disagree with a correct device result.
const ggml::hrx::MoeRoutingDescriptorLayout layout = ggml::hrx::moe_router_descriptor_layout(expert_count);
const int32_t descriptor = static_cast<int32_t>(expert) |
(partition << std::atoi(layout.partition_shift)) |
((row_count - 1) << std::atoi(layout.row_count_shift));
partition_table[static_cast<size_t>(1 + partition_count)] = descriptor;
++partition_count;
}
Expand Down
9 changes: 8 additions & 1 deletion tests/test-hrx-ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5201,7 +5201,14 @@ static void run_decode_routed_moe_scheduling_case(ggml_type down_weight_type, bo
const bool gate_up_routed =
test_sequence_has(sequence, "qwen3_moe:qwen3_moe_routed_gate_up_swiglu_q4k_q8_1_x4_next_q8") ||
test_sequence_has(sequence, "qwen3_moe:qwen3_moe_routed_gate_up_swiglu_q4k_q8") ||
test_sequence_has(sequence, "loom_libs:ggml_mul_mat_id_swiglu_f32_f32_wmma");
test_sequence_has(sequence, "loom_libs:ggml_mul_mat_id_swiglu_f32_f32_wmma") ||
// engine#2374: after #118 factored the monolith into composable kernels, the registration
// "common.mul_mat_id_swiglu.f32_f32_wmma" selects the tiled/skinny *pair-input publish* kernels
// (see mul_mat_id_swiglu_f32_kernel(): skinny at token_count <= 5, tiled above). Those are the same
// routed gate/up SwiGLU computation under the composable names, so the intent of this check --
// "a routed mul_mat_id SwiGLU kernel is in the plan" -- is satisfied by either naming.
test_sequence_has(sequence, "loom_libs:ggml_mul_mat_id_skinny_pair_input_f32_swiglu_publish_f32") ||
test_sequence_has(sequence, "loom_libs:ggml_mul_mat_id_tiled_pair_input_f32_swiglu_publish_f32");
REQUIRE(gate_up_routed);
require_kernel_subsequence(sequence,
{ "qwen3_moe:qwen3_moe_router_projection_top8_fused_decode_f32",
Expand Down