mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
tools/vision/own: on gfx1151, products with F16 results and float32 accumulation by default
The Windows ROCm package's rocBLAS has tuned gfx1151 kernels for 16-bit results only (Tensile BB_HPA / HH_HPA); BF16 / F16 -> F32, which the tower asked for, has only fallback kernels. On gfx1151 the tower now takes, by default: - STRATA_VIT_HPA16: weight products with a 16-bit result, float32 accumulation, widened after; - STRATA_VIT_HPA16_ATT: the same for the attention's P*V product; - STRATA_VIT_BF16_AS_F16: BF16 matrices held as F16 (the Pascal path), so every product gives an F16 result (HH_HPA, 10-bit mantissa) and not a BF16 one. Each variable set to 0 turns its part off. No other card changes; no user setting. Strix (Radeon 8060S, Windows), 18 pictures at 1,024 tokens against mtmd-CPU, medians of 5 encodes: - Qwen3.8 (BF16 file): 0.54-0.83 of mtmd-HIP's time, median 0.66; rule 1 and rule 2 pass on all 18 (lowest global cosine 0.999285); byte-identical within a process and across two processes. - Qwen3.6 (F16 file): 0.57-0.91, median 0.67; rule 1 and rule 2 pass on all 18 (lowest 0.999760). - With BF16 results (no BF16_AS_F16) Qwen3.8 missed rule 1 on 3 pictures and rule 2 on 3. - Before: 1.72-3.06 of mtmd-HIP's time with float32 results. Jobs strix-20261111-1135-3669 (R2) and strix-20261111-1147-cbbb (R2b); RESULTS-OWN-3V.md PART F2/F3.
This commit is contained in:
1 parent
8499137ac5
commit
888ded122f
2 files changed
+13
-3
No files matched your search
@@ -486,7 +486,7 @@ struct VitGpuImpl {
|
||||
#endif
|
||||
|
||||
#if defined(STRATA_VIT_HIP)
|
||||
// STRATA_VIT_HPA16=1 (off by default): the 16-bit weight products ask rocBLAS for a 16-bit RESULT with float32 accumulation (BF16 -> BF16 and F16 -> F16,
|
||||
// STRATA_VIT_HPA16=1 (on by default on gfx1151 only, see VitGpu::load): the 16-bit weight products ask rocBLAS for a 16-bit RESULT with float32 accumulation (BF16 -> BF16 and F16 -> F16,
|
||||
// compute 32F: rocBLAS's BB_HPA / HH_HPA kernels), then widen it to float32. On gfx110x and gfx1151 the Windows ROCm package's rocBLAS has tuned kernels
|
||||
// for those types and only its generic fallback kernels for BF16 / F16 -> F32 (BS_HPA / HS_HPA), which our products asked for (lane COVER 11-11,
|
||||
// phaseA-tests\par\RESULTS-COVER.md); mtmd's reader asks for the 16-bit result there. STRATA_VIT_HPA16_ATT=1: the same for the attention's P*V product
|
||||
@@ -721,6 +721,15 @@ bool VitGpu::load(const Gguf& gg, const VitGeometry& g, int device, int max_patc
|
||||
if (cudaGetDeviceProperties(&p, device) == cudaSuccess && p.major == 6) pascal = m.bf16_as_f16 = true;
|
||||
(void) cudaGetLastError();
|
||||
}
|
||||
#else
|
||||
{ // gfx1151 (Strix Halo): every product with a 16-bit result and float32 accumulation, BF16 matrices held as F16, so all of them run rocBLAS's tuned
|
||||
// HH_HPA kernels (F16 results, 10-bit mantissa). Strix, 18 pictures at 1,024 tokens: Qwen3.8 0.54-0.83 of mtmd-HIP's time (median 0.66), Qwen3.6
|
||||
// 0.57-0.91 (median 0.67), rule 1 and 2 pass on both, byte-identical in and across processes; the BF16 results of BB_HPA missed rule 1 on 3 of the
|
||||
// Qwen3.8 pictures and rule 2 on 3 (RESULTS-OWN-3V.md PART F2/F3). STRATA_VIT_HPA16, STRATA_VIT_HPA16_ATT and STRATA_VIT_BF16_AS_F16 = 0 turn each off.
|
||||
hipDeviceProp_t p;
|
||||
if (hipGetDeviceProperties(&p, device) == hipSuccess && vit_gpu_is_gfx1151(p.gcnArchName)) m.bf16_as_f16 = m.hpa16 = m.hpa16_att = true;
|
||||
(void) hipGetLastError();
|
||||
}
|
||||
#endif
|
||||
if (const char* e = std::getenv("STRATA_VIT_BF16_AS_F16")) m.bf16_as_f16 = std::atoi(e) != 0;
|
||||
if (cudaSetDevice(device) != cudaSuccess) { err = std::string("cannot use GPU ") + std::to_string(device) + ": " + cudaGetErrorString(cudaGetLastError()); return false; }
|
||||
|
||||
@@ -34,8 +34,9 @@ inline bool vit_gpu_slower_nvidia(int cc_major, int cc_minor, bool bf16_matrices
|
||||
return max_tokens <= kVitGpuDefaultLimit && cc_major == 6 && !(cc_minor == 0 && bf16_matrices);
|
||||
}
|
||||
// AMD gfx1151 (Strix Halo, Radeon 8060S) takes our tower under `auto` (owner 11-11: "For Strix - use our reader, even if its a bit slower ... Our priority is to
|
||||
// get off ggml and llama.cpp"). It is slower there: the ROCm package's rocBLAS ships only its generic "fallback" Tensile kernels for gfx1151 (Windows, Strix:
|
||||
// 1.73 to 3.03 of mtmd-HIP's time with hipBLAS; RESULTS-OWN-3V.md 12.14, PART F), and correct (rule 1 and 2 pass on 18 pictures, both models).
|
||||
// get off ggml and llama.cpp"). The ROCm package's rocBLAS has tuned gfx1151 kernels for 16-bit results only (BF16 / F16 -> F32 is fallback-only), so on
|
||||
// gfx1151 the tower asks for F16 results with float32 accumulation (vit_gpu.cu, VitGpu::load): 0.54-0.91 of mtmd-HIP's time on Strix, rule 1 and 2 pass on
|
||||
// 18 pictures with both models (RESULTS-OWN-3V.md PART F2/F3; with float32 results it was 1.7 to 3.1).
|
||||
// `gfx` is the device's arch name (hipDeviceProp_t::gcnArchName, possibly with feature suffixes such as ":xnack-").
|
||||
inline bool vit_gpu_is_gfx1151(const std::string& gfx) { return gfx.rfind("gfx1151", 0) == 0 && (gfx.size() == 7 || gfx[7] == ':'); }
|
||||
// AMD on Windows (coordinator 11-11, with the default flip to our tower): no card but gfx1151 has been measured with the Windows HIP package, so `auto` keeps
|
||||
|
||||
Reference in new issue
Block a user