File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import KernelAbstractions:
25
25
__index_Global_Linear,
26
26
__groupsize,
27
27
__groupindex,
28
+ __validindex,
28
29
Backend,
29
30
synchronize
30
31
@@ -219,8 +220,10 @@ function gpu_aug_fwd(
219
220
220
221
# On the GPU: F is a per thread function
221
222
# On the GPU: subtape::Vector
222
- I = __index_Global_Linear (ctx)
223
- subtape[I] = forward (Const (f), Const (ctx), args... )[1 ]
223
+ if __validindex (ctx)
224
+ I = __index_Global_Linear (ctx)
225
+ subtape[I] = forward (Const (f), Const (ctx), args... )[1 ]
226
+ end
224
227
return nothing
225
228
end
226
229
@@ -241,9 +244,11 @@ function gpu_rev(
241
244
Const{Core. Typeof (ctx)},
242
245
map (Core. Typeof, args)... ,
243
246
)
244
- I = __index_Global_Linear (ctx)
245
- tp = subtape[I]
246
- reverse (Const (f), Const (ctx), args... , tp)
247
+ if __validindex (ctx)
248
+ I = __index_Global_Linear (ctx)
249
+ tp = subtape[I]
250
+ reverse (Const (f), Const (ctx), args... , tp)
251
+ end
247
252
return nothing
248
253
end
249
254
You can’t perform that action at this time.
0 commit comments