Mojo module
id
This module includes grid-related aliases and functions. Most of these are generic, a few are specific to NVIDIA GPUs.
You can import these APIs from the gpu
package. For example:
from gpu import block_idx, block_dim, thread_idx
from gpu import block_idx, block_dim, thread_idx
Aliases
-
block_dim = {}
: Contains the dimensions of the block asx
,y
, andz
values (for example,block_dim.y
) -
block_idx = {}
: Contains the block index in the grid, asx
,y
, andz
values. -
cluster_dim = {}
: Contains the dimensions of the cluster, asx
,y
, andz
values. -
cluster_idx = {}
: Contains the cluster index in the grid, asx
,y
, andz
values. -
global_idx = {}
: Contains the global offset of the kernel launch, asx
,y
, andz
values. -
grid_dim = {}
: Provides accessors for getting thex
,y
, andz
dimensions of a grid. -
thread_idx = {}
: Contains the thread index in the block, asx
,y
, andz
values.
Functions
-
block_rank_in_cluster
: Gets the unique identifier for the current thread block (CTA) in the cluster across all dimensions. Equivalent to%cluster_ctarank
in CUDA. -
lane_id
: Returns the lane ID of the current thread. -
sm_id
: Returns the Streaming Multiprocessor (SM) ID of the current thread. Returns: The SM ID of the the current thread.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!