core: the second lane's scratch region sized by the ops it may issue

A program naming a buffer to rad_buf_concurrent got two scratch regions of the program's largest kernel
scratch each, though by Ctx::lane1_ rule 3 an op on the second lane touches only rad_buf_concurrent
buffers. Program::scratch_bytes_lane1 is the largest device scratch of such an op (or one naming no
transient buffer); the Arena takes per-region sizes, arena_plan_bytes counts them for the VRAM budget,
and Ctx::issue refuses a larger lane-1 request by name instead of overrunning the region. Qwen3.8 with
its drafter: region 1 0 B instead of 50 MiB (17 MiB without speculation).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
mici81andClaude Opus 5.5 authored and StillDeadcode committed 2026-10-24 11:10:08 +02:00
1 parent 5838c25343
commit 0c813784a0
8 files changed
+125 -15

No files matched your search

+2
View File
@@ -1895,6 +1895,8 @@ TEST(the_logits_pooled_and_concurrent_buffers_live_past_their_declared_uses) {
CHECK_EQ(by->first_def, 0);
CHECK_EQ(by->last_use, 4);
CHECK_EQ(p.scratch_regions, 2);
/* The second lane's region is bounded by the ops it may issue, never the larger. */
CHECK(p.scratch_bytes_lane1 >= 0 && p.scratch_bytes_lane1 <= p.scratch_bytes);
/* Without the extension y (op 4) would take the bytes the output (op 1) left. */
CHECK(by->arena_offset >= bo->arena_offset + bo->bytes ||
bo->arena_offset >= by->arena_offset + by->bytes);