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