Skip to content

Commit c956e4b

Browse files
marcos.maronasmaarquitos14
authored andcommitted
Dissociate Logical/Physical from OpenCL/Vulkan env.
1 parent 05b7e97 commit c956e4b

9 files changed

+138
-41
lines changed

llvm/lib/Target/SPIRV/SPIRVAsmPrinter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,11 @@ void SPIRVAsmPrinter::outputExecutionMode(const Module &M) {
532532
Inst.addOperand(MCOperand::createImm(TypeCode));
533533
outputMCInst(Inst);
534534
}
535-
if (ST->isOpenCLEnv() && !M.getNamedMetadata("spirv.ExecutionMode") &&
535+
// FIXME: At the moment, `isOpenCLEnv()` is not precise enough. This is
536+
// because the Triple is not always precise enough. For now, we'll rely
537+
// instead on `isLogicalSPIRV()`, but this should be changed when
538+
// `isOpenCLEnv()` is precise enough.
539+
if (!ST->isLogicalSPIRV() && !M.getNamedMetadata("spirv.ExecutionMode") &&
536540
!M.getNamedMetadata("opencl.enable.FP_CONTRACT")) {
537541
MCInst Inst;
538542
Inst.setOpcode(SPIRV::OpExecutionMode);

llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,12 @@ static SPIRVType *getArgSPIRVType(const Function &F, unsigned ArgIdx,
267267

268268
static SPIRV::ExecutionModel::ExecutionModel
269269
getExecutionModel(const SPIRVSubtarget &STI, const Function &F) {
270-
if (STI.isOpenCLEnv())
270+
// FIXME: At the moment, there's a possibility that both `isOpenCLEnv()` and
271+
// `isVulkanEnv()` return true. This is because the Triple is not always
272+
// precise enough. For now, we'll rely instead on `isLogicalSPIRV()`, but this
273+
// should be changed when `isOpenCLEnv()` and `isVulkanEnv()` cannot be true
274+
// at the same time.
275+
if (!STI.isLogicalSPIRV())
271276
return SPIRV::ExecutionModel::Kernel;
272277

273278
auto attribute = F.getFnAttribute("hlsl.shader");

llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,10 @@ Register SPIRVGlobalRegistry::buildGlobalVariable(
767767
// TODO: maybe move to GenerateDecorations pass.
768768
const SPIRVSubtarget &ST =
769769
cast<SPIRVSubtarget>(MIRBuilder.getMF().getSubtarget());
770-
if (IsConst && ST.isOpenCLEnv())
770+
// FIXME: Constant requires Kernel Capabilities, so we only emit it if we are
771+
// in OpenCL env. However, that is not good enough at the moment, so we use
772+
// `!isLogicalSPIRV()` instead.
773+
if (IsConst && !ST.isLogicalSPIRV())
771774
buildOpDecorate(Reg, MIRBuilder, SPIRV::Decoration::Constant, {});
772775

773776
if (GVar && GVar->getAlign().valueOrOne().value() != 1) {

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ bool SPIRVInstructionSelector::spvSelect(Register ResVReg,
862862
.addUse(GV);
863863
return MIB.constrainAllUses(TII, TRI, RBI) &&
864864
BuildMI(BB, I, I.getDebugLoc(),
865-
TII.get(STI.isVulkanEnv()
865+
TII.get(STI.isLogicalSPIRV()
866866
? SPIRV::OpInBoundsAccessChain
867867
: SPIRV::OpInBoundsPtrAccessChain))
868868
.addDef(ResVReg)
@@ -1036,7 +1036,7 @@ bool SPIRVInstructionSelector::selectUnOp(Register ResVReg,
10361036
const SPIRVType *ResType,
10371037
MachineInstr &I,
10381038
unsigned Opcode) const {
1039-
if (STI.isOpenCLEnv() && I.getOperand(1).isReg()) {
1039+
if (!STI.isLogicalSPIRV() && I.getOperand(1).isReg()) {
10401040
Register SrcReg = I.getOperand(1).getReg();
10411041
bool IsGV = false;
10421042
for (MachineRegisterInfo::def_instr_iterator DefIt =
@@ -2069,7 +2069,7 @@ bool SPIRVInstructionSelector::selectDot4AddPackedExpansion(
20692069
auto ExtractOp =
20702070
Signed ? SPIRV::OpBitFieldSExtract : SPIRV::OpBitFieldUExtract;
20712071

2072-
bool ZeroAsNull = STI.isOpenCLEnv();
2072+
bool ZeroAsNull = !STI.isLogicalSPIRV();
20732073
// Extract the i8 element, multiply and add it to the accumulator
20742074
for (unsigned i = 0; i < 4; i++) {
20752075
// A[i]
@@ -2209,7 +2209,7 @@ bool SPIRVInstructionSelector::selectWaveOpInst(Register ResVReg,
22092209
.addDef(ResVReg)
22102210
.addUse(GR.getSPIRVTypeID(ResType))
22112211
.addUse(GR.getOrCreateConstInt(SPIRV::Scope::Subgroup, I,
2212-
IntTy, TII, STI.isOpenCLEnv()));
2212+
IntTy, TII, !STI.isLogicalSPIRV()));
22132213

22142214
for (unsigned J = 2; J < I.getNumOperands(); J++) {
22152215
BMI.addUse(I.getOperand(J).getReg());
@@ -2233,7 +2233,7 @@ bool SPIRVInstructionSelector::selectWaveActiveCountBits(
22332233
.addDef(ResVReg)
22342234
.addUse(GR.getSPIRVTypeID(ResType))
22352235
.addUse(GR.getOrCreateConstInt(SPIRV::Scope::Subgroup, I, IntTy,
2236-
TII, STI.isOpenCLEnv()))
2236+
TII, !STI.isLogicalSPIRV()))
22372237
.addImm(SPIRV::GroupOperation::Reduce)
22382238
.addUse(BallotReg)
22392239
.constrainAllUses(TII, TRI, RBI);
@@ -2264,7 +2264,7 @@ bool SPIRVInstructionSelector::selectWaveReduceMax(Register ResVReg,
22642264
.addDef(ResVReg)
22652265
.addUse(GR.getSPIRVTypeID(ResType))
22662266
.addUse(GR.getOrCreateConstInt(SPIRV::Scope::Subgroup, I, IntTy, TII,
2267-
STI.isOpenCLEnv()))
2267+
!STI.isLogicalSPIRV()))
22682268
.addImm(SPIRV::GroupOperation::Reduce)
22692269
.addUse(I.getOperand(2).getReg())
22702270
.constrainAllUses(TII, TRI, RBI);
@@ -2291,7 +2291,7 @@ bool SPIRVInstructionSelector::selectWaveReduceSum(Register ResVReg,
22912291
.addDef(ResVReg)
22922292
.addUse(GR.getSPIRVTypeID(ResType))
22932293
.addUse(GR.getOrCreateConstInt(SPIRV::Scope::Subgroup, I, IntTy, TII,
2294-
STI.isOpenCLEnv()))
2294+
!STI.isLogicalSPIRV()))
22952295
.addImm(SPIRV::GroupOperation::Reduce)
22962296
.addUse(I.getOperand(2).getReg());
22972297
}
@@ -2513,7 +2513,7 @@ bool SPIRVInstructionSelector::selectFCmp(Register ResVReg,
25132513
Register SPIRVInstructionSelector::buildZerosVal(const SPIRVType *ResType,
25142514
MachineInstr &I) const {
25152515
// OpenCL uses nulls for Zero. In HLSL we don't use null constants.
2516-
bool ZeroAsNull = STI.isOpenCLEnv();
2516+
bool ZeroAsNull = !STI.isLogicalSPIRV();
25172517
if (ResType->getOpcode() == SPIRV::OpTypeVector)
25182518
return GR.getOrCreateConstVector(0UL, I, ResType, TII, ZeroAsNull);
25192519
return GR.getOrCreateConstInt(0, I, ResType, TII, ZeroAsNull);
@@ -2522,7 +2522,7 @@ Register SPIRVInstructionSelector::buildZerosVal(const SPIRVType *ResType,
25222522
Register SPIRVInstructionSelector::buildZerosValF(const SPIRVType *ResType,
25232523
MachineInstr &I) const {
25242524
// OpenCL uses nulls for Zero. In HLSL we don't use null constants.
2525-
bool ZeroAsNull = STI.isOpenCLEnv();
2525+
bool ZeroAsNull = !STI.isLogicalSPIRV();
25262526
APFloat VZero = getZeroFP(GR.getTypeForSPIRVType(ResType));
25272527
if (ResType->getOpcode() == SPIRV::OpTypeVector)
25282528
return GR.getOrCreateConstVector(VZero, I, ResType, TII, ZeroAsNull);
@@ -2532,7 +2532,7 @@ Register SPIRVInstructionSelector::buildZerosValF(const SPIRVType *ResType,
25322532
Register SPIRVInstructionSelector::buildOnesValF(const SPIRVType *ResType,
25332533
MachineInstr &I) const {
25342534
// OpenCL uses nulls for Zero. In HLSL we don't use null constants.
2535-
bool ZeroAsNull = STI.isOpenCLEnv();
2535+
bool ZeroAsNull = !STI.isLogicalSPIRV();
25362536
APFloat VOne = getOneFP(GR.getTypeForSPIRVType(ResType));
25372537
if (ResType->getOpcode() == SPIRV::OpTypeVector)
25382538
return GR.getOrCreateConstVector(VOne, I, ResType, TII, ZeroAsNull);
@@ -2720,10 +2720,10 @@ bool SPIRVInstructionSelector::selectConst(Register ResVReg,
27202720
Reg = GR.getOrCreateConstNullPtr(MIRBuilder, ResType);
27212721
} else if (Opcode == TargetOpcode::G_FCONSTANT) {
27222722
Reg = GR.getOrCreateConstFP(I.getOperand(1).getFPImm()->getValue(), I,
2723-
ResType, TII, STI.isOpenCLEnv());
2723+
ResType, TII, !STI.isLogicalSPIRV());
27242724
} else {
27252725
Reg = GR.getOrCreateConstInt(I.getOperand(1).getCImm()->getZExtValue(), I,
2726-
ResType, TII, STI.isOpenCLEnv());
2726+
ResType, TII, !STI.isLogicalSPIRV());
27272727
}
27282728
return Reg == ResVReg ? true : BuildCOPY(ResVReg, Reg, I);
27292729
}
@@ -2803,7 +2803,7 @@ bool SPIRVInstructionSelector::selectGEP(Register ResVReg,
28032803
// OpAccessChain could be used for OpenCL, but the SPIRV-LLVM Translator only
28042804
// relies on PtrAccessChain, so we'll try not to deviate. For Vulkan however,
28052805
// we have to use Op[InBounds]AccessChain.
2806-
const unsigned Opcode = STI.isVulkanEnv()
2806+
const unsigned Opcode = STI.isLogicalSPIRV()
28072807
? (IsGEPInBounds ? SPIRV::OpInBoundsAccessChain
28082808
: SPIRV::OpAccessChain)
28092809
: (IsGEPInBounds ? SPIRV::OpInBoundsPtrAccessChain
@@ -3483,7 +3483,7 @@ bool SPIRVInstructionSelector::selectFirstBitSet64Overflow(
34833483

34843484
// On odd component counts we need to handle one more component
34853485
if (CurrentComponent != ComponentCount) {
3486-
bool ZeroAsNull = STI.isOpenCLEnv();
3486+
bool ZeroAsNull = !STI.isLogicalSPIRV();
34873487
Register FinalElemReg = MRI->createVirtualRegister(GR.getRegClass(I64Type));
34883488
Register ConstIntLastIdx = GR.getOrCreateConstInt(
34893489
ComponentCount - 1, I, BaseType, TII, ZeroAsNull);
@@ -3513,7 +3513,7 @@ bool SPIRVInstructionSelector::selectFirstBitSet64(
35133513
Register SrcReg, unsigned BitSetOpcode, bool SwapPrimarySide) const {
35143514
unsigned ComponentCount = GR.getScalarOrVectorComponentCount(ResType);
35153515
SPIRVType *BaseType = GR.retrieveScalarOrVectorIntType(ResType);
3516-
bool ZeroAsNull = STI.isOpenCLEnv();
3516+
bool ZeroAsNull = !STI.isLogicalSPIRV();
35173517
Register ConstIntZero =
35183518
GR.getOrCreateConstInt(0, I, BaseType, TII, ZeroAsNull);
35193519
Register ConstIntOne =
@@ -3715,7 +3715,10 @@ bool SPIRVInstructionSelector::selectAllocaArray(Register ResVReg,
37153715
.addUse(GR.getSPIRVTypeID(ResType))
37163716
.addUse(I.getOperand(2).getReg())
37173717
.constrainAllUses(TII, TRI, RBI);
3718-
if (!STI.isVulkanEnv()) {
3718+
// FIXME: Alignment requires Kernel Capabilities, so we only emit it if we are
3719+
// in OpenCL env. However, that is not good enough at the moment, so we use
3720+
// `!isLogicalSPIRV()` instead.
3721+
if (!STI.isLogicalSPIRV()) {
37193722
unsigned Alignment = I.getOperand(3).getImm();
37203723
buildOpDecorate(ResVReg, I, TII, SPIRV::Decoration::Alignment, {Alignment});
37213724
}
@@ -3734,7 +3737,10 @@ bool SPIRVInstructionSelector::selectFrameIndex(Register ResVReg,
37343737
.addUse(GR.getSPIRVTypeID(ResType))
37353738
.addImm(static_cast<uint32_t>(SPIRV::StorageClass::Function))
37363739
.constrainAllUses(TII, TRI, RBI);
3737-
if (!STI.isVulkanEnv()) {
3740+
// FIXME: Alignment requires Kernel Capabilities, so we only emit it if we are
3741+
// in OpenCL env. However, that is not good enough at the moment, so we use
3742+
// `!isLogicalSPIRV()` instead.
3743+
if (!STI.isLogicalSPIRV()) {
37383744
unsigned Alignment = I.getOperand(2).getImm();
37393745
buildOpDecorate(ResVReg, *It, TII, SPIRV::Decoration::Alignment,
37403746
{Alignment});

llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ getSymbolicOperandRequirements(SPIRV::OperandCategory::OperandCategory Category,
6868
SPIRV::RequirementHandler &Reqs) {
6969
// A set of capabilities to avoid if there is another option.
7070
AvoidCapabilitiesSet AvoidCaps;
71-
if (ST.isOpenCLEnv())
71+
// FIXME: At the moment, there's a possibility that both `isOpenCLEnv()` and
72+
// `isVulkanEnv()` return true. This is because the Triple is not always
73+
// precise enough. For now, we'll rely instead on `isLogicalSPIRV()`, but this
74+
// should be changed when `isOpenCLEnv()` and `isVulkanEnv()` cannot be true
75+
// at the same time.
76+
if (!ST.isLogicalSPIRV())
7277
AvoidCaps.S.insert(SPIRV::Capability::Shader);
7378

7479
VersionTuple ReqMinVer = getSymbolicOperandMinVersion(Category, i);
@@ -144,7 +149,12 @@ void SPIRVModuleAnalysis::setBaseInfo(const Module &M) {
144149
static_cast<SPIRV::MemoryModel::MemoryModel>(getMetadataUInt(MemMD, 1));
145150
} else {
146151
// TODO: Add support for VulkanMemoryModel.
147-
MAI.Mem = ST->isOpenCLEnv() ? SPIRV::MemoryModel::OpenCL
152+
// FIXME: At the moment, there's a possibility that both `isOpenCLEnv()` and
153+
// `isVulkanEnv()` return true. This is because the Triple is not always
154+
// precise enough. For now, we'll rely instead on `isLogicalSPIRV()`, but this
155+
// should be changed when `isOpenCLEnv()` and `isVulkanEnv()` cannot be true
156+
// at the same time.
157+
MAI.Mem = !ST->isLogicalSPIRV() ? SPIRV::MemoryModel::OpenCL
148158
: SPIRV::MemoryModel::GLSL450;
149159
if (MAI.Mem == SPIRV::MemoryModel::OpenCL) {
150160
unsigned PtrSize = ST->getPointerSize();
@@ -203,7 +213,12 @@ void SPIRVModuleAnalysis::setBaseInfo(const Module &M) {
203213
MAI.Reqs.getAndAddRequirements(SPIRV::OperandCategory::AddressingModelOperand,
204214
MAI.Addr, *ST);
205215

206-
if (ST->isOpenCLEnv()) {
216+
// FIXME: At the moment, there's a possibility that both `isOpenCLEnv()` and
217+
// `isVulkanEnv()` return true. This is because the Triple is not always
218+
// precise enough. For now, we'll rely instead on `isLogicalSPIRV()`, but this
219+
// should be changed when `isOpenCLEnv()` and `isVulkanEnv()` cannot be true
220+
// at the same time.
221+
if (!ST->isLogicalSPIRV()) {
207222
// TODO: check if it's required by default.
208223
MAI.ExtInstSetMap[static_cast<unsigned>(
209224
SPIRV::InstructionSet::OpenCL_std)] = MAI.getNextIDRegister();
@@ -804,12 +819,17 @@ void RequirementHandler::initAvailableCapabilities(const SPIRVSubtarget &ST) {
804819
addAvailableCaps(EnabledCapabilities);
805820
}
806821

807-
if (ST.isOpenCLEnv()) {
822+
// FIXME: At the moment, there's a possibility that both `isOpenCLEnv()` and
823+
// `isVulkanEnv()` return true. This is because the Triple is not always
824+
// precise enough. For now, we'll rely instead on `isLogicalSPIRV`, but this
825+
// should be changed when `isOpenCLEnv()` and `isVulkanEnv()` cannot be true
826+
// at the same time.
827+
if (!ST.isLogicalSPIRV()) {
808828
initAvailableCapabilitiesForOpenCL(ST);
809829
return;
810830
}
811831

812-
if (ST.isVulkanEnv()) {
832+
if (ST.isLogicalSPIRV()) {
813833
initAvailableCapabilitiesForVulkan(ST);
814834
return;
815835
}
@@ -969,7 +989,12 @@ static void addOpTypeImageReqs(const MachineInstr &MI,
969989
}
970990

971991
// Has optional access qualifier.
972-
if (ST.isOpenCLEnv()) {
992+
// FIXME: ImageBasic/ImageReadWrite capabilities require Kernel capability.
993+
// However, for now, both `isVulkanEnv()` and `isOpenCLEnv()` can return
994+
// true under some circumstances. Instead, we're using `isLogicalSPIRV()`,
995+
// but we should change this when `isVulkanEnv()` and `isOpenCLEnv()` are
996+
// precise enough.
997+
if (!ST.isLogicalSPIRV()) {
973998
if (MI.getNumOperands() > 8 &&
974999
MI.getOperand(8).getImm() == SPIRV::AccessQualifier::ReadWrite)
9751000
Reqs.addRequirements(SPIRV::Capability::ImageReadWrite);
@@ -1267,7 +1292,12 @@ void addInstrRequirements(const MachineInstr &MI,
12671292
ST);
12681293
// If it's a type of pointer to float16 targeting OpenCL, add Float16Buffer
12691294
// capability.
1270-
if (!ST.isOpenCLEnv())
1295+
// FIXME: Float16Buffer capability requires Kernel capability. However,
1296+
// for now, both `isVulkanEnv()` and `isOpenCLEnv()` can return true under
1297+
// some circumstances. Instead, we're using `isLogicalSPIRV()`, but we
1298+
// should change this when `isVulkanEnv()` and `isOpenCLEnv()` are precise
1299+
// enough.
1300+
if (ST.isLogicalSPIRV())
12711301
break;
12721302
assert(MI.getOperand(2).isReg());
12731303
const MachineRegisterInfo &MRI = MI.getMF()->getRegInfo();
@@ -1342,7 +1372,12 @@ void addInstrRequirements(const MachineInstr &MI,
13421372
addOpTypeImageReqs(MI, Reqs, ST);
13431373
break;
13441374
case SPIRV::OpTypeSampler:
1345-
if (!ST.isVulkanEnv()) {
1375+
// FIXME: ImageBasic capability requires Kernel capability. However, for
1376+
// now, both `isVulkanEnv()` and `isOpenCLEnv()` can return true under
1377+
// some circumstances. Instead, we're using `isLogicalSPIRV()`, but
1378+
// we should change this when `isVulkanEnv()` and `isOpenCLEnv()` are
1379+
// precise enough.
1380+
if (!ST.isLogicalSPIRV()) {
13461381
Reqs.addCapability(SPIRV::Capability::ImageBasic);
13471382
}
13481383
break;

llvm/lib/Target/SPIRV/SPIRVPrepareFunctions.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,23 @@ bool SPIRVPrepareFunctions::substituteIntrinsicCalls(Function *F) {
407407
Changed = true;
408408
break;
409409
case Intrinsic::lifetime_start:
410-
if (STI.isOpenCLEnv()) {
410+
// FIXME: OpLifetimeStart requires Kernel capability. However, for now,
411+
// both `isVulkanEnv()` and `isOpenCLEnv()` can return true under some
412+
// circumstances. Instead, we're using `isLogicalSPIRV()`, but we
413+
// should change this when `isVulkanEnv()` and `isOpenCLEnv()` are
414+
// precise enough.
415+
if (!STI.isLogicalSPIRV()) {
411416
Changed |= toSpvOverloadedIntrinsic(
412417
II, Intrinsic::SPVIntrinsics::spv_lifetime_start, {1});
413418
}
414419
break;
415420
case Intrinsic::lifetime_end:
416-
if (STI.isOpenCLEnv()) {
421+
// FIXME: OpLifetimeStop requires Kernel capability. However, for now,
422+
// both `isVulkanEnv()` and `isOpenCLEnv()` can return true under some
423+
// circumstances. Instead, we're using `isLogicalSPIRV()`, but we
424+
// should change this when `isVulkanEnv()` and `isOpenCLEnv()` are
425+
// precise enough.
426+
if (!STI.isLogicalSPIRV()) {
417427
Changed |= toSpvOverloadedIntrinsic(
418428
II, Intrinsic::SPVIntrinsics::spv_lifetime_end, {1});
419429
}

llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ bool SPIRVSubtarget::canUseExtInstSet(
113113

114114
SPIRV::InstructionSet::InstructionSet
115115
SPIRVSubtarget::getPreferredInstructionSet() const {
116-
if (isOpenCLEnv())
116+
// FIXME: For now, both `isVulkanEnv()` and `isOpenCLEnv()` can return true
117+
// under some circumstances. Instead, we're using `isLogicalSPIRV()`, but we
118+
// should change this when `isVulkanEnv()` and `isOpenCLEnv()` are precise
119+
// enough.
120+
if (!isLogicalSPIRV())
117121
return SPIRV::InstructionSet::OpenCL_std;
118122
else
119123
return SPIRV::InstructionSet::GLSL_std_450;
@@ -124,7 +128,11 @@ bool SPIRVSubtarget::isAtLeastSPIRVVer(VersionTuple VerToCompareTo) const {
124128
}
125129

126130
bool SPIRVSubtarget::isAtLeastOpenCLVer(VersionTuple VerToCompareTo) const {
127-
if (!isOpenCLEnv())
131+
// FIXME: For now, both `isVulkanEnv()` and `isOpenCLEnv()` can return true
132+
// under some circumstances. Instead, we're using `isLogicalSPIRV()`, but we
133+
// should change this when `isVulkanEnv()` and `isOpenCLEnv()` are precise
134+
// enough.
135+
if (isLogicalSPIRV())
128136
return false;
129137
return isAtLeastVer(OpenCLVersion, VerToCompareTo);
130138
}
@@ -147,7 +155,11 @@ void SPIRVSubtarget::accountForAMDShaderTrinaryMinmax() {
147155
// Must have called initAvailableExtensions first.
148156
void SPIRVSubtarget::initAvailableExtInstSets() {
149157
AvailableExtInstSets.clear();
150-
if (!isOpenCLEnv())
158+
// FIXME: For now, both `isVulkanEnv()` and `isOpenCLEnv()` can return true
159+
// under some circumstances. Instead, we're using `isLogicalSPIRV()`, but we
160+
// should change this when `isVulkanEnv()` and `isOpenCLEnv()` are precise
161+
// enough.
162+
if (isLogicalSPIRV())
151163
AvailableExtInstSets.insert(SPIRV::InstructionSet::GLSL_std_450);
152164
else
153165
AvailableExtInstSets.insert(SPIRV::InstructionSet::OpenCL_std);

0 commit comments

Comments
 (0)