Skip to content

expect_tx byte accounting is hand-summed and can silently disagree with the loads issued #29

Closed

Description

@feitreim

Every TMA producer writes its own transaction-byte total:

sem.expect_tx((ATile::BYTES + BTile::BYTES) as u32);

and must keep that expression in step, by hand, with the set of tma_load calls
it actually issues. A tile already knows its own size — nothing here needs a
human in the loop.

The failure mode is the bad kind. Under-charging means the barrier flips
before the data has landed, so consumers read a partially-written tile: no
diagnostic, no fault, just wrong numbers that depend on transfer timing.
Over-charging hangs the kernel. Neither is caught by any test we could write at
this level, and both are one edit away at all times — add a load, forget the
sum.

Shape

Either direction works:

  • Semaphore::expect_tiles(&[...]), or a builder that sums BYTES from the
    tile types themselves; or
  • have tma_load return its byte charge, so the total is derived from the
    calls that were made rather than asserted alongside them.

The second is stronger — it makes the two impossible to disagree rather than
merely convenient to keep in sync — but it changes the shape of every producer
call site, so it wants a look at how the pipeline stages read before committing.

Note the interaction with #24: expect_tx lowers to
mbarrier.arrive.expect_tx … .shared::cta and cannot charge a remote barrier,
while upstream's mbarrier_arrive_cluster takes a remote address but carries no
transaction bytes. Whatever lands here should not make the cluster-scope
accounting harder to add later.

Surfaced by the examples (#18), §9.

Activity

  1. added
    area:memory
    on Jul 27, 2026
  2. feitreim commented on Jul 27, 2026

    @feitreim
    OwnerAuthor

    Acceptance: update examples/ as part of closing this.

    Every producer in gemm hand-sums its transaction bytes.

    The examples crate (#18) exists so that "done" is checkable in the terms a kernel author cares about, rather than as a claim about a primitive nobody has tried to hold. Concretely, on closing this:

    • Delete any workaround or GAP fence in examples/src/ that this issue removes the need for, and replace it with the real API.
    • If a kernel becomes fully unblocked, move it from aspirational to compiles: flip its header, take it out of its feature gate, and confirm modal run modal_app.py::build builds it for sm_100a.
    • Update the status table and the blocked-on lists in examples/README.md.

    If the example still does not compile afterwards, that is a finding worth writing down — say what is still missing rather than leaving the README stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:memory

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions