[PR #1149] [CLOSED] HIP gfx103x FP16 prompt (#835 follow-up): STRATA_F16_RANGE measures what reaches FP16's range, and hip_prefill_gemm covers the FP16-io route #3267

Closed
opened 2026-11-07 14:40:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1149
Author: @Vop3p
Created: 10/6/2026
Status: ❌ Closed

Base: main ← Head: v140/hip-fp16-prompt-followup


📝 Commits (2)

  • 1868375 tests: hip_prefill_gemm runs the FP16-io prompt GEMMs (set_f16_io) on any HIP card, and its BF16 inputs are no longer zero
  • f606dcf hip gfx103x FP16 prompt: STRATA_F16_RANGE counts what enters and leaves FP16; the range measured (outputs peak at 410 of 65504) and the FP32 route compared

📊 Changes

9 files changed (+204 additions, -18 deletions)

View changed files

📝 bench/results/2026-10-04-rdna2-fp16-prompt/README.md (+54 -5)
📝 docs/AMD_HIP.md (+4 -1)
📝 include/strata/hip_compat/cuda_runtime.h (+1 -0)
📝 include/strata/prefill/gemm.hpp (+7 -0)
📝 include/strata/prefill/kernels.hpp (+5 -0)
📝 src/prefill/gemm.cu (+45 -0)
📝 src/prefill/kernels.cu (+36 -2)
📝 src/prefill/prefill.cpp (+10 -0)
📝 tests/hip/prefill_gemm.cpp (+42 -10)

📄 Description

Two follow-ups to #835 that were on its branch when main was rewritten, re-filed on 0.1.40.1 with the review changes (opt-in STRATA_HIP_PROMPT_F16=1, the mode decided once per stage) kept.

  • STRATA_F16_RANGE=1 records, per device, the largest |value| and the count beyond 65504 (or not finite) at the three places a value enters or leaves FP16 - the activation images (hf_sat), the BF16 weights converted to FP16 (bf16_to_f16_rows) and the FP16 GEMM outputs as they are widened (widen_rows_f16) - and prints one line per prompt. It sits beside the review's STRATA_DBG_NAN count in widen_rows_f16. Off, the cost is one flag read per value; on, a 34.4K-token prompt read at 889.8 tok/s against 888.5 without it. Measured on one RX 6900 XT over 466K tokens in nine prompts (three corpus slices, two prompts built to push activations - delimiter floods, repeated tokens, base64, mixed scripts - and four batches of real API requests): FP16 GEMM outputs peak at 410 of 65504, nothing beyond the range or non-finite. The numbers are in bench/results/2026-10-04-rdna2-fp16-prompt/README.md, which also gains the same-card comparison against the FP32 SGEMM route of #1006.
  • hip_prefill_gemm runs its shapes a second time with set_f16_io(true) on any HIP card: X as the FP16 image for the BF16 products, a scratch of 64 rows so a 96-row weight converts in two slices, ldy > N, an odd N, T = 1 and a beta = 1 f16() call (which keeps the FP32-out GEMM); the FP16-out results are checked at FP16's rounding, the row padding and the guards around Y must be untouched. Its BF16 inputs are no longer all zero.

HIP ctest on the RX 6900 XT at 0.1.40.1 (82f46a8), with this change and #1148 (the hip_prefill_wmma_gemm_parity skip) applied: 19 tests, 13 pass, 6 skip (the WMMA / hipBLASLt / fused-kernel tests that do not apply to gfx1030), 0 fail.

Original branch: #835's hip-gfx103x-fp16-prompt after the merge.

Developed with an AI coding assistant; every number above was measured on 2x RX 6900 XT (gfx1030, PCIe 4.0 x8 each) / Ryzen 5 5600X, ROCm 10.0.


🔄 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/1149 **Author:** [@Vop3p](https://github.com/Vop3p) **Created:** 10/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `v140/hip-fp16-prompt-followup` --- ### 📝 Commits (2) - [`1868375`](https://github.com/Niko1221/Strata/commit/1868375290899c7f52abe27dc3ab33f6601adb59) tests: hip_prefill_gemm runs the FP16-io prompt GEMMs (set_f16_io) on any HIP card, and its BF16 inputs are no longer zero - [`f606dcf`](https://github.com/Niko1221/Strata/commit/f606dcfd6a6f6588404fe4fdf05ee5e0f05c5ccc) hip gfx103x FP16 prompt: STRATA_F16_RANGE counts what enters and leaves FP16; the range measured (outputs peak at 410 of 65504) and the FP32 route compared ### 📊 Changes **9 files changed** (+204 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `bench/results/2026-10-04-rdna2-fp16-prompt/README.md` (+54 -5) 📝 `docs/AMD_HIP.md` (+4 -1) 📝 `include/strata/hip_compat/cuda_runtime.h` (+1 -0) 📝 `include/strata/prefill/gemm.hpp` (+7 -0) 📝 `include/strata/prefill/kernels.hpp` (+5 -0) 📝 `src/prefill/gemm.cu` (+45 -0) 📝 `src/prefill/kernels.cu` (+36 -2) 📝 `src/prefill/prefill.cpp` (+10 -0) 📝 `tests/hip/prefill_gemm.cpp` (+42 -10) </details> ### 📄 Description Two follow-ups to #835 that were on its branch when `main` was rewritten, re-filed on 0.1.40.1 with the review changes (opt-in `STRATA_HIP_PROMPT_F16=1`, the mode decided once per stage) kept. - `STRATA_F16_RANGE=1` records, per device, the largest |value| and the count beyond 65504 (or not finite) at the three places a value enters or leaves FP16 - the activation images (`hf_sat`), the BF16 weights converted to FP16 (`bf16_to_f16_rows`) and the FP16 GEMM outputs as they are widened (`widen_rows_f16`) - and prints one line per prompt. It sits beside the review's `STRATA_DBG_NAN` count in `widen_rows_f16`. Off, the cost is one flag read per value; on, a 34.4K-token prompt read at 889.8 tok/s against 888.5 without it. Measured on one RX 6900 XT over 466K tokens in nine prompts (three corpus slices, two prompts built to push activations - delimiter floods, repeated tokens, base64, mixed scripts - and four batches of real API requests): FP16 GEMM outputs peak at 410 of 65504, nothing beyond the range or non-finite. The numbers are in `bench/results/2026-10-04-rdna2-fp16-prompt/README.md`, which also gains the same-card comparison against the FP32 SGEMM route of #1006. - `hip_prefill_gemm` runs its shapes a second time with `set_f16_io(true)` on any HIP card: X as the FP16 image for the BF16 products, a scratch of 64 rows so a 96-row weight converts in two slices, `ldy > N`, an odd N, T = 1 and a `beta = 1` f16() call (which keeps the FP32-out GEMM); the FP16-out results are checked at FP16's rounding, the row padding and the guards around Y must be untouched. Its BF16 inputs are no longer all zero. HIP ctest on the RX 6900 XT at 0.1.40.1 (`82f46a8`), with this change and #1148 (the `hip_prefill_wmma_gemm_parity` skip) applied: 19 tests, 13 pass, 6 skip (the WMMA / hipBLASLt / fused-kernel tests that do not apply to gfx1030), 0 fail. Original branch: #835's `hip-gfx103x-fp16-prompt` after the merge. Developed with an AI coding assistant; every number above was measured on 2x RX 6900 XT (gfx1030, PCIe 4.0 x8 each) / Ryzen 5 5600X, ROCm 10.0. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:40:14 +07:00
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#3267
No description provided.