diff --git a/opencl/source/program/program.cpp b/opencl/source/program/program.cpp index 0f15ec021f..cca9176a54 100644 --- a/opencl/source/program/program.cpp +++ b/opencl/source/program/program.cpp @@ -410,10 +410,6 @@ void Program::replaceDeviceBinary(std::unique_ptr &&newBinary, size_t ne this->buildInfos[rootDeviceIndex].packedDeviceBinarySize = newBinarySize; this->buildInfos[rootDeviceIndex].unpackedDeviceBinary.reset(); this->buildInfos[rootDeviceIndex].unpackedDeviceBinarySize = 0U; - if (isAnySingleDeviceBinaryFormat(ArrayRef(reinterpret_cast(this->buildInfos[rootDeviceIndex].packedDeviceBinary.get()), this->buildInfos[rootDeviceIndex].packedDeviceBinarySize))) { - this->buildInfos[rootDeviceIndex].unpackedDeviceBinary = makeCopy(buildInfos[rootDeviceIndex].packedDeviceBinary.get(), buildInfos[rootDeviceIndex].packedDeviceBinarySize); - this->buildInfos[rootDeviceIndex].unpackedDeviceBinarySize = buildInfos[rootDeviceIndex].packedDeviceBinarySize; - } } else { this->buildInfos[rootDeviceIndex].packedDeviceBinary.reset(); this->buildInfos[rootDeviceIndex].packedDeviceBinarySize = 0U; diff --git a/opencl/test/unit_test/debugger/ocl_with_l0_debugger_tests.cpp b/opencl/test/unit_test/debugger/ocl_with_l0_debugger_tests.cpp index 6716dd46da..1b91b1b00b 100644 --- a/opencl/test/unit_test/debugger/ocl_with_l0_debugger_tests.cpp +++ b/opencl/test/unit_test/debugger/ocl_with_l0_debugger_tests.cpp @@ -238,9 +238,15 @@ HWTEST_F(DebuggerZebinProgramTest, GivenProgramWhenBuildingThenNotifyModuleCreat auto mockCompilerInterface = new NEO::MockCompilerInterfaceCaptureBuildOptions(); device->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex]->compilerInterface.reset(mockCompilerInterface); - auto zebin = ZebinTestData::ValidEmptyProgram<>(); + auto zebin = ZebinTestData::ValidEmptyProgram < is32bit ? NEO::Elf::EI_CLASS_32 : NEO::Elf::EI_CLASS_64 > (); auto program = new MockProgram(toClDeviceVector(*clDevice)); + auto copyHwInfo = device->getHardwareInfo(); + auto &compilerProductHelper = device->getCompilerProductHelper(); + compilerProductHelper.adjustHwInfoForIgc(copyHwInfo); + + zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily; + mockCompilerInterface->output.intermediateRepresentation.size = zebin.storage.size(); mockCompilerInterface->output.intermediateRepresentation.mem.reset(new char[zebin.storage.size()]); @@ -264,9 +270,15 @@ HWTEST_F(DebuggerZebinProgramTest, GivenProgramWhenLinkingThenNotifyModuleCreate auto mockCompilerInterface = new NEO::MockCompilerInterfaceCaptureBuildOptions(); device->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex]->compilerInterface.reset(mockCompilerInterface); - auto zebin = ZebinTestData::ValidEmptyProgram<>(); + auto zebin = ZebinTestData::ValidEmptyProgram < is32bit ? NEO::Elf::EI_CLASS_32 : NEO::Elf::EI_CLASS_64 > (); auto program = new MockProgram(toClDeviceVector(*clDevice)); + auto copyHwInfo = device->getHardwareInfo(); + auto &compilerProductHelper = device->getCompilerProductHelper(); + compilerProductHelper.adjustHwInfoForIgc(copyHwInfo); + + zebin.elfHeader->machine = copyHwInfo.platform.eProductFamily; + mockCompilerInterface->output.intermediateRepresentation.size = zebin.storage.size(); mockCompilerInterface->output.intermediateRepresentation.mem.reset(new char[zebin.storage.size()]); diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index a106aacf1e..783e3758d8 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -3294,7 +3294,7 @@ TEST_F(ProgramBinTest, GivenSourceKernelWhenLinkingProgramThenGtpinInitInfoIsPas mockCompilerInterface.release(); } -TEST(ProgramReplaceDeviceBinary, GivenBinaryZebinThenUseAsBothPackedAndUnpackedBinaryContainer) { +TEST(ProgramReplaceDeviceBinary, GivenBinaryZebinThenUseAsPackedBinaryContainer) { ZebinTestData::ValidEmptyProgram zebin; std::unique_ptr src = makeCopy(zebin.storage.data(), zebin.storage.size()); MockContext context; @@ -3303,11 +3303,10 @@ TEST(ProgramReplaceDeviceBinary, GivenBinaryZebinThenUseAsBothPackedAndUnpackedB MockProgram program{&context, false, toClDeviceVector(*device)}; program.replaceDeviceBinary(std::move(src), zebin.storage.size(), rootDeviceIndex); ASSERT_EQ(zebin.storage.size(), program.buildInfos[rootDeviceIndex].packedDeviceBinarySize); - ASSERT_EQ(zebin.storage.size(), program.buildInfos[rootDeviceIndex].unpackedDeviceBinarySize); + ASSERT_EQ(0u, program.buildInfos[rootDeviceIndex].unpackedDeviceBinarySize); ASSERT_NE(nullptr, program.buildInfos[rootDeviceIndex].packedDeviceBinary); - ASSERT_NE(nullptr, program.buildInfos[rootDeviceIndex].unpackedDeviceBinary); + ASSERT_EQ(nullptr, program.buildInfos[rootDeviceIndex].unpackedDeviceBinary); EXPECT_EQ(0, memcmp(program.buildInfos[rootDeviceIndex].packedDeviceBinary.get(), zebin.storage.data(), program.buildInfos[rootDeviceIndex].packedDeviceBinarySize)); - EXPECT_EQ(0, memcmp(program.buildInfos[rootDeviceIndex].unpackedDeviceBinary.get(), zebin.storage.data(), program.buildInfos[rootDeviceIndex].unpackedDeviceBinarySize)); } TEST(ProgramCallbackTest, whenFunctionIsNullptrThenUserDataNeedsToBeNullptr) {