class gridDim(Stub): '''gridDim.{x, y} ''' _description_ = '<gridDim.{x,y,z}>' x = macro.Macro('nctaid.x', SREG_SIGNATURE) y = macro.Macro('nctaid.y', SREG_SIGNATURE) z = macro.Macro('nctaid.z', SREG_SIGNATURE)
class threadIdx(Stub): '''threadIdx.{x, y, z} ''' _description_ = '<threadIdx.{x,y,z}>' x = macro.Macro('tid.x', SREG_SIGNATURE) y = macro.Macro('tid.y', SREG_SIGNATURE) z = macro.Macro('tid.z', SREG_SIGNATURE)
class blockIdx(Stub): '''blockIdx.{x, y} ''' _description_ = '<blockIdx.{x,y,z}>' x = macro.Macro('ctaid.x', SREG_SIGNATURE) y = macro.Macro('ctaid.y', SREG_SIGNATURE) z = macro.Macro('ctaid.z', SREG_SIGNATURE)
class gridDim(Stub): ''' The shape of the grid of blocks, accressed through the attributes ``x``, ``y``, and ``z``. ''' _description_ = '<gridDim.{x,y,z}>' x = macro.Macro('nctaid.x', SREG_SIGNATURE) y = macro.Macro('nctaid.y', SREG_SIGNATURE) z = macro.Macro('nctaid.z', SREG_SIGNATURE)
class blockDim(Stub): ''' The shape of a block of threads, as declared when instantiating the kernel. This value is the same for all threads in a given kernel, even if they belong to different blocks (i.e. each block is "full"). ''' x = macro.Macro('ntid.x', SREG_SIGNATURE) y = macro.Macro('ntid.y', SREG_SIGNATURE) z = macro.Macro('ntid.z', SREG_SIGNATURE)
class blockIdx(Stub): ''' The block indices in the grid of thread blocks, accessed through the attributes ``x``, ``y``, and ``z``. Each index is an integer spanning the range from 0 inclusive to the corresponding value of the attribute in :attr:`numba.cuda.gridDim` exclusive. ''' _description_ = '<blockIdx.{x,y,z}>' x = macro.Macro('ctaid.x', SREG_SIGNATURE) y = macro.Macro('ctaid.y', SREG_SIGNATURE) z = macro.Macro('ctaid.z', SREG_SIGNATURE)
class const(Stub): '''shared namespace ''' _description_ = '<const>' array_like = macro.Macro('const.array_like', const_array_like, callable=True, argnames=['ary'])
class local(Stub): '''shared namespace ''' _description_ = '<local>' array = macro.Macro('local.array', local_array, callable=True, argnames=['shape', 'dtype'])
class shared(Stub): """shared namespace """ _description_ = '<shared>' array = macro.Macro('shared.array', shared_array, callable=True, argnames=['shape', 'dtype'])
class const(Stub): ''' Constant memory namespace. ''' _description_ = '<const>' array_like = macro.Macro('const.array_like', const_array_like, callable=True, argnames=['ary']) '''
class blockDim(Stub): '''blockDim.{x, y, z} ''' x = macro.Macro('ntid.x', SREG_SIGNATURE) y = macro.Macro('ntid.y', SREG_SIGNATURE) z = macro.Macro('ntid.z', SREG_SIGNATURE)
return x, y """ if ndim == 1: fname = "ptx.grid.1d" restype = types.int32 elif ndim == 2: fname = "ptx.grid.2d" restype = types.UniTuple(types.int32, 2) else: raise ValueError('argument can only be 1 or 2') return ir.Intrinsic(fname, typing.signature(restype, types.intp), args=[ndim]) grid = macro.Macro('ptx.grid', grid_expand, callable=True) #------------------------------------------------------------------------------- # Gridsize Macro def gridsize_expand(ndim): """gridsize(ndim) ndim: [int] 1 or 2 if ndim == 1: return cuda.blockDim.x * cuda.gridDim.x elif ndim == 2: x = cuda.blockDim.x * cuda.gridDim.x y = cuda.blockDim.y * cuda.gridDim.y return x, y
y = macro.Macro('ntid.y', SREG_SIGNATURE) z = macro.Macro('ntid.z', SREG_SIGNATURE) class gridDim(Stub): ''' The shape of the grid of blocks, accressed through the attributes ``x``, ``y``, and ``z``. ''' _description_ = '<gridDim.{x,y,z}>' x = macro.Macro('nctaid.x', SREG_SIGNATURE) y = macro.Macro('nctaid.y', SREG_SIGNATURE) z = macro.Macro('nctaid.z', SREG_SIGNATURE) warpsize = macro.Macro('warpsize', SREG_SIGNATURE) laneid = macro.Macro('laneid', SREG_SIGNATURE) #------------------------------------------------------------------------------- # Grid Macro def _ptx_grid1d(): pass def _ptx_grid2d(): pass def grid_expand(ndim):