[all-commits] [llvm/llvm-project] 4d676e: [flang][cuda] Preserve fir.rebox captured by cuf.k...

Zhen Wang via All-commits all-commits at lists.llvm.org
Tue Apr 28 09:08:35 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d676e56f0ee819a20a021434a53060a43c33120
      https://github.com/llvm/llvm-project/commit/4d676e56f0ee819a20a021434a53060a43c33120
  Author: Zhen Wang <zhenw at nvidia.com>
  Date:   2026-04-28 (Tue, 28 Apr 2026)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/CMakeLists.txt
    A flang/include/flang/Optimizer/Dialect/CUDAKernelOpInterface.h
    A flang/include/flang/Optimizer/Dialect/CUDAKernelOpInterface.td
    M flang/include/flang/Optimizer/Dialect/CUF/CUFOps.h
    M flang/include/flang/Optimizer/Dialect/CUF/CUFOps.td
    M flang/lib/Optimizer/Dialect/CMakeLists.txt
    A flang/lib/Optimizer/Dialect/CUDAKernelOpInterface.cpp
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    A flang/test/Fir/array-coor-canonicalization-cuf.fir

  Log Message:
  -----------
  [flang][cuda] Preserve fir.rebox captured by cuf.kernel via CUDAKernelOpInterface (#193890)

Reland of #193837 (reverted in #193855), now using a marker op interface
to avoid the link cycle that broke `BUILD_SHARED_LIBS=ON` builds.

`SimplifyArrayCoorOp` folded `fir.rebox` into `fir.array_coor` across a
`cuf.kernel` boundary. CUF lowering needs the captured rebox to
materialize a managed-memory descriptor for the kernel; folding it away
makes the kernel dereference the host-side descriptor and crash with
`cudaErrorIllegalAddress`.

Fix is to add `fir::CUDAKernelOpInterface`, a marker op interface
defined in FIRDialect and implemented by `cuf.kernel`. The
canonicalization guard queries the interface, so the `TypeIDResolver`
symbol lives in `libFIRDialect.so` and no `FIR -> CUF` link edge is
introduced.



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