Skip to main content

cubecl_tile/launch/spec/
boundary_policy.rs

1//! [`BoundaryPolicy`]: how the caller states an operand's bounds-check.
2
3use crate::Boundary;
4
5/// How an operand's reads are bounds-checked, where the caller states it. An operand that states
6/// none is checked with [`Boundary::Zero`] on the axes that can leave the buffer.
7#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
8pub enum BoundaryPolicy {
9    /// Unchecked; the caller guarantees every read is in bounds.
10    Unchecked,
11    /// Checked with this boundary on every axis that is not provably in bounds.
12    Every(Boundary),
13    /// Checked with this boundary on the axes some extent could take it past, not only those this
14    /// launch's do: every axis whose extent the kernel leaves dynamic and a tile can cut short,
15    /// beside the static ones a tile overhangs. The kernel then checks the same axes whatever
16    /// extents a launch brings, so the one compiled for one call serves every other — what a
17    /// caller that compiles its kernels ahead of the calls needs, where a call's extents fall
18    /// between the ones it compiled for.
19    AnyExtent(Boundary),
20}