6363
6464@device_functions begin
6565
66- """
67- gridDim ()::NamedTuple
66+ @doc """
67+ threadIdx ()::NamedTuple
6868
69- Returns the dimensions of the grid .
70- """
71- @inline gridDim () = (x= gridDim_x (), y = gridDim_y (), z = gridDim_z ())
69+ Returns the thread index within the block .
70+ """ threadIdx
71+ @inline threadIdx () = (x= threadIdx_x (), y = threadIdx_y (), z = threadIdx_z ())
7272
73- """
74- blockIdx ()::NamedTuple
73+ @doc """
74+ blockDim ()::NamedTuple
7575
76- Returns the block index within the grid .
77- """
78- @inline blockIdx () = (x= blockIdx_x (), y = blockIdx_y (), z = blockIdx_z ())
76+ Returns the dimensions (in threads) of the block .
77+ """ blockDim
78+ @inline blockDim () = (x= blockDim_x (), y = blockDim_y (), z = blockDim_z ())
7979
80- """
81- blockDim ()::NamedTuple
80+ @doc """
81+ blockIdx ()::NamedTuple
8282
83- Returns the dimensions of the block .
84- """
85- @inline blockDim () = (x= blockDim_x (), y = blockDim_y (), z = blockDim_z ())
83+ Returns the block index within the grid .
84+ """ blockIdx
85+ @inline blockIdx () = (x= blockIdx_x (), y = blockIdx_y (), z = blockIdx_z ())
8686
87- """
88- threadIdx ()::NamedTuple
87+ @doc """
88+ gridDim ()::NamedTuple
8989
90- Returns the thread index within the block .
91- """
92- @inline threadIdx () = (x= threadIdx_x (), y= threadIdx_y (), z= threadIdx_z ())
90+ Returns the dimensions (in blocks) of the grid .
91+ """ gridDim
92+ @inline gridDim () = (x= gridDim_x (), y= gridDim_y (), z= gridDim_z ())
9393
94- """
94+ @doc """
9595 warpsize()::Int32
9696
9797Returns the warp size (in threads).
98- """
98+ """ warpsize
9999@inline warpsize () = ccall (" llvm.nvvm.read.ptx.sreg.warpsize" , llvmcall, Int32, ())
100100
101- """
101+ @doc """
102102 laneid()::Int32
103103
104104Returns the thread's lane within the warp.
105- """
105+ """ laneid
106106@inline laneid () = ccall (" llvm.nvvm.read.ptx.sreg.laneid" , llvmcall, Int32, ()) + 1 i32
107107
108- """
108+ @doc """
109109 lanemask(pred)::UInt32
110110
111111Returns a 32-bit mask indicating which threads in a warp satisfy the given predicate.
112112Supported predicates are `==`, `<`, `<=`, `>=`, and `>`.
113- """
113+ """ lanemask
114114@inline function lanemask (pred:: F ) where F
115115 if pred === Base.:(== )
116116 ccall (" llvm.nvvm.read.ptx.sreg.lanemask.eq" , llvmcall, UInt32, ())
@@ -127,12 +127,12 @@ Supported predicates are `==`, `<`, `<=`, `>=`, and `>`.
127127 end
128128end
129129
130- """
130+ @doc """
131131 active_mask()
132132
133133Returns a 32-bit mask indicating which threads in a warp are active with the current
134134executing thread.
135- """
135+ """ active_mask
136136@inline active_mask () = @asmcall (" activemask.b32 \$ 0;" , " =r" , false , UInt32, Tuple{})
137137
138138end
0 commit comments