You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[REQ] Add support for tile slicing syntax, including fancy indexing #1176
Feature Request: NumPy-Style Slicing for Warp Tiles
Problem
Warp tiles currently lack slicing syntax support. While tile_view() exists, it requires explicit offset and shape parameters rather than the familiar NumPy slicing notation that users expect.
Current approach with tile_view():
@wp.kerneldefprocess_tile(data: wp.array2d(dtype=float)):
t=wp.tile_load(data, shape=(64, 64))
# Extract rows 10-20subset=wp.tile_view(t, offset=(10, 0), shape=(10, 64))
# Extract a single row â requires knowing the full shaperow=wp.tile_view(t, offset=(5, 0), shape=(1, 64))
Slice bounds should be compile-time constants for optimal code generation, consistent with existing tile shape requirements. The compiler can verify bounds at compile time when constants are used.
The change adds NumPy-style tile indexing in kernel code. Basic, strided, and reversed slices and dimension-collapsing integer indices now lower to tile views; slice assignment is supported; and 1D integer index tiles gather through the new differentiable wp.tile_slice_indexed() primitive. Existing explicit wp.tile_view() and scalar wp.tile_extract() behavior remains available.
Public API behavior:
Kernel scope:
@wp.kerneldefprocess_tile(data: wp.array2d[float]):
t=wp.tile_load(data, shape=(64, 64))
block=t[2:6, :] # Select rows 2 through 5columns=t[:, ::2] # Select every other columnreversed_rows=t[::-1, :] # Reverse the row orderrow=t[5, :] # Select one row and collapse that dimension# Gather non-contiguous rows using a 1D integer index tileindices=wp.tile_arange(0, 8, dtype=int) *8selected_rows=t[indices, :]
# Assign a tile to a view in placet[0:8, :] =wp.tile_ones(shape=(8, 64), dtype=float)
Slice bounds must be compile-time constants. Runtime integer indices are supported, including negative indices, but out-of-range runtime values are checked only in debug builds.
Advanced-index assignment, compound assignment to views, scalar broadcasting into slices, and zero-length tile views remain unsupported.
Test coverage:
warp/tests/tile/test_tile_view.py adds 39 tests covering basic, strided, reversed, dimension-collapsing, and assigned slices, including test_tile_slice_rows, test_tile_slice_strided, test_tile_slice_reverse, and test_tile_slice_assign.
Advanced indexing and autograd coverage includes test_tile_advanced_index, test_tile_advanced_index_duplicate_grad, test_tile_slice_assign_grad, and test_tile_gather_neg_index.
Runtime and negative indices, chained expressions, explicit slice offsets, overlapping assignment, bounds validation, and unsupported inputs are also covered.
An independent probe matching the original 64Ã64 examples passed on CPU and CUDA. No remaining requirement from this issue was identified.
Activity
Add NumPy-style tile slicing and fancy indexing (NVIDIAGH-1176)
Fix correctness issues found in tile slicing review (NVIDIAGH-1176)
4 remaining items
Address tile slicing review (NVIDIAGH-1176)
Address GitHub review feedback (NVIDIAGH-1176)
Add NumPy-style tile slicing and fancy indexing (NVIDIAGH-1176)
Fix correctness issues found in tile slicing review (NVIDIAGH-1176)
Address review feedback on tile slicing tests (NVIDIAGH-1176)
Promote tile indexing bounds warnings to caution directives (NVIDIAGHâĶ
Address review feedback on tile slicing (NVIDIAGH-1176)
Fix chained tile row gather (NVIDIAGH-1176)
Address tile slicing review (NVIDIAGH-1176)
Address GitHub review feedback (NVIDIAGH-1176)
Guard tile type probe symbol copy (NVIDIAGH-1176)
Add NumPy-style tile slicing and fancy indexing (NVIDIAGH-1176)
shi-eric commentedon Jul 23, 2026
This is addressed by c07653a.
The change adds NumPy-style tile indexing in kernel code. Basic, strided, and reversed slices and dimension-collapsing integer indices now lower to tile views; slice assignment is supported; and 1D integer index tiles gather through the new differentiable
wp.tile_slice_indexed()primitive. Existing explicitwp.tile_view()and scalarwp.tile_extract()behavior remains available.Public API behavior:
Kernel scope:
Slice bounds must be compile-time constants. Runtime integer indices are supported, including negative indices, but out-of-range runtime values are checked only in debug builds.
Advanced-index assignment, compound assignment to views, scalar broadcasting into slices, and zero-length tile views remain unsupported.
Test coverage:
warp/tests/tile/test_tile_view.pyadds 39 tests covering basic, strided, reversed, dimension-collapsing, and assigned slices, includingtest_tile_slice_rows,test_tile_slice_strided,test_tile_slice_reverse, andtest_tile_slice_assign.test_tile_advanced_index,test_tile_advanced_index_duplicate_grad,test_tile_slice_assign_grad, andtest_tile_gather_neg_index.An independent probe matching the original 64Ã64 examples passed on CPU and CUDA. No remaining requirement from this issue was identified.
Add NumPy-style tile slicing and fancy indexing (NVIDIAGH-1176)