mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Revert "fix: correctly set unpacked device binary prior decoding"
This reverts commit c4c3ec3291.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a1db7f6dcf
commit
69f46c79c5
@@ -241,19 +241,15 @@ cl_int Program::processGenBinary(const ClDevice &clDevice) {
|
||||
}
|
||||
|
||||
if (!decodedSingleDeviceBinary.isSet) {
|
||||
|
||||
auto blob = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(buildInfo.unpackedDeviceBinary.get()), buildInfo.unpackedDeviceBinarySize);
|
||||
SingleDeviceBinary singleDeviceBinary = {};
|
||||
decodedSingleDeviceBinary.programInfo = {};
|
||||
|
||||
singleDeviceBinary.deviceBinary = blob;
|
||||
singleDeviceBinary.targetDevice = NEO::getTargetDevice(clDevice.getRootDeviceEnvironment());
|
||||
singleDeviceBinary.generatorFeatureVersions.indirectMemoryAccessDetection = this->indirectDetectionVersion;
|
||||
singleDeviceBinary.generatorFeatureVersions.indirectAccessBuffer = this->indirectAccessBufferMajorVersion;
|
||||
singleDeviceBinary.generator = this->isGeneratedByIgc ? GeneratorType::igc : GeneratorType::unknown;
|
||||
auto blob = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(buildInfo.unpackedDeviceBinary.get()), buildInfo.unpackedDeviceBinarySize);
|
||||
SingleDeviceBinary binary = {};
|
||||
binary.deviceBinary = blob;
|
||||
binary.targetDevice = NEO::getTargetDevice(clDevice.getRootDeviceEnvironment());
|
||||
|
||||
auto &gfxCoreHelper = clDevice.getGfxCoreHelper();
|
||||
std::tie(decodedSingleDeviceBinary.decodeError, std::ignore) = NEO::decodeSingleDeviceBinary(decodedSingleDeviceBinary.programInfo, singleDeviceBinary, decodedSingleDeviceBinary.decodeErrors, decodedSingleDeviceBinary.decodeWarnings, gfxCoreHelper);
|
||||
std::tie(decodedSingleDeviceBinary.decodeError, std::ignore) = NEO::decodeSingleDeviceBinary(decodedSingleDeviceBinary.programInfo, binary, decodedSingleDeviceBinary.decodeErrors, decodedSingleDeviceBinary.decodeWarnings, gfxCoreHelper);
|
||||
} else {
|
||||
decodedSingleDeviceBinary.isSet = false;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ cl_int Program::createProgramFromBinary(
|
||||
|
||||
this->isGeneratedByIgc = singleDeviceBinary.generator == GeneratorType::igc;
|
||||
this->indirectDetectionVersion = singleDeviceBinary.generatorFeatureVersions.indirectMemoryAccessDetection;
|
||||
this->indirectAccessBufferMajorVersion = singleDeviceBinary.generatorFeatureVersions.indirectAccessBuffer;
|
||||
this->indirectAccessBufferMajorVersion = singleDeviceBinary.generatorFeatureVersions.indirectMemoryAccessDetection;
|
||||
|
||||
bool rebuild = AddressingModeHelper::containsBindlessKernel(decodedSingleDeviceBinary.programInfo.kernelInfos);
|
||||
rebuild |= !clDevice.getDevice().getExecutionEnvironment()->isOneApiPvcWaEnv();
|
||||
|
||||
@@ -597,104 +597,6 @@ TEST_F(ClBuildProgramMultiDeviceTests, givenMultiDeviceProgramWithProgramBuiltFo
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(ClBuildProgramMultiDeviceTests, GivenProgramCreatedFromSourceWhenBuildingThenCorrectlyFilledSingleDeviceBinaryIsUsed) {
|
||||
MockUnrestrictiveContextMultiGPU context;
|
||||
cl_program pProgram = nullptr;
|
||||
|
||||
std::string zeinfo = std::string("version :\'") + versionToString(Zebin::ZeInfo::zeInfoDecoderVersion) + R"===('
|
||||
kernels:
|
||||
- name : some_kernel
|
||||
execution_env :
|
||||
simd_size : 32
|
||||
require_iab: true
|
||||
- name : some_other_kernel
|
||||
execution_env :
|
||||
simd_size : 32
|
||||
)===";
|
||||
|
||||
uint8_t kernelIsa[8]{0U};
|
||||
ZebinTestData::ValidEmptyProgram<is32bit ? NEO::Elf::EI_CLASS_32 : NEO::Elf::EI_CLASS_64> zebin;
|
||||
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
|
||||
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
|
||||
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_kernel", {kernelIsa, sizeof(kernelIsa)});
|
||||
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_other_kernel", {kernelIsa, sizeof(kernelIsa)});
|
||||
|
||||
const uint8_t data[] = {'H', 'e', 'l', 'l', 'o', '!'};
|
||||
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::dataConstString, data);
|
||||
|
||||
{
|
||||
const uint32_t indirectAccessBufferMajorVersion = 4u;
|
||||
|
||||
Zebin::Elf::ElfNoteSection elfNoteSection = {};
|
||||
elfNoteSection.type = Zebin::Elf::IntelGTSectionType::indirectAccessBufferMajorVersion;
|
||||
elfNoteSection.descSize = sizeof(uint32_t);
|
||||
elfNoteSection.nameSize = 8u;
|
||||
|
||||
auto sectionDataSize = sizeof(Zebin::Elf::ElfNoteSection) + elfNoteSection.nameSize + alignUp(elfNoteSection.descSize, 4);
|
||||
auto noteIntelGTSectionData = std::make_unique<uint8_t[]>(sectionDataSize);
|
||||
auto appendSingleIntelGTSectionData = [](const NEO::Elf::ElfNoteSection &elfNoteSection, uint8_t *const intelGTSectionData, const uint8_t *descData, const char *ownerName, size_t spaceAvailable) {
|
||||
size_t offset = 0;
|
||||
ASSERT_GE(spaceAvailable, sizeof(Zebin::Elf::ElfNoteSection) + elfNoteSection.nameSize + elfNoteSection.descSize);
|
||||
memcpy_s(ptrOffset(intelGTSectionData, offset), sizeof(NEO::Elf::ElfNoteSection), &elfNoteSection, sizeof(NEO::Elf::ElfNoteSection));
|
||||
offset += sizeof(NEO::Elf::ElfNoteSection);
|
||||
memcpy_s(reinterpret_cast<char *>(ptrOffset(intelGTSectionData, offset)), elfNoteSection.nameSize, ownerName, elfNoteSection.nameSize);
|
||||
offset += elfNoteSection.nameSize;
|
||||
memcpy_s(ptrOffset(intelGTSectionData, offset), elfNoteSection.descSize, descData, elfNoteSection.descSize);
|
||||
offset += elfNoteSection.descSize;
|
||||
};
|
||||
|
||||
appendSingleIntelGTSectionData(elfNoteSection, noteIntelGTSectionData.get(), reinterpret_cast<const uint8_t *>(&indirectAccessBufferMajorVersion),
|
||||
Zebin::Elf::intelGTNoteOwnerName.str().c_str(), sectionDataSize);
|
||||
zebin.appendSection(Zebin::Elf::SHT_NOTE, Zebin::Elf::SectionNames::noteIntelGT, ArrayRef<uint8_t>::fromAny(noteIntelGTSectionData.get(), sectionDataSize));
|
||||
}
|
||||
|
||||
MockCompilerDebugVars debugVars;
|
||||
debugVars.binaryToReturn = const_cast<unsigned char *>(zebin.storage.data());
|
||||
debugVars.binaryToReturnSize = zebin.storage.size();
|
||||
gEnvironment->igcPushDebugVars(debugVars);
|
||||
gEnvironment->fclPushDebugVars(debugVars);
|
||||
|
||||
cl_int retVal = CL_INVALID_PROGRAM;
|
||||
pProgram = clCreateProgramWithSource(
|
||||
&context,
|
||||
1,
|
||||
sources,
|
||||
&sourceKernelSize,
|
||||
&retVal);
|
||||
|
||||
EXPECT_NE(nullptr, pProgram);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
cl_device_id firstDevice = context.pRootDevice0;
|
||||
cl_device_id secondDevice = context.pRootDevice1;
|
||||
cl_device_id devices[] = {firstDevice, secondDevice};
|
||||
|
||||
retVal = clBuildProgram(
|
||||
pProgram,
|
||||
2,
|
||||
devices,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
cl_kernel pKernel = clCreateKernel(pProgram, "some_kernel", &retVal);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
MultiDeviceKernel *kernel = castToObject<MultiDeviceKernel>(pKernel);
|
||||
Program *program = castToObject<Program>(pProgram);
|
||||
EXPECT_EQ(4u, program->getIndirectAccessBufferVersion());
|
||||
EXPECT_FALSE(kernel->getKernelInfos()[1]->kernelDescriptor.kernelMetadata.isGeneratedByIgc);
|
||||
|
||||
retVal = clReleaseKernel(pKernel);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
retVal = clReleaseProgram(pProgram);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
gEnvironment->igcPopDebugVars();
|
||||
gEnvironment->fclPopDebugVars();
|
||||
}
|
||||
|
||||
TEST_F(ClBuildProgramMultiDeviceTests, givenMultiDeviceProgramWithProgramBuiltForSingleDeviceWithCreatedKernelWhenBuildingProgramForSecondDeviceThenInvalidOperationReturned) {
|
||||
MockUnrestrictiveContextMultiGPU context;
|
||||
cl_program pProgram = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user