-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang][cuda] Make sure CUDA attribute are imported when using module…
… variable (#82844) CUDA attribute are correctly propagated to the module file but were not imported currently so they did not appear on the hlfir.declare and fir.global operations for module variables.
- Loading branch information
1 parent
d8406d4
commit e2d80a3
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s | ||
|
||
! Simple module to test module use in | ||
|
||
module cuf_mod | ||
real, device :: md | ||
end module | ||
|
||
! CHECK: fir.global @_QMcuf_modEmd {cuda_attr = #fir.cuda<device>} : f32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
! RUN: bbc -emit-hlfir -fcuda %S/cuda-mod.cuf | ||
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s | ||
|
||
! Test importing module with variable with CUDA attributes. | ||
|
||
subroutine sub1() | ||
use cuf_mod | ||
md = 1.0 | ||
end | ||
|
||
! CHECK-LABEL: func.func @_QPsub1() | ||
! CHECK: %[[ADDR:.*]] = fir.address_of(@_QMcuf_modEmd) : !fir.ref<f32> | ||
! CHECK: %{{.*}}:2 = hlfir.declare %[[ADDR]] {cuda_attr = #fir.cuda<device>, uniq_name = "_QMcuf_modEmd"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>) | ||
|
||
! CHECK: fir.global @_QMcuf_modEmd {cuda_attr = #fir.cuda<device>} : f32 |