Skip to content

test(gdn_gating_proj): numeric failure persists under MSVC after #139 — rel_l2 has no headroom outside author's Linux env #232

Description

@klcstyle

Summary

ninfer_gdn_gating_proj_test fails numerically under MSVC even after #139 was closed. On Windows 10 + MSVC 19.44 (VS2022 17.14) + CUDA 12.8.61 + Tesla V100-32GB (sm_70), the only failing case out of 103 ctest tests is:

gdn_norm_gating_proj qwen3_8_27b_parent T=16 mode=4 phase=1 g: reduction criterion failed
rel_l2=0.000896 vs limit 0.0008 (ratio 1.12)

This mirrors the gdn_gating_proj numeric failure tmark00 already reported in #139 (qwen3_6_27b T=1024 g actual=-2.27703 reference=-2.27704, RTX 5090 + CUDA 13.2). Different case, different geometry, different GPU generation — same test, same symptom. That pattern suggests the criterion itself has no headroom outside the author's Linux environment, not a per-machine quirk.

Already excluded (measured, not guessed)

  • Inputs are identical across platforms: MSVC and libstdc++ std::uniform_real_distribution<float> produce bit-identical values for the same seed (verified by dumping a_log[46], dt_bias[46] on both).
  • BF16 rounding is deterministic bit-twiddling: f32_to_bf16 is a round-to-nearest-even integer operation, platform-independent.
  • Code is unmodified upstream: test file, kernel (bf16_gdn_norm_gating_proj_27.cu), and CTest registration diff clean against master; build flags identical (--expt-relaxed-constexpr, -fmad default).
  • Failure is deterministic: 4 reruns produce byte-identical actual=-4.0566 reference=-4.04689; GPU idle, no stray processes (double-GPU host, confirmed on V100).

Why the headroom is gone

  • kGdnNormControlFp32.relative_l2 was tightened 1.0e-3 → 8.0e-4 in ad54e179 (2026-07-26, "test(ops): tighten measured error bounds").
  • The kernels stage everything through BF16 inputs; BF16 tail precision is 2^-8 ≈ 0.39%, so rel_l2 around 0.9e-3 is the natural noise floor of the staging path, not an outlier.
  • The healthy sibling case (mode=0 phase=1 g) already sits at ratio 0.795 — the limit is at the noise ceiling even for the best cases.
  • On this machine MSVC/CUDA 12.8.61 libdevice (expf/log1pf) ULP-level differences push the edge case to 1.12×.

Suggested resolution (any one)

  1. Restore relative_l2 to 1.0e-3 (the pre-ad54e179 value; still 4× stricter than the BF16 noise floor of 0.39%).
  2. Or keep 8.0e-4 and document MSVC as a known-limitation platform with the measured stats above.
  3. Related to Three tests in tests/ cannot compile under MSVC, so a full Windows build stops before linking #139's observation that there is no .github/workflows: a build-only CI job (even Linux) would anchor these tolerances so a tighten commit has to prove itself on a machine other than the author's.

Environment: Windows 10 x64, MSVC 19.44 (VS2022 17.14), CUDA 12.8.61, Tesla V100-PCIe-32GB, Ninja, CMake 4.4.3, BUILD_TESTING=ON. 102/103 tests pass.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions