perf(noise): batch the three cave-warp channels through the SIMD evaluator -- exact, ~4% faster

The remove-one ablation, re-confirmed on the current build, puts the cave warp at 11.0% static /
11.8% moving of worker time: three independent Perlin3D calls per sample. VoxelNoise::Perlin3D_x3
evaluates the three warp channels together through the existing SIMD evaluator (Codex; reviewed
by me). It is wired into the generator, op-stack, classifier and room/player-fit unwarp paths.

Exact: the field is byte-identical. 0/841 tiles changed, 0 triangle delta, 0 voxels of maximum
surface displacement; canonical export 07C14005 / b3e5f4c3..9b377; capability 20,830 / 10,909;
strate-crossing and sealed-proof tests pass. The seam test (VoxelForgeMazeSeamTest, extended) has
48 neighbouring-tile and 24 cross-LOD comparisons, 0 mismatches. Before/after renders from a
camera aimed at the real arrival tunnel are byte-identical.

Cross-machine determinism: Perlin3D_x3 adds no new intrinsics, no AVX, no FMA and no runtime CPU
dispatch. It reuses the evaluator behind the compile-time gate
`#if PLATFORM_ENABLE_VECTORINTRINSICS && PLATFORM_CPU_X86_FAMILY`, so every x64 machine runs the same
instruction path; its output matches the scalar path bit for bit.

Final DEFAULT build vs the committed-tip DLL (two interleaved runs each):
  static  worker 30.83 -> 29.47 s (-4.4%)   LOD0 generation p50/p95 56.3/99.3 -> 53.3/95.3 ms
  moving  worker 67.28 -> 64.56 s (-4.0%)   LOD0 generation p50/p95 55.9/99.0 -> 53.4/96.4 ms
Ledger: every launch passed; two harness false negatives (the seam test on the game-only
validator, and a trace ended by intentional forced termination) were rerun. No crash folders.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TaFdXhTdYMkW1xrV6ApT6Y
This commit is contained in:
Fr0zkaandClaude Opus 5 committed 2026-09-15 08:41:59 +02:00
1 parent ce4d8783e9
commit 1d824aaab2
5 files changed
+235 -31

No files matched your search

+12 -9
View File
@@ -3841,21 +3841,24 @@ float UVoxelGenerator::GetDensityWithParams(float WorldX, float WorldY, float Wo
const float WF = Params.CaveWarpFrequency;
const float WS = Params.CaveWarpStrength;
// Three independent Perlin fields offset by irrational-ish numbers
// so the X/Y/Z warp channels don't correlate with each other.
// Single octave to keep per-voxel cost low (3 Perlin calls total).
WarpedX += VoxelNoise::Perlin3D(FVector3f(
// Three independent Perlin fields offset by irrational-ish numbers keep the X/Y/Z warp
// channels decorrelated. Perlin3D_x3 evaluates these same three scalar channels in one
// SIMD batch on x86; its non-SIMD fallback is the original three-call expression.
float WarpX, WarpY, WarpZ;
VoxelNoise::Perlin3D_x3(
WorldX * WF + VoxelHash::SeedOffset(SeedU, 0.37f),
WorldY * WF + 1.3f,
EffectiveZ * WF + 5.7f)) * VOXEL_NOISE_SCALE * WS;
WarpedY += VoxelNoise::Perlin3D(FVector3f(
EffectiveZ * WF + 5.7f,
WorldX * WF + 7.1f,
WorldY * WF + VoxelHash::SeedOffset(SeedU, 0.59f),
EffectiveZ * WF + 2.3f)) * VOXEL_NOISE_SCALE * WS;
WarpedZ += VoxelNoise::Perlin3D(FVector3f(
EffectiveZ * WF + 2.3f,
WorldX * WF + 11.3f,
WorldY * WF + 9.7f,
EffectiveZ * WF + VoxelHash::SeedOffset(SeedU, 0.41f))) * VOXEL_NOISE_SCALE * WS;
EffectiveZ * WF + VoxelHash::SeedOffset(SeedU, 0.41f),
WarpX, WarpY, WarpZ);
WarpedX += WarpX * VOXEL_NOISE_SCALE * WS;
WarpedY += WarpY * VOXEL_NOISE_SCALE * WS;
WarpedZ += WarpZ * VOXEL_NOISE_SCALE * WS;
}
//=========================================================================