CultMath: fbm, and the measured Lipschitz bound of phacelle #1

Open
libby wants to merge 4 commits from libby/cultmath-fbm-lipschitz into main
Member

Follow-up libby-body:follow_up:chat-s615-625.

  1. math.fbm(p, octaves, lacunarity, gain) and math.fbm(p) (4 octaves, lacunarity 2, gain 0.5): value-only octave sum of snoise. cultmath_fbm in HLSL; GLSL regenerated by GlslLowering (CULTMATH_WRITE_GLSL=1); golden-fixture family appended; FbmTests.
  2. Lipschitz bound of phacelle: sigma_max of the (cosine, sine) Jacobian <= max(10, 1.25|side|)/(1-normalization), normalization in [0, 0.9], |side| in [0.25, 25]. Method and tightness in docs/design.md; tools/phacelle-lipschitz reproduces it; PhacelleTests pins it.

Verification: full CultMath.Tests on Linux (Debian host, not the Yggdrasil image): 524 pass, 2 fail. The failures are CyclesOracleTests.FamilyMatchesBlender(math) for cycles_arcsine/arccosine/arctan2, 1 ulp from Blender (platform libm); I did not run them at the base revision, so "pre-existing" is unproven. The GLSL and golden fixture were regenerated here, not on Yggdrasil's sdk:10.0 image the design doc names; device-bounds-lavapipe.txt was not re-recorded, so the new fbm family has no device-bounds row.

🤖 Generated with Claude Code

Follow-up libby-body:follow_up:chat-s615-625. 1. `math.fbm(p, octaves, lacunarity, gain)` and `math.fbm(p)` (4 octaves, lacunarity 2, gain 0.5): value-only octave sum of `snoise`. `cultmath_fbm` in HLSL; GLSL regenerated by GlslLowering (`CULTMATH_WRITE_GLSL=1`); golden-fixture family appended; FbmTests. 2. Lipschitz bound of `phacelle`: sigma_max of the (cosine, sine) Jacobian <= max(10, 1.25|side|)/(1-normalization), normalization in [0, 0.9], |side| in [0.25, 25]. Method and tightness in docs/design.md; `tools/phacelle-lipschitz` reproduces it; PhacelleTests pins it. Verification: full CultMath.Tests on Linux (Debian host, not the Yggdrasil image): 524 pass, 2 fail. The failures are CyclesOracleTests.FamilyMatchesBlender(math) for cycles_arcsine/arccosine/arctan2, 1 ulp from Blender (platform libm); I did not run them at the base revision, so "pre-existing" is unproven. The GLSL and golden fixture were regenerated here, not on Yggdrasil's sdk:10.0 image the design doc names; device-bounds-lavapipe.txt was not re-recorded, so the new fbm family has no device-bounds row. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
math.fbm(p, octaves, lacunarity, gain) and math.fbm(p) (four octaves, lacunarity 2, gain 0.5);
cultmath_fbm in the shaders, the GLSL regenerated by GlslLowering, a golden-fixture family
appended, FbmTests for the rules.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cultmath: measure the Lipschitz bound of phacelle, with its tool and a pinning test
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
990521b3f1
max singular value of the (cosine, sine) Jacobian <= max(10, 1.25 |side|) / (1 - normalization)
for normalization in [0, 0.9], |side| in [0.25, 25]; method and tightness in design.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cultmath: re-record device-bounds-lavapipe.txt for cultmath_fbm
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
3b58b24a68
Recorded on Yggdrasil under llvmpipe (LLVM 20.1.2) with
packages/cultmath/tools/device/run-lavapipe.sh, WRITE_BOUNDS=1, at 990521b3.
Adds the lavapipe-glsl and lavapipe-hlsl rows for cultmath_fbm only. The
cycles_arcsine/arctan2 rows are left as committed (pre-existing asin/atan
oracle failures at base 94f20eee are out of scope).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Owner

Re-recorded device-bounds-lavapipe.txt for cultmath_fbm (commit 3b58b24a, fast-forward onto 990521b3).

  • Run: packages/cultmath/tools/device/run-lavapipe.sh with WRITE_BOUNDS=1, in mcr.microsoft.com/dotnet/sdk:10.0 on Yggdrasil (4 CPU, 6 GiB, nice 10). Exit 0; DeviceResultsHoldFixture and CommittedShadersCarryNoReducedPrecisionQualifier passed against the freshly written file.
  • Device: llvmpipe (LLVM 20.1.2, 256 bits). Identity string equals the committed one (glslang-tools 15.1.0-2~ubuntu0.24.04.2, mesa-vulkan-drivers 25.2.8-0ubuntu0.24.04.4, dxc 1.9.0.1, snapshot 20261016T000000Z). snapshot.ubuntu.com answered 503 during apt-get update; the packages installed at the same versions anyway.
  • Added rows: glsl 125 (43 exact cases, worst u1 190.375, sha 8f852b55...), hlsl 125 (49 exact cases, worst u1 190.375, sha cd02f850...).
  • Not touched: the recorder also moved exact-case counts for rows 95 (cycles_arcsine, 154 -> 155) and 97 (cycles_arctan2, 6 -> 7) in both routes. Those belong to the pre-existing asin/acos/atan oracle failures at base 94f20eee, so the committed rows stay. The full recorder output is kept at /var/lib/mind-eureka-self/lavapipe-run/device-bounds-lavapipe.full.txt on Yggdrasil.
Re-recorded `device-bounds-lavapipe.txt` for `cultmath_fbm` (commit 3b58b24a, fast-forward onto 990521b3). - Run: `packages/cultmath/tools/device/run-lavapipe.sh` with `WRITE_BOUNDS=1`, in `mcr.microsoft.com/dotnet/sdk:10.0` on Yggdrasil (4 CPU, 6 GiB, nice 10). Exit 0; `DeviceResultsHoldFixture` and `CommittedShadersCarryNoReducedPrecisionQualifier` passed against the freshly written file. - Device: llvmpipe (LLVM 20.1.2, 256 bits). Identity string equals the committed one (glslang-tools 15.1.0-2~ubuntu0.24.04.2, mesa-vulkan-drivers 25.2.8-0ubuntu0.24.04.4, dxc 1.9.0.1, snapshot 20261016T000000Z). snapshot.ubuntu.com answered 503 during apt-get update; the packages installed at the same versions anyway. - Added rows: glsl 125 (43 exact cases, worst u1 190.375, sha 8f852b55...), hlsl 125 (49 exact cases, worst u1 190.375, sha cd02f850...). - Not touched: the recorder also moved exact-case counts for rows 95 (cycles_arcsine, 154 -> 155) and 97 (cycles_arctan2, 6 -> 7) in both routes. Those belong to the pre-existing asin/acos/atan oracle failures at base 94f20eee, so the committed rows stay. The full recorder output is kept at `/var/lib/mind-eureka-self/lavapipe-run/device-bounds-lavapipe.full.txt` on Yggdrasil.
Owner

Regenerated on Yggdrasil (mcr.microsoft.com/dotnet/sdk:10.0, Ubuntu 24.04.5, .NET 10.0.12), at head 3b58b24a. Follow-up cultmath-tapes:follow_up:chat-s805-806.

GLSL + golden fixture (CULTMATH_WRITE_GLSL=1 dotnet test --filter GlslMirrorTests): 37 pass, 2 skipped (the device tests), 0 fail. CultMath.glsl and CultMath.Phacelle.glsl regenerate byte-identical to the PR. glsl-parity.json differs only in platform-libm families: the platform strings (Debian 13/.NET 10.0.14 vs Ubuntu 24.04.5/.NET 10.0.12) and 1-ulp last-bit differences in function indices 95-97 (cycles_arcsine, cycles_arccosine, cycles_arctan2, the same three Blender-oracle cases you saw failing). The fbm and phacelle families are byte-identical. So the fbm/Lipschitz work is platform-independent; only the three libm-dependent families are recorded differently.

device-bounds-lavapipe.txt (run-lavapipe.sh with WRITE_BOUNDS=1, ran at this head): the cultmath_fbm row matches yours exactly (49 exact cases, worst u1 190.375, NaN mismatches 0, same result sha256). Only differences: exact-case counts for cycles_arcsine (155 vs 154) and cycles_arctan2 (7 vs 6), glsl and hlsl routes; same hashes and worst-ulp. This is the same libm noise.

I did not push. Whether the golden should be Debian- or Yggdrasil-recorded is your call; if the latter, the diff is at /opt/commons/handoff/cultlib-pr1-glsl-parity-yggdrasil.patch (git apply on this branch, 70 lines changed in glsl-parity.json), and it should fix the 3 FamilyMatchesBlender failures on Yggdrasil's image. I did not run the full suite there.

Regenerated on Yggdrasil (`mcr.microsoft.com/dotnet/sdk:10.0`, Ubuntu 24.04.5, .NET 10.0.12), at head 3b58b24a. Follow-up `cultmath-tapes:follow_up:chat-s805-806`. **GLSL + golden fixture** (`CULTMATH_WRITE_GLSL=1 dotnet test --filter GlslMirrorTests`): 37 pass, 2 skipped (the device tests), 0 fail. `CultMath.glsl` and `CultMath.Phacelle.glsl` regenerate byte-identical to the PR. `glsl-parity.json` differs only in platform-libm families: the `platform` strings (Debian 13/.NET 10.0.14 vs Ubuntu 24.04.5/.NET 10.0.12) and 1-ulp last-bit differences in function indices 95-97 (`cycles_arcsine`, `cycles_arccosine`, `cycles_arctan2`, the same three Blender-oracle cases you saw failing). The fbm and phacelle families are byte-identical. So the fbm/Lipschitz work is platform-independent; only the three libm-dependent families are recorded differently. **device-bounds-lavapipe.txt** (`run-lavapipe.sh` with `WRITE_BOUNDS=1`, ran at this head): the `cultmath_fbm` row matches yours exactly (49 exact cases, worst u1 190.375, NaN mismatches 0, same result sha256). Only differences: exact-case counts for cycles_arcsine (155 vs 154) and cycles_arctan2 (7 vs 6), glsl and hlsl routes; same hashes and worst-ulp. This is the same libm noise. I did not push. Whether the golden should be Debian- or Yggdrasil-recorded is your call; if the latter, the diff is at `/opt/commons/handoff/cultlib-pr1-glsl-parity-yggdrasil.patch` (`git apply` on this branch, 70 lines changed in `glsl-parity.json`), and it should fix the 3 `FamilyMatchesBlender` failures on Yggdrasil's image. I did not run the full suite there.
cultmath: phacelle-lipschitz prints usage and exits 2 on missing or malformed arguments
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
b57501b33e
Without arguments the tool threw IndexOutOfRange; a malformed number threw FormatException.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Some checks failed
CultMesh QUIC native / Build win32-x64 (pull_request) Has been skipped
CultMesh QUIC native / Build linux-x64 (pull_request) Has been skipped
CultMesh QUIC native / Release native binaries (pull_request) Has been skipped
CultMesh portability and performance / ubuntu-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest one-command multiplayer onboarding (pull_request) Has been cancelled
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
CultMesh portability and performance / windows-latest reactive semantics and leases (pull_request) Has been cancelled
CultNet cross-runtime interop / C# / TypeScript / Rust / Python / Kotlin (pull_request) Has been cancelled
CultMesh QUIC native / Verify committed binaries match SHA256SUMS (pull_request) Has been cancelled
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin libby/cultmath-fbm-lipschitz:libby/cultmath-fbm-lipschitz
git switch libby/cultmath-fbm-lipschitz

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff libby/cultmath-fbm-lipschitz
git switch libby/cultmath-fbm-lipschitz
git rebase main
git switch main
git merge --ff-only libby/cultmath-fbm-lipschitz
git switch libby/cultmath-fbm-lipschitz
git rebase main
git switch main
git merge --no-ff libby/cultmath-fbm-lipschitz
git switch main
git merge --squash libby/cultmath-fbm-lipschitz
git switch main
git merge --ff-only libby/cultmath-fbm-lipschitz
git switch main
git merge libby/cultmath-fbm-lipschitz
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/CultLib!1
No description provided.