Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package spirv-llvm-translator for
openSUSE:Factory checked in at 2024-12-08 11:36:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/spirv-llvm-translator (Old)
and /work/SRC/openSUSE:Factory/.spirv-llvm-translator.new.21547 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "spirv-llvm-translator"
Sun Dec 8 11:36:50 2024 rev:13 rq:1228791 version:19.1.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/spirv-llvm-translator/spirv-llvm-translator.changes
2024-11-20 16:59:06.886661609 +0100
+++
/work/SRC/openSUSE:Factory/.spirv-llvm-translator.new.21547/spirv-llvm-translator.changes
2024-12-08 11:37:57.031665767 +0100
@@ -1,0 +2,13 @@
+Thu Dec 5 21:39:15 UTC 2024 - Aaron Puchert <[email protected]>
+
+- Update to version 19.1.2.
+ * Add fast math flag translation for OpenCL standard library.
+ * Ensure that PHI node has an incoming value per each predecessor
+ instance, even if the input SPIR-V module is invalid as
+ reported by `spirv-val`.
+ * SPIRVReader: Support OpConstantComposite for cooperative matrix.
+ * SPIRVReader: Add OpSizeOf support (SPIR-V 1.1).
+ * Generate load and store for OpCopyLogical.
+ * SPIRVReader: Add AlignmentId support (SPIR-V 1.2).
+
+-------------------------------------------------------------------
Old:
----
SPIRV-LLVM-Translator-19.1.1.tar.gz
New:
----
SPIRV-LLVM-Translator-19.1.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ spirv-llvm-translator.spec ++++++
--- /var/tmp/diff_new_pack.jUqv58/_old 2024-12-08 11:37:58.855741544 +0100
+++ /var/tmp/diff_new_pack.jUqv58/_new 2024-12-08 11:37:58.875742375 +0100
@@ -19,7 +19,7 @@
%define sover 19
Name: spirv-llvm-translator
-Version: 19.1.1
+Version: 19.1.2
Release: 0
Summary: LLVM/SPIR-V Bi-Directional Translator library
License: BSD-3-Clause
++++++ SPIRV-LLVM-Translator-19.1.1.tar.gz ->
SPIRV-LLVM-Translator-19.1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVBuiltinHelper.cpp
new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVBuiltinHelper.cpp
--- old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVBuiltinHelper.cpp
2024-10-30 11:39:26.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVBuiltinHelper.cpp
2024-11-28 14:26:55.000000000 +0100
@@ -106,6 +106,9 @@
NewCall->copyMetadata(*CI);
NewCall->setAttributes(CallAttrs);
NewCall->setTailCall(CI->isTailCall());
+ if (isa<FPMathOperator>(CI))
+ NewCall->setFastMathFlags(CI->getFastMathFlags());
+
if (CI->hasFnAttr("fpbuiltin-max-error")) {
auto Attr = CI->getFnAttr("fpbuiltin-max-error");
NewCall->addFnAttr(Attr);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVReader.cpp
new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVReader.cpp
--- old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVReader.cpp 2024-10-30
11:39:26.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVReader.cpp 2024-11-28
14:26:55.000000000 +0100
@@ -289,6 +289,29 @@
return F;
}
+std::optional<uint64_t> SPIRVToLLVM::transIdAsConstant(SPIRVId Id) {
+ auto *V = BM->get<SPIRVValue>(Id);
+ const auto *ConstValue =
+ dyn_cast<ConstantInt>(transValue(V, nullptr, nullptr));
+ if (!ConstValue)
+ return {};
+ return ConstValue->getZExtValue();
+}
+
+std::optional<uint64_t> SPIRVToLLVM::getAlignment(SPIRVValue *V) {
+ SPIRVWord AlignmentBytes = 0;
+ if (V->hasAlignment(&AlignmentBytes)) {
+ return AlignmentBytes;
+ }
+
+ // If there was no Alignment decoration, look for AlignmentId instead.
+ SPIRVId AlignId;
+ if (V->hasDecorateId(DecorationAlignmentId, 0, &AlignId)) {
+ return transIdAsConstant(AlignId);
+ }
+ return {};
+}
+
Type *SPIRVToLLVM::transFPType(SPIRVType *T) {
switch (T->getFloatBitWidth()) {
case 16:
@@ -1504,6 +1527,21 @@
return mapValue(BV, ConstantStruct::get(BCCTy, CV));
}
+ case OpTypeCooperativeMatrixKHR: {
+ assert(CV.size() == 1 &&
+ "expecting exactly one operand for cooperative matrix types");
+ llvm::Type *RetTy = transType(BCC->getType());
+ llvm::Type *EltTy = transType(
+ static_cast<const SPIRVTypeCooperativeMatrixKHR *>(BV->getType())
+ ->getCompType());
+ auto *FTy = FunctionType::get(RetTy, {EltTy}, false);
+ FunctionCallee Func =
+ M->getOrInsertFunction(getSPIRVFuncName(OC, RetTy), FTy);
+ IRBuilder<> Builder(BB);
+ CallInst *Call = Builder.CreateCall(Func, CV.front());
+ Call->setCallingConv(CallingConv::SPIR_FUNC);
+ return Call;
+ }
default:
llvm_unreachable("not implemented");
return nullptr;
@@ -1543,6 +1581,15 @@
case OpUndef:
return mapValue(BV, UndefValue::get(transType(BV->getType())));
+ case OpSizeOf: {
+ Type *ResTy = transType(BV->getType());
+ auto *BI = static_cast<SPIRVSizeOf *>(BV);
+ SPIRVType *TypeArg = reinterpret_cast<SPIRVType *>(BI->getOpValue(0));
+ Type *EltTy = transType(TypeArg->getPointerElementType());
+ uint64_t Size = M->getDataLayout().getTypeStoreSize(EltTy).getFixedValue();
+ return mapValue(BV, ConstantInt::get(ResTy, Size));
+ }
+
case OpVariable: {
auto *BVar = static_cast<SPIRVVariable *>(BV);
auto *PreTransTy = BVar->getType()->getPointerElementType();
@@ -2150,7 +2197,22 @@
}
case OpCopyLogical: {
SPIRVCopyLogical *CL = static_cast<SPIRVCopyLogical *>(BV);
- return mapValue(BV, transSPIRVBuiltinFromInst(CL, BB));
+
+ auto *SrcTy = transType(CL->getOperand()->getType());
+ auto *DstTy = transType(CL->getType());
+
+ assert(M->getDataLayout().getTypeStoreSize(SrcTy).getFixedValue() ==
+ M->getDataLayout().getTypeStoreSize(DstTy).getFixedValue() &&
+ "Size mismatch in OpCopyLogical");
+
+ IRBuilder<> Builder(BB);
+
+ auto *SrcAI = Builder.CreateAlloca(SrcTy);
+ Builder.CreateAlignedStore(transValue(CL->getOperand(), F, BB), SrcAI,
+ SrcAI->getAlign());
+
+ auto *LI = Builder.CreateAlignedLoad(DstTy, SrcAI, SrcAI->getAlign());
+ return mapValue(BV, LI);
}
case OpAccessChain:
@@ -2478,8 +2540,11 @@
case OpExtInst: {
auto *ExtInst = static_cast<SPIRVExtInst *>(BV);
switch (ExtInst->getExtSetKind()) {
- case SPIRVEIS_OpenCL:
- return mapValue(BV, transOCLBuiltinFromExtInst(ExtInst, BB));
+ case SPIRVEIS_OpenCL: {
+ auto *V = mapValue(BV, transOCLBuiltinFromExtInst(ExtInst, BB));
+ applyFPFastMathModeDecorations(BV, static_cast<Instruction *>(V));
+ return V;
+ }
case SPIRVEIS_Debug:
case SPIRVEIS_OpenCL_DebugInfo_100:
case SPIRVEIS_NonSemantic_Shader_DebugInfo_100:
@@ -3062,9 +3127,9 @@
SPIRVWord MaxOffset = 0;
if (BA->hasDecorate(DecorationMaxByteOffset, 0, &MaxOffset))
Builder.addDereferenceableAttr(MaxOffset);
- SPIRVWord AlignmentBytes = 0;
- if (BA->hasDecorate(DecorationAlignment, 0, &AlignmentBytes))
- Builder.addAlignmentAttr(AlignmentBytes);
+ if (auto Alignment = getAlignment(BA)) {
+ Builder.addAlignmentAttr(*Alignment);
+ }
I->addAttrs(Builder);
}
BF->foreachReturnValueAttr([&](SPIRVFuncParamAttrKind Kind) {
@@ -3074,6 +3139,49 @@
});
}
+namespace {
+// One basic block can be a predecessor to another basic block more than
+// once (https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/2702).
+// This function fixes any PHIs that break this rule.
+static void validatePhiPredecessors(Function *F) {
+ for (BasicBlock &BB : *F) {
+ bool UniquePreds = true;
+ DenseMap<BasicBlock *, unsigned> PredsCnt;
+ for (BasicBlock *PredBB : predecessors(&BB)) {
+ auto It = PredsCnt.try_emplace(PredBB, 1);
+ if (!It.second) {
+ UniquePreds = false;
+ ++It.first->second;
+ }
+ }
+ if (UniquePreds)
+ continue;
+ // `phi` requires an incoming value per each predecessor instance, even
+ // it's the same basic block that has been already inserted as an incoming
+ // value of the `phi`.
+ for (PHINode &Phi : BB.phis()) {
+ SmallVector<Value *> Vs;
+ SmallVector<BasicBlock *> Bs;
+ SmallPtrSet<BasicBlock *, 8> UsedB;
+ for (auto [V, B] : zip(Phi.incoming_values(), Phi.blocks())) {
+ if (!UsedB.insert(B).second)
+ continue;
+ unsigned N = PredsCnt[B];
+ Vs.insert(Vs.end(), N, V);
+ Bs.insert(Bs.end(), N, B);
+ }
+ unsigned I = 0;
+ for (unsigned N = Phi.getNumIncomingValues(); I < N; ++I) {
+ Phi.setIncomingValue(I, Vs[I]);
+ Phi.setIncomingBlock(I, Bs[I]);
+ }
+ for (unsigned N = Vs.size(); I < N; ++I)
+ Phi.addIncoming(Vs[I], Bs[I]);
+ }
+ }
+}
+} // namespace
+
Function *SPIRVToLLVM::transFunction(SPIRVFunction *BF, unsigned AS) {
auto Loc = FuncMap.find(BF);
if (Loc != FuncMap.end())
@@ -3158,6 +3266,7 @@
}
}
+ validatePhiPredecessors(F);
transLLVMLoopMetadata(F);
return F;
@@ -4779,15 +4888,13 @@
bool SPIRVToLLVM::transAlign(SPIRVValue *BV, Value *V) {
if (auto *AL = dyn_cast<AllocaInst>(V)) {
- SPIRVWord Align = 0;
- if (BV->hasAlignment(&Align))
- AL->setAlignment(llvm::Align(Align));
+ if (auto Align = getAlignment(BV))
+ AL->setAlignment(llvm::Align(*Align));
return true;
}
if (auto *GV = dyn_cast<GlobalVariable>(V)) {
- SPIRVWord Align = 0;
- if (BV->hasAlignment(&Align))
- GV->setAlignment(MaybeAlign(Align));
+ if (auto Align = getAlignment(BV))
+ GV->setAlignment(MaybeAlign(*Align));
return true;
}
return true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVReader.h
new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVReader.h
--- old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVReader.h 2024-10-30
11:39:26.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVReader.h 2024-11-28
14:26:55.000000000 +0100
@@ -215,6 +215,13 @@
bool isDirectlyTranslatedToOCL(Op OpCode) const;
MDString *transOCLKernelArgTypeName(SPIRVFunctionParameter *);
+
+ // Attempt to translate Id as a (specialization) constant.
+ std::optional<uint64_t> transIdAsConstant(SPIRVId Id);
+
+ // Return the value of an Alignment or AlignmentId decoration for V.
+ std::optional<uint64_t> getAlignment(SPIRVValue *V);
+
Value *mapFunction(SPIRVFunction *BF, Function *F);
Value *getTranslatedValue(SPIRVValue *BV);
IntrinsicInst *getLifetimeStartIntrinsic(Instruction *I);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
--- old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
2024-10-30 11:39:26.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVToLLVMDbgTran.cpp
2024-11-28 14:26:55.000000000 +0100
@@ -153,8 +153,10 @@
}
void SPIRVToLLVMDbgTran::transDbgInfo(const SPIRVValue *SV, Value *V) {
- // A constant sampler does not have a corresponding SPIRVInstruction.
- if (SV->getOpCode() == OpConstantSampler)
+ // Constant samplers and composites do not have a corresponding
+ // SPIRVInstruction, but they may be mapped to an LLVM Instruction.
+ if (SV->getOpCode() == OpConstantSampler ||
+ SV->getOpCode() == OpConstantComposite)
return;
if (Instruction *I = dyn_cast<Instruction>(V)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVWriter.cpp
new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVWriter.cpp
--- old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/SPIRVWriter.cpp 2024-10-30
11:39:26.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/SPIRVWriter.cpp 2024-11-28
14:26:55.000000000 +0100
@@ -3022,7 +3022,8 @@
if (Opcode == Instruction::FAdd || Opcode == Instruction::FSub ||
Opcode == Instruction::FMul || Opcode == Instruction::FDiv ||
Opcode == Instruction::FRem ||
- ((Opcode == Instruction::FNeg || Opcode == Instruction::FCmp) &&
+ ((Opcode == Instruction::FNeg || Opcode == Instruction::FCmp ||
+ BV->isExtInst()) &&
BM->isAllowedToUseVersion(VersionNumber::SPIRV_1_6))) {
FastMathFlags FMF = BVF->getFastMathFlags();
SPIRVWord M{0};
@@ -3049,8 +3050,52 @@
}
}
}
- if (M != 0)
+ // Handle nofpclass attribute. Nothing to do if fast math flag is already
+ // set.
+ if ((BV->isExtInst() &&
+ static_cast<SPIRVExtInst *>(BV)->getExtSetKind() ==
+ SPIRVEIS_OpenCL) &&
+ BM->isAllowedToUseVersion(VersionNumber::SPIRV_1_6) &&
+ !(M & FPFastMathModeFastMask)) {
+ auto *F = cast<CallInst>(V)->getCalledFunction();
+ auto FAttrs = F->getAttributes();
+ AttributeSet RetAttrs = FAttrs.getRetAttrs();
+ if (RetAttrs.hasAttribute(Attribute::NoFPClass)) {
+ FPClassTest RetTest =
+ RetAttrs.getAttribute(Attribute::NoFPClass).getNoFPClass();
+ AttributeSet RetAttrs = FAttrs.getRetAttrs();
+ // Only Nan and Inf tests are representable in SPIR-V now.
+ bool ToAddNoNan = RetTest & fcNan;
+ bool ToAddNoInf = RetTest & fcInf;
+ if (ToAddNoNan || ToAddNoInf) {
+ const auto *FT = F->getFunctionType();
+ const size_t NumParams = FT->getNumParams();
+ for (size_t I = 0; I != NumParams; ++I) {
+ if (!FT->getParamType(I)->isFloatTy())
+ continue;
+ if (!F->hasParamAttribute(I, Attribute::NoFPClass)) {
+ ToAddNoNan = false;
+ ToAddNoInf = false;
+ break;
+ }
+ FPClassTest ArgTest =
+ FAttrs.getParamAttr(I, Attribute::NoFPClass).getNoFPClass();
+ ToAddNoNan = ToAddNoNan && static_cast<bool>(ArgTest & fcNan);
+ ToAddNoInf = ToAddNoInf && static_cast<bool>(ArgTest & fcInf);
+ }
+ }
+ if (ToAddNoNan)
+ M |= FPFastMathModeNotNaNMask;
+ if (ToAddNoInf)
+ M |= FPFastMathModeNotInfMask;
+ }
+ }
+ if (M != 0) {
BV->setFPFastMathMode(M);
+ if (Opcode == Instruction::FNeg || Opcode == Instruction::FCmp ||
+ BV->isExtInst())
+ BM->setMinSPIRVVersion(VersionNumber::SPIRV_1_6);
+ }
}
}
if (Instruction *Inst = dyn_cast<Instruction>(V)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/libSPIRV/SPIRVEntry.h
new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/libSPIRV/SPIRVEntry.h
--- old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/libSPIRV/SPIRVEntry.h
2024-10-30 11:39:26.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/libSPIRV/SPIRVEntry.h
2024-11-28 14:26:55.000000000 +0100
@@ -1088,7 +1088,6 @@
_SPIRV_OP(MemoryNamedBarrier)
_SPIRV_OP(GetKernelMaxNumSubgroups)
_SPIRV_OP(GetKernelLocalSizeForSubgroupCount)
-_SPIRV_OP(SizeOf)
#undef _SPIRV_OP
} // namespace SPIRV
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/libSPIRV/SPIRVInstruction.h
new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/libSPIRV/SPIRVInstruction.h
--- old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/libSPIRV/SPIRVInstruction.h
2024-10-30 11:39:26.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/libSPIRV/SPIRVInstruction.h
2024-11-28 14:26:55.000000000 +0100
@@ -1548,6 +1548,16 @@
SPIRVId Matrix;
};
+class SPIRVSizeOfInstBase : public SPIRVInstTemplateBase {
+protected:
+ VersionNumber getRequiredSPIRVVersion() const override {
+ return VersionNumber::SPIRV_1_1;
+ }
+};
+
+typedef SPIRVInstTemplate<SPIRVSizeOfInstBase, OpSizeOf, true, 4, false>
+ SPIRVSizeOf;
+
class SPIRVUnary : public SPIRVInstTemplateBase {
protected:
void validate() const override {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h
new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h
--- old/SPIRV-LLVM-Translator-19.1.1/lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h
2024-10-30 11:39:26.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h
2024-11-28 14:26:55.000000000 +0100
@@ -291,6 +291,7 @@
_SPIRV_OP(NoLine, 317)
_SPIRV_OP(AtomicFlagTestAndSet, 318)
_SPIRV_OP(AtomicFlagClear, 319)
+_SPIRV_OP(SizeOf, 321)
_SPIRV_OP(TypePipeStorage, 322)
_SPIRV_OP(ConstantPipeStorage, 323)
_SPIRV_OP(CreatePipeFromPipeStorage, 324)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPIRV-LLVM-Translator-19.1.1/test/AlignmentId.spvasm
new/SPIRV-LLVM-Translator-19.1.2/test/AlignmentId.spvasm
--- old/SPIRV-LLVM-Translator-19.1.1/test/AlignmentId.spvasm 1970-01-01
01:00:00.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/test/AlignmentId.spvasm 2024-11-28
14:26:55.000000000 +0100
@@ -0,0 +1,34 @@
+; REQUIRES: spirv-as
+
+; RUN: spirv-as %s --target-env spv1.2 -o %t.spv
+; RUN: spirv-val %t.spv
+; RUN: llvm-spirv -r -o %t.rev.bc %t.spv
+; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s
+
+ OpCapability Addresses
+ OpCapability Linkage
+ OpCapability Kernel
+ OpMemoryModel Physical64 OpenCL
+ OpEntryPoint Kernel %fn "testAlignmentId"
+ OpName %p "p"
+ OpDecorate %x LinkageAttributes "x" Export
+ OpDecorateId %x AlignmentId %al
+ OpDecorateId %p AlignmentId %al_spec
+ %void = OpTypeVoid
+ %uint = OpTypeInt 32 0
+ %ptr = OpTypePointer CrossWorkgroup %uint
+ %fnTy = OpTypeFunction %void %ptr
+ %al = OpConstant %uint 16
+ %al_spec = OpSpecConstantOp %uint IAdd %al %al
+ %uint_42 = OpConstant %uint 42
+; Verify alignment of variable.
+; CHECK: @x = addrspace(1) global i32 42, align 16
+ %x = OpVariable %ptr CrossWorkgroup %uint_42
+
+ %fn = OpFunction %void None %fnTy
+; Verify alignment of function parameter.
+; CHECK: define spir_kernel void @testAlignmentId(ptr addrspace(1) align 32 %p)
+ %p = OpFunctionParameter %ptr
+ %entry = OpLabel
+ OpReturn
+ OpFunctionEnd
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/test/OpCopyLogical.spvasm
new/SPIRV-LLVM-Translator-19.1.2/test/OpCopyLogical.spvasm
--- old/SPIRV-LLVM-Translator-19.1.1/test/OpCopyLogical.spvasm 2024-10-30
11:39:26.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/test/OpCopyLogical.spvasm 2024-11-28
14:26:55.000000000 +0100
@@ -22,4 +22,6 @@
OpReturn
OpFunctionEnd
-; CHECK-LLVM: @_Z19__spirv_CopyLogical12structtype.0(ptr sret(%structtype)
%[[#]], %structtype.0 zeroinitializer)
+; CHECK-LLVM: [[ALLOCA:%[a-z0-9.]+]] = alloca [[SRC_TYPE:%[a-z0-9.]+]], align 8
+; CHECK-LLVM: store [[SRC_TYPE]] zeroinitializer, ptr [[ALLOCA]], align 8
+; CHECK-LLVM: [[DST:%[a-z0-9.]+]] = load [[DST_TYPE:%[a-z0-9.]+]], ptr
[[ALLOCA]], align 8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPIRV-LLVM-Translator-19.1.1/test/OpSizeOf.spvasm
new/SPIRV-LLVM-Translator-19.1.2/test/OpSizeOf.spvasm
--- old/SPIRV-LLVM-Translator-19.1.1/test/OpSizeOf.spvasm 1970-01-01
01:00:00.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/test/OpSizeOf.spvasm 2024-11-28
14:26:55.000000000 +0100
@@ -0,0 +1,33 @@
+; REQUIRES: spirv-as
+; RUN: spirv-as --target-env spv1.1 -o %t.spv %s
+; TODO: reenable spirv-val when OpSizeOf is supported.
+; R/U/N: spirv-val %t.spv
+; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s
+ OpCapability Addresses
+ OpCapability Kernel
+ OpMemoryModel Physical64 OpenCL
+ OpEntryPoint Kernel %f "testSizeOf"
+ OpName %p "p"
+ %void = OpTypeVoid
+ %bool = OpTypeBool
+ %i32 = OpTypeInt 32 0
+ %struct = OpTypeStruct %i32 %i32
+%_ptr_CrossWorkgroup_bool = OpTypePointer CrossWorkgroup %bool
+%_ptr_CrossWorkgroup_i32 = OpTypePointer CrossWorkgroup %i32
+%_ptr_CrossWorkgroup_struct = OpTypePointer CrossWorkgroup %struct
+ %fnTy = OpTypeFunction %void %_ptr_CrossWorkgroup_i32
+
+ %f = OpFunction %void None %fnTy
+ %p = OpFunctionParameter %_ptr_CrossWorkgroup_i32
+ %10 = OpLabel
+
+; CHECK: store i32 1, ptr addrspace(1) %p
+ %11 = OpSizeOf %i32 %_ptr_CrossWorkgroup_bool
+ OpStore %p %11
+
+; CHECK: store i32 8, ptr addrspace(1) %p
+ %12 = OpSizeOf %i32 %_ptr_CrossWorkgroup_struct
+ OpStore %p %12
+
+ OpReturn
+ OpFunctionEnd
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/test/extensions/KHR/SPV_KHR_cooperative_matrix/constant_composite.spvasm
new/SPIRV-LLVM-Translator-19.1.2/test/extensions/KHR/SPV_KHR_cooperative_matrix/constant_composite.spvasm
---
old/SPIRV-LLVM-Translator-19.1.1/test/extensions/KHR/SPV_KHR_cooperative_matrix/constant_composite.spvasm
1970-01-01 01:00:00.000000000 +0100
+++
new/SPIRV-LLVM-Translator-19.1.2/test/extensions/KHR/SPV_KHR_cooperative_matrix/constant_composite.spvasm
2024-11-28 14:26:55.000000000 +0100
@@ -0,0 +1,30 @@
+; REQUIRES: spirv-as
+; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
+; TODO: re-enable spirv-val
+; R/U/N: spirv-val %t.spv
+; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s
+
+OpCapability Addresses
+OpCapability Kernel
+OpCapability CooperativeMatrixKHR
+OpExtension "SPV_KHR_cooperative_matrix"
+OpMemoryModel Physical64 OpenCL
+OpEntryPoint Kernel %1 "testCoopMat"
+%void = OpTypeVoid
+%uint = OpTypeInt 32 0
+%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
+%fnTy = OpTypeFunction %void %_ptr_CrossWorkgroup_uint
+%uint_0 = OpConstant %uint 0
+%uint_3 = OpConstant %uint 3
+%uint_8 = OpConstant %uint 8
+%uint_42 = OpConstant %uint 42
+%matTy = OpTypeCooperativeMatrixKHR %uint %uint_3 %uint_8 %uint_8 %uint_0
+%matConst = OpConstantComposite %matTy %uint_42
+%1 = OpFunction %void None %fnTy
+%outPtr = OpFunctionParameter %_ptr_CrossWorkgroup_uint
+%2 = OpLabel
+OpCooperativeMatrixStoreKHR %outPtr %matConst %uint_0 %uint_8
+OpReturn
+OpFunctionEnd
+
+; CHECK: call spir_func target("spirv.CooperativeMatrixKHR", i32, 3, 8, 8, 0)
@__spirv_ConstantComposite_RPU3AS142__spirv_CooperativeMatrixKHR__uint_3_8_8_0(i32
42)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/test/phi-multiple-predecessors-invalid-input.spvasm
new/SPIRV-LLVM-Translator-19.1.2/test/phi-multiple-predecessors-invalid-input.spvasm
---
old/SPIRV-LLVM-Translator-19.1.1/test/phi-multiple-predecessors-invalid-input.spvasm
1970-01-01 01:00:00.000000000 +0100
+++
new/SPIRV-LLVM-Translator-19.1.2/test/phi-multiple-predecessors-invalid-input.spvasm
2024-11-28 14:26:55.000000000 +0100
@@ -0,0 +1,41 @@
+; The goal of the test case is to ensure that PHI node has an incoming value
per each predecessor
+; instance even if the input SPIR-V module is invalid as reported by spirv-val.
+
+; We don't run spirv-val on this module therefore.
+
+; REQUIRES: spirv-as
+; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
+; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s
+
+ OpCapability Kernel
+ OpCapability Addresses
+ OpCapability Int64
+ OpCapability Linkage
+ %1 = OpExtInstImport "OpenCL.std"
+ OpMemoryModel Physical64 OpenCL
+ OpSource OpenCL_CPP 100000
+ OpName %foo "foo"
+ OpName %get "get"
+ OpDecorate %foo LinkageAttributes "foo" Export
+ OpDecorate %get LinkageAttributes "get" Import
+ %uint = OpTypeInt 32 0
+ %3 = OpTypeFunction %uint
+ %ulong = OpTypeInt 64 0
+ %uint_2 = OpConstant %uint 2
+ %uint_4 = OpConstant %uint 4
+ %get = OpFunction %uint None %3
+ OpFunctionEnd
+ %foo = OpFunction %uint None %3
+ %11 = OpLabel
+ %9 = OpFunctionCall %uint %get
+ OpSwitch %9 %12 10 %13 4 %13 0 %13 42 %13
+ %12 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ %10 = OpPhi %uint %uint_4 %11 %uint_4 %11 %uint_4 %11 %uint_4 %11
%uint_2 %12
+ %14 = OpPhi %uint %uint_2 %12 %uint_4 %11 %uint_4 %11 %uint_4 %11
%uint_4 %11
+ OpReturnValue %14
+ OpFunctionEnd
+
+; CHECK: phi i32 [ 4, %0 ], [ 4, %0 ], [ 4, %0 ], [ 4, %0 ], [ 2, %2 ]
+; CHECK: phi i32 [ 2, %2 ], [ 4, %0 ], [ 4, %0 ], [ 4, %0 ], [ 4, %0 ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/test/phi-multiple-predecessors.spvasm
new/SPIRV-LLVM-Translator-19.1.2/test/phi-multiple-predecessors.spvasm
--- old/SPIRV-LLVM-Translator-19.1.1/test/phi-multiple-predecessors.spvasm
1970-01-01 01:00:00.000000000 +0100
+++ new/SPIRV-LLVM-Translator-19.1.2/test/phi-multiple-predecessors.spvasm
2024-11-28 14:26:55.000000000 +0100
@@ -0,0 +1,37 @@
+; REQUIRES: spirv-as
+; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
+; RUN: spirv-val %t.spv
+; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s
+
+ OpCapability Kernel
+ OpCapability Addresses
+ OpCapability Int64
+ OpCapability Linkage
+ %1 = OpExtInstImport "OpenCL.std"
+ OpMemoryModel Physical64 OpenCL
+ OpSource OpenCL_CPP 100000
+ OpName %foo "foo"
+ OpName %get "get"
+ OpDecorate %foo LinkageAttributes "foo" Export
+ OpDecorate %get LinkageAttributes "get" Import
+ %uint = OpTypeInt 32 0
+ %3 = OpTypeFunction %uint
+ %ulong = OpTypeInt 64 0
+ %uint_2 = OpConstant %uint 2
+ %uint_4 = OpConstant %uint 4
+ %get = OpFunction %uint None %3
+ OpFunctionEnd
+ %foo = OpFunction %uint None %3
+ %11 = OpLabel
+ %9 = OpFunctionCall %uint %get
+ OpSwitch %9 %12 10 %13 4 %13 0 %13 42 %13
+ %12 = OpLabel
+ OpBranch %13
+ %13 = OpLabel
+ %10 = OpPhi %uint %uint_4 %11 %uint_2 %12
+ %14 = OpPhi %uint %uint_2 %12 %uint_4 %11
+ OpReturnValue %14
+ OpFunctionEnd
+
+; CHECK: phi i32 [ 4, %0 ], [ 4, %0 ], [ 4, %0 ], [ 4, %0 ], [ 2, %2 ]
+; CHECK: phi i32 [ 2, %2 ], [ 4, %0 ], [ 4, %0 ], [ 4, %0 ], [ 4, %0 ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPIRV-LLVM-Translator-19.1.1/test/transcoding/fast-math-opencl-builtins.ll
new/SPIRV-LLVM-Translator-19.1.2/test/transcoding/fast-math-opencl-builtins.ll
---
old/SPIRV-LLVM-Translator-19.1.1/test/transcoding/fast-math-opencl-builtins.ll
1970-01-01 01:00:00.000000000 +0100
+++
new/SPIRV-LLVM-Translator-19.1.2/test/transcoding/fast-math-opencl-builtins.ll
2024-11-28 14:26:55.000000000 +0100
@@ -0,0 +1,98 @@
+; RUN: llvm-as %s -o %t.bc
+; RUN: llvm-spirv -spirv-text %t.bc -o - | FileCheck %s
--check-prefix=CHECK-SPIRV
+; RUN: llvm-spirv %t.bc -o %t.spv
+; RUN: spirv-val %t.spv
+; RUN: llvm-spirv -r %t.spv -o - | llvm-dis -o - | FileCheck %s
--check-prefix=CHECK-LLVM-OCL
+; RUN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o - | llvm-dis -o - |
FileCheck %s --check-prefix=CHECK-LLVM-SPV
+
+; RUN: llvm-spirv -spirv-text --spirv-max-version=1.5 %t.bc -o - | FileCheck
%s --check-prefix=CHECK-SPIRV-NEG
+
+; CHECK-SPIRV: Decorate [[#FPDec1:]] FPFastMathMode 3
+; CHECK-SPIRV: Decorate [[#FPDec2:]] FPFastMathMode 2
+; CHECK-SPIRV: Decorate [[#FPDec3:]] FPFastMathMode 3
+; CHECK-SPIRV: Decorate [[#FPDec4:]] FPFastMathMode 16
+; CHECK-SPIRV: ExtInst [[#]] [[#FPDec1]] [[#]] fmax [[#]] [[#]]
+; CHECK-SPIRV: ExtInst [[#]] [[#FPDec2]] [[#]] fmin [[#]] [[#]]
+; CHECK-SPIRV: ExtInst [[#]] [[#FPDec3]] [[#]] ldexp [[#]] [[#]]
+; CHECK-SPIRV: ExtInst [[#]] [[#FPDec4]] [[#]] fmax [[#]] [[#]]
+
+; CHECK-SPIRV-NEG-NOT: Decorate [[#]] FPFastMathMode [[#]]
+
+; CHECK-LLVM-OCL: call nnan ninf spir_func float @_Z4fmaxff(float %[[#]],
float %[[#]])
+; CHECK-LLVM-OCL: call ninf spir_func float @_Z4fminff(float %[[#]], float
%[[#]])
+; CHECK-LLVM-OCL: call nnan ninf spir_func float @_Z5ldexpfi(float %[[#]], i32
%[[#]])
+; CHECK-LLVM-OCL: call fast spir_func float @_Z4fmaxff(float %[[#]], float
%[[#]])
+
+; CHECK-LLVM-SPV: call nnan ninf spir_func float @_Z16__spirv_ocl_fmaxff(float
%[[#]], float %[[#]])
+; CHECK-LLVM-SPV: call ninf spir_func float @_Z16__spirv_ocl_fminff(float
%[[#]], float %[[#]])
+; CHECK-LLVM-SPV: call nnan ninf spir_func float
@_Z17__spirv_ocl_ldexpfi(float %[[#]], i32 %[[#]])
+; CHECK-LLVM-SPV: call fast spir_func float @_Z16__spirv_ocl_fmaxff(float
%[[#]], float %[[#]])
+
+; ModuleID = 'test.bc'
+source_filename = "test.cpp"
+target datalayout =
"e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
+target triple = "spir64-unknown-unknown"
+
+@__spirv_BuiltInGlobalInvocationId = external dso_local local_unnamed_addr
addrspace(1) constant <3 x i64>, align 32
+
+declare dso_local spir_func noundef nofpclass(nan inf) float
@_Z16__spirv_ocl_fmaxff(float noundef nofpclass(nan inf), float noundef
nofpclass(nan inf)) local_unnamed_addr
+
+declare dso_local spir_func noundef nofpclass(nan inf) float
@_Z16__spirv_ocl_fminff(float noundef nofpclass(inf), float noundef
nofpclass(nan inf)) local_unnamed_addr
+
+declare dso_local spir_func noundef nofpclass(nan inf) float
@_Z17__spirv_ocl_ldexpfi(float noundef nofpclass(nan inf), i32 noundef)
+
+define weak_odr dso_local spir_kernel void @nofpclass_all(ptr addrspace(1)
noundef align 4 %_arg_data, ptr addrspace(1) noundef align 4 %_arg_dat1, ptr
addrspace(1) noundef align 4 %_arg_dat2) local_unnamed_addr {
+entry:
+ %0 = load i64, ptr addrspace(1) @__spirv_BuiltInGlobalInvocationId, align 32
+ %arrayidx.i = getelementptr inbounds float, ptr addrspace(1) %_arg_data, i64
%0
+ %arrayidx3.i = getelementptr inbounds float, ptr addrspace(1) %_arg_dat1,
i64 %0
+ %cmp.i = icmp ult i64 %0, 2147483648
+ %arrayidx5.i = getelementptr inbounds float, ptr addrspace(1) %_arg_dat2,
i64 %0
+ %1 = load float, ptr addrspace(1) %arrayidx3.i, align 4
+ %2 = load float, ptr addrspace(1) %arrayidx5.i, align 4
+ %call.i.i = tail call spir_func noundef nofpclass(nan inf) float
@_Z16__spirv_ocl_fmaxff(float noundef nofpclass(nan inf) %1, float noundef
nofpclass(nan inf) %2)
+ store float %call.i.i, ptr addrspace(1) %arrayidx.i, align 4
+ ret void
+}
+
+define weak_odr dso_local spir_kernel void @nofpclass_part(ptr addrspace(1)
noundef align 4 %_arg_data, ptr addrspace(1) noundef align 4 %_arg_dat1, ptr
addrspace(1) noundef align 4 %_arg_dat2) local_unnamed_addr {
+entry:
+ %0 = load i64, ptr addrspace(1) @__spirv_BuiltInGlobalInvocationId, align 32
+ %arrayidx.i = getelementptr inbounds float, ptr addrspace(1) %_arg_data, i64
%0
+ %arrayidx3.i = getelementptr inbounds float, ptr addrspace(1) %_arg_dat1,
i64 %0
+ %cmp.i = icmp ult i64 %0, 2147483648
+ %arrayidx5.i = getelementptr inbounds float, ptr addrspace(1) %_arg_dat2,
i64 %0
+ %1 = load float, ptr addrspace(1) %arrayidx3.i, align 4
+ %2 = load float, ptr addrspace(1) %arrayidx5.i, align 4
+ %call.i.i = tail call spir_func noundef nofpclass(nan inf) float
@_Z16__spirv_ocl_fminff(float noundef nofpclass(inf) %1, float noundef
nofpclass(nan inf) %2)
+ store float %call.i.i, ptr addrspace(1) %arrayidx.i, align 4
+ ret void
+}
+
+define weak_odr dso_local spir_kernel void @nofpclass_int(ptr addrspace(1)
noundef align 4 %_arg_data, ptr addrspace(1) noundef align 4 %_arg_dat1, ptr
addrspace(1) noundef align 4 %_arg_dat2) local_unnamed_addr {
+entry:
+ %0 = load i64, ptr addrspace(1) @__spirv_BuiltInGlobalInvocationId, align 32
+ %arrayidx.i = getelementptr inbounds float, ptr addrspace(1) %_arg_data, i64
%0
+ %arrayidx3.i = getelementptr inbounds float, ptr addrspace(1) %_arg_dat1,
i64 %0
+ %cmp.i = icmp ult i64 %0, 2147483648
+ %arrayidx5.i = getelementptr inbounds i32, ptr addrspace(1) %_arg_dat2, i64
%0
+ %1 = load float, ptr addrspace(1) %arrayidx3.i, align 4
+ %2 = load i32, ptr addrspace(1) %arrayidx5.i, align 4
+ %call.i.i = tail call spir_func noundef nofpclass(nan inf) float
@_Z17__spirv_ocl_ldexpfi(float noundef nofpclass(inf) %1, i32 noundef %2)
+ store float %call.i.i, ptr addrspace(1) %arrayidx.i, align 4
+ ret void
+}
+
+define weak_odr dso_local spir_kernel void @nofpclass_fast(ptr addrspace(1)
noundef align 4 %_arg_data, ptr addrspace(1) noundef align 4 %_arg_dat1, ptr
addrspace(1) noundef align 4 %_arg_dat2) local_unnamed_addr {
+entry:
+ %0 = load i64, ptr addrspace(1) @__spirv_BuiltInGlobalInvocationId, align 32
+ %arrayidx.i = getelementptr inbounds float, ptr addrspace(1) %_arg_data, i64
%0
+ %arrayidx3.i = getelementptr inbounds float, ptr addrspace(1) %_arg_dat1,
i64 %0
+ %cmp.i = icmp ult i64 %0, 2147483648
+ %arrayidx5.i = getelementptr inbounds float, ptr addrspace(1) %_arg_dat2,
i64 %0
+ %1 = load float, ptr addrspace(1) %arrayidx3.i, align 4
+ %2 = load float, ptr addrspace(1) %arrayidx5.i, align 4
+ %call.i.i = tail call fast spir_func noundef nofpclass(nan inf) float
@_Z16__spirv_ocl_fmaxff(float noundef nofpclass(nan inf) %1, float noundef
nofpclass(nan inf) %2)
+ store float %call.i.i, ptr addrspace(1) %arrayidx.i, align 4
+ ret void
+}