[PR #4983] [Engine] gfx900: no v_fma_mixlo_f16 in gdn_out_norm_loop_kernel #5276

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4983
Author: @nerdoc
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: gfx900-fma-mix


📝 Commits (1)

  • 310dfd3 gfx900: no v_fma_mixlo_f16 in gdn_out_norm_loop_kernel

📊 Changes

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

View changed files

📝 src/prefill/kernels.cu (+5 -0)

📄 Description

Problem and result

gdn_out_norm_loop_kernel<false> (the STRATA_GDN_NOY=1 path in src/prefill/kernels.cu) uses inline
v_fma_mixlo_f16. The mix instructions exist from gfx906 on, so building the GFX906 compat backend for gfx900
(Vega 10, -DSTRATA_HIP_GFX906=ON -DCMAKE_HIP_ARCHITECTURES=gfx900) stops when the assembler hits that instruction.
With this change gfx900 compiles hf(bp * sg) there instead. Every other target keeps the asm unchanged.

none (focused build fix). Build notes and measurements for gfx900 are in #4982.

Approach

#if defined(__gfx900__) around the asm, nothing else. hf(bp * sg) rounds the FP32 product to FP16. The FP16
value can differ from the fused mix in the last bit, which the comment says. That is also what the WY branch
above already stores (v = bp * sg; y16 = hf(v)). __gfx900__ is only defined in the gfx900 device pass, so other
architectures, the host pass and CUDA preprocess to the same code as before.

Validation

Passed:

  • Build, gfx900, Debian 13 (HIP 5.7.1, clang 17, hipBLAS 0.54): cmake -S . -B build-gfx900 -DCMAKE_BUILD_TYPE=Release -DSTRATA_HIP_GFX906=ON -DCMAKE_HIP_ARCHITECTURES=gfx900 -DCMAKE_HIP_COMPILER=/usr/lib/llvm-17/bin/clang++ -DCMAKE_HIP_COMPILER_ROCM_ROOT=/usr ..., cmake --build build-gfx900 --target strata: links. Base c62d5e3a
    plus this change and three unrelated build fixes that this toolchain also needs (first with my own
    equivalents, now with #4600 and #4766 applied, plus a hipBLAS < 1.0 type mapping, see #4982).

  • Build, gfx900, ROCm 6.4 from Debian sid (HIP 6.4.3, clang 21, gcc 15 libstdc++): same, without the hipBLAS mapping.

  • Hardware, Radeon RX Vega 64 (gfx900, 8 GB), Qwen3.8-Flash-Next Coder IQ1_M, Debian 13 build above. The patched
    line only runs with STRATA_GDN_HEAD=1 STRATA_GDN_NOY=1, so I sent the same 5,378-token prompt (temperature 0,
    200 tokens) to a fresh engine twice per setting and compared the answer's md5:

    Environment md5 run 1 md5 run 2
    default b4d460c9… b4d460c9…
    STRATA_GDN_HEAD=1 (<true>, no asm) f7a3863c… f7a3863c…
    STRATA_GDN_HEAD=1 STRATA_GDN_NOY=1 (<false>, this change) f7a3863c… f7a3863c…

    The patched path gives the same answer as the WY path on this prompt. The default differs because it runs the
    older GDN kernels.

  • Default settings on the same build: a ~2 h load test (needle at 14k / 27k / 46k tokens, 3,000-token output, three
    concurrent requests, 45 min multi-turn soak) with 0 failed requests. That run does not use the patched line.

Failed:

none observed

Not run:

  • gfx906, gfx1151, gfx12 and CUDA builds: no hardware or toolchain here. The guard only touches the gfx900 device
    pass, but I have not compiled those targets with this change.
  • Bitwise comparison of the FP16 output itself. The md5 above is of one generated answer, not of the kernel output.

Limits

gfx900 is not an official target. This only removes the one instruction gfx900 lacks. It makes no claim about
STRATA_GDN_NOY being faster on gfx900.


🔄 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/4983 **Author:** [@nerdoc](https://github.com/nerdoc) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `gfx900-fma-mix` --- ### 📝 Commits (1) - [`310dfd3`](https://github.com/Niko1221/Strata/commit/310dfd3199b18668394798ecb77fb5b3a1adc3fa) gfx900: no v_fma_mixlo_f16 in gdn_out_norm_loop_kernel ### 📊 Changes **1 file changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/prefill/kernels.cu` (+5 -0) </details> ### 📄 Description ## Problem and result `gdn_out_norm_loop_kernel<false>` (the `STRATA_GDN_NOY=1` path in `src/prefill/kernels.cu`) uses inline `v_fma_mixlo_f16`. The mix instructions exist from gfx906 on, so building the GFX906 compat backend for gfx900 (Vega 10, `-DSTRATA_HIP_GFX906=ON -DCMAKE_HIP_ARCHITECTURES=gfx900`) stops when the assembler hits that instruction. With this change gfx900 compiles `hf(bp * sg)` there instead. Every other target keeps the asm unchanged. ## Related discussion none (focused build fix). Build notes and measurements for gfx900 are in #4982. ## Approach `#if defined(__gfx900__)` around the asm, nothing else. `hf(bp * sg)` rounds the FP32 product to FP16. The FP16 value can differ from the fused mix in the last bit, which the comment says. That is also what the `WY` branch above already stores (`v = bp * sg; y16 = hf(v)`). `__gfx900__` is only defined in the gfx900 device pass, so other architectures, the host pass and CUDA preprocess to the same code as before. ## Validation **Passed:** - Build, gfx900, Debian 13 (HIP 5.7.1, clang 17, hipBLAS 0.54): `cmake -S . -B build-gfx900 -DCMAKE_BUILD_TYPE=Release -DSTRATA_HIP_GFX906=ON -DCMAKE_HIP_ARCHITECTURES=gfx900 -DCMAKE_HIP_COMPILER=/usr/lib/llvm-17/bin/clang++ -DCMAKE_HIP_COMPILER_ROCM_ROOT=/usr ...`, `cmake --build build-gfx900 --target strata`: links. Base `c62d5e3a` plus this change **and** three unrelated build fixes that this toolchain also needs (first with my own equivalents, now with #4600 and #4766 applied, plus a hipBLAS < 1.0 type mapping, see #4982). - Build, gfx900, ROCm 6.4 from Debian sid (HIP 6.4.3, clang 21, gcc 15 libstdc++): same, without the hipBLAS mapping. - Hardware, Radeon RX Vega 64 (gfx900, 8 GB), Qwen3.8-Flash-Next Coder IQ1_M, Debian 13 build above. The patched line only runs with `STRATA_GDN_HEAD=1 STRATA_GDN_NOY=1`, so I sent the same 5,378-token prompt (temperature 0, 200 tokens) to a fresh engine twice per setting and compared the answer's md5: | Environment | md5 run 1 | md5 run 2 | |---|---|---| | default | `b4d460c9…` | `b4d460c9…` | | `STRATA_GDN_HEAD=1` (`<true>`, no asm) | `f7a3863c…` | `f7a3863c…` | | `STRATA_GDN_HEAD=1 STRATA_GDN_NOY=1` (`<false>`, this change) | `f7a3863c…` | `f7a3863c…` | The patched path gives the same answer as the `WY` path on this prompt. The default differs because it runs the older GDN kernels. - Default settings on the same build: a ~2 h load test (needle at 14k / 27k / 46k tokens, 3,000-token output, three concurrent requests, 45 min multi-turn soak) with 0 failed requests. That run does not use the patched line. **Failed:** none observed **Not run:** - gfx906, gfx1151, gfx12 and CUDA builds: no hardware or toolchain here. The guard only touches the gfx900 device pass, but I have not compiled those targets with this change. - Bitwise comparison of the FP16 output itself. The md5 above is of one generated answer, not of the kernel output. ## Limits gfx900 is not an official target. This only removes the one instruction gfx900 lacks. It makes no claim about `STRATA_GDN_NOY` being faster on gfx900. --- <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#5276
No description provided.