V10.7.46: budget audio against total system load and preserve pending core-1 jobs

Use total audio-half time for overload protection, admission prediction and UI throttling. Refuse mailbox replacement while USB resampling is pending. Add regression coverage and retain generator sounds.
This commit is contained in:
JUAN JIANT committed 2026-11-17 13:06:01 -03:00
1 parent 6ebc1b7352
commit f44f81ce0e
14 files changed
+2192 -2046

No files matched your search

+11 -1
View File
@@ -1,7 +1,7 @@
name: VOICE user lyric candidate
on:
push:
branches: [codex/voice-user-lyrics, codex/swarm]
branches: [codex/voice-user-lyrics, codex/swarm, codex/audio-cpu-v46]
permissions:
contents: read
concurrency:
@@ -50,6 +50,16 @@ jobs:
python3 -c "import sys,pathlib;sys.path.insert(0,'tools');import build;p=pathlib.Path('build/felucca.map');r=build.map_inputs(p.read_text()) if p.exists() else [];print('Largest sections:', sorted(r,key=lambda x:x[2],reverse=True)[:35]);print('Save/GEN sections:',[(n,a,z,o) for n,a,z,o in r if n.startswith(('.text.song_', '.text.gen_', '.text.project_save', '.text.lib_scan'))]);print('Cold bank:',[l for l in p.read_text().splitlines() if '_bt_end' in l or '_bt_start' in l] if p.exists() else [])"
exit 1
}
- name: V46 realtime overload and core ownership regressions
run: |
set -euo pipefail
python3 tests/realtime_regression_test.py
cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/audio_test.c -lm -o build/song-check/audio
build/song-check/audio | tee build/song-check/audio.log
cc -O1 -g -w -Wno-implicit-function-declaration -fsanitize=address,undefined -fno-sanitize=shift,signed-integer-overflow -Ibuild/gen -Ifirmware/src tests/overload_stress_test.c -lm -o build/song-check/overload
ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=halt_on_error=1 build/song-check/overload | tee build/song-check/overload.log
cc -O1 -w -Wno-implicit-function-declaration -Ibuild/gen -Ifirmware/src tests/anim_test.c -lm -o build/song-check/anim
build/song-check/anim > build/song-check/anim.log
- name: Firmware memory and reach checks
run: tail -n 20 build/song-check/target.log
- name: Lossless font metadata and isolated per-track generator
+6 -1
View File
@@ -17,7 +17,7 @@ a generator and effects, all inside the little keyboard. It is a fork of [Felucc
The emulator runs the same code as the FM-1, with sound, played with the computer keyboard or the mouse. The installer
always offers the current public version first, and the earlier ones under it.
## This release: V10.7.45
## This release: V10.7.46
### Installing
@@ -483,6 +483,11 @@ same license.
Every update is listed here, newest first. (Since 0.6.80 at the end of the page: what the synth does comes first.)
### V10.7.46 (2026-11-17)
- **Audio under system load:** voice admission, overload recovery and animation throttling now account for the entire audio deadline, including nested input/USB interrupts. Sustained system work can no longer make the guard reopen while the audio buffer is still near its deadline.
- **USB and the second core:** a pending resampling job keeps ownership of its mailbox. A new mixing job falls back to core 0 instead of overwriting unfinished work.
- Generator recipes, sounds and project format are unchanged. These fixes address missed overload protection; they do not make the hardware's CPU budget unlimited.
### V10.7.43 — beta (2026-11-15)
- **PRESETS as before V10.7.33** (the owner): turning **PRESETS** loads the next / previous sound of the track's
engine at once, round within the engine, its name shown, the page staying as it is; **EDIT + PRESETS** jumps to the
+5
View File
@@ -174,6 +174,11 @@ static inline int fm1_mc_run(void (*fn)(uint32_t), uint32_t arg)
fm1_mc_lost = 3;
return 0;
}
/* One mailbox, not a queue: a late USB resampler may not have read its
* job yet. Leave ownership intact; the mixer can render on core 0. */
FM1_C1_SYNC();
if (fm1_mc_box.done != fm1_mc_box.job)
return 0;
job = fm1_mc_box.job + 1u;
fm1_mc_box.fn = fn;
fm1_mc_box.arg = arg;
+1 -1
View File
@@ -49,7 +49,7 @@
#define FELUCCA_ID "FM-1_900" /* package identity (build.py: the .fwsc marker string) */
#endif
#ifndef FELUCCA_VERSION
#define FELUCCA_VERSION "V10.7.45" /* (2026-11-17) V10.7.45: LIFE out of the system for now (HOME without its page, its punch-in another FX), a held step's OCT+ copies and OCT- pastes, a held step + SELECT walks the lock pages again (Eugen). (2026-11-17) V10.7.44: punch-in FX you choose (three layouts, MUTES back), FX FILTER snaps open, GLITCH as before V10.7.36, a kit's VOICES, HOME > TRACKS lighter. (2026-11-17) V10.7.43: CPU back under V10.7.23 (BALANCE gone, LIFE one cross-FM knob, EROSION NOISE / METAL), clean releases, PANIC clears the FX, PRESETS as before V10.7.33. (2026-11-15) V10.7.42: FREEZE let go, the tracks back at the full rate; a silent block skips the master, LIFE lighter. (2026-11-15) V10.7.41: WEST RES high no longer breaks on the peaks, the tracks under a FREEZE holding at half the rate. (2026-11-15) V10.7.40: FM6 (and every engine that can) at half the rate before a glitch, from 75 % load (ECO 55 %), the full rate back under 55 %. (2026-11-15) V10.7.39: EDIT > VOICES 2 > VOICES, a track's voices at most (AUTO, 1..8), ALL n/8. (2026-11-15) V10.7.38: WEST drawn as its circuit, FILTER 2 is EROSION, DRUM-X in twelve pages with its own EROSION and its sound reviewed, ALLOC automatic (VOICES 2 UNISON VEL IMAGE), MATH RETRIG TIME NOTE or tempo rates, PROX SLEW and SENS, the emulator sends to and reads from the FM-1. (2026-11-15) V10.7.37: WEST remade (a vactrol low-pass gate: quick attack, slow nonlinear decay and its ring; sine-to-triangle cores folded Buchla / Serge style), FREEZE holds the master itself as a drone (was the reverb's). (2026-11-15) V10.7.36: WEST COAST replaces NOISE (FOLD SYMM MOD RATIO, GATE DECAY RES DUST; NOISE projects open as WEST in DUST), FX punch-ins redesigned (REVERSE TAPE STOP WOBBLE DLY 1/16 COMB, PITCH UP DN FREEZE REV ALL DLY ALL RING LIFE MAX, GLITCH new; LPF HPF MUTES TRK DEC CLR keys out), HOME LIFE MACROS LIVE MIX TRACKS .., SAVE PART SLOTS after PROJECTS, HOME + SELECT on MACROS the macros' dice, EDIT held no map, MENU four rows, REC SAVE held tiles. (2026-11-14) V10.7.35: SELECT on HOME > MACROS turns the page (the macros' dice LFO + SELECT), EDIT the sound first (EDIT 1 EDIT 2 the engine's page, FILTER FILTER 2 TONE: KEY TRK CRUSH LIFE, VOICES VOICES 2, AUTO KNOBS last), LIFE past 25 % up to x4 at 100 %, PRESETS' list larger. (2026-11-14) V10.7.34: HOME > LIFE first (the voices alive, the tracks moving each other before the effects; LIFE FILTER PITCH FX, a track's own LIFE on VOICES 3, LIFE BEING sources and LIFE destination in the matrix), HOME > TRACKS after MACROS (every track a lane, TRACK LEVEL PAN REV, GLO's mute and solo), an FX held recording its automation said (REC FX AUTOM, REC+FX clears). (2026-11-14) V10.7.33: VOICE sings phonemes (the editor's lyrics, no dictionary on the device), BALANCE and DIST NOISE back, CRUSH on VOICES 3, DRONE (the same note again lets it go, MUTE lets all go, the held keys lit; ARP HOLD the arp's alone), the UI's names, PRESETS' list, SEQ + PRESETS the step, BPM on MACROS, G.SWING on MIXER, HELP (HOME + OCT+), the macros' dice, AUTO KNOBS. (2026-11-14) V10.7.32: HOME the song (MACROS TIMELINE ARRANGE PARTS SCOPE GENE), PARTS one grid (a column the part, a cell its track), SAVE saves (TOOLS PROJECTS USER PRESETS PART SLOTS), LOCKS (AUTOMATION + AUTO LIST), the punch-in lane on the FX-held screen (FX KNOBS), KEY SPLIT STAGE ENV TRACKS out, FX SENDS' DIST bar. (2026-11-14) V10.7.31: FILTER 2 modulates (NOISE the depth, MODE SOFT STEP METAL BREAK DUST on the cutoff, DEST FILT .. PITCH), F.NOISE a MOD source, KEY on FILTER 3, LP24 with more power (drive x6, level kept, self-oscillation). (2026-11-13) V10.7.30: FILTER MS20 an LP24 alias, LP24 DRIVE, FILTER 2 (KEY, the noise modulator, textures); DIST CRUSH without its pedal tone, a smooth FOLD, AMP without the honk; GEN the sequencer's tools per section, the chords' room; GLO's KEYS and RAILS out (BALANCE and DIST NOISE built, out of the image). (2026-11-13) V10.7.29: STRING FDBK GAIN the feedback's amount (holds from 1, up to +6 dB, a soft limit after the cab), the highs held as the lows; GEN the drums' TONE 13 lower (a seed's third 25). (2026-11-13) V10.7.28: GEN FORM PARTS a structure per seed too (SONG's templates, its rows at half length). (2026-11-13) V10.7.27: STRING FDBK an electric guitar into an amp (pick, pickup, tube, cab, feedback held at its level), BOW a bow's stick and slip with the body by register, VIOLIN VIOLA CELLO. (2026-11-13) V10.7.26: GEN FORM SONG a structure per seed, from templates of the genre's family (club, song, hip hop, arc, fuga), ENERGY shaping drops and intros, 2-5 minutes. (2026-11-13) V10.7.25: VOICE like a singer (pitch life, entries, legato landings, vibrato on long notes, swell, phrase fall, creak), N / M / Ñ and R / RR / English r, a retriggered MONO note one syllable. (2026-11-13) V10.7.24: HOME is MACROS (M1..M4 over the beings) and SCOPE (FILTER SPACE DRIVE DUCK on the whole mix); VOICE sings on the step (consonants started eaLine truncated
#define FELUCCA_VERSION "V10.7.46" /* (2026-11-17) V10.7.45: LIFE out of the system for now (HOME without its page, its punch-in another FX), a held step's OCT+ copies and OCT- pastes, a held step + SELECT walks the lock pages again (Eugen). (2026-11-17) V10.7.44: punch-in FX you choose (three layouts, MUTES back), FX FILTER snaps open, GLITCH as before V10.7.36, a kit's VOICES, HOME > TRACKS lighter. (2026-11-17) V10.7.43: CPU back under V10.7.23 (BALANCE gone, LIFE one cross-FM knob, EROSION NOISE / METAL), clean releases, PANIC clears the FX, PRESETS as before V10.7.33. (2026-11-15) V10.7.42: FREEZE let go, the tracks back at the full rate; a silent block skips the master, LIFE lighter. (2026-11-15) V10.7.41: WEST RES high no longer breaks on the peaks, the tracks under a FREEZE holding at half the rate. (2026-11-15) V10.7.40: FM6 (and every engine that can) at half the rate before a glitch, from 75 % load (ECO 55 %), the full rate back under 55 %. (2026-11-15) V10.7.39: EDIT > VOICES 2 > VOICES, a track's voices at most (AUTO, 1..8), ALL n/8. (2026-11-15) V10.7.38: WEST drawn as its circuit, FILTER 2 is EROSION, DRUM-X in twelve pages with its own EROSION and its sound reviewed, ALLOC automatic (VOICES 2 UNISON VEL IMAGE), MATH RETRIG TIME NOTE or tempo rates, PROX SLEW and SENS, the emulator sends to and reads from the FM-1. (2026-11-15) V10.7.37: WEST remade (a vactrol low-pass gate: quick attack, slow nonlinear decay and its ring; sine-to-triangle cores folded Buchla / Serge style), FREEZE holds the master itself as a drone (was the reverb's). (2026-11-15) V10.7.36: WEST COAST replaces NOISE (FOLD SYMM MOD RATIO, GATE DECAY RES DUST; NOISE projects open as WEST in DUST), FX punch-ins redesigned (REVERSE TAPE STOP WOBBLE DLY 1/16 COMB, PITCH UP DN FREEZE REV ALL DLY ALL RING LIFE MAX, GLITCH new; LPF HPF MUTES TRK DEC CLR keys out), HOME LIFE MACROS LIVE MIX TRACKS .., SAVE PART SLOTS after PROJECTS, HOME + SELECT on MACROS the macros' dice, EDIT held no map, MENU four rows, REC SAVE held tiles. (2026-11-14) V10.7.35: SELECT on HOME > MACROS turns the page (the macros' dice LFO + SELECT), EDIT the sound first (EDIT 1 EDIT 2 the engine's page, FILTER FILTER 2 TONE: KEY TRK CRUSH LIFE, VOICES VOICES 2, AUTO KNOBS last), LIFE past 25 % up to x4 at 100 %, PRESETS' list larger. (2026-11-14) V10.7.34: HOME > LIFE first (the voices alive, the tracks moving each other before the effects; LIFE FILTER PITCH FX, a track's own LIFE on VOICES 3, LIFE BEING sources and LIFE destination in the matrix), HOME > TRACKS after MACROS (every track a lane, TRACK LEVEL PAN REV, GLO's mute and solo), an FX held recording its automation said (REC FX AUTOM, REC+FX clears). (2026-11-14) V10.7.33: VOICE sings phonemes (the editor's lyrics, no dictionary on the device), BALANCE and DIST NOISE back, CRUSH on VOICES 3, DRONE (the same note again lets it go, MUTE lets all go, the held keys lit; ARP HOLD the arp's alone), the UI's names, PRESETS' list, SEQ + PRESETS the step, BPM on MACROS, G.SWING on MIXER, HELP (HOME + OCT+), the macros' dice, AUTO KNOBS. (2026-11-14) V10.7.32: HOME the song (MACROS TIMELINE ARRANGE PARTS SCOPE GENE), PARTS one grid (a column the part, a cell its track), SAVE saves (TOOLS PROJECTS USER PRESETS PART SLOTS), LOCKS (AUTOMATION + AUTO LIST), the punch-in lane on the FX-held screen (FX KNOBS), KEY SPLIT STAGE ENV TRACKS out, FX SENDS' DIST bar. (2026-11-14) V10.7.31: FILTER 2 modulates (NOISE the depth, MODE SOFT STEP METAL BREAK DUST on the cutoff, DEST FILT .. PITCH), F.NOISE a MOD source, KEY on FILTER 3, LP24 with more power (drive x6, level kept, self-oscillation). (2026-11-13) V10.7.30: FILTER MS20 an LP24 alias, LP24 DRIVE, FILTER 2 (KEY, the noise modulator, textures); DIST CRUSH without its pedal tone, a smooth FOLD, AMP without the honk; GEN the sequencer's tools per section, the chords' room; GLO's KEYS and RAILS out (BALANCE and DIST NOISE built, out of the image). (2026-11-13) V10.7.29: STRING FDBK GAIN the feedback's amount (holds from 1, up to +6 dB, a soft limit after the cab), the highs held as the lows; GEN the drums' TONE 13 lower (a seed's third 25). (2026-11-13) V10.7.28: GEN FORM PARTS a structure per seed too (SONG's templates, its rows at half length). (2026-11-13) V10.7.27: STRING FDBK an electric guitar into an amp (pick, pickup, tube, cab, feedback held at its level), BOW a bow's stick and slip with the body by register, VIOLIN VIOLA CELLO. (2026-11-13) V10.7.26: GEN FORM SONG a structure per seed, from templates of the genre's family (club, song, hip hop, arc, fuga), ENERGY shaping drops and intros, 2-5 minutes. (2026-11-13) V10.7.25: VOICE like a singer (pitch life, entries, legato landings, vibrato on long notes, swell, phrase fall, creak), N / M / Ñ and R / RR / English r, a retriggered MONO note one syllable. (2026-11-13) V10.7.24: HOME is MACROS (M1..M4 over the beings) and SCOPE (FILTER SPACE DRIVE DUCK on the whole mix); VOICE sings on the step (consonants started eaLine truncated
#endif
#if FELUCCA_OTA && !FELUCCA_FLASH
#error "FELUCCA_OTA needs FELUCCA_FLASH"
+1 -1
View File
@@ -141,7 +141,7 @@ static const uint8_t UI_ON[3] = {60u, 75u, 85u}, UI_OFF[3] = {50u, 65u, 78u};
#define ANIM_SNAP() (ANIM_OFF() || sys_load || ui_hold)
static void ui_hold_poll(void)
{
uint32_t pct = song.playing ? load_avg_q8 >> 8 : 0u, h = 0;
uint32_t pct = song.playing ? load_all_q8 >> 8 : 0u, h = 0; /* include nested work in the deadline budget */
while (h < 3u && pct >= (h < ui_hold ? UI_OFF[h] : UI_ON[h])) /* (each step up past its own, down under its own) */
h++;
ui_hold = (uint8_t)h;
+15 -13
View File
@@ -711,7 +711,7 @@ static volatile uint8_t load_tight;
#define GUARD_STEP ((uint32_t)FS / 2u / HALF_FRAMES) /* halves of calm a voice given back: 0.5 s */
#define GUARD_MIN 4u /* the cap never under this: a lead for each of 4 tracks */
static uint32_t load_avg_q8, load_all_q8; /* the render's share of a half (%, Q8), averaged; with TIMER5
* nested in it (audio.c: the extra voices' admission) */
* nested in it (audio.c: the total deadline budget) */
static uint32_t load_pred_q8; /* the admission's prediction: the average, plus what the
* voices admitted since add (load_admit) */
static uint8_t guard_run, guard_cap, load_cores2; /* halves in a row past GUARD_ON_RUN; the cap while tripped
@@ -791,8 +791,10 @@ static __attribute__((noinline)) void load_half(uint32_t pct, uint32_t pct_all,
load_avg_q8 = (load_avg_q8 * ((1u << GUARD_AVG_LOG2) - 1u) + (pct << 8) + (1u << (GUARD_AVG_LOG2 - 1u))) >> GUARD_AVG_LOG2;
load_all_q8 = (load_all_q8 * ((1u << GUARD_AVG_LOG2) - 1u) + (pct_all << 8) + (1u << (GUARD_AVG_LOG2 - 1u))) >> GUARD_AVG_LOG2;
load_cores2 = (uint8_t)cores2;
guard_run = pct > on_run ? (uint8_t)(guard_run < 255u ? guard_run + 1u : 255u) : 0u;
if (guard_run >= GUARD_RUN || load_avg_q8 > (on_avg << 8)) {
/* V10.7.46: nested input/USB work consumes the same DMA deadline. Keep
* render-only diagnostics, but budget voices against the whole half. */
guard_run = pct_all > on_run ? (uint8_t)(guard_run < 255u ? guard_run + 1u : 255u) : 0u;
if (guard_run >= GUARD_RUN || load_all_q8 > (on_avg << 8)) {
uint32_t busy = voices_busy(), cap = voice_cap0();
if (busy < GUARD_MIN) busy = GUARD_MIN;
if (busy > cap) busy = cap;
@@ -803,7 +805,7 @@ static __attribute__((noinline)) void load_half(uint32_t pct, uint32_t pct_all,
load_tight = 1;
guard_calm = 0;
} else if (load_tight) {
if (load_avg_q8 >= (off << 8) || guard_run) {
if (load_all_q8 >= (off << 8) || guard_run) {
guard_calm = 0;
} else if (++guard_calm >= GUARD_STEP) { /* calm: a voice back, and so on */
guard_calm = 0;
@@ -813,8 +815,8 @@ static __attribute__((noinline)) void load_half(uint32_t pct, uint32_t pct_all,
}
}
}
if (load_pred_q8 < load_avg_q8)
load_pred_q8 = load_avg_q8; /* (what the voices added decays by the block: load_block) */
if (load_pred_q8 < load_all_q8)
load_pred_q8 = load_all_q8; /* (what the voices added decays by the block: load_block) */
}
/* Key-up ends a melodic hold, but a one-shot drum is still a live hit.
@@ -961,8 +963,8 @@ static void load_take(const track_t *t) /* a voice added: into t
static void load_block(void) /* a block rendered (track_render, part 1: every block, on the
* host too): the prediction back toward the average */
{
uint32_t add = load_pred_q8 > load_avg_q8 ? load_pred_q8 - load_avg_q8 : 0u;
load_pred_q8 = load_avg_q8 + add - ((add + (1u << (LOAD_ADD_LOG2 - 1u))) >> LOAD_ADD_LOG2);
uint32_t add = load_pred_q8 > load_all_q8 ? load_pred_q8 - load_all_q8 : 0u;
load_pred_q8 = load_all_q8 + add - ((add + (1u << (LOAD_ADD_LOG2 - 1u))) >> LOAD_ADD_LOG2);
}
static uint32_t load_sounding_q8(void) /* what every sounding voice costs: the most the voices admitted
* since the average can have added (a bound on the prediction:
@@ -981,13 +983,13 @@ static uint32_t load_sounding_q8(void) /* what every sounding v
static int load_admit(const track_t *t) /* room for a voice of part t? taken if so */
{
uint32_t limit = (sys_load == LOAD_ECO ? LOAD_ADMIT_ECO : LOAD_ADMIT) << 8, add, most;
add = load_pred_q8 > load_avg_q8 ? load_pred_q8 - load_avg_q8 : 0u;
add = load_pred_q8 > load_all_q8 ? load_pred_q8 - load_all_q8 : 0u;
most = load_sounding_q8();
if (add > most) {
add = most;
load_pred_q8 = load_avg_q8 + add;
load_pred_q8 = load_all_q8 + add;
}
if (load_avg_q8 + add + load_cost_q8(t) > limit)
if (load_all_q8 + add + load_cost_q8(t) > limit)
return 0;
load_take(t);
return 1;
@@ -1101,7 +1103,7 @@ static __attribute__((noinline)) void voice_soft(void)
voice_kill(&vp->v[k]);
busy = voices_load();
}
if (!near || (!load_tight && load_avg_q8 <= lim)) /* (V10.7.40, the owner: before a glitch) the average past the
if (!near || (!load_tight && load_all_q8 <= lim)) /* (V10.7.40, the owner: before a glitch) the average past the
* admission's limit less HALF_NEAR (75 %, ECO 55 %) for HALF_WAIT,
* or the guard tripped: the dearest part's held voices at half the
* rate; back at the full rate under HALF_BACK (55 %) */
@@ -1111,7 +1113,7 @@ static __attribute__((noinline)) void voice_soft(void)
vh_held |= (uint8_t)(1u << dear);
vh_wait = 0;
}
if (!load_tight && load_avg_q8 < (HALF_BACK << 8))
if (!load_tight && load_all_q8 < (HALF_BACK << 8))
vh_held = 0;
if (frz_on) /* (V10.7.41, the owner: FREEZE glitched a full project) the
* tracks under a FREEZE holding are not heard: every part that can
+21
View File
@@ -0,0 +1,21 @@
# V10.7.46 audio overload validation
Base: `6ebc1b73521b831a8cbfdfcbbe272f2c88d8d63b` (published V10.7.45).
The audio IRQ already measured both render time and total time including nested input/USB work. The voice guard, admission predictor, half-rate recovery and UI load throttling used render time, so sustained total load could fail to engage protection or reopen it too soon. They now use total time; render-only diagnostics remain available.
The core-1 mailbox has one slot. A pending asynchronous USB resampler could be overwritten by a subsequent mixer submission. Submission now refuses a busy mailbox, using the existing serial mixer fallback.
## Checks
- `tests/audio_test.c`: simulated 60% rendering plus 30% nested work engages the guard, keeps it engaged, and prevents the admission predictor from spending occupied CPU time. Existing spike, recovery and DRUM-X checks remain.
- `tests/realtime_regression_test.py`: executes the production submission function; verifies pending USB ownership, subsequent completion, fault handling and job-counter wrap.
- `tests/overload_stress_test.c`: four tracks across all 201 presets, sustained overload/recovery under ASan and UBSan (legacy signed shifts/overflow excluded).
- `tests/anim_test.c`: nested work contributes to animation FREEZE; existing timing and animation regressions retained.
- Serial/deferred/threaded/chaotic core scheduling renders match in all 11 multicore scenes.
- The existing golden suite has the same two mismatches on V45 and V46: `song/4track_mix` -> `5e7b49a9cd8ec3da`, `slicer/song_gate_stut` -> `382e15e98db1154e`. No expected hashes were rewritten. All 219 renders have no new audio, health, routing or crash regressions.
- The existing `micro_test` legacy save-byte assertion and `voice_fairness_test load` final steals assertion also fail identically on the unmodified V45 baseline. These unrelated expectations were not changed.
An experimental bit-exact CLOUD reciprocal passed 19,223,100 arithmetic comparisons but did not demonstrate a lower target cost, so it is excluded from this release. No generator recipe or voice cap was reduced to make a host benchmark pass.
No physical FM-1 was available. Host timings are relative benchmarks, not proof of an on-device CPU percentage or absence of all glitches. Recheck the reported heavy projects, with and without USB, on an FM-1 after installation.
+12 -8
View File
@@ -141,7 +141,7 @@ static void test_jumps(void)
prep(scr_id("home"));
song.playing = 1;
for (c = 0; c < ECO_N; c++) trk[c].peak = 7000; /* (loud: the fastest swim) */
load_avg_q8 = 80u << 8; ui_hold_poll();
load_avg_q8 = load_all_q8 = 80u << 8; ui_hold_poll();
h0 = ui_hold;
t = fm1_ms;
for (f = 0; f < 40u; f++) {
@@ -170,7 +170,7 @@ static void test_jumps(void)
(unsigned)mx, (unsigned)still);
ck(w, mx > 0u && mx <= 48u && still < 6u);
}
load_avg_q8 = 90u << 8; ui_hold_poll();
load_avg_q8 = load_all_q8 = 90u << 8; ui_hold_poll();
k = anim_at;
at(t += 50u); at(t += 50u);
ck("jumps: FREEZE (90 %) the last resort: the clock still", ui_hold == 3u && anim_at == k);
@@ -179,11 +179,11 @@ static void test_jumps(void)
for (f = 0; f < 10u; f++) at(t += 50u);
ck("still: frozen, ten frames send no pixel", sent == s0);
}
load_avg_q8 = 70u << 8; ui_hold_poll();
load_avg_q8 = load_all_q8 = 70u << 8; ui_hold_poll();
k = anim_at;
at(t += 100u);
ck("jumps: back to LITE, on from where it stood (100 ms on, no jump)", ui_hold == 2u && anim_at == k + 100u);
load_avg_q8 = 0; song.playing = 0; ui_hold_poll();
load_avg_q8 = load_all_q8 = 0; song.playing = 0; ui_hold_poll();
for (f = 0; f < 30u; f++) at(t + 200u + 15u * f);
ck("lod: back to the whole detail once the load is gone", ui_lod == 0u && ui_hold == 0u);
song.playing = pl0;
@@ -272,7 +272,7 @@ static void cost(const char *n, uint32_t step, int lite)
double us;
prep(scr_id(n));
#ifdef ANIM_TICK
if (lite) { song.playing = 1; load_avg_q8 = (lite == 1 ? 80u : 65u) << 8; ui_hold_poll(); }
if (lite) { song.playing = 1; load_avg_q8 = load_all_q8 = (lite == 1 ? 80u : 65u) << 8; ui_hold_poll(); }
#endif
(void)lite;
t = fm1_ms;
@@ -289,7 +289,7 @@ static void cost(const char *n, uint32_t step, int lite)
printf("cost %-14s %s %7.1f us/frame %8.0f us/s %7llu px/frame\n", n, lite == 1 ? "LITE 10/s" : lite ? "SLOW 20/s" : "FULL 66/s", us, us * 1000.0 / step,
(unsigned long long)(sent / N));
#ifdef ANIM_TICK
load_avg_q8 = 0; song.playing = 0; ui_hold_poll(); ui_lod = 0;
load_avg_q8 = load_all_q8 = 0; song.playing = 0; ui_hold_poll(); ui_lod = 0;
#endif
}
static void costs(void)
@@ -340,7 +340,7 @@ static void frames_out(const char *dir)
host_ticks += (t - fm1_ms) * 1000u;
fm1_ms = t;
pl0 = song.playing;
if (r) { song.playing = 1; load_avg_q8 = 80u << 8; ui_hold_poll(); }
if (r) { song.playing = 1; load_avg_q8 = load_all_q8 = 80u << 8; ui_hold_poll(); }
for (f = 0; f * STEP[r] < 1200u; f++) {
char p[512];
FILE *o;
@@ -359,7 +359,7 @@ static void frames_out(const char *dir)
}
fclose(o);
}
load_avg_q8 = 0; song.playing = pl0; ui_hold_poll();
load_avg_q8 = load_all_q8 = 0; song.playing = pl0; ui_hold_poll();
}
}
#endif
@@ -373,6 +373,10 @@ int main(int argc, char **argv)
test_jumps();
test_lod();
test_still();
song.playing = 1; load_avg_q8 = 60u << 8; load_all_q8 = 90u << 8;
ui_hold_poll();
ck("nested work counts toward UI FREEZE to protect audio", ui_hold == 3);
song.playing = 0; load_avg_q8 = load_all_q8 = 0; ui_hold_poll();
#endif
costs();
#ifdef ANIM_TICK
+8 -3
View File
@@ -160,10 +160,15 @@ static void dma(void)
fresh();
expected = HALF_FRAMES * 1000000u / FS; /* the half's deadline in us */
host_us = expected * 90u / 100u; host_nest = expected * 30u / 100u; /* the render 60 %, TIMER5 nested 30 % */
for (i = 0; i < 64u; i++) fm1_alnk0_irq();
check("TIMER5 nested in the render counts toward the deadline (the extra voices), not toward the guard",
!shed_req && !load_tight && felucca_dbg.last_us == host_us - host_nest &&
for (i = 0; i < 128u; i++) fm1_alnk0_irq();
check("sustained 90% deadline load engages the guard even when render alone is 60%",
!shed_req && load_tight && felucca_dbg.last_us == host_us - host_nest &&
load_all_q8 > (HEAD_OFF << 8) && load_avg_q8 < (GUARD_OFF << 8));
for (i = 0; i < GUARD_STEP * 8u; i++) fm1_alnk0_irq();
check("guard does not reopen while nested work still leaves only 10% headroom", load_tight);
load_block();
check("voice prediction retains nested work between audio blocks", load_pred_q8 >= load_all_q8);
check("a new voice cannot spend CPU time already occupied by nested interrupts", !load_admit(&trk[0]));
fresh(); host_nest = 0;
host_us = 5000;
fm1_alnk0_irq(); host_us = 100; fm1_alnk0_irq(); host_us = 5000; fm1_alnk0_irq();
+36
View File
@@ -0,0 +1,36 @@
/* SPDX-License-Identifier: GPL-3.0-only */
/* Exercise the real overload transitions with four tracks and every preset. */
#define main hostsim_main
#include "hostsim.c"
#undef main
int main(void)
{
uint32_t e, pr, p, b, cases = 0;
int32_t out[2 * CTL];
for (e = 0; e < NENGINES; e++) {
if (!eng_ok(e)) continue;
for (pr = 0; pr < ENGINES[e]->npresets; pr++) {
memset(trk, 0, sizeof trk);
memset(&song, 0, sizeof song);
memset(&chain, 0, sizeof chain);
host_tracks_init(); trk_live = 4;
for (p = 0; p < 4; p++) {
host_preset(&trk[p], e, pr);
trk[p].p[P_VOICE] = V_POLY;
trk_note_on(&trk[p], 48 + p * 3, 100);
}
for (b = 0; b < 384; b++) {
if (!(b & 1)) load_half(b < 192 ? 90 : 40, b < 192 ? 98 : 45, 1);
if (!(b & 31)) for (p = 0; p < 4; p++) {
trk_note_off(&trk[p], 48 + p * 3);
trk_note_on(&trk[p], 48 + p * 3, 100);
}
mix_block(out, CTL);
}
cases++;
}
}
printf("overload stress: %u four-track presets, overload/recovery PASS\n", cases);
return 0;
}
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-only
"""Exercise production mailbox submission under a pending USB job."""
from pathlib import Path
import subprocess
import tempfile
root = Path(__file__).resolve().parents[1]
def function(path, start, end):
source = (root / path).read_text()
return source[source.index(start):source.index(end, source.index(start))]
submit = function('firmware/hal/fm1_multicore.h', 'static inline int fm1_mc_run(',
'static inline int fm1_mc_done(')
code = r'''
#include <stdint.h>
#include <assert.h>
#include <stdio.h>
#define FM1_C1_SYNC() ((void)0)
#define FM1_C1_CHECK(fn,arg,job) ((uint32_t)(uintptr_t)(fn) ^ (arg) ^ (job) * 0x9E3779B1u)
static uint32_t fm1_mc_on, fm1_mc_lost;
static struct { uint32_t count; } fm1_core1_fault;
static struct { uint32_t job, done, arg, check; void (*fn)(uint32_t); } fm1_mc_box;
static void fm1_mc_hold(void) { fm1_mc_on = 0; }
static void resample(uint32_t a) { (void)a; }
static void mix(uint32_t a) { (void)a; }
@SUBMIT@
int main(void) {
fm1_mc_on = 1;
assert(fm1_mc_run(resample, 128));
uint32_t check = fm1_mc_box.check;
/* Core 1 has not read the USB job yet; a late audio IRQ wants the mixer. */
assert(!fm1_mc_run(mix, 64));
assert(fm1_mc_box.job == 1 && fm1_mc_box.arg == 128);
assert(fm1_mc_box.fn == resample && fm1_mc_box.check == check);
fm1_mc_box.done = 1;
assert(fm1_mc_run(mix, 64) && fm1_mc_box.job == 2);
fm1_mc_box.done = 2;
fm1_core1_fault.count = 1;
assert(!fm1_mc_run(mix, 64) && !fm1_mc_on && fm1_mc_lost == 3);
fm1_core1_fault.count = 0; fm1_mc_on = 1;
fm1_mc_box.job = fm1_mc_box.done = UINT32_MAX;
assert(fm1_mc_run(mix, 64) && fm1_mc_box.job == 0);
puts("realtime: mailbox ownership/fault/wrap PASS");
}
'''.replace('@SUBMIT@', submit)
with tempfile.TemporaryDirectory() as tmp:
source, binary = Path(tmp) / 'test.c', Path(tmp) / 'test'
source.write_text(code)
subprocess.run(['cc', '-O2', '-Wall', '-Wextra', '-fsanitize=undefined',
'-fno-sanitize-recover=all', str(source), '-o', str(binary)], check=True)
subprocess.run([str(binary)], check=True)
+3
View File
@@ -184,6 +184,7 @@ run() { echo "== $1"; shift; "$@" || fail=1; }
$CC -O2 -o "$OUT/core1_stop_test" tests/core1_stop_test.c
run "core 1 halt: delayed bus fault and restored protection" "$OUT/core1_stop_test"
run "realtime: pending core-1 job ownership" python3 tests/realtime_regression_test.py
$CC -o "$OUT/storage_test" tests/storage_test.c
run "flash storage (A/B, torn writes)" "$OUT/storage_test"
@@ -360,6 +361,8 @@ if [ -f build/gen/felucca_tables.h ]; then
"$OUT/ui_render_fm4" build/ui_fm4 build/ui_fm4_slot
$CC -w -Ibuild/gen -Ifirmware/src -o "$OUT/audio_test" tests/audio_test.c -lm
run "audio: overload protection, bounded fades and DMA diagnostics" "$OUT/audio_test"
$CC -O1 -g -w -fsanitize=address,undefined -fno-sanitize=shift,signed-integer-overflow -fno-sanitize-recover=all -Ibuild/gen -Ifirmware/src -o "$OUT/overload_stress_test" tests/overload_stress_test.c -lm
run "audio: every preset on four tracks through sustained overload and recovery" env ASAN_OPTIONS=detect_leaks=0 "$OUT/overload_stress_test"
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/click_test" tests/click_test.c -lm
run "metronome and count-in: beats sample for sample (internal and external clock), accent, level, MASTER, not in USB, count-in timing, notes onto step 1" "$OUT/click_test"
$CC -O1 -w -Ibuild/gen -Ifirmware/src -o "$OUT/fit_test" tests/fit_test.c -lm
+17 -17
View File
@@ -10591,27 +10591,27 @@ static int test_click_menu(void)
* 50 ms, the values snap, half the detail), LITE from 75 % (a frame each 100 ms; until codex/anim the animation
* froze here), FREEZE from 85 % (the last resort); each its own way back; never while stopped. The animation's
* clock follows the time while it moves, whatever the frames, and stands while frozen */
uint32_t q0 = load_avg_q8, f0, m0 = fm1_ms;
uint32_t q0 = load_avg_q8, a0 = load_all_q8, f0, m0 = fm1_ms;
uint8_t pl0 = song.playing;
song.playing = 1;
load_avg_q8 = 59u << 8; ui_hold_poll(); ok = ui_hold == 0u && !ANIM_OFF() && UI_PACE() == 15u;
load_avg_q8 = 60u << 8; ui_hold_poll(); ok &= ui_hold == 1u && !ANIM_OFF() && ANIM_SNAP() && UI_PACE() == 50u;
load_avg_q8 = load_all_q8 = 59u << 8; ui_hold_poll(); ok = ui_hold == 0u && !ANIM_OFF() && UI_PACE() == 15u;
load_avg_q8 = load_all_q8 = 60u << 8; ui_hold_poll(); ok &= ui_hold == 1u && !ANIM_OFF() && ANIM_SNAP() && UI_PACE() == 50u;
anim_sync(); f0 = anim_at; fm1_ms += 45u; anim_sync(); ok &= anim_at == f0 + 45u; /* (SLOW: it moves, by the time) */
load_avg_q8 = 74u << 8; ui_hold_poll(); ok &= ui_hold == 1u;
load_avg_q8 = 51u << 8; ui_hold_poll(); ok &= ui_hold == 1u; /* (not back yet) */
load_avg_q8 = 75u << 8; ui_hold_poll(); ok &= ui_hold == 2u && !ANIM_OFF() && UI_PACE() == 100u;
load_avg_q8 = load_all_q8 = 74u << 8; ui_hold_poll(); ok &= ui_hold == 1u;
load_avg_q8 = load_all_q8 = 51u << 8; ui_hold_poll(); ok &= ui_hold == 1u; /* (not back yet) */
load_avg_q8 = load_all_q8 = 75u << 8; ui_hold_poll(); ok &= ui_hold == 2u && !ANIM_OFF() && UI_PACE() == 100u;
f0 = anim_at; fm1_ms += 100u; anim_sync(); ok &= anim_at == f0 + 100u; /* (LITE: it moves) */
load_avg_q8 = 84u << 8; ui_hold_poll(); ok &= ui_hold == 2u;
load_avg_q8 = 85u << 8; ui_hold_poll(); ok &= ui_hold == 3u && ANIM_OFF() && UI_PACE() == 50u;
load_avg_q8 = load_all_q8 = 84u << 8; ui_hold_poll(); ok &= ui_hold == 2u;
load_avg_q8 = load_all_q8 = 85u << 8; ui_hold_poll(); ok &= ui_hold == 3u && ANIM_OFF() && UI_PACE() == 50u;
f0 = anim_at; fm1_ms += 300u; anim_sync(); ok &= anim_at == f0; /* (FREEZE: still) */
load_avg_q8 = 79u << 8; ui_hold_poll(); ok &= ui_hold == 3u; /* (not back yet) */
load_avg_q8 = 77u << 8; ui_hold_poll(); ok &= ui_hold == 2u && !ANIM_OFF();
load_avg_q8 = load_all_q8 = 79u << 8; ui_hold_poll(); ok &= ui_hold == 3u; /* (not back yet) */
load_avg_q8 = load_all_q8 = 77u << 8; ui_hold_poll(); ok &= ui_hold == 2u && !ANIM_OFF();
f0 = anim_at; fm1_ms += 30u; anim_sync(); ok &= anim_at == f0 + 30u; /* (on from where it stood: no jump) */
load_avg_q8 = 66u << 8; ui_hold_poll(); ok &= ui_hold == 2u; /* (not back yet) */
load_avg_q8 = 64u << 8; ui_hold_poll(); ok &= ui_hold == 1u && !ANIM_OFF();
load_avg_q8 = 49u << 8; ui_hold_poll(); ok &= ui_hold == 0u && !ANIM_SNAP();
load_avg_q8 = 90u << 8; song.playing = 0; ui_hold_poll(); ok &= ui_hold == 0u; /* (stopped: never) */
song.playing = pl0; load_avg_q8 = q0; ui_hold_poll();
load_avg_q8 = load_all_q8 = 66u << 8; ui_hold_poll(); ok &= ui_hold == 2u; /* (not back yet) */
load_avg_q8 = load_all_q8 = 64u << 8; ui_hold_poll(); ok &= ui_hold == 1u && !ANIM_OFF();
load_avg_q8 = load_all_q8 = 49u << 8; ui_hold_poll(); ok &= ui_hold == 0u && !ANIM_SNAP();
load_avg_q8 = load_all_q8 = 90u << 8; song.playing = 0; ui_hold_poll(); ok &= ui_hold == 0u; /* (stopped: never) */
song.playing = pl0; load_avg_q8 = q0; load_all_q8 = a0; ui_hold_poll();
fm1_ms = m0 + 1000u; anim_sync(); ui_lod = 0;
bad += check("UI under load: SLOW from 60 %, LITE from 75 % (it moves on, by the clock), FREEZE from 85 %, each back lower, never stopped", ok);
}
@@ -12401,9 +12401,9 @@ static int test_home_tracks(void)
for (k = 0; k < 200u; k++) { cv_begin(240, graph_h(), T_BG); graph_tracks(); }
clock_gettime(CLOCK_MONOTONIC, &t1);
for (k = 0; k < 125u; k++) { sg = ui.graph_sig; vxt_run(16, 1); nd += ui.graph_sig != sg; }
load_avg_q8 = 90u << 8; /* (a high load) */
load_avg_q8 = load_all_q8 = 90u << 8; /* (a high load) */
for (k = 0; k < 125u; k++) { sg = ui.graph_sig; vxt_run(16, 1); nh += ui.graph_sig != sg; }
load_avg_q8 = 0;
load_avg_q8 = load_all_q8 = 0;
printf(" TRACKS: a draw %.1f us (host), %u draws in 2 s playing, %u under a high load\n",
((t1.tv_sec - t0.tv_sec) * 1e9 + (t1.tv_nsec - t0.tv_nsec)) / 200e3, (unsigned)nd, (unsigned)nh);
ok &= nd > 8u && nd <= 50u && nh < nd; /* (V10.7.42: 67, every other frame) */
+2001 -2001
View File
File diff suppressed because it is too large. Load diff