-
Notifications
You must be signed in to change notification settings - Fork 96
Fix test failures on Julia 1.12 and improve version compatibility #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix test failures on Julia 1.12 and improve version compatibility #833
Conversation
CI Status NotesVersionVigilante: Fixed with version bump to 1.72.7. Julia 1 CI (94 errored): All errors are from Zygote downstream: The "Unexpected Pass" errors are actually a positive outcome — Zygote had Yota: Passes. |
|
I'm not sure, maybe this should be considered a bug with testing rather than a bug in the rules. AD doesn't guarantee that primal values are exactly identical to the values obtained without AD. So is it actually problematic and violating any guarantees if a function returns |
- Fix `_matfun` to return correct wrapper types matching Julia's behavior:
- Hermitian{ComplexF64} with real output → Hermitian (all versions)
- Hermitian{Float64} with real output → Hermitian (1.12+), Symmetric (<1.12)
- Real input with complex output → Symmetric (all versions)
- Complex input with complex output → Matrix (all versions)
- Fix GPU test failures from Julia 1.12's scalar-indexing matmul fast path:
- Increase Diagonal and muladd test matrix sizes from 3 to 4
- Mark tr GPU tests as @gpu_broken on Julia 1.12+ only
- Fix sortslices rrule inference test failures (ntuple union type)
- Update symmetric test type unions and use ≈ instead of == for value checks
- Bump version to 1.72.7
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
34bdb2b to
1be77c1
Compare
|
Is that really better though? Is there a reason to not just match the primal? |
|
The reason is that it seems brittle (as shown, the behaviour is not even consistent across Julia versions), makes the code more complex and could become broken again at any point - without any clear benefit. None of the result types seem to be superior, neither |
|
stricter matrix types are better when possible, linearalgebra and chainrules should both get stricter returns over time |
|
The clear benefit is numerical stability... |
|
It shouldn't matter whether a matrix is a |
1 similar comment
|
It shouldn't matter whether a matrix is a |
|
Definitely depends. In ExponentialUtilities.jl it would miss some branches that would improve it. |
Summary
Fixes test failures on Julia 1.12 (nightly) and Julia 1 (stable) while maintaining backward compatibility with Julia 1.6.
_matfunreturn type fix (src/rulesets/LinearAlgebra/symmetric.jl)Julia 1.12 changed matrix functions on
Hermitian{Float64}to returnHermitianinstead ofSymmetric. The_matfunfunction (which recomputes matrix functions via eigen decomposition for AD) now matches Julia's native return types:Hermitian{ComplexF64}with real output →Hermitian(all versions, fixes conjugate vs mirror symmetry bug)Hermitian{Float64}with real output →Hermitian(1.12+),Symmetric(<1.12)Symmetric(all versions)Matrix(all versions)GPU test fixes (
test/rulesets/Base/arraymath.jl,test/rulesets/LinearAlgebra/dense.jl)Julia 1.12 added a
matmul2x2or3x3_nonzeroalpha!fast path in LinearAlgebra that uses scalar indexing, incompatible with GPU arrays (JLArrays):trGPU tests marked@gpu_brokenon Julia 1.12+ only (upstreamLinearAlgebra.truses scalar indexing)sortslices inference fix (
test/rulesets/Base/sort.jl)ntuplewith a conditional (ColonvsVector) produces a union type that Julia 1.12 can no longer fully narrow. Addedcheck_inferred=falseconsistent with the existing 3D test case.Test updates (
test/rulesets/LinearAlgebra/symmetric.jl)@test Y_ad == Yto@test Y_ad ≈ Yfor value comparisons@maybe_inferredtype unions to includeHermitianvariantsCI Results
Test plan
_matfunreturn types across all input combinationsGenerated with Claude Code