[GH-ISSUE #1258] gfx1151 (Strix Halo) prompt: per-kernel profile of a 16K prompt (rocprofv3) - where would outside help be useful? #517

Closed
opened 2026-11-04 01:43:42 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @huppiflupp on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1258

Box. Ryzen AI Max+ 395, 128 GB (gfx1151, Radeon 8060S, 40 CUs, 2.9 GHz), Linux 7.2, ROCm 7.14.1 (TheRock, hipBLASLt 100401), Strata 82f46a8 built per docs/STRIX_HALO.md.
Run. UD-IQ4_XS with a Q6_K dense trunk, one 16,058-token prompt, --prefill 16384 --kv int8 --mmap-experts --expert-cache 24576 --no-prefill-borrow --spec 4 --mtp mtp/rt --mtp-q4 all, the section-5 switches of STRIX_HALO.md. rocprofv3 --kernel-trace --stats (1,193 tok/s under the profiler, 1,230 without).

GPU time by kernel (12.8 s total, top entries):

kernel calls ms share registers / LDS / scratch
pfg::kernel_bk64 (FP16 prompt projections) 181 2,249 17.6 % 248 VGPR, 54 KB
native_w11_kernel<IQ3_S, gate/up> 172 1,983 15.5 % 192 VGPR, 31 KB, scratch 12
prompt_attn_wmma_kernel 12 1,243 9.7 % 224 VGPR, 22 KB
native_w11_kernel<IQ4_NL, down> 172 1,023 8.0 % 192 VGPR, 25 KB, scratch 48
gr_write_norm_rs_kernel 94 938 7.3 % 32 VGPR
gr_upmix_kernel 96 866 6.8 % 248 VGPR, 41 KB
gdn_rec_quad2c_kernel 36 584 4.6 %
moe_combine4_kernel 48 455 3.6 %
pfg::kernel_hcd_exact 96 454 3.5 % 248 VGPR, 36 KB
__amd_rocclr_fillBufferAligned 477 301 2.3 % one call is 297 ms
dequant_kernel<Q6_K> 252 258 2.0 %

Rough efficiency (my arithmetic, please correct):

  • Routed experts: gate/up ~50 TFLOP (16,058 x 10 x 48 x 2 x 2560 x 640 x 2) in 1.98 s = ~25 TFLOP/s; down ~25 TFLOP in 1.02 s = ~25 TFLOP/s, against a WMMA peak of roughly 59 on this part.
  • Hyper-connection read/write: gr_write_norm_rs moves >= ~1 GB per call (R fp32 in, xn16 out) in 10.0 ms = ~100 GB/s; gr_upmix >= ~1 GB per call in 9.0 ms = ~110 GB/s, against ~256 GB/s theoretical. Together with kernel_hcd_exact that is 2.26 s (17.6 %), the largest share after the expert kernels.
  • The phase timer (STRATA_PREFILL_TIMING) put "gemm down" at 197 ms on the same run type; the trace shows the down kernel at 1,023 ms, so the phase split mixes the expert kernels.

Question for the maintainers: you are actively working on gfx1151 (the Aurora port, the W bundle 528c1fb fused-expert exact wins). Where would outside help be useful and not get in your way? Candidates I can see from this profile: (a) the memory-bound hyper-connection kernels (norm_rs / upmix at ~40 % of bandwidth), (b) the routed-expert kernels, (c) a unified-memory default that skips the prompt-path loan (see #1236: +5.2 % prompt in the server here). I can run interleaved A/B measurements and bitwise checks on this box for any branch you point me at, and I can test the #1139 fix on gfx1151 with --parallel.

The trace CSVs are available if useful.

Measured and written with an AI assistant (Claude Code).

Originally created by @huppiflupp on GitHub (Oct 6, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1258 **Box.** Ryzen AI Max+ 395, 128 GB (gfx1151, Radeon 8060S, 40 CUs, 2.9 GHz), Linux 7.2, ROCm 7.14.1 (TheRock, hipBLASLt 100401), Strata 82f46a8 built per docs/STRIX_HALO.md. **Run.** UD-IQ4_XS with a Q6_K dense trunk, one 16,058-token prompt, `--prefill 16384 --kv int8 --mmap-experts --expert-cache 24576 --no-prefill-borrow --spec 4 --mtp mtp/rt --mtp-q4 all`, the section-5 switches of STRIX_HALO.md. `rocprofv3 --kernel-trace --stats` (1,193 tok/s under the profiler, 1,230 without). **GPU time by kernel (12.8 s total, top entries):** | kernel | calls | ms | share | registers / LDS / scratch | |---|---:|---:|---:|---| | `pfg::kernel_bk64` (FP16 prompt projections) | 181 | 2,249 | 17.6 % | 248 VGPR, 54 KB | | `native_w11_kernel<IQ3_S, gate/up>` | 172 | 1,983 | 15.5 % | 192 VGPR, 31 KB, scratch 12 | | `prompt_attn_wmma_kernel` | 12 | 1,243 | 9.7 % | 224 VGPR, 22 KB | | `native_w11_kernel<IQ4_NL, down>` | 172 | 1,023 | 8.0 % | 192 VGPR, 25 KB, scratch 48 | | `gr_write_norm_rs_kernel` | 94 | 938 | 7.3 % | 32 VGPR | | `gr_upmix_kernel` | 96 | 866 | 6.8 % | 248 VGPR, 41 KB | | `gdn_rec_quad2c_kernel` | 36 | 584 | 4.6 % | | | `moe_combine4_kernel` | 48 | 455 | 3.6 % | | | `pfg::kernel_hcd_exact` | 96 | 454 | 3.5 % | 248 VGPR, 36 KB | | `__amd_rocclr_fillBufferAligned` | 477 | 301 | 2.3 % | one call is 297 ms | | `dequant_kernel<Q6_K>` | 252 | 258 | 2.0 % | | **Rough efficiency (my arithmetic, please correct):** - Routed experts: gate/up ~50 TFLOP (16,058 x 10 x 48 x 2 x 2560 x 640 x 2) in 1.98 s = ~25 TFLOP/s; down ~25 TFLOP in 1.02 s = ~25 TFLOP/s, against a WMMA peak of roughly 59 on this part. - Hyper-connection read/write: `gr_write_norm_rs` moves >= ~1 GB per call (R fp32 in, xn16 out) in 10.0 ms = ~100 GB/s; `gr_upmix` >= ~1 GB per call in 9.0 ms = ~110 GB/s, against ~256 GB/s theoretical. Together with `kernel_hcd_exact` that is 2.26 s (17.6 %), the largest share after the expert kernels. - The phase timer (STRATA_PREFILL_TIMING) put "gemm down" at 197 ms on the same run type; the trace shows the down kernel at 1,023 ms, so the phase split mixes the expert kernels. **Question for the maintainers:** you are actively working on gfx1151 (the Aurora port, the W bundle 528c1fb `fused-expert exact wins`). Where would outside help be useful and not get in your way? Candidates I can see from this profile: (a) the memory-bound hyper-connection kernels (norm_rs / upmix at ~40 % of bandwidth), (b) the routed-expert kernels, (c) a unified-memory default that skips the prompt-path loan (see #1236: +5.2 % prompt in the server here). I can run interleaved A/B measurements and bitwise checks on this box for any branch you point me at, and I can test the #1139 fix on gfx1151 with `--parallel`. The trace CSVs are available if useful. _Measured and written with an AI assistant (Claude Code)._
Author
Owner

@huppiflupp commented on GitHub (Oct 6, 2026):

Correction to the efficiency estimate above: gr_write_norm_rs_kernel also writes R back, so a call moves >= ~1.8 GB (R fp32 read and write plus xn16, 10 bytes per element at T = 16,058), not ~1 GB. At 10.0 ms per call that is >= ~180 GB/s, i.e. already close to what this memory delivers, not ~100 GB/s. The upmix figure needs the same recount before anyone acts on it. The expert-kernel and per-kernel timing numbers stand.

Written with an AI assistant (Claude Code).

<!-- gh-comment-id:6025547502 --> @huppiflupp commented on GitHub (Oct 6, 2026): Correction to the efficiency estimate above: `gr_write_norm_rs_kernel` also writes R back, so a call moves >= ~1.8 GB (R fp32 read and write plus xn16, 10 bytes per element at T = 16,058), not ~1 GB. At 10.0 ms per call that is >= ~180 GB/s, i.e. already close to what this memory delivers, not ~100 GB/s. The upmix figure needs the same recount before anyone acts on it. The expert-kernel and per-kernel timing numbers stand. _Written with an AI assistant (Claude Code)._
Author
Owner

@Masterihawk commented on GitHub (Oct 7, 2026):

Thanks very much to Niko1221, My gfx1151 runs IQ3_S at decode speed 44~55 tok/s , very nice, I'm so glad !

<!-- gh-comment-id:6034259664 --> @Masterihawk commented on GitHub (Oct 7, 2026): Thanks very much to Niko1221, My gfx1151 runs IQ3_S at decode speed 44~55 tok/s , very nice, I'm so glad !
Author
Owner

@libratechw commented on GitHub (Oct 12, 2026):

This is a partial answer to the question here, from a Ryzen AI Max+ 395 (128 GB, gfx1151, ROCm 7.14.1, clang 23, Linux) on v0.1.43. I profiled UD-Q4_K_XL and UD-IQ4_XS prompts next to gufo's engine (same prompts, rocprofv3 on both), took the kernels that stood out, and opened five PRs, one change each:

PR change output
#2016 QSA top-k radix digit by a cooperative scan (block_topk_reg_kernel) same ids
#2017 prompt attention: a chunk's reads issued before its compute (WMMA kernel) same bits
#2018 VGPR cap back on for gfx1151 on clang 23, per format (#1180) same bits
#2019 STRATA_QPREP=1 (q split + norm + rope in one kernel), STRATA_ATTN_GATE=1 (gate_attn in the attention epilogue), opt-in same bits
#2020 STRATA_PF_F16=1: routed experts on the F16 matrix cores (gufo's RoutedF16GEMMKernel, MIT, attribution in the file), opt-in differs (first-token KL below)

All five together against v0.1.43 (prompt tok/s, medians of 3 interleaved rounds of fresh servers, 1 discarded, --prefill 16384, the section-5 switches with STRATA_PF_SWITCH_MIN_T=2048; decode is not part of the claim):

model prompt v0.1.43 #2016-2018 only (always on) all five (STRATA_PF_F16=1 STRATA_QPREP=1 STRATA_ATTN_GATE=1)
UD-Q4_K_XL (STRATA_PF_FUSED_KQ=1) 4K 1,093.3 1,093.8 (+0.5%) 1,266.6 (+15.8%)
32K 1,228.4 1,246.2 (+1.2%) 1,437.1 (+16.9%)
128K 1,164.9 1,187.7 (+1.9%) 1,368.3 (+17.4%)
UD-IQ4_XS 4K 1,074.2 1,123.3 (+4.7%) 1,244.0 (+15.7%)
32K 1,255.0 1,319.0 (+5.1%) 1,410.3 (+12.4%)
128K 1,191.9 1,260.0 (+5.8%) 1,340.3 (+12.4%)

The generated text is identical to v0.1.43 in all 18 runs of the "always on" column; it differs with F16, as expected (it rounds differently). One round of UD-IQ4_XS 4K in that column started slowly (725.7 tok/s), so I used the median.

Where the time goes now (kernel-trace of one 128K UD-Q4_K_XL prompt, gufo's trace next to it): dense GEMM and the hyper-connection kernels are equal to gufo's, the routed experts are faster than gufo's after #2020 (UD-Q4_K_XL 32K / 128K: 1,437 / 1,368 tok/s here against gufo's 1,512 / 1,410 measured earlier on the same box). What is still behind gufo, at 128K, is attention about 1.0 s, the indexer about 1.5 s (#2016 takes part of it), the GDN conv + L2 about 1.3 s, small kernels about 2.1 s, and a 0.2-0.6 s re-fill of the borrowed expert-cache slots after the prompt (--no-prefill-borrow avoids it; UD-Q4_K_XL 4K +13%, 32K +4%, 128K +2% with it, mixed on UD-IQ4_XS). #1896 looks like the right place for the re-fill.

Where I would look next if useful: attention, and the GDN conv fused into the recurrence (a register version of the recurrence was bit-exact but only 2% faster, so I dropped it).

One more thing I found while measuring, unrelated to the PRs: with STRATA_PF_SWITCH_MIN_T=4096 (section 5), a "4K" prompt is cut into 4,095-token chunks and stays under the threshold, so its dense GEMM runs hipBLASLt solutions that are not in the tuning table (26% of the GPU time at 4K). On the same server, 4 runs of a 4K prompt: 1,052-1,106 tok/s at 4096 against 1,262-1,298 at 2048 (UD-Q4_K_XL). I'll open a separate issue for that.

🤖 Generated with Claude Code

<!-- gh-comment-id:6115837125 --> @libratechw commented on GitHub (Oct 12, 2026): This is a partial answer to the question here, from a Ryzen AI Max+ 395 (128 GB, gfx1151, ROCm 7.14.1, clang 23, Linux) on v0.1.43. I profiled UD-Q4_K_XL and UD-IQ4_XS prompts next to gufo's engine (same prompts, rocprofv3 on both), took the kernels that stood out, and opened five PRs, one change each: | PR | change | output | |---|---|---| | #2016 | QSA top-k radix digit by a cooperative scan (`block_topk_reg_kernel`) | same ids | | #2017 | prompt attention: a chunk's reads issued before its compute (WMMA kernel) | same bits | | #2018 | VGPR cap back on for gfx1151 on clang 23, per format (#1180) | same bits | | #2019 | `STRATA_QPREP=1` (q split + norm + rope in one kernel), `STRATA_ATTN_GATE=1` (gate_attn in the attention epilogue), opt-in | same bits | | #2020 | `STRATA_PF_F16=1`: routed experts on the F16 matrix cores (gufo's `RoutedF16GEMMKernel`, MIT, attribution in the file), opt-in | differs (first-token KL below) | **All five together against v0.1.43** (prompt tok/s, medians of 3 interleaved rounds of fresh servers, 1 discarded, `--prefill 16384`, the section-5 switches with `STRATA_PF_SWITCH_MIN_T=2048`; decode is not part of the claim): | model | prompt | v0.1.43 | #2016-2018 only (always on) | all five (`STRATA_PF_F16=1 STRATA_QPREP=1 STRATA_ATTN_GATE=1`) | |---|---|---:|---:|---:| | UD-Q4_K_XL (`STRATA_PF_FUSED_KQ=1`) | 4K | 1,093.3 | 1,093.8 (+0.5%) | 1,266.6 (+15.8%) | | | 32K | 1,228.4 | 1,246.2 (+1.2%) | 1,437.1 (+16.9%) | | | 128K | 1,164.9 | 1,187.7 (+1.9%) | 1,368.3 (+17.4%) | | UD-IQ4_XS | 4K | 1,074.2 | 1,123.3 (+4.7%) | 1,244.0 (+15.7%) | | | 32K | 1,255.0 | 1,319.0 (+5.1%) | 1,410.3 (+12.4%) | | | 128K | 1,191.9 | 1,260.0 (+5.8%) | 1,340.3 (+12.4%) | The generated text is identical to v0.1.43 in all 18 runs of the "always on" column; it differs with F16, as expected (it rounds differently). One round of UD-IQ4_XS 4K in that column started slowly (725.7 tok/s), so I used the median. **Where the time goes now** (kernel-trace of one 128K UD-Q4_K_XL prompt, gufo's trace next to it): dense GEMM and the hyper-connection kernels are equal to gufo's, the routed experts are faster than gufo's after #2020 (UD-Q4_K_XL 32K / 128K: 1,437 / 1,368 tok/s here against gufo's 1,512 / 1,410 measured earlier on the same box). What is still behind gufo, at 128K, is attention about 1.0 s, the indexer about 1.5 s (#2016 takes part of it), the GDN conv + L2 about 1.3 s, small kernels about 2.1 s, and a 0.2-0.6 s re-fill of the borrowed expert-cache slots after the prompt (`--no-prefill-borrow` avoids it; UD-Q4_K_XL 4K +13%, 32K +4%, 128K +2% with it, mixed on UD-IQ4_XS). #1896 looks like the right place for the re-fill. Where I would look next if useful: attention, and the GDN conv fused into the recurrence (a register version of the recurrence was bit-exact but only 2% faster, so I dropped it). One more thing I found while measuring, unrelated to the PRs: with `STRATA_PF_SWITCH_MIN_T=4096` (section 5), a "4K" prompt is cut into 4,095-token chunks and stays under the threshold, so its dense GEMM runs hipBLASLt solutions that are not in the tuning table (26% of the GPU time at 4K). On the same server, 4 runs of a 4K prompt: 1,052-1,106 tok/s at 4096 against 1,262-1,298 at 2048 (UD-Q4_K_XL). I'll open a separate issue for that. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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:6156047141 --> @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#517
No description provided.