mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
image: gfx1200 / gfx1201 fast attention on by default in the image DiT code (STRATA_QI_GFX12_ATTN=0 turns it off)
src/image/dit/qi21_kernels.cu has_fast_attn: on gfx1200 / gfx1201 (RDNA4) attn_fast (the WMMA attention, already the default on gfx11 and on NVIDIA sm_80+) now runs unless STRATA_QI_GFX12_ATTN=0. It was opt-in (=1). Only our image code changes: strata-dit-step and strata-image. The sd-cli native-runner patch (tools/image/sdcpp_native/qi21-native.cu) keeps its own read of the name and its own default (=1 turns it on there); a shipped path is not touched. R9700 (gfx1201, HIP, p620), Q8_0, GB10 inputs and references: - DiT stage check, nine cases: step 1024: 3392 ms off, 824 ms on; 512: 390-399 ms off, 207 ms on. Velocities identical run to run in both modes. The stage rule against the float32-sum emulation: on mean 1.062 x, off 1.052 x; the one case over the 1.5 cap is 512 p5 in both modes (on 1.523, off 1.588), a known sensitivity of prompt 5; on is not worse on any case and is 0.0002-0.0003 from off on every case. - Joined gate, 16 pictures at 1024 against the GB10's CUDA reference (line 28.90 / 14.59 dB, 0.9525 / 0.8045): on 30.07 / 16.54 dB, 0.9605 / 0.8489 (off 30.11 / 16.53, 0.9605 / 0.8501). Paired against sd.cpp's cuBLAS arm: PSNR +1.174 dB [+0.661, +1.713], SSIM +0.0080 [+0.0033, +0.0136], minima 16.54 / 0.8489 against 14.59 / 0.8045. On against off per picture: 54.13 / 35.15 dB (mean / min), 0.9991 / 0.9946. - Speed, 1024 p0 s42, whole program, 5 interleaved pairs: 8 steps 27.75 s [27.63-27.79] off, 6.93 s [6.92-6.95] on; whole process 32.33 s off, 11.47 s on; junction maximum 97 C off, 95 C on. sd.cpp on the same card, median of 16: stock 35.41 s, cuBLAS-forced 28.76 s whole. - Run to run, pictures byte-identical, measured: fast attention ON 15 of 16 (gate set, two runs) + 6 of 6 + 29 of 30 (p2_s42 repeats); OFF 16 of 16 + 4 of 4 + 29 of 30. The differing runs: ON run 27 differs in the VAE output only (2.46 % of the values, 90 bottom rows, largest 0.0119, PNG 78.97 dB from run 1); OFF run 20 differs from the eighth DiT step on (all values, PNG 23.81 dB). So it occurs with the fast attention off at the same rate and in different stages; its cause is not found. It is an open item of the image program on the R9700, both modes. Tests: tools/check docs step 6 of 6 and tools/test_settings_register.py 8 passed (p2006-20261111-1729-85ab). Register: data/settings-register.json entry STRATA_QI_GFX12_ATTN default_state off -> on and the note reworded, marked [DRAFT] (the wording is the owner's).
This commit is contained in:
1 parent
8fef680c0d
commit
e93b90250d
3 files changed
+6
-4
No files matched your search
@@ -32393,7 +32393,7 @@
|
||||
}
|
||||
],
|
||||
"parse": "flag",
|
||||
"default_state": "off",
|
||||
"default_state": "on",
|
||||
"code_default": null,
|
||||
"engine_sets": [],
|
||||
"engine_defaults": [],
|
||||
@@ -32408,7 +32408,7 @@
|
||||
"last_date": "2026-11-11",
|
||||
"status": "research",
|
||||
"owner": "image",
|
||||
"note": "[reviewed] Test switch of the image test programs (strata-dit-step, strata-image) and of the opt-in native DiT runner patch for sd-cli (tools/image/sdcpp_native): 1 turns on Strata's own WMMA attention for the Qwen-Image DiT on gfx1200 / gfx1201 (RDNA4), where it is not measured yet. Off by default; no shipped default sets it.",
|
||||
"note": "[DRAFT] Switch of Strata's own WMMA attention in the image DiT code (strata-dit-step, strata-image) on gfx1200 / gfx1201 (RDNA4): on by default there, 0 turns it off. Measured on an R9700 at 1024 x 1024, 8 steps: 6.93 s with it, 27.75 s without; the pictures are 54.1 dB (worst 35.2 dB) from the ones without it. The opt-in native DiT runner patch for sd-cli (tools/image/sdcpp_native) reads this name too and keeps its own default: there 1 turns it on.",
|
||||
"retire_after": "",
|
||||
"retired_in": ""
|
||||
},
|
||||
|
||||
@@ -590,7 +590,9 @@ int has_fast_attn(int device) {
|
||||
if (std::strncmp(arch, p, 7) == 0) return 1;
|
||||
const char* g12 = std::getenv("STRATA_QI_GFX12_ATTN");
|
||||
const bool rdna4 = std::strncmp(arch, "gfx1200", 7) == 0 || std::strncmp(arch, "gfx1201", 7) == 0;
|
||||
return rdna4 && g12 != nullptr && g12[0] == '1' ? 1 : 0;
|
||||
// gfx1200 / gfx1201: on by default (R9700: 8 steps 27.75 s -> 6.93 s at 1024, pictures 54 dB from the exact-attention ones);
|
||||
// STRATA_QI_GFX12_ATTN=0 turns it off
|
||||
return rdna4 && !(g12 && g12[0] == '0') ? 1 : 0;
|
||||
#else
|
||||
return prop.major >= 8 ? 1 : 0;
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@ int swiglu(void* stream, const float* gu, float* out, int T, int F);
|
||||
int attn_exact(void* stream, const float* q, int q_tstride, const void* k, const void* v, int kv_tstride, float* out,
|
||||
int H, int Lq, int Lk, int causal);
|
||||
|
||||
// 1 when this device runs attn_fast (NVIDIA sm_80+: mma.sync; HIP gfx11: WMMA; gfx12 with STRATA_QI_GFX12_ATTN=1)
|
||||
// 1 when this device runs attn_fast (NVIDIA sm_80+: mma.sync; HIP gfx11: WMMA; gfx12 unless STRATA_QI_GFX12_ATTN=0)
|
||||
int has_fast_attn(int device);
|
||||
|
||||
// flash attention for the image tokens: q f16 head-major, k / v f16 head-major, out f32 token-major
|
||||
|
||||
Reference in new issue
Block a user