warp.CaptureMode#

class warp.CaptureMode(*values)[source]#

CUDA stream capture mode; mirrors cudaStreamCaptureMode.

Controls how strictly CUDA rejects capture-unsafe runtime APIs while a capture is active. RELAXED is typically required when composing with libraries that perform lazy / capture-unsafe runtime calls (e.g. context initialization) during the capture.

The default mode used by capture_begin() and ScopedCapture is THREAD_LOCAL, which preserves the historical Warp behavior.

Attributes

GLOBAL

Capture-unsafe runtime APIs called from any thread invalidate the capture.

THREAD_LOCAL

Capture-unsafe runtime APIs called from the capturing thread invalidate the capture, but other threads are unaffected.

RELAXED

Capture-unsafe runtime APIs are tolerated and do not invalidate the capture.

GLOBAL = 0#

Capture-unsafe runtime APIs called from any thread invalidate the capture. This is the strictest mode and matches cudaStreamCaptureModeGlobal.

THREAD_LOCAL = 1#

Capture-unsafe runtime APIs called from the capturing thread invalidate the capture, but other threads are unaffected. Matches cudaStreamCaptureModeThreadLocal. This is the default Warp uses.

RELAXED = 2#

Capture-unsafe runtime APIs are tolerated and do not invalidate the capture. Matches cudaStreamCaptureModeRelaxed. Useful when composing with libraries that still perform lazy / capture-unsafe CUDA runtime calls (e.g. cudaFree(0) during lazy context / allocator init) during the capture.