[PR #4855] [Engine] gfx1010 (RX 5700 / 5700 XT): the SDWA dp4a that gfx1012 already uses #5215

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4855
Author: @Keoian
Created: 10/31/2026
Status: 🔄 Open

Base: main ← Head: gfx1010-sdwa-dot


📝 Commits (1)

  • 95527d6 [Engine] gfx1010 (RX 5700 / 5700 XT): the SDWA dp4a that gfx1012 already uses

📊 Changes

2 files changed (+3 additions, -2 deletions)

View changed files

📝 docs/OLDER_GPUS.md (+1 -0)
📝 include/strata/hip_compat/intrinsics.hpp (+2 -2)

📄 Description

Problem and result

RDNA1 has no signed dot4 instruction. hip_compat/intrinsics.hpp gives gfx1012 (RX 5500 XT) llama.cpp's SDWA byte-select sequence for __dp4a. gfx1010 (RX 5700 / 5700 XT), which has no dot instructions at all, fell through to the portable shift-and-mask loop. Strata's own kernels call it through STRATA_DP4A (45 call sites in native_mmvq.cu, the native expert matvec, plus the grouped S2 expert, Qwen and IQ kernels), so the slower form is on the decode path. With this change gfx1010 takes the same SDWA sequence as gfx1012, and the integer results are the same (modulo 2^32, no clamp).

On 2x RX 5700 XT with Qwen3.8-Flash-Next Q2_0, decode goes from 22.38 to 28.77 tok/s (+28.5%, 12 of 12 pairs faster), and the greedy text stays byte-identical. The engine binary also shrinks from 47.7 MB to 37.4 MB.

None for this change. Setup does not offer gfx1010 yet; #3272 (open) adds the STRATA_EXPERIMENTAL_GFX1010=1 opt-in, and docs/OLDER_GPUS.md lists the card as built by hand. This PR only changes what a gfx1010 build compiles to.

Approach

defined(__gfx1010__) || is added to the gfx1012 branch of dp4a(). -DSTRATA_GFX1012_PORTABLE_DOT=ON still selects the portable loop, now on both chips. Every other architecture compiles the same code as before. docs/OLDER_GPUS.md says that gfx1010 takes the SDWA sequence too.

Validation

Environment: 2x RX 5700 XT 8 GB (gfx1010), i7-3770 (AVX, no AVX2), 32 GB DDR3-1600, Ubuntu with kernel 7.0, ROCm 7.14.0a20260612 (TheRock gfx101X-dgpu), -DSTRATA_ENABLE_HIP=ON -DCMAKE_HIP_ARCHITECTURES=gfx1010 -DSTRATA_ISA_FLOOR=avx, base 870aedd9.

Passed:

  • hip_intrinsics (dot4 and its overflow cases against a CPU reference) built from this branch (870aedd9 + this commit) and run on an RX 5700 XT: HIP intrinsics parity OK: dynamic signed dot4/overflow, byte permute, packed integer boundaries, wave32 shuffles, shared-memory exchange, ballot and sleep. It is also OK on main's portable loop.

  • The strata engine target built with this change on top of the AVX-only CPU branch (https://github.com/Keoian/Strata/tree/avx1-q2-native-rows, #4728), 0 errors. That branch touches only CPU files, and it keeps this CPU from hiding the GPU side.

  • Exact: with a fixed expert placement (--adapt-swaps 0 --prompt-cache 0, pcie_frac 0), 6 greedy prompts (up to 256 tokens) gave byte-identical text with and without this change (6 of 6).

  • Decode A/B, both arms on the AVX-only CPU branch: 2x RX 5700 XT 8 GB (layer split 27), Qwen3.8-Flash-Next ISTA-DASLab Q2_0, --spec 4 --spec-min-p 0.8 --mtp --kv int8 --max-context 131072 --resident-budget-gib 24 --vram-reserve-mib 700, STRATA_Q2_BITPLANE=1, STRATA_HC_Q8=0. Three prompts (code, story, explanation) x 2 reps, 256 tokens greedy, thinking off, one warm-up request, a fresh engine start per arm, the arms in ABBA order over two starts each. Mean 22.38 -> 28.77 tok/s (+28.5%), 12 of 12 pairs faster.

    Per-run decode tok/s
    • without: 26.6 14.3 23.1 26.3 23.2 24.6 26.7 22.2 25.6 15.0 23.6 17.4
    • with: 29.8 25.2 31.1 29.1 26.9 31.2 29.8 25.1 31.3 29.1 25.2 31.4

Failed:
none observed.

Not run:

  • gfx1012 and gfx1011: no card here. gfx1012 compiles the same code as before; gfx1011 is not touched.
  • CUDA and SYCL builds: the file is HIP-only (#if defined(__HIPCC__)).
  • ctest beyond hip_intrinsics, and the strata target on this commit alone (it was built on top of the CPU branch above).

Limits

Measured on one machine with one model (Qwen3.8-Flash-Next Q2_0). gfx1010 stays a hand-built, unvalidated target.

🤖 Generated with Claude Code


🔄 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/4855 **Author:** [@Keoian](https://github.com/Keoian) **Created:** 10/31/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `gfx1010-sdwa-dot` --- ### 📝 Commits (1) - [`95527d6`](https://github.com/Niko1221/Strata/commit/95527d6e314db4b85d07dba7adf5c011aa1a3991) [Engine] gfx1010 (RX 5700 / 5700 XT): the SDWA dp4a that gfx1012 already uses ### 📊 Changes **2 files changed** (+3 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docs/OLDER_GPUS.md` (+1 -0) 📝 `include/strata/hip_compat/intrinsics.hpp` (+2 -2) </details> ### 📄 Description ## Problem and result RDNA1 has no signed dot4 instruction. `hip_compat/intrinsics.hpp` gives gfx1012 (RX 5500 XT) llama.cpp's SDWA byte-select sequence for `__dp4a`. gfx1010 (RX 5700 / 5700 XT), which has no dot instructions at all, fell through to the portable shift-and-mask loop. Strata's own kernels call it through `STRATA_DP4A` (45 call sites in `native_mmvq.cu`, the native expert matvec, plus the grouped S2 expert, Qwen and IQ kernels), so the slower form is on the decode path. With this change gfx1010 takes the same SDWA sequence as gfx1012, and the integer results are the same (modulo 2^32, no clamp). On 2x RX 5700 XT with Qwen3.8-Flash-Next Q2_0, decode goes from 22.38 to 28.77 tok/s (+28.5%, 12 of 12 pairs faster), and the greedy text stays byte-identical. The engine binary also shrinks from 47.7 MB to 37.4 MB. ## Related discussion None for this change. Setup does not offer gfx1010 yet; #3272 (open) adds the `STRATA_EXPERIMENTAL_GFX1010=1` opt-in, and `docs/OLDER_GPUS.md` lists the card as built by hand. This PR only changes what a gfx1010 build compiles to. ## Approach `defined(__gfx1010__) ||` is added to the gfx1012 branch of `dp4a()`. `-DSTRATA_GFX1012_PORTABLE_DOT=ON` still selects the portable loop, now on both chips. Every other architecture compiles the same code as before. `docs/OLDER_GPUS.md` says that gfx1010 takes the SDWA sequence too. ## Validation Environment: 2x RX 5700 XT 8 GB (gfx1010), i7-3770 (AVX, no AVX2), 32 GB DDR3-1600, Ubuntu with kernel 7.0, ROCm 7.14.0a20260612 (TheRock gfx101X-dgpu), `-DSTRATA_ENABLE_HIP=ON -DCMAKE_HIP_ARCHITECTURES=gfx1010 -DSTRATA_ISA_FLOOR=avx`, base 870aedd9. **Passed:** - `hip_intrinsics` (dot4 and its overflow cases against a CPU reference) built from this branch (870aedd9 + this commit) and run on an RX 5700 XT: `HIP intrinsics parity OK: dynamic signed dot4/overflow, byte permute, packed integer boundaries, wave32 shuffles, shared-memory exchange, ballot and sleep`. It is also OK on main's portable loop. - The `strata` engine target built with this change on top of the AVX-only CPU branch (https://github.com/Keoian/Strata/tree/avx1-q2-native-rows, #4728), 0 errors. That branch touches only CPU files, and it keeps this CPU from hiding the GPU side. - Exact: with a fixed expert placement (`--adapt-swaps 0 --prompt-cache 0`, `pcie_frac` 0), 6 greedy prompts (up to 256 tokens) gave byte-identical text with and without this change (6 of 6). - Decode A/B, both arms on the AVX-only CPU branch: 2x RX 5700 XT 8 GB (layer split 27), Qwen3.8-Flash-Next ISTA-DASLab Q2_0, `--spec 4 --spec-min-p 0.8 --mtp --kv int8 --max-context 131072 --resident-budget-gib 24 --vram-reserve-mib 700`, `STRATA_Q2_BITPLANE=1`, `STRATA_HC_Q8=0`. Three prompts (code, story, explanation) x 2 reps, 256 tokens greedy, thinking off, one warm-up request, a fresh engine start per arm, the arms in ABBA order over two starts each. Mean 22.38 -> 28.77 tok/s (+28.5%), 12 of 12 pairs faster. <details><summary>Per-run decode tok/s</summary> - without: 26.6 14.3 23.1 26.3 23.2 24.6 26.7 22.2 25.6 15.0 23.6 17.4 - with: 29.8 25.2 31.1 29.1 26.9 31.2 29.8 25.1 31.3 29.1 25.2 31.4 </details> **Failed:** none observed. **Not run:** - gfx1012 and gfx1011: no card here. gfx1012 compiles the same code as before; gfx1011 is not touched. - CUDA and SYCL builds: the file is HIP-only (`#if defined(__HIPCC__)`). - `ctest` beyond `hip_intrinsics`, and the `strata` target on this commit alone (it was built on top of the CPU branch above). ## Limits Measured on one machine with one model (Qwen3.8-Flash-Next Q2_0). gfx1010 stays a hand-built, unvalidated target. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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#5215
No description provided.