mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Update OpenCL C features reporting to the compiler
Pass features also with -cl-ext option. Change-Id: I1a1c68b655a2108be51c7d57be771591ee0b14e7 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
746cf7fd33
commit
60430d79ee
@ -46,6 +46,8 @@ struct DeviceGetCapsTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
void verifyOpenclCAllVersions(MockClDevice &clDevice) {
|
||||
EXPECT_FALSE(clDevice.getDeviceInfo().openclCAllVersions.usesDynamicMem());
|
||||
|
||||
for (auto &openclCVersion : clDevice.getDeviceInfo().openclCAllVersions) {
|
||||
EXPECT_STREQ("OpenCL C", openclCVersion.name);
|
||||
}
|
||||
@ -67,6 +69,8 @@ struct DeviceGetCapsTest : public ::testing::Test {
|
||||
}
|
||||
|
||||
void verifyOpenclCFeatures(MockClDevice &clDevice) {
|
||||
EXPECT_FALSE(clDevice.getDeviceInfo().openclCFeatures.usesDynamicMem());
|
||||
|
||||
for (auto &openclCFeature : clDevice.getDeviceInfo().openclCFeatures) {
|
||||
EXPECT_EQ(CL_MAKE_VERSION(3u, 0u, 0u), openclCFeature.version);
|
||||
}
|
||||
@ -833,6 +837,8 @@ TEST_F(DeviceGetCapsTest, givenVmeRelatedFlagsSetWhenCapsAreCreatedThenDeviceRep
|
||||
|
||||
UltClDeviceFactory deviceFactory{1, 0};
|
||||
const auto &caps = deviceFactory.rootDevices[0]->getDeviceInfo();
|
||||
EXPECT_FALSE(caps.builtInKernelsWithVersion.usesDynamicMem());
|
||||
|
||||
auto builtInKernelWithVersion = caps.builtInKernelsWithVersion.begin();
|
||||
|
||||
if (isVmeEnabled) {
|
||||
@ -1053,6 +1059,45 @@ TEST(DeviceGetCaps, WhenCheckingCompilerFeaturesThenValueIsCorrect) {
|
||||
EXPECT_STREQ(expectedCompilerFeatures.c_str(), pClDevice->compilerFeatures.c_str());
|
||||
}
|
||||
|
||||
TEST(DeviceGetCaps, WhenPeekingCompilerExtensionsThenCompilerExtensionsAreReturned) {
|
||||
UltClDeviceFactory deviceFactory{1, 0};
|
||||
auto pClDevice = deviceFactory.rootDevices[0];
|
||||
EXPECT_EQ(&pClDevice->compilerExtensions, &pClDevice->peekCompilerExtensions());
|
||||
}
|
||||
|
||||
TEST(DeviceGetCaps, WhenCheckingCompilerExtensionsThenValueIsCorrect) {
|
||||
UltClDeviceFactory deviceFactory{1, 0};
|
||||
auto pClDevice = deviceFactory.rootDevices[0];
|
||||
OpenClCFeaturesContainer emptyOpenClCFeatures;
|
||||
auto expectedCompilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(pClDevice->deviceInfo.deviceExtensions,
|
||||
emptyOpenClCFeatures);
|
||||
EXPECT_STREQ(expectedCompilerExtensions.c_str(), pClDevice->compilerExtensions.c_str());
|
||||
}
|
||||
|
||||
TEST(DeviceGetCaps, WhenPeekingCompilerExtensionsWithFeaturesThenCompilerExtensionsWithFeaturesAreReturned) {
|
||||
UltClDeviceFactory deviceFactory{1, 0};
|
||||
auto pClDevice = deviceFactory.rootDevices[0];
|
||||
EXPECT_EQ(&pClDevice->compilerExtensionsWithFeatures, &pClDevice->peekCompilerExtensionsWithFeatures());
|
||||
}
|
||||
|
||||
TEST(DeviceGetCaps, WhenCheckingCompilerExtensionsWithFeaturesThenValueIsCorrect) {
|
||||
UltClDeviceFactory deviceFactory{1, 0};
|
||||
auto pClDevice = deviceFactory.rootDevices[0];
|
||||
auto expectedCompilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(pClDevice->deviceInfo.deviceExtensions,
|
||||
pClDevice->deviceInfo.openclCFeatures);
|
||||
EXPECT_STREQ(expectedCompilerExtensions.c_str(), pClDevice->compilerExtensionsWithFeatures.c_str());
|
||||
}
|
||||
|
||||
TEST(DeviceGetCaps, WhenComparingCompilerExtensionsAndCompilerExtensionsWithFeaturesThenValuesMatch) {
|
||||
UltClDeviceFactory deviceFactory{1, 0};
|
||||
auto pClDevice = deviceFactory.rootDevices[0];
|
||||
auto compilerExtensions = pClDevice->compilerExtensions;
|
||||
auto compilerExtensionsWithFeatures = pClDevice->compilerExtensionsWithFeatures;
|
||||
|
||||
compilerExtensions.erase(compilerExtensions.size() - 1);
|
||||
EXPECT_STREQ(compilerExtensions.c_str(), compilerExtensionsWithFeatures.substr(0, compilerExtensions.size()).c_str());
|
||||
}
|
||||
|
||||
TEST(DeviceGetCaps, givenOclVersionLessThan21WhenCapsAreCreatedThenDeviceReportsNoSupportedIlVersions) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
{
|
||||
|
@ -25,6 +25,8 @@ extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executio
|
||||
class MockClDevice : public ClDevice {
|
||||
public:
|
||||
using ClDevice::ClDevice;
|
||||
using ClDevice::compilerExtensions;
|
||||
using ClDevice::compilerExtensionsWithFeatures;
|
||||
using ClDevice::compilerFeatures;
|
||||
using ClDevice::deviceExtensions;
|
||||
using ClDevice::deviceInfo;
|
||||
|
@ -235,7 +235,7 @@ TEST_F(OfflineCompilerTests, GoodArgTest) {
|
||||
|
||||
delete pOfflineCompiler;
|
||||
}
|
||||
TEST_F(OfflineCompilerTests, TestExtensions) {
|
||||
TEST_F(OfflineCompilerTests, WhenCompilingSourceThenCorrectExtensionsArePassed) {
|
||||
std::vector<std::string> argv = {
|
||||
"ocloc",
|
||||
"-file",
|
||||
@ -246,13 +246,39 @@ TEST_F(OfflineCompilerTests, TestExtensions) {
|
||||
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
|
||||
ASSERT_NE(nullptr, mockOfflineCompiler);
|
||||
mockOfflineCompiler->parseCommandLine(argv.size(), argv);
|
||||
|
||||
std::string internalOptions = mockOfflineCompiler->internalOptions;
|
||||
EXPECT_THAT(internalOptions, ::testing::HasSubstr(std::string("cl_khr_3d_image_writes")));
|
||||
|
||||
StackVec<cl_name_version, 15> openclCFeatures;
|
||||
OpenClCFeaturesContainer openclCFeatures;
|
||||
getOpenclCFeaturesList(DEFAULT_PLATFORM::hwInfo, openclCFeatures);
|
||||
auto expectedFeaturesOption = convertEnabledOclCFeaturesToCompilerInternalOptions(openclCFeatures);
|
||||
EXPECT_THAT(internalOptions, ::testing::HasSubstr(expectedFeaturesOption));
|
||||
for (auto &feature : openclCFeatures) {
|
||||
EXPECT_THAT(internalOptions, ::testing::Not(::testing::HasSubstr(std::string{feature.name})));
|
||||
}
|
||||
}
|
||||
TEST_F(OfflineCompilerTests, givenClStd30OptionWhenCompilingSourceThenCorrectExtensionsArePassed) {
|
||||
std::vector<std::string> argv = {
|
||||
"ocloc",
|
||||
"-file",
|
||||
"test_files/copybuffer.cl",
|
||||
"-device",
|
||||
gEnvironment->devicePrefix.c_str(),
|
||||
"-options",
|
||||
"-cl-std=CL3.0"};
|
||||
|
||||
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
|
||||
ASSERT_NE(nullptr, mockOfflineCompiler);
|
||||
mockOfflineCompiler->parseCommandLine(argv.size(), argv);
|
||||
|
||||
std::string internalOptions = mockOfflineCompiler->internalOptions;
|
||||
EXPECT_THAT(internalOptions, ::testing::HasSubstr(std::string("cl_khr_3d_image_writes")));
|
||||
|
||||
OpenClCFeaturesContainer openclCFeatures;
|
||||
getOpenclCFeaturesList(DEFAULT_PLATFORM::hwInfo, openclCFeatures);
|
||||
for (auto &feature : openclCFeatures) {
|
||||
auto expectedRegex = std::string{feature.name} + ".*" + std::string{feature.name};
|
||||
EXPECT_THAT(internalOptions, ::testing::ContainsRegex(expectedRegex));
|
||||
}
|
||||
}
|
||||
TEST_F(OfflineCompilerTests, GoodBuildTest) {
|
||||
std::vector<std::string> argv = {
|
||||
|
@ -201,35 +201,54 @@ TEST(PlatformTestSimple, givenNotCsrHwTypeWhenPlatformIsInitializedThenInitAubCe
|
||||
}
|
||||
|
||||
TEST(PlatformTestSimple, WhenConvertingCustomOclCFeaturesToCompilerInternalOptionsThenResultIsCorrect) {
|
||||
StackVec<cl_name_version, 15> customOpenclCFeatures;
|
||||
OpenClCFeaturesContainer customOpenclCFeatures;
|
||||
|
||||
cl_name_version feature;
|
||||
strcpy_s(feature.name, CL_NAME_VERSION_MAX_NAME_SIZE, "custom_feature");
|
||||
customOpenclCFeatures.push_back(feature);
|
||||
auto compilerOption = convertEnabledOclCFeaturesToCompilerInternalOptions(customOpenclCFeatures);
|
||||
EXPECT_STREQ(" -cl-feature=+custom_feature ", compilerOption.c_str());
|
||||
compilerOption = convertEnabledExtensionsToCompilerInternalOptions("", customOpenclCFeatures);
|
||||
EXPECT_STREQ(" -cl-ext=-all,+cl_khr_3d_image_writes,+custom_feature ", compilerOption.c_str());
|
||||
|
||||
strcpy_s(feature.name, CL_NAME_VERSION_MAX_NAME_SIZE, "other_extra_feature");
|
||||
customOpenclCFeatures.push_back(feature);
|
||||
compilerOption = convertEnabledOclCFeaturesToCompilerInternalOptions(customOpenclCFeatures);
|
||||
EXPECT_STREQ(" -cl-feature=+custom_feature,+other_extra_feature ", compilerOption.c_str());
|
||||
compilerOption = convertEnabledExtensionsToCompilerInternalOptions("", customOpenclCFeatures);
|
||||
EXPECT_STREQ(" -cl-ext=-all,+cl_khr_3d_image_writes,+custom_feature,+other_extra_feature ", compilerOption.c_str());
|
||||
}
|
||||
|
||||
TEST(PlatformTestSimple, WhenConvertingOclCFeaturesToCompilerInternalOptionsThenResultIsCorrect) {
|
||||
UltClDeviceFactory deviceFactory{1, 0};
|
||||
auto pClDevice = deviceFactory.rootDevices[0];
|
||||
|
||||
std::string expectedCompilerOption = " -cl-feature=";
|
||||
for (auto &openclCFeature : pClDevice->deviceInfo.openclCFeatures) {
|
||||
expectedCompilerOption += "+";
|
||||
expectedCompilerOption += openclCFeature.name;
|
||||
expectedCompilerOption += ",";
|
||||
}
|
||||
expectedCompilerOption.erase(expectedCompilerOption.size() - 1, 1);
|
||||
expectedCompilerOption += " ";
|
||||
{
|
||||
std::string expectedCompilerOption = " -cl-feature=";
|
||||
for (auto &openclCFeature : pClDevice->deviceInfo.openclCFeatures) {
|
||||
expectedCompilerOption += "+";
|
||||
expectedCompilerOption += openclCFeature.name;
|
||||
expectedCompilerOption += ",";
|
||||
}
|
||||
expectedCompilerOption.erase(expectedCompilerOption.size() - 1, 1);
|
||||
expectedCompilerOption += " ";
|
||||
|
||||
auto compilerOption = convertEnabledOclCFeaturesToCompilerInternalOptions(pClDevice->deviceInfo.openclCFeatures);
|
||||
EXPECT_STREQ(expectedCompilerOption.c_str(), compilerOption.c_str());
|
||||
auto compilerOption = convertEnabledOclCFeaturesToCompilerInternalOptions(pClDevice->deviceInfo.openclCFeatures);
|
||||
EXPECT_STREQ(expectedCompilerOption.c_str(), compilerOption.c_str());
|
||||
}
|
||||
{
|
||||
std::string expectedCompilerOption = " -cl-ext=-all,+cl_khr_3d_image_writes,";
|
||||
for (auto &openclCFeature : pClDevice->deviceInfo.openclCFeatures) {
|
||||
expectedCompilerOption += "+";
|
||||
expectedCompilerOption += openclCFeature.name;
|
||||
expectedCompilerOption += ",";
|
||||
}
|
||||
expectedCompilerOption.erase(expectedCompilerOption.size() - 1, 1);
|
||||
expectedCompilerOption += " ";
|
||||
|
||||
auto compilerOption = convertEnabledExtensionsToCompilerInternalOptions("", pClDevice->deviceInfo.openclCFeatures);
|
||||
EXPECT_STREQ(expectedCompilerOption.c_str(), compilerOption.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
namespace NEO {
|
||||
@ -274,8 +293,10 @@ TEST_F(PlatformTest, givenSupportingCl21WhenPlatformSupportsFp64ThenFillMatching
|
||||
const HardwareInfo *hwInfo;
|
||||
hwInfo = defaultHwInfo.get();
|
||||
std::string extensionsList = getExtensionsList(*hwInfo);
|
||||
OpenClCFeaturesContainer features;
|
||||
getOpenclCFeaturesList(*hwInfo, features);
|
||||
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str());
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
|
||||
EXPECT_THAT(compilerExtensions, ::testing::HasSubstr(std::string(" -cl-ext=-all,+cl")));
|
||||
|
||||
if (hwInfo->capabilityTable.supportsOcl21Features) {
|
||||
@ -312,11 +333,13 @@ TEST_F(PlatformTest, givenNotSupportingCl21WhenPlatformNotSupportFp64ThenNotFill
|
||||
TesthwInfo.capabilityTable.supportsOcl21Features = false;
|
||||
|
||||
std::string extensionsList = getExtensionsList(TesthwInfo);
|
||||
OpenClCFeaturesContainer features;
|
||||
getOpenclCFeaturesList(*defaultHwInfo, features);
|
||||
if (TesthwInfo.capabilityTable.supportsImages) {
|
||||
EXPECT_THAT(extensionsList, ::testing::HasSubstr(std::string("cl_khr_3d_image_writes")));
|
||||
}
|
||||
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str());
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
|
||||
EXPECT_THAT(compilerExtensions, ::testing::HasSubstr(std::string("-cl-ext=-all,+cl")));
|
||||
|
||||
EXPECT_THAT(compilerExtensions, ::testing::Not(::testing::HasSubstr(std::string("cl_khr_fp64"))));
|
||||
@ -329,7 +352,9 @@ TEST_F(PlatformTest, givenFtrSupportAtomicsWhenCreateExtentionsListThenGetMatchi
|
||||
const HardwareInfo *hwInfo;
|
||||
hwInfo = defaultHwInfo.get();
|
||||
std::string extensionsList = getExtensionsList(*hwInfo);
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str());
|
||||
OpenClCFeaturesContainer features;
|
||||
getOpenclCFeaturesList(*hwInfo, features);
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
|
||||
|
||||
if (hwInfo->capabilityTable.ftrSupportsInteger64BitAtomics) {
|
||||
EXPECT_THAT(compilerExtensions, ::testing::HasSubstr(std::string("cl_khr_int64_base_atomics")));
|
||||
@ -346,7 +371,9 @@ TEST_F(PlatformTest, givenSupporteImagesAndClVersion21WhenCreateExtentionsListTh
|
||||
hwInfo.capabilityTable.clVersionSupport = 21;
|
||||
hwInfo.capabilityTable.supportsOcl21Features = true;
|
||||
std::string extensionsList = getExtensionsList(hwInfo);
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str());
|
||||
OpenClCFeaturesContainer features;
|
||||
getOpenclCFeaturesList(*defaultHwInfo, features);
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
|
||||
|
||||
EXPECT_THAT(compilerExtensions, testing::HasSubstr(std::string("cl_intel_spirv_media_block_io")));
|
||||
}
|
||||
@ -356,24 +383,13 @@ TEST_F(PlatformTest, givenNotSupporteImagesAndClVersion21WhenCreateExtentionsLis
|
||||
hwInfo.capabilityTable.supportsImages = false;
|
||||
hwInfo.capabilityTable.clVersionSupport = 21;
|
||||
std::string extensionsList = getExtensionsList(hwInfo);
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str());
|
||||
OpenClCFeaturesContainer features;
|
||||
getOpenclCFeaturesList(*defaultHwInfo, features);
|
||||
std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), features);
|
||||
|
||||
EXPECT_THAT(compilerExtensions, testing::Not(testing::HasSubstr(std::string("cl_intel_spirv_media_block_io"))));
|
||||
}
|
||||
|
||||
TEST_F(PlatformTest, WhenRemovingLastSpaceThenStringDoesNotEndWithSpace) {
|
||||
std::string emptyString = "";
|
||||
removeLastSpace(emptyString);
|
||||
EXPECT_EQ(std::string(""), emptyString);
|
||||
|
||||
std::string xString = "x";
|
||||
removeLastSpace(xString);
|
||||
EXPECT_EQ(std::string("x"), xString);
|
||||
|
||||
std::string xSpaceString = "x ";
|
||||
removeLastSpace(xSpaceString);
|
||||
EXPECT_EQ(std::string("x"), xSpaceString);
|
||||
}
|
||||
TEST(PlatformConstructionTest, givenPlatformConstructorWhenItIsCalledTwiceThenTheSamePlatformIsReturned) {
|
||||
platformsImpl->clear();
|
||||
auto platform1 = constructPlatform();
|
||||
|
@ -864,19 +864,44 @@ TEST_P(ProgramFromSourceTest, CreateWithSource_Build_Options_Duplicate) {
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_P(ProgramFromSourceTest, WhenBuildingProgramThenFeaturesOptionIsAdded) {
|
||||
TEST_P(ProgramFromSourceTest, WhenBuildingProgramThenFeaturesOptionIsNotAdded) {
|
||||
auto featuresOption = static_cast<ClDevice *>(devices[0])->peekCompilerFeatures();
|
||||
EXPECT_THAT(pProgram->getInternalOptions(), testing::Not(testing::HasSubstr(featuresOption)));
|
||||
|
||||
retVal = pProgram->build(1, devices, nullptr, nullptr, nullptr, false);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_THAT(pProgram->getInternalOptions(), testing::Not(testing::HasSubstr(featuresOption)));
|
||||
}
|
||||
|
||||
TEST_P(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesOptionIsAdded) {
|
||||
auto featuresOption = static_cast<ClDevice *>(devices[0])->peekCompilerFeatures();
|
||||
EXPECT_THAT(pProgram->getInternalOptions(), testing::Not(testing::HasSubstr(featuresOption)));
|
||||
|
||||
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
|
||||
auto pClDevice = pContext->getDevice(0);
|
||||
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(*pClDevice->getExecutionEnvironment());
|
||||
pProgram->setDevice(&pClDevice->getDevice());
|
||||
pProgram->sourceCode = "__kernel mock() {}";
|
||||
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
|
||||
retVal = pProgram->build(1, devices, "-cl-std=CL3.0", nullptr, nullptr, false);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_THAT(pProgram->getInternalOptions(), testing::HasSubstr(featuresOption));
|
||||
}
|
||||
|
||||
TEST_P(ProgramFromSourceTest, WhenBuildingProgramThenFeaturesOptionIsAddedOnlyOnce) {
|
||||
retVal = pProgram->build(1, devices, nullptr, nullptr, nullptr, false);
|
||||
TEST_P(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesOptionIsAddedOnlyOnce) {
|
||||
auto cip = new MockCompilerInterfaceCaptureBuildOptions();
|
||||
auto pClDevice = pContext->getDevice(0);
|
||||
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(*pClDevice->getExecutionEnvironment());
|
||||
pProgram->setDevice(&pClDevice->getDevice());
|
||||
pProgram->sourceCode = "__kernel mock() {}";
|
||||
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
|
||||
retVal = pProgram->build(0, nullptr, "-cl-std=CL3.0", nullptr, nullptr, false);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
retVal = pProgram->build(1, devices, nullptr, nullptr, nullptr, false);
|
||||
retVal = pProgram->build(0, nullptr, "-cl-std=CL3.0", nullptr, nullptr, false);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto expectedFeaturesOption = static_cast<ClDevice *>(devices[0])->peekCompilerFeatures();
|
||||
@ -888,7 +913,7 @@ TEST_P(ProgramFromSourceTest, WhenBuildingProgramThenFeaturesOptionIsAddedOnlyOn
|
||||
EXPECT_EQ(std::string::npos, pos);
|
||||
}
|
||||
|
||||
TEST_P(ProgramFromSourceTest, WhenCompilingProgramThenFeaturesOptionIsAdded) {
|
||||
TEST_P(ProgramFromSourceTest, WhenCompilingProgramThenFeaturesOptionIsNotAdded) {
|
||||
auto pCompilerInterface = new MockCompilerInterfaceCaptureBuildOptions();
|
||||
auto pClDevice = static_cast<ClDevice *>(devices[0]);
|
||||
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(pCompilerInterface);
|
||||
@ -897,6 +922,23 @@ TEST_P(ProgramFromSourceTest, WhenCompilingProgramThenFeaturesOptionIsAdded) {
|
||||
|
||||
retVal = pProgram->compile(1, devices, nullptr, 0, nullptr, nullptr, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_THAT(pCompilerInterface->buildInternalOptions, testing::Not(testing::HasSubstr(featuresOption)));
|
||||
}
|
||||
|
||||
TEST_P(ProgramFromSourceTest, WhenCompilingProgramWithOpenClC30ThenFeaturesOptionIsAdded) {
|
||||
auto pCompilerInterface = new MockCompilerInterfaceCaptureBuildOptions();
|
||||
auto pClDevice = pContext->getDevice(0);
|
||||
pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(pCompilerInterface);
|
||||
auto pProgram = std::make_unique<SucceedingGenBinaryProgram>(*pClDevice->getExecutionEnvironment());
|
||||
pProgram->setDevice(&pClDevice->getDevice());
|
||||
pProgram->sourceCode = "__kernel mock() {}";
|
||||
pProgram->createdFrom = Program::CreatedFrom::SOURCE;
|
||||
|
||||
auto featuresOption = pClDevice->peekCompilerFeatures();
|
||||
EXPECT_THAT(pCompilerInterface->buildInternalOptions, testing::Not(testing::HasSubstr(featuresOption)));
|
||||
|
||||
retVal = pProgram->compile(1, devices, "-cl-std=CL3.0", 0, nullptr, nullptr, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_THAT(pCompilerInterface->buildInternalOptions, testing::HasSubstr(featuresOption));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user