Skip to main content

Module utils

Module utils 

Source
Expand description

Small utilities shared by the GPU memory and kernel-launch paths.

Everything here is pure CPU arithmetic; nothing touches a device except get_optimal_backend, which probes scirs2_core::gpu for a usable backend.

Functionsยง

align_size
Round size up to the next multiple of alignment.
calculate_block_size
Launch geometry for a 1-D kernel over n elements.
calculate_fragmentation
External fragmentation of a free list given as (block_size, count) pairs.
checked_next_power_of_two
Smallest power of two greater than or equal to n, or None on overflow.
format_bytes
Format a byte count with a binary unit suffix.
get_optimal_backend
First backend from SUPPORTED_BACKENDS-style probing that opens a context.
is_aligned
Whether addr sits on an alignment boundary.