memlnaut-nisps/nisps/core/perf.hpp
monkey-w1n5t0n e37f16739e refactor(nisps): delete dead core/ML mass; keep the legacy feedback modes
Phase 1 group 2 (L27, L26, L28, S21, L13, ST6, S20).

- L27: fixed_buffer.hpp + its test + the CMake entry — no consumers.
- L26: dislike_multiplier_ and its doubling/halving bookkeeping — upstream
  InterfaceRL residue that drove nothing. The audit pointed at the wrong test
  file for the surviving reference; the actual assert was in
  test_mlp_geo_dislike.cpp:211, removed here.
- L28: added copy_weights_to(std::span<float>) to FixedStorage and
  DynamicStorage and switched feedback.hpp's take_snapshot/push_undo/nudge to
  it. Drops the permanent whole-net flat_ scratch buffer from FixedStorage and
  the per-gesture double copy. Behaviour-identical: same source values, same
  write order, same RNG draw order in nudge().
- S21 + L13: deleted NISPS_AUDIO_MEM / NISPS_APP_SRAM / NISPS_AUDIO_FUNC —
  zero use sites outside perf.hpp and comments — and rewrote midi_io.hpp's one
  misshapen NISPS_AUDIO_FUNC use as a plain `inline void`. perf.hpp now
  documents only the inlining/hotness macros that actually exist, and
  audio_driver.hpp no longer claims an SRAM discipline the code never had.
- ST6: feedback.hpp's header now describes the four current modes and the
  Geometric default, dropping the retracted "geometric push NOT ported" claim.

S20 — OPERATOR DECISION (§7.1): the four legacy feedback behaviours
(RandomiseOutputs, RandomiseMlp, AvoidStyle::Diffuse, the RandomiseMlp branch of
on_drag) are KEPT, not deleted. They are wanted as building blocks for
experimenting with how different instruments feel under different behaviours.
Each is now marked at its definition as deliberately-retained research reserve
so future audits stop flagging it as dead code.

L25 (the 16 KB firmware loss-history buffer) is NOT done here — see the phase
report; it turned out to be coupled into the shared mlp.hpp, and its fate
belongs with the browser telemetry build (§7.3 / plan §6.5e).

Gates: run-all-tests.sh ALL GREEN.
2026-07-21 12:48:27 +02:00

35 lines
1.5 KiB
C++

// nisps/core/perf.hpp — RP2040/RP2350 inlining/hotness attributes.
//
// On firmware builds NISPS_FORCE_INLINE/NISPS_HOT/NISPS_NOINLINE expand to
// GCC-specific attributes; on every other build (host tests, Emscripten/WASM)
// NISPS_FORCE_INLINE/NISPS_HOT are inert (NISPS_NOINLINE still applies under
// GCC/Clang host compilers). No SRAM-section placement macros are defined
// here today (the previous NISPS_AUDIO_MEM/NISPS_APP_SRAM/NISPS_AUDIO_FUNC
// regime had zero real call sites — 2026-07 simplification audit S21). If
// flash-vs-SRAM placement is ever measured to matter, add the macro(s) back
// alongside the actual hot declaration(s) that need them.
#pragma once
// NISPS_TARGET_EMBEDDED marks builds for the RP2350 hardware target. Code
// that is allowed heap allocation at construction time on host/WASM targets
// (e.g. nisps/ml/dynamic_storage.hpp) is compile-time excluded when this is
// defined — the zero-heap firmware contract is enforced structurally, not
// just by lint.
#if defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_RP2350)
#define NISPS_TARGET_EMBEDDED 1
#endif
#if defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_RP2350)
#define NISPS_FORCE_INLINE __attribute__((always_inline)) inline
#define NISPS_HOT __attribute__((hot))
#define NISPS_NOINLINE __attribute__((noinline))
#else
#define NISPS_FORCE_INLINE inline
#define NISPS_HOT
#if defined(__GNUC__) || defined(__clang__)
#define NISPS_NOINLINE __attribute__((noinline))
#else
#define NISPS_NOINLINE
#endif
#endif