fix: use .spv for intermediate representation
Related-To: NEO-7785 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
a7dc19cf9a
commit
cfd5f0c9b3
|
@ -42,7 +42,7 @@ components:
|
|||
dest_dir: kernels_bin
|
||||
type: git
|
||||
branch: kernels_bin
|
||||
revision: 2889-1850
|
||||
revision: 2889-1851
|
||||
kmdaf:
|
||||
branch: kmdaf
|
||||
dest_dir: kmdaf
|
||||
|
|
|
@ -1479,7 +1479,7 @@ TEST_F(VmeBuiltInTests, WhenGettingBuiltinAsStringThenCorrectStringIsReturned) {
|
|||
TEST_F(BuiltInTests, GivenEncodeTypeWhenGettingExtensionThenCorrectStringIsReturned) {
|
||||
EXPECT_EQ(0, strcmp("", BuiltinCode::getExtension(BuiltinCode::ECodeType::any)));
|
||||
EXPECT_EQ(0, strcmp(".bin", BuiltinCode::getExtension(BuiltinCode::ECodeType::binary)));
|
||||
EXPECT_EQ(0, strcmp(".bc", BuiltinCode::getExtension(BuiltinCode::ECodeType::intermediate)));
|
||||
EXPECT_EQ(0, strcmp(".spv", BuiltinCode::getExtension(BuiltinCode::ECodeType::intermediate)));
|
||||
EXPECT_EQ(0, strcmp(".cl", BuiltinCode::getExtension(BuiltinCode::ECodeType::source)));
|
||||
EXPECT_EQ(0, strcmp("", BuiltinCode::getExtension(BuiltinCode::ECodeType::count)));
|
||||
EXPECT_EQ(0, strcmp("", BuiltinCode::getExtension(BuiltinCode::ECodeType::invalid)));
|
||||
|
|
|
@ -79,7 +79,7 @@ TEST_F(ClCompilerInterfaceTest, WhenCompileIsInvokedThenFclReceivesListOfExtensi
|
|||
std::string receivedInternalOptions;
|
||||
|
||||
MockCompilerDebugVars fclDebugVars;
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, "CopyBuffer_simd16_", ".bc");
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, "CopyBuffer_simd16_", ".spv");
|
||||
fclDebugVars.receivedInternalOptionsOutput = &receivedInternalOptions;
|
||||
gEnvironment->fclPushDebugVars(fclDebugVars);
|
||||
TranslationOutput translationOutput = {};
|
||||
|
|
|
@ -30,7 +30,7 @@ void BuiltInFixture::setUp(Device *pDevice) {
|
|||
} else {
|
||||
builtInsFileName = KernelBinaryHelper::BUILT_INS;
|
||||
}
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, builtInsFileName + "_", ".bc");
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, builtInsFileName + "_", ".spv");
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, builtInsFileName + "_", ".bin");
|
||||
|
||||
gEnvironment->fclPushDebugVars(fclDebugVars);
|
||||
|
|
|
@ -22,7 +22,7 @@ inline void overwriteBuiltInBinaryName(
|
|||
MockCompilerDebugVars fclDebugVars;
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, filename + "_", ".bc");
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, filename + "_", ".spv");
|
||||
fclDebugVars.appendOptionsToFileName = appendOptionsToFileName;
|
||||
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, filename + "_", ".bin");
|
||||
|
|
|
@ -177,7 +177,7 @@ if(WIN32)
|
|||
TARGET run_ocloc_tests
|
||||
POST_BUILD
|
||||
COMMAND echo deleting offline compiler files and directories...
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/copybuffer_${CLOC_LIB_DEFAULT_DEVICE}.bc
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/copybuffer_${CLOC_LIB_DEFAULT_DEVICE}.spv
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/copybuffer_${CLOC_LIB_DEFAULT_DEVICE}.gen
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/copybuffer_${CLOC_LIB_DEFAULT_DEVICE}.bin
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/offline_compiler_test
|
||||
|
@ -189,7 +189,7 @@ else()
|
|||
TARGET run_ocloc_tests
|
||||
POST_BUILD
|
||||
COMMAND echo deleting offline compiler files and directories...
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/*.bc
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/*.spv
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/*.gen
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/*.ll
|
||||
COMMAND ${CMAKE_COMMAND} -E remove ${TargetDir}/${CLOC_LIB_DEFAULT_DEVICE}/*.bin
|
||||
|
|
|
@ -22,7 +22,7 @@ class Environment : public ::testing::Environment {
|
|||
const std::string filename) {
|
||||
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, filename + "_", ".bin");
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, filename + "_", ".bc");
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, filename + "_", ".spv");
|
||||
|
||||
NEO::setIgcDebugVars(igcDebugVars);
|
||||
NEO::setFclDebugVars(fclDebugVars);
|
||||
|
|
|
@ -3181,6 +3181,7 @@ TEST(OfflineCompilerTest, givenUseLlvmBcFlagWhenBuildingIrBinaryThenProperTransl
|
|||
auto mockFclOclDeviceCtx = new NEO::MockFclOclDeviceCtx();
|
||||
mockOfflineCompiler.mockFclFacade->fclDeviceCtx = CIF::RAII::Pack<IGC::FclOclDeviceCtxTagOCL>(mockFclOclDeviceCtx);
|
||||
|
||||
mockOfflineCompiler.inputFileLlvm = true;
|
||||
mockOfflineCompiler.useLlvmBc = true;
|
||||
const auto buildResult = mockOfflineCompiler.buildIrBinary();
|
||||
EXPECT_EQ(CL_SUCCESS, buildResult);
|
||||
|
|
|
@ -75,7 +75,7 @@ std::string parseToCharArray(std::unique_ptr<uint8_t[]> &binary, size_t size, st
|
|||
out << std::endl;
|
||||
out << " \"";
|
||||
deviceIp != "" ? out << deviceIp << "_" << builtinName : out << builtinName;
|
||||
isSpirV ? out << ".builtin_kernel.bc\"," : out << ".builtin_kernel.bin\",";
|
||||
isSpirV ? out << ".builtin_kernel.spv\"," : out << ".builtin_kernel.bin\",";
|
||||
out << std::endl;
|
||||
out << " (const char *)" << builtinName;
|
||||
if (deviceIpPresent) {
|
||||
|
|
|
@ -454,6 +454,11 @@ struct OfflineCompiler::buildInfo {
|
|||
|
||||
int OfflineCompiler::buildIrBinary() {
|
||||
int retVal = OCLOC_SUCCESS;
|
||||
pBuildInfo->intermediateRepresentation = preferredIntermediateRepresentation;
|
||||
if (inputFileLlvm) {
|
||||
pBuildInfo->intermediateRepresentation = useLlvmText ? IGC::CodeType::llvmLl : IGC::CodeType::llvmBc;
|
||||
}
|
||||
isSpirV = pBuildInfo->intermediateRepresentation == IGC::CodeType::spirV;
|
||||
|
||||
if (allowCaching) {
|
||||
const std::string igcRevision = igcFacade->getIgcRevision();
|
||||
|
@ -470,8 +475,6 @@ int OfflineCompiler::buildIrBinary() {
|
|||
}
|
||||
|
||||
UNRECOVERABLE_IF(!fclFacade->isInitialized());
|
||||
pBuildInfo->intermediateRepresentation = useLlvmText ? IGC::CodeType::llvmLl
|
||||
: (useLlvmBc ? IGC::CodeType::llvmBc : preferredIntermediateRepresentation);
|
||||
|
||||
// sourceCode.size() returns the number of characters without null terminated char
|
||||
CIF::RAII::UPtr_t<CIF::Builtins::BufferLatest> fclSrc = nullptr;
|
||||
|
@ -533,7 +536,6 @@ int OfflineCompiler::buildIrBinary() {
|
|||
}
|
||||
|
||||
storeBinary(irBinary, irBinarySize, pBuildInfo->fclOutput->GetOutput()->GetMemory<char>(), pBuildInfo->fclOutput->GetOutput()->GetSizeRaw());
|
||||
isSpirV = pBuildInfo->intermediateRepresentation == IGC::CodeType::spirV;
|
||||
|
||||
updateBuildLog(pBuildInfo->fclOutput->GetBuildLog()->GetMemory<char>(), pBuildInfo->fclOutput->GetBuildLog()->GetSizeRaw());
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ All supported acronyms: %s.
|
|||
bool inputFileSpirV = false;
|
||||
bool outputNoSuffix = false;
|
||||
bool forceStatelessToStatefulOptimization = false;
|
||||
bool isSpirV = false;
|
||||
bool isSpirV = true;
|
||||
bool showHelp = false;
|
||||
bool excludeIr = false;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ struct BuiltinCode {
|
|||
case BuiltinCode::ECodeType::binary:
|
||||
return ".bin";
|
||||
case BuiltinCode::ECodeType::intermediate:
|
||||
return ".bc";
|
||||
return ".spv";
|
||||
case BuiltinCode::ECodeType::source:
|
||||
return ".cl";
|
||||
}
|
||||
|
|
|
@ -402,7 +402,7 @@ int main(int argc, char **argv) {
|
|||
} else {
|
||||
builtInsFileName = KernelBinaryHelper::BUILT_INS;
|
||||
}
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, builtInsFileName + "_", ".bc");
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, builtInsFileName + "_", ".spv");
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, builtInsFileName + "_", ".bin");
|
||||
|
||||
gEnvironment->setMockFileNames(fclDebugVars.fileName, igcDebugVars.fileName);
|
||||
|
|
|
@ -19,7 +19,7 @@ KernelBinaryHelper::KernelBinaryHelper(const std::string &name, bool appendOptio
|
|||
MockCompilerDebugVars fclDebugVars;
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, name + "_", ".bc");
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, name + "_", ".spv");
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, name + "_", ".bin");
|
||||
|
||||
appendBinaryNameSuffix(fclDebugVars.fileNameSuffix);
|
||||
|
|
|
@ -32,10 +32,6 @@ void retrieveBinaryKernelFilename(std::string &outputFilename, const std::string
|
|||
}
|
||||
outputFilename.append(binaryNameSuffix);
|
||||
outputFilename.append(extension);
|
||||
|
||||
if (!fileExists(outputFilename) && (extension == ".bc")) {
|
||||
retrieveBinaryKernelFilename(outputFilename, kernelName, ".spv", options);
|
||||
}
|
||||
}
|
||||
|
||||
void retrieveBinaryKernelFilenameApiSpecific(std::string &outputFilename, const std::string &kernelName, const std::string &extension, const std::string &options) {
|
||||
|
@ -48,12 +44,8 @@ void retrieveBinaryKernelFilenameApiSpecific(std::string &outputFilename, const
|
|||
outputFilename.append(binaryNameSuffix);
|
||||
outputFilename.append(extension);
|
||||
outputFilename.append(options);
|
||||
|
||||
if (!fileExists(outputFilename) && (extension == ".bc")) {
|
||||
retrieveBinaryKernelFilename(outputFilename, kernelName, ".spv", options);
|
||||
}
|
||||
}
|
||||
|
||||
void appendBinaryNameSuffix(std::string &outputFileNameSuffix) {
|
||||
outputFileNameSuffix.append(binaryNameSuffix);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ HWTEST_F(BuiltInSharedTest, GivenRequestedTypeIntermediateWhenGettingResourceNam
|
|||
|
||||
auto resourceNames = getBuiltinResourceNames(EBuiltInOps::copyBufferToBuffer, BuiltinCode::ECodeType::intermediate, *pDevice);
|
||||
|
||||
std::string expectedResourceNameGeneric = "copy_buffer_to_buffer.builtin_kernel.bc";
|
||||
std::string expectedResourceNameGeneric = "copy_buffer_to_buffer.builtin_kernel.spv";
|
||||
std::string expectedResourceNameForRelease = deviceIpString + "_" + expectedResourceNameGeneric;
|
||||
|
||||
EXPECT_EQ(2u, resourceNames.size());
|
||||
|
|
|
@ -224,7 +224,7 @@ TEST_F(CompilerInterfaceTest, GivenOptionsWhenCompilingToIsaThenSuccessIsReturne
|
|||
|
||||
TEST_F(CompilerInterfaceTest, WhenCompilingToIrThenSuccessIsReturned) {
|
||||
MockCompilerDebugVars fclDebugVars;
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, "CopyBuffer_simd32_", ".bc");
|
||||
retrieveBinaryKernelFilename(fclDebugVars.fileName, "CopyBuffer_simd32_", ".spv");
|
||||
gEnvironment->fclPushDebugVars(fclDebugVars);
|
||||
TranslationOutput translationOutput = {};
|
||||
auto err = pCompilerInterface->compile(*pDevice, inputArgs, translationOutput);
|
||||
|
@ -305,7 +305,7 @@ TEST_F(CompilerInterfaceTest, GivenForceBuildFailureWhenLinkingIrThenLinkFailure
|
|||
TEST_F(CompilerInterfaceTest, WhenLinkIsCalledThenOclGenBinIsTheTranslationTarget) {
|
||||
// link only from .ll to gen ISA
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBuffer_simd32_", ".bc");
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBuffer_simd32_", ".spv");
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
TranslationOutput translationOutput = {};
|
||||
auto err = pCompilerInterface->link(*pDevice, inputArgs, translationOutput);
|
||||
|
@ -372,7 +372,7 @@ TEST_F(CompilerInterfaceTest, GivenForceBuildFailureWhenCreatingLibraryThenLinkF
|
|||
TEST_F(CompilerInterfaceTest, WhenCreateLibraryIsCalledThenLlvmBcIsUsedAsIntermediateRepresentation) {
|
||||
// create library from .ll to IR
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBuffer_simd32_", ".bc");
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBuffer_simd32_", ".spv");
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
TranslationOutput translationOutput = {};
|
||||
auto err = pCompilerInterface->createLibrary(*pDevice, inputArgs, translationOutput);
|
||||
|
@ -418,7 +418,7 @@ TEST_F(CompilerInterfaceTest, GivenForceBuildFailureWhenFclBuildingThenBuildFail
|
|||
fclDebugVars.forceCreateFailure = false;
|
||||
fclDebugVars.forceBuildFailure = true;
|
||||
fclDebugVars.forceRegisterFail = false;
|
||||
fclDebugVars.fileName = "copybuffer_skl.bc";
|
||||
fclDebugVars.fileName = "copybuffer_skl.spv";
|
||||
|
||||
gEnvironment->fclPushDebugVars(fclDebugVars);
|
||||
|
||||
|
@ -1039,7 +1039,7 @@ TEST_F(CompilerInterfaceTest, whenGetIgcDeviceCtxReturnsNullptrThenGetSipKernelB
|
|||
|
||||
TEST_F(CompilerInterfaceTest, whenEverythingIsOkThenGetSipKernelReturnsIgcsOutputAsSipBinary) {
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBuffer_simd32_", ".bc");
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBuffer_simd32_", ".spv");
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
std::vector<char> sipBinary;
|
||||
std::vector<char> stateAreaHeader;
|
||||
|
|
|
@ -46,17 +46,17 @@ using namespace NEO;
|
|||
void cleanTestHelpers() {}
|
||||
|
||||
void applyWorkarounds() {
|
||||
const std::array<ConstStringRef, 11> builtinIntermediateNames{"copy_buffer_to_buffer.builtin_kernel.bc",
|
||||
"copy_buffer_rect.builtin_kernel.bc",
|
||||
"fill_buffer.builtin_kernel.bc",
|
||||
"copy_buffer_to_image3d.builtin_kernel.bc",
|
||||
"copy_image3d_to_buffer.builtin_kernel.bc",
|
||||
"copy_image_to_image1d.builtin_kernel.bc",
|
||||
"copy_image_to_image2d.builtin_kernel.bc",
|
||||
"copy_image_to_image3d.builtin_kernel.bc",
|
||||
"fill_image1d.builtin_kernel.bc",
|
||||
"fill_image2d.builtin_kernel.bc",
|
||||
"fill_image3d.builtin_kernel.bc"};
|
||||
const std::array<ConstStringRef, 11> builtinIntermediateNames{"copy_buffer_to_buffer.builtin_kernel.spv",
|
||||
"copy_buffer_rect.builtin_kernel.spv",
|
||||
"fill_buffer.builtin_kernel.spv",
|
||||
"copy_buffer_to_image3d.builtin_kernel.spv",
|
||||
"copy_image3d_to_buffer.builtin_kernel.spv",
|
||||
"copy_image_to_image1d.builtin_kernel.spv",
|
||||
"copy_image_to_image2d.builtin_kernel.spv",
|
||||
"copy_image_to_image3d.builtin_kernel.spv",
|
||||
"fill_image1d.builtin_kernel.spv",
|
||||
"fill_image2d.builtin_kernel.spv",
|
||||
"fill_image3d.builtin_kernel.spv"};
|
||||
auto &storageRegistry = EmbeddedStorageRegistry::getInstance();
|
||||
for (auto builtinIntermediateName : builtinIntermediateNames) {
|
||||
std::string resource = "__mock_spirv_resource";
|
||||
|
|
Loading…
Reference in New Issue