Skip to content

Add generic attention key-measure execution support - #16239

Draft
xmarre wants to merge 1 commit into
Comfy-Org:masterfrom
xmarre:mirror/mixed-grid-measure-core-20260910
Draft

Add generic attention key-measure execution support#16239
xmarre wants to merge 1 commit into
Comfy-Org:masterfrom
xmarre:mirror/mixed-grid-measure-core-20260910

Conversation

@xmarre

@xmarre xmarre commented Sep 10, 2026

Copy link
Copy Markdown

Implements the generic core contract and execution support required for heterogeneous MiniMax-H3 mixed-grid attention.

What this adds

  • canonical attention_measure_v1 normalization/validation with positive rational per-key measure and semantic digesting;
  • H3 mixed-layout validation and optional VDN external-sequence API-2 geometry cross-checking;
  • provider capability binding with concrete provider/owner/generation/preprocess identity;
  • an O(T) contiguous FP32 natural-log key-measure buffer; no O(T²) measure tensor is materialized;
  • exact physical K-block coverage for every non-unit-measure key interval, merged with any existing exact sink;
  • exact dense weighted SDPA and a bounded streaming dense oracle;
  • weighted BlockSparseAttention execution for direct and H3 chunked routes;
  • measure-aware sparse calibration identity while preserving the existing unweighted pool key unchanged;
  • cache-hit hardening: cached plans reuse only immutable measure materialization, while the live H3 layout, optional API-2 external geometry, and concrete provider capability owner are revalidated on every use;
  • optional VDN epilogue delegation only when the concrete attention forward is VDN-owned. API-2 mixed-grid geometry alone does not imply that VDN is installed; the native projection path remains valid without VDN.

The weighted route preserves all Q/K/V rows. Spatial carrier density is represented by adding log(measure_k) to attention logits. It does not implement representative-K/V deletion or downsampling.

Compatibility invariants

  • Existing unweighted sparse-attention calibration identity remains (block_index, rows, uuids).
  • Query-prefix exactness and key-block exactness remain independent.
  • Calibration values (kmean / vscale) are not modified by the key measure; only weighted cache identity is measure-specific.
  • A cached measure tensor is not accepted as proof of current runtime geometry or capability ownership.
  • A VDN external epilogue is required only when the actual attention forward is the VDN forward; stale or foreign ownership fails closed.
  • Existing serialized workflows without an attention_measure_v1 request retain their prior numerical semantics.

Validation

The current clean head 8406da920f9df19cbc14b76aef1bcd3dc4cf1119 is one implementation commit on current upstream master 1d48d9cf7bcecb6022a87b3cb13e0fb435bf9b8a.

Focused cache-hardening run 34560181433 completed 11 passed across the attention-measure contract suite and the new cache regression. The regression first proves a legitimate cache hit, then separately rejects a changed H3 layout, changed API-2 external geometry, and replacement of the registered capability owner.

The exact clean head also passes fork Python-lint run 34560729867: both Ruff and Pylint completed successfully.

Current companion structural validation was rerun from Spectrum run 34561055104, pinned to:

  • Core 8406da920f9df19cbc14b76aef1bcd3dc4cf1119;
  • Flow a6bf395133c8ce496217ca9194f3ab3f2b9181ef;
  • VDN d5f158a1c1750d79b37cb6ef22b0f14e6a8cbad6.

The weighted Core-BSA / Flow / VDN / Spectrum targeted suites completed 43 passed, 1 skipped. The single skip is the separate Untwist-composition fixture, which was intentionally not installed in that targeted run; it is not part of the weighted Core/Flow/VDN contract being revalidated.

These are structural/CPU compatibility evidence only. They do not establish GPU numerical or decoded-media correctness.

Still required before production release:

  • compiled CUDA numerical validation of the weighted chunked sparse path;
  • real SM120 Sol-Attn validation through the provider companion;
  • end-to-end schedule/receipt validation proving no additional H3 NFE and preserving the applicable 18 logical / 14 actual / 4 forecast schedule;
  • decoded-media and performance validation.

Authoritative architecture: https://github.com/xmarre/MiniMax-H3-Flow-Aligned-Regenerate/blob/3afc6c63063f410afec756c42811a8cf1ad2ed77/docs/MIXED_GRID_MEASURE_ARCHITECTURE.md

Companion design PR: xmarre/MiniMax-H3-Flow-Aligned-Regenerate#29

@xmarre
xmarre force-pushed the mirror/mixed-grid-measure-core-20260910 branch from e395bb9 to 8406da9 Compare September 11, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant