From 23a654fd2b678377221d1e5893d2ccbab74fde15 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Sun, 22 Nov 2026 21:43:14 +0100 Subject: [PATCH 1/8] [VFDLIBM-30] State issue #30's tie rules as set, cosh as their exception, and requote the 8573C's datapath readings Generated-by: Claude Code (Opus 5.5) --- HARDWARE.md | 23 +++++---- PLAN.md | 22 ++++++--- README.md | 10 ++-- SKILLS.md | 47 ++++++++++--------- .../io/github/vecbricks/vfdlibm/Cosh.java | 14 +++--- .../java/io/github/vecbricks/vfdlibm/Exp.java | 7 +-- .../io/github/vecbricks/vfdlibm/Expm1.java | 7 +-- .../java/io/github/vecbricks/vfdlibm/Log.java | 11 +++-- .../io/github/vecbricks/vfdlibm/Log1p.java | 8 ++-- 9 files changed, 87 insertions(+), 62 deletions(-) diff --git a/HARDWARE.md b/HARDWARE.md index c6ccfc9..162c8c3 100644 --- a/HARDWARE.md +++ b/HARDWARE.md @@ -35,7 +35,7 @@ be the whole string ("The Arm host" below). | machine | host key and CPU string | vector flags | JVM | lane-ops/ns at 128 / 256 / 512 | control | 512:256 | source | |---|---|---|---|---|---|---|---| -| Intel Xeon Platinum 8573C | `xeon8573c`, `INTEL(R) XEON(R) PLATINUM 8573C` | full `avx512` set | `UseAVX=3`, `MaxVectorSize=64` | two readings: 34.5-34.8 / 68.8-69.2 / 93.7-94.1 (eight files, 3 to 21 November 2026); 41.5 / 82.7 / 113.0 (one file, 3 November) | 1.98 to 2.00 in the files; 2.00 to 2.03 in Varka's runs | 1.36 to 1.37 in the files; 1.34 to 1.36 in Varka's runs | Varka, `VARKA-62.md` 11.9, 4 runs (the control and 512:256 ranges of Varka's runs); the files named under "The 8573C's two readings" below; the string from vecbricks/varka's fork runs 41465323581, 41255932044 and 41241977271 (the owner's fork of apache/spark) | +| Intel Xeon Platinum 8573C | `xeon8573c`, `INTEL(R) XEON(R) PLATINUM 8573C` | full `avx512` set | `UseAVX=3`, `MaxVectorSize=64` | two readings: 34.5-35.7 / 68.8-70.8 / 93.7-96.3 (fifteen files, 3 to 22 November 2026); 41.5 / 82.7 / 113.0 (one file, 3 November) | 1.98 to 2.00 in the files; 2.00 to 2.03 in Varka's runs | 1.36 to 1.37 in the files; 1.34 to 1.36 in Varka's runs | Varka, `VARKA-62.md` 11.9, 4 runs (the control and 512:256 ranges of Varka's runs); the files named under "The 8573C's two readings" below; the string from vecbricks/varka's fork runs 41465323581, 41255932044 and 41241977271 (the owner's fork of apache/spark) | | Intel Xeon 6973P-C (Granite Rapids) | `xeon6973p`, `Intel(R) Xeon(R) 6973P-C` | full `avx512` set | `UseAVX=3`, `MaxVectorSize=64` | see source | 2.00 to 2.01 | 1.33 to 1.35 | Varka, `VARKA-62.md` 11.9, 2 runs; the string from vfdlibm run 41442062308 | | AMD EPYC 9V45 (Zen 5) | `epyc9v45`, `AMD EPYC 9V45 96-Core Processor` | full `avx512` set | `UseAVX=3`, `MaxVectorSize=64` | see source | 2.04 | 1.99 | Varka, `VARKA-62.md` 11.9, 1 run; the string from Varka's fork runs 41486339971, 41446843041 and 41329377429 | | AMD EPYC 7763 (Zen 3) | `epyc7763`, `AMD EPYC 7763 64-Core Processor` | `avx2`, no `avx512` | `UseAVX=2`, `MaxVectorSize=32` | 45.0-46.5 / 90.0-92.6 / 90.0-92.6 | 1.99 to 2.01 | 1.00 | Varka, `VARKA-62.md` 11.9, 8 runs; the lane rates, a range, from 16 Varka fork runs, 31 October to 2 November 2026 (41236071283 to 41460150392); the string from `bench/results/exp-epyc7763-2026-11-02.txt` and `log-epyc7763-2026-11-02.txt`; `exp-epyc7763-2026-11-20.txt` reads 46.2 / 92.2 / 92.5 (control 2.00, 512:256 1.00) in its first run and 46.3 / 92.4 / 92.4 in its second, inside the range | @@ -74,15 +74,18 @@ it, none is claimed, and whether the ports' arms should differ on Arm waits for ### The 8573C's two readings -Eight of the nine files of this host read 34.5 to 34.8 lane-ops/ns at 128 bits, 68.8 to 69.2 at -256 and 93.7 to 94.1 at 512: `exp-onediv-xeon8573c-2026-11-03.txt` (34.7 / 68.8 / 94.1, control -1.98, 512:256 1.37), `expm1-xeon8573c-2026-11-04.txt` (34.8 / 69.2 / 94.1, 1.99, 1.36) and the six -files of 21 November, `exp-xeon8573c-2026-11-21.txt` and its five siblings (34.5 / 69.1 / 93.7, -2.00, 1.36). `log1p-xeon8573c-2026-11-03.txt`, of the same day as the pair, reads 41.5 / 82.7 / -113.0 (1.99, 1.37), and its scalar `StrictMath` loop reads 7,358 ns on common data where the -`log1p` file of 21 November reads 8,846. Each file's header says which it ran on; no cause for the -difference is claimed here. The 25 nightly draws of this CPU in "What the pool gives" below read -34.5 to 41.7, 68.9 to 83.2 and 93.6 to 113.0 at the three widths. +Fifteen of the sixteen files of this host read 34.5 to 35.7 lane-ops/ns at 128 bits, 68.8 to 70.8 +at 256 and 93.7 to 96.3 at 512: `exp-onediv-xeon8573c-2026-11-03.txt` (34.7 / 68.8 / 94.1, control +1.98, 512:256 1.37), `expm1-xeon8573c-2026-11-04.txt` (34.8 / 69.2 / 94.1, 1.99, 1.36), the nine +files of 21 November, from two runs: `exp-xeon8573c-2026-11-21.txt` and its five siblings (34.5 / +69.1 / 93.7, 2.00, 1.36) and `sinh-`, `cosh-` and `cosh-kinds-xeon8573c-2026-11-21.txt` (34.9 / +69.9 / 94.8, 2.00, 1.36), and the four of 22 November, `asin-xeon8573c-2026-11-22.txt` and its +three siblings (35.7 / 70.8 / 96.3, 1.98, 1.36). `log1p-xeon8573c-2026-11-03.txt`, of the same +day as the pair, reads 41.5 / 82.7 / 113.0 (1.99, 1.37), and its scalar `StrictMath` loop reads +7,358 ns on common data where the `log1p` file of 21 November reads 8,846. Each file's header says +which it ran on; no cause for the difference is claimed here. The 25 nightly draws of this CPU in +"What the pool gives" below read 34.5 to 41.7, 68.9 to 83.2 and 93.6 to 113.0 at the three +widths. The two Xeons are the AVX-512 hosts results wait for and are read first; their 512:256 of about 1.35 means a 512-bit arm can win there, but not by the factor of two its lane count suggests. diff --git a/PLAN.md b/PLAN.md index 5f603a1..b3b6e16 100644 --- a/PLAN.md +++ b/PLAN.md @@ -42,7 +42,8 @@ own logarithm and exponential and calls only `sqrt`, `fabs` and `scalbn`. `sinh` (`VFdlibm.sinh`, from `e_sinh.c`, computing through `expm1`'s common path below 22 and finishing the rest per lane), and so is `cosh` (`VFdlibm.cosh`, from `e_cosh.c`, through `exp`'s common path and expm1's `k == 0` lines, with two arms for its small range: the default arm is the slice arm, -provisionally, the host files of 21 November timing both and deciding neither). `asin` is done +provisionally: the host files of 21 November read the finish arm lower on every `CoshBenchmark` +row, by ratios near 1.3x or inside it, and decide neither). `asin` is done too (`VFdlibm.asin`, from `e_asin.c`, with `sqrt` as the Vector API's `SQRT`, one arm, and the lanes of `|x| >= 1` finished per lane), and so is `atan` (`VFdlibm.atan`, from `s_atan.c`, five ranges through one division on blended operands, the lanes from `2^66` up finished per lane), and @@ -136,12 +137,19 @@ five are a later, optional set; the large-argument reduction of the trigonometri The code has changed since both runs (a fault constant and a local in the k conversion, and the finish's first eight lanes written out with constant indices), so no run has timed today's `exp` but for the rows of that pair. - Which arm each function keeps stays provisional until the 8573C has a second run, the other - AVX-512 hosts a first, and a pair exists, and the rules for a tie within 1.3x and for hosts that - disagree are set (issue #30); meanwhile `VFdlibm` calls the finish arm of `exp`, `log` and - `log10`, the guarded arm of `expm1`, `log1p` and `atan2` and the slice arm of `cosh` - (`bench/results/cosh-*-2026-11-21.txt` and `atan2-*-2026-11-22.txt` give the arms of `cosh` - and `atan2` no direction, and each wants a re-run on the EPYC 7763 too). + Which arm each function keeps follows the two rules issue #30 set on 21 November 2026: a tie + within 1.3x on every host that has a file goes to the finish arm, except for `cosh`, whose + per-lane set is not rare, so a host run decides its arm; and where hosts disagree, each species + keeps the arm its own rows choose by that rule. Every default stays provisional until a host run + revises it (a second run of the 8573C, a first of the other AVX-512 hosts). Meanwhile `VFdlibm` + calls the finish arm of `exp`, `log` and `log10`; the guarded arm of `expm1` and `log1p`, which + the rule would move to the finish arm once the 8573C's second run is in (issue #30); the slice + arm of `cosh`, provisionally, as the rule's exception + (`bench/results/cosh-xeon8573c-2026-11-21.txt` and `cosh-epyc7763-2026-11-21.txt` read the + finish arm lower on every row by ratios near 1.3x or inside it, and give no direction); and the + guarded arm of `atan2`, which has no finish arm, provisionally until a re-run + (`atan2-xeon8573c-2026-11-22.txt` and `atan2-epyc7763-2026-11-22.txt` give its arms no + direction). ## 6. Rules diff --git a/README.md b/README.md index 1927a3b..2b11b6d 100644 --- a/README.md +++ b/README.md @@ -182,10 +182,12 @@ fdlibm's own sequence of operations, lane by lane. That is this library. one arm, `exp`, `expm1`, `log`, `log10`, `log1p`, `cosh` and `atan2`, each have files from the Xeon Platinum 8573C and the EPYC 7763 (`bench/results/`), and each file's reading is in `SKILLS.md`; where two arms are within 1.3x of each other no direction is read, and where the - hosts disagree the files say so. The decision waits for a second run of the 8573C and a first of - the other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when drawn), for `cosh` and `atan2` a - second run of the EPYC 7763 too, a pair, and the rules for a tie and for hosts that disagree - (issue #30). The laptop's numbers do not agree at every width. + hosts disagree the files say so. The rules are set (issue #30): a tie within 1.3x goes to the + finish arm, except for `cosh`, whose arm a host run decides, and where hosts disagree each + species keeps its own arm. Every default stays provisional until a host run revises it: a second + run of the 8573C and a first of the other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when + drawn), and for `cosh` and `atan2` a second run of the EPYC 7763 too. The laptop's numbers do + not agree at every width. ## Testing diff --git a/SKILLS.md b/SKILLS.md index 06843a8..ff0dfa2 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -337,9 +337,10 @@ stops the next port re-trying a settled question. time `exp` as of a5683c3 and a1db6df, and `Exp.java` has changed since by a fault constant, a local and the finish's first eight lanes written out with constant indices (issue #37), so no run has timed today's body as a whole: the pair above times rows of it after that change, on one - host. Which arm `VFdlibm.exp` keeps is not decided here: it waits for a second - run of the Xeon 8573C and a first of the other AVX-512 hosts, a pair and the rules for a tie - within 1.3x and for hosts that disagree (issue #30). Each port measures both on common and mixed + host. `VFdlibm.exp` keeps the finish arm by the rules issue #30 set (a tie within 1.3x goes to + the finish arm; where hosts disagree, one arm per species), provisionally until a host run + revises it: a second run of the Xeon 8573C, a first of the other AVX-512 hosts or a pair. Each + port measures both on common and mixed data, decides per branch, and records the decision in its pull request (`PLAN.md` section 5). - **A blended alternative costs its whole form in every lane.** exp computed the C's near form and its `k == 0` form for every lane and blended them. Proving that the far form and the general tail @@ -407,9 +408,9 @@ stops the next port re-trying a settled question. 512-bit rows run in the Java fallback), so the files show no disagreement between the hosts at equal width. Both files time the `log` of a5683c3 and a1db6df, before the finish's first eight lanes written out with constant indices (issue #37); `LogBenchmark` gained its `finishMax` row - after the EPYC run, which is why that file has none. Which arm `VFdlibm.log` keeps is not decided - here: it waits for a second Xeon run, a pair and the rules for a tie within 1.3x and for hosts - that disagree (issue #30). Measure the finish only once it allocates nothing. + after the EPYC run, which is why that file has none. `VFdlibm.log` keeps the finish arm by the + rules issue #30 set (a tie within 1.3x goes to the finish arm), provisionally until a host run + revises it: a second Xeon run or a pair. Measure the finish only once it allocates nothing. - **Int words can live in long lanes, with an exact dk.** log first kept its words in int lanes for the `I2D`; moving them to the long lanes of the bits drops `L2I`, `I2L`, `I2D` and the @@ -471,9 +472,10 @@ stops the next port re-trying a settled question. datapath read higher, `HARDWARE.md`) had guarded lowest on every row. The EPYC file times `Log1p` as of a5683c3, before a fault constant and a mask local were added; the Xeon file of 21 November times it as of a1db6df; neither times it after the finish's first eight lanes written out with - constant indices (issue #37). `VFdlibm.log1p` uses the guarded arm provisionally: the decision - waits for a second run of the Xeon 8573C and a first of the other AVX-512 hosts, a pair and the - rules for a tie within 1.3x and for hosts that disagree (issue #30). A port whose rare paths are + constant indices (issue #37). `VFdlibm.log1p` uses the guarded arm provisionally: by the rules + issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move log1p to it once + the Xeon 8573C's second run is in; a first run of the other AVX-512 hosts or a pair may revise + the choice. A port whose rare paths are cheap in vector form should measure this shape beside the other two. - **The in-body finish allocates nothing in log1p too.** log1p's finish was first a call, `finishPerLane(x, result, rare)`, and boxed: 52,928 B/op on mixed data at 256 bits under @@ -553,9 +555,9 @@ stops the next port re-trying a settled question. of a5683c3 and a1db6df, before the finish's first eight lanes written out with constant indices (issue #37); the pair of that change (the exp entry above) reads log10's mixed finish rows 2.6% to 4.0% slower by median and 3.7% to 4.1% by best on the EPYC 7763, the cause not known. - `VFdlibm.log10` calls the finish arm provisionally: the decision waits for a second run of the - Xeon 8573C and a first of the other AVX-512 hosts, a pair and the rules for a tie - within 1.3x and for hosts that disagree (issue #30). + `VFdlibm.log10` calls the finish arm by the rules issue #30 set (a tie within 1.3x goes to the + finish arm), provisionally until a host run revises it: a second run of the Xeon 8573C, a first + of the other AVX-512 hosts or a pair. ## What the expm1 port taught @@ -611,9 +613,10 @@ stops the next port re-trying a settled question. arm has the lowest minimum on mixed data (finish on the EPYC, guarded on the Xeon). The Xeon file of 4 November (`bench/results/expm1-xeon8573c-2026-11-04.txt`, one run, at another commit) had guarded lowest on the preferred rows of both kinds of data; the file of 21 November has finish - lowest there on common data. `VFdlibm.expm1` keeps the guarded arm provisionally: the decision - waits for a second run of the Xeon 8573C and a first of the other AVX-512 hosts, a pair and the - rules for a tie within 1.3x and for hosts that disagree (issue #30). Both files time `Expm1` + lowest there on common data. `VFdlibm.expm1` keeps the guarded arm provisionally: by the rules + issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move expm1 to it once + the Xeon 8573C's second run is in; a first run of the other AVX-512 hosts or a pair may revise + the choice. Both files time `Expm1` before its core entry (below) and before the finish's first eight lanes written out with constant indices (issue #37), and `Expm1.java` changed between their two commits too (a fault constant and a local in the k conversion, as for `Exp`), so the cross-host comparison rests on @@ -989,12 +992,14 @@ stops the next port re-trying a settled question. not kept. Each host has since run both classes once (`bench/results/cosh-xeon8573c-2026-11-21.txt`, `cosh-epyc7763-2026-11-21.txt`, `cosh-kinds-xeon8573c-2026-11-21.txt` and `cosh-kinds-epyc7763-2026-11-21.txt`), and no file - decides the arm: on `CoshBenchmark` the ratios between the arms are near 1.3x, waiting for a - re-run before a direction is written, or inside it, with no direction; on `CoshKindsBench` the - finish arm reads lower by more than 1.3x only on data with no small lane, and the arms read - within 1.3x of each other, with no direction, at 3.5% and 17% of small lanes, Varka's and - Spark's shares. So the default is still the plan's baseline design, not a measurement, and - stays provisional until a re-run and issue #30's rules decide it. + decides the arm: on `CoshBenchmark` the finish arm reads lower on every row, slice over finish + 1.24 to 1.35 on the Xeon 8573C and 1.29 to 1.35 on the EPYC 7763, ratios near 1.3x or inside + it that give no direction until a re-run; on `CoshKindsBench` the finish arm reads lower by + more than 1.3x only on data with no small lane, and the arms read within 1.3x of each other, + with no direction, at 3.5% and 17% of small lanes, Varka's and Spark's shares. cosh is the + named exception to issue #30's tie rule (its per-lane set is not rare, so a host run decides), + so the default is still the plan's baseline design, not a measurement, and stays provisional + until a host run decides it. - **Which exp faults reach cosh.** `exp.dropCorrection` and `exp.constantOffByOneUlp`, which change `expCore`'s lanes of `|x| >= 0.5 ln2`. `exp.thresholdMoved` moves the subnormal scale-back, which `expCore` leaves out, and `exp.dropKForcing` the lanes of the word of 0.5 diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Cosh.java b/src/main/java/io/github/vecbricks/vfdlibm/Cosh.java index 0e91f76..9f34773 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Cosh.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Cosh.java @@ -85,12 +85,14 @@ * CoshBenchmark} and {@code CoshKindsBench} once ({@code * bench/results/cosh-xeon8573c-2026-11-21.txt}, {@code cosh-epyc7763-2026-11-21.txt} and the * two {@code cosh-kinds-} files of that day), and no file decides the arm. On {@code - * CoshBenchmark} the ratios between the arms are near 1.3x, waiting for a re-run before a - * direction is written, or inside it, with no direction. On {@code CoshKindsBench} the finish - * arm reads lower by more than 1.3x only on data with no small lane, and at 3.5% and 17% of - * small lanes the arms read within 1.3x of each other, with no direction ({@code SKILLS.md}, - * issue #30). The default is chosen in {@code cosh(x, live)}; other - * places say "the default arm". + * CoshBenchmark} the finish arm reads lower on every row, slice over finish 1.24 to 1.35 on the + * Xeon 8573C and 1.29 to 1.35 on the EPYC 7763, ratios near 1.3x or inside it that give no + * direction until a re-run. On {@code CoshKindsBench} the finish arm reads lower by more than + * 1.3x only on data with no small lane, and at 3.5% and 17% of small lanes the arms read within + * 1.3x of each other, with no direction ({@code SKILLS.md}). cosh is the named exception to + * issue #30's tie rule, since its per-lane set is not rare: a host run decides its arm, and the + * slice default stays provisional until one does. The default is chosen in {@code cosh(x, + * live)}; other places say "the default arm". */ final class Cosh { diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java index 68ea619..03ff040 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java @@ -76,9 +76,10 @@ * faster on mixed data, since it no longer boxes. The cause is not known, and no AVX-512 host has * been paired. * The first run's head is a branch tip, not a commit of main (that file's header says so). - * Which arm is kept waits for a second run of the Xeon 8573C and a first of the other AVX-512 hosts - * ({@code HARDWARE.md}), a pair, and the rules for a tie within 1.3x and for hosts that disagree - * (issue #30). The second arm is kept so the choice can be re-measured, on other hosts and as + * The rules for a tie within 1.3x and for hosts that disagree are set (issue #30): a tie goes to + * the finish arm, which exp keeps, and the choice stays provisional until a host run revises it, + * a second run of the Xeon 8573C, a first of the other AVX-512 hosts ({@code HARDWARE.md}) or a + * pair. The second arm is kept so the choice can be re-measured, on other hosts and as * the JDK changes. The folds above cut the common path C2 emits from 77 instructions with two * divisions to 52 with one at 512 bits on AVX-512, and from 107 to 64 at 256 bits under {@code * -XX:UseAVX=2} ({@code bench/asm/README.md}). The folded body was timed once as a pair against diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java index 4b3660e..ab87e42 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java @@ -93,9 +93,10 @@ * core rows, and also times the finish before the eight lanes; its minimums read the guarded * arm over the finish at 1.02 on common data and 1.07 to 1.08 on mixed data, against 1.13 to * 1.15 and 1.07 to 1.08 in the 20 November files, all within 1.3x, and no pair or re-run backs - * the 1.02. The choice waits for a second run - * of the Xeon 8573C and a first of the other AVX-512 hosts ({@code HARDWARE.md}), a pair, and - * the rules for a tie within 1.3x and for hosts that disagree (issue #30); the other two arms + * the 1.02. The rules for a tie within 1.3x and for hosts that disagree are set (issue #30): a + * tie goes to the finish arm, so rule 1 would move expm1 to the finish arm once the Xeon 8573C's + * second run is in; until then the guarded arm stays, provisionally, and a first run of the + * other AVX-512 hosts ({@code HARDWARE.md}) or a pair may revise the choice; the other two arms * are kept so it can be re-measured ({@code SKILLS.md}). * *

{@link #expm1Core} and {@link #expm1Rare} split the finish arm into its branch-free part and diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Log.java b/src/main/java/io/github/vecbricks/vfdlibm/Log.java index 4f836da..bada4e2 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Log.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Log.java @@ -76,11 +76,12 @@ * widths, its preferred species being 256 bits. On the EPYC's 256-bit and preferred rows the * finish read 0.017 B/op or less in JMH's table. Both host files time this class after the * departures of {@code PROOFS.md}'s L6 to L9 and before the finish's first eight lanes were - * written out with constant indices (issue #37). The choice waits for a second run of the Xeon - * 8573C and a first of the other AVX-512 hosts ({@code HARDWARE.md}), a pair ({@code - * bench/pair.sh}), and the rules for a tie within 1.3x and for hosts that disagree (issue #30); - * the second arm is kept so it can be re-measured, on other hosts and as the JDK changes. The - * laptop's runs measured the body before those departures. + * written out with constant indices (issue #37). The rules for a tie within 1.3x and for hosts + * that disagree are set (issue #30): a tie goes to the finish arm, which log keeps, and the choice + * stays provisional until a host run revises it, a second run of the Xeon 8573C, a first of the + * other AVX-512 hosts ({@code HARDWARE.md}) or a pair ({@code bench/pair.sh}); the second arm + * is kept so it can be re-measured, on other hosts and as the JDK changes. The laptop's runs + * measured the body before those departures. * *

{@link #logCore} is the common path alone, with no rare lanes and no finish: {@code Log10} * computes its {@code __ieee754_log} through it, the only entry it uses. diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java index afb57c5..272841e 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java @@ -84,9 +84,11 @@ * every one of those rows (the EPYC's 512-bit rows run in the Java fallback and are left out), * so no direction is read, and the lowest minimum moves between the finish and the guarded arm * from row to row. The Xeon file of 3 November ({@code log1p-xeon8573c-2026-11-03.txt}) had the - * guarded arm lowest on every 256-bit, 512-bit and preferred row. The choice waits for a second - * run of the Xeon 8573C and a first of the other AVX-512 hosts ({@code HARDWARE.md}), a pair, - * and the rules for a tie within 1.3x and for hosts that disagree (issue #30). The other two are + * guarded arm lowest on every 256-bit, 512-bit and preferred row. The rules for a tie within + * 1.3x and for hosts that disagree are set (issue #30): a tie goes to the finish arm, so rule 1 + * would move log1p to the finish arm once the Xeon 8573C's second run is in; until then the + * guarded arm stays, provisionally, and a first run of the other AVX-512 hosts ({@code + * HARDWARE.md}) or a pair may revise the choice. The other two are * kept so the choice can be re-measured, on other hosts and as the JDK changes. */ final class Log1p { From f73df9f935adab4b2f383c76acb76f49bb655af5 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Sun, 22 Nov 2026 21:49:40 +0100 Subject: [PATCH 2/8] [VFDLIBM-30] State atan2's guarded default, outside rule 1, and the rules' cases in README and PLAN Generated-by: Claude Code (Opus 5.5) --- PLAN.md | 22 ++++++++++++------- README.md | 13 ++++++----- SKILLS.md | 17 +++++++++----- .../io/github/vecbricks/vfdlibm/Atan2.java | 12 ++++++---- .../java/io/github/vecbricks/vfdlibm/Exp.java | 10 ++++----- 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/PLAN.md b/PLAN.md index b3b6e16..b0d3993 100644 --- a/PLAN.md +++ b/PLAN.md @@ -50,8 +50,8 @@ ranges through one division on blended operands, the lanes from `2^66` up finish so is `acos` (`VFdlibm.acos`, from `e_acos.c`, built as asin is), and so is `atan2` (`VFdlibm.atan2`, from `e_atan2.c`, the first function of two arguments: the special lanes blended over the general path, which calls `atan`'s core, no lane finished per lane, and two arms, the -blended one and the guarded one `VFdlibm` calls, provisionally: the host files of 22 November time -both and give them no direction). `log`, `log10` and `log1p` are done too (`VFdlibm.log`, from +blended one and the guarded one `VFdlibm` calls at every species, section 5 below says why). +`log`, `log10` and `log1p` are done too (`VFdlibm.log`, from `e_log.c`, `VFdlibm.log10`, from `e_log10.c`, which computes through log's common path, and `VFdlibm.log1p`, from `s_log1p.c`), and so is `expm1` (`VFdlibm.expm1`, from `s_expm1.c`, whose reduction is exp's). @@ -140,16 +140,22 @@ five are a later, optional set; the large-argument reduction of the trigonometri Which arm each function keeps follows the two rules issue #30 set on 21 November 2026: a tie within 1.3x on every host that has a file goes to the finish arm, except for `cosh`, whose per-lane set is not rare, so a host run decides its arm; and where hosts disagree, each species - keeps the arm its own rows choose by that rule. Every default stays provisional until a host run - revises it (a second run of the 8573C, a first of the other AVX-512 hosts). Meanwhile `VFdlibm` - calls the finish arm of `exp`, `log` and `log10`; the guarded arm of `expm1` and `log1p`, which + keeps the arm its own rows choose by that rule (decided; no function needs it yet, so `VFdlibm` + runs one arm at every species). Every default stays provisional until a host run revises it (a + second run of the 8573C, a first of the other AVX-512 hosts). Meanwhile `VFdlibm` calls the + finish arm of `exp`, `log` and `log10`; the guarded arm of `expm1` and `log1p`, which the rule would move to the finish arm once the 8573C's second run is in (issue #30); the slice arm of `cosh`, provisionally, as the rule's exception (`bench/results/cosh-xeon8573c-2026-11-21.txt` and `cosh-epyc7763-2026-11-21.txt` read the finish arm lower on every row by ratios near 1.3x or inside it, and give no direction); and the - guarded arm of `atan2`, which has no finish arm, provisionally until a re-run - (`atan2-xeon8573c-2026-11-22.txt` and `atan2-epyc7763-2026-11-22.txt` give its arms no - direction). + guarded arm of `atan2` at every species. atan2 has no finish arm (both arms compute the special + lanes in the vector; blended runs their blends in every vector, guarded behind a test), so rule + 1 does not pick between them ([issue #30's corrected + comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). On + `atan2-xeon8573c-2026-11-22.txt` and `atan2-epyc7763-2026-11-22.txt`, one run each, guarded + reads lower on the slower input at every species on the EPYC 7763 and at 256 bits on the 8573C; + at 512 bits on the 8573C the rows are a tie (blended lower by 3.3% at the preferred species and + 1.3% at `SPECIES_MAX`, inside the run's spread), which waits for the 8573C's second run. ## 6. Rules diff --git a/README.md b/README.md index 2b11b6d..6180011 100644 --- a/README.md +++ b/README.md @@ -183,11 +183,14 @@ fdlibm's own sequence of operations, lane by lane. That is this library. Xeon Platinum 8573C and the EPYC 7763 (`bench/results/`), and each file's reading is in `SKILLS.md`; where two arms are within 1.3x of each other no direction is read, and where the hosts disagree the files say so. The rules are set (issue #30): a tie within 1.3x goes to the - finish arm, except for `cosh`, whose arm a host run decides, and where hosts disagree each - species keeps its own arm. Every default stays provisional until a host run revises it: a second - run of the 8573C and a first of the other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when - drawn), and for `cosh` and `atan2` a second run of the EPYC 7763 too. The laptop's numbers do - not agree at every width. + finish arm, except for `cosh`, whose arm a host run decides, and for `atan2`, which has no + finish arm and keeps its guarded arm; `expm1` and `log1p` stay on their guarded arm until the + 8573C's second run, when the rule would move them to the finish arm; and where hosts disagree, + each species keeps its own arm (no function needs that yet, so each runs one arm at every + species). Every default stays provisional until a host run revises it, such as a second run of + the 8573C or a first of the other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when drawn); + `PLAN.md` section 5 gives each function's case. The laptop's numbers do not agree at every + width. ## Testing diff --git a/SKILLS.md b/SKILLS.md index ff0dfa2..db7440d 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -337,9 +337,10 @@ stops the next port re-trying a settled question. time `exp` as of a5683c3 and a1db6df, and `Exp.java` has changed since by a fault constant, a local and the finish's first eight lanes written out with constant indices (issue #37), so no run has timed today's body as a whole: the pair above times rows of it after that change, on one - host. `VFdlibm.exp` keeps the finish arm by the rules issue #30 set (a tie within 1.3x goes to - the finish arm; where hosts disagree, one arm per species), provisionally until a host run - revises it: a second run of the Xeon 8573C, a first of the other AVX-512 hosts or a pair. Each + host. `VFdlibm.exp` keeps the finish arm, which those files read lower than the blend by more + than 1.3x on mixed data on both hosts, and to which issue #30's rules send a tie; + provisionally, until a host run revises it: a second run of the Xeon 8573C, a first of the + other AVX-512 hosts or a pair. Each port measures both on common and mixed data, decides per branch, and records the decision in its pull request (`PLAN.md` section 5). - **A blended alternative costs its whole form in every lane.** exp computed the C's near form and @@ -1151,8 +1152,14 @@ stops the next port re-trying a settled question. AVX2 host, and CI runs it. Those local readings are not committed, so no figure of them is quoted. Each host has timed both arms once (`bench/results/atan2-xeon8573c-2026-11-22.txt` and `atan2-epyc7763-2026-11-22.txt`): on the Xeon they read within 1.3x of each other at every - width, and on the EPYC 7763 near 1.3x or inside it, so neither file gives them a direction, and - the guarded one stays the default provisionally until a re-run and issue #30's rules decide it. + width, and on the EPYC 7763 near 1.3x or inside it, so neither file gives them a direction. + atan2 has no finish arm (both arms compute the special lanes in the vector; blended runs their + blends in every vector, guarded behind a test), so rule 1 of issue #30 does not pick between + them ([the issue's corrected comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). + The guarded arm stays the default at every species: on those files it reads lower on the + slower input at every species on the EPYC 7763 and at 256 bits on the 8573C, and at 512 bits + on the 8573C the rows are a tie (blended lower by 3.3% at the preferred species and 1.3% at + `SPECIES_MAX`, inside the run's spread), which waits for the 8573C's second run. - **A lane the core must not see.** A NaN, an infinity or a huge `t` in a lane the special blends overwrite would send the vector to atan's per-lane finish. The mask `t < 2^66` keeps them out (a NaN compares false), and a vector with no special lane never reaches the finish. diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java b/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java index 7567992..b904526 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java @@ -58,10 +58,14 @@ * leaves those lanes out, so that no infinity or NaN of theirs reaches its finish. Two arms * share the body below: {@code blended} computes the special lanes' blends in every vector, * {@code guarded} only in a vector with a live special lane, which is the one {@code VFdlibm} - * calls, provisionally. Each host has timed the two arms once ({@code - * bench/results/atan2-xeon8573c-2026-11-22.txt} and {@code atan2-epyc7763-2026-11-22.txt}): - * neither file gives them a direction, the Xeon's ratios being inside 1.3x and the EPYC 7763's - * near it or inside it, so the default stays until a re-run and issue #30's rules decide it. + * calls, at every species. atan2 has no finish arm, so rule 1 of issue #30 (a tie goes to the + * finish arm) does not pick between the two (the issue's corrected comment, + * https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272). On {@code + * bench/results/atan2-xeon8573c-2026-11-22.txt} and {@code atan2-epyc7763-2026-11-22.txt}, one + * run each, the guarded arm reads lower on the slower input at every species on the EPYC 7763 + * and at 256 bits on the Xeon 8573C; at 512 bits on the 8573C the rows are a tie, the blended arm + * lower by 3.3% at the preferred species and 1.3% at {@code SPECIES_MAX}, inside the run's + * spread, which waits for the 8573C's second run. */ final class Atan2 { diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java index 03ff040..f28617f 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java @@ -76,11 +76,11 @@ * faster on mixed data, since it no longer boxes. The cause is not known, and no AVX-512 host has * been paired. * The first run's head is a branch tip, not a commit of main (that file's header says so). - * The rules for a tie within 1.3x and for hosts that disagree are set (issue #30): a tie goes to - * the finish arm, which exp keeps, and the choice stays provisional until a host run revises it, - * a second run of the Xeon 8573C, a first of the other AVX-512 hosts ({@code HARDWARE.md}) or a - * pair. The second arm is kept so the choice can be re-measured, on other hosts and as - * the JDK changes. The folds above cut the common path C2 emits from 77 instructions with two + * exp keeps the finish arm, which the host files read lower than the blend by more than 1.3x on + * mixed data on both hosts ({@code PLAN.md}, section 5), and to which issue #30's rules send a + * tie; the choice stays provisional until a host run revises it, a second run of the Xeon 8573C, + * a first of the other AVX-512 hosts ({@code HARDWARE.md}) or a pair. The second arm is kept so + * the choice can be re-measured, on other hosts and as the JDK changes. The folds above cut the common path C2 emits from 77 instructions with two * divisions to 52 with one at 512 bits on AVX-512, and from 107 to 64 at 256 bits under {@code * -XX:UseAVX=2} ({@code bench/asm/README.md}). The folded body was timed once as a pair against * its base on the Xeon Platinum 8573C ({@code From f88eb336482715d504415599f8cd94d074aabab8 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Sun, 22 Nov 2026 21:54:33 +0100 Subject: [PATCH 3/8] [VFDLIBM-30] Requote log10's rule sentence, the would-move condition and atan2 in README Generated-by: Claude Code (Opus 5.5) --- PLAN.md | 3 ++- README.md | 12 +++++++----- SKILLS.md | 17 +++++++++++------ .../java/io/github/vecbricks/vfdlibm/Exp.java | 5 +++-- .../java/io/github/vecbricks/vfdlibm/Expm1.java | 5 +++-- .../java/io/github/vecbricks/vfdlibm/Log10.java | 8 ++++---- .../java/io/github/vecbricks/vfdlibm/Log1p.java | 3 ++- 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/PLAN.md b/PLAN.md index b0d3993..7a13cec 100644 --- a/PLAN.md +++ b/PLAN.md @@ -144,7 +144,8 @@ five are a later, optional set; the large-argument reduction of the trigonometri runs one arm at every species). Every default stays provisional until a host run revises it (a second run of the 8573C, a first of the other AVX-512 hosts). Meanwhile `VFdlibm` calls the finish arm of `exp`, `log` and `log10`; the guarded arm of `expm1` and `log1p`, which - the rule would move to the finish arm once the 8573C's second run is in (issue #30); the slice + the rule would move to the finish arm if their arms are still within 1.3x on the 8573C's + second run (issue #30); the slice arm of `cosh`, provisionally, as the rule's exception (`bench/results/cosh-xeon8573c-2026-11-21.txt` and `cosh-epyc7763-2026-11-21.txt` read the finish arm lower on every row by ratios near 1.3x or inside it, and give no direction); and the diff --git a/README.md b/README.md index 6180011..9b79f01 100644 --- a/README.md +++ b/README.md @@ -183,11 +183,13 @@ fdlibm's own sequence of operations, lane by lane. That is this library. Xeon Platinum 8573C and the EPYC 7763 (`bench/results/`), and each file's reading is in `SKILLS.md`; where two arms are within 1.3x of each other no direction is read, and where the hosts disagree the files say so. The rules are set (issue #30): a tie within 1.3x goes to the - finish arm, except for `cosh`, whose arm a host run decides, and for `atan2`, which has no - finish arm and keeps its guarded arm; `expm1` and `log1p` stay on their guarded arm until the - 8573C's second run, when the rule would move them to the finish arm; and where hosts disagree, - each species keeps its own arm (no function needs that yet, so each runs one arm at every - species). Every default stays provisional until a host run revises it, such as a second run of + finish arm, except for `cosh`, whose arm a host run decides; `expm1` and `log1p` stay on their + guarded arm until the 8573C's second run, and the rule would move them to the finish arm if + their arms are still within 1.3x there; and where hosts disagree, each species keeps its own + arm (no function needs that yet, so each runs one arm at every species). `atan2` has no finish + arm, so the rule does not pick between its two: its guarded arm is the default at every species, + and the 8573C's 512-bit rows, a tie, wait for its second run. Every default stays provisional + until a host run revises it, such as a second run of the 8573C or a first of the other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when drawn); `PLAN.md` section 5 gives each function's case. The laptop's numbers do not agree at every width. diff --git a/SKILLS.md b/SKILLS.md index db7440d..8ecf69e 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -411,7 +411,9 @@ stops the next port re-trying a settled question. lanes written out with constant indices (issue #37); `LogBenchmark` gained its `finishMax` row after the EPYC run, which is why that file has none. `VFdlibm.log` keeps the finish arm by the rules issue #30 set (a tie within 1.3x goes to the finish arm), provisionally until a host run - revises it: a second Xeon run or a pair. Measure the finish only once it allocates nothing. + revises it: a second Xeon run or a pair. The 8573C's mixed rows at 512 bits and the preferred + species read the blend lower by 1.29 to 1.30x, on rule 2's line, and wait for that second run + like the rest. Measure the finish only once it allocates nothing. - **Int words can live in long lanes, with an exact dk.** log first kept its words in int lanes for the `I2D`; moving them to the long lanes of the bits drops `L2I`, `I2L`, `I2D` and the @@ -474,8 +476,9 @@ stops the next port re-trying a settled question. as of a5683c3, before a fault constant and a mask local were added; the Xeon file of 21 November times it as of a1db6df; neither times it after the finish's first eight lanes written out with constant indices (issue #37). `VFdlibm.log1p` uses the guarded arm provisionally: by the rules - issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move log1p to it once - the Xeon 8573C's second run is in; a first run of the other AVX-512 hosts or a pair may revise + issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move log1p to it if + its arms are still within 1.3x on the Xeon 8573C's second run; a first run of the other AVX-512 + hosts or a pair may revise the choice. A port whose rare paths are cheap in vector form should measure this shape beside the other two. - **The in-body finish allocates nothing in log1p too.** log1p's finish was first a call, @@ -615,8 +618,9 @@ stops the next port re-trying a settled question. of 4 November (`bench/results/expm1-xeon8573c-2026-11-04.txt`, one run, at another commit) had guarded lowest on the preferred rows of both kinds of data; the file of 21 November has finish lowest there on common data. `VFdlibm.expm1` keeps the guarded arm provisionally: by the rules - issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move expm1 to it once - the Xeon 8573C's second run is in; a first run of the other AVX-512 hosts or a pair may revise + issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move expm1 to it if + its arms are still within 1.3x on the Xeon 8573C's second run; a first run of the other AVX-512 + hosts or a pair may revise the choice. Both files time `Expm1` before its core entry (below) and before the finish's first eight lanes written out with constant indices (issue #37), and `Expm1.java` changed between their two commits too (a fault @@ -1155,7 +1159,8 @@ stops the next port re-trying a settled question. width, and on the EPYC 7763 near 1.3x or inside it, so neither file gives them a direction. atan2 has no finish arm (both arms compute the special lanes in the vector; blended runs their blends in every vector, guarded behind a test), so rule 1 of issue #30 does not pick between - them ([the issue's corrected comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). + them ([the issue's corrected + comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). The guarded arm stays the default at every species: on those files it reads lower on the slower input at every species on the EPYC 7763 and at 256 bits on the 8573C, and at 512 bits on the 8573C the rows are a tie (blended lower by 3.3% at the preferred species and 1.3% at diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java index f28617f..9230762 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java @@ -80,8 +80,9 @@ * mixed data on both hosts ({@code PLAN.md}, section 5), and to which issue #30's rules send a * tie; the choice stays provisional until a host run revises it, a second run of the Xeon 8573C, * a first of the other AVX-512 hosts ({@code HARDWARE.md}) or a pair. The second arm is kept so - * the choice can be re-measured, on other hosts and as the JDK changes. The folds above cut the common path C2 emits from 77 instructions with two - * divisions to 52 with one at 512 bits on AVX-512, and from 107 to 64 at 256 bits under {@code + * the choice can be re-measured, on other hosts and as the JDK changes. The folds above cut the + * common path C2 emits from 77 instructions with two divisions to 52 with one at 512 bits on + * AVX-512, and from 107 to 64 at 256 bits under {@code * -XX:UseAVX=2} ({@code bench/asm/README.md}). The folded body was timed once as a pair against * its base on the Xeon Platinum 8573C ({@code * bench/results/exp-onediv-xeon8573c-2026-11-03.txt}): on common data its 256-bit, 512-bit, diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java index ab87e42..78414f4 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java @@ -94,8 +94,9 @@ * arm over the finish at 1.02 on common data and 1.07 to 1.08 on mixed data, against 1.13 to * 1.15 and 1.07 to 1.08 in the 20 November files, all within 1.3x, and no pair or re-run backs * the 1.02. The rules for a tie within 1.3x and for hosts that disagree are set (issue #30): a - * tie goes to the finish arm, so rule 1 would move expm1 to the finish arm once the Xeon 8573C's - * second run is in; until then the guarded arm stays, provisionally, and a first run of the + * tie goes to the finish arm, so rule 1 would move expm1 to the finish arm if its arms are still + * within 1.3x on the Xeon 8573C's second run; until then the guarded arm stays, provisionally, and + * a first run of the * other AVX-512 hosts ({@code HARDWARE.md}) or a pair may revise the choice; the other two arms * are kept so it can be re-measured ({@code SKILLS.md}). * diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Log10.java b/src/main/java/io/github/vecbricks/vfdlibm/Log10.java index 26ad44f..7e20a0b 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Log10.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Log10.java @@ -82,10 +82,10 @@ * slower by median and 3.7% to 4.1% by best in two runs ({@code * bench/results/exp-log10-pair-epyc7763-2026-11-21.txt} and {@code * bench/results/exp-log10-pair-rerun-epyc7763-2026-11-21.txt}), the cause not known, and no - * AVX-512 host paired. The choice waits for a second run of the - * Xeon 8573C and a first of the other AVX-512 hosts ({@code HARDWARE.md}), a pair, and the rules - * for a tie within 1.3x and for hosts that disagree (issue #30); the second arm is kept so the - * choice can be re-measured. + * AVX-512 host paired. log10 calls the finish arm by the rules issue #30 set (a tie within 1.3x + * goes to the finish arm), provisionally until a host run revises it: a second run of the Xeon + * 8573C, a first of the other AVX-512 hosts ({@code HARDWARE.md}) or a pair; the second arm is + * kept so the choice can be re-measured. */ final class Log10 { diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java index 272841e..99a0c6b 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java @@ -86,7 +86,8 @@ * from row to row. The Xeon file of 3 November ({@code log1p-xeon8573c-2026-11-03.txt}) had the * guarded arm lowest on every 256-bit, 512-bit and preferred row. The rules for a tie within * 1.3x and for hosts that disagree are set (issue #30): a tie goes to the finish arm, so rule 1 - * would move log1p to the finish arm once the Xeon 8573C's second run is in; until then the + * would move log1p to the finish arm if its arms are still within 1.3x on the Xeon 8573C's + * second run; until then the * guarded arm stays, provisionally, and a first run of the other AVX-512 hosts ({@code * HARDWARE.md}) or a pair may revise the choice. The other two are * kept so the choice can be re-measured, on other hosts and as the JDK changes. From fda04521a09f95f5ce82d6ea4fd4c06fb90ff3f1 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Sun, 22 Nov 2026 21:58:33 +0100 Subject: [PATCH 4/8] [VFDLIBM-30] Scope the would-move condition to the rows that read today's finish, and name cosh's EPYC re-run Generated-by: Claude Code (Opus 5.5) --- PLAN.md | 9 ++++++--- README.md | 7 ++++--- SKILLS.md | 11 +++++++---- src/main/java/io/github/vecbricks/vfdlibm/Expm1.java | 3 ++- src/main/java/io/github/vecbricks/vfdlibm/Log1p.java | 3 ++- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/PLAN.md b/PLAN.md index 7a13cec..915ce24 100644 --- a/PLAN.md +++ b/PLAN.md @@ -50,7 +50,8 @@ ranges through one division on blended operands, the lanes from `2^66` up finish so is `acos` (`VFdlibm.acos`, from `e_acos.c`, built as asin is), and so is `atan2` (`VFdlibm.atan2`, from `e_atan2.c`, the first function of two arguments: the special lanes blended over the general path, which calls `atan`'s core, no lane finished per lane, and two arms, the -blended one and the guarded one `VFdlibm` calls at every species, section 5 below says why). +blended one and the guarded one `VFdlibm` calls at every species, by the owner's decision of 22 +November; section 5 below gives the case). `log`, `log10` and `log1p` are done too (`VFdlibm.log`, from `e_log.c`, `VFdlibm.log10`, from `e_log10.c`, which computes through log's common path, and `VFdlibm.log1p`, from `s_log1p.c`), and so is `expm1` (`VFdlibm.expm1`, from `s_expm1.c`, whose @@ -144,11 +145,13 @@ five are a later, optional set; the large-argument reduction of the trigonometri runs one arm at every species). Every default stays provisional until a host run revises it (a second run of the 8573C, a first of the other AVX-512 hosts). Meanwhile `VFdlibm` calls the finish arm of `exp`, `log` and `log10`; the guarded arm of `expm1` and `log1p`, which - the rule would move to the finish arm if their arms are still within 1.3x on the 8573C's + the rule would move to the finish arm if their 256-bit, 512-bit and preferred rows are still + within 1.3x on the 8573C's second run (issue #30); the slice arm of `cosh`, provisionally, as the rule's exception (`bench/results/cosh-xeon8573c-2026-11-21.txt` and `cosh-epyc7763-2026-11-21.txt` read the - finish arm lower on every row by ratios near 1.3x or inside it, and give no direction); and the + finish arm lower on every row by ratios near 1.3x or inside it, and give no direction; it waits + for a second run of the EPYC 7763 too); and the guarded arm of `atan2` at every species. atan2 has no finish arm (both arms compute the special lanes in the vector; blended runs their blends in every vector, guarded behind a test), so rule 1 does not pick between them ([issue #30's corrected diff --git a/README.md b/README.md index 9b79f01..ed1694b 100644 --- a/README.md +++ b/README.md @@ -185,12 +185,13 @@ fdlibm's own sequence of operations, lane by lane. That is this library. hosts disagree the files say so. The rules are set (issue #30): a tie within 1.3x goes to the finish arm, except for `cosh`, whose arm a host run decides; `expm1` and `log1p` stay on their guarded arm until the 8573C's second run, and the rule would move them to the finish arm if - their arms are still within 1.3x there; and where hosts disagree, each species keeps its own + their 256-bit, 512-bit and preferred rows are still within 1.3x there (the `*Max` rows time the + finish that boxed before issue #37); and where hosts disagree, each species keeps its own arm (no function needs that yet, so each runs one arm at every species). `atan2` has no finish arm, so the rule does not pick between its two: its guarded arm is the default at every species, and the 8573C's 512-bit rows, a tie, wait for its second run. Every default stays provisional - until a host run revises it, such as a second run of - the 8573C or a first of the other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when drawn); + until a host run revises it, such as a second run of the 8573C or a first of the other AVX-512 + hosts (`HARDWARE.md`, the EPYC 9V45 when drawn), and for `cosh` a second run of the EPYC 7763 too; `PLAN.md` section 5 gives each function's case. The laptop's numbers do not agree at every width. diff --git a/SKILLS.md b/SKILLS.md index 8ecf69e..6fc792e 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -412,7 +412,7 @@ stops the next port re-trying a settled question. after the EPYC run, which is why that file has none. `VFdlibm.log` keeps the finish arm by the rules issue #30 set (a tie within 1.3x goes to the finish arm), provisionally until a host run revises it: a second Xeon run or a pair. The 8573C's mixed rows at 512 bits and the preferred - species read the blend lower by 1.29 to 1.30x, on rule 2's line, and wait for that second run + species read the blend lower by 1.29 to 1.30x, on the 1.3x line, and wait for that second run like the rest. Measure the finish only once it allocates nothing. - **Int words can live in long lanes, with an exact dk.** log first kept its words in int lanes @@ -477,7 +477,8 @@ stops the next port re-trying a settled question. times it as of a1db6df; neither times it after the finish's first eight lanes written out with constant indices (issue #37). `VFdlibm.log1p` uses the guarded arm provisionally: by the rules issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move log1p to it if - its arms are still within 1.3x on the Xeon 8573C's second run; a first run of the other AVX-512 + its 256-bit, 512-bit and preferred rows are still within 1.3x on the Xeon 8573C's second run; a + first run of the other AVX-512 hosts or a pair may revise the choice. A port whose rare paths are cheap in vector form should measure this shape beside the other two. @@ -619,7 +620,8 @@ stops the next port re-trying a settled question. guarded lowest on the preferred rows of both kinds of data; the file of 21 November has finish lowest there on common data. `VFdlibm.expm1` keeps the guarded arm provisionally: by the rules issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move expm1 to it if - its arms are still within 1.3x on the Xeon 8573C's second run; a first run of the other AVX-512 + its 256-bit, 512-bit and preferred rows are still within 1.3x on the Xeon 8573C's second run; a + first run of the other AVX-512 hosts or a pair may revise the choice. Both files time `Expm1` before its core entry (below) and before the finish's first eight lanes written out with @@ -1161,7 +1163,8 @@ stops the next port re-trying a settled question. blends in every vector, guarded behind a test), so rule 1 of issue #30 does not pick between them ([the issue's corrected comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). - The guarded arm stays the default at every species: on those files it reads lower on the + The guarded arm stays the default at every species, by the owner's decision of 22 November. On + those files it reads lower on the slower input at every species on the EPYC 7763 and at 256 bits on the 8573C, and at 512 bits on the 8573C the rows are a tie (blended lower by 3.3% at the preferred species and 1.3% at `SPECIES_MAX`, inside the run's spread), which waits for the 8573C's second run. diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java index 78414f4..45fea3d 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java @@ -94,7 +94,8 @@ * arm over the finish at 1.02 on common data and 1.07 to 1.08 on mixed data, against 1.13 to * 1.15 and 1.07 to 1.08 in the 20 November files, all within 1.3x, and no pair or re-run backs * the 1.02. The rules for a tie within 1.3x and for hosts that disagree are set (issue #30): a - * tie goes to the finish arm, so rule 1 would move expm1 to the finish arm if its arms are still + * tie goes to the finish arm, so rule 1 would move expm1 to the finish arm if its 256-bit, 512-bit + * and preferred rows are still * within 1.3x on the Xeon 8573C's second run; until then the guarded arm stays, provisionally, and * a first run of the * other AVX-512 hosts ({@code HARDWARE.md}) or a pair may revise the choice; the other two arms diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java index 99a0c6b..4419f7e 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java @@ -86,7 +86,8 @@ * from row to row. The Xeon file of 3 November ({@code log1p-xeon8573c-2026-11-03.txt}) had the * guarded arm lowest on every 256-bit, 512-bit and preferred row. The rules for a tie within * 1.3x and for hosts that disagree are set (issue #30): a tie goes to the finish arm, so rule 1 - * would move log1p to the finish arm if its arms are still within 1.3x on the Xeon 8573C's + * would move log1p to the finish arm if its 256-bit, 512-bit and preferred rows are still within + * 1.3x on the Xeon 8573C's * second run; until then the * guarded arm stays, provisionally, and a first run of the other AVX-512 hosts ({@code * HARDWARE.md}) or a pair may revise the choice. The other two are From 011fc8cf6ed74df417bbe705c146f22d280c7db6 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Sun, 22 Nov 2026 22:14:54 +0100 Subject: [PATCH 5/8] [VFDLIBM-30] Read atan2's 8573C rows as a tie at every species Generated-by: Claude Code (Opus 5.5) --- PLAN.md | 7 ++++--- README.md | 2 +- SKILLS.md | 8 ++++---- src/main/java/io/github/vecbricks/vfdlibm/Atan2.java | 9 +++++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/PLAN.md b/PLAN.md index 915ce24..9e382e2 100644 --- a/PLAN.md +++ b/PLAN.md @@ -157,9 +157,10 @@ five are a later, optional set; the large-argument reduction of the trigonometri 1 does not pick between them ([issue #30's corrected comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). On `atan2-xeon8573c-2026-11-22.txt` and `atan2-epyc7763-2026-11-22.txt`, one run each, guarded - reads lower on the slower input at every species on the EPYC 7763 and at 256 bits on the 8573C; - at 512 bits on the 8573C the rows are a tie (blended lower by 3.3% at the preferred species and - 1.3% at `SPECIES_MAX`, inside the run's spread), which waits for the 8573C's second run. + reads lower on the slower input at every species on the EPYC 7763; on the 8573C the two arms + are a tie at every species (guarded lower by 1.3% at 256 bits, blended lower by 3.3% at the + preferred species and 1.3% at `SPECIES_MAX`, all inside 1.3x), which waits for the 8573C's + second run. Guarded is the default at every species by the owner's decision of 22 November. ## 6. Rules diff --git a/README.md b/README.md index ed1694b..3e715f8 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,7 @@ fdlibm's own sequence of operations, lane by lane. That is this library. finish that boxed before issue #37); and where hosts disagree, each species keeps its own arm (no function needs that yet, so each runs one arm at every species). `atan2` has no finish arm, so the rule does not pick between its two: its guarded arm is the default at every species, - and the 8573C's 512-bit rows, a tie, wait for its second run. Every default stays provisional + and the 8573C's rows, a tie at every species, wait for its second run. Every default stays provisional until a host run revises it, such as a second run of the 8573C or a first of the other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when drawn), and for `cosh` a second run of the EPYC 7763 too; `PLAN.md` section 5 gives each function's case. The laptop's numbers do not agree at every diff --git a/SKILLS.md b/SKILLS.md index 6fc792e..d54d98f 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -1164,10 +1164,10 @@ stops the next port re-trying a settled question. them ([the issue's corrected comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). The guarded arm stays the default at every species, by the owner's decision of 22 November. On - those files it reads lower on the - slower input at every species on the EPYC 7763 and at 256 bits on the 8573C, and at 512 bits - on the 8573C the rows are a tie (blended lower by 3.3% at the preferred species and 1.3% at - `SPECIES_MAX`, inside the run's spread), which waits for the 8573C's second run. + those files it reads lower on the slower input at every species on the EPYC 7763; on the 8573C + the two arms are a tie at every species (guarded lower by 1.3% at 256 bits, blended lower by + 3.3% at the preferred species and 1.3% at `SPECIES_MAX`, all inside 1.3x), which waits for the + 8573C's second run. - **A lane the core must not see.** A NaN, an infinity or a huge `t` in a lane the special blends overwrite would send the vector to atan's per-lane finish. The mask `t < 2^66` keeps them out (a NaN compares false), and a vector with no special lane never reaches the finish. diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java b/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java index b904526..15bcead 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java @@ -62,10 +62,11 @@ * finish arm) does not pick between the two (the issue's corrected comment, * https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272). On {@code * bench/results/atan2-xeon8573c-2026-11-22.txt} and {@code atan2-epyc7763-2026-11-22.txt}, one - * run each, the guarded arm reads lower on the slower input at every species on the EPYC 7763 - * and at 256 bits on the Xeon 8573C; at 512 bits on the 8573C the rows are a tie, the blended arm - * lower by 3.3% at the preferred species and 1.3% at {@code SPECIES_MAX}, inside the run's - * spread, which waits for the 8573C's second run. + * run each, the guarded arm reads lower on the slower input at every species on the EPYC 7763; + * on the Xeon 8573C the two arms are a tie at every species (guarded lower by 1.3% at 256 bits, + * blended lower by 3.3% at the preferred species and 1.3% at {@code SPECIES_MAX}, all inside + * 1.3x), which waits for the 8573C's second run. Guarded is the default at every species by the + * owner's decision of 22 November. */ final class Atan2 { From bc2666fc856ff9762a0dca1c09fbfe22d4a694df Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Sun, 22 Nov 2026 22:15:36 +0100 Subject: [PATCH 6/8] [VFDLIBM-30] Rewrap README's rare-paths paragraph to 100 columns Generated-by: Claude Code (Opus 5.5) --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3e715f8..5c8c764 100644 --- a/README.md +++ b/README.md @@ -189,11 +189,11 @@ fdlibm's own sequence of operations, lane by lane. That is this library. finish that boxed before issue #37); and where hosts disagree, each species keeps its own arm (no function needs that yet, so each runs one arm at every species). `atan2` has no finish arm, so the rule does not pick between its two: its guarded arm is the default at every species, - and the 8573C's rows, a tie at every species, wait for its second run. Every default stays provisional - until a host run revises it, such as a second run of the 8573C or a first of the other AVX-512 - hosts (`HARDWARE.md`, the EPYC 9V45 when drawn), and for `cosh` a second run of the EPYC 7763 too; - `PLAN.md` section 5 gives each function's case. The laptop's numbers do not agree at every - width. + and the 8573C's rows, a tie at every species, wait for its second run. Every default stays + provisional until a host run revises it, such as a second run of the 8573C or a first of the + other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when drawn), and for `cosh` a second run of + the EPYC 7763 too; `PLAN.md` section 5 gives each function's case. The laptop's numbers do not + agree at every width. ## Testing From 951e58fdc2a0c2d4632c63cc2c9bf2d6cd5caa16 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Sun, 22 Nov 2026 22:43:57 +0100 Subject: [PATCH 7/8] [VFDLIBM-30] Leave the committed files' boxing *Max rows out of the rules, and scope exp's lead Generated-by: Claude Code (Opus 5.5) --- PLAN.md | 17 ++++++----- README.md | 25 ++++++++-------- SKILLS.md | 29 ++++++++++--------- .../java/io/github/vecbricks/vfdlibm/Exp.java | 6 ++-- .../io/github/vecbricks/vfdlibm/Expm1.java | 14 ++++----- .../io/github/vecbricks/vfdlibm/Log10.java | 7 +++-- .../io/github/vecbricks/vfdlibm/Log1p.java | 15 +++++----- 7 files changed, 60 insertions(+), 53 deletions(-) diff --git a/PLAN.md b/PLAN.md index 9e382e2..0c98d9d 100644 --- a/PLAN.md +++ b/PLAN.md @@ -141,13 +141,16 @@ five are a later, optional set; the large-argument reduction of the trigonometri Which arm each function keeps follows the two rules issue #30 set on 21 November 2026: a tie within 1.3x on every host that has a file goes to the finish arm, except for `cosh`, whose per-lane set is not rare, so a host run decides its arm; and where hosts disagree, each species - keeps the arm its own rows choose by that rule (decided; no function needs it yet, so `VFdlibm` - runs one arm at every species). Every default stays provisional until a host run revises it (a - second run of the 8573C, a first of the other AVX-512 hosts). Meanwhile `VFdlibm` calls the - finish arm of `exp`, `log` and `log10`; the guarded arm of `expm1` and `log1p`, which - the rule would move to the finish arm if their 256-bit, 512-bit and preferred rows are still - within 1.3x on the 8573C's - second run (issue #30); the slice + keeps the arm its own rows choose by that rule. The `*Max` rows of the files committed so far + (`exp`, `expm1`, `log`, `log10` and `log1p`, of 20 and 21 November) time the finish that boxed at + `SPECIES_MAX` before issue #37, so they are left out of both rules; a new run's `*Max` rows time + today's finish. On the other rows no function needs rule 2 yet, so `VFdlibm` runs one arm at every + species; the nearest is `log`, whose 8573C mixed rows at 512 bits and the preferred species read + the blend lower by 1.29 to 1.30x, on the 1.3x line. Every default stays provisional until a host + run revises it (a second run of the 8573C, a first of the other AVX-512 hosts). Meanwhile + `VFdlibm` calls the finish arm of `exp`, `log` and `log10`; the guarded arm of `expm1` and + `log1p`, which rule 1 would move to the finish arm at the 8573C's second run unless the guarded + arm wins by more than 1.3x there (issue #30); the slice arm of `cosh`, provisionally, as the rule's exception (`bench/results/cosh-xeon8573c-2026-11-21.txt` and `cosh-epyc7763-2026-11-21.txt` read the finish arm lower on every row by ratios near 1.3x or inside it, and give no direction; it waits diff --git a/README.md b/README.md index 5c8c764..3722557 100644 --- a/README.md +++ b/README.md @@ -182,18 +182,19 @@ fdlibm's own sequence of operations, lane by lane. That is this library. one arm, `exp`, `expm1`, `log`, `log10`, `log1p`, `cosh` and `atan2`, each have files from the Xeon Platinum 8573C and the EPYC 7763 (`bench/results/`), and each file's reading is in `SKILLS.md`; where two arms are within 1.3x of each other no direction is read, and where the - hosts disagree the files say so. The rules are set (issue #30): a tie within 1.3x goes to the - finish arm, except for `cosh`, whose arm a host run decides; `expm1` and `log1p` stay on their - guarded arm until the 8573C's second run, and the rule would move them to the finish arm if - their 256-bit, 512-bit and preferred rows are still within 1.3x there (the `*Max` rows time the - finish that boxed before issue #37); and where hosts disagree, each species keeps its own - arm (no function needs that yet, so each runs one arm at every species). `atan2` has no finish - arm, so the rule does not pick between its two: its guarded arm is the default at every species, - and the 8573C's rows, a tie at every species, wait for its second run. Every default stays - provisional until a host run revises it, such as a second run of the 8573C or a first of the - other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when drawn), and for `cosh` a second run of - the EPYC 7763 too; `PLAN.md` section 5 gives each function's case. The laptop's numbers do not - agree at every width. + hosts disagree the files say so. The rules are set (issue #30): a tie within 1.3x on every host + that has a file goes to the finish arm, except for `cosh`, whose arm a host run decides; `expm1` + and `log1p` stay on their guarded arm until the 8573C's second run, when the rule would move them + to the finish arm unless the guarded arm wins by more than 1.3x there; and where hosts disagree, + each species keeps its own arm (no function needs that yet, so each runs one arm at every + species). The `*Max` rows of the files committed so far time the finish that boxed before issue + #37 and are left out of the rules; a new run's `*Max` rows time today's finish. `atan2` has no + finish arm, so the rule does not pick between its two: its guarded arm is the default at every + species, and the 8573C's rows, a tie at every species, wait for its second run. Every default + stays provisional until a host run revises it, such as a second run of the 8573C or a first of the + other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when drawn), and for `cosh` a second run of the + EPYC 7763 too; `PLAN.md` section 5 gives each function's case. The laptop's numbers do not agree + at every width. ## Testing diff --git a/SKILLS.md b/SKILLS.md index d54d98f..21cbf47 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -337,8 +337,10 @@ stops the next port re-trying a settled question. time `exp` as of a5683c3 and a1db6df, and `Exp.java` has changed since by a fault constant, a local and the finish's first eight lanes written out with constant indices (issue #37), so no run has timed today's body as a whole: the pair above times rows of it after that change, on one - host. `VFdlibm.exp` keeps the finish arm, which those files read lower than the blend by more - than 1.3x on mixed data on both hosts, and to which issue #30's rules send a tie; + host. `VFdlibm.exp` keeps the finish arm, which those files read lower than the blend by more than + 1.3x on mixed data at 256 bits and the preferred species on both hosts and at 512 bits on the + 8573C (the `*Max` rows of the files committed so far time the finish that boxed before issue #37 + and are left out), and to which issue #30's rules send a tie; provisionally, until a host run revises it: a second run of the Xeon 8573C, a first of the other AVX-512 hosts or a pair. Each port measures both on common and mixed @@ -476,11 +478,10 @@ stops the next port re-trying a settled question. as of a5683c3, before a fault constant and a mask local were added; the Xeon file of 21 November times it as of a1db6df; neither times it after the finish's first eight lanes written out with constant indices (issue #37). `VFdlibm.log1p` uses the guarded arm provisionally: by the rules - issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move log1p to it if - its 256-bit, 512-bit and preferred rows are still within 1.3x on the Xeon 8573C's second run; a - first run of the other AVX-512 - hosts or a pair may revise - the choice. A port whose rare paths are + issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move log1p to it at the + Xeon 8573C's second run unless the guarded arm wins by more than 1.3x there (the `*Max` rows of + the files committed so far time the finish that boxed before issue #37 and are left out); a first + run of the other AVX-512 hosts or a pair may revise the choice. A port whose rare paths are cheap in vector form should measure this shape beside the other two. - **The in-body finish allocates nothing in log1p too.** log1p's finish was first a call, `finishPerLane(x, result, rare)`, and boxed: 52,928 B/op on mixed data at 256 bits under @@ -561,8 +562,9 @@ stops the next port re-trying a settled question. (issue #37); the pair of that change (the exp entry above) reads log10's mixed finish rows 2.6% to 4.0% slower by median and 3.7% to 4.1% by best on the EPYC 7763, the cause not known. `VFdlibm.log10` calls the finish arm by the rules issue #30 set (a tie within 1.3x goes to the - finish arm), provisionally until a host run revises it: a second run of the Xeon 8573C, a first - of the other AVX-512 hosts or a pair. + finish arm; its `*Max` rows, where the blend reads lower on mixed data, time the finish that boxed + before issue #37 and are left out), provisionally until a host run revises it: a second run of the + Xeon 8573C, a first of the other AVX-512 hosts or a pair. ## What the expm1 port taught @@ -619,11 +621,10 @@ stops the next port re-trying a settled question. of 4 November (`bench/results/expm1-xeon8573c-2026-11-04.txt`, one run, at another commit) had guarded lowest on the preferred rows of both kinds of data; the file of 21 November has finish lowest there on common data. `VFdlibm.expm1` keeps the guarded arm provisionally: by the rules - issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move expm1 to it if - its 256-bit, 512-bit and preferred rows are still within 1.3x on the Xeon 8573C's second run; a - first run of the other AVX-512 - hosts or a pair may revise - the choice. Both files time `Expm1` + issue #30 set, a tie within 1.3x goes to the finish arm, so rule 1 would move expm1 to it at the + Xeon 8573C's second run unless the guarded arm wins by more than 1.3x there (the `*Max` rows of + the files committed so far time the finish that boxed before issue #37 and are left out); a first + run of the other AVX-512 hosts or a pair may revise the choice. Both files time `Expm1` before its core entry (below) and before the finish's first eight lanes written out with constant indices (issue #37), and `Expm1.java` changed between their two commits too (a fault constant and a local in the k conversion, as for `Exp`), so the cross-host comparison rests on diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java index 9230762..02a5788 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java @@ -77,8 +77,10 @@ * been paired. * The first run's head is a branch tip, not a commit of main (that file's header says so). * exp keeps the finish arm, which the host files read lower than the blend by more than 1.3x on - * mixed data on both hosts ({@code PLAN.md}, section 5), and to which issue #30's rules send a - * tie; the choice stays provisional until a host run revises it, a second run of the Xeon 8573C, + * mixed data at 256 bits and the preferred species on both hosts and at 512 bits on the Xeon 8573C + * ({@code PLAN.md}, section 5; the {@code *Max} rows of the files committed so far time the finish + * that boxed before issue #37 and are left out), and to which issue #30's rules send a tie; the + * choice stays provisional until a host run revises it, a second run of the Xeon 8573C, * a first of the other AVX-512 hosts ({@code HARDWARE.md}) or a pair. The second arm is kept so * the choice can be re-measured, on other hosts and as the JDK changes. The folds above cut the * common path C2 emits from 77 instructions with two divisions to 52 with one at 512 bits on diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java index 45fea3d..302987a 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java @@ -93,13 +93,13 @@ * core rows, and also times the finish before the eight lanes; its minimums read the guarded * arm over the finish at 1.02 on common data and 1.07 to 1.08 on mixed data, against 1.13 to * 1.15 and 1.07 to 1.08 in the 20 November files, all within 1.3x, and no pair or re-run backs - * the 1.02. The rules for a tie within 1.3x and for hosts that disagree are set (issue #30): a - * tie goes to the finish arm, so rule 1 would move expm1 to the finish arm if its 256-bit, 512-bit - * and preferred rows are still - * within 1.3x on the Xeon 8573C's second run; until then the guarded arm stays, provisionally, and - * a first run of the - * other AVX-512 hosts ({@code HARDWARE.md}) or a pair may revise the choice; the other two arms - * are kept so it can be re-measured ({@code SKILLS.md}). + * the 1.02. The rules for a tie within 1.3x and for hosts that disagree are set (issue #30): a tie + * goes to the finish arm, so rule 1 would move expm1 to the finish arm at the Xeon 8573C's second + * run unless the guarded arm wins by more than 1.3x there (the {@code *Max} rows of the files + * committed so far time the finish that boxed before issue #37 and are left out); until then the + * guarded arm stays, provisionally, and a first run of the other AVX-512 hosts ({@code + * HARDWARE.md}) or a pair may revise the choice; the other two arms are kept so it can be + * re-measured ({@code SKILLS.md}). * *

{@link #expm1Core} and {@link #expm1Rare} split the finish arm into its branch-free part and * its rare-lane mask, as {@code Exp.expCore} and {@code Exp.expRare} do, so that a port that diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Log10.java b/src/main/java/io/github/vecbricks/vfdlibm/Log10.java index 7e20a0b..b0ef04e 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Log10.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Log10.java @@ -83,9 +83,10 @@ * bench/results/exp-log10-pair-epyc7763-2026-11-21.txt} and {@code * bench/results/exp-log10-pair-rerun-epyc7763-2026-11-21.txt}), the cause not known, and no * AVX-512 host paired. log10 calls the finish arm by the rules issue #30 set (a tie within 1.3x - * goes to the finish arm), provisionally until a host run revises it: a second run of the Xeon - * 8573C, a first of the other AVX-512 hosts ({@code HARDWARE.md}) or a pair; the second arm is - * kept so the choice can be re-measured. + * goes to the finish arm; its {@code *Max} rows, where the blend reads lower on mixed data, time + * the finish that boxed before issue #37 and are left out), provisionally until a host run revises + * it: a second run of the Xeon 8573C, a first of the other AVX-512 hosts ({@code HARDWARE.md}) or a + * pair; the second arm is kept so the choice can be re-measured. */ final class Log10 { diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java index 4419f7e..57ef08e 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java @@ -84,14 +84,13 @@ * every one of those rows (the EPYC's 512-bit rows run in the Java fallback and are left out), * so no direction is read, and the lowest minimum moves between the finish and the guarded arm * from row to row. The Xeon file of 3 November ({@code log1p-xeon8573c-2026-11-03.txt}) had the - * guarded arm lowest on every 256-bit, 512-bit and preferred row. The rules for a tie within - * 1.3x and for hosts that disagree are set (issue #30): a tie goes to the finish arm, so rule 1 - * would move log1p to the finish arm if its 256-bit, 512-bit and preferred rows are still within - * 1.3x on the Xeon 8573C's - * second run; until then the - * guarded arm stays, provisionally, and a first run of the other AVX-512 hosts ({@code - * HARDWARE.md}) or a pair may revise the choice. The other two are - * kept so the choice can be re-measured, on other hosts and as the JDK changes. + * guarded arm lowest on every 256-bit, 512-bit and preferred row. The rules for a tie within 1.3x + * and for hosts that disagree are set (issue #30): a tie goes to the finish arm, so rule 1 would + * move log1p to the finish arm at the Xeon 8573C's second run unless the guarded arm wins by more + * than 1.3x there (the {@code *Max} rows of the files committed so far time the finish that boxed + * before issue #37 and are left out); until then the guarded arm stays, provisionally, and a first + * run of the other AVX-512 hosts ({@code HARDWARE.md}) or a pair may revise the choice. The other + * two are kept so the choice can be re-measured, on other hosts and as the JDK changes. */ final class Log1p { From bcc9df380225e98b1e5f6fc44d792f6eda2b019e Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Sun, 22 Nov 2026 23:07:41 +0100 Subject: [PATCH 8/8] [VFDLIBM-30] Name the boxing files by date, read atan2 with no direction, and state expm1/log1p's deferral Generated-by: Claude Code (Opus 5.5) --- PLAN.md | 39 ++++++++----------- README.md | 23 ++++++----- SKILLS.md | 7 +--- .../io/github/vecbricks/vfdlibm/Atan2.java | 11 ++---- 4 files changed, 33 insertions(+), 47 deletions(-) diff --git a/PLAN.md b/PLAN.md index 0c98d9d..b22ca60 100644 --- a/PLAN.md +++ b/PLAN.md @@ -141,29 +141,22 @@ five are a later, optional set; the large-argument reduction of the trigonometri Which arm each function keeps follows the two rules issue #30 set on 21 November 2026: a tie within 1.3x on every host that has a file goes to the finish arm, except for `cosh`, whose per-lane set is not rare, so a host run decides its arm; and where hosts disagree, each species - keeps the arm its own rows choose by that rule. The `*Max` rows of the files committed so far - (`exp`, `expm1`, `log`, `log10` and `log1p`, of 20 and 21 November) time the finish that boxed at - `SPECIES_MAX` before issue #37, so they are left out of both rules; a new run's `*Max` rows time - today's finish. On the other rows no function needs rule 2 yet, so `VFdlibm` runs one arm at every - species; the nearest is `log`, whose 8573C mixed rows at 512 bits and the preferred species read - the blend lower by 1.29 to 1.30x, on the 1.3x line. Every default stays provisional until a host - run revises it (a second run of the 8573C, a first of the other AVX-512 hosts). Meanwhile - `VFdlibm` calls the finish arm of `exp`, `log` and `log10`; the guarded arm of `expm1` and - `log1p`, which rule 1 would move to the finish arm at the 8573C's second run unless the guarded - arm wins by more than 1.3x there (issue #30); the slice - arm of `cosh`, provisionally, as the rule's exception - (`bench/results/cosh-xeon8573c-2026-11-21.txt` and `cosh-epyc7763-2026-11-21.txt` read the - finish arm lower on every row by ratios near 1.3x or inside it, and give no direction; it waits - for a second run of the EPYC 7763 too); and the - guarded arm of `atan2` at every species. atan2 has no finish arm (both arms compute the special - lanes in the vector; blended runs their blends in every vector, guarded behind a test), so rule - 1 does not pick between them ([issue #30's corrected - comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). On - `atan2-xeon8573c-2026-11-22.txt` and `atan2-epyc7763-2026-11-22.txt`, one run each, guarded - reads lower on the slower input at every species on the EPYC 7763; on the 8573C the two arms - are a tie at every species (guarded lower by 1.3% at 256 bits, blended lower by 3.3% at the - preferred species and 1.3% at `SPECIES_MAX`, all inside 1.3x), which waits for the 8573C's - second run. Guarded is the default at every species by the owner's decision of 22 November. + keeps the arm its own rows choose by that rule. The `*Max` rows of the host files of 3 to 21 + November for `exp`, `expm1`, `log`, `log10` and `log1p` (`exp-onediv-xeon8573c-2026-11-03.txt` and + those of 20 and 21 November; `log1p-xeon8573c-2026-11-03.txt` and `expm1-xeon8573c-2026-11-04.txt` + have no `*Max` row) time the finish that boxed at `SPECIES_MAX` before issue #37, so they are left + out of both rules; a later run's `*Max` rows time today's finish. On the other rows no function + needs rule 2 yet, so `VFdlibm` runs one arm at every species. Every default stays provisional + until a host run revises it. Meanwhile `VFdlibm` calls the finish arm of `exp`, `log` and `log10`; + the guarded arm of `expm1` and `log1p`, by the owner's deferral of rule 1 until the 8573C's second + run (issue #30, 21 November); the slice arm of `cosh`, provisionally, as the rule's exception + (`bench/results/cosh-xeon8573c-2026-11-21.txt` and `cosh-epyc7763-2026-11-21.txt` read the finish + arm lower on every row by ratios near 1.3x or inside it, and give no direction); and the guarded + arm of `atan2`, which has no finish arm, so rule 1 does not pick between its two ([issue #30's + corrected comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). + Neither host's file gives the arms a direction (`atan2-xeon8573c-2026-11-22.txt`, inside 1.3x; + `atan2-epyc7763-2026-11-22.txt`, near 1.3x or inside it, one run), so guarded stays the default at + every species by the owner's decision of 22 November until a re-run of each host. ## 6. Rules diff --git a/README.md b/README.md index 3722557..7de059f 100644 --- a/README.md +++ b/README.md @@ -183,18 +183,17 @@ fdlibm's own sequence of operations, lane by lane. That is this library. Xeon Platinum 8573C and the EPYC 7763 (`bench/results/`), and each file's reading is in `SKILLS.md`; where two arms are within 1.3x of each other no direction is read, and where the hosts disagree the files say so. The rules are set (issue #30): a tie within 1.3x on every host - that has a file goes to the finish arm, except for `cosh`, whose arm a host run decides; `expm1` - and `log1p` stay on their guarded arm until the 8573C's second run, when the rule would move them - to the finish arm unless the guarded arm wins by more than 1.3x there; and where hosts disagree, - each species keeps its own arm (no function needs that yet, so each runs one arm at every - species). The `*Max` rows of the files committed so far time the finish that boxed before issue - #37 and are left out of the rules; a new run's `*Max` rows time today's finish. `atan2` has no - finish arm, so the rule does not pick between its two: its guarded arm is the default at every - species, and the 8573C's rows, a tie at every species, wait for its second run. Every default - stays provisional until a host run revises it, such as a second run of the 8573C or a first of the - other AVX-512 hosts (`HARDWARE.md`, the EPYC 9V45 when drawn), and for `cosh` a second run of the - EPYC 7763 too; `PLAN.md` section 5 gives each function's case. The laptop's numbers do not agree - at every width. + that has a file goes to the finish arm, except for `cosh`, whose arm a host run decides, and where + hosts disagree each species keeps its own arm (no function needs that yet). `expm1` and `log1p` + stay on their guarded arm by the owner's deferral of the rule until the 8573C's second run. The + `*Max` rows of the host files of 3 to 21 November for `exp`, `expm1`, `log`, `log10` and `log1p` + (`exp-onediv-xeon8573c-2026-11-03.txt` and those of 20 and 21 November; + `log1p-xeon8573c-2026-11-03.txt` and `expm1-xeon8573c-2026-11-04.txt` have no `*Max` row) time the + finish that boxed before issue #37 and are left out of the rules. `atan2` has no finish arm, so + the rule does not pick between its two; neither host's file gives them a direction, and its + guarded arm stays the default at every species by the owner's decision until a re-run of each + host. Every default stays provisional until a host run revises it; `PLAN.md` section 5 gives each + function's case. The laptop's numbers do not agree at every width. ## Testing diff --git a/SKILLS.md b/SKILLS.md index 21cbf47..c9c4e27 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -1164,11 +1164,8 @@ stops the next port re-trying a settled question. blends in every vector, guarded behind a test), so rule 1 of issue #30 does not pick between them ([the issue's corrected comment](https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272)). - The guarded arm stays the default at every species, by the owner's decision of 22 November. On - those files it reads lower on the slower input at every species on the EPYC 7763; on the 8573C - the two arms are a tie at every species (guarded lower by 1.3% at 256 bits, blended lower by - 3.3% at the preferred species and 1.3% at `SPECIES_MAX`, all inside 1.3x), which waits for the - 8573C's second run. + So guarded stays the default at every species by the owner's decision of 22 November until a + re-run of each host. - **A lane the core must not see.** A NaN, an infinity or a huge `t` in a lane the special blends overwrite would send the vector to atan's per-lane finish. The mask `t < 2^66` keeps them out (a NaN compares false), and a vector with no special lane never reaches the finish. diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java b/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java index 15bcead..21c0b8a 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Atan2.java @@ -60,13 +60,10 @@ * {@code guarded} only in a vector with a live special lane, which is the one {@code VFdlibm} * calls, at every species. atan2 has no finish arm, so rule 1 of issue #30 (a tie goes to the * finish arm) does not pick between the two (the issue's corrected comment, - * https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272). On {@code - * bench/results/atan2-xeon8573c-2026-11-22.txt} and {@code atan2-epyc7763-2026-11-22.txt}, one - * run each, the guarded arm reads lower on the slower input at every species on the EPYC 7763; - * on the Xeon 8573C the two arms are a tie at every species (guarded lower by 1.3% at 256 bits, - * blended lower by 3.3% at the preferred species and 1.3% at {@code SPECIES_MAX}, all inside - * 1.3x), which waits for the 8573C's second run. Guarded is the default at every species by the - * owner's decision of 22 November. + * https://github.com/vecbricks/vfdlibm/issues/30#issuecomment-7085437272). Neither host's file + * gives the arms a direction ({@code bench/results/atan2-xeon8573c-2026-11-22.txt}, inside 1.3x; + * {@code atan2-epyc7763-2026-11-22.txt}, near 1.3x or inside it, one run), so guarded stays the + * default at every species by the owner's decision of 22 November until a re-run of each host. */ final class Atan2 {