Repository navigation
Fix #145: KernelAbstractions >= 0.10.3, drop the 320 B/launch CPU allocation allowance - #171
Conversation
…ocation allowance KA 0.10.3+ launches allocation-free on the CPU backend (measured 0 B for a warmed trivial and @LocalMem kernel on 0.10.3 and 0.10.4, 1 and 4 threads, with and without coverage; 0.10.0 allocates 96 B). The fixed 320 B/launch term of `ka_cpu_alloc_budget` made the numeric/solve budgets ~40x too loose and hid real allocations. Raise the compat bound (Project.toml, test/Project.toml), keep the 1024 B base and the coverage term, update the docstrings and AGENTS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MsLzHmUtWpQYEoF8pxgywZ
| that is 0: a warmed launch on the KernelAbstractions ≥ 0.10.3 CPU backend | ||
| allocates nothing (measured for #145 on KA 0.10.3 and 0.10.4, trivial and | ||
| `@localmem` kernels, 1 and 4 threads). With `--code-coverage` (CI's | ||
| `julia-runtest`) the `@localmem` `MArray`s may be heap-allocated (T09 review | ||
| round 1), hence `localmem_bytes` plus 64 B of header per launch. KA 0.10.0–0.10.2 | ||
| heap-allocated on every launch (96 B measured with a trivial kernel, ~230 B in | ||
| PR #133), which a 320 B/launch allowance covered; that allowance hid real | ||
| allocations of the numeric phase (~40 KB of headroom for a 500×500 matrix), so |
There was a problem hiding this comment.
nit (non-blocking): two numbers here do not match the PR description. The description measures 1 and 4 threads on KA 0.10.4 only (0.10.3 was measured with and without --code-coverage=all), while the docstring folds both into "0.10.3 and 0.10.4 ... 1 and 4 threads". And the headroom for random_spd(500, 0.01) is "~62 KB" in the description but "~40 KB" (the issue's figure) here. Worth aligning so the docstring stays the record of the measurement.
Suggestion, also non-blocking: with the per-launch term gone, a future KA release that allocates per launch again would surface as scattered budget failures across the numeric and solve tests. A single guard test in test_api (or wherever the CPU backend is cheapest), asserting that a warmed trivial launch allocates 0 B, would point at the cause directly and could @test_broken with a note when KA regresses.
There was a problem hiding this comment.
VERDICT: APPROVE (head 9f18281)
Not a task PR: a test-infrastructure fix for #145 (labels claude:pr, chore, testing; no task, no milestone), reviewed against the issue, AGENTS.md and the diff.
Checked
- Scope: four files only (
Project.toml,test/Project.toml,test/utils.jl,AGENTS.md). PLAN.md and TASKS.md untouched, no Manifest.toml. The AGENTS.md edit only updates the session-rules sentence about the KA bound and the allocation budgets to the new state. - Compat:
KernelAbstractions = "0.10.3"in both project files; 0.10.3 and 0.10.4 are registered in General.docs/andbench/carry no KA compat, so nothing else needs the bound. ka_cpu_alloc_budget: the320 * launchesterm is removed; the 1024 B base and the coverage term (localmem_bytes + 64 * launches) are unchanged, so the CI runs withjulia-runtestcoverage keep their allowance. All callers (numeric_alloc_budget,solve_alloc_budget,ldlt_alloc_budget) are unchanged and still passlaunchesandlocalmem_bytes;fused_cycle_alloc_budgetand the GPU budgets do not use the helper, as the description says. No test was weakened: the change only tightens the budgets, and no@test_brokenwas added.- Docstrings: the stale "on KA 0.9" remark in
ldlt_alloc_budgetis gone; theka_cpu_alloc_budgetdocstring records the measurements and the reason for the removal. - PR description vs diff: matches. The CPU test counts are plausible for the listed file subsets without coverage. CI (CPU with coverage, CUDA, AMDGPU, Aurora) is still pending at review time; the GPU legs do not use the helper, and the coverage leg is the one that exercises the remaining term. The owner handles pending checks.
Blocking findings: none.
Non-blocking: one inline nit on the ka_cpu_alloc_budget docstring (two figures differ from the PR description), with a suggestion for a guard test asserting that a warmed trivial launch allocates 0 B, so a future KA regression is attributed directly instead of appearing as scattered budget failures. PLAN.md risks table (line 482) still says the 0.10 backend allocates a fixed amount per launch; that is for the owner to update.
…er-launch allocation The ka_cpu_alloc_budget docstring now records what was measured where (KA 0.10.3 with and without coverage, 0.10.4 with 1 and 4 threads) and the ~62 KB of headroom the old allowance granted for random_spd(500, 0.01). test_helpers asserts that a warmed trivial launch on the KA CPU backend allocates 0 B (64 B under coverage), so a KA release that allocates per launch again names its cause instead of failing budgets across the suite. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MsLzHmUtWpQYEoF8pxgywZ
|
Review nit of 9f18281 addressed in 0a653a7: the |
Closes #145
Not a task PR: a test-infrastructure fix. The budgets of the CPU-backend allocation tests carried a fixed 320 B per kernel launch for KernelAbstractions 0.10, measured on 0.10.0; on the KA that CI resolves a launch allocates nothing, so every numeric- and solve-phase budget was ~40× too loose (~62 KB of headroom for one
factorize!ofrandom_spd(500, 0.01), which let the 32 KB per factorization of the old:kafallbacks pass). T32 (#146) needs budgets that can see such allocations.Measured (CPU backend, Julia 1.13.3, warmed launches of a trivial kernel and of one with 512 B
@localmem, ndrange 64 and 65536): KA 0.10.0 96 B per launch (PR #133 had recorded ~230 B); KA 0.10.3 0 B, with and without--code-coverage=all; KA 0.10.4 0 B with 1 and 4 threads and--code-coverage=user, 100 launches back to back also 0 B. Onefactorize!(impl = :auto, Float64, SPD n = 500, nnz 5430): 512 B steady state, with or without coverage, within the 1024 B base.What changed
Project.toml,test/Project.toml:KernelAbstractions = "0.10.3"(docs/andbench/carry no KA compat).test/utils.jl:ka_cpu_alloc_budgetdrops the320 * launchesterm and keeps the 1024 B base plus the coverage term (localmem_bytes + 64 B/launch); docstring and comment record the measurements and why the allowance went; a stale "on KA 0.9" remark in theldlt_alloc_budgetdocstring removed.AGENTS.md: the session-rules sentence describes the new state (KA ≥ 0.10.3, no per-launch allowance outside coverage runs).Tests (CPU backend only,
SDS_TEST_GPU=0 SDS_TEST_ELTYPES="Float64,ComplexF32", without coverage):test_numeric_cholesky_a,test_numeric_cholesky_b1522 pass;test_numeric_cholesky_c,test_solve584 pass;test_numeric_ldlt,test_numeric_lu1656 pass;test_api1129 pass; 0 fail, 0 broken. No budget failed under the tightened allowance, so no@test_brokenwas added. The coverage term is exercised by CI (julia-runtestwith coverage); CUDA/AMDGPU/oneAPI: pending CI (the GPU budgets,fused_cycle_alloc_budgetincluded, do not useka_cpu_alloc_budget).Deviations from PLAN.md / TASKS.md: none. Note: the 0.10.3 lower bound rests on the standalone launch measurement; the package tests ran against the resolved 0.10.4.
Follow-up issues opened: none.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MsLzHmUtWpQYEoF8pxgywZ