[GPU] Enable f8e4m3fn quantized-KV GroupQueryAttention (dynamic path)#36806
[GPU] Enable f8e4m3fn quantized-KV GroupQueryAttention (dynamic path)#36806ankitm3k wants to merge 4 commits into
Conversation
b6784b8 to
f877b1f
Compare
|
build_jenkins |
f877b1f to
a086ade
Compare
|
@ankitm3k please fix code style |
a086ade to
9ab99c3
Compare
fixed |
d042bfd to
251d038
Compare
|
build_jenkins |
251d038 to
7015b83
Compare
Extends the GPU quantized-KV GroupQueryAttention support (i8/i4) to the f8e4m3fn KV cache on the dynamic (Slice+Concat) cache-assembly path. f8e4m3fn KV is part of the com.microsoft GQA spec (T_CACHE) and already worked on CPU/TEMPLATE via the device-agnostic decomposition; only GPU primitive gaps remained. fp8e4m3_t is a 1-byte struct with no arithmetic/convert overloads, so the reference kernels needed f8-aware handling on top of the type-list widenings: - Slice / Concat / ScatterUpdate ref kernels: include f8_utils.cl for the fp8e4m3_t typedef, and on the identity (no-activation) store copy the byte directly when the tensor is fp8 - ACTIVATION/TO_OUTPUT_TYPE do not compile on the struct. Gated by an INPUT*_IS_FP8 jit flag; non-fp8 paths are unchanged. - reorder_data.cl: (a) f8->f8 layout reorder stores the already-encoded value directly; (b) for a non-float input reordered to fp8, encode from float to resolve the ambiguous fp8 encoder overload. Both gated on fp8 flags. - Add f8e4m3 to the Slice/Concat/ScatterUpdate impl and kernel supported-type lists. Tests: un-skip the 2 IE_GPU gqa_f8e4m3fnkv tests (dynamic). GQA quant suite is 36/36 across GPU/CPU/INTERPRETER (i8/i4/f8); 356 GPU reorder unit tests green (no regression from the shared-kernel change). Out of scope: the static (ScatterUpdate) f8 path still fails impl selection in add_required_reorders for the fp8 dtype (i8/i4 static pass); tracked as a follow-up. No static f8 GQA test is added here.
Mirror of the i8/i4 review feedback for the f8e4m3 dynamic path: - slice_gpu_f8e4m3.bfyx - f8 Slice output (dynamic Slice+Concat path). - concat_gpu.dynamic_f8e4m3 - f8 Concat in/out on a dynamic shape (as GQA uses it). Both cover the f8 primitive paths enabled for a quantized KV cache. ScatterUpdate f8 is not tested here as the static (ScatterUpdate) f8 path is out of scope / a documented follow-up.
- Use a named tolerance_bits constant instead of a bare magic number in run(). - Annotate the f8e4m3fn test tensors with their shapes.
7015b83 to
7e2d888
Compare
…o, add f8 scatter test - Guard f8_utils.cl includes behind the f8e4m3 jit flag in the concatenation/ scatter_update/slice ref kernels so it is not pulled in (and does not bloat the kernel binary) when the input is not f8e4m3. - Rename INPUT0_IS_FP8/INPUT2_IS_FP8 jit macros to *_IS_F8E4M3 since only f8e4m3 is handled. - Add an f8e4m3 scatter_update unit test.
CI Doctor — Merge Queue failure on this PRPipeline: Windows (VS 2022, Python 3.11, Release) Possible remedy
What happenedThe JS API E2E test job ( This is a recurring known pattern — same failure seen 5 previous times on PRs #36780, #36763, #36796, #36887, #36888.
|
Follow-up to the openvinotoolkit#36806 review: adds a uint8 Slice case (values above the int8 range) next to the existing slice_gpu_i8 test, covering the u8 output path used by the quantized-KV GroupQueryAttention Slice+Concat assembly.
Details:
Enables the com.microsoft
GroupQueryAttentionop with an f8e4m3fn quantized KV cache on theIntel GPU plugin, for the dynamic (Slice+Concat) cache-assembly path. This extends the i8/i4 GPU
support (#36751, #36798) to fp8. f8e4m3fn KV is part of the com.microsoft GQA spec
(
T_CACHE = {float, float16, bfloat16, uint8, int8, float8e4m3fn}, scalesT_KV_SCALE = tensor(float),symmetric, ±448 clamp) and already worked on CPU/TEMPLATE via the device-agnostic
GroupQueryAttentionDecomposition; only GPU primitive gaps remained.Spec reference: https://github.com/microsoft/onnxruntime/blob/main/docs/ContribOperators.md#commicrosoftgroupqueryattention
fp8e4m3_tis a 1-byte struct with no arithmetic/convert overloads, so beyond widening thesupported-type lists the reference kernels needed fp8-aware handling (all GPU-plugin-local; core op
and decomposition untouched):
f8_utils.clfor thefp8e4m3_ttypedef,and on the identity (no-activation) store copy the byte directly when the tensor is fp8 —
ACTIVATION/TO_OUTPUT_TYPEdon't compile on the struct. Gated by anINPUT*_IS_F8E4M3jit flag(the
f8_utils.clinclude is guarded on it, so it is not pulled into — and does not bloat —non-fp8 kernels); non-fp8 paths are textually unchanged.
(b) a non-float input reordered to fp8 encodes from
floatto resolve the ambiguous fp8-encoderoverload. Both gated on fp8 flags.
f8e4m3to the Slice/Concat/ScatterUpdate impl and kernel supported-type lists.Tests: un-skip the 2
IE_GPU.onnx_model_gqa_f8e4m3fnkv_{per_channel,per_tensor}conformance tests(present KV checked bit-exact, float output by ULP tolerance). GQA quantized-KV suite is 36/36
across IE_GPU / IE_CPU / INTERPRETER (i8/i4/f8); a dedicated
scatter_update_gpu_f8e4m3unit testcovers the fp8 scatter byte-copy path, and 356 GPU reorder unit tests remain green (the
shared-kernel change is a regression-safe, fp8-gated addition).
Out of scope / follow-up: the static (ScatterUpdate) f8 path still fails implementation selection
in
add_required_reordersfor the fp8 dtype (i8/i4 static pass through the same path unchanged); itis tracked as a separate follow-up and no static f8 GQA test is added here.
Builds on #36798 (int8/int4 GPU GQA), now merged to master; this PR is rebased on top.
Tickets:
AI Assistance: