Built-Ins#
Warp built-in types and functions.
Built-in types and functions are available within Warp kernels and optionally also from the Warp Python runtime API.
Each built-in function is tagged to indicate where it can be used:
Kernel - Can be called from inside a Warp kernel
Python - Can be called at the Python scope
Differentiable - Propagates gradients when used in reverse mode automatic differentiation
For a listing of the API that is exclusively intended to be used at the Python scope and run inside the CPython interpreter, see warp.
Scalar Math#
Compute the absolute value of |
|
Compute arccos of |
|
Compute arcsin of |
|
Compute the arctangent of |
|
Compute the 2-argument arctangent, atan2, of the point |
|
Compute the cube root of |
|
Compute the smallest integer that is greater than or equal to |
|
Clamp the value of |
|
Compute the cosine of |
|
Compute the cosh of |
|
Convert |
|
Compute the error function of |
|
Compute the complementary error function of |
|
Compute the inverse complementary error function of |
|
Compute the inverse error function of |
|
Compute the value of the exponential function \(e^x\). |
|
Compute the largest integer that is less than or equal to |
|
Retrieve the fractional part of |
|
Check if all elements of |
|
Check if any element of |
|
Check if any element of |
|
Compute the natural logarithm (base-e) of |
|
Compute the binary logarithm (base-2) of |
|
Compute the common logarithm (base-10) of |
|
Compute the maximum value. |
|
Compute the minimum value. |
|
Compute 1.0 if |
|
Compute |
|
Convert |
|
Compute the nearest integer value to |
|
Compute the nearest integer value to |
|
Compute the sign of |
|
Compute the sine of |
|
Compute the sinh of |
|
Compute the square root of |
|
Compute 1.0 if |
|
Compute the tangent of |
|
Compute the tanh of |
|
Compute the nearest integer that is closer to zero than |
Vector Math#
Compute the index of the maximum element of vector |
|
Compute the index of the minimum element of vector |
|
Compute the cross product of two 3D vectors. |
|
Compute the component-wise division of |
|
Compute the component-wise product of |
|
Compute the double dot product between two matrices. |
|
Compute the determinant of matrix |
|
Construct a matrix with the components of vector |
|
Compute the dot product. |
|
Compute the eigendecomposition of a 3x3 matrix |
|
Extract a vector containing the diagonal elements of square matrix |
|
Create an identity matrix with shape=(n,n) with the type given by |
|
Compute the inverse of matrix |
|
Compute the length of |
|
Compute the squared length of |
|
Construct a matrix. |
|
Construct a matrix with each vector argument as a column. |
|
Construct a matrix with each vector argument as a row. |
|
Compute the Huber norm of a vector v with a given delta. |
|
Compute the L1 norm of a vector v. |
|
Compute the L2 norm of a vector v. |
|
Compute the "pseudo" Huber norm of a vector v with a given delta. |
|
Compute the normalized value of |
|
Compute the outer product |
|
Compute the QR decomposition of a 3x3 matrix |
|
Compute the skew-symmetric 3x3 matrix for a 3D vector |
|
Normalize a vector using the pseudo-Huber norm. |
|
Compute the SVD of a 2x2 matrix |
|
Compute the SVD of a 3x3 matrix |
|
Compute the trace of matrix |
|
Compute the transpose of matrix |
|
Construct a vector of given length and dtype. |
Quaternion Math#
Construct a quaternion representing a rotation of angle radians around the given axis. |
|
Construct a quaternion from a matrix. |
|
Construct an identity quaternion with zero imaginary part and real part of 1.0. |
|
Compute quaternion conjugate. |
|
Rotate a vector by a quaternion. |
|
Rotate a vector by the inverse of a quaternion. |
|
Construct a quaternion representing a combined roll (z), pitch (x), yaw rotations (y) in radians. |
|
Linearly interpolate between two quaternions. |
|
Extract the rotation axis and angle radians a quaternion represents. |
|
Convert a quaternion to a 3x3 rotation matrix. |
|
Construct a quaternion. |
Transformations#
Compose a 4x4 transformation matrix from a 3D position, quaternion orientation, and 3D scale. |
|
Decompose a 4x4 transformation matrix into 3D position, quaternion orientation, and 3D scale. |
|
Construct a transformation from a 4x4 matrix. |
|
Extract the rotational part of transform |
|
Extract the translational part of transform |
|
Construct an identity transform with zero translation and identity rotation. |
|
Compute the inverse of the transformation |
|
Multiply two rigid body transformations together. |
|
Apply a transform to a point. |
|
Set the rotational part of a transform |
|
Set the translational part of a transform |
|
Convert a transformation to a 4x4 matrix. |
|
Apply a transform to a vector. |
|
Construct a transformation. |
Spatial Math#
Construct a 6x6 spatial inertial matrix from two 3x3 diagonal blocks. |
|
Extract the bottom (second) part of a 6D screw vector. |
|
Compute the cross product of two 6D screw vectors. |
|
Compute the dual cross product of two 6D screw vectors. |
|
Compute the dot product of two 6D screw vectors. |
|
Compute the spatial Jacobian matrix for a kinematic chain. |
|
Compute the composite rigid-body mass matrix for a kinematic chain. |
|
Extract the top (first) part of a 6D screw vector. |
|
Construct a 6D screw vector. |
Tile Primitives#
Construct a new tile from per-thread kernel values. |
|
Generate a tile of linearly spaced elements. |
|
Cooperatively compute the index of the maximum element in the tile using all threads in the block. |
|
Cooperatively compute the index of the minimum element in the tile using all threads in the block. |
|
Assign a tile to a subrange of a destination tile. |
|
Create a new tile with the same data as the input tile, but with a different data type. |
|
Atomically add a tile onto the array |
|
Atomically add a tile to a global memory array, with storage along a specified axis mapped according to a 1D tile of indices. |
|
Broadcast a tile. |
|
Construct an axis-aligned bounding box query against a BVH object for thread-block parallel traversal. |
|
Move to the next bound in a thread-block parallel BVH query and return results as a tile. |
|
Construct a ray query against a BVH object for thread-block parallel traversal. |
|
Compute the Cholesky factorization |
|
Compute the Cholesky factorization |
|
Solve for |
|
Solve for |
|
Add a square matrix and a diagonal matrix |
|
Extract a single element from the tile. |
|
Compute the forward FFT along the second dimension of a 2D tile of data. |
|
Allocate a tile filled with the specified value. |
|
Compute the inverse FFT along the second dimension of a 2D tile of data. |
|
Load a tile from a global memory array. |
|
Load a tile from a global memory array, with loads along a specified axis mapped according to a 1D tile of indices. |
|
Solve for |
|
Solve for |
|
Apply a function to tile elements. |
|
Compute the matrix product |
|
Cooperatively compute the maximum of the tile elements using all threads in the block. |
|
Construct an axis-aligned bounding box query against a |
|
Move to the next triangle in a thread-block parallel mesh AABB query and return results as a tile. |
|
Cooperatively compute the minimum of the tile elements using all threads in the block. |
|
Allocate a tile of one-initialized items. |
|
Generate a tile of random floats. |
|
Generate a tile of random integers. |
|
Apply a custom reduction operator across a tile. |
|
Create a reshaped view of a tile with the same data. |
|
Exclusive scan (prefix sum) across the tile. |
|
Inclusive scan (prefix sum) across the tile. |
|
Inclusive max scan across the tile. |
|
Inclusive min scan across the tile. |
|
Cooperatively sort the elements of two tiles in ascending order based on the keys, using all threads in the block. |
|
Create a squeezed view of a tile with the same data. |
|
Store a tile to a global memory array. |
|
Store a tile to a global memory array, with storage along a specified axis mapped according to a 1D tile of indices. |
|
Cooperatively compute the sum of the tile elements. |
|
Transpose a tile. |
|
Solve for |
|
Solve for |
|
Extract a slice of a given tile [offset, offset+shape], if shape is not specified it will be inferred from the unspecified offset dimensions. |
|
Allocate a tile of zero-initialized items. |
|
Convert a tile back to per-thread values. |
Geometry#
Get the root of a group in a BVH. |
|
Construct an axis-aligned bounding box query against a BVH object. |
|
Construct an axis-aligned bounding box query against a BVH object for thread-block parallel traversal. |
|
Move to the next bound returned by the query. |
|
Move to the next bound in a thread-block parallel BVH query and return results as a tile. |
|
Construct a ray query against a BVH object. |
|
Construct a ray query against a BVH object for thread-block parallel traversal. |
|
Find the closest points between two edges. |
|
Query the index of a point in the |
|
Construct a point query against a |
|
Move to the next point in the hash grid query. |
|
Test for intersection between two triangles (v0, v1, v2) and (u0, u1, u2) using Möller's method. |
|
Evaluate the face normal the mesh given a face index. |
|
Evaluate the position on the |
|
Evaluate the velocity on the |
|
Retrieve the mesh given its index. |
|
Get the root of a group in a |
|
Query the point-index of the mesh given a face-vertex index. |
|
Query the point of the mesh given an index. |
|
Query the velocity of the mesh given an index. |
|
Construct an axis-aligned bounding box query against a |
|
Move to the next triangle whose bounding box overlaps the query bounding box. |
|
Move to the next triangle in a thread-block parallel mesh AABB query and return results as a tile. |
|
Construct an axis-aligned bounding box query against a |
|
Compute the furthest point on the |
|
Compute the closest point on the |
|
Compute the closest point on the |
|
Compute the closest point on the |
|
Compute the closest point on the |
|
Compute the closest point on the |
|
Compute the closest ray hit on the |
|
Check for any ray hit on the |
|
Count the number of intersections between a ray and a |
Volumes#
Transform a point |
|
Transform a direction |
|
Query the value of voxel with coordinates |
|
Query the value of voxel with coordinates |
|
Query the |
|
Query the index associated with the voxel at coordinates |
|
Query the vector value of voxel with coordinates |
|
Sample the volume of type |
|
Sample the volume given by |
|
Sample the volume given by |
|
Sample the volume and its gradient given by |
|
Sample the volume given by |
|
Sample the |
|
Sample the volume given by |
|
Sample the vector volume given by |
|
Store |
|
Store |
|
Store |
|
Store |
|
Transform a point |
|
Transform a direction |
Random#
Divergence-free vector field based on Perlin noise. |
|
Non-periodic Perlin-style noise. |
|
Periodic Perlin-style noise. |
|
Generate a random sample from a Poisson distribution. |
|
Initialize a random number generator. |
|
Generate a random float. |
|
Generate a random integer. |
|
Sample a normal (Gaussian) distribution of mean 0 and variance 1. |
|
Generate a random unsigned integer. |
|
Inverse-transform sample a cumulative distribution function. |
|
Uniformly sample a triangle. |
|
Uniformly sample a unit cube. |
|
Uniformly sample a disk in the xy plane. |
|
Uniformly sample a unit hemisphere. |
|
Uniformly sample a unit hemisphere surface. |
|
Uniformly sample a ring in the xy plane. |
|
Uniformly sample a unit sphere. |
|
Uniformly sample a unit sphere surface. |
|
Uniformly sample a unit square. |
Utility#
Construct an array from a memory pointer, shape, and data type. |
|
Atomically adds |
|
Atomically performs a bitwise AND between |
|
Atomically compare and swap |
|
Atomically exchange |
|
Compute the maximum of |
|
Compute the minimum of |
|
Atomically performs a bitwise OR between |
|
Atomically subtracts |
|
Atomically performs a bitwise XOR between |
|
Query the number of threads in the current block. |
|
Trigger a debugger breakpoint. |
|
Reinterpret a value as a different type while preserving its bit pattern. |
|
Print an error to stdout if |
|
Query the number of elements in a vector. |
|
Linearly interpolate two values |
|
Print a variable to stdout. |
|
Allows printing formatted strings using C-style format specifiers. |
|
Select between two arguments, if |
|
Smoothly interpolate between two values |
|
Query the current thread index or indices. |
|
Select between two arguments, if |
|
Create a zero-initialized fixed-size array of the given shape and dtype. |
Other#
Search a sorted array |
Operators#
Add |
|
Compute the bitwise AND of |
|
Compute the bitwise OR of |
|
Compute the bitwise XOR of |
|
Divide two values. |
|
Divide two scalars using floor division. |
|
Compute the bitwise complement of |
|
Compute |
|
Modulo operation using truncated division. |
|
Multiply two values. |
|
Negate |
|
Pass |
|
Compute |
|
Subtract |
|
Compute logical NOT of |
Code Generation#
Evaluate a static Python expression and replaces it with its result. |