From e9e1757a7f4585a61fa04d15d365579470d9dc3d Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Wed, 7 Oct 2026 09:09:40 +0200 Subject: [PATCH] hip: one-line start hint for STRATA_HIP_WMMA=1 on gfx12 with --kv int8 A hint only: it never enables the kernel and says the output bits change. Silent when the variable is set to anything. Follows the R9700 numbers of PR #1318 (+31% prompt at 8.8K). --- docs/AMD_HIP.md | 2 +- src/program/generate.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md index 77f8e2a7..fe4c3b02 100644 --- a/docs/AMD_HIP.md +++ b/docs/AMD_HIP.md @@ -303,7 +303,7 @@ an RX 9070 XT 16 GB and a Radeon AI PRO R9700 32 GB (both gfx1201), a Ryzen 9 39 nightly); a user's repeated A/B/A/B with setup's TheRock 7.10 wheels and an i5-12600K measured +1-4%, inside a 12-20% run-to-run spread (#432) - how much it gains depends on how much of decode the router is on that setup. `STRATA_HIP_ROUTER_OLD=1` runs the portable kernel. - - `STRATA_HIP_WMMA=1` (opt-in, gfx12 only, int8 KV): the prompt path's QSA attention on RDNA4 matrix cores + - `STRATA_HIP_WMMA=1` (opt-in, gfx12 only, int8 KV): the prompt path's QSA attention on RDNA4 matrix cores (the engine prints a one-line hint about it at start on gfx12 with `--kv int8`; it never enables it, because the output bits change; setting the variable to anything, 0 included, silences the hint) (`v_wmma_f32_16x16x16_f16`, FP16 hi + lo halves like the CUDA tensor-core kernel; `hip_prompt_attn_wmma` bounds it against the FP32 kernel and FP64). 7.2-7.5x the portable kernel; R9700 prompts 4K 1,784 -> 2,427 tok/s, 16K 1,797 -> 2,700 (a user with TheRock 7.10: +29-34%, #432). Not bitwise: greedy text differs from token ~50 on, as with the CUDA tensor-core attention. With it diff --git a/src/program/generate.cpp b/src/program/generate.cpp index eab73e19..e1d3deab 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -3950,6 +3950,13 @@ int main(int argc, char** argv) { const char* name = named && p.name[0] ? p.name : "(an unnamed GPU)"; #if defined(STRATA_USE_HIP) std::fprintf(stderr, "strata generate: GPU %d: %s (%s)\n", dev, name, named ? p.gcnArchName : "?"); + // A hint only, never an action: on RDNA4 with an int8 KV the opt-in matrix-core prompt attention reads prompts + // about 30% faster (R9700, PR #1318), but its output differs from the default kernel's in the last bits, so it + // stays the user's choice. Silent when the variable is set to anything (STRATA_HIP_WMMA=0 included). + if (named && o.kv == "int8" && std::strncmp(p.gcnArchName, "gfx12", 5) == 0 && std::getenv("STRATA_HIP_WMMA") == nullptr) + std::fprintf(stderr, "strata generate: hint: STRATA_HIP_WMMA=1 reads prompts about 30%% faster on this card with " + "--kv int8 (prompt attention on the matrix cores); it is off by default because the output " + "bits change (last-place rounding). Nothing was enabled.\n"); #if defined(_WIN32) // #468 #461: which HIP runtime was loaded - the bundled one beside the exe, or an AMD driver's System32 copy if (HMODULE h = GetModuleHandleA("amdhip64_7.dll")) {