mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
ocloc - don't require device for src->spv
Change-Id: Idb2acd9af4e09f59958e3bc622885423a3f79227
This commit is contained in:
@@ -1358,4 +1358,21 @@ TEST(OclocCompile, whenDetectedPotentialInputTypeMismatchThenEmitsWarning) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(OclocCompile, givenCommandLineWithoutDeviceWhenCompilingToSpirvThenSucceedsButUsesEmptyExtensionString) {
|
||||||
|
MockOfflineCompiler ocloc;
|
||||||
|
|
||||||
|
std::vector<std::string> argv = {
|
||||||
|
"ocloc",
|
||||||
|
"-q",
|
||||||
|
"-file",
|
||||||
|
"test_files/copybuffer.cl",
|
||||||
|
"-spv_only"};
|
||||||
|
|
||||||
|
int retVal = ocloc.initialize(argv.size(), argv);
|
||||||
|
ASSERT_EQ(0, retVal);
|
||||||
|
retVal = ocloc.build();
|
||||||
|
EXPECT_EQ(0, retVal);
|
||||||
|
EXPECT_THAT(ocloc.internalOptions.c_str(), testing::HasSubstr("-cl-ext=-all,+cl_khr_3d_image_writes"));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -577,18 +577,18 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
|
|||||||
} else if (inputFile.empty()) {
|
} else if (inputFile.empty()) {
|
||||||
argHelper->printf("Error: Input file name missing.\n");
|
argHelper->printf("Error: Input file name missing.\n");
|
||||||
retVal = INVALID_COMMAND_LINE;
|
retVal = INVALID_COMMAND_LINE;
|
||||||
} else if (deviceName.empty()) {
|
} else if (deviceName.empty() && (false == onlySpirV)) {
|
||||||
argHelper->printf("Error: Device name missing.\n");
|
argHelper->printf("Error: Device name missing.\n");
|
||||||
retVal = INVALID_COMMAND_LINE;
|
retVal = INVALID_COMMAND_LINE;
|
||||||
} else if (!argHelper->fileExists(inputFile)) {
|
} else if (!argHelper->fileExists(inputFile)) {
|
||||||
argHelper->printf("Error: Input file %s missing.\n", inputFile.c_str());
|
argHelper->printf("Error: Input file %s missing.\n", inputFile.c_str());
|
||||||
retVal = INVALID_FILE;
|
retVal = INVALID_FILE;
|
||||||
} else {
|
} else {
|
||||||
retVal = getHardwareInfo(deviceName.c_str());
|
retVal = deviceName.empty() ? 0 : getHardwareInfo(deviceName.c_str());
|
||||||
if (retVal != SUCCESS) {
|
if (retVal != 0) {
|
||||||
argHelper->printf("Error: Cannot get HW Info for device %s.\n", deviceName.c_str());
|
argHelper->printf("Error: Cannot get HW Info for device %s.\n", deviceName.c_str());
|
||||||
} else {
|
} else if (false == deviceName.empty()) {
|
||||||
std::string extensionsList = getExtensionsList(hwInfo);
|
std::string extensionsList = deviceName.empty() ? "" : getExtensionsList(hwInfo);
|
||||||
if (requiresOpenClCFeatures(options)) {
|
if (requiresOpenClCFeatures(options)) {
|
||||||
OpenClCFeaturesContainer openclCFeatures;
|
OpenClCFeaturesContainer openclCFeatures;
|
||||||
getOpenclCFeaturesList(hwInfo, openclCFeatures);
|
getOpenclCFeaturesList(hwInfo, openclCFeatures);
|
||||||
@@ -601,6 +601,8 @@ int OfflineCompiler::parseCommandLine(size_t numArgs, const std::vector<std::str
|
|||||||
auto compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), emptyOpenClCFeatures);
|
auto compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), emptyOpenClCFeatures);
|
||||||
CompilerOptions::concatenateAppend(internalOptions, compilerExtensions);
|
CompilerOptions::concatenateAppend(internalOptions, compilerExtensions);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this->internalOptions = CompilerOptions::concatenate("-cl-ext=-all,+cl_khr_3d_image_writes", this->internalOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user