Skip to content

fix(borg): widen FP16 reciprocal LUT - #3

Merged
gonsolo merged 1 commit into
gonsolo:mainfrom
kanapitsas:fp16-rcp-lut-33
Sep 4, 2026
Merged

gonsolo merged 1 commit into
gonsolo:mainfrom
kanapitsas:fp16-rcp-lut-33

Conversation

@kanapitsas

Copy link
Copy Markdown
Contributor

Fixes #2.

Summary

  • Widen rcpLut from 17 to 33 entries and index it on mant(9,5).
  • Pre-double the 5-bit interpolation fraction to keep the shared >> 6 datapath.
  • Turn FrcpPrecisionTests into a regression check.
  • Update the ROM copies and documentation.

This adds 160 LUT bits per lane and no extra cycle. Inputs above the Vulkan divisor range
are not fixed; at exponent 29, the worst error changes from 1022.0 to 1022.5 ULP.

Results

FRCP alone — exhaustive, 57,346 inputs OpFDiv — exhaustive, 1,048,576 pairs
17 entries 168 over bound, worst 2.555 ULP 3,507 over bound, worst 3.295 ULP
33 entries 0 over bound, worst 1.000 ULP 0 over bound, worst 2.245 ULP

The OpFDiv sweep covers all mantissa pairs for normal quotients. The RTL test reports
0.955 ULP for FRCP and 2.074 ULP for its FDIV sample.

Tests

  • mill hardware.borg.test.testOnly borg.FrcpPrecisionTests — 3/3
  • mill hardware.borg.test — 19/19

Not run: make test-all (cocotb and gate-level suites).

Fixes gonsolo#2.

Widen rcpLut from 17 to 33 entries and index it on mant(9,5).
Pre-double the 5-bit interpolation fraction to keep the shared shift
unchanged.

An exhaustive normal-quotient sweep reduces the worst OpFDiv error
from 3.295 to 2.245 ULP, with no result above the Vulkan 2.5 ULP
bound. FrcpPrecisionTests now enforces the bound.

Tests: mill hardware.borg.test
@gonsolo
gonsolo merged commit eecacfd into gonsolo:main Sep 4, 2026
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.

FP16 division exceeds the Vulkan 2.5 ULP bound

2 participants