warp.Launch#
- class warp.Launch(
- kernel,
- device,
- hooks=None,
- params=None,
- params_addr=None,
- bounds=None,
- max_blocks=0,
- block_dim=256,
- adjoint=False,
- fwd_args=None,
- adj_args=None,
Represent all data required for a kernel launch so that launches can be replayed quickly.
Users should not directly instantiate this class, instead use
warp.launch(..., record_cmd=True)to record a launch.- Parameters:
- __init__(
- kernel,
- device,
- hooks=None,
- params=None,
- params_addr=None,
- bounds=None,
- max_blocks=0,
- block_dim=256,
- adjoint=False,
- fwd_args=None,
- adj_args=None,
Methods
__init__(kernel, device[, hooks, params, ...])launch([stream])Launch the kernel.
set_dim(dim)Set the launch dimensions.
set_param_at_index(index, value[, adjoint])Set a kernel parameter at an index.
set_param_at_index_from_ctype(index, value)Set a kernel parameter at an index without any type conversion.
set_param_by_name(name, value[, adjoint])Set a kernel parameter by argument name.
set_param_by_name_from_ctype(name, value)Set a kernel parameter by argument name with no type conversions.
set_params(values)Set all parameters.
set_params_from_ctypes(values)Set all parameters without performing type-conversions.
Attributes
The device to launch on.
The launch bounds.
The maximum number of CUDA thread blocks to use.
The number of threads per block.
The number of CUDA thread blocks per Thread Block Cluster.
Whether to run the adjoint kernel instead of the forward kernel.
Whether the kernel uses a grid-stride loop (vs the lean 3D launch).
- device: Device#
The device to launch on. This should not be changed after the launch object is created.
- bounds: launch_bounds_1d_t | launch_bounds_2d_t | launch_bounds_3d_t | launch_bounds_4d_t#
The launch bounds. Update with
set_dim().
- grid_stride: bool#
Whether the kernel uses a grid-stride loop (vs the lean 3D launch). Selects the grid shape.
- set_dim(dim)[source]#
Set the launch dimensions.
- Parameters:
dim (int | list[int] | tuple[int, ...]) – The dimensions of the launch.
- Raises:
RuntimeError – If the kernel is not grid-stride and the new dimensions exceed the lean 3D grid capacity (~7e16 work items). Decorate the kernel with
@warp.kernel(grid_stride=True)to support launch dimensions this large.
- set_param_at_index_from_ctype(index, value, adjoint=False)[source]#
Set a kernel parameter at an index without any type conversion.
- Parameters:
Note
This method does not perform warp-level type conversion, so it should not be used on array-typed parameters during CPU APIC capture. APIC relocation metadata requires the original
warp.arrayobjects stored infwd_argsto track region IDs; passing a raw ctype struct bypasses that. Useset_param_at_index()instead when a CPU APIC capture is active.
- set_param_by_name_from_ctype(name, value)[source]#
Set a kernel parameter by argument name with no type conversions.