From 947532ad0dfe22161ffa887d7c9c51424af6f1bd Mon Sep 17 00:00:00 2001 From: agent Date: Fri, 13 Nov 2026 17:33:45 -0400 Subject: [PATCH] tests: the qwen partition reference packs row_count at bit 13, as the backend does The descriptor's fields tile with no gap: expert bits 0-8, partition bits 9-12, row_count-1 bits 13-18. The reference put row_count-1 at bit 15, so every descriptor it computed differed from the backend's by a constant 761856 and qwen_expert_table_partition_prefill_512_execution was the only failing device case (engine#2381). Device tier before: 12 passed, 1 failed. After: 13 passed, 0 failed. Host unchanged: 76 passed, 10 failed (the ten that fail on the base too). --- tests/hrx-backend-test.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/hrx-backend-test.cpp b/tests/hrx-backend-test.cpp index b37d0ac9e3ab..767f9c056aa8 100644 --- a/tests/hrx-backend-test.cpp +++ b/tests/hrx-backend-test.cpp @@ -341,6 +341,10 @@ static std::vector make_qwen_expert_table_reference(const std::vector make_qwen_partition_table_reference(const std::vector & expert_table, int64_t token_count, int64_t route_count, @@ -357,7 +361,12 @@ static std::vector make_qwen_partition_table_reference(const std::vecto if (row_count > 32) { row_count = 32; } - const int32_t descriptor = static_cast(expert) | (partition << 9) | ((row_count - 1) << 15); + // engine#2381: the descriptor packs expert in bits 0-8, partition in bits 9-12 and + // row_count-1 in bits 13-18. This reference used to put row_count-1 at bit 15, which + // disagreed with every descriptor the backend writes by a constant, and made this case the + // only failing device case. The bit layout is the backend's, so the reference follows it. + const int32_t descriptor = static_cast(expert) | (partition << kPartitionFieldShift) | + ((row_count - 1) << kRowCountFieldShift); partition_table[static_cast(1 + partition_count)] = descriptor; ++partition_count; }