Skip to main content

admit

Function admit 

Source
pub fn admit(bytes: &[u8], target: Target) -> Result<CompilerSpec, AdmitError>
Expand description

Admit a TOSA artifact for target, returning the specialization the helper compiles.

The BF16 target admits IDENTITY (a DMA copy), BF16 → FP32 MATMUL, and BF16 NHWC MAX_POOL2D. The separate FP8 storage target admits one explicit FP8 → BF16 CAST. The integer target admits exact INT8 IDENTITY, zero-point-aware INT8 → INT32 MATMUL, and static signed INT32 → INT8 RESCALE. Everything else is rejected without running the compiler. Each template admits only graphs whose dataflow matches what the compiled kernel executes — the IDENTITY template requires every operator to be IDENTITY (no constants: with a single block input, every value then provably carries that input’s bytes), and the MATMUL template requires the operator’s operands to be exactly the block inputs (constants may exist only as the two zero-points). Without these checks a semantically different graph (say, a constant-output IDENTITY or a constant-weights MATMUL) would compile to a kernel that reads runtime buffers the graph never asked for, returning well-formed but wrong data. Semantic and target validity — including that BF16 MATMUL zero-points are constant zero — is enforced by analyze_for before these structural checks.