You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this has something to do with the fact that there is no specialized implementation for TracedRNumbers and the generic implementation does comparisons between a and b.
(cc @mofeing)
using Reactant
functionf(a, b)
it =collect(a:b)
return it
end
a, b =ConcreteRNumber(1), ConcreteRNumber(3)
@code_hlof(a, b)
Adding a new method for Base.:(:) on TracedRNumber seems to fix it:
julia> Base.:(:)(start::TracedRNumber{T}, stop::TracedRNumber{T}) where {T} =UnitRange{TracedRNumber{T}}(start, stop)
julia>functionf(a,b)
x =zero(a)
@tracefor i in a:b
x += i
endreturn x
end
f (generic function with 1 method)
julia> a =ConcreteRNumber(1)
ConcretePJRTNumber{Int64, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}}(1)
julia> b =ConcreteRNumber(4)
ConcretePJRTNumber{Int64, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}}(4)
julia> fre =@compilef(a,b)
Reactant.Compiler.Thunk{typeof(f), Symbol("##f_reactant#244"), Tuple{ConcretePJRTNumber{Int64, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}}, ConcretePJRTNumber{Int64, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}}}, false}(f)
julia>fre(a,b)
ConcretePJRTNumber{Int64, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}}(10)
julia>1+2+3+410
I believe this has something to do with the fact that there is no specialized implementation for TracedRNumbers and the generic implementation does comparisons between
a
andb
.(cc @mofeing)
The text was updated successfully, but these errors were encountered: