From b7a780868a1d052cd60cd76ae756af5b3c0f4903 Mon Sep 17 00:00:00 2001 From: Krystian Chmielewski Date: Wed, 14 Sep 2022 13:00:13 +0000 Subject: [PATCH] Prepare OCL tests for switch to zebin Signed-off-by: Krystian Chmielewski --- .../api/cl_get_kernel_sub_group_info_khr_tests.inl | 12 +----------- opencl/test/unit_test/program/program_tests.cpp | 10 ++++++++++ .../program/program_with_kernel_debug_tests.cpp | 12 ++++++++---- shared/source/kernel/kernel_arg_descriptor.h | 4 +++- .../unit_test/kernel/kernel_arg_descriptor_tests.cpp | 7 +++++++ 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/opencl/test/unit_test/api/cl_get_kernel_sub_group_info_khr_tests.inl b/opencl/test/unit_test/api/cl_get_kernel_sub_group_info_khr_tests.inl index d66363573a..db62800ab0 100644 --- a/opencl/test/unit_test/api/cl_get_kernel_sub_group_info_khr_tests.inl +++ b/opencl/test/unit_test/api/cl_get_kernel_sub_group_info_khr_tests.inl @@ -137,18 +137,8 @@ TEST_F(KernelSubGroupInfoKhrReturnCompileSizeTest, GivenKernelWhenGettingRequire ¶mValueSizeRet); EXPECT_EQ(CL_SUCCESS, retVal); - EXPECT_EQ(paramValueSizeRet, sizeof(size_t)); - - size_t requiredSubGroupSize = 0; - auto start = pKernel->getKernelInfo().kernelDescriptor.kernelMetadata.kernelLanguageAttributes.find("intel_reqd_sub_group_size("); - if (start != std::string::npos) { - start += strlen("intel_reqd_sub_group_size("); - auto stop = pKernel->getKernelInfo().kernelDescriptor.kernelMetadata.kernelLanguageAttributes.find(")", start); - requiredSubGroupSize = stoi(pKernel->getKernelInfo().kernelDescriptor.kernelMetadata.kernelLanguageAttributes.substr(start, stop - start)); - } - - EXPECT_EQ(paramValue, requiredSubGroupSize); + EXPECT_EQ(pKernel->getKernelInfo().kernelDescriptor.kernelMetadata.requiredSubGroupSize, paramValue); } TEST_F(KernelSubGroupInfoKhrTest, GivenNullKernelWhenGettingKernelSubGroupInfoThenInvalidKernelErrorIsReturned) { diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index 8db042597f..1ea229726a 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -1410,6 +1410,9 @@ HWTEST_F(PatchTokenTests, givenKernelRequiringConstantAllocationWhenMakeResident ASSERT_EQ(CL_SUCCESS, retVal); auto pKernelInfo = pProgram->getKernelInfo("test", rootDeviceIndex); + if (pKernelInfo->kernelDescriptor.kernelAttributes.binaryFormat == NEO::DeviceBinaryFormat::Zebin) { + GTEST_SKIP(); + } ASSERT_NE(nullptr, pProgram->getConstantSurface(pClDevice->getRootDeviceIndex())); @@ -1685,6 +1688,9 @@ TEST_F(ProgramWithDebugSymbolsTests, GivenProgramCreatedWithDashGOptionWhenGetti EXPECT_EQ(CL_SUCCESS, retVal); ArrayRef archive(reinterpret_cast(testBinary.get()), size); + if (NEO::isDeviceBinaryFormat(archive)) { + GTEST_SKIP(); + } auto productAbbreviation = hardwarePrefix[pDevice->getHardwareInfo().platform.eProductFamily]; HardwareInfo copyHwInfo = pDevice->getHardwareInfo(); @@ -2284,6 +2290,10 @@ TEST_F(ProgramTests, GivenFailingGenBinaryProgramWhenRebuildingBinaryThenInvalid auto pBinary = loadDataFromFile(filePath.c_str(), binarySize); EXPECT_NE(0u, binarySize); + if (NEO::isDeviceBinaryFormat({reinterpret_cast(pBinary.get()), binarySize})) { + GTEST_SKIP(); + } + // Create program from loaded binary retVal = program->createProgramFromBinary(pBinary.get(), binarySize, *pClDevice); EXPECT_EQ(CL_SUCCESS, retVal); diff --git a/opencl/test/unit_test/program/program_with_kernel_debug_tests.cpp b/opencl/test/unit_test/program/program_with_kernel_debug_tests.cpp index dabf955b6f..bd17d5590c 100644 --- a/opencl/test/unit_test/program/program_with_kernel_debug_tests.cpp +++ b/opencl/test/unit_test/program/program_with_kernel_debug_tests.cpp @@ -55,8 +55,11 @@ TEST(ProgramFromBinary, givenBinaryWithDebugDataWhenCreatingProgramFromBinaryThe size_t binarySize = 0; auto pBinary = loadDataFromFile(filePath.c_str(), binarySize); - cl_int retVal = program->createProgramFromBinary(pBinary.get(), binarySize, *device); + if (NEO::isDeviceBinaryFormat({reinterpret_cast(pBinary.get()), binarySize})) { + GTEST_SKIP(); + } + cl_int retVal = program->createProgramFromBinary(pBinary.get(), binarySize, *device); EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, program->getDebugData(device->getRootDeviceIndex())); EXPECT_NE(0u, program->getDebugDataSize(device->getRootDeviceIndex())); @@ -303,11 +306,12 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinke } TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenBuiltThenPatchTokenAllocateSipSurfaceHasSizeGreaterThanZero) { - auto &refBin = pProgram->buildInfos[pDevice->getRootDeviceIndex()].unpackedDeviceBinary; - auto refBinSize = pProgram->buildInfos[pDevice->getRootDeviceIndex()].unpackedDeviceBinarySize; - if (NEO::isDeviceBinaryFormat(ArrayRef::fromAny(refBin.get(), refBinSize))) { + auto &devBinary = pProgram->buildInfos[pDevice->getRootDeviceIndex()].packedDeviceBinary; + auto devBinarySize = pProgram->buildInfos[pDevice->getRootDeviceIndex()].packedDeviceBinarySize; + if (NEO::isDeviceBinaryFormat(ArrayRef::fromAny(devBinary.get(), devBinarySize))) { GTEST_SKIP(); } + auto retVal = pProgram->build(pProgram->getDevices(), CompilerOptions::debugKernelEnable.data(), false); EXPECT_EQ(CL_SUCCESS, retVal); diff --git a/shared/source/kernel/kernel_arg_descriptor.h b/shared/source/kernel/kernel_arg_descriptor.h index 141967a54b..6e8f06aa35 100644 --- a/shared/source/kernel/kernel_arg_descriptor.h +++ b/shared/source/kernel/kernel_arg_descriptor.h @@ -161,7 +161,9 @@ struct ArgDescriptor final { case ArgTImage: return (KernelArgMetadata::AccessReadOnly == traits.accessQualifier); case ArgTPointer: - return (KernelArgMetadata::AddrConstant == traits.addressQualifier) || (traits.typeQualifiers.constQual); + return (KernelArgMetadata::AddrConstant == traits.addressQualifier) || + (KernelArgMetadata::AccessReadOnly == traits.accessQualifier) || + traits.typeQualifiers.constQual; } } diff --git a/shared/test/unit_test/kernel/kernel_arg_descriptor_tests.cpp b/shared/test/unit_test/kernel/kernel_arg_descriptor_tests.cpp index dccf2b8de3..ce5c67db14 100644 --- a/shared/test/unit_test/kernel/kernel_arg_descriptor_tests.cpp +++ b/shared/test/unit_test/kernel/kernel_arg_descriptor_tests.cpp @@ -181,6 +181,13 @@ TEST(ArgDescriptorIsReadOnly, GivenPointerArgWhenConstantAddressSpaceThenReturns EXPECT_FALSE(arg.isReadOnly()); } +TEST(ArgDescriptorIsReadOnly, GivenPointerArgWhenAccessQualifierIsReadOnlyThenReturnsTrue) { + NEO::ArgDescriptor arg; + arg.as(true); + arg.getTraits().accessQualifier = NEO::KernelArgMetadata::AccessReadOnly; + EXPECT_TRUE(arg.isReadOnly()); +} + TEST(ArgDescriptorIsReadOnly, GivenSamplerArgThenReturnsTrue) { NEO::ArgDescriptor arg; arg.as(true);