nemo_automodel.components.optim.nvfp4_adam_cuda
nemo_automodel.components.optim.nvfp4_adam_cuda
Source text of the Adam step of NVFP4 expert weights (CUDA) and its torch binding.
nvfp4_resident_adam hands these strings to torch.utils.cpp_extension.load_inline as
cpp_sources = [HEADER, BINDING] and cuda_sources = [HEADER, KERNEL], so the wheel ships Python files only.
The header is inlined into both translation units (there is no file to #include), which is why it carries no
#pragma once.
Both kernels return the bits of the Transformer Engine kernel they stand in for. The Adam arithmetic is written as
explicit PTX operations for that reason: Transformer Engine builds its Adam kernel with --use_fast_math, and
the result depends on which operations the compiler then emits.