IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo module

nan_check

NaN/Inf detection kernels for the max-debug.nan-check feature.

These kernels are registered as custom ops in the kernels package and inserted by the NanCheckPass compiler pass. The architecture is:

  1. nan_check_count: read-only reduction that counts NaN/Inf values in a floating-point tensor. Outputs two single-element int32 tensors with the counts. CPU: vectorized scan with atomics. GPU: parallel reduction.

  2. nan_check_raise: host-side kernel that reads the NaN/Inf counts (transferred to host via mo.transfer for GPU graphs) and raises a diagnostic error if any are non-zero.

Functionsโ€‹