You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two opt-in Application.compile_env flags re-enable runtime assertions
on hot paths that GPU backends skip by default. Both default false
with zero runtime cost when off — the gated branches are dead-code
eliminated by the Elixir compiler and no Emily.Backend.DebugHelpers
reference reaches the compiled BEAM.
- :debug_bounds_check — raises on OOB / negative indices in gather,
take, take_along_axis, indexed_add, indexed_put. Closes the silent-
NaN-from-OOB-gather class of bug that surfaced in DistilBERT-QA
conformance (vocab-30522 tokenizer vs. tiny-random embedding).
- :debug_detect_nan_inf — scans matmul, fast_rms_norm, fast_layer_norm,
and both fast_scaled_dot_product_attention variants for NaN/Inf so
training-time numerics failures surface at the producing op.
The Emily.Backend.DebugHelpers module holds the assertion bodies and
is always compiled; Emily.Backend only references it from inside
`if @flag` gates, so when the flags are off the entire module is
unreachable from Emily.Backend's bytecode. A zero-cost verification
test inspects :beam_disasm.file/1 output and asserts no reference
survives under the default-off build.
Emily's own config/test.exs keeps both prod flags false so mix test
doesn't pay GPU-sync cost on every run; fixture-only flags drive the
gate→helper composition tests in test/support/debug_fixture.ex.
Standalone softmax has no Backend callback in Emily (it's Axon-composed
from exp/sum/divide); the fused SDPA softmax is covered via the two
SDPA callback paths.
Closes#32.
0 commit comments