mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
feature: extract indirect access buffer major version from ELF's notes
- use version from ELF to create correct layout of implcit args Related-To: NEO-15574 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a755ad131d
commit
be483491bf
@@ -312,6 +312,10 @@ ze_result_t KernelImp::getBaseAddress(uint64_t *baseAddress) {
|
||||
KernelImp::KernelImp(Module *module) : module(module) {
|
||||
if (module) {
|
||||
this->implicitArgsVersion = module->getDevice()->getGfxCoreHelper().getImplicitArgsVersion();
|
||||
ModuleImp *moduleImp = reinterpret_cast<ModuleImp *>(this->module);
|
||||
if (moduleImp->getTranslationUnit()->programInfo.indirectAccessBufferMajorVersion > 0) {
|
||||
this->implicitArgsVersion = moduleImp->getTranslationUnit()->programInfo.indirectAccessBufferMajorVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ struct ModuleImmutableDataFixture : public DeviceFixture {
|
||||
|
||||
class MockKernel : public WhiteBox<L0::KernelImp> {
|
||||
public:
|
||||
using KernelImp::implicitArgsVersion;
|
||||
using KernelImp::kernelImmData;
|
||||
using KernelImp::patchBindlessOffsetsInCrossThreadData;
|
||||
using KernelImp::printfBuffer;
|
||||
|
||||
@@ -43,6 +43,7 @@ struct WhiteBox<::L0::KernelImp> : public ::L0::KernelImp {
|
||||
using ::L0::KernelImp::cooperativeSupport;
|
||||
using ::L0::KernelImp::createPrintfBuffer;
|
||||
using ::L0::KernelImp::heaplessEnabled;
|
||||
using ::L0::KernelImp::implicitArgsVersion;
|
||||
using ::L0::KernelImp::implicitScalingEnabled;
|
||||
using ::L0::KernelImp::kernelImmData;
|
||||
using ::L0::KernelImp::localDispatchSupport;
|
||||
|
||||
@@ -4160,6 +4160,33 @@ TEST_F(KernelImplicitArgTests, givenKernelWithImplicitArgsWhenSettingKernelParam
|
||||
EXPECT_EQ(0, memcmp(pImplicitArgs, &expectedImplicitArgs, ImplicitArgsV0::getSize()));
|
||||
}
|
||||
|
||||
TEST_F(KernelImplicitArgTests, givenModuleWithImplicitArgsVersionWhenCreatingKernelThenImplicitArgsVersionFromModuleIsUsed) {
|
||||
auto zebinData = std::make_unique<ZebinTestData::ZebinWithL0TestCommonModule>(device->getHwInfo());
|
||||
const auto &src = zebinData->storage;
|
||||
ze_module_desc_t moduleDesc = {};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_NATIVE;
|
||||
moduleDesc.pInputModule = reinterpret_cast<const uint8_t *>(src.data());
|
||||
moduleDesc.inputSize = src.size();
|
||||
ModuleBuildLog *moduleBuildLog = nullptr;
|
||||
ze_result_t result = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
|
||||
|
||||
uint32_t perHwThreadPrivateMemorySizeRequested = 0;
|
||||
std::unique_ptr<MockImmutableData> mockKernelImmData = std::make_unique<MockImmutableData>(perHwThreadPrivateMemorySizeRequested);
|
||||
mockKernelImmData->kernelDescriptor->kernelAttributes.flags.requiresImplicitArgs = true;
|
||||
std::unique_ptr<MockModule> module = std::make_unique<MockModule>(device,
|
||||
moduleBuildLog,
|
||||
ModuleType::user,
|
||||
perHwThreadPrivateMemorySizeRequested,
|
||||
mockKernelImmData.get());
|
||||
result = module->initialize(&moduleDesc, device->getNEODevice());
|
||||
EXPECT_EQ(result, ZE_RESULT_SUCCESS);
|
||||
|
||||
module->getTranslationUnit()->programInfo.indirectAccessBufferMajorVersion = 5u;
|
||||
|
||||
auto kernel = std::make_unique<WhiteBox<L0::KernelImp>>(module.get());
|
||||
EXPECT_EQ(5u, kernel->implicitArgsVersion);
|
||||
}
|
||||
|
||||
using BindlessKernelTest = Test<DeviceFixture>;
|
||||
|
||||
TEST_F(BindlessKernelTest, givenBindlessKernelWhenPatchingCrossThreadDataThenCorrectBindlessOffsetsAreWritten) {
|
||||
|
||||
Reference in New Issue
Block a user