Add __IMAGE_SUPPORT__ option for compilation
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
parent
ffb6e955b1
commit
65aecc84f1
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -93,11 +93,16 @@ void Program::initInternalOptions(std::string &internalOptions) const {
|
|||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::hasBufferOffsetArg);
|
||||
}
|
||||
|
||||
auto &hwHelper = HwHelper::get(pClDevice->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
if (hwHelper.isForceEmuInt32DivRemSPWARequired(pClDevice->getHardwareInfo())) {
|
||||
auto &hwInfo = pClDevice->getHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
if (hwHelper.isForceEmuInt32DivRemSPWARequired(hwInfo)) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::forceEmuInt32DivRemSP);
|
||||
}
|
||||
|
||||
if (hwInfo.capabilityTable.supportsImages) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::enableImageSupport);
|
||||
}
|
||||
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::preserveVec3Type);
|
||||
}
|
||||
|
||||
|
|
|
@ -279,6 +279,12 @@ TEST_F(OfflineCompilerTests, givenVariousClStdValuesWhenCompilingSourceThenCorre
|
|||
EXPECT_THAT(internalOptions, ::testing::Not(::testing::HasSubstr(std::string{feature.name})));
|
||||
}
|
||||
}
|
||||
|
||||
if (DEFAULT_PLATFORM::hwInfo.capabilityTable.supportsImages) {
|
||||
EXPECT_THAT(internalOptions, ::testing::HasSubstr(CompilerOptions::enableImageSupport.data()));
|
||||
} else {
|
||||
EXPECT_THAT(internalOptions, ::testing::Not(::testing::HasSubstr(CompilerOptions::enableImageSupport.data())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -2223,6 +2223,20 @@ TEST_F(ProgramTests, givenNewProgramThenStatelessToStatefulBufferOffsetOptimizat
|
|||
}
|
||||
}
|
||||
|
||||
TEST(ProgramTest, givenImagesSupportedWhenCreatingProgramThenInternalOptionsAreCorrectlyInitialized) {
|
||||
VariableBackup<bool> supportsImagesCapability{&defaultHwInfo->capabilityTable.supportsImages};
|
||||
|
||||
for (auto areImagesSupported : ::testing::Bool()) {
|
||||
supportsImagesCapability = areImagesSupported;
|
||||
UltClDeviceFactory clDeviceFactory{1, 0};
|
||||
MockContext context{clDeviceFactory.rootDevices[0]};
|
||||
MockProgram program(&context, false, toClDeviceVector(*clDeviceFactory.rootDevices[0]));
|
||||
|
||||
auto internalOptions = program.getInitInternalOptions();
|
||||
EXPECT_EQ(areImagesSupported, CompilerOptions::contains(internalOptions, CompilerOptions::enableImageSupport));
|
||||
}
|
||||
}
|
||||
|
||||
template <int32_t ErrCodeToReturn, bool spirv = true>
|
||||
struct CreateProgramFromBinaryMock : public MockProgram {
|
||||
using MockProgram::MockProgram;
|
||||
|
|
|
@ -394,8 +394,6 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
|||
if (deviceName.empty()) {
|
||||
internalOptions = CompilerOptions::concatenate("-ocl-version=300 -cl-ext=-all,+cl_khr_3d_image_writes", internalOptions);
|
||||
} else {
|
||||
auto oclVersion = getOclVersionCompilerInternalOption(hwInfo.capabilityTable.clVersionSupport);
|
||||
|
||||
std::string extensionsList = getExtensionsList(hwInfo);
|
||||
if (requiresAdditionalExtensions(options)) {
|
||||
extensionsList += "cl_khr_3d_image_writes ";
|
||||
|
@ -404,8 +402,14 @@ int OfflineCompiler::initialize(size_t numArgs, const std::vector<std::string> &
|
|||
if (requiresOpenClCFeatures(options)) {
|
||||
getOpenclCFeaturesList(hwInfo, openclCFeatures);
|
||||
}
|
||||
|
||||
auto compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str(), openclCFeatures);
|
||||
auto oclVersion = getOclVersionCompilerInternalOption(hwInfo.capabilityTable.clVersionSupport);
|
||||
internalOptions = CompilerOptions::concatenate(oclVersion, compilerExtensions, internalOptions);
|
||||
|
||||
if (hwInfo.capabilityTable.supportsImages) {
|
||||
CompilerOptions::concatenateAppend(internalOptions, CompilerOptions::enableImageSupport);
|
||||
}
|
||||
}
|
||||
|
||||
parseDebugSettings();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -31,6 +31,7 @@ static constexpr ConstStringRef uniformWorkgroupSize = "-cl-uniform-work-group-s
|
|||
static constexpr ConstStringRef forceEmuInt32DivRem = "-cl-intel-force-emu-int32divrem";
|
||||
static constexpr ConstStringRef forceEmuInt32DivRemSP = "-cl-intel-force-emu-sp-int32divrem";
|
||||
static constexpr ConstStringRef allowZebin = "-allow-zebin";
|
||||
static constexpr ConstStringRef enableImageSupport = "-D__IMAGE_SUPPORT__=1";
|
||||
|
||||
constexpr size_t nullterminateSize = 1U;
|
||||
constexpr size_t spaceSeparatorSize = 1U;
|
||||
|
|
Loading…
Reference in New Issue