[Engine] SYCL: make the prompt attention's query batch a switch, and measure it
The prompt path runs the decode-shaped FP32 attention kernel `attn_batch` queries per launch (the tensor-core kernel is opt-in and 2.9x slower here, see qsa_prompt_attn_parity). 32 was chosen for a vector-matrix kernel; on 2x Arc Pro B65 more queries per launch give it more to overlap. Measured on Qwen3.8-Flash-Next IQ3_S, 16,380-token prompt, second request in the process (STRATA_PREFILL_TIMING): | attn_batch | qsa attn | prefill | | ---: | ---: | ---: | | 32 (default) | 2,572 ms (23.0%) | 1,294 tok/s | | 64 | 2,492 ms | 1,309 | | 128 | 2,448 ms | 1,316 | | 256 | 2,422 ms | 1,315 | | 512 | 2,409 ms (22.0%) | 1,319 | So the switch is worth ~2% and the default stays 32 (the difference is inside the run-to-run spread on one pair of runs); STRATA_ATTN_BATCH=512 is the measured best for a long prompt. The kernel itself is the problem: it is 1-4% of the card's fp16 peak at long context, and the XMX port is correct (2e-6 against FP64 in qsa_prompt_attn_parity) but 3x slower, using 122,880 of 131,072 bytes of local memory for its 64-cell layout (mode 32 halves that to 86,784 and is slower still).
This commit is contained in:
1 parent
d56565ce39
commit
f7570e23e2
1 file changed
+5
-1
@@ -734,7 +734,11 @@ struct Prefill::Impl {
|
||||
float* sel_scores = nullptr; // [sel_batch, max_blocks]
|
||||
int64_t sel_batch = 256, max_blocks = 0;
|
||||
float* attn_scratch = nullptr;
|
||||
int64_t attn_batch = 32, cap = 0;
|
||||
int64_t attn_batch = [] { // SYCL port: how many queries the prompt path hands the FP32 attention kernel at once
|
||||
const char* v = std::getenv("STRATA_ATTN_BATCH"); // (the tensor-core kernel is opt-in and slower here)
|
||||
const long long n = v ? std::atoll(v) : 32; // 32 was picked for a vector-matrix kernel; more queries
|
||||
return (n >= 1 && n <= 1024) ? (int64_t) n : 32LL; // per launch give it more to overlap. Scratch grows too.
|
||||
}(), cap = 0;
|
||||
// MoE
|
||||
float *logits = nullptr, *w = nullptr, *GU = nullptr, *Dm = nullptr, *sgate = nullptr, *sup = nullptr,
|
||||
*shared = nullptr, *sg = nullptr;
|
||||
|
||||
Reference in new issue
Block a user