Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

hip: address review of the gfx1201 table: current docs, smoke-test wording

bsorensen110a8d57b1f0013
diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md
index 918efab1a..0a34e797b 100644
--- a/docs/AMD_HIP.md
+++ b/docs/AMD_HIP.md
@@ -154,9 +154,11 @@ an RX 9070 XT 16 GB and a Radeon AI PRO R9700 32 GB (both gfx1201), a Ryzen 9 39
The engine's resident memory was about 26 GB in every run. Since 0.1.31 `__byte_perm` is one `v_perm_b32` and the
packed byte subtracts/compare work on four lanes at once (#262, ttio2tech): decode +15% on the R9700 (46.0 -> 53.0
tok/s on a 4K prompt, 52.0 -> 60.5 warm) and +5-7% on the 9070 XT, prompts unchanged, the same tokens.
-- **hipBLASLt:** there is no gfx1201 table in `tools/hip`. A table calibrated on the R9700 at the engine's shapes
- (hipBLASLt 1.4.1; 0.98-1.76x per GEMM over hipBLAS) changed the end-to-end prompt speed by 0-3%, within noise,
- so none is shipped: on gfx1201 the plain hipBLAS path is already close.
+- **hipBLASLt:** the validation above used hipBLASLt 1.4.1. A table calibrated on the R9700 at the engine's shapes
+ with that version (0.98-1.76x per GEMM over hipBLAS) changed the end-to-end prompt speed by 0-3%, within noise,
+ so none was shipped for it: there the plain hipBLAS path is already close. For hipBLASLt 1.5.0 (ROCm
+ 10.2.0a nightly) `tools/hip/gfx1201-hipblaslt-100500.txt` is shipped (see "Tuning table" below); on one R9700 it
+ measured +3.9% prompt speed on 4,210-token prompts (1,590 vs 1,531 tok/s), a modest gain.
- **Both cards in one run (layer split, engine 0.1.30):** the config's `"backend": "hip", "gpu": [1, 0]` (R9700
first) runs through `serve/server.py` (setup writes it with `--gpus 1,0` since 0.1.31). Auto split put layers 0-27 on the R9700 and
28-47 on the 9070 XT. With every expert on the GPUs the split gives exactly the tokens of the R9700 alone (4K and
@@ -239,8 +241,12 @@ Shipped tables:
(AMD's `gfx120X-all` nightly, hipBLASLt 1.5.0, library build `d3164197`). 16 dense GEMM geometries at T=4096 and
T=8192, 32 rows. setup uses it only when the installed hipBLASLt reports 1.5.0 (it is found in `/opt/rocm`
when that is a system ROCm 7 or newer). The version number is the only thing the engine can check, so another
- 1.5.0 build could number its solutions differently. `hip_prefill_hipblaslt_gemm` only spot-checks one BF16 and
- one F16 row, so recalibrate with `tune_hipblaslt` before using this table with a different 1.5.0 build.
+ 1.5.0 build could number its solutions differently. `hip_prefill_hipblaslt_gemm` (with `STRATA_HIPBLASLT_TUNING`
+ set) is a smoke test: it refuses a table for another architecture or version and checks that one BF16 and one
+ F16 row exist and agree with hipBLASEx, which covers 2 of the 32 rows. It does not prove that a solution id is
+ valid: the engine falls back to hipBLASEx for an id the library rejects, and the test still passes. Run it with
+ `STRATA_HIPBLASLT_VERBOSE=1` and look for `fallbacks=0` in its summary line, and recalibrate with
+ `tune_hipblaslt` before using this table with a different 1.5.0 build.
## Original backend validation (PR #94)
diff --git a/tests/hip/prefill_hipblaslt_gemm.cpp b/tests/hip/prefill_hipblaslt_gemm.cpp
index 9d59945c9..4b9ed65dd 100644
--- a/tests/hip/prefill_hipblaslt_gemm.cpp
+++ b/tests/hip/prefill_hipblaslt_gemm.cpp
@@ -1,4 +1,9 @@
-// Opt-in HIP test for the calibrated hipBLASLt prefill route. Requires a matching tuning table.
+// Opt-in HIP smoke test for the calibrated hipBLASLt prefill route; it needs STRATA_HIPBLASLT_TUNING (SKIP otherwise).
+// It checks that the table loads for this device and hipBLASLt version, that the two rows it uses exist (bf16
+// N=48 K=2560 ldy=96 and f16 N=512 K=2560 ldy=512, T bucket 4096), and that Gemm's output matches hipBLASEx on those
+// two rows. It does NOT check the other rows, and it does not check that hipBLASLt ran the table's solution: an id
+// the library rejects falls back to hipBLASEx and the test still passes. Set STRATA_HIPBLASLT_VERBOSE=1 to read the
+// "hipBLASLt summary launches=... fallbacks=..." line.
#include <cuda_runtime.h>
#include <hip/hip_bfloat16.h>
#include <hip/hip_fp16.h>
@@ -132,7 +137,7 @@ bool run_case(strata::prefill::Gemm& gemm, hipblasHandle_t blas, hipStream_t str
int main() {
const char* tuning_path = std::getenv("STRATA_HIPBLASLT_TUNING");
if (!tuning_path || !*tuning_path) {
- std::fprintf(stderr, "SKIP: set STRATA_HIPBLASLT_TUNING to a calibrated matching table\n");
+ std::fprintf(stderr, "SKIP: set STRATA_HIPBLASLT_TUNING to a tuning table for this GPU and hipBLASLt version\n");
return 77;
}
@@ -157,7 +162,7 @@ int main() {
}
if (!table.closest(strata::prefill::hipblaslt::InputType::bf16, 48, 2560, 96, 4096) ||
!table.closest(strata::prefill::hipblaslt::InputType::f16, 512, 2560, 512, 4096)) {
- std::fprintf(stderr, "tuning table lacks the focused BF16/F16 test rows\n");
+ std::fprintf(stderr, "tuning table lacks the rows this smoke test uses (bf16 N=48 K=2560 ldy=96, f16 N=512 K=2560 ldy=512)\n");
return 1;
}
@@ -176,8 +181,8 @@ int main() {
HIPBLAS_CHECK(hipblasCreate(&blas));
HIPBLAS_CHECK(hipblasSetStream(blas, stream));
- // Exact calibrated chunks exercise the selected solution; T=37 reuses the closest bucket,
- // validates the actual shape before launch, and tests a non-tile-multiple tail.
+ // T=4096 is an exact calibrated bucket; T=37 resolves to the same T=4096 row (the closest bucket), validates the
+ // actual shape before launch, and tests a non-tile-multiple tail. So the four cases use two table rows.
ok &= run_case(gemm, blas, stream, true, 4096, 48, 2560, 96, 0, 0.0f, 101);
ok &= run_case(gemm, blas, stream, true, 37, 48, 2560, 96, 48, 1.0f, 102);
ok &= run_case(gemm, blas, stream, false, 4096, 512, 2560, 512, 0, 0.0f, 103);
@@ -185,5 +190,8 @@ int main() {
HIPBLAS_CHECK(hipblasDestroy(blas));
}
HIP_CHECK(hipStreamDestroy(stream));
+ std::printf("smoke test: 4 cases on 2 of the table's %zu rows; %s\n", table.rows().size(),
+ ok ? "outputs match hipBLASEx (solution ids are not verified; see STRATA_HIPBLASLT_VERBOSE)"
+ : "FAILED");
return ok ? 0 : 1;
}