Skip to content

Inbounds decompression - #355

Open
blegat wants to merge 4 commits into
JuliaDiff:mainfrom
blegat:inbounds-decompression
Open

blegat wants to merge 4 commits into
JuliaDiff:mainfrom
blegat:inbounds-decompression

Conversation

@blegat

@blegat blegat commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Needs this one to be merged first, I'll rebase afterwards (so at the moment the diff contains both):

Add @inbounds to the CSC recovery loops and propagate it through the shared write helper with Base.@propagate_inbounds.

Fresh median timings for the same benchmark as #354:

Implementation Recovery only Full Hessian
Legacy MOI 98.07 μs 507.54 μs
SMC main 243.47 μs 666.90 μs
#354 137.98 μs 520.81 μs
This PR 88.59 μs 502.87 μs

On Julia 1.13.1 with Intel i7-12700K.

@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.38%. Comparing base (d88e142) to head (3cc18b5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #355   +/-   ##
=======================================
  Coverage   99.37%   99.38%           
=======================================
  Files          22       22           
  Lines        2577     2592   +15     
=======================================
+ Hits         2561     2576   +15     
  Misses         16       16           

☔ 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.

@blegat
blegat force-pushed the inbounds-decompression branch from 6ad8f5e to 904c203 Compare October 22, 2026 13:32

@gdalle gdalle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've had this discussion with @amontoison in the past and I'm very uncomfortable adding @inbounds to a loop without previously checking that all indexing falls in the proper range. However I think this could be an opportunity to tighten our typing, and maybe put Vectors everywhere we can, to simplify this kind of verification (there are lots of places where AbstractVectors are accepted but really shouldn't be).

@blegat
blegat force-pushed the inbounds-decompression branch from 544fe40 to 984adab Compare October 28, 2026 08:54
@blegat

blegat commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

The tricky thing is to check that the CSC structure is satisfied. I tried adding an explicit loop and a first step but that was too expensive. What's best is to check bounds just for nzA and keep @inbounds for the others:

Pattern Current Checks bounds just for nzA Verify nzA upfront
Chain, 65,536 vertices 186.4 188.9 277.6
Random, 4,096 vertices 124.0 123.8 173.8
Star, 65,536 vertices 60.6 60.8 112.

This branch has not been deployed

No deployments
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