Verify runtime spectrum resource upload
This commit is contained in:
parent
940601ef3e
commit
8636519bc1
6 changed files with 96 additions and 3 deletions
|
|
@ -230,7 +230,10 @@ matching TubeSpline metadata for audio spectrum/waveform Tube claims. That is
|
|||
engine ownership, not a reason for Mimir to create a parallel renderer.
|
||||
Mimir also uploads normalized spectral frames as Float32 data into a
|
||||
Fensalir-owned structured buffer resource, so the TubeField path consumes live
|
||||
GPU buffer contents rather than an empty declaration.
|
||||
GPU buffer contents rather than an empty declaration. The runtime-level receipt
|
||||
is `Mimir.BufferSmoke --mimir-spectrum-upload-smoke`: it boots Mimir's frame
|
||||
path, advances spectrum analysis, and verifies one Float32 upload, one planned
|
||||
TubeField packet, and no live legacy spline/buffer-field dashboard input.
|
||||
|
||||
### 3. Calibration Constraint
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,11 @@ a named invariant that the native runtime cannot protect yet.
|
|||
into a row-major Float32 matrix, attaches that as a field resource upload, and
|
||||
Fensalir copies it into the resolved GPU structured buffer before TubeField
|
||||
compute reads. The old `AquariumBufferFieldFrame` / `ReservoirSplats`
|
||||
dashboard path is also silent.
|
||||
dashboard path is also silent. `Mimir.BufferSmoke
|
||||
--mimir-spectrum-upload-smoke` boots `MimirRuntime`, advances the synthetic
|
||||
spectrum preview path, and verifies that the frame contains the Float32
|
||||
resource upload plus planned TubeField packet while legacy spline and buffer
|
||||
field inputs stay empty.
|
||||
- `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
|
||||
|
|
|
|||
|
|
@ -380,7 +380,9 @@ Mimir declares the rolling resource, publishes a Tube claim plus
|
|||
expansion, and TubeField material rendering. The spectrum resource is not just
|
||||
a handle: Mimir uploads the current spectral amplitudes as row-major Float32
|
||||
data into a Fensalir-owned GPU structured buffer before TubeField compute reads
|
||||
it.
|
||||
it. `Mimir.BufferSmoke --mimir-spectrum-upload-smoke` verifies this through the
|
||||
actual `MimirRuntime` frame path and confirms the legacy direct spline and
|
||||
buffer-field dashboard inputs are empty.
|
||||
|
||||
## Known Risks
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,13 @@ using System.Diagnostics;
|
|||
using System.Numerics;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json;
|
||||
using Aquarium.Engine;
|
||||
using Aquarium.Engine.Input;
|
||||
using Aquarium.Engine.Render;
|
||||
using GameCult.Caching;
|
||||
using GameCult.Caching.MessagePack;
|
||||
using MessagePack;
|
||||
using Mimir.Runtime;
|
||||
using Mimir.Runtime.Synchronization;
|
||||
|
||||
if (args.Any(arg => string.Equals(arg, "--chirplet-self-test", StringComparison.OrdinalIgnoreCase)))
|
||||
|
|
@ -100,6 +103,11 @@ if (args.Any(arg => string.Equals(arg, "--fensalir-field-dsl-resource-smoke", St
|
|||
return RunFensalirFieldDslResourceSmoke();
|
||||
}
|
||||
|
||||
if (args.Any(arg => string.Equals(arg, "--mimir-spectrum-upload-smoke", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return RunMimirSpectrumUploadSmoke();
|
||||
}
|
||||
|
||||
if (args.Any(arg => string.Equals(arg, "--perfect-machine-contract-smoke", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return await RunPerfectMachineContractSmokeAsync(
|
||||
|
|
@ -619,6 +627,78 @@ tubespline id=spectrum-trail resource=spectrum domain=mimir:domain:spectrum conf
|
|||
: 1;
|
||||
}
|
||||
|
||||
static int RunMimirSpectrumUploadSmoke()
|
||||
{
|
||||
var previousSyntheticPreview = Environment.GetEnvironmentVariable("MIMIR_SYNTHETIC_SPECTRUM_PREVIEW");
|
||||
Environment.SetEnvironmentVariable("MIMIR_SYNTHETIC_SPECTRUM_PREVIEW", "1");
|
||||
try
|
||||
{
|
||||
var settings = new MimirSynchronizationSettings
|
||||
{
|
||||
BufferDuration = TimeSpan.FromSeconds(5),
|
||||
Audio = new MimirAudioSynchronizationSettings
|
||||
{
|
||||
Mode = MimirAudioSyncMode.Passive,
|
||||
ReferenceSourceId = "loopback-scarlett-speakers",
|
||||
},
|
||||
};
|
||||
using var runtime = new MimirRuntime(new AquariumRuntimeOptions(Headless: true, CultCachePath: null), settings);
|
||||
runtime.OnSceneReady();
|
||||
runtime.Update(0.0f, new InputState());
|
||||
|
||||
var frame = runtime.Frame;
|
||||
var field = frame.Scene.FieldEvidenceFrame;
|
||||
var upload = field.ResourceUploads.SingleOrDefault(upload =>
|
||||
string.Equals(upload.ResourceKey, "mimir:resource:spectrum:field-upload", StringComparison.Ordinal));
|
||||
var matchingResources = field.Resources
|
||||
.Where(resource => string.Equals(resource.ResourceKey, "mimir:resource:spectrum:field-upload", StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
var matchingLowerings = field.TubeSplineLowerings
|
||||
.Where(lowering => string.Equals(lowering.ResourceKey, "mimir:resource:spectrum:field-upload", StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
var matchingClaims = field.Claims
|
||||
.Where(claim => string.Equals(claim.ClaimKey, "intent:mimir:spectrum:field-upload", StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
var resource = matchingResources.FirstOrDefault();
|
||||
var lowering = matchingLowerings.FirstOrDefault();
|
||||
var claim = matchingClaims.FirstOrDefault();
|
||||
var validation = AquariumFieldEvidenceValidator.Validate(field);
|
||||
var plan = AquariumFieldLoweringPlanner.Plan(field);
|
||||
|
||||
Console.WriteLine(
|
||||
$"mimir-spectrum-upload-smoke resources={field.Resources.Count} uploads={field.ResourceUploads.Count} claims={field.Claims.Count} tubeLowerings={field.TubeSplineLowerings.Count} planned={plan.Packets.Count} errors={validation.HasErrors} legacySplines={frame.Scene.SplineFrame.Splines.Count} bufferFields={frame.Scene.BufferFieldFrame.SplineTubeFields.Count + frame.Scene.BufferFieldFrame.TextureSplineFields.Count} uploadFloats={upload?.Float32Data.Count ?? 0}");
|
||||
|
||||
return
|
||||
!validation.HasErrors &&
|
||||
!frame.Scene.SplineFrame.HasInput &&
|
||||
!frame.Scene.BufferFieldFrame.HasInput &&
|
||||
upload is not null &&
|
||||
matchingResources.Length == 1 &&
|
||||
matchingLowerings.Length == 1 &&
|
||||
matchingClaims.Length == 1 &&
|
||||
upload.Version == resource.Version &&
|
||||
upload.Float32Data.Count == resource.DepthOrCount &&
|
||||
resource.Kind == AquariumFieldResourceKind.StructuredBuffer &&
|
||||
resource.Residency == AquariumFieldResourceResidency.GpuResident &&
|
||||
resource.Access == AquariumFieldShaderAccess.ShaderResource &&
|
||||
string.Equals(resource.Format, "Float32", StringComparison.OrdinalIgnoreCase) &&
|
||||
resource.StrideBytes == sizeof(float) &&
|
||||
lowering.Width * lowering.Height == upload.Float32Data.Count &&
|
||||
lowering.ClaimKey == claim.ClaimKey &&
|
||||
claim.PayloadHandle == resource.ResourceKey &&
|
||||
plan.Packets.Any(packet =>
|
||||
packet.Backend == AquariumFieldBackendKind.TubeField &&
|
||||
string.Equals(packet.ClaimKey, claim.ClaimKey, StringComparison.Ordinal) &&
|
||||
string.Equals(packet.PayloadHandle, resource.ResourceKey, StringComparison.Ordinal))
|
||||
? 0
|
||||
: 1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Environment.SetEnvironmentVariable("MIMIR_SYNTHETIC_SPECTRUM_PREVIEW", previousSyntheticPreview);
|
||||
}
|
||||
}
|
||||
|
||||
static int RunChirpBinSelfTest()
|
||||
{
|
||||
var timeline = MimirChirpBinTimeline.Default;
|
||||
|
|
|
|||
|
|
@ -158,3 +158,4 @@
|
|||
{"ts": "2026-05-26T23:03:00+01:00", "type": "implementation", "status": "ok", "note": "Mimir's typed Fensalir surface-intent lowering now emits AquariumFieldTubeSplineLowering metadata for audio spectrum/waveform Tube claims. The hardware-free field evidence smoke now proves one resource, three claims, one TubeSpline lowering, one planned TubeField packet, and two deferred non-backend claims; the DSL smoke still proves resource-bound TubeSpline lowering with ramp binding."}
|
||||
{"ts": "2026-05-26T23:18:00+01:00", "type": "correction", "status": "ok", "note": "Silenced the legacy direct spectrum spline path. MimirRuntime now submits AquariumSplineFrame.Empty and the old BuildSpectrumSplineFrame/direct spline styling helpers were deleted, so live spectrum visualization authority is FieldEvidence TubeField only. Mimir build and both Fensalir field smokes passed."}
|
||||
{"ts": "2026-05-26T23:36:00+01:00", "type": "implementation", "status": "ok", "note": "Mimir now feeds spectral frames into the GPU buffer path. Current audio spectra are normalized into a row-major Float32 matrix, declared as mimir:resource:spectrum:field-upload, attached as a field ResourceUpload, and consumed by the TubeField claim/lowering. Fensalir now uploads ResourceUpload Float32 data into resolved structured buffers before TubeField compute runs. Mimir build, Fensalir build/tests/headless reload, and both field smokes passed."}
|
||||
{"ts": "2026-05-26T23:44:26+01:00", "type": "verification", "status": "ok", "note": "Added Mimir.BufferSmoke --mimir-spectrum-upload-smoke to exercise the actual MimirRuntime frame path. The smoke verifies one Float32 spectrum ResourceUpload, one declared GPU structured buffer, one Tube claim/lowering, one planned TubeField packet, and no legacy AquariumSplineFrame or AquariumBufferFieldFrame dashboard input."}
|
||||
|
|
|
|||
|
|
@ -356,6 +356,9 @@ accepted_design:
|
|||
into a row-major Float32 matrix, declared as
|
||||
`mimir:resource:spectrum:field-upload`, uploaded into a Fensalir-owned
|
||||
GPU-resident structured buffer, and consumed by the TubeField lowering.
|
||||
`Mimir.BufferSmoke --mimir-spectrum-upload-smoke` verifies the live
|
||||
`MimirRuntime` frame path emits that Float32 upload and planned TubeField
|
||||
packet while direct spline and buffer-field dashboard inputs remain empty.
|
||||
- `config/perfect-machine.example.json` declares live owners, sensors,
|
||||
reservoir views, and runtime policy.
|
||||
- `src/Mimir.Runtime/Synchronization` now includes the Perfect Machine module
|
||||
|
|
|
|||
Loading…
Reference in a new issue