Skip to content

Commit e6b9f12

Browse files
authored
[flang][cuda][driver] Make sure flang does not switch to cc1 (#104613)
Flang is switch to cc1 when we use `-x cuda`. Make sure we can use fc1 with cuda fortran input. The current pipeline will fail at MLIR level for the moment. #104483
1 parent ef56061 commit e6b9f12

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

clang/lib/Driver/Types.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ bool types::isAcceptedByFlang(ID Id) {
170170
case TY_LLVM_IR:
171171
case TY_LLVM_BC:
172172
return true;
173+
case TY_PP_CUDA:
174+
case TY_CUDA:
175+
return true;
173176
}
174177
}
175178

flang/test/Driver/cuda-option.f90

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
! Test -fcuda option
22
! RUN: %flang_fc1 -cpp -x cuda -fdebug-unparse %s -o - | FileCheck %s
3+
! RUN: not %flang -cpp -x cuda %s -o - 2>&1 | FileCheck %s --check-prefix=MLIRERROR
34
! RUN: not %flang_fc1 -cpp %s -o - 2>&1 | FileCheck %s --check-prefix=ERROR
45
program main
56
#if _CUDA
@@ -12,4 +13,8 @@ program main
1213
! CHECK: INTEGER :: var = 1
1314
! CHECK: INTEGER, DEVICE :: dvar
1415

15-
! ERROR: cuda-option.f90:8:19: error: expected end of statement
16+
! ERROR: cuda-option.f90:{{.*}}:{{.*}}: error: expected end of statement
17+
18+
! The whole pipeline is not in place yet. It will currently fail at MLIR
19+
! translation level.
20+
! MLIRERROR: failed to legalize operation 'cuf.alloc'

0 commit comments

Comments
 (0)