Upload only newest spectrum ring slot

This commit is contained in:
Meta Vens 2026-05-27 12:22:30 +01:00
commit 73140607a9
6 changed files with 24 additions and 18 deletions

View file

@ -156,11 +156,13 @@ a named invariant that the native runtime cannot protect yet.
truncated and reported in the runtime UI. Lowerings use that fixed capacity
as `ColumnStride`. Physical history slots are addressed as a ring with
`RollingOffset`, so logical age no longer requires reshuffling every column
before shader sampling. Mimir emits one Float32 resource upload per sampled
history slot with an explicit element offset, rather than uploading the full
fixed-capacity backing buffer every frame. `MIMIR_SPECTRUM_TUBE_SUBDIVISIONS`
controls the requested Catmull-Rom subdivision count so Fensalir's overflow
report has a direct cost lever.
before shader sampling. Mimir emits one Float32 resource upload for the
newest spectrum ring slot with an explicit element offset, rather than
uploading the full fixed-capacity backing buffer every frame. Fensalir owns
rolling-slot validity and clamps TubeField dispatch so invalid older slots are
not sampled after renderer allocation, reset, or partial update.
`MIMIR_SPECTRUM_TUBE_SUBDIVISIONS` controls the requested Catmull-Rom
subdivision count so Fensalir's overflow report has a direct cost lever.
- `MimirFensalirFieldLowering` now emits `AquariumFieldResourceDeclaration`
rows for live native/GPU payload views. Observation claims reference
`mimir:resource:*` keys, and Fensalir validation/planning can reject or defer

View file

@ -393,11 +393,13 @@ resize the GPU buffer while the rolling trail fills. `MIMIR_SPECTRUM_SOURCE_LANE
sets the fixed lane budget; surplus sources are truncated and reported in the
runtime UI. Physical history slots are now addressed as a ring with
`RollingOffset`, so logical age no longer requires moving every column before
shader sampling. Mimir emits one Float32 resource upload per sampled history
slot with an explicit element offset instead of uploading the full
fixed-capacity backing buffer every frame. `MIMIR_SPECTRUM_TUBE_SUBDIVISIONS`
is the runtime cost lever for lowering Catmull-Rom subdivision count when
Fensalir reports TubeField truncation.
shader sampling. Mimir emits one Float32 resource upload for the newest
spectrum ring slot with an explicit element offset instead of uploading the
full fixed-capacity backing buffer every frame. Fensalir owns rolling-slot
validity and clamps TubeField dispatch so invalid older slots are not sampled
after renderer allocation, reset, or partial update.
`MIMIR_SPECTRUM_TUBE_SUBDIVISIONS` is the runtime cost lever for lowering
Catmull-Rom subdivision count when Fensalir reports TubeField truncation.
## Known Risks

View file

@ -693,13 +693,13 @@ static int RunMimirSpectrumUploadSmoke()
!validation.HasErrors &&
!frame.Scene.SplineFrame.HasInput &&
!frame.Scene.BufferFieldFrame.HasInput &&
matchingUploads.Length == expectedHistoryCount &&
matchingUploads.Length == 1 &&
matchingResources.Length == 1 &&
matchingRamps.Length == 1 &&
matchingLowerings.Length == 4 &&
matchingClaims.Length == matchingLowerings.Length &&
matchingUploads.All(upload => upload.Version == resource.Version) &&
matchingUploads.Sum(upload => upload.Float32Data.Count) == lowering.Width * expectedSourceLaneCapacity * expectedHistoryCount &&
matchingUploads.Sum(upload => upload.Float32Data.Count) == lowering.Width * expectedSourceLaneCapacity &&
matchingUploads.All(upload =>
upload.Float32Data.Count == lowering.Width * expectedSourceLaneCapacity &&
upload.ElementOffset >= 0 &&
@ -707,9 +707,7 @@ static int RunMimirSpectrumUploadSmoke()
matchingUploads.Select(upload => upload.ElementOffset).Order().SequenceEqual(
new[]
{
0,
lowering.Width * expectedSourceLaneCapacity * (expectedHistoryCapacity - 2),
lowering.Width * expectedSourceLaneCapacity * (expectedHistoryCapacity - 1),
}.Order()) &&
resource.Kind == AquariumFieldResourceKind.StructuredBuffer &&
resource.Residency == AquariumFieldResourceResidency.GpuResident &&

View file

@ -280,8 +280,8 @@ public sealed class MimirRuntime : IAquariumRuntime
var resourceColumnCapacity = checked(spectrumSourceLaneCapacity * SpectrumHistoryWindowCount);
var newestHistorySlot = PositiveModulo(-historyFrames[0].Sequence, SpectrumHistoryWindowCount);
var rollingOffset = checked(newestHistorySlot * spectrumSourceLaneCapacity);
var resourceUploads = new List<AquariumFieldResourceUpload>(historyFrames.Length);
for (var historyIndex = 0; historyIndex < historyFrames.Length; historyIndex++)
var resourceUploads = new List<AquariumFieldResourceUpload>(1);
for (var historyIndex = 0; historyIndex < Math.Min(1, historyFrames.Length); historyIndex++)
{
var historySlot = PositiveModulo(-historyFrames[historyIndex].Sequence, SpectrumHistoryWindowCount);
var uploadColumnOffset = checked(historySlot * spectrumSourceLaneCapacity);

View file

@ -168,3 +168,4 @@
{"ts": "2026-05-27T11:47:48+01:00", "type": "implementation", "status": "ok", "note": "Mimir spectrum upload now has fixed source-lane capacity as well as fixed history capacity. MIMIR_SPECTRUM_SOURCE_LANES sets the lane budget, TubeSpline lowerings use that budget as ColumnStride, surplus sources are truncated and reported in the runtime UI, and --mimir-spectrum-upload-smoke verifies 48 bands x 8 lanes x 40 history capacity = 15360 uploaded floats while emitting only four active TubeField claims/lowerings."}
{"ts": "2026-05-27T11:54:44+01:00", "type": "implementation", "status": "ok", "note": "Mimir spectrum history now uses true ring addressing. Physical history slots are keyed by sequence modulo the fixed history capacity, TubeSpline lowerings carry RollingOffset for newest logical age, and --mimir-spectrum-upload-smoke verifies the expected offset with the fixed 8-lane resource. This makes partial column uploads possible without changing shader sampling semantics."}
{"ts": "2026-05-27T12:00:41+01:00", "type": "implementation", "status": "ok", "note": "Mimir now emits partial spectrum resource uploads for the active ring slots it samples. The declared GPU buffer remains fixed at 48 bands x 8 lanes x 40 history slots, but the smoke now verifies three offset uploads totaling 1152 floats for the three active ages instead of a full 15360-float backing-store upload. Headless Fensalir rendered the offset-copy path with empty stderr."}
{"ts": "2026-05-27T12:21:38+01:00", "type": "implementation", "status": "ok", "note": "Mimir now sends only the newest spectrum ring slot as an offset Float32 resource upload. Fensalir owns rolling structured-buffer slot validity and clamps TubeField dispatch to valid contiguous logical columns, so invalid older slots cannot reach shader sampling after renderer allocation or partial update. Smoke reports uploadFloats=384 and headless render succeeded with empty stderr."}

View file

@ -373,8 +373,11 @@ accepted_design:
`z = age * 0.1`. Physical history slots are addressed as a ring with
`RollingOffset`, so logical age no longer requires moving every column in
the upload matrix before shader sampling. Mimir emits one Float32 resource
upload per sampled history slot with an explicit element offset instead of
uploading the full fixed-capacity backing buffer every frame.
upload for the newest spectrum ring slot with an explicit element offset
instead of uploading the full fixed-capacity backing buffer every frame.
Fensalir owns rolling-slot validity and clamps TubeField dispatch so invalid
older slots are not sampled after renderer allocation, reset, or partial
update.
`MIMIR_SPECTRUM_TUBE_SUBDIVISIONS` controls the Mimir-requested Catmull-Rom
subdivisions so Fensalir's TubeField truncation report has a direct cost
lever.