Skip to content

Commit

Permalink
[flang][cuda][driver] Make sure flang does not switch to cc1 (#104613)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
clementval authored Aug 16, 2024
1 parent ef56061 commit e6b9f12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions clang/lib/Driver/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ bool types::isAcceptedByFlang(ID Id) {
case TY_LLVM_IR:
case TY_LLVM_BC:
return true;
case TY_PP_CUDA:
case TY_CUDA:
return true;
}
}

Expand Down
7 changes: 6 additions & 1 deletion flang/test/Driver/cuda-option.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
! Test -fcuda option
! RUN: %flang_fc1 -cpp -x cuda -fdebug-unparse %s -o - | FileCheck %s
! RUN: not %flang -cpp -x cuda %s -o - 2>&1 | FileCheck %s --check-prefix=MLIRERROR
! RUN: not %flang_fc1 -cpp %s -o - 2>&1 | FileCheck %s --check-prefix=ERROR
program main
#if _CUDA
Expand All @@ -12,4 +13,8 @@ program main
! CHECK: INTEGER :: var = 1
! CHECK: INTEGER, DEVICE :: dvar

! ERROR: cuda-option.f90:8:19: error: expected end of statement
! ERROR: cuda-option.f90:{{.*}}:{{.*}}: error: expected end of statement

! The whole pipeline is not in place yet. It will currently fail at MLIR
! translation level.
! MLIRERROR: failed to legalize operation 'cuf.alloc'

0 comments on commit e6b9f12

Please sign in to comment.