From a9dc0f717758423918ff5fa96ef334dbaa5855d9 Mon Sep 17 00:00:00 2001 From: Kacper Nowak Date: Tue, 27 Dec 2022 14:28:27 +0000 Subject: [PATCH] fix(zebin): add missing ULT for global/const buffers scenario Signed-off-by: Kacper Nowak --- .../zebin_decoder_tests.cpp | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp index eb23e4dc40..a554005f37 100644 --- a/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp +++ b/shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp @@ -7004,6 +7004,51 @@ kernels: EXPECT_EQ(NEO::DecodeError::InvalidBinary, err); } +TEST(PopulateKernelDescriptor, givenGlobalBufferAndConstBufferWhenPopulatingKernelDescriptorThenMakeThemStateful) { + NEO::ConstStringRef zeinfo = R"===( +kernels: + - name : some_kernel + execution_env: + simd_size: 8 + payload_arguments: + - arg_type: global_base + offset: 0 + size: 8 + bti_value: 0 + - arg_type: const_base + offset: 8 + size: 8 + bti_value: 1 +... +)==="; + NEO::ProgramInfo programInfo; + ZebinTestData::ValidEmptyProgram zebin; + zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::textPrefix.str() + "some_kernel", {}); + std::string errors, warnings; + auto elf = NEO::Elf::decodeElf(zebin.storage, errors, warnings); + ASSERT_NE(nullptr, elf.elfFileHeader) << errors << " " << warnings; + + NEO::Yaml::YamlParser parser; + bool parseSuccess = parser.parse(zeinfo, errors, warnings); + ASSERT_TRUE(parseSuccess) << errors << " " << warnings; + + NEO::ZebinSections zebinSections; + auto extractErr = NEO::extractZebinSections(elf, zebinSections, errors, warnings); + ASSERT_EQ(NEO::DecodeError::Success, extractErr) << errors << " " << warnings; + + auto &kernelNode = *parser.createChildrenRange(*parser.findNodeWithKeyDfs("kernels")).begin(); + auto res = NEO::populateKernelDescriptor(programInfo, elf, zebinSections, parser, kernelNode, errors, warnings); + EXPECT_EQ(NEO::DecodeError::Success, res); + EXPECT_TRUE(warnings.empty()); + EXPECT_TRUE(errors.empty()); + + const auto &kernelInfo = *programInfo.kernelInfos.rbegin(); + EXPECT_EQ(2u, kernelInfo->kernelDescriptor.payloadMappings.bindingTable.numEntries); + EXPECT_EQ(128u, kernelInfo->kernelDescriptor.payloadMappings.bindingTable.tableOffset); + ASSERT_EQ(192u, kernelInfo->heapInfo.SurfaceStateHeapSize); + ASSERT_NE(nullptr, kernelInfo->heapInfo.pSsh); +} + TEST(PopulateInlineSamplers, GivenInvalidSamplerIndexThenPopulateInlineSamplersFails) { NEO::KernelDescriptor kd; std::string errors, warnings;