EnzymeAD / EnzymeAD/Reactant.jl
Should we overlay `Array{T, N}(.....)` to return TracedRArray if T is TracedNumber
- Dominant language
- Julia
- Stars
- 370
- Forks
- 74
- Avg merge
- 18h 47m
- Merged PRs (30d)
- 30
Description
Most dispatches in Base from OOP version to in place versions look like
```julia
julia> function fn(x::AbstractArray{T}) where {T}
y = Array{T, 2}(undef, 2, 3)
y .= 1
return y
end
fn (generic function with 1 method)
julia> @code_hlo fn(ConcreteRArray(rand(3, 4)))
module {
func.func @main(%arg0: tensor<4x3xf64>) -> tensor {
%cst = stablehlo.constant dense<1.000000e+00> : tensor
return %cst : tensor
}
}
julia> @jit fn(ConcreteRArray(rand(3, 4)))
2025-01-24 11:39:07.909842: I external/xla/xla/service/llvm_ir/llvm_command_line_options.cc:50] XLA (re)initializing LLVM with options fingerprint: 10619666526029654205
2×3 Matrix{ConcreteRNumber{Float64}}:
ConcreteRNumber{Float64}(1.0) ConcreteRNumber{Float64}(1.0) ConcreteRNumber{Float64}(1.0)
ConcreteRNumber{Float64}(1.0) ConcreteRNumber{Float64}(1.0) ConcreteRNumber{Float64}(1.0)
```
This means we have to manually rewrite the out of place version to construct a SoA instead of the default AoS and call the in place version.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.