Skip to content

Commit 11e5b6f

Browse files
committed
Change how to detect OpenCL/Vulkan env and update tests accordingly.
1 parent a652195 commit 11e5b6f

File tree

476 files changed

+1296
-1039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

476 files changed

+1296
-1039
lines changed

llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ static bool buildExtendedBitOpsInst(const SPIRV::IncomingCall *Call,
10191019
if ((Opcode == SPIRV::OpBitFieldInsert ||
10201020
Opcode == SPIRV::OpBitFieldSExtract ||
10211021
Opcode == SPIRV::OpBitFieldUExtract || Opcode == SPIRV::OpBitReverse) &&
1022-
!ST->canUseExtension(SPIRV::Extension::SPV_KHR_bit_instructions)) {
1022+
(!ST->canUseExtension(SPIRV::Extension::SPV_KHR_bit_instructions) && (ST->isOpenCLEnv()))) {
10231023
std::string DiagMsg = std::string(Builtin->Name) +
10241024
": the builtin requires the following SPIR-V "
10251025
"extension: SPV_KHR_bit_instructions";

llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,14 @@ getExecutionModel(const SPIRVSubtarget &STI, const Function &F) {
281281
auto attribute = F.getFnAttribute("hlsl.shader");
282282
if (!attribute.isValid()) {
283283
report_fatal_error(
284-
"This entry point lacks mandatory hlsl.shader attribute.");
284+
"This entry point lacks mandatory hlsl.shader attribute.", false);
285285
}
286286

287287
const auto value = attribute.getValueAsString();
288288
if (value == "compute")
289289
return SPIRV::ExecutionModel::GLCompute;
290290

291-
report_fatal_error("This HLSL entry point is not supported by this backend.");
291+
report_fatal_error("This HLSL entry point is not supported by this backend.", false);
292292
}
293293

294294
bool SPIRVCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,

llvm/lib/Target/SPIRV/SPIRVSubtarget.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,10 @@ class SPIRVSubtarget : public SPIRVGenSubtargetInfo {
7878
unsigned getPointerSize() const { return PointerSize; }
7979
unsigned getBound() const { return GR->getBound(); }
8080
bool canDirectlyComparePointers() const;
81-
// TODO: this environment is not implemented in Triple, we need to decide
82-
// how to standardize its support. For now, let's assume SPIR-V with physical
83-
// addressing is OpenCL, and Logical addressing is Vulkan.
8481
bool isOpenCLEnv() const {
85-
return TargetTriple.getArch() == Triple::spirv32 ||
86-
TargetTriple.getArch() == Triple::spirv64;
82+
return TargetTriple.getEnvironment() == Triple::OpenCL;
8783
}
88-
bool isVulkanEnv() const { return TargetTriple.getArch() == Triple::spirv; }
84+
bool isVulkanEnv() const { return !isOpenCLEnv(); }
8985
const std::string &getTargetTripleAsStr() const { return TargetTriple.str(); }
9086
VersionTuple getSPIRVVersion() const { return SPIRVVersion; };
9187
bool isAtLeastSPIRVVer(VersionTuple VerToCompareTo) const;

llvm/test/CodeGen/SPIRV/AtomicBuiltinsFloat.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
1+
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown-opencl %s -o - | FileCheck %s
22

33
;; Types:
44
; CHECK: %[[#F32:]] = OpTypeFloat 32

llvm/test/CodeGen/SPIRV/AtomicCompareExchange.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2-
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
1+
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown-opencl %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown-opencl %s -o - -filetype=obj | spirv-val %}
33

44
; CHECK-SPIRV-DAG: %[[#Int:]] = OpTypeInt 32 0
55
; CHECK-SPIRV-DAG: %[[#MemScope_CrossDevice:]] = OpConstantNull %[[#Int]]

llvm/test/CodeGen/SPIRV/AtomicExchange.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
2-
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
1+
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown-opencl %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown-opencl %s -o - -filetype=obj | spirv-val %}
33

44
; CHECK-DAG: %[[#Long:]] = OpTypeInt 64 0
55
; CHECK-COUNT-9: %[[#]] = OpAtomicExchange %[[#Long]] %[[#]] %[[#]] %[[#]] %[[#]]

llvm/test/CodeGen/SPIRV/CheckCapKernelWithoutKernel.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
1+
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown-opencl %s -o - | FileCheck %s
22

33
@a = addrspace(2) constant i32 1, align 4
44

llvm/test/CodeGen/SPIRV/ComparePointers.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -O0 -mtriple=spirv64v1.3-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2-
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64v1.3-unknown-unknown %s -o - -filetype=obj | spirv-val %}
1+
; RUN: llc -O0 -mtriple=spirv64v1.3-unknown-unknown-opencl %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64v1.3-unknown-unknown-opencl %s -o - -filetype=obj | spirv-val %}
33

44
;; kernel void test(int global *in, int global *in2) {
55
;; if (!in)

llvm/test/CodeGen/SPIRV/EnqueueEmptyKernel.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
1+
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown-opencl %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
22

33
; TODO(#60133): Requires updates following opaque pointer migration.
44
; XFAIL: *

llvm/test/CodeGen/SPIRV/ExecutionMode.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
2-
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
1+
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown-opencl %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown-opencl %s -o - -filetype=obj | spirv-val %}
33

44
; CHECK-DAG: %[[#VOID:]] = OpTypeVoid
55

0 commit comments

Comments
 (0)