JuliaDiff / JuliaDiff/ChainRules.jl
`@fastmath maximum` broken on 1.10
Open
Nobody has claimed this yet.
missing rule
- Dominant language
- Julia
- Stars
- 475
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
julia> using Zygote, BenchmarkTools
julia> @macroexpand1 @fastmath maximum(x) # this is new
:(Base.FastMath.maximum_fast(x))
julia> VERSION
v"1.10.0-DEV.421"
julia> gradient(x -> sum(maximum(x; dims=1)), [1,3,2])
([0.0, 1.0, 0.0],)
julia> @fastmath gradient(x -> sum(maximum(x; dims=1)), [1,3,2])
ERROR: Mutating arrays is not supported -- called setindex!(Vector{Int64}, ...)
julia> @btime gradient(x -> maximum(x), $([1,3,2]))
min 1.113 μs, mean 1.214 μs (15 allocations, 528 bytes)
([0.0, 1.0, 0.0],)
julia> @btime @fastmath gradient(x -> maximum(x), $([1,3,2])) # also misses the rule
min 28.541 μs, mean 29.743 μs (159 allocations, 5.94 KiB)
([0.0, 1.0, 0.0],)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the shown Julia commands involving Zygote, @fastmath, and maximum, then trace the handling of Base.FastMath.maximum_fast and the gradient rule. Done means @fastmath gradient calls match ordinary maximum gradients without the mutation error or missed rule.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100