Skip to content

[Loom] Separate external resource effects from memory reports - #1316

Merged
benvanik merged 1 commit into
mainfrom
users/benvanik/loom-external-resource-reporting
Oct 6, 2026
Merged

benvanik merged 1 commit into
mainfrom
users/benvanik/loom-external-resource-reporting

Conversation

@benvanik

@benvanik benvanik commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Compile reports now count a read or write as memory traffic only when the effect carries a memory-space attachment. Attachment-free effects continue to model external resources for scheduling and result lifetime, but no longer appear as generic memory operations or unknown-width transfers.

AMDGPU counter-returning instructions expose the distinction directly. For example, s_sendmsg_rtn_b32 reads its completion counter without aliasing memory:

Effect(EffectKind.READ, counter_id=_COUNTER_SMEM)

Its generated effect has memory_space=NONE. Previously, descriptor classification and traffic aggregation looked only at READ or WRITE, so a clock query became both a generic memory instruction and an unknown-width memory read.

One attachment contract

The authored and runtime descriptor models now expose the same is_memory_access predicate: an effect is a memory access when it is a read or write with a non-NONE memory space. Memory-specific consumers use that fact for:

  • generic memory, load, store, and atomic instruction classes;
  • source-memory recording during lowering;
  • descriptor footprint summaries and compile-report traffic;
  • volatile memory verification.

Dependency construction, scheduling traits, wait planning, and storage leases continue to consume the underlying external-resource effect. The counter read therefore retains its ordering and completion behavior. No opcode-specific reporting exception is needed, and real memory effects with unknown widths remain visible.

Report behavior

The reduced clock witness and a representative resident kernel remove exactly the attachment-free counter reads while preserving measured byte traffic:

Witness Metric Before After
Reduced clock Generic memory instructions 3 2
Reduced clock Unknown-width memory reads 1 0
Reduced clock Read / write bytes 8 / 4 8 / 4
Representative kernel Generic memory instructions 32 29
Representative kernel Unknown-width memory reads 3 0
Representative kernel Read / write bytes 120 / 48 120 / 48

Both witnesses emit byte-identical HSACO before and after the change, confirming that the correction is confined to classification and reporting.

Coverage

Descriptor compiler tests distinguish external effects from attached memory effects and require actual memory for load, store, and atomic classes. Lowering contract coverage proves that only attached reads propagate source-memory flags. Shared C descriptor and compile-report tests mix external reads and writes with known- and unknown-width memory accesses, ensuring that real traffic remains accounted for while external resources stay out of the totals.

Reviewer Notes

The key boundary is intentional: memory-only consumers call the shared attachment predicate, while scheduling and dependency consumers retain the raw READ and WRITE effects. The highest-value review surface is the set of converted consumers, to ensure each one is truly asking a memory question.

Low read and write effects describe either memory or external resources,
with the memory-space attachment carrying that distinction. Teach
descriptor classification, source-memory propagation, footprint
summaries, verification, and compile reporting to consume that shared
fact while leaving scheduling effects intact.

Focused descriptor and reporting coverage keeps real unknown-width
accesses visible and proves attachment-free effects do not become memory
traffic.
@benvanik
benvanik marked this pull request as ready for review October 6, 2026 22:42
@benvanik
benvanik requested a review from a team as a code owner October 6, 2026 22:42
@benvanik
benvanik merged commit 872b980 into main Oct 6, 2026
26 of 28 checks passed
@benvanik
benvanik deleted the users/benvanik/loom-external-resource-reporting branch October 6, 2026 22:42
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