fix(zebin): pass disable zebin internal option when building vme program
Signed-off-by: Kopryk, Kamil <kamil.kopryk@intel.com>
This commit is contained in:
parent
9fc16f4c52
commit
ceda3f65c2
|
@ -74,6 +74,8 @@ cl_int Program::build(
|
|||
break;
|
||||
}
|
||||
|
||||
disableZebinIfVmeEnabled(options, internalOptions);
|
||||
|
||||
TranslationInput inputArgs = {IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
|
||||
if (createdFrom != CreatedFrom::SOURCE) {
|
||||
inputArgs.srcType = isSpirV ? IGC::CodeType::spirV : IGC::CodeType::llvmBc;
|
||||
|
|
|
@ -446,6 +446,27 @@ bool Program::containsVmeUsage(const std::vector<KernelInfo *> &kernelInfos) con
|
|||
return false;
|
||||
}
|
||||
|
||||
void Program::disableZebinIfVmeEnabled(std::string &options, std::string &internalOptions) {
|
||||
auto isVme = false;
|
||||
const char *vmeOptions[] = {"cl_intel_device_side_advanced_vme_enable",
|
||||
"cl_intel_device_side_avc_vme_enable",
|
||||
"cl_intel_device_side_vme_enable"};
|
||||
for (auto vmeOption : vmeOptions) {
|
||||
auto pos = options.find(vmeOption);
|
||||
if (pos != std::string::npos) {
|
||||
isVme = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isVme) {
|
||||
auto pos = options.find(CompilerOptions::allowZebin.str());
|
||||
if (pos != std::string::npos) {
|
||||
options.erase(pos, pos + CompilerOptions::allowZebin.length());
|
||||
}
|
||||
internalOptions += " " + CompilerOptions::disableZebin.str();
|
||||
}
|
||||
}
|
||||
|
||||
bool Program::isValidCallback(void(CL_CALLBACK *funcNotify)(cl_program program, void *userData), void *userData) {
|
||||
return funcNotify != nullptr || userData == nullptr;
|
||||
}
|
||||
|
|
|
@ -307,6 +307,7 @@ class Program : public BaseObject<_cl_program> {
|
|||
void setBuildStatusSuccess(const ClDeviceVector &deviceVector, cl_program_binary_type binaryType);
|
||||
|
||||
bool containsVmeUsage(const std::vector<KernelInfo *> &kernelInfos) const;
|
||||
void disableZebinIfVmeEnabled(std::string &options, std::string &internalOptions);
|
||||
|
||||
bool isSpirV = false;
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ class MockProgram : public Program {
|
|||
using Program::createdFrom;
|
||||
using Program::createProgramFromBinary;
|
||||
using Program::deviceBuildInfos;
|
||||
using Program::disableZebinIfVmeEnabled;
|
||||
using Program::extractInternalOptions;
|
||||
using Program::getKernelInfo;
|
||||
using Program::internalOptionsToExtract;
|
||||
|
|
|
@ -3379,6 +3379,34 @@ TEST(ProgramVmeUsage, givenVmeUsageWhenContainsVmeUsageIsCalledThenReturnTrue) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(ProgramVmeUsage, givenVmeOptionsWhenDisableZebinIfVmeEnabledIsCalledThenZebinIsDisabled) {
|
||||
MockClDevice device{new MockDevice()};
|
||||
MockProgram program(toClDeviceVector(device));
|
||||
|
||||
{
|
||||
std::string options = CompilerOptions::allowZebin.str();
|
||||
std::string internalOptions = "";
|
||||
program.disableZebinIfVmeEnabled(options, internalOptions);
|
||||
EXPECT_TRUE(CompilerOptions::contains(options, CompilerOptions::allowZebin));
|
||||
EXPECT_FALSE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin));
|
||||
}
|
||||
|
||||
{
|
||||
std::string options = CompilerOptions::allowZebin.str() + " cl_intel_device_side_vme_enable";
|
||||
std::string internalOptions = "";
|
||||
program.disableZebinIfVmeEnabled(options, internalOptions);
|
||||
EXPECT_FALSE(CompilerOptions::contains(options, CompilerOptions::allowZebin));
|
||||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin));
|
||||
}
|
||||
{
|
||||
std::string options = "cl_intel_device_side_vme_enable";
|
||||
std::string internalOptions = "";
|
||||
program.disableZebinIfVmeEnabled(options, internalOptions);
|
||||
EXPECT_FALSE(CompilerOptions::contains(options, CompilerOptions::allowZebin));
|
||||
EXPECT_TRUE(CompilerOptions::contains(internalOptions, CompilerOptions::disableZebin));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ProgramPopulateZebinExtendedArgsMetadataTests, givenZebinaryFormatAndDecodeErrorOnDecodingArgsMetadataWhenCallingPopulateZebinExtendedArgsMetadataThenMetadataIsNotPopulated) {
|
||||
MockClDevice device{new MockDevice()};
|
||||
MockProgram program(toClDeviceVector(device));
|
||||
|
|
Loading…
Reference in New Issue