warp: make the curve fit independent of the CPU (fixes the flaky fonts-are-current check)

Closed
RI
2d ago
+33-3

Failing run: 41302995275 (workflow_dispatch after the Dependabot merge on 1 Nov). Not caused by the bump: the same check failed on 30 Oct with the old pins and passed on other runs of identical inputs.

Cause: np.power (m ** 3, t ** 3 in loom/outline.py) uses a different AVX-512 (SVML) code path than on CPUs without AVX-512. GitHub runners are mixed. On a diagnostic run of 6 dispatches, the 3 runners with avx512f (EPYC 9V45, Xeon 6973P) built the committed Xi glyph (sha256 151aea5a), the 3 without it (EPYC 7763 and 9V74) built another (5ac2ade7): 8 points of one curve fit move by 1 to 2 font units in Regular Xi. Only Regular Xi is affected; a corner/curve-split decision is discontinuous.

Fix: write the Bezier terms as products. Reproduced locally by switching the AVX-512 paths off (NPY_DISABLE_CPU_FEATURES='X86_V4 AVX512_ICL'): before the fix the Xi glyph differs and matches the CI hash 5ac2ade7; after the fix the Regular UFO is byte identical with and without AVX-512, and identical to the one the committed fonts come from. No font file changes, no glyph design changes, the check stays. New test test_curve_fit_does_not_depend_on_cpu_features fails on the old code and passes now (on an AVX-512 machine).

weft, heddle and sans do not use NumPy, so they do not have this exposure.

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency of outline curve calculations across different CPU configurations.
  • Tests
    • Added checks to verify that curve-fitting results remain consistent across CPU configurations.