[PR #744] [CLOSED] HIP: on-device autotuning for gfx1100 decode (kernel shapes, draft and CPU settings) #2799

Closed
opened 2026-11-04 02:03:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/744
Author: @xyzzing
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: hip-decode-autotune


📝 Commits (10+)

  • 9ef55a4 Merge branch 'pr-14'
  • ca1758d Merge pull request #14: CPU pool: fix dangling else in Linux physical_cores() (#14, fixes #13 and #11)
  • 0cf01f5 Merge pull request #9: CPU pool: sleep between requests instead of spinning (#9, fixes #4)
  • 6d2b450 Merge pull request #7: serve: fix zero-token replies from the engine-queue race between requests (#7)
  • 54cf7b6 Merge pull request #10: Conversation cache + short prompt parts through the decode windows (#8, #10)
  • 65163f6 setup: require engine v0.1.3 (conversation cache, idle CPU fix, Linux pool fix)
  • 11bb7e2 setup: update an old ready-made engine when an existing install starts
  • 36215b9 IQ3_S support: the GSQ-RCO IQ3_S model (engine 0.1.4)
  • 6c4c8c1 setup: require engine v0.1.4 (IQ3_S)
  • a40fe52 serve: treat unset/-1 max_tokens as remaining context, not 1024

📊 Changes

15 files changed (+1911 additions, -92 deletions)

View changed files

📝 CMakeLists.txt (+10 -0)
📝 docs/AMD_HIP.md (+1 -1)
➕ docs/AMD_HIP_AUTOTUNE.md (+92 -0)
➕ include/strata/kernels/decode_tuning.hpp (+89 -0)
📝 include/strata/kernels/iq_kernels.hpp (+12 -0)
📝 setup.py (+27 -11)
📝 src/kernels/cuda/iq_kernels.cu (+208 -47)
➕ src/kernels/decode_tuning.cpp (+160 -0)
📝 src/program/generate.cpp (+4 -0)
➕ tests/core/decode_tuning_test.cpp (+87 -0)
📝 tools/calibrate.py (+130 -33)
➕ tools/hip/autotune.py (+321 -0)
➕ tools/hip/test_autotune.py (+146 -0)
➕ tools/hip/tune_decode.cpp (+504 -0)
📝 tools/test_calibrate.py (+120 -0)

📄 Description

Summary

On-device decode autotuning for the AMD HIP backend (gfx1100): per-shape rows-per-block tuning for the decode expert kernels and iq_mmvq (bitwise-exact variants only), a guarded tuning-table format, an on-device tuner, and an orchestrator that sweeps kernels, draft floor, CPU workers, and drafting windows with the user's own prompts. Settings-layer sweeps (--spec, --suffix-draft, --spec-min-p, workers) now work on HIP too, and calibrate is HIP-aware (keeps the config's --pcie-frac).

Both layers keep answers exactly the same: kernel variants are byte-compared on-device and end-to-end; the settings layer is greedy-verification-exact.

Measured on the target hardware (RX 7900 XTX 24 GB, IQ3_S, ROCm 7.1.1)

  • Kernel layer: the shipped defaults already win on every IQ3_S shape (deltas ≤1%, below the keep threshold) — an honest null; the sweep took ~1 min + 4 engine starts.
  • Settings layer: defaults fastest (57.0 tok/s on the tool's workload).
  • Draft floor: --spec-min-p 0.70 = 63.1 tok/s vs baseline (~+10%), token-identity verified end-to-end — adopted in our serving config.
  • 128K-context one-shot and ROCm-nightly comparisons are in progress on the same box; the tool's report (strata-<model>.autotune.json) carries every measurement.

Notes

  • Base is this fork's HIP integration main (4da9c59); a rebase onto current upstream main is queued (the files the patch touches are untouched by 0.1.36–0.1.38's kernel changes, so the rebase should be mechanical).
  • The free-VRAM pre-check over-counts (section 6.1 of the authoring notes) — known, fix queued.
  • gfx1100 measured; the table's arch gate keeps other cards on defaults until tuned.

🔄 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/744 **Author:** [@xyzzing](https://github.com/xyzzing) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `hip-decode-autotune` --- ### 📝 Commits (10+) - [`9ef55a4`](https://github.com/Niko1221/Strata/commit/9ef55a46992162685b3cff6306a0bf2ad1b0f9bb) Merge branch 'pr-14' - [`ca1758d`](https://github.com/Niko1221/Strata/commit/ca1758d62181ed338700724efcf74d331d7336c6) Merge pull request #14: CPU pool: fix dangling else in Linux physical_cores() (#14, fixes #13 and #11) - [`0cf01f5`](https://github.com/Niko1221/Strata/commit/0cf01f5f3775f07f56bf7ed18663121e0f02a5eb) Merge pull request #9: CPU pool: sleep between requests instead of spinning (#9, fixes #4) - [`6d2b450`](https://github.com/Niko1221/Strata/commit/6d2b4502decc17cd5795543473dbedee2f78ffe7) Merge pull request #7: serve: fix zero-token replies from the engine-queue race between requests (#7) - [`54cf7b6`](https://github.com/Niko1221/Strata/commit/54cf7b6f0700f4442ffa8bc8b5af257d5db91cf4) Merge pull request #10: Conversation cache + short prompt parts through the decode windows (#8, #10) - [`65163f6`](https://github.com/Niko1221/Strata/commit/65163f6ac7bbaaf471dd5dd1a8037865e4a0a33f) setup: require engine v0.1.3 (conversation cache, idle CPU fix, Linux pool fix) - [`11bb7e2`](https://github.com/Niko1221/Strata/commit/11bb7e293ff295839661275dcee5e99babf06410) setup: update an old ready-made engine when an existing install starts - [`36215b9`](https://github.com/Niko1221/Strata/commit/36215b947cbdd278bd8e55fab1bb776d114ee14b) IQ3_S support: the GSQ-RCO IQ3_S model (engine 0.1.4) - [`6c4c8c1`](https://github.com/Niko1221/Strata/commit/6c4c8c1dfafc16fa0ea7fc80c12c79f93b9f7eee) setup: require engine v0.1.4 (IQ3_S) - [`a40fe52`](https://github.com/Niko1221/Strata/commit/a40fe520cef4fc1e910123702a22fc5235408b5c) serve: treat unset/-1 max_tokens as remaining context, not 1024 ### 📊 Changes **15 files changed** (+1911 additions, -92 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+10 -0) 📝 `docs/AMD_HIP.md` (+1 -1) ➕ `docs/AMD_HIP_AUTOTUNE.md` (+92 -0) ➕ `include/strata/kernels/decode_tuning.hpp` (+89 -0) 📝 `include/strata/kernels/iq_kernels.hpp` (+12 -0) 📝 `setup.py` (+27 -11) 📝 `src/kernels/cuda/iq_kernels.cu` (+208 -47) ➕ `src/kernels/decode_tuning.cpp` (+160 -0) 📝 `src/program/generate.cpp` (+4 -0) ➕ `tests/core/decode_tuning_test.cpp` (+87 -0) 📝 `tools/calibrate.py` (+130 -33) ➕ `tools/hip/autotune.py` (+321 -0) ➕ `tools/hip/test_autotune.py` (+146 -0) ➕ `tools/hip/tune_decode.cpp` (+504 -0) 📝 `tools/test_calibrate.py` (+120 -0) </details> ### 📄 Description ## Summary On-device decode autotuning for the AMD HIP backend (gfx1100): per-shape rows-per-block tuning for the decode expert kernels and `iq_mmvq` (bitwise-exact variants only), a guarded tuning-table format, an on-device tuner, and an orchestrator that sweeps kernels, draft floor, CPU workers, and drafting windows with the user's own prompts. Settings-layer sweeps (`--spec`, `--suffix-draft`, `--spec-min-p`, workers) now work on HIP too, and `calibrate` is HIP-aware (keeps the config's `--pcie-frac`). Both layers keep answers exactly the same: kernel variants are byte-compared on-device and end-to-end; the settings layer is greedy-verification-exact. ## Measured on the target hardware (RX 7900 XTX 24 GB, IQ3_S, ROCm 7.1.1) - **Kernel layer: the shipped defaults already win on every IQ3_S shape** (deltas ≤1%, below the keep threshold) — an honest null; the sweep took ~1 min + 4 engine starts. - **Settings layer: defaults fastest** (57.0 tok/s on the tool's workload). - **Draft floor: `--spec-min-p 0.70` = 63.1 tok/s vs baseline (~+10%), token-identity verified end-to-end** — adopted in our serving config. - 128K-context one-shot and ROCm-nightly comparisons are in progress on the same box; the tool's report (`strata-<model>.autotune.json`) carries every measurement. ## Notes - Base is this fork's HIP integration main (`4da9c59`); a rebase onto current upstream main is queued (the files the patch touches are untouched by 0.1.36–0.1.38's kernel changes, so the rebase should be mechanical). - The free-VRAM pre-check over-counts (section 6.1 of the authoring notes) — known, fix queued. - gfx1100 measured; the table's arch gate keeps other cards on defaults until tuned. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:13 +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#2799
No description provided.