Skip to content

Commit 2b95385

Browse files
committed
Revert "Add validation of vloada_half instruction (#1138)"
This reverts commit 1a7f142. The vloada_halfn functions return float vectors: floatn vloada_halfn(size_t offset, const __global half *p) floatn vloada_halfn(size_t offset, const __local half *p) floatn vloada_halfn(size_t offset, const __constant half *p) floatn vloada_halfn(size_t offset, const __private half *p) For the generic address space: floatn vloada_halfn(size_t offset, const half *p) These functions exist specifically for implementations that lack the cl_khr_fp16 extension, and so do not include the halfn vector types, but do include a scalar half type for use as a pointer argument *only*. Likewise, in the SPIR-V OpenCL Extended Instruction Set, the result type for vloada_halfn is defined as follows: Result Type must be vector(2,3,4,8,16) of float values. The assertion added to isBuiltinTransToExtInst(...) is therefore incorrect. The vloada_halfn SPIR-V OpenCL Extended Instruction Set instructions that are emitted for calls to these builtins are accepted by the SPIR-V Validator.
1 parent a10c012 commit 2b95385

File tree

4 files changed

+0
-86
lines changed

4 files changed

+0
-86
lines changed

lib/SPIRV/SPIRVToOCL.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,6 @@ void SPIRVToOCLBase::visitCallSPIRVVLoadn(CallInst *CI, OCLExtOpKind Kind) {
982982
std::string Name = OCLExtOpMap::map(Kind);
983983
if (ConstantInt *C = dyn_cast<ConstantInt>(Args.back())) {
984984
uint64_t NumComponents = C->getZExtValue();
985-
assert(NumComponents > 1 &&
986-
"vloada_halfn instruction is not for scalar types");
987985
std::stringstream SS;
988986
SS << NumComponents;
989987
Name.replace(Name.find("n"), 1, SS.str());

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,6 @@ bool LLVMToSPIRVBase::isBuiltinTransToExtInst(
208208
OCLExtOpKind EOC;
209209
if (!OCLExtOpMap::rfind(Splited.first.str(), &EOC))
210210
return false;
211-
if (EOC == OpenCLLIB::Vloada_halfn) {
212-
auto *VecTy = dyn_cast<VectorType>(F->getReturnType());
213-
if (!VecTy)
214-
BM->getErrorLog().checkError(
215-
false, SPIRVEC_InvalidModule,
216-
"vloada_half should be of a half vector type");
217-
auto *Ty = VecTy->getElementType();
218-
BM->getErrorLog().checkError(Ty->isHalfTy(), SPIRVEC_InvalidModule,
219-
"vloada_half should be of a half vector type");
220-
}
221211

222212
if (ExtSet)
223213
*ExtSet = Set;

test/negative/invalid-vloada-half-scalar.ll

Lines changed: 0 additions & 37 deletions
This file was deleted.

test/negative/invalid-vloada-half-vector.ll

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)