AIKernel

AIKernel v0.1.3 GPU canonical Migration Notes

AIKernel v0.1.3 promotes the GPU work proven in AIKernel.Doom into canonical contracts. The goal is not to make every package GPU-dependent; the goal is to give WebGPU, Dawn, CUDA, and CPU fallback providers the same vocabulary.

What Changed

  • AIKernel.Enums now defines GpuBackend, GpuProviderCapabilities,
  • GpuFrameTargetKind, GpuReadbackPolicy, and GpuEgoRadarMode.

  • AIKernel.Dtos.Gpu now defines canonical DTOs for frame tokens, raw/HUD
  • frame targets, frame diagnostics, GPU HUD input, GPU Aisthesis input/output, and GPU spatial reasoning input/output.

  • AIKernel.Abstractions.Gpu now defines provider, context, Aisthesis,
  • Spatial Reasoner, HUD Composer, buffer, and texture interfaces.

  • AIKernel.Dtos.Gpu.GpuCanonicalValidation now provides shared validation
  • for layouts, capabilities, raw-frame capture, HUD buffers, spatial matrices, frame diagnostics, and individual canonical diagnostics metadata dictionaries.

  • GPU HUD state is split into geometry/style (HudPanelRect) and semantic
  • state (HudPanelStateVector).

  • Spatial reasoning accepts exactly four 9x9 matrices in AisMatrix order:
  • Topos, Route, Threat, Zoe. CTG and other task state belongs in StateVector.

  • Sensor analysis must use GpuFrameTargetKind.RawFramebuffer. HUD composite
  • and display fallback targets are presentation surfaces, not Aisthesis inputs.

Provider Guidance

Providers should expose GpuProviderCapabilities in metadata even when they also implement older compute contracts. Browser WebGPU providers typically set:

  • SupportsCompute
  • SupportsHudComposite
  • SupportsAisthesis
  • SupportsSpatialReasoning
  • SupportsZeroCopyRawTexture
  • SupportsCpuFallback
  • SupportsFrameDiagnostics

Native CUDA capability modules typically set:

  • SupportsCompute
  • SupportsNativeValidation
  • SupportsFrameDiagnostics

Browser WebGPU providers should implement the canonical pass interfaces even when the first implementation still uses deterministic fallback projections:

  • IGpuProvider
  • IGpuAisthesisProcessor
  • IGpuSpatialReasoner
  • IGpuHudComposer

The provider should report GpuFrameDiagnostics for all four public paths:

  • GamePath
  • BonsaiPath
  • HudPath
  • SensorPath

If zero-copy is unavailable, the path must include a fallback reason. A path must not report both ZeroCopy=true and Readback=RequiredFallback.

Bridge metadata is a required contract, not display-only data. Providers and browser/native bridge adapters should validate each outgoing canonical diagnostics metadata dictionary with GpuCanonicalValidation.ValidateDiagnosticsMetadata(...) before queue submission or JS/native handoff. Malformed boolean, integer, execution-mode, pilot-state, promotion-gate, or pass-readiness values should fail closed at the bridge boundary instead of being repaired downstream.

Runtime Guidance

GPU shader code should be a pure view over already-resolved runtime state. Compass/radar smoothing, hold, decay, and semantic suppression should be computed by the runtime layer before values are uploaded to GPU buffers.

Browser Bridge Assets

Use the files shipped by AIKernel.Wasm.WebGpuComputeProvider together:

  • runtime/browser/webgpu-envelope-bridge.js
  • shaders/aisthesis/aisthesis.wgsl, shaders/spatial/spatial-reasoning.wgsl,
  • and shaders/hud/hud-composite.wgsl

  • buffers/layouts/gpu-layouts.json

Replace old rev3 asset paths in host copy rules and browser imports. Do not mix bridge, shader, or layout files from different builds. The dispatch schema is aikernel.gpu.dispatch with envelope version 0.1.3; the envelope version does not include the NuGet development suffix. Validate both the browser dispatch path and deterministic CPU fallback.

Developer Checklist

  1. Align package references to the same 0.1.3 family; keep stable and
  2. development dependencies separate.

  3. Replace Doom-local future GPU DTOs with AIKernel.Dtos.Gpu DTOs as the
  4. consumer packages move to v0.1.3.

  5. Route raw sensor capture through RawFramebuffer.
  6. Keep HUD/composite targets separate from Aisthesis capture.
  7. Verify layouts with aik gpu verify.
  8. Treat GPU lost as one-way CPU fallback unless a higher-level host explicitly
  9. owns a full restart boundary.

  10. Validate provider capabilities with GpuCanonicalValidation before binding
  11. a shader pass.

  12. Validate GpuAisthesisInput before any image analysis pass; HUD-composited
  13. targets must fail closed.

  14. Validate GpuSpatialReasoningInput before matrix dispatch; exactly four
  15. 9x9 matrices must be supplied in Topos, Route, Threat, Zoe order.

  16. Validate each canonical diagnostics metadata dictionary before browser JS,
  17. Dawn, or CUDA bridge handoff.

  18. Preserve GpuFrameDiagnostics in HUD/log surfaces so browser demos can show
  19. GPU vs CPU fallback and zero-copy status without ad hoc flags.

Doom Migration Notes

AIKernel.Doom can migrate incrementally:

  1. Keep the current browser DTO adapters as compatibility shims.
  2. Map raw capture descriptors to GpuFrameTarget.
  3. Map ego-radar/HUD state to GpuHudInput.
  4. Replace Doom-local Aisthesis feature DTOs with GpuAisthesisInput and
  5. GpuAisthesisOutput.

  6. Replace Doom-local topology matrices with GpuSpatialReasoningInput.
  7. Compare Doom HUD status rows against GpuFrameDiagnostics before removing
  8. existing debug flags.

This keeps the public demo stable while moving the reusable GPU vocabulary into AIKernel.Wasm and AIKernel.NET.

Source: migration/v0.1.3-gpu-canonical-migration.md