[all-commits] [llvm/llvm-project] 340b35: [flang][acc] Don't treat a managed pointer as devi...

yebinchon via All-commits all-commits at lists.llvm.org
Tue Sep 22 10:48:27 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 340b35cd504e01e4eeff0381bd5eb317dfb7f504
      https://github.com/llvm/llvm-project/commit/340b35cd504e01e4eeff0381bd5eb317dfb7f504
  Author: yebinchon <yebin.chon at princeton.edu>
  Date:   2026-09-22 (Tue, 22 Sep 2026)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h
    M flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.h
    M flang/include/flang/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.h
    M flang/lib/Optimizer/Dialect/CUF/Attributes/CUFAttr.cpp
    M flang/lib/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.cpp
    M flang/lib/Optimizer/OpenACC/Support/FIROpenACCTypeInterfaces.cpp
    A flang/test/Transforms/OpenACC/acc-implicit-data-device-data.fir
    M mlir/include/mlir/Dialect/OpenACC/OpenACCOpsInterfaces.td
    M mlir/include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.td
    M mlir/include/mlir/Dialect/OpenACC/OpenACCUtils.h
    M mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
    M mlir/lib/Dialect/OpenACC/Transforms/ACCImplicitData.cpp
    M mlir/lib/Dialect/OpenACC/Utils/OpenACCUtils.cpp
    M mlir/unittests/Dialect/OpenACC/OpenACCUtilsTest.cpp

  Log Message:
  -----------
  [flang][acc] Don't treat a managed pointer as device resident data (#222769)

isDeviceData classifies every entity with a device-data CUDA attribute
(device, managed, constant, shared, unified) as device data, and so all
pointers and allocatables under mem:managed/unified are treated as
deviceptr.

However, managed and unified guarantee accessibility from device but not
that the storage is already residing on device. Treating these
unconditionally as "on device" (deviceptr) asserts to the runtime that
it is a valid device address and skips the mapping/attach the runtime
needs.

This patch adds a Util helper "isDeviceResident" which conservatively
returns false for managed/unified.

The guard for deviceptr is changed from isDeviceValue to
isDeviceResident, and does NOT give deviceptr for managed and unified.
These entities are now mapped (copyin/out) instead.

---------

Co-authored-by: Yebin Chon <ychon at nvidia.com>



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