Kernel API
A local tensor is a multi-dimensional array of values in local memory (Unified Buffer, L1 Cache, etc.) |
|
A global tensor is a contiguous ND-array of values in Global Memory. |
Programming model
Define a new tensor descriptor for accessing data in global memory. |
|
Returns the current block (NPU core) index. |
|
Returns the total number of blocks (NPU cores) allocated for the kernel. |
Iterators
A range loop construct for use in JIT functions. |
|
A static range loop construct for use in JIT functions. |
Creation operations
Cast a tensor or scalar value to a different data type. |
|
Concatenate tensors along the first dimension. |
|
Create a tensor filled with a scalar value. |
|
Create a tensor filled with a scalar value, with the same shape and dtype as the input tensor. |
|
Create a tensor filled with zeros. |
|
Create a zero-initialized accumulator tensor in L0C memory for matrix multiplication. |
|
Create a tensor filled with zeros, with the same shape and dtype as the input tensor. |
Memory operations
Copy a local tensor to a new local tensor, optionally reshaping and relocating. |
|
Copy data from a global tensor into a local tensor or scalar value. |
|
Copy data from a local tensor or scalar value to a global tensor. |
Arithmetic operations
Computes the element-wise addition of |
|
Computes the element-wise division of |
|
Computes the element-wise 'equality' comparison of |
|
Computes the element-wise 'greater' comparison of |
|
Computes the element-wise 'greater or equal' comparison of |
|
Computes the element-wise left shift (bitwise) of |
|
Computes the element-wise 'less' comparison of |
|
Computes the element-wise 'less or equal' comparison of |
|
Computes the element-wise maximum of |
|
Computes the element-wise minimum of |
|
Computes the element-wise multiplication of |
|
Computes the element-wise negation of |
|
Computes the element-wise 'inequality' comparison of |
|
Computes the element-wise right shift (bitwise) of |
|
Computes the element-wise subtraction of |
Math operations
Computes the element-wise absolute value of |
|
Computes the element-wise ceil rounding of |
|
Computes the element-wise cosine of |
|
Computes the element-wise hyperbolic cosine of |
|
Computes the element-wise error function of |
|
Computes the element-wise exponential of |
|
Computes the element-wise exponential (base 2) of |
|
Computes the element-wise floor rounding of |
|
Computes the element-wise natural logarithm of |
|
Computes the element-wise logarithm (base 2) of |
|
Computes the element-wise ReLU value of |
|
Computes Root Mean Square Layer Normalization of |
|
Computes the element-wise inverse square root of |
|
Computes the element-wise sine of |
|
Computes the element-wise hyperbolic sine of |
|
Computes the row-wise softmax of |
|
Computes the element-wise square root of |
|
Computes the element-wise tangent of |
|
Computes the element-wise hyperbolic tangent of |
Matrix multiplication operations
Computes the matrix multiplication of |
|
Computes the matrix multiplication of |
Indexing operations
[Experimental] A context manager for masked operations on tensors. |
|
Select elements from two sources based on a mask. |
Reduction operations
Returns the minimum value of each row of the |
|
Returns the maximum value of each row of the |
|
Returns the sum of each row of the |
|
Returns the product of each row of the |
Shape manipulation operations
Creates new tensor of a given shape broadcasting data from the input tensor. |
|
Insert new dimensions of size 1 at the specified positions. |
|
Flatten a tensor into a 1D tensor. |
|
Reshape a tensor to a new shape without changing its data. |
|
Remove dimensions of size 1 from the tensor. |
|
Rearrange tensor dimensions in specific order. |
Atomic operations
Atomically add local tensor elements to a global tensor at specified offsets. |
|
Atomically compute the maximum between local tensor elements and global tensor elements at specified offsets. |
|
Atomically compute the minimum between local tensor elements and global tensor elements at specified offsets. |
Debug operations
Inject raw Ascend C++ code into the generated kernel. |
|
Embed Ascend C VF (vector function) code within a kernel. |
Utility functions
Compute ceiling division of two integers. |