[all-commits] [llvm/llvm-project] 27e458: [flang][cuda] Distinguish constant fir.global from...

Renaud Kauffmann via All-commits all-commits at lists.llvm.org
Thu Dec 5 18:37:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 27e458c8cbec27d48ee73623c4b5bbf6bba407cb
      https://github.com/llvm/llvm-project/commit/27e458c8cbec27d48ee73623c4b5bbf6bba407cb
  Author: Renaud Kauffmann <rkauffmann at nvidia.com>
  Date:   2024-12-05 (Thu, 05 Dec 2024)

  Changed paths:
    M flang/include/flang/Optimizer/Transforms/CUFCommon.h
    M flang/lib/Optimizer/Transforms/CUFAddConstructor.cpp
    M flang/lib/Optimizer/Transforms/CUFCommon.cpp
    M flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp
    M flang/lib/Optimizer/Transforms/CUFOpConversion.cpp
    M flang/test/Fir/CUDA/cuda-constructor-2.f90
    M flang/test/Fir/CUDA/cuda-global-addr.mlir
    M flang/test/Fir/CUDA/cuda-implicit-device-global.f90

  Log Message:
  -----------
  [flang][cuda] Distinguish constant fir.global from globals with a #cuf.cuda<constant> attribute (#118912)

1. In `CufOpConversion` `isDeviceGlobal` was renamed
`isRegisteredGlobal` and moved to the common file. `isRegisteredGlobal`
excludes constant `fir.global` operation from registration. This is to
avoid calls to `_FortranACUFGetDeviceAddress` on globals which do not
have any symbols in the runtime. This was done for
`_FortranACUFRegisterVariable` in #118582, but also needs to be done
here after #118591
2. `CufDeviceGlobal` no longer adds the `#cuf.cuda<constant>` attribute
to the constant global. As discussed in #118582 a module variable with
the #cuf.cuda<constant> attribute is not a compile time constant. Yet,
the compile time constant also needs to be copied into the GPU module.
The candidates for copy to the GPU modules are
- the globals needing regsitrations regardless of their uses in device
code (they can be referred to in host code as well)
       - the compile time constant when used in device code 

3. The registration of "constant" module device variables (
#cuf.cuda<constant>) can be restored in `CufAddConstructor`



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