Skip to content

Commit 1a0c429

Browse files
michalpaszkowskiigcbot
authored andcommitted
Disable building legacy SPIR-V Reader
IGC switched to using the upstream Khronos LLVM/SPIR-V Translator for reading SPIR-V. The legacy fork is unused and can be removed. This PR disables building the legacy SPIR-V Reader.
1 parent 7317ee4 commit 1a0c429

File tree

74 files changed

+96
-20934
lines changed

Some content is hidden

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

74 files changed

+96
-20934
lines changed

IGC/AdaptorCommon/ProcessFuncAttributes.cpp

+39-14
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ SPDX-License-Identifier: MIT
1515
#include "Compiler/CISACodeGen/OpenCLKernelCodeGen.hpp"
1616
#include "Compiler/CodeGenContextWrapper.hpp"
1717
#include "Compiler/Optimizer/OpenCLPasses/StackOverflowDetection/StackOverflowDetection.hpp"
18-
#include "SPIRV/SPIRVInternal.h"
1918

2019
#include "common/LLVMWarningsPush.hpp"
2120

@@ -48,6 +47,40 @@ using namespace IGC::IGCMD;
4847

4948
namespace {
5049

50+
static const std::unordered_set<std::string> OCLExtOpBuiltinNames = {
51+
"acos", "acosh", "acospi", "asin", "asinh", "asinpi",
52+
"atan", "atan2", "atanh", "atanpi", "atan2pi", "cbrt",
53+
"ceil", "copysign", "cos", "cosh", "cospi", "erfc",
54+
"erf", "exp", "exp2", "exp10", "expm1", "fabs",
55+
"fdim", "floor", "fma", "fmax", "fmin", "fmod",
56+
"fract", "frexp", "hypot", "ilogb", "ldexp", "lgamma",
57+
"lgamma_r", "log", "log2", "log10", "log1p", "logb",
58+
"mad", "maxmag", "minmag", "modf", "nan", "nextafter",
59+
"pow", "pown", "powr", "remainder", "remquo", "rint",
60+
"rootn", "round", "rsqrt", "sin", "sincos", "sinh",
61+
"sinpi", "sqrt", "tan", "tanh", "tanpi", "tgamma",
62+
"trunc", "half_cos", "half_divide", "half_exp", "half_exp2",
63+
"half_exp10", "half_log", "half_log2", "half_log10",
64+
"half_powr", "half_recip", "half_rsqrt", "half_sin",
65+
"half_sqrt", "half_tan", "native_cos", "native_divide",
66+
"native_exp", "native_exp2", "native_exp10", "native_log",
67+
"native_log2", "native_log10", "native_powr", "native_recip",
68+
"native_rsqrt", "native_sin", "native_sqrt", "native_tan",
69+
"fclamp", "degrees", "mix", "fmax_common", "fmin_common",
70+
"radians", "step", "smoothstep", "sign", "cross", "distance",
71+
"length", "normalize", "fast_distance", "fast_length", "fast_normalize",
72+
"s_abs", "s_abs_diff", "s_add_sat", "u_add_sat", "s_hadd", "u_hadd",
73+
"s_rhadd", "u_rhadd", "s_clamp", "u_clamp", "clz", "ctz",
74+
"s_mad_hi", "s_mad_sat", "u_mad_sat", "s_max", "s_min", "u_max",
75+
"u_min", "s_mul_hi", "rotate", "s_sub_sat", "u_sub_sat", "u_upsample",
76+
"s_upsample", "popcount", "s_mad24", "u_mad24", "s_mul24", "u_mul24",
77+
"vloadn", "vstoren", "vload_half", "vload_halfn", "vstore_half",
78+
"vstore_half_r", "vstore_halfn", "vstore_halfn_r", "vloada_halfn",
79+
"vstorea_halfn", "vstorea_halfn_r", "shuffle", "shuffle2", "printf",
80+
"prefetch", "bitselect", "select", "u_abs", "u_abs_diff",
81+
"u_mul_hi", "u_mad_hi"
82+
};
83+
5184
class ProcessFuncAttributes : public ModulePass
5285
{
5386
public:
@@ -355,14 +388,8 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
355388
return false;
356389
};
357390

358-
static std::set<StringRef> mathFunctionNames = {
359-
#define _OCL_EXT_OP(name, num) #name,
360-
#include "SPIRV/libSPIRV/OpenCL.stdfuncs.h"
361-
#undef _OCL_EXT_OP
362-
};
363-
364391
// If a builtin func is a FP64 one with the given prefix, return true.
365-
auto IsBuiltinFP64WithPrefix = [](Function* F, StringRef Prefix) {
392+
auto IsBuiltinFP64WithPrefix = [](Function* F, const std::string& Prefix) {
366393
if (F->getName().startswith(Prefix))
367394
{
368395
if (F->getReturnType()->isDoubleTy() ||
@@ -372,7 +399,7 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
372399
functionName = functionName.drop_front(Prefix.size());
373400
functionName = functionName.take_front(functionName.find('_'));
374401

375-
if (mathFunctionNames.find(functionName) != mathFunctionNames.end()) {
402+
if (OCLExtOpBuiltinNames.find(functionName.str()) != OCLExtOpBuiltinNames.end()) {
376403
return true;
377404
}
378405
}
@@ -385,8 +412,7 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
385412
// if we don't make any fast relaxed math optimizations.
386413
auto IsBuiltinFP64 = [&IsBuiltinFP64WithPrefix](Function* F)
387414
{
388-
StringRef buildinPrefixOpenCL = igc_spv::kLLVMName::builtinExtInstPrefixOpenCL;
389-
return IsBuiltinFP64WithPrefix(F, buildinPrefixOpenCL);
415+
return IsBuiltinFP64WithPrefix(F, "__spirv_ocl_");
390416
};
391417

392418
// Process through all functions and add the appropriate function attributes
@@ -565,8 +591,7 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
565591
bool defaultStackCall = IGC_IS_FLAG_ENABLED(EnableStackCallFuncCall);
566592

567593
// Add always attribute if function is a builtin
568-
if (F->hasFnAttribute("OclBuiltin") ||
569-
F->getName().startswith(igc_spv::kLLVMName::builtinPrefix))
594+
if (F->hasFnAttribute("OclBuiltin") || F->getName().startswith("__builtin_spirv_"))
570595
{
571596
// OptNone builtins are special versions of builtins assuring that all
572597
// theirs parameters are constant values.
@@ -579,7 +604,7 @@ bool ProcessFuncAttributes::runOnModule(Module& M)
579604
F->removeFnAttr(llvm::Attribute::NoInline);
580605
}
581606
else if (pCtx->m_hasDPEmu &&
582-
IsBuiltinFP64WithPrefix(F, igc_spv::kLLVMName::builtinIMFPrefixSVML))
607+
IsBuiltinFP64WithPrefix(F, "__ocl_svml_"))
583608
{
584609
defaultStackCall = true;
585610
mustAlwaysInline = false;

IGC/AdaptorOCL/CMakeLists.txt

+7-54
Original file line numberDiff line numberDiff line change
@@ -24,55 +24,9 @@ set(IGC_BUILD__SRC__AdaptorOCL
2424
"${CMAKE_CURRENT_SOURCE_DIR}/preprocess_spvir/HandleSPIRVDecorations/HandleSpirvDecorationMetadata.cpp"
2525
)
2626

27-
if(IGC_OPTION__USE_KHRONOS_SPIRV_TRANSLATOR_IN_SC)
28-
list(APPEND IGC_BUILD__SRC__AdaptorOCL
29-
"${CMAKE_CURRENT_SOURCE_DIR}/preprocess_spvir/ConvertUserSemanticDecoratorOnFunctions.cpp"
30-
)
31-
endif()
32-
33-
if(IGC_BUILD__SPIRV_ENABLED)
34-
list(APPEND IGC_BUILD__SRC__AdaptorOCL
35-
SPIRV/libSPIRV/OpenCL.std.h
36-
SPIRV/libSPIRV/OpenCL.stdfuncs.h
37-
SPIRV/libSPIRV/SPIRVBasicBlock.h
38-
SPIRV/libSPIRV/SPIRVDebug.h
39-
SPIRV/libSPIRV/SPIRVDecorate.h
40-
SPIRV/libSPIRV/SPIRVEntry.h
41-
SPIRV/libSPIRV/SPIRVEnum.h
42-
SPIRV/libSPIRV/SPIRVError.h
43-
SPIRV/libSPIRV/SPIRVErrorEnum.h
44-
SPIRV/libSPIRV/SPIRVExtInst.h
45-
SPIRV/libSPIRV/SPIRVFunction.h
46-
SPIRV/libSPIRV/SPIRVInstruction.h
47-
SPIRV/libSPIRV/SPIRVMemAliasingINTEL.h
48-
SPIRV/libSPIRV/SPIRVModule.h
49-
SPIRV/libSPIRV/SPIRVOpCode.h
50-
SPIRV/libSPIRV/SPIRVOpCodeEnum.h
51-
SPIRV/libSPIRV/SPIRVBuiltinEnum.h
52-
SPIRV/libSPIRV/SPIRVStream.h
53-
SPIRV/libSPIRV/SPIRVType.h
54-
SPIRV/libSPIRV/SPIRVUtil.h
55-
SPIRV/libSPIRV/SPIRVValue.h
56-
SPIRV/libSPIRV/spirv.hpp
57-
SPIRV/SPIRVconsum.h
58-
SPIRV/SPIRVInternal.h
59-
SPIRV/libSPIRV/SPIRVBasicBlock.cpp
60-
SPIRV/libSPIRV/SPIRVDebug.cpp
61-
SPIRV/libSPIRV/SPIRVDecorate.cpp
62-
SPIRV/libSPIRV/SPIRVEntry.cpp
63-
SPIRV/libSPIRV/SPIRVFunction.cpp
64-
SPIRV/libSPIRV/SPIRVInstruction.cpp
65-
SPIRV/libSPIRV/SPIRVModule.cpp
66-
SPIRV/libSPIRV/SPIRVStream.cpp
67-
SPIRV/libSPIRV/SPIRVType.cpp
68-
SPIRV/libSPIRV/SPIRVValue.cpp
69-
SPIRV/SPIRVReader.cpp
70-
SPIRV/SPIRVUtil.cpp
71-
SPIRV/libSPIRV/SPIRV.DebugInfo.h
72-
SPIRV/libSPIRV/SPIRV.DebugInfofuncs.h
73-
SPIRV/libSPIRV/SPIRVDebugInfoExt.h
74-
)
75-
endif(IGC_BUILD__SPIRV_ENABLED)
27+
list(APPEND IGC_BUILD__SRC__AdaptorOCL
28+
"${CMAKE_CURRENT_SOURCE_DIR}/preprocess_spvir/ConvertUserSemanticDecoratorOnFunctions.cpp"
29+
)
7630

7731
# NOTE: Exported functions must be added to final libraries/executables directly.
7832

@@ -149,11 +103,10 @@ set(IGC_BUILD__HDR__AdaptorOCL
149103
"${IGC_BUILD__COMMON_COMPILER_DIR}/API/usc_gen9.h"
150104
)
151105

152-
if(IGC_OPTION__USE_KHRONOS_SPIRV_TRANSLATOR_IN_SC)
153-
list(APPEND IGC_BUILD__HDR__AdaptorOCL
154-
"${CMAKE_CURRENT_SOURCE_DIR}/preprocess_spvir/ConvertUserSemanticDecoratorOnFunctions.h"
155-
)
156-
endif()
106+
list(APPEND IGC_BUILD__HDR__AdaptorOCL
107+
"${CMAKE_CURRENT_SOURCE_DIR}/preprocess_spvir/ConvertUserSemanticDecoratorOnFunctions.h"
108+
)
109+
157110

158111
if(IGC_BUILD__SPIRV/ENABLED)
159112
list(APPEND IGC_BUILD__HDR__AdaptorOCL

IGC/AdaptorOCL/ResolveConstExprCalls.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ SPDX-License-Identifier: MIT
88

99
#include "ResolveConstExprCalls.h"
1010
#include "Compiler/IGCPassSupport.h"
11-
#include "SPIRV/SPIRVInternal.h"
1211

1312
#include "common/LLVMWarningsPush.hpp"
1413

@@ -20,8 +19,11 @@ SPDX-License-Identifier: MIT
2019
#include <llvm/IR/Function.h>
2120
#include <llvm/IR/Instructions.h>
2221
#include <llvm/IR/Attributes.h>
22+
#include <llvm/IR/IRBuilder.h>
2323
#include "common/LLVMWarningsPop.hpp"
2424

25+
#include "Probe/Assertion.h"
26+
2527
using namespace llvm;
2628
using namespace IGC;
2729

0 commit comments

Comments
 (0)