Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,18 @@ def fhip_emit_relocatable : Flag<["-"], "fhip-emit-relocatable">,
HelpText<"Compile HIP source to relocatable">;
def fno_hip_emit_relocatable : Flag<["-"], "fno-hip-emit-relocatable">,
HelpText<"Do not override toolchain to compile HIP source to relocatable">;
def hip_use_experimental_spirv_backend
: Flag<["-"], "hip-use-experimental-spirv-backend">,
Group<hip_Group>,
Flags<[HelpHidden]>,
HelpText<"Use experimental SPIRV backend for HIP compilation (HIP "
"only)">;
def no_hip_use_experimental_spirv_backend
: Flag<["-"], "no-hip-use-experimental-spirv-backend">,
Group<hip_Group>,
Flags<[HelpHidden]>,
HelpText<"Do not use experimental SPIRV backend for HIP compilation "
"(HIP only)">;
}

// Clang specific/exclusive options for OpenACC.
Expand Down Expand Up @@ -5483,20 +5495,6 @@ defm wavefrontsize64 : SimpleMFlag<"wavefrontsize64",
defm amdgpu_precise_memory_op
: SimpleMFlag<"amdgpu-precise-memory-op", "Enable", "Disable",
" precise memory mode (AMDGPU only)">;
def amdgpu_use_experimental_spirv_backend
: Flag<["-"], "amdgpu-use-experimental-spirv-backend">,
Group<m_amdgpu_Features_Group>,
Flags<[HelpHidden]>,
Visibility<[ClangOption]>,
HelpText<"Use experimental SPIRV backend for AMDGPU compilation (AMDGPU "
"only)">;
def no_amdgpu_use_experimental_spirv_backend
: Flag<["-"], "no-amdgpu-use-experimental-spirv-backend">,
Group<m_amdgpu_Features_Group>,
Flags<[HelpHidden]>,
Visibility<[ClangOption]>,
HelpText<"Do not use experimental SPIRV backend for AMDGPU compilation "
"(AMDGPU only)">;

def munsafe_fp_atomics : Flag<["-"], "munsafe-fp-atomics">,
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>, Alias<fatomic_ignore_denormal_mode>;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Driver/ToolChains/HIPAMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ void AMDGCN::Linker::constructLinkAndEmitSpirvCommand(
constructLlvmLinkCommand(C, JA, Inputs, LinkedBCFile, Args);

bool UseSPIRVBackend = Args.hasFlag(
options::OPT_amdgpu_use_experimental_spirv_backend,
options::OPT_no_amdgpu_use_experimental_spirv_backend, /*Default=*/false);
options::OPT_hip_use_experimental_spirv_backend,
options::OPT_no_hip_use_experimental_spirv_backend, /*Default=*/false);

// Emit SPIR-V binary either using the SPIRV backend or the translator.
if (UseSPIRVBackend) {
Expand Down
12 changes: 0 additions & 12 deletions clang/test/Driver/amdgpu-spirv-backend-opt.c

This file was deleted.

12 changes: 12 additions & 0 deletions clang/test/Driver/hip-spirv-backend-opt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// COM: This test case validates the behavior of -hip-use-experimental-spirv-backend

// COM: Test that -hip-use-experimental-spirv-backend calls clang -cc1 with the SPIRV triple.
// RUN: %clang -x hip %s --cuda-device-only --offload-arch=amdgcnspirv -hip-use-experimental-spirv-backend -nogpuinc -nogpulib -### 2>&1 | FileCheck %s --check-prefix=CHECK-SPIRV-BACKEND
// CHECK-SPIRV-BACKEND: "{{.*}}clang{{.*}}" "-cc1" "{{.*-triple=spirv64-amd-amdhsa}}"

// COM: Test that -no-hip-use-experimental-spirv-backend calls the SPIRV translator
// RUN: %clang -x hip %s --cuda-device-only --offload-arch=amdgcnspirv -no-hip-use-experimental-spirv-backend -nogpuinc -nogpulib -### 2>&1 | FileCheck %s --check-prefix=CHECK-SPIRV-TRANSLATOR
// CHECK-SPIRV-TRANSLATOR: "{{.*llvm-spirv.*}}" "{{--spirv-max-version=[0-9]+\.[0-9]}}"

// COM: Test that by default we use the translator
// RUN: %clang -x hip %s --cuda-device-only --offload-arch=amdgcnspirv -nogpuinc -nogpulib -### 2>&1 | FileCheck %s --check-prefix=CHECK-SPIRV-TRANSLATOR