Skip to content

feat(gf16): implement φ-optimized FMA/FMS operations#57

Merged
gHashTag merged 1 commit into
mainfrom
feat/issue-4-phi-fma
Apr 29, 2026
Merged

feat(gf16): implement φ-optimized FMA/FMS operations#57
gHashTag merged 1 commit into
mainfrom
feat/issue-4-phi-fma

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

Summary

Implements φ-optimized fused multiply-add and multiply-subtract for GF16, as requested in #4.

New Functions

GF16 core (src/formats/golden_float16.zig):

  • phiFma(a, b, c) — φ-dequantize all inputs, compute a*b+c in f32, φ-quantize result
  • phiFms(a, b, c) — φ-dequantize all inputs, compute a*b-c in f32, φ-quantize result
  • fma(a, b, c) — standard FMA without φ scaling (was only in c_abi, now also in GF16 struct)

C-ABI (src/c_abi.zig):

  • gf16_phi_fma(a, b, c) — exported C function
  • gf16_phi_fms(a, b, c) — exported C function

C header (src/c/gf16.h):

  • Declarations for both new functions

Tests Added (6)

  • GF16 phi-fused multiply-add
  • GF16 phi-fused multiply-subtract
  • GF16 standard fused multiply-add
  • C-ABI: gf16_phi_fma
  • C-ABI: gf16_phi_fms
  • C-ABI: gf16_fma (existing, kept)

Closes #4

Add three new fused operations to GF16:
- phiFma(a, b, c): φ-dequantize inputs, compute a*b+c, φ-quantize result
- phiFms(a, b, c): φ-dequantize inputs, compute a*b-c, φ-quantize result
- fma(a, b, c): standard fused multiply-add (no φ scaling)

Also adds C-ABI exports (gf16_phi_fma, gf16_phi_fms) and C header
declarations, plus 6 new tests (3 GF16 core, 3 C-ABI).

Closes #4
@gHashTag gHashTag merged commit e2c100d into main Apr 29, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IIGLA-GF16: Implement φ-optimized FMA operations

1 participant