Repository navigation
feat(wave): explicit PsramStorage opt-in for WaveSimulation2D_Real (refs #3122 A3) - #3141
Conversation
…efs #3122 A3) A3 of meta #3122. Closes the deferred PSRAM opt-in follow-up from #3114 without introducing a parallel class — instead, exposes a tag-dispatch constructor overload on the existing WaveSimulation2D_Real: WaveSimulation2D_Real sim{ WaveSimulation2D_Real::PsramStorage{}, 256, 256}; Default constructor stays SRAM (post-#3117 default). PsramStorage tag explicitly opts a grid into PSRAM for users who genuinely need a grid larger than SRAM can hold AND accept the per-cell perf cost (~5-10x slower on ESP32-S3 without L2 cache; ~no cost on ESP32-P4 with L2 + cached PSRAM). Implementation: - New PsramStorage tag type on WaveSimulation2D_Real. - New tag-dispatch constructor that constructs grid1/grid2 with psram_memory_resource() instead of the default SRAM resource. - Cell count populated via resize() after PSRAM allocation. Avoided creating a parallel WaveSimulation2D_Real_Large class — the duplicated body would have been a maintenance burden, and the existing class is already SRAM by default after #3117. One class, two constructors, predictable storage. Verified by tests/fl/math/wave/wave_simulation_real.cpp (9/9 cases pass, including the new PSRAM constructor exercise). The PSRAM constructor falls back to default allocator on host where there's no real PSRAM, so the test exercises the constructor path everywhere. Refs #3122 A3, #3114 (now closed), #3117 (SRAM default), #3113 parent meta.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds a PSRAM opt-in constructor to ChangesPSRAM opt-in constructor for WaveSimulation2D_Real
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
A3 of meta #3122. Closes the deferred PSRAM opt-in follow-up from #3114 without introducing a parallel class.
API
Tag-dispatch constructor overload:
Why this approach
Considered and rejected: a parallel
WaveSimulation2D_Real_Largeclass. The body would have duplicated everything; the existing class is already SRAM by default. One class, two constructors, predictable storage.When to use
PsramStorage{}Users who genuinely need a grid larger than SRAM can hold AND accept the per-cell perf cost:
Validation
bash test fl_math_wave_wave_simulation_real --cpp --clean— 9/9 pass.bash lint --cpp— clean.The new test case (
WaveSimulation2D_Real PSRAM opt-in constructor builds and runs) exercises the constructor path on host wherepsram_memory_resource()falls back to the default allocator.Refs #3122 A3, #3114 (closed), #3117 (SRAM default), #3113 parent meta.
Summary by CodeRabbit
New Features
Tests