@@ -189,6 +189,10 @@ function unsafe_free! end
189
189
190
190
unsafe_free! (:: AbstractArray ) = return
191
191
192
+ include (" intrinsics.jl" )
193
+ import . KernelIntrinsics
194
+ export KernelIntrinsics
195
+
192
196
# ##
193
197
# Kernel language
194
198
# - @localmem
@@ -447,13 +451,27 @@ end
447
451
# Internal kernel functions
448
452
# ##
449
453
450
- function __index_Local_Linear end
451
- function __index_Group_Linear end
452
- function __index_Global_Linear end
454
+ function __index_Local_Linear (ctx)
455
+ return KernelIntrinsics . get_local_id () . x
456
+ end
453
457
454
- function __index_Local_Cartesian end
455
- function __index_Group_Cartesian end
456
- function __index_Global_Cartesian end
458
+ function __index_Group_Linear (ctx)
459
+ return KernelIntrinsics. get_group_id (). x
460
+ end
461
+
462
+ function __index_Global_Linear (ctx)
463
+ return KernelIntrinsics. get_global_id (). x
464
+ end
465
+
466
+ function __index_Local_Cartesian (ctx)
467
+ return @inbounds workitems (__iterspace (ctx))[KernelIntrinsics. get_local_id (). x]
468
+ end
469
+ function __index_Group_Cartesian (ctx)
470
+ return @inbounds blocks (__iterspace (ctx))[KernelIntrinsics. get_group_id (). x]
471
+ end
472
+ function __index_Global_Cartesian (ctx)
473
+ return @inbounds expand (__iterspace (ctx), KernelIntrinsics. get_group_id (). x, KernelIntrinsics. get_local_id (). x)
474
+ end
457
475
458
476
@inline __index_Local_NTuple (ctx, I... ) = Tuple (__index_Local_Cartesian (ctx, I... ))
459
477
@inline __index_Group_NTuple (ctx, I... ) = Tuple (__index_Group_Cartesian (ctx, I... ))
0 commit comments