Fix reverse custom-rule rooting for nested sparse wrappers#3073
Fix reverse custom-rule rooting for nested sparse wrappers#3073AshtonSBradley wants to merge 2 commits into
Conversation
|
Your PR no longer requires formatting changes. Thank you for your contribution! |
6484864 to
9b72c2c
Compare
9b72c2c to
fe14659
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3073 +/- ##
==========================================
+ Coverage 66.76% 69.85% +3.08%
==========================================
Files 65 66 +1
Lines 21522 21721 +199
==========================================
+ Hits 14369 15173 +804
+ Misses 7153 6548 -605 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Looks related |
afe8f10 to
d2de4ca
Compare
|
Yes, related. The compiler fix still targets the root-dominance failure, but my first regression test used a parametric I changed the test fixture to use a concrete nested wrapper type instead. That keeps the sparse wrapper/rooting coverage for #3072 without testing the separate parametric-constructor limitation. I also verified the file through the same runner shape:
|
|
I checked the current CI logs after the fixture update. The The sparse regression path now passes in the CI-shaped jobs I inspected:
The remaining failures I saw look unrelated to this patch: several jobs end with |
Summary
SparseMatrixCSCscaledmul!.Explanation
The failure in #3072 came from reverse custom-rule setup reusing the original rooted argument value when boxing a
Duplicated{SparseMatrixCSC}argument. In the nested wrapper reproducer, that root pointer was defined along the forward path, so the reverse-generated load forloaded.roots.primal.SparseMatrixCSC{Float64, Int64}failed LLVM verification because the definition did not dominate the use.This updates rooted argument handling to call
lookup_valueforroots_valin reverse mode, matching how the primal argument value is remapped before being boxed. That keeps the root load anchored to the reverse-pass value map instead of the original forward-path value.The new sparse regression exercises the nested active wrapper case from the issue: a scalar wrapper plus a sparse matrix wrapper passed through scaled
mul!underset_runtime_activity(Reverse). The test checks both the primal result and the expected gradientdp ≈ [-4.0].Notes
_compute_sparamspath underParallelTestRunner.Tests
julia --project=test -e 'include("test/rules/internal_rules/sparsearrays_rules.jl")'SparseArrays spmatvec reverse rule: 4002 passedSparseArrays nested wrapper reverse rule: 2 passedSparseArrays spmatmat reverse rule: 1709 passedjulia --project=test test/runtests.jl rules/internal_rules/sparsearrays_rules --jobs=1 --quickfailOverall: 5713 passed, 5713 total,SUCCESSjulia --project=@runic -e 'using Runic; exit(Runic.main(["--inplace", "test/rules/internal_rules/sparsearrays_rules.jl"]))'git diff --check