warp.Module#
- class warp.Module(name, loader=None)[source]#
Warp module containing kernels and functions to be compiled.
- Parameters:
name (str | None)
Methods
__init__(name[, loader])get_kernel_hooks(kernel, device)get_module_hash([block_dim])Get the hash of the module for a block_dim variant.
get_module_identifier([block_dim])Get an abbreviated module name to use for directories and files in the cache.
Get the hash of the module for the current block_dim.
load(device[, block_dim, binary_path, ...])register_function(func, scope_locals[, ...])register_kernel(kernel)register_struct(struct)resolve_options(config[, block_dim])Return a fully-resolved copy of the module options.
unload()- resolve_options(config, block_dim=None)[source]#
Return a fully-resolved copy of the module options.
Resolves
Nonesentinels by falling back toconfigvalues and hardcoded defaults. Also includes global config flags that affect compilation, so downstream consumers never need to read config directly.When
block_dimis supplied, it overridesself.options["block_dim"]in the returned dict. This letsModule.loadresolve a per-loadblock_dimvariant without mutating the module-level default.
- hash_module()[source]#
Get the hash of the module for the current block_dim.
This function always creates a new
ModuleHasherand computes the hash.- Return type:
- get_module_hash(block_dim=None)[source]#
Get the hash of the module for a block_dim variant.
If
block_dimisNone, use the module-level default. If the variant hash has not been computed yet, compute and cache it.
- get_module_identifier(block_dim=None)[source]#
Get an abbreviated module name to use for directories and files in the cache.
Depending on the setting of the
"strip_hash"option for this module, the module identifier might include a content-dependent hash as a suffix.