[PR #4902] [Engine] build the Q5_0 parity checks on HIP as well as CUDA #5241

Open
opened 2026-11-07 16:33:43 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4902
Author: @sdroege
Created: 11/1/2026
Status: 🔄 Open

Base: main ← Head: hip-q5-parity-tests


📝 Commits (1)

  • e553344 hip: build the Q5_0 parity checks on HIP as well as CUDA

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 CMakeLists.txt (+1 -1)

📄 Description

Problem and result

ple_q5_parity and q5_projection_parity are #296's real-weight checks for the OrcaRouter Q4_K_S files (docs/ORCA_Q4_K_S.md). Both programs are written against the portable kernel layer and link ${_strata_gpu_runtime_target}, so they build and run unchanged on HIP, but the CMake condition kept them to CUDA:

if(STRATA_ENABLE_CUDA AND STRATA_BUILD_TESTS)

On an AMD box they could not be built at all, so the Q5_0 PLE reader and the Q5_1 projection had no way to be checked against real weights there.

After the change the condition is (STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP) AND STRATA_BUILD_TESTS, the same form the other GPU test targets in this file already use.

none

Approach

One line in CMakeLists.txt. The OR adds a backend; the CUDA path is unchanged. Nothing outside the test targets is affected: they are only built with STRATA_BUILD_TESTS=ON and are not part of a release.

Validation

Passed:

  • HIP build (gfx1201, ROCm 10.1, HIP 7.16.26385, -DSTRATA_ENABLE_HIP=ON -DSTRATA_BUILD_TESTS=ON): both targets compile and link. The tree I built in has the same CMakeLists.txt as this branch and the same test sources; git diff origin/main -- CMakeLists.txt src/kernels/ple_q5_parity.cpp src/kernels/q5_projection_parity.cpp shows only this one line.
  • LD_LIBRARY_PATH=/opt/rocm/lib ./build-hip/ple_q5_parity Qwen3.8-Flash-Next-Uncensored-Q4_K_M-00001-of-00003.gguf ->
    Q5_0 PLE, mapped reader: 320001536 rows, max_abs 0.000e+00 PASS and Q5_0 PLE, direct reader: 320001536 rows, max_abs 0.000e+00 PASS.
  • LD_LIBRARY_PATH=/opt/rocm/lib ./build-hip/ple_q5_parity Qwen3.8-Flash-Next-Uncensored-Q4_K_S-00001-of-00003.gguf -> the same result, both readers PASS on the file #296 is about.
  • LD_LIBRARY_PATH=/opt/rocm/lib ./build-hip/q5_projection_parity Qwen3.8-Flash-Next-Uncensored-Q4_K_S-00001-of-00003.gguf ->
    Q5_1 projection: 2560 elements, max_abs 0.000e+00, bf16 differences 0 PASS.

Failed:

  • none observed

Not run:

  • CUDA, SYCL and Metal builds. The change only adds HIP to a condition that already included CUDA, so every other configuration evaluates exactly as before; this machine has no NVIDIA card, so the CUDA build was not compiled here.

Limits

Test targets only, no engine code. q5_projection_parity needs a file whose blk.0.ffn_down_shexp.weight is Q5_1, which the Q4_K_M file is not (its layer 0 shared down is Q8_0), so that check ran on the Q4_K_S file only. Both files carry the same Q5_0 PLE table, so ple_q5_parity ran on both. The checks still need a real OrcaRouter file, which is a large download (three shards).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4902 **Author:** [@sdroege](https://github.com/sdroege) **Created:** 11/1/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `hip-q5-parity-tests` --- ### 📝 Commits (1) - [`e553344`](https://github.com/Niko1221/Strata/commit/e5533448fb1dc701d1bbdcd442d6868bad9ab548) hip: build the Q5_0 parity checks on HIP as well as CUDA ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+1 -1) </details> ### 📄 Description ## Problem and result `ple_q5_parity` and `q5_projection_parity` are #296's real-weight checks for the OrcaRouter Q4_K_S files (docs/ORCA_Q4_K_S.md). Both programs are written against the portable kernel layer and link `${_strata_gpu_runtime_target}`, so they build and run unchanged on HIP, but the CMake condition kept them to CUDA: ```cmake if(STRATA_ENABLE_CUDA AND STRATA_BUILD_TESTS) ``` On an AMD box they could not be built at all, so the Q5_0 PLE reader and the Q5_1 projection had no way to be checked against real weights there. After the change the condition is `(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP) AND STRATA_BUILD_TESTS`, the same form the other GPU test targets in this file already use. ## Related discussion none ## Approach One line in `CMakeLists.txt`. The `OR` adds a backend; the CUDA path is unchanged. Nothing outside the test targets is affected: they are only built with `STRATA_BUILD_TESTS=ON` and are not part of a release. ## Validation **Passed:** - HIP build (gfx1201, ROCm 10.1, HIP 7.16.26385, `-DSTRATA_ENABLE_HIP=ON -DSTRATA_BUILD_TESTS=ON`): both targets compile and link. The tree I built in has the same `CMakeLists.txt` as this branch and the same test sources; `git diff origin/main -- CMakeLists.txt src/kernels/ple_q5_parity.cpp src/kernels/q5_projection_parity.cpp` shows only this one line. - `LD_LIBRARY_PATH=/opt/rocm/lib ./build-hip/ple_q5_parity Qwen3.8-Flash-Next-Uncensored-Q4_K_M-00001-of-00003.gguf` -> `Q5_0 PLE, mapped reader: 320001536 rows, max_abs 0.000e+00 PASS` and `Q5_0 PLE, direct reader: 320001536 rows, max_abs 0.000e+00 PASS`. - `LD_LIBRARY_PATH=/opt/rocm/lib ./build-hip/ple_q5_parity Qwen3.8-Flash-Next-Uncensored-Q4_K_S-00001-of-00003.gguf` -> the same result, both readers PASS on the file #296 is about. - `LD_LIBRARY_PATH=/opt/rocm/lib ./build-hip/q5_projection_parity Qwen3.8-Flash-Next-Uncensored-Q4_K_S-00001-of-00003.gguf` -> `Q5_1 projection: 2560 elements, max_abs 0.000e+00, bf16 differences 0 PASS`. **Failed:** - none observed **Not run:** - CUDA, SYCL and Metal builds. The change only adds HIP to a condition that already included CUDA, so every other configuration evaluates exactly as before; this machine has no NVIDIA card, so the CUDA build was not compiled here. ## Limits Test targets only, no engine code. `q5_projection_parity` needs a file whose `blk.0.ffn_down_shexp.weight` is Q5_1, which the Q4_K_M file is not (its layer 0 shared down is Q8_0), so that check ran on the Q4_K_S file only. Both files carry the same Q5_0 PLE table, so `ple_q5_parity` ran on both. The checks still need a real OrcaRouter file, which is a large download (three shards). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#5241
No description provided.