Skip to content

test: measure CSC decompression allocations behind a function barrier - #358

Merged
gdalle merged 1 commit into
JuliaDiff:mainfrom
gdalle-bot:gd/fix-csc-allocations
Oct 28, 2026
Merged

gdalle merged 1 commit into
JuliaDiff:mainfrom
gdalle-bot:gd/fix-csc-allocations

Conversation

@gdalle-bot

@gdalle-bot gdalle-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Important

This PR was generated by a coding agent, please disregard it until @gdalle has reviewed it.

Fixes the @allocated failures in test/decompression.jl (lines 54 and 174) on Julia 1.10 and 1.11, which have made main CI red since #353/#354.

Diagnosis

The package code does not allocate: calling decompress_csc! with a concretely typed result gives 0 bytes on 1.10–1.13, views included.

The allocations come from the tests. coloring returns a Union{StarSetColoringResult,TreeSetColoringResult} (the decompression mode is a keyword), so each decompress_csc! call in the test function is union-split. For the line 54 call (ComplexF64 view output, Float64 view input), the TreeSetColoringResult branch has no matching method (it requires equal eltypes) and compiles to a dynamic call. That branch is never taken, but on Julia < 1.12 it still forces the SubArray arguments to be heap-allocated (64 bytes). Julia 1.12+ no longer does this. The line 174 failure on 1.11 is the same pattern with view arguments.

Fix

Add a small allocated_decompress_csc! helper and route the four @allocated decompress_csc!(...) checks through it. The helper is a function barrier, so allocations are measured with concrete argument types, which is what users with a concrete result type see.

Local checks

  • test/decompression.jl passes on Julia 1.10, 1.11, 1.12 and 1.13 (it failed on 1.10 with 360 failures before).

Note: CI will still show the unrelated SuiteSparse download errors (MatrixDepot.DataError, server returns 403), tracked in #356 / #357.

Model: Claude Opus 5.5

🤖 Generated with Claude Code

https://claude.ai/code/session_01NohyV4o3EsFGSzxSYqoZrN

`coloring` returns a `Union` of star and tree results. On Julia < 1.12, the
never-taken branch of the split `decompress_csc!` call is a dynamic call
(e.g. no tree method for mixed eltypes), which heap-allocates view arguments
and makes the `@allocated` checks report 64 bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NohyV4o3EsFGSzxSYqoZrN
@gdalle
gdalle marked this pull request as ready for review October 28, 2026 14:30
@gdalle
gdalle merged commit aa7ac0b into JuliaDiff:main Oct 28, 2026
3 of 7 checks passed
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.22%. Comparing base (f0bb3b6) to head (24d9cdf).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #358   +/-   ##
=======================================
  Coverage   46.22%   46.22%           
=======================================
  Files          20       20           
  Lines        2533     2533           
=======================================
  Hits         1171     1171           
  Misses       1362     1362           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants