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