@@ -146,22 +146,74 @@ Base.one(::Type{<:CuTracedRNumber{T,A}}) where {T,A} = one(T)
146
146
Base. zero (a:: CuTracedRNumber ) = zero (a[])
147
147
Base. zero (:: Type{<:CuTracedRNumber{T,A}} ) where {T,A} = zero (T)
148
148
149
- function Base. promote_rule (
150
- :: Type{<:CuTracedRNumber{T}} , :: Type{<:CuTracedRNumber{T2}}
149
+ Base. @nospecializeinfer function Base. promote_rule (
150
+ @nospecialize (a:: Type{<:CuTracedRNumber{T}} ),
151
+ @nospecialize (b:: Type{<:CuTracedRNumber{T2}} )
151
152
) where {T,T2}
152
153
return Base. promote_rule (T, T2)
153
154
end
154
- function Base. promote_rule (:: Type{Any} , :: Type{<:CuTracedRNumber} )
155
+ Base. @nospecializeinfer function Base. promote_rule (
156
+ :: Type{Any} , @nospecialize (b:: Type{<:CuTracedRNumber} )
157
+ )
155
158
return Any
156
159
end
157
- function Base. promote_rule (:: Type{<:CuTracedRNumber} , :: Type{Any} )
160
+ Base. @nospecializeinfer function Base. promote_rule (
161
+ @nospecialize (a:: Type{<:CuTracedRNumber} ), :: Type{Any}
162
+ )
158
163
return Any
159
164
end
160
- function Base. promote_rule (:: Type{T2} , :: Type{<:CuTracedRNumber{T}} ) where {T,T2}
161
- return Base. promote_rule (T, T2)
165
+ Base. @nospecializeinfer function Base. promote_rule (
166
+ @nospecialize (T2:: Type ), @nospecialize (b:: Type{<:CuTracedRNumber{T}} )
167
+ ) where {T}
168
+ if T == T2
169
+ return T
170
+ else
171
+ return Base. promote_rule (T, T2)
172
+ end
162
173
end
163
- function Base. promote_rule (:: Type{<:CuTracedRNumber{T}} , :: Type{T2} ) where {T,T2}
164
- return Base. promote_rule (T, T2)
174
+ Base. @nospecializeinfer function Base. promote_rule (
175
+ @nospecialize (a:: Type{<:CuTracedRNumber{T}} ), @nospecialize (T2:: Type )
176
+ ) where {T}
177
+ if T == T2
178
+ return T
179
+ else
180
+ return Base. promote_rule (T, T2)
181
+ end
182
+ end
183
+
184
+ Base. @nospecializeinfer function Reactant. promote_traced_type (
185
+ @nospecialize (a:: Type{<:CuTracedRNumber{T,A}} ),
186
+ @nospecialize (b:: Type{<:CuTracedRNumber{T2,A}} )
187
+ ) where {T,T2,A}
188
+ return CuTracedRNumber{Reactant. promote_traced_type (T, T2),A}
189
+ end
190
+ Base. @nospecializeinfer function Reactant. promote_traced_type (
191
+ :: Type{Any} , @nospecialize (b:: Type{<:CuTracedRNumber} )
192
+ )
193
+ return Any
194
+ end
195
+ Base. @nospecializeinfer function Reactant. promote_traced_type (
196
+ @nospecialize (a:: Type{<:CuTracedRNumber} ), :: Type{Any}
197
+ )
198
+ return Any
199
+ end
200
+ Base. @nospecializeinfer function Reactant. promote_traced_type (
201
+ @nospecialize (T2:: Type ), :: Type{<:CuTracedRNumber{T,A}}
202
+ ) where {T,A}
203
+ if T == T2
204
+ return CuTracedRNumber{T,A}
205
+ else
206
+ return CuTracedRNumber{Reactant. promote_trace_type (T, T2),A}
207
+ end
208
+ end
209
+ Base. @nospecializeinfer function Reactant. promote_traced_type (
210
+ :: Type{<:CuTracedRNumber{T,A}} , @nospecialize (T2:: Type )
211
+ ) where {T,A}
212
+ if T == T2
213
+ return CuTracedRNumber{T,A}
214
+ else
215
+ return CuTracedRNumber{Reactant. promote_trace_type (T, T2),A}
216
+ end
165
217
end
166
218
167
219
function Base. show (io:: IO , a:: AT ) where {AT<: CuTracedArray }
0 commit comments