NVIDIA/warp v1.11.0
NVIDIA/warp
Captured source
source ↗v1.11.0
Repository: NVIDIA/warp
Tag: v1.11.0
Published: 2026-01-02T13:26:06Z
Prerelease: no
Release notes:
Warp v1.11.0
Warp v1.11 introduces group-aware spatial queries for multi-world workloads, provides new options for managing JIT compilation overhead, and expands differentiation capabilities with wp.grad(). This release also includes expanded tile operations, the unpack operator in kernels, C++ integration examples, and a major API cleanup clarifying public versus internal interfaces.
New features
Group-aware spatial queries
Warp v1.11 introduces group-aware construction and queries for wp.Bvh and wp.Mesh data structures, enabling efficient spatial queries across multiple independent environments. This feature allows you to build a single acceleration structure containing geometry from multiple worlds or scenes, then query each world independently without traversing primitives from other worlds.
When constructing a BVH or Mesh, assign each primitive to a group using the groups parameter. Warp builds isolated sub-trees for each group within a unified structure:
# Build a BVH in Python containing multiple worlds lowers = wp.array(...) # Shape bounds for all worlds uppers = wp.array(...) world_ids = wp.array([0, 0, 1, 1, 2, 2, ...], dtype=int) bvh = wp.Bvh(lowers, uppers, groups=world_ids) @wp.kernel def raycast_world( bvh_id: wp.uint64, world_id: int, ray_origin: wp.vec3, ray_dir: wp.vec3 ): # Get the root node for this world's sub-tree root = wp.bvh_get_group_root(bvh_id, world_id) # Query only intersects geometry from this world query = wp.bvh_query_ray(bvh_id, ray_origin, ray_dir, root) # Process hits shape_idx = int(0) while wp.bvh_query_next(query, shape_idx): # Handle intersection with shape_idx pass # Launch kernel to query world 2 wp.launch(raycast_world, dim=1, inputs=[bvh.id, 2, origin, direction])
This example shows a single-world query for clarity. For production use, launch multiple threads in parallel, each querying its assigned world from arrays of world IDs and ray parameters. See Newton's raytrace implementation for a real-world example of parallel multi-world raycasting.
Key features
- Group construction: Pass a
groupsarray during construction to organize primitives into isolated sub-trees - Group-restricted queries: All query functions accept an optional
rootparameter to limit traversal to a specific group - Helper functions:
wp.bvh_get_group_root()andwp.mesh_get_group_root()retrieve sub-tree roots for each group
*Thanks to @StafaH for implementing this feature.*
Geometry query enhancements
Warp v1.11 adds several new query functions and improvements for spatial queries:
- `wp.mesh_query_ray_anyhit()`: Fast any-hit query that returns immediately upon finding any intersection, useful for shadow ray calculations in rendering
- `wp.mesh_query_ray_count_intersections()`: Counts all ray-triangle intersections along a ray path
- `wp.mesh_query_point_sign_parity()`: Point-in-mesh query using perturbed ray casting with majority voting for improved robustness in challenging cases
- `max_dist` parameter:
wp.bvh_query_next()now accepts a maximum distance to filter intersections, useful for early ray termination - Tiled query functions: Cooperative thread-block queries for use in tiled kernels (
wp.bvh_query_aabb_tiled(),wp.bvh_query_ray_tiled(),wp.mesh_query_aabb_tiled(), etc.)
Evaluate the gradients of functions
wp.grad() directly evaluates the gradient of a Warp function at specific input values, computing gradients inline during the forward pass. This is useful for computing forces from energy functions or when implementing custom adjoints that need to call auto-generated gradients of subfunctions, avoiding the need to manually code the entire adjoint chain. This contrasts with wp.Tape(), which records an entire computation graph for reverse-mode automatic differentiation across multiple kernel launches. This feature was implemented in response to community feedback (#125).
import warp as wp import numpy as np k = 1.0 @wp.func def compute_energy(x: float): return 0.5 * k * x * x @wp.kernel def compute_force(x: wp.array(dtype=float), U: wp.array(dtype=float), F: wp.array(dtype=float)): i = wp.tid() U[i] = compute_energy(x[i]) F[i] = -wp.grad(compute_energy)(x[i]) N = 5 x = wp.array(np.arange(N, dtype=np.float32), dtype=float) U = wp.zeros_like(x) F = wp.zeros_like(x) wp.launch(compute_force, N, inputs=[x], outputs=[U, F]) print(U.numpy()) # Energy: [0. 0.5 2. 4.5 8. ] print(F.numpy()) # Force: [ 0. -1. -2. -3. -4.]
wp.tile_map() supports n-ary maps (up to n=8)
User-defined functions that accept up to 8 arguments may now be used as tile mapping functions. An equivalent number of tiles must be passed to wp.tile_map(). For example:
@wp.func def weighted_sum(a: float, b: float, c: float): return 0.5 * a + 0.3 * b + 0.2 * c @wp.kernel def compute(): a = wp.tile_arange(0.0, 1.0, 0.1, dtype=float) b = wp.tile_ones(shape=10, dtype=float) c = wp.tile_arange(1.0, 2.0, 0.1, dtype=float) s = wp.tile_map(weighted_sum, a, b, c) print(s) wp.launch_tiled(compute, dim=[1], inputs=[], block_dim=16)
Generate tiles of random numbers
wp.tile_randf() and wp.tile_randi() have been introduced to generate tiles of random floats and ints, respectively. These functions accept optional lower and upper bound arguments to control the range of generated values. This snippet generates 4x4 tensors of random floats using 2x2 tiles:
TILE_M, TILE_N = 2, 2 M, N = 2, 2 seed = 42 @wp.kernel def rand_kernel(seed: int, x: wp.array2d(dtype=float)): i, j = wp.tid() rng = wp.rand_init(seed, i * TILE_M + j) t = wp.tile_randf(shape=(TILE_M, TILE_N), rng=rng) wp.tile_store(x, t, offset=(i * TILE_M, j * TILE_N)) x = wp.zeros(shape=(M * TILE_M, N * TILE_N), dtype=float) wp.launch_tiled(rand_kernel, dim=[M, N], inputs=[seed, x], block_dim=32) print(x.numpy())
Alpha and Beta scalings in wp.tile_matmul()
Optional alpha and beta scaling arguments have been added to wp.tile_matmul() builtins.
| Previous Behavior | Updated Behavior | |--------------------------|---------------------------------------------| | out = A * B + out | out = alpha * A * B + beta * out | | out = A * B | out = alpha * A * B...
Excerpt shown — open the source for the full document.