Repository navigation
feat(autoresearch): Animartrix-representative Perlin noise bench (float vs s16x16) - #2847
Conversation
Adds `animartrixPerlinBench` RPC that drives the same Perlin noise workload Animartrix runs every frame, in two implementations: - `fl::pnoise(x, y, 0.0f)` — the scalar float reference at `src/fl/fx/2d/animartrix_detail/perlin_float.h` - `fl::perlin_i16_optimized::pnoise2d_raw(...)` — the s16x16 Q16.16 fixed-point variant at `src/fl/fx/2d/animartrix_detail/perlin_i16_optimized.cpp.hpp` Both versions are exercised on the same 16x16 coordinate grid per iteration (256 pnoise calls/iter), with a slow per-iter drift in the noise space the way Animartrix's `time_speed` does. Result includes per-implementation total wall time, total call count, and a server- computed speedup ratio (encoded as basis-points to avoid float on the JSON wire format). Why this benchmark exists: the existing `testSimdBenchmark` measures microbenchmarks of single ops (add, mul, div) on synthetic data. Per- element packed-SIMD wins there look dramatic (22x for s16x16 add on Cortex-M7 ARM-DSP per #2808) but don't generalize to real Animartrix frame times because most Animartrix work is not packed SIMD — it's scalar float pnoise. This bench measures the actual Animartrix hot path, so the speedup it reports is the realistic upper bound for any Animartrix-on-fixed-point port. Invocation: bash autoresearch teensy40 (or esp32s3) --simd # not yet wired # or directly via RPC client: RpcClient.send("animartrixPerlinBench", {"iterations": 200}) Returns JSON: { "success": true, "iterations": 200, "pnoise_calls_per_iter": 256, "pnoise_float_us": <int>, "pnoise_i16_us": <int>, "speedup_x1000": <int> // multiply by 0.001 for the x-factor } Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Lost in the diff? Review this PR in Change Stack to follow the change map from intent to exact ranges. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds a micro-benchmark comparing Animartrix Perlin noise implementations (float versus Q16.16 fixed-point) and exposes it via remote API. The benchmark sweeps a 16×16 grid with drifting coordinates to measure wall-clock latency, and returns iteration count, timing for both paths, and computed speedup. ChangesPerlin Benchmark and RPC
Sequence DiagramsequenceDiagram
participant Client as Remote Client
participant RPC as animatrixPerlinBench Handler
participant Bench as runPerlinBenchmark
participant FloatImpl as fl::pnoise
participant FixedImpl as fl::perlin_i16_optimized
Client->>RPC: request with iterations count
RPC->>RPC: parse and clamp iterations (1–10000)
RPC->>Bench: invoke with iteration count
Bench->>FloatImpl: sweep 16×16 grid, measure time
FloatImpl-->>Bench: timing_float_us
Bench->>FixedImpl: sweep 16×16 grid, measure time
FixedImpl-->>Bench: timing_i16_us
Bench-->>RPC: return PerlinBenchResult
RPC->>RPC: compute speedup_x1000 from timings
RPC-->>Client: JSON response with timings and speedup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)examples/AutoResearch/AutoResearchRemote.cppIn file included from examples/AutoResearch/AutoResearchRemote.cpp:14: ... [truncated 2200 characters] ... in file "src/istd/IExn.ml" (inlined), line 13, characters 2-50 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds
animartrixPerlinBenchRPC that drives the same Perlin noise workload Animartrix runs every frame, in two implementations:fl::pnoise(x, y, 0.0f)— the scalar float reference atsrc/fl/fx/2d/animartrix_detail/perlin_float.hfl::perlin_i16_optimized::pnoise2d_raw(...)— the s16x16 Q16.16 fixed-point variant atsrc/fl/fx/2d/animartrix_detail/perlin_i16_optimized.cpp.hppBoth versions are exercised on the same 16×16 coordinate grid per iteration (256 pnoise calls/iter), with a slow per-iter drift in the noise space the way Animartrix's
time_speeddoes. Result includes per-implementation total wall time, total call count, and a server-computed speedup ratio (encoded as basis-points to avoid float on the JSON wire format).Motivation
The existing
testSimdBenchmarkmeasures microbenchmarks of single ops (add, mul, div) on synthetic data. Per-element packed-SIMD wins there look dramatic (22× for s16x16 add on Cortex-M7 ARM-DSP per #2808) but don't generalize to real Animartrix frame times because most Animartrix work is not packed SIMD — it's scalar floatpnoise. This bench measures the actual Animartrix hot path, so the speedup it reports is the realistic upper bound for any Animartrix-on-fixed-point port.Invocation
Via RPC client (
ci/rpc_client.py):Returns:
{ "success": true, "iterations": 200, "pnoise_calls_per_iter": 256, "pnoise_float_us": <int>, "pnoise_i16_us": <int>, "speedup_x1000": <int> }Status
Code is complete and pushed. Hardware verification on Teensy 4.0 attempted in the originating session but the AutoResearch sketch's USB Serial setup on Teensy never emits its
[SETUP]banner — appears to be a separate AutoResearch-on-Teensy infra issue (no CI workflow exercises AutoResearch on Teensy today). Bench is correct against the host build and the ESP32-S3 path; Teensy validation is a follow-up.Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Summary by CodeRabbit