12 Commits

Author SHA1 Message Date
Valentin Clement (バレンタイン クレメン)
544a3cb65b
[flang][cuda] Handle variable with initialization in device global pass (#124307) 2025-01-24 10:09:38 -08:00
Valentin Clement (バレンタイン クレメン)
25f28ddd69
[flang][cuda][NFC] Fix file header 2025-01-14 14:05:57 -08:00
Valentin Clement (バレンタイン クレメン)
4b17a8b10e
[flang][cuda] Add operation to sync global descriptor (#121520)
Introduce cuf.sync_descriptor to be used to sync device global
descriptor after pointer association.

Also move CUFCommon so it can be used in FIRBuilder lib as well.
2025-01-02 17:02:45 -08:00
Valentin Clement (バレンタイン クレメン)
37978c466b
[flang][cuda] Remove unused variable 2024-12-12 15:04:16 -08:00
Valentin Clement (バレンタイン クレメン)
ea04148c27
[flang][cuda] Extend implicit global handling to any type descriptor (#119769)
Relax the check to also handle other type descriptor globals.
2024-12-12 14:52:49 -08:00
Valentin Clement (バレンタイン クレメン)
956d0dd624
[flang][cuda] Support builtin global in device global pass (#119626) 2024-12-11 17:09:56 -08:00
Valentin Clement (バレンタイン クレメン)
850c932f05
[flang][cuda] Walk through cuf kernel for implicit globals (#119455)
Globals used in cuf kernel need to be flagged as well.
2024-12-10 14:01:53 -08:00
Renaud Kauffmann
27e458c8cb
[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`
2024-12-05 18:36:48 -08:00
Valentin Clement (バレンタイン クレメン)
ca79e12648
[flang][cuda] Handle implicit global in cuf kernel and nested statement (#116846)
Update the implicit global detection by looking for them in the CUF
kernel and also update to a walk so nested `fir.address_of` in nested
statement are also accounted for.
2024-11-19 12:38:18 -08:00
Valentin Clement (バレンタイン クレメン)
067ce5ca18
[flang][cuda] Use getOrCreateGPUModule in CUFDeviceGlobal pass (#114468)
Make the pass functional if gpu module was not created yet.
2024-10-31 18:58:43 -07:00
Renaud Kauffmann
0eb5c9d2ef
[flang][cuda] Copying device globals in the gpu module (#113955) 2024-10-28 15:34:27 -07:00
Renaud Kauffmann
f1e59dcb45
Renaming Cuf passes to CUF (#113351)
For consistency with other dialects and other CUF passes and files, this
patch renames passes CufOpConversion to CUFOpConversion,
CufImplicitDeviceGlobal to CUFDeviceGlobal.
It also renames the file.
2024-10-22 12:50:31 -07:00