Skip to content

Commit

Permalink
Revert "Add support for SPV_INTEL_fpga_buffer_location extension"
Browse files Browse the repository at this point in the history
This reverts commit f71cec5.
  • Loading branch information
MrSidims committed Jul 31, 2020
1 parent 5c30093 commit ab5b6da
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 118 deletions.
1 change: 0 additions & 1 deletion llvm-spirv/include/LLVMSPIRVExtensions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ EXT(SPV_INTEL_optimization_hints)
EXT(SPV_INTEL_float_controls2)
EXT(SPV_INTEL_vector_compute)
EXT(SPV_INTEL_usm_storage_classes)
EXT(SPV_INTEL_fpga_buffer_location)
30 changes: 0 additions & 30 deletions llvm-spirv/lib/SPIRV/SPIRVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,27 +168,6 @@ static void addOCLKernelArgumentMetadata(
Fn->setMetadata(MDName, MDNode::get(*Context, ValueVec));
}

static void addBufferLocationMetadata(
LLVMContext *Context, SPIRVFunction *BF, llvm::Function *Fn,
std::function<Metadata *(SPIRVFunctionParameter *)> Func) {
std::vector<Metadata *> ValueVec;
bool DecorationFound = false;
BF->foreachArgument([&](SPIRVFunctionParameter *Arg) {
if (Arg->getType()->isTypePointer() &&
Arg->hasDecorate(DecorationBufferLocationINTEL)) {
DecorationFound = true;
ValueVec.push_back(Func(Arg));
} else {
llvm::Metadata *DefaultNode = ConstantAsMetadata::get(
ConstantInt::get(Type::getInt32Ty(*Context), -1));
ValueVec.push_back(DefaultNode);
}
});
if (DecorationFound)
Fn->setMetadata("kernel_arg_buffer_location",
MDNode::get(*Context, ValueVec));
}

Value *SPIRVToLLVM::getTranslatedValue(SPIRVValue *BV) {
auto Loc = ValueMap.find(BV);
if (Loc != ValueMap.end())
Expand Down Expand Up @@ -3540,15 +3519,6 @@ bool SPIRVToLLVM::transOCLMetadata(SPIRVFunction *BF) {
Arg->getName());
});
}
// Generate metadata for kernel_arg_buffer_location
addBufferLocationMetadata(Context, BF, F, [=](SPIRVFunctionParameter *Arg) {
auto Literals = Arg->getDecorationLiterals(DecorationBufferLocationINTEL);
assert(Literals.size() == 1 &&
"BufferLocationINTEL decoration shall have 1 ID literal");

return ConstantAsMetadata::get(
ConstantInt::get(Type::getInt32Ty(*Context), Literals[0]));
});
return true;
}

Expand Down
16 changes: 0 additions & 16 deletions llvm-spirv/lib/SPIRV/SPIRVWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,6 @@ SPIRVFunction *LLVMToSPIRV::transFunctionDecl(Function *F) {
BM->addEntryPoint(ExecutionModelKernel, BF->getId());
else if (F->getLinkage() != GlobalValue::InternalLinkage)
BF->setLinkageType(transLinkageType(F));

// Translate OpenCL/SYCL buffer_location metadata if it's attached to the
// translated function declaration
MDNode *BufferLocation = nullptr;
if (BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_fpga_buffer_location))
BufferLocation = ((*F).getMetadata("kernel_arg_buffer_location"));

auto Attrs = F->getAttributes();

for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E;
Expand All @@ -559,15 +552,6 @@ SPIRVFunction *LLVMToSPIRV::transFunctionDecl(Function *F) {
BA->addDecorate(DecorationMaxByteOffset,
Attrs.getAttribute(ArgNo + 1, Attribute::Dereferenceable)
.getDereferenceableBytes());
if (BufferLocation && I->getType()->isPointerTy()) {
// Order of integer numbers in MD node follows the order of function
// parameters on which we shall attach the appropriate decoration. Add
// decoration only if MD value is not negative.
BM->addCapability(CapabilityFPGABufferLocationINTEL);
int LocID = getMDOperandAsInt(BufferLocation, ArgNo);
if (LocID >= 0)
BA->addDecorate(DecorationBufferLocationINTEL, LocID);
}
}
if (Attrs.hasAttribute(AttributeList::ReturnIndex, Attribute::ZExt))
BF->addDecorate(DecorationFuncParamAttr, FunctionParameterAttributeZext);
Expand Down
4 changes: 0 additions & 4 deletions llvm-spirv/lib/SPIRV/libSPIRV/SPIRVDecorate.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ class SPIRVDecorate : public SPIRVDecorateGeneric {
return getSet(ExtensionID::SPV_INTEL_function_pointers);
case DecorationIOPipeStorageINTEL:
return getSet(ExtensionID::SPV_INTEL_io_pipes);
case DecorationBufferLocationINTEL:
return getSet(ExtensionID::SPV_INTEL_fpga_buffer_location);
default:
return SPIRVExtSet();
}
Expand Down Expand Up @@ -269,8 +267,6 @@ class SPIRVMemberDecorate : public SPIRVDecorateGeneric {
return getSet(ExtensionID::SPV_INTEL_fpga_memory_accesses);
case DecorationIOPipeStorageINTEL:
return getSet(ExtensionID::SPV_INTEL_io_pipes);
case DecorationBufferLocationINTEL:
return getSet(ExtensionID::SPV_INTEL_fpga_buffer_location);
default:
return SPIRVExtSet();
}
Expand Down
2 changes: 0 additions & 2 deletions llvm-spirv/lib/SPIRV/libSPIRV/SPIRVEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,6 @@ template <> inline void SPIRVMap<Decoration, SPIRVCapVec>::init() {
ADD_VEC_INIT(DecorationDontStaticallyCoalesceINTEL,
{CapabilityFPGAMemoryAccessesINTEL});
ADD_VEC_INIT(DecorationPrefetchINTEL, {CapabilityFPGAMemoryAccessesINTEL});
ADD_VEC_INIT(DecorationBufferLocationINTEL,
{CapabilityFPGABufferLocationINTEL});
}

template <> inline void SPIRVMap<BuiltIn, SPIRVCapVec>::init() {
Expand Down
2 changes: 0 additions & 2 deletions llvm-spirv/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ template <> inline void SPIRVMap<Decoration, std::string>::init() {
add(DecorationGlobalVariableOffsetINTEL, "GlobalVariableOffsetINTEL");
add(DecorationFuncParamIOKind, "FuncParamIOKind");
add(DecorationSIMTCallINTEL, "SIMTCallINTEL");
add(DecorationBufferLocationINTEL, "BufferLocationINTEL");
}
SPIRV_DEF_NAMEMAP(Decoration, SPIRVDecorationNameMap)

Expand Down Expand Up @@ -561,7 +560,6 @@ template <> inline void SPIRVMap<Capability, std::string>::init() {
"GroupNonUniformShuffleRelative");
add(CapabilityGroupNonUniformClustered, "GroupNonUniformClustered");
add(CapabilityUSMStorageClassesINTEL, "USMStorageClassesINTEL");
add(CapabilityFPGABufferLocationINTEL, "FPGABufferLocationINTEL");
}
SPIRV_DEF_NAMEMAP(Capability, SPIRVCapabilityNameMap)

Expand Down
2 changes: 0 additions & 2 deletions llvm-spirv/lib/SPIRV/libSPIRV/spirv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ enum Decoration {
DecorationCacheSizeINTEL = 5900,
DecorationDontStaticallyCoalesceINTEL = 5901,
DecorationPrefetchINTEL = 5902,
DecorationBufferLocationINTEL = 5921,
DecorationIOPipeStorageINTEL = 5944,
DecorationMax = 0x7fffffff,
};
Expand Down Expand Up @@ -963,7 +962,6 @@ enum Capability {
CapabilityFPGARegINTEL = 5948,
CapabilityKernelAttributesINTEL = 5892,
CapabilityFPGAKernelAttributesINTEL = 5897,
CapabilityFPGABufferLocationINTEL = 5920,
CapabilityUSMStorageClassesINTEL = 5935,
CapabilityFPGAMemoryAccessesINTEL = 5898,
CapabilityIOPipeINTEL = 5943,
Expand Down
61 changes: 0 additions & 61 deletions llvm-spirv/test/transcoding/FPGABufferLocation.ll

This file was deleted.

0 comments on commit ab5b6da

Please sign in to comment.