[all-commits] [llvm/llvm-project] 11bd02: [MLIR][GPU] Fix async.yield gpu.async.token loweri...

Jared Hoberock via All-commits all-commits at lists.llvm.org
Mon Apr 27 11:02:20 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 11bd02895da137a46fb37cc33df8f66862e53351
      https://github.com/llvm/llvm-project/commit/11bd02895da137a46fb37cc33df8f66862e53351
  Author: Jared Hoberock <jaredhoberock at gmail.com>
  Date:   2026-04-27 (Mon, 27 Apr 2026)

  Changed paths:
    M mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
    A mlir/test/Conversion/GPUCommon/lower-async-to-gpu-runtime-calls.mlir

  Log Message:
  -----------
  [MLIR][GPU] Fix async.yield gpu.async.token lowering race (#190717)

Root cause of #170833 (flakiness of `Integration/GPU/CUDA/async.mlir` on
the Tesla T4 mlir-nvidia buildbot).

In `gpu-to-llvm`, two patterns matched `async.yield` with the same
benefit: the structural `ConvertYieldOpTypes` from
`populateAsyncStructuralTypeConversionsAndLegality` (which just retypes
operands), and `ConvertAsyncYieldToGpuRuntimeCallPattern` (which also
creates and records an event on the stream backing each
`gpu.async.token` operand). When the IR contained `gpu.launch_func`, the
dialect-conversion framework picked the structural pattern, silently
dropping the event record. The `async.execute` then yielded a stream
pointer where its consumers expected an event, and the host await ended
up calling `cuEventSynchronize` on a stream pointer. That call returns
an error without waiting, so the host raced against the GPU.

This change implements a fix which registers
`ConvertAsyncYieldToGpuRuntimeCallPattern` with pattern benefit 2 so it
wins on yields carrying `gpu.async.token` operands. The structural
rewriter still handles yields without token operands.

Also adds a new test `lower-async-to-gpu-runtime-calls.mlir` to check
the correct IR shape of `async.yield` after a `gpu.launch_func`.

Assisted-by: Claude

Fixes #170833



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list