[GH-ISSUE #1474] hip_q2_zero fails on gfx1201 (R9700) with ROCm 7.10: Q2_0 signed-zero fix e9a5f8d is gated to gfx1012 / HIP < 7 #594

Closed
opened 2026-11-04 01:44:19 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @jkuepker on GitHub (Oct 8, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1474

hip_q2_zero fails on an R9700 (gfx1201) with setup's default ROCm:

index=65 got=0x0000 expected=0x8000
index=69 got=0x0000 expected=0x8000
index=73 got=0x0000 expected=0x8000
index=77 got=0x0000 expected=0x8000
hip_q2_zero: 1024 values, 128 failures

It's the symptom e9a5f8d fixed for gfx1012: Q2_0 dequant to half, with a negative scale and code 1, gives +0 instead of −0. The workaround in dq_q2_0 (src/kernels/cuda/iq_kernels.cu) only applies when this holds:

#if defined(__HIPCC__) && defined(__gfx1012__) && HIP_VERSION_MAJOR < 7

gfx1201 on HIP 7 never takes it, so the compiler still folds d * 0.0f to +0 there.

Proposed fix: drop the arch and version conditions and keep only __HIPCC__, so every HIP build keeps the scale's sign for code 1. The branch is one compare on a path that already does per-element work, and it matches the FP32/CPU paths.

Impact: probably small. Only the sign of zero changes in Q2_0 half dequant (I measured Coder IQ1_M, which doesn't use Q2_0, and its answers are unaffected). But the test fails on a supported card with the default toolchain.

Not checked: I only ran ctest on the 7.10 build. A 7.14.0a20260612 build of the same tag had no tests built, so I don't know whether the newer compiler does the same. #918 lists ctest results on gfx1151/Windows without hip_q2_zero among the failures, so this may depend on the arch or compiler.

Environment: Strata v0.1.40.3 (d5ea713), Linux (Ubuntu 24.04), AMD Radeon AI PRO R9700 (gfx1201, 32 GB), Ryzen 9 9900X, TheRock ROCm 7.10.0a20251120 (gfx120X-all wheels, setup's default), built by ./setup.sh --backend hip, then cmake -DSTRATA_BUILD_TESTS=ON + ctest --test-dir build-hip.

Originally created by @jkuepker on GitHub (Oct 8, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1474 `hip_q2_zero` fails on an R9700 (gfx1201) with setup's default ROCm: ``` index=65 got=0x0000 expected=0x8000 index=69 got=0x0000 expected=0x8000 index=73 got=0x0000 expected=0x8000 index=77 got=0x0000 expected=0x8000 hip_q2_zero: 1024 values, 128 failures ``` It's the symptom e9a5f8d fixed for gfx1012: Q2_0 dequant to half, with a negative scale and code 1, gives +0 instead of −0. The workaround in `dq_q2_0` (`src/kernels/cuda/iq_kernels.cu`) only applies when this holds: ```cpp #if defined(__HIPCC__) && defined(__gfx1012__) && HIP_VERSION_MAJOR < 7 ``` gfx1201 on HIP 7 never takes it, so the compiler still folds `d * 0.0f` to +0 there. **Proposed fix:** drop the arch and version conditions and keep only `__HIPCC__`, so every HIP build keeps the scale's sign for code 1. The branch is one compare on a path that already does per-element work, and it matches the FP32/CPU paths. **Impact:** probably small. Only the sign of zero changes in Q2_0 half dequant (I measured Coder IQ1_M, which doesn't use Q2_0, and its answers are unaffected). But the test fails on a supported card with the default toolchain. **Not checked:** I only ran ctest on the 7.10 build. A 7.14.0a20260612 build of the same tag had no tests built, so I don't know whether the newer compiler does the same. #918 lists ctest results on gfx1151/Windows without `hip_q2_zero` among the failures, so this may depend on the arch or compiler. **Environment:** Strata v0.1.40.3 (d5ea713), Linux (Ubuntu 24.04), AMD Radeon AI PRO R9700 (gfx1201, 32 GB), Ryzen 9 9900X, TheRock ROCm 7.10.0a20251120 (`gfx120X-all` wheels, setup's default), built by `./setup.sh --backend hip`, then `cmake -DSTRATA_BUILD_TESTS=ON` + `ctest --test-dir build-hip`.
Author
Owner

@Niko1221 commented on GitHub (Oct 10, 2026):

Thank you. The signed-zero fix for Q2_0 half dequant now also applies on gfx1200 and gfx1201, next to gfx1012 and gfx1151, rather than for every HIP build; the other targets keep their code. Not run on an R9700 from this change: could you rerun hip_q2_zero on v0.1.42 and tell us whether it passes?

<!-- gh-comment-id:6099595351 --> @Niko1221 commented on GitHub (Oct 10, 2026): Thank you. The signed-zero fix for Q2_0 half dequant now also applies on gfx1200 and gfx1201, next to gfx1012 and gfx1151, rather than for every HIP build; the other targets keep their code. Not run on an R9700 from this change: could you rerun hip_q2_zero on v0.1.42 and tell us whether it passes?
Author
Owner

@Niko1221 commented on GitHub (Oct 13, 2026):

Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.

If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.

<!-- gh-comment-id:6156103640 --> @Niko1221 commented on GitHub (Oct 13, 2026): Thanks for the report. To keep the tracker current we are closing issues older than three days: [0.1.44](https://github.com/Niko1221/Strata/releases/tag/v0.1.44) is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1. If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#594
No description provided.