[ck_tile][FMHA] fp8 forward returns incorrect results for head dims not divisible by 16 (gfx950)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- cpp
- Bereich
- hpc, machine-learning
Rechercherichtung
Reproduce with the provided cmake build, then run tile_example_fmha_fwd across the listed -d values; the failures are exactly the cases where d % 16 != 0. Inspect the fp8 pipeline selection in get_pipelines() and the dpad/dvpad path, especially GetSmemKPackV and the 16-element K-pack assumption for fp8. Done means the listed head dims, including 72 and 200, validate as valid:y for fp8bf16 on gfx950.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
On gfx950, the ck_tile FMHA forward fp8 (fp8bf16) path returns numerically
incorrect results for any head dimension that is not a multiple of 16. The
example's own validator flags it, and the failure is large (not a tolerance issue) —
e.g. at d=72 it reports OUT accuracy bound: 174681 elements over, worst 38.0894x.
Head dims that are multiples of 16 are all correct, so the dispatch and the kernels
themselves work; only the padded (non-multiple-of-16) head dims are wrong.
This matters in practice because head_dim = 72 is used by real vision encoders, and
it silently produces wrong attention output rather than failing to dispatch.
Reproduction
Unmodified tree, built with only the fp8 instances to keep the build short:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
-DGPU_TARGETS=gfx950 -DCMAKE_HIP_ARCHITECTURES=gfx950 \
-DCMAKE_CXX_COMPILER=hipcc \
-DFMHA_FWD_ENABLE_APIS=fwd -DFMHA_FWD_CODEGEN_RECEIPT=1 \
-DFMHA_FWD_INSTANCE_FILTER='*fp8*' -DBUILD_TESTING=OFF
cmake --build build --target tile_example_fmha_fwd -j
for D in 64 72 80 88 96 104 112 120 128 192 200 256; do
./build/bin/tile_example_fmha_fwd -prec=fp8bf16 -mode=0 \
-b=2 -h=8 -s=512 -d=$D -mask=0 -qscale=pt -init=3 -v=1 \
| grep -o 'valid:[yn]'
done
Result
| head dim | d % 16 |
validation |
|---|---|---|
| 64 | 0 | valid:y |
| 72 | 8 | valid:n |
| 80 | 0 | valid:y |
| 88 | 8 | valid:n |
| 96 | 0 | valid:y |
| 104 | 8 | valid:n |
| 112 | 0 | valid:y |
| 120 | 8 | valid:n |
| 128 | 0 | valid:y |
| 192 | 0 | valid:y |
| 200 | 8 | valid:n |
| 256 | 0 | valid:y |
The correlation with d % 16 is exact across all 12 points. Note the failures span
several different instances (72/88 and 104/120 dispatch to different tile sizes), so
this is not specific to one instance.
Suspected cause (not confirmed)
The fp8 pipelines are selected with dpad/dvpad set, which get_pipelines()
describes as covering padded head dims. For fp8 the smem K-pack works out to 16
elements (GetSmemKPackV returns min(total_pixels, 16 * PackedSize / sizeof(VDataType)),
and sizeof(fp8) == 1), so a 16-wide vector load over a head dim of 72 reads past the
logical extent. That would explain why only non-multiples of 16 are affected, and why
fp16/bf16 (whose MFMA K and pack width are 16-bit, giving a different alignment
requirement) are not reported here. I have not confirmed this by reading the generated
ISA — treat it as a hypothesis.
Workaround
Callers must pre-pad Q/K/V to a multiple of 16 in the host code rather than relying on
the in-kernel dpad path.
Environment
- gfx950 (MI355X)
composable_kernel@f93c029- HIP 7.15.26333, AMD clang 23.0.0git (
ROCm/llvm-project@8f497e09) fp8bf16,-qscale=pt, batch mode, no mask
A bf16 control at the same head dims was not run in this build (the instance filter
excluded non-fp8 kernels), so this report covers the fp8 path only.
- Vorherrschende Sprache
- C++
- Sterne
- 552
- Forks
- 316
- Ø Merge
- 3 T. 14 Std.
- Gemergte PRs (30 T.)
- 2
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus ROCm/composable_kernel
-
[ck_tile] FastGeluAsm::operator()<float, float> returns wrong results from -O1 up: inline-asm scratch operand lacks earlyclobberEvtl. vergeben @francois141 hat das vor 17 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
ROCm/composable_kernel#3763 ·
-
Tracking issue for #3792: relu2 CK XDL 2-stage MoE GEMM fix stalled on reviewEvtl. vergeben @shantipriya-amd hat das vor 19 Tagen übernommen. Offen
ROCm/composable_kernel#3794 · 1 zugewiesene Person ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
ROCm/composable_kernel#3781 · 1 Kommentar ·
-
[CK Tile] 8-wave ABQuant silently returns wrong results when BQuantGroupSize::kN < WarpGemm::kNOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
ROCm/composable_kernel#3771 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
ROCm/composable_kernel#3767 · 4 Kommentare ·
Alle Issues in ROCm/composable_kernel
Ähnliche Issues
-
bug good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
difficulty:easy func:gui prio:normal type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
NatronGitHub/Natron#2118 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
-
bug difficulty:easy prio:low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
NatronGitHub/openfx-io#523 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
ArduPilot/ardupilot_gazebo#195 ·