Repository navigation
tests: size the flash-attention K/V at the kernel's 64-token tile (engine#2870) - #430
bong-water-water-bong wants to merge 1 commit into
Conversation
…gine#2870) The split-attention rows allocated K/V at exactly key_value_token_count, so the case for kv=65 or kv=513 handed the matcher a cache it refuses by design: dispatch-flash-attention.cpp:387 declines unless key->ne[1] >= ceil(kv/64)*64, the padded capacity engine#2494 introduced after the kv65 page faults. A real cache is allocated to the tile, so the rig now is too. The mask widens with it, and the two kernel-facing expectations move to the capacity, because that is the length the kernel is handed. fa_decode_split.4.513 goes from 1 dispatch on the general wmma kernel to one dispatch per query row on ggml_flash_attention_decode_split_f32_f16_wmma_next_q8, which is what the row asserts.
|
Closing in favour of #433, which fixes the same two failing rows the other way round. The substantive difference: this PR pads K/V and the mask together, so the fixture ends up with #433 keeps the mask logical and pads only the storage, which is the production shape, and it asserts Two things from this PR are still worth keeping and are being carried into #433: the second suite |
…d pin the fallback The split-attention fixtures allocated K/V at exactly key_value_token_count, so the kv=65 and kv=513 cases handed the matcher a cache it refuses by design (engine#2494: key->ne[1] >= ceil(kv/64)*64). A real cache is allocated to the tile, so the rig is now too, and the mask widens with it -- that is the length the kernel is handed. The rows the split arm cannot take (kv not a 64-token multiple, or past the engine#679 cap of 2944) now assert the fallback explicitly instead of failing on the split arm's transients: one launch per query row, none of the split transients, and never the split kernel. Ports the fix from tests/fa-kv-tile-capacity (llama.cpp#430) onto 1bit/hrx-vulkan-patched, whose exported matcher was already renamed, and adds the fallback guard for the 2304/4096/16384 rows #430 leaves out.
The split-attention rows allocated K/V at exactly
key_value_token_count, so the kv=65 and kv=513 cases handed the matcher a cache it refuses by design:dispatch-flash-attention.cpp:387declines unlesskey->ne[1] >= ceil(kv/64)*64— the padded capacity engine#2494 introduced after the kv65 page faults.A real cache is allocated to the tile, so the rig is now too. The mask widens with it, and the two kernel-facing expectations move to the capacity, because that is the length the kernel is handed.
Evidence
fa_decode_split.4.513on gfx1201 (GGML_HRX_GTT_RESERVE_MB=1024,IREE_HAL_AMDGPU_LIBHSA_PATHfrom the SDK):PROBE2870 dispatches=1onloom_libs:ggml_flash_attention_f32_f16_wmma, thenrequirement failed: plan.dispatches.size() == query_token_countggml_flash_attention_decode_split_f32_f16_wmma_next_q8fa_decode_split.4.513.true.96.64.1: rc 0qwen_flash_attentionstill schedulesggml_flash_attention_f32_f16_wmma: that case passesuse_common_dispatch=trueon purpose.Not done here
The
flash_attention.{64,128,192,256,320,384,448,512}.2.65.1group goes throughrun_common_flash_attention_cpu_reference_case, which compares numbers. Padding there also needs the padded mask tail masked out (and the padded K/V slots zeroed) or the comparison reads uninitialised memory; that is a second change and is not in this PR.