@@ -43,21 +43,26 @@ also query what the grid and threadgroup sizes are as well.
4343For Metal.jl, these values are accessed via the following functions:
4444
4545- ` thread_index_in_threadgroup() `
46- - ` grid_size_Xd ()`
47- - ` thread_position_in_grid_Xd ()`
48- - ` thread_position_in_threadgroup_Xd ()`
49- - ` threadgroup_position_in_grid_Xd ()`
50- - ` threadgroups_per_grid_Xd ()`
51- - ` threads_per_grid_Xd ()`
52- - ` threads_per_threadgroup_Xd ()`
46+ - ` grid_size ()`
47+ - ` thread_position_in_grid ()`
48+ - ` thread_position_in_threadgroup ()`
49+ - ` threadgroup_position_in_grid ()`
50+ - ` threadgroups_per_grid ()`
51+ - ` threads_per_grid ()`
52+ - ` threads_per_threadgroup ()`
5353
54- * Where 'X' is 1, 2, or 3 according to the number of dimensions requested.*
54+ !!! note
55+ Prior to Metal.jl v1.9, the aforementioned indexing intrinsics had a ` _Xd ` suffix,
56+ where 'X' was 1, 2, or 3 according to the number of dimensions requested.
57+
58+ These methods are deprecated and it is now recommended to use the version without a suffix,
59+ which behaves like the `_3d` version.
5560
5661Using these in a kernel (taken directly from the [ vadd example] ( https://github.com/JuliaGPU/Metal.jl/blob/main/examples/vadd.jl ) ):
5762
5863``` julia
5964function vadd (a, b, c)
60- i = thread_position_in_grid_1d ()
65+ i = thread_position_in_grid () . x
6166 c[i] = a[i] + b[i]
6267 return
6368end
0 commit comments