Skip to content

Support register-resident F16 WGMMA counted K-loop lowering #1074

Closed

Description

@uurl

Problem

cuda-oxide currently supports m64n64k16.f32.f16.f16 WGMMA for canonical linear full-drain regions, but canonical counted K-loops remain unsupported.

BF16 already has a counted-loop lowering that keeps all 32 per-thread accumulator values in SSA and fuses the complete asynchronous lifetime into one convergent inline-PTX scope:

wgmma.fence
counted K-loop:
    wgmma.mma_async
    affine descriptor recurrence
wgmma.commit_group
wgmma.wait_group 0

F16 already uses the same 32-value accumulator carrier for linear full-drain regions, so the remaining gap is extending the single-slot counted-loop path to the F16 input type without broadening the existing F16 support to partial waits or counted pipelines.

Proposed scope

Support the canonical F16 counted K-loop shape with:

  • one m64n64k16.f32.f16.f16 MMA per iteration;
  • a canonical [[f32; 8]; 4] accumulator;
  • a compile-time positive trip count;
  • affine u64 descriptor recurrences;
  • one fence before the loop;
  • one commit after the loop;
  • a final wait_group<0>;
  • all 32 accumulator values kept register-resident across the complete loop.

The lowering should reuse the existing counted-loop machinery and differ from the BF16 path only in the WGMMA input element type.

Out of scope

This should not add support for:

  • F16 partial waits;
  • F16 multi-slot pipelines;
  • F16 counted pipelines;
  • non-canonical F16 accumulator fallback;
  • dynamic trip counts;
  • arbitrary CFG loop shapes;
  • TF32 WGMMA.

Acceptance criteria

  • Canonical pointer-form F16 counted K-loops are recognized and rewritten to a value-threaded counted-loop carrier.
  • The generated PTX contains wgmma.mma_async.sync.aligned.m64n64k16.f32.f16.f16.
  • The whole fence / loop / commit / final wait lifetime remains inside one convergent inline-PTX scope.
  • ptxas -arch=sm_90a accepts the generated PTX.
  • The probe reports zero stack usage and zero spill loads/stores.
  • Existing BF16 counted-loop and counted-pipeline behavior remains unchanged.
  • F16 partial-wait and non-canonical shapes continue to fail closed.
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions