warp.launch#
- warp.launch(
- kernel,
- dim,
- inputs=[],
- outputs=[],
- adj_inputs=[],
- adj_outputs=[],
- device=None,
- stream=None,
- adjoint=False,
- record_tape=True,
- record_cmd=False,
- max_blocks=0,
- block_dim=256,
Launch a Warp kernel on the target device
Kernel launches are asynchronous with respect to the calling Python thread.
The default
warp.config.LaunchArrayAccessMode.RELAXEDmode does not check whether array arguments are accessible from the launch device. Cross-device access depends on the access direction, memory kind, and system capabilities. An inaccessible array may cause a segmentation fault in a CPU kernel or a CUDA illegal memory access. Setwarp.config.launch_array_access_modetowarp.config.LaunchArrayAccessMode.CHECKEDto detect known-invalid accesses before launch. Usewarp.config.LaunchArrayAccessMode.STRICTto require every Warp array argument to be allocated on the launch device, including cross-device allocations the hardware could access. See Checked Launch Validation for details and limitations.- Parameters:
kernel – The name of a Warp kernel function, decorated with the
@warp.kerneldecoratordim (int | Sequence[int]) – The number of threads to launch the kernel, can be an integer or a sequence of integers with a maximum of 4 dimensions.
inputs (Sequence) – The input parameters to the kernel (optional)
outputs (Sequence) – The output parameters (optional)
adj_inputs (Sequence) – The adjoint inputs (optional)
adj_outputs (Sequence) – The adjoint outputs (optional)
stream (Stream | None) – The stream to launch on.
adjoint (bool) – Whether to run forward or backward pass (typically use
False).record_tape (bool) – When
True, the launch will be recorded the globalwarp.Tapeobject when present.record_cmd (bool) – When
True, the launch will return aLaunchobject. The launch will not occur until the user callsLaunch.launch().max_blocks (int) – The maximum number of CUDA thread blocks to use. Requires a grid-stride loop, which is the default. Launching a kernel that opted into the lean launch path with
@warp.kernel(grid_stride=False)andmax_blocks > 0raises aRuntimeError.block_dim (int) – The number of threads per block (always 1 for “cpu” devices).