Skip to content

Commit 43fa074

Browse files
okada-shogoclaude
andcommitted
poly: Inkling 2's Turing flash attention keeps away from Q8_0 caches
simplexai-labs#209 sends a Turing prompt batch to ink_flash75_kernel unless the caches are FP8; simplexai-labs#214 adds Q8_0 caches, which that kernel would read as halves (poly_inkling2_kvq8_test on an RTX 2070: ink_attend_batch rel rms nan). With --kv q8_0 on Turing the batch goes to attend_batch() again, simplexai-labs#214's checked path there. Only the combination of the two changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0af636a commit 43fa074

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎engine/src/poly/inkling2.cu‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,8 @@ bool ink_attend_batch(const InkAttn& a, void* stream) {
24632463
cudaFuncAttributes f{};
24642464
return cudaFuncGetAttributes(&f, ink_flash_kernel<1>) == cudaSuccess ? f.ptxVersion : 0;
24652465
}();
2466-
if (ptx < 80) return ptx >= 75 && !a.kv8 && flash75(a, per, stream);
2466+
// Turing: ink_flash75_kernel reads fp16 caches only (FP8 and Q8_0 rows go to attend_batch())
2467+
if (ptx < 80) return ptx >= 75 && !a.kv8 && !a.kvq8 && flash75(a, per, stream);
24672468
const auto launch = [&](auto kernel, int g) {
24682469
const size_t smem = kFlashKv + (size_t) kFlashTokens * g * kFlashRel * sizeof(float);
24692470
const cudaError_t e = cudaFuncSetAttribute(kernel, cudaFuncAttributeMaxDynamicSharedMemorySize, (int) smem);

0 commit comments

Comments
 (0)