Skip to content

inner_tiled op needs explicit semantics and a strict verifier #22336

Closed

Description

@bjacob

The inner_tiled op rides successive lowerings. Some of these are semantically straightforward, e.g. bufferization. But some other lowerings cause nontrivial changes to its semantics and the shapes of its operands:

  1. ExpandUndistributedInnerTilesPass expands the 2D tiles into higher-dimensional tiles with expand_shape and transpose ("swizzle").
  2. DistributeInnerTiledToLanesPass changes from workgroup to thread semantics, slicing the tiles.

This means we have 3 different "semantics" for this op:

  1. Not yet expanded or distributed.
  2. Expanded but not yet distributed.
  3. Distributed to threads.

This is currently implied by the shapes of operands.

The verifier, accordingly, is very lax: it only requires the tiles element counts to match.

As a result, the verifier has false negatives and confusing diagnostics.

The false negatives are concerning because the ill-formed IR that is allowed past the verifier is known to cause assertion failures (in assert-enabled build) and out-of-bounds accesses (when asserts are disabled) in the compiler, see #22284 (comment) . That is why this Issue is tagged 'Bug' not just 'Enhancement'.

Instead, inner_tiled should have an additional attribute parameter selecting its semantics among the above 3. The verifier should then strictly enforce the specified semantics.

Activity

  1. added
    codegen/rocm
    on Oct 16, 2025
  2. changed the issue type fromtoon Oct 17, 2025
  3. MaheshRavishankar commented on Oct 19, 2025

    @MaheshRavishankar
    Collaborator

    I am not sure using an attribute to distinguish between the three different use cases, if they are really three different semantics, makes sense. If we need to distinguish between the different "phases" the same operation is used, we need to just add different operations. But also, not everything can be caught in the verifier. Some will have to be caught in pipeline/e2e tests.

  4. bjacob commented on Oct 21, 2025

    @bjacob
    CollaboratorAuthor

    @MaheshRavishankar , the PR under review (link above this comment) ends up adding not one enum attr, but two separate orthogonal bool attrs. It merely straightens up a preexisting loose ops. I think it's a step in the right direction even if one would prefer separate ops as the destination. Continue discussion there!

  5. added a commit that references this issue on Oct 27, 2025
    34379e6
  6. added a commit that references this issue on Oct 30, 2025
    2cb29e0
  7. added a commit that references this issue on Nov 19, 2025
    f0e72ca
  8. added a commit that references this issue on Nov 28, 2025
    3e43e14
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

    codegen/rocm

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions