memlnaut-nisps/nisps/core/perf.hpp
monkey-w1n5t0n 4e60d0192a feat(slp-workshop): new MEMLCelium-based mode + port Jolt & OU-noise RL learning
New SLP-Workshop firmware variant (Synth Library Portland), built on the
MEMLCelium engine + MLP shape. Ports the two post-fork learning-algorithm
changes from upstream memllib InterfaceRL into the shared nisps/ml core,
runtime-configurable (no compile-time switch), inert by default:

- nisps/ml/jolt.hpp: Jolt — held continuous weight morph over the flat
  weight buffer + post-release LR ramp (kJolt* constants verbatim).
- nisps/ml/ou_noise.hpp: OUNoise<N> — Ornstein-Uhlenbeck exploration walk
  on the output vector (theta=0.02, dt=0.001, kMaxAmplitude=0.65).

Both wired into ModeBase so every mode gains jolt_press/jolt_release/
jolt_lr_scale + set_explore_intensity; gated so existing modes stay
bit-identical (parity + golden tests green). Firmware surfaces them on
TogB1 (Jolt) and RVX1 (explore). New SLPWorkshopMode mode + schema +
codegen; firmware alias + .ino variant; playground mode registration.

Tests: jolt + OU unit tests, ModeBase learning integration incl. an
inert-parity test proving SLP-Workshop == MEMLCelium with features off.
Verified: cpp tests, wasm build, native↔wasm parity, lint, codegen
golden, playground typecheck. Firmware compile/e2e/hardware are
environment-bound (no arduino-cli/submodules/browser here).

Refs ergo 019f0fca.
2026-06-28 22:15:36 +02:00

34 lines
1.3 KiB
C++

// nisps/core/perf.hpp — RP2040/RP2350 memory section + inlining attributes.
//
// On firmware builds the macros expand to GCC/Pico-specific section attributes
// so hot code/data lives in SRAM instead of XIP flash. On every other build
// (host tests, Emscripten/WASM) they are inert — the discipline of marking
// audio-critical declarations is preserved syntactically without affecting
// codegen.
//
// See architecture.md §3.4.
#pragma once
#if defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_RP2350)
// Pico SDK provides __not_in_flash and __not_in_flash_func.
// __not_in_flash takes a section name string; __not_in_flash_func wraps the
// declaration directly.
#define NISPS_AUDIO_MEM __not_in_flash("audio")
#define NISPS_AUDIO_FUNC __not_in_flash_func
#define NISPS_APP_SRAM __not_in_flash("app")
#define NISPS_FORCE_INLINE __attribute__((always_inline)) inline
#define NISPS_HOT __attribute__((hot))
#define NISPS_NOINLINE __attribute__((noinline))
#else
#define NISPS_AUDIO_MEM
#define NISPS_AUDIO_FUNC(decl) decl
#define NISPS_APP_SRAM
#define NISPS_FORCE_INLINE inline
#define NISPS_HOT
#if defined(__GNUC__) || defined(__clang__)
#define NISPS_NOINLINE __attribute__((noinline))
#else
#define NISPS_NOINLINE
#endif
#endif