The Radeon 780M on Linux reads its 16-bit prompt GEMMs FP16 in and out by default

On a Radeon 780M (gfx1103, integrated) under Linux the engine now runs the prompt's 16-bit GEMMs FP16 in and out when the user
has not set STRATA_HIP_PROMPT_F16: "1" still turns it on on any card, any other set value (0) is the way back, and every other
architecture, every discrete card and Windows stay opt-in as before. The rule is prompt_f16_resolve
(include/strata/core/arch_defaults.hpp), used by prompt_f16() in src/prefill/gemm.cu; it needs integrated, not Windows and a
gcnArchName of exactly gfx1103 (the :sramecc / :xnack suffix forms included). Nothing is printed at start for the default; the
"FP16 in and out" line still appears when the variable is set to 1 and the gfx103x tip is unchanged. Not flipped elsewhere: a
Radeon AI PRO R9700 (gfx1201) is slower with it on (dense GEMMs x0.70 to x0.72), gfx103x has no run of ours on real activations,
the other gfx11 chips have no number.

It needs the two commits before it on this branch: with the FP16 prompt path the fused hyper-connection up-mix (on by default on
this card) read FP16 activations as BF16, which made the first measurement of this default wrong (forced-token KL 166 times the
MMQ path's); that is fixed and the up-mix now has an FP16 variant.

Measured on a Radeon 780M (Q2_0 pack, 3 interleaved rounds, prompt tok/s medians, nothing set -> FP16 io): 300 tokens 124.3 ->
138.5 (x1.114), 1,000 157.7 -> 181.7 (x1.152), 2,048 208.7 -> 248.9 (x1.193), 8,192 270.0 -> 337.8 (x1.251). Beside
STRATA_PF_FUSED=1: x1.111 / x1.152 / x1.628 / x1.450 against nothing set.
Quality, same card: forced-token KL against the FP16 path (24 prompts of 2,048 tokens, 64 forced tokens each, draft-cost table
fixed, repeat arms equal their first run byte for byte): 0.00593 against 0.00543 for MMQ (ratio 1.091, 95% CI 0.968 to 1.231),
top-1 agreement with the FP16 path 97.46% against 97.27%, no non-finite value. Not run: any other card; no second model.

This commit also updates the settings register entry of STRATA_HIP_PROMPT_F16 and the rows of docs/AMD_HIP.md and
docs/RADEON_780M.md.
This commit is contained in:
Niko1221 committed 2026-11-12 21:26:16 +01:00
1 parent 563e0fa037
commit 8d7f997d41
6 files changed
+59 -17

No files matched your search

+19 -11
View File
@@ -12153,7 +12153,7 @@
"reads": [
{
"file": "src/prefill/gemm.cu",
"line": 612,
"line": 615,
"backend": "hip",
"fn": "getenv"
},
@@ -12168,27 +12168,35 @@
"default_state": "off",
"code_default": null,
"engine_sets": [],
"engine_defaults": [],
"engine_defaults": [
{
"file": "include/strata/core/arch_defaults.hpp",
"line": 78,
"value": "1",
"arch": "gfx1103 (Linux, integrated)"
}
],
"launch_files": [],
"launch_sets": [],
"launch_reads": [],
"doc_mentions": [
"docs/AMD_HIP.md:286",
"docs/AMD_HIP.md:515",
"docs/AMD_HIP.md:516",
"docs/AMD_HIP.md:696",
"docs/AMD_HIP.md:703",
"docs/AMD_HIP.md:769",
"docs/AMD_HIP.md:780"
"docs/AMD_HIP.md:283",
"docs/AMD_HIP.md:512",
"docs/AMD_HIP.md:513",
"docs/AMD_HIP.md:693",
"docs/AMD_HIP.md:700",
"docs/AMD_HIP.md:766",
"docs/AMD_HIP.md:777",
"docs/RADEON_780M.md:91"
],
"first_commit": "972cad1bc5",
"first_date": "2026-10-05",
"since": "v0.1.40.1",
"last_commit": "85f839d80c",
"last_date": "2026-10-12",
"status": "opt-in",
"status": "default",
"owner": "prefill",
"note": "[reviewed] Documented FP16 prompt route, off unless =1. [docs/AMD_HIP.md:516]",
"note": "[auto] on by default for a Radeon 780M (gfx1103, integrated, Linux) only (include/strata/core/arch_defaults.hpp:78 prompt_f16_resolve, used by prompt_f16() in src/prefill/gemm.cu); opt-in elsewhere (=1); =0 turns it off. [docs/AMD_HIP.md:512]",
"retire_after": "",
"retired_in": ""
},
+1 -1
View File
@@ -509,7 +509,7 @@ kernels for FP16-in / FP16-out GEMMs only; the prompt path's FP16-in / FP32-out
| Switch | Effect |
| --- | --- |
| `STRATA_HIP_PROMPT_F16=1` | Runs the 16-bit prompt GEMMs FP16 in and out (the engine prints a tip on gfx103x). `STRATA_F16_RANGE=1` prints, per prompt, the largest value that entered or left FP16 (FP16 ends at 65504); `STRATA_DBG_NAN=1` counts non-finite FP16 outputs. Checks: [2026-10-04-rdna2-fp16-prompt](../bench/results/2026-10-04-rdna2-fp16-prompt/README.md). |
| `STRATA_HIP_PROMPT_F16=1` | Runs the 16-bit prompt GEMMs FP16 in and out (the engine prints a tip on gfx103x). On by default on a Radeon 780M (gfx1103) under Linux; `=0` turns it off there; every other card needs `=1`. Radeon 780M, Q2_0, prompt x1.11 / x1.15 / x1.19 / x1.25 at 300 / 1,000 / 2,048 / 8,192 tokens (x1.11 / x1.15 / x1.63 / x1.45 beside `STRATA_PF_FUSED=1`); forced-token KL against the FP16 path 0.00593 against 0.00543 for MMQ (24 prompts, 64 tokens each, ratio 1.09, 95% CI 0.97 to 1.23). On a Radeon AI PRO R9700 (gfx1201) the dense GEMMs are slower with it (x0.70 to x0.72), so it stays opt-in there. `STRATA_F16_RANGE=1` prints, per prompt, the largest value that entered or left FP16 (FP16 ends at 65504); `STRATA_DBG_NAN=1` counts non-finite FP16 outputs. Checks: [2026-10-04-rdna2-fp16-prompt](../bench/results/2026-10-04-rdna2-fp16-prompt/README.md). |
| `STRATA_RDNA2_SGEMM=1` | Widens both GEMM inputs to FP32 (exact) and runs SGEMM, no 65504 limit. `=all` forces it on any AMD card. With `STRATA_HIP_PROMPT_F16=1` the FP16 route runs first and SGEMM takes the products it leaves. Slower than the FP16 route. |
| `STRATA_ROCBLAS_TUNING=<file or dir>` | A rocBLAS solution table for the FP16 route; setup points the engine at the directory when a table for the architecture exists. The log says `rocBLAS tuning enabled (... rows ...)` or why not. See [rocBLAS table](#rocblas-table-gfx103x). |
| `STRATA_SELECT_SIMT=1` | QSA block scores on the FP32 tiled scorer instead of the warp kernel; helps long prompts (128K: +7.4%). Not bitwise the warp kernel. [Data](../bench/results/2026-10-07-rdna2-qsa-select-simt/README.md). |
+2
View File
@@ -88,6 +88,8 @@ On by default on the Radeon 780M (`gfx1103`, integrated, Linux; AMD_HIP.md, "Int
Measured (021-minipc, P2006, Q2_0, fresh engine per run, 10 interleaved rounds, 6 complete pairs): prompt 1K 98.5 -> 157.3 tok/s (x1.60, 6/6 pairs faster),
4K 115.1 -> 233.3 (x2.03, 6/6), decode 22.02 -> 21.99 (code) and 15.09 -> 15.05 (story) (x0.999), greedy token ids identical in 6 of 6 pairs.
The 16-bit prompt GEMMs run FP16 in and out by themselves on the 780M under Linux (`STRATA_HIP_PROMPT_F16`; AMD_HIP.md has the numbers and the check against the FP16 path); `STRATA_HIP_PROMPT_F16=0` keeps the BF16 route.
**GPU resets.** The 780M's current Ubuntu firmware (gc 11.0.1 MES) can still reset the GPU now and then, with or without this set: when the kernel moves memory that the
GPU has registered, the process's queues are evicted, and a kernel that sits in a barrier at that moment never answers. The engine recovers
("device wedged, but recovered through reset") but the running request fails. In the same runs the default engine crashed 4 of 10 times and the set 0 of 10, so it did
+9
View File
@@ -11,6 +11,8 @@
// A switch the user set (to anything) is never overridden; STRATA_GFX1151_DEFAULTS=0 turns the whole table off.
#pragma once
#include "strata/kernels/gfx_arch.hpp"
#include <string>
#include <utility>
#include <vector>
@@ -70,6 +72,13 @@ bool igpu_kfd_settle_default(const char* gcn_arch, bool integrated, bool windows
/// the file-cache give-back during and after the expert load (strata/core/page_cache_drop.hpp) applies to the same class: an integrated
/// gfx11 GPU under Linux (gfx1103, gfx1150, gfx1151). Never Windows, never a discrete card. STRATA_NO_ARENA_CACHE_DROP=1 turns it off.
bool igpu_cache_drop_default(const char* gcn_arch, bool integrated, bool windows);
/// The 16-bit prompt GEMMs FP16 in and out (STRATA_HIP_PROMPT_F16, gemm.cu prompt_f16()): `env` is the variable's text (nullptr = unset). "1" = on, any other set
/// value = off (as before); unset = the device rule: on for a Radeon 780M (gfx1103, integrated, Linux), off everywhere else (every other gfx11, gfx12, gfx103x,
/// Windows and discrete cards are unchanged). Inline: src/prefill/gemm.cu uses it without linking arch_defaults.cpp.
inline bool prompt_f16_resolve(const char* env, const char* gcn_arch, bool integrated, bool windows) {
if (env != nullptr) return env[0] == '1';
return integrated && !windows && strata::kernels::gfx_arch_is(gcn_arch, "gfx1103");
}
/// Whether the expert arena skips its MADV_HUGEPAGE request: `no_arena_thp` is STRATA_NO_ARENA_THP (nullptr when unset): "0" asks for the huge
/// pages, any other value skips the request; unset leaves it to `igpu_rule` (igpu_arena_no_thp_default for this device). `thp_always`: the
/// kernel's THP mode is "always" (the request would add nothing, #771). Inline: src/core/pinned.cu (strata_core) uses it without
+16
View File
@@ -431,6 +431,22 @@ int main() {
CHECK(!igpu_cache_drop_default(g, false, false)); // not integrated
}
for (const char* g : {"gfx1100", "gfx1201", "gfx90a", "gfx1030", "gfx1152", ""}) CHECK(!igpu_cache_drop_default(g, true, false));
// STRATA_HIP_PROMPT_F16 (gemm.cu prompt_f16): "1" = on anywhere, any other set value = off (the way back), unset = on for the Linux integrated 780M only
for (const char* g : {"gfx1103", "gfx1103:sramecc-:xnack-"}) {
CHECK(prompt_f16_resolve(nullptr, g, true, false));
CHECK(!prompt_f16_resolve(nullptr, g, true, true)); // Windows
CHECK(!prompt_f16_resolve(nullptr, g, false, false)); // a discrete card of that name / a mixed report
CHECK(!prompt_f16_resolve("0", g, true, false)); // the way back
CHECK(!prompt_f16_resolve("", g, true, false));
CHECK(prompt_f16_resolve("1", g, true, false));
}
for (const char* g : {"gfx1150", "gfx1151", "gfx1152", "gfx1100", "gfx1101", "gfx1102", "gfx1200", "gfx1201", "gfx1030", "gfx1031", "gfx1032", "gfx11030", "", "gfx90a"}) {
CHECK(!prompt_f16_resolve(nullptr, g, true, false)); // unchanged: opt-in
CHECK(!prompt_f16_resolve(nullptr, g, false, false));
CHECK(prompt_f16_resolve("1", g, false, false)); // =1 still turns it on anywhere
CHECK(!prompt_f16_resolve("0", g, true, false));
}
CHECK(!prompt_f16_resolve(nullptr, nullptr, true, false));
// STRATA_NO_ARENA_THP: unset = the device rule decides; "0" = ask for the huge pages (also on such a device); any other value = skip them
CHECK(arena_skip_thp_request(nullptr, false, true)); // integrated gfx11, nothing set: skipped
CHECK(!arena_skip_thp_request(nullptr, false, false)); // any other device, nothing set: requested (as before)
+12 -5
View File
@@ -1,6 +1,7 @@
// src/prefill/gemm.cu - see include/strata/prefill/gemm.hpp.
#include "strata/prefill/gemm.hpp"
#include "strata/kernels/dequant_bf16.hpp"
#include "strata/core/arch_defaults.hpp" // prompt_f16_resolve (inline)
#if defined(STRATA_PREFILL_MMQ) && defined(__HIPCC__)
#include "strata/prefill/mmq_ids_margin.hpp"
#include "strata/prefill/moe_mmq.hpp"
@@ -608,13 +609,19 @@ bool prompt_f16() {
int dev = 0;
if (hipGetDevice(&dev) != hipSuccess || dev < 0 || dev >= kMaxDev) { (void) hipGetLastError(); return false; }
if (const int8_t c = cached[dev].load(std::memory_order_relaxed)) return c == 2;
// Opt-in (#835): only STRATA_HIP_PROMPT_F16=1 turns it on. It changes the prompt path's numbers (an FP16 rounding of
// each 16-bit GEMM's output), so no card gets it unasked. On gfx103x it is ~2x faster, so we say so once.
// Opt-in (#835): STRATA_HIP_PROMPT_F16=1 turns it on. It changes the prompt path's numbers (an FP16 rounding of
// each 16-bit GEMM's output), so a card gets it unasked only where it was measured against the FP16 path's level: the Radeon 780M
// (gfx1103, integrated, Linux; strata::core::prompt_f16_resolve), where =0 is the way back. On gfx103x it is ~2x faster, so we say so once.
const char* e = std::getenv("STRATA_HIP_PROMPT_F16");
const bool on = e != nullptr && e[0] == '1';
hipDeviceProp_t p{};
if (hipGetDeviceProperties(&p, dev) != hipSuccess) { (void) hipGetLastError(); p.gcnArchName[0] = 0; }
if (on) std::fprintf(stderr, "strata prefill: HIP device %d%s%s - STRATA_HIP_PROMPT_F16=1: the prompt's 16-bit GEMMs run FP16 in and out "
if (hipGetDeviceProperties(&p, dev) != hipSuccess) { (void) hipGetLastError(); p.gcnArchName[0] = 0; p.integrated = 0; }
#if defined(_WIN32)
constexpr bool kWin = true;
#else
constexpr bool kWin = false;
#endif
const bool on = strata::core::prompt_f16_resolve(e, p.gcnArchName, p.integrated != 0, kWin);
if (on && e != nullptr) std::fprintf(stderr, "strata prefill: HIP device %d%s%s - STRATA_HIP_PROMPT_F16=1: the prompt's 16-bit GEMMs run FP16 in and out "
"(rocBLAS is tuned only for that on gfx103x; not bit-identical to the default)%s",
dev, p.gcnArchName[0] ? " " : "", p.gcnArchName, "\n");
else if (e == nullptr && std::strncmp(p.gcnArchName, "gfx103", 6) == 0)