Skip to content

Commit 229ca95

Browse files
committed
Renable -fopenacc and emit warning for amdgpu
1 parent d5f3852 commit 229ca95

File tree

9 files changed

+13
-5
lines changed

9 files changed

+13
-5
lines changed

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ def warn_drv_unsupported_openmp_library : Warning<
146146
"the library '%0=%1' is not supported, OpenMP will not be enabled">,
147147
InGroup<OptionIgnored>;
148148

149+
def warn_openacc_experimental : Warning<
150+
"OpenACC is NOT supported for AMDGPU">;
151+
149152
def err_drv_invalid_thread_model_for_target : Error<
150153
"invalid thread model '%0' in '%1' for this target">;
151154
def err_drv_invalid_linker_name : Error<

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3737,8 +3737,10 @@ def fno_openmp_target_debug : Flag<["-"], "fno-openmp-target-debug">;
37373737
// FlangOption + FC1 + ClangOption + CC1Option
37383738
//===----------------------------------------------------------------------===//
37393739
// Unsupported on AMD downstream
3740+
let Visibility = [FC1Option, FlangOption, CC1Option, ClangOption] in {
37403741
def fopenacc : Flag<["-"], "fopenacc">, Group<f_Group>, Visibility<[]>,
37413742
HelpText<"Enable OpenACC">;
3743+
}
37423744

37433745
//===----------------------------------------------------------------------===//
37443746
// Optimisation remark options

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4028,6 +4028,7 @@ static void RenderOpenACCOptions(const Driver &D, const ArgList &Args,
40284028
if (!Args.hasArg(options::OPT_fopenacc))
40294029
return;
40304030

4031+
D.Diag(diag::warn_openacc_experimental);
40314032
CmdArgs.push_back("-fopenacc");
40324033

40334034
if (Arg *A = Args.getLastArg(options::OPT_openacc_macro_override)) {

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ void Flang::addOtherOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
132132
options::OPT_fno_offload_global_filtering,
133133
options::OPT_funsigned, options::OPT_fno_unsigned});
134134

135+
if (Args.hasArg(options::OPT_fopenacc)) {
136+
const Driver &D = getToolChain().getDriver();
137+
D.Diag(diag::warn_openacc_experimental);
138+
}
139+
135140
llvm::codegenoptions::DebugInfoKind DebugInfoKind;
136141
if (Args.hasArg(options::OPT_gN_Group)) {
137142
Arg *gNArg = Args.getLastArg(options::OPT_gN_Group);

clang/test/AST/ast-print-openacc-atomic-construct.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %clang_cc1 -fopenacc -ast-print %s -o - | FileCheck %s
2-
// XFAIL: *
32

43
void foo(int v, int x) {
54
// CHECK: #pragma acc atomic read

clang/test/AST/ast-print-openacc-cache-construct.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %clang_cc1 -fopenacc -ast-print %s -o - | FileCheck %s
2-
// XFAIL: *
32
void foo() {
43
int Array[5];
54
// CHECK: #pragma acc cache(readonly: Array[1], Array[1:2])

clang/test/AST/ast-print-openacc-declare-construct.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %clang_cc1 -fopenacc -ast-print %s -o - | FileCheck %s
22
// flang decided that we would NOT accept -fopenacc downsteam
3-
// XFAIL: *
43

54
int *Global, *Global2;
65
int GlobalArray[5];

clang/test/Misc/warning-flags.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This test serves two purposes:
1818

1919
The list of warnings below should NEVER grow. It should gradually shrink to 0.
2020

21-
CHECK: Warnings without flags (58):
21+
CHECK: Warnings without flags (59):
2222

2323
CHECK-NEXT: ext_expected_semi_decl_list
2424
CHECK-NEXT: ext_missing_whitespace_after_macro_name
@@ -63,6 +63,7 @@ CHECK-NEXT: warn_not_compound_assign
6363
CHECK-NEXT: warn_objc_property_copy_missing_on_block
6464
CHECK-NEXT: warn_objc_protocol_qualifier_missing_id
6565
CHECK-NEXT: warn_on_superclass_use
66+
CHECK-NEXT: warn_openacc_experimental
6667
CHECK-NEXT: warn_pp_convert_to_positive
6768
CHECK-NEXT: warn_pp_expr_overflow
6869
CHECK-NEXT: warn_pp_line_decimal

flang/test/Semantics/cuf18.cuf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
! RUN: %python %S/test_errors.py %s %flang_fc1 -fopenacc
2-
! XFAIL: *
32
subroutine sub1()
43
real, allocatable, device :: a(:)
54
integer :: i

0 commit comments

Comments
 (0)