Prose scratchpad · NVIDIA/hyperflare-inference #231

Raw Markdown for agents: https://autobot.eidonix.com/p/6d23cfc3-58a1-413d-bce1-7a80aab60d6d.md

#1 [high] Should fix: module docstring claims FP32 accumulation/one BF16 rounding for the cuBLAS tactic

ignition/components/bf16_bmm.py:7-9 (PR head) states: "output[g] = source[g] @ weight[g] ... with FP32 accumulation and one BF16 rounding per result."

The default/champion tactic is torch.bmm (bf16_bmm.py:57, 124-126). PyTorch's BF16 batched matmul honours torch.backends.cuda.matmul.allow_bf16_reduced_precision_reduction, which defaults to True, so the tensor-core reduction path may accumulate in BF16. The repository treats this as a real distinction: tests/components? no - tests/recipes/test_deepseek41_indexer_batches_cuda.py:39-44 and tests/recipes/test_step5_reference_cuda.py:38-43 set allow_bf16_reduced_precision_reduction = False to obtain exact BF16 matmul results. Nothing in bf16_bmm.py sets or reads that flag.

So the docstring states as an operator invariant something only the Triton tactic guarantees. Fix: say the Triton tile accumulates in FP32 and rounds once, and that cuBLAS's accumulation follows PyTorch's BF16 matmul settings; or state the measured bound (one BF16 ulp) the CUDA test enforces. Also the PR description repeats it: "Both accumulate in FP32 and round once to BF16". Severity: should fix (prose claims exceed code).

#2 [high] Should fix: tuning.py import-time toolchain init contradicts documented ordering; TODO.txt:185 left stale

ignition/preparation/tuning.py:66 (PR head) now calls _prepare_compiler_toolchain() at module import, which calls runtime_patches.apply() (line 51) and _set_triton_libdevice_path() (lines 62-63).

Documented order violated (prose lens: the comment the PR rewrites now contradicts the repository's own stated ordering):

  1. docs/preparation-development.md:59-63 says ignition.runtime_patches.apply() installs fixes "after dependency environment setup and before compilation or artifact loading". Ignition/cli/environment.py:5-10 docstring: environment apply "sets the environment before installing runtime patches"; it sets CUDA_HOME (line 54) and TRITON_CACHE_DIR (line 47) and is only called from ignition/cli/serve.py:211,322,476,587 and bench.py:176. An import-time call now installs patches and chooses a libdevice path before that environment setup. _set_triton_libdevice_path derives the toolkit library from CUDA_HOME (tests/preparation/test_toolchain.py:31-35), so the import-time selection can predate CUDA_HOME being set - the identity mismatch the new comment at tuning.py:57-61 claims to prevent. The PR description should state where the new import-time point sits relative to ignition.cli.environment.apply, or the code should re-assert after environment setup.

  2. docs/TODO.txt:185-187 still lists the open item "Invalidate b12x preparation discovery's cached compiler context when Inductor selects a different libdevice in the same process. Repeated GPU test preparation can restore program keys for the preceding library." The PR claims to fix that class of failure but does not update or remove the TODO, contrary to AGENTS.md:338-343 (update or remove entries as work completes) and repo-prose present-state rule.

Also note (context for the report, no finding): the comment at tuning.py:57-61 and the PR description both say Triton "memoizes compiled kernels per specialization and launch options only" - accurate as far as the code shows, and it explains why the ordering matters. Good.

Second prose finding (low/nit): ignition/preparation/tuning.py:48 docstring "Resolve forward math libraries before any Triton program identity is recorded" - the function is called at import of ignition.preparation.tuning, which is itself imported by tests and by many modules; "forward math libraries" is an unexplained identifier for libdevice (the term appears nowhere else in the repo - searched docs/ and ignition/). Name the library: "Resolve the CUDA toolkit's libdevice before any Triton program identity is recorded."