From 8ba13d1fad38339308fab469ecc7ace5a302a0c8 Mon Sep 17 00:00:00 2001 From: Max Gekk Date: Sun, 22 Nov 2026 00:03:52 +0100 Subject: [PATCH] [VFDLIBM-30] Requote the benchmark claims from the 21 November files Generated-by: Claude Code (Sonnet 5.5) --- PLAN.md | 18 +++++--- SKILLS.md | 41 ++++++++++++++----- .../java/io/github/vecbricks/vfdlibm/Exp.java | 15 +++++-- .../io/github/vecbricks/vfdlibm/Expm1.java | 11 +++-- .../io/github/vecbricks/vfdlibm/Log10.java | 7 +++- .../io/github/vecbricks/vfdlibm/Log1p.java | 5 ++- .../io/github/vecbricks/vfdlibm/VFdlibm.java | 13 ++++-- 7 files changed, 83 insertions(+), 27 deletions(-) diff --git a/PLAN.md b/PLAN.md index 9bafffb..25ab9a2 100644 --- a/PLAN.md +++ b/PLAN.md @@ -119,14 +119,22 @@ five are a later, optional set; the large-argument reduction of the trigonometri For `exp` the per-lane finish allocates nothing at 256 bits, 512 bits and `SPECIES_MAX` of up to eight lanes in the laptop reading `bench/results/max-finish-alloc-free-laptop-2026-11-21.txt` (allocation only, no timing; it boxed at `SPECIES_MAX` before its first eight lanes were written - out with constant indices, `bench/results/max-finish-laptop-2026-11-20.txt`), and the host files - read the two arms by minimums: on the EPYC 7763 (`bench/results/exp-epyc7763-2026-11-20.txt`, two - runs) the finish is 1.99 to 2.13 times faster than the blend on common data and 1.50 to 1.57 on - mixed data, at 256 bits and the preferred species; on the Xeon Platinum 8573C + out with constant indices, `bench/results/max-finish-laptop-2026-11-20.txt`). That change is not + free in time: the pair on the EPYC 7763 (`bench/results/exp-log10-pair-epyc7763-2026-11-21.txt` + and its re-run `exp-log10-pair-rerun-epyc7763-2026-11-21.txt`) reads exp's two mixed finish rows + 7.4% to 9.3% slower by median and 8.3% to 8.9% by best (under its 10% threshold), log10's + 2.6% to 4.0% by median and 3.7% to 4.1% by best, and the `*Max` rows on mixed data faster, since + they no longer box; the cause of the slowdown is not known, and only one AVX2 host was paired, + with no AVX-512 host or other port. + The host files read the two arms by minimums: on the EPYC 7763 + (`bench/results/exp-epyc7763-2026-11-20.txt`, two runs) the finish is 1.99 to 2.13 times faster + than the blend on common data and 1.50 to 1.57 on mixed data, at 256 bits and the preferred + species; on the Xeon Platinum 8573C (`bench/results/exp-xeon8573c-2026-11-21.txt`, one run) 1.23 to 1.37 on common data, a ratio that straddles 1.3x, and 1.70 to 1.84 on mixed data, at 256 bits, 512 bits and the preferred species. 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`. + 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` diff --git a/SKILLS.md b/SKILLS.md index 1200ef6..2222034 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -183,8 +183,19 @@ stops the next port re-trying a settled question. at 256, 0.033 and 0.072 at most, and all 94 rows of the check pass under both flag sets on a lightly loaded machine, the `*Max` rows now among them (`bench/results/max-finish-alloc-free-laptop-2026-11-21.txt`). Lanes past eight, and 128 bits, are - not read. The fixed shapes' finish changes too, so the change goes through a pair on a host (the - pull request names it). + not read. The fixed shapes' finish changes too, and the change is not free there. The pair on the + EPYC 7763 (`bench/results/exp-log10-pair-epyc7763-2026-11-21.txt` and its re-run + `exp-log10-pair-rerun-epyc7763-2026-11-21.txt`, base `f2907e5`, head `1cec059` in the first run + and `5a452fa` in the re-run, one AVX2 host, `MaxVectorSize=32`) reads exp's two mixed finish + rows (`finish256`, `finishPreferred`) 7.4% to 9.3% slower by median and 8.3% to 8.9% slower by + best in both runs, log10's 2.6% to 4.0% slower by median and 3.7% to 4.1% by best, and the + `*Max` rows on mixed data faster, since they no longer box. Those slowdowns are under the + pair's 10% threshold, whose verdict counts none of them, and its scalar control row moves 3% to + 6% by median between the sides, so the bests (8.3% to 8.9% for exp) are the steadier figure. + The cause is not known: the re-run's file names the eight tests that replace a bit walk and + code placement, and decides neither. Only exp and log10 were paired, on that one host: no + AVX-512 host and no other port + (`expm1`, `log`, `log1p`, `sinh`, `cosh`) has a pair, so the other ports' cost is unread. - **At two 64-bit lanes x86 C2 lowers no mask.** Compare to mask, blend, mask cast, mask broadcast, logic and test are `not supported` at `vlen=2` for double and long masks, and fine at four lanes. So on x86 every 128-bit double port that branches through masks runs per lane @@ -325,7 +336,8 @@ stops the next port re-trying a settled question. `bench/results/exp-kinds-xeon8573c-2026-11-21.txt` times each kind of rare input apart. Both files 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. Which arm `VFdlibm.exp` keeps is not decided here: it waits for a second + 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 data, decides per branch, and records the decision in its pull request (`PLAN.md` section 5). @@ -539,8 +551,10 @@ stops the next port re-trying a settled question. the Xeon level (within 5%), both inside 1.3x. At the Xeon's preferred species and 512 bits, which have no native EPYC counterpart, blended over finish is 0.94 and 0.92. Both files time `Log10` as of a5683c3 and a1db6df, before the finish's first eight lanes written out with constant indices - (issue #37). `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 + (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). ## What the expm1 port taught @@ -587,7 +601,8 @@ stops the next port re-trying a settled question. species and, on the Xeon, 512 bits. On the EPYC 7763 (`bench/results/expm1-epyc7763-2026-11-20.txt`, two runs) the finish arm is lowest on every row: blended over finish is 1.17 to 1.18 on common data and 1.18 to 1.20 on mixed data, guarded over - finish 1.13 to 1.15 and 1.07 to 1.08. On the Xeon Platinum 8573C + finish 1.13 to 1.15 and 1.07 to 1.08 (the EPYC's run of 21 November, below, reads the first of + those 1.02). On the Xeon Platinum 8573C (`bench/results/expm1-xeon8573c-2026-11-21.txt`, one run) blended over finish is 1.04 to 1.16 on common data and 0.90 to 0.94 on mixed data, guarded over finish 0.97 to 1.05 and 0.85 to 0.87: on common data guarded is lowest at 256 bits and finish at the preferred species and 512 bits, on @@ -599,10 +614,16 @@ stops the next port re-trying a settled question. 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` - before its core entry (below), which no run has timed, 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 two code versions. The EPYC file's 512-bit rows run in the Java fallback and measure no + 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 + two code versions, and the EPYC file below on a third. The EPYC 7763's run of 21 November at 9b9cc7b + (`bench/results/expm1-epyc7763-2026-11-21.txt`, one run) is the only one with core rows + (`expm1Core`, no arm of `VFdlibm`); it still times the finish before the eight lanes, and reads + blended over finish 1.19, guarded over finish 1.02 on common data and 1.07 to 1.08 on mixed + data, all within 1.3x, so no direction either. Its guarded arm reads about 12% lower on common + data than in the 20 November runs, which no pair or re-run backs and the file does not + attribute to the code. The EPYC files' 512-bit rows run in the Java fallback and measure no expm1. - **Lefevre's direction bit is the 54th bit of the exact |result|.** testlibm-data's last field agreed with that for all 7578 `em1` lines (3836 ones, 3742 zeros), not with "the exact diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java index 69b9b50..68ea619 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Exp.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Exp.java @@ -54,7 +54,8 @@ * eight): in the laptop reading of {@code * bench/results/max-finish-alloc-free-laptop-2026-11-21.txt} (allocation only, no timing) * the finish allocates nothing at 256 bits, at 512 bits and at {@code SPECIES_MAX} of up - * to eight lanes. At 128 bits on x86 the masks box anyway ({@code SKILLS.md}). + * to eight lanes. At 128 bits on x86 the masks box anyway ({@code SKILLS.md}). The change + * is not free in time: see the pair below. *
  • {@link #expBlended} computes them in every lane too and blends them, with no branch. * * @@ -66,8 +67,16 @@ * a1db6df) it is 1.23 to 1.37 on common data, a range with 1.3x inside it, and 1.70 to 1.84 on * mixed data, at 256 bits, 512 bits and the preferred species. This class has changed since both * runs by a fault constant and a local in the k conversion and by the finish's first eight lanes - * written out with constant indices (issue #37), so no run has timed it as it stands. Which arm - * is kept waits for a second run of the Xeon 8573C and a first of the other AVX-512 hosts + * written out with constant indices (issue #37), so no run has timed it as it stands, but for + * the rows of the pair on the EPYC 7763: that change is not free there. Its finish rows on + * mixed data ({@code finish256}, {@code finishPreferred}) read 7.4% to 9.3% slower by median and + * 8.3% to 8.9% slower by best, under the pair's 10% threshold, in two runs of one AVX2 host ({@code + * bench/results/exp-log10-pair-epyc7763-2026-11-21.txt} and {@code + * bench/results/exp-log10-pair-rerun-epyc7763-2026-11-21.txt}), and the {@code finishMax} row + * 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 JDK changes. The folds above cut the common path C2 emits from 77 instructions with two diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java index 3d76f88..405a15d 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Expm1.java @@ -85,9 +85,14 @@ * finish arm at the preferred species and 512 bits on common data. The earlier Xeon file ({@code * expm1-xeon8573c-2026-11-04.txt}) had the guarded arm lowest on the preferred rows of both * kinds of data. The EPYC file of 20 November and the Xeon file of 21 November time the class - * before {@link #expm1Core}, which no run has timed, and before the finish's first eight lanes - * were written out with constant indices (issue #37); the class changed between their two - * commits by a fault constant and a local in the k conversion. The choice waits for a second run + * before {@link #expm1Core} and before the finish's first eight lanes were written out with + * constant indices (issue #37); the class changed between their two commits by a fault constant + * and a local in the k conversion. The EPYC's file of 21 November ({@code + * bench/results/expm1-epyc7763-2026-11-21.txt}, one run, main at 9b9cc7b) is the only one with + * 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 * 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 a58c80d..26ad44f 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Log10.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Log10.java @@ -77,7 +77,12 @@ * to 1.25 on common data and 0.92 to 0.98 on mixed data on the Xeon Platinum 8573C ({@code * bench/results/log10-xeon8573c-2026-11-21.txt}, one run). Every one of those ratios is within * 1.3x, so no direction is read; the files time this class before the finish's first eight lanes - * were written out with constant indices (issue #37). The choice waits for a second run of the + * were written out with constant indices (issue #37), which the pair on the EPYC 7763 reads as + * not free: its mixed finish rows ({@code finish256}, {@code finishPreferred}) 2.6% to 4.0% + * 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. diff --git a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java index 8fa1c73..afb57c5 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/Log1p.java @@ -78,8 +78,9 @@ * code of a5683c3) and on the Xeon Platinum 8573C ({@code * bench/results/log1p-xeon8573c-2026-11-21.txt}, one run, the code of a1db6df; the class changed * between their two commits by a fault constant, a local in the blend and a branch on the - * constant that folds away with no fault planted, and since both by the finish's first eight - * lanes written out with constant indices (issue #37)) every arm is within 1.3x of the others on + * constant, which is expected to fold away with no fault planted (no pair has shown it), and + * since both by the finish's first eight lanes written out with constant indices (issue #37)) + * every arm is within 1.3x of the others on * 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 diff --git a/src/main/java/io/github/vecbricks/vfdlibm/VFdlibm.java b/src/main/java/io/github/vecbricks/vfdlibm/VFdlibm.java index afdb89d..d87b60a 100644 --- a/src/main/java/io/github/vecbricks/vfdlibm/VFdlibm.java +++ b/src/main/java/io/github/vecbricks/vfdlibm/VFdlibm.java @@ -59,9 +59,16 @@ * *Max} row of {@code exp}, {@code expm1}, {@code log}, {@code log10}, {@code log1p}, * {@code sinh} and {@code cosh} reads under 0.1 bytes per op ({@code * bench/results/max-finish-alloc-free-laptop-2026-11-21.txt}, a laptop file and not a - * headline, read at 512 bits and as an AVX2 host at 256). {@code SPECIES_MAX} at 128 - * bits, and with more than eight lanes, was not read. No file has an {@code asin} row, - * and no {@code asin} timing exists. + * headline, read at 512 bits and as an AVX2 host at 256). Where it was timed, the change + * cost time on the fixed shapes: on the EPYC 7763 (one AVX2 host) the pair reads {@code + * exp}'s two mixed finish rows 7.4% to 9.3% slower by median and 8.3% to 8.9% slower by + * best (under the pair's 10% threshold), and {@code log10}'s 2.6% to 4.0% slower by + * median and 3.7% to 4.1% by best, and the {@code *Max} rows on mixed data faster ({@code + * bench/results/exp-log10-pair-epyc7763-2026-11-21.txt} and {@code + * exp-log10-pair-rerun-epyc7763-2026-11-21.txt}); the cause is not known, and no AVX-512 + * host and no other port was paired. {@code SPECIES_MAX} at 128 bits, and with more than + * eight lanes, was not read. No file has an {@code asin} row, and no {@code asin} timing + * exists. *
  • Not measured: any port's speed at 512 bits against 256 on the EPYC 9V74 draws that have * AVX-512 ({@code HARDWARE.md} has only a datapath reading for them, and lists {@code * MaxVectorSize=64}), any port's speed on Arm, and allocation on an Arm host with vectors