From 6f62a784e143fbaea0bbe78b2063994c809b5e6c Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Fri, 4 Feb 2022 05:11:41 +0100 Subject: [PATCH] Revert "Check IndirectStatelessCount from igc" This reverts commit 5e62df4f8eb6720edd09f0399e0634a0afda9978. Signed-off-by: Compute-Runtime-Validation --- level_zero/core/source/kernel/kernel_imp.cpp | 7 ++-- level_zero/core/source/kernel/kernel_imp.h | 2 +- .../test/unit_tests/fixtures/module_fixture.h | 3 +- .../core/test/unit_tests/mocks/mock_kernel.h | 1 - .../test_cmdlist_append_launch_kernel_1.cpp | 2 +- .../sources/cmdqueue/test_cmdqueue_1.cpp | 6 ++-- .../unit_tests/sources/kernel/test_kernel.cpp | 21 ------------ opencl/source/kernel/kernel.cpp | 8 +++-- opencl/test/unit_test/kernel/kernel_tests.cpp | 32 +------------------ .../device_binary_format/zebin_decoder.cpp | 3 -- shared/source/kernel/kernel_descriptor.h | 6 ++-- shared/source/unified_memory/unified_memory.h | 4 --- 12 files changed, 18 insertions(+), 77 deletions(-) diff --git a/level_zero/core/source/kernel/kernel_imp.cpp b/level_zero/core/source/kernel/kernel_imp.cpp index 7d8dff754c..8e8d13b91e 100644 --- a/level_zero/core/source/kernel/kernel_imp.cpp +++ b/level_zero/core/source/kernel/kernel_imp.cpp @@ -851,8 +851,7 @@ ze_result_t KernelImp::initialize(const ze_kernel_desc_t *desc) { kernelHasIndirectAccess = kernelDescriptor.kernelAttributes.hasNonKernelArgLoad || kernelDescriptor.kernelAttributes.hasNonKernelArgStore || - kernelDescriptor.kernelAttributes.hasNonKernelArgAtomic || - getImmutableData()->getKernelInfo()->hasIndirectStatelessAccess; + kernelDescriptor.kernelAttributes.hasNonKernelArgAtomic; if (this->usesRayTracing()) { if (this->getImmutableData()->getDescriptor().payloadMappings.implicitArgs.rtDispatchGlobals.pointerSize > 0) { @@ -979,7 +978,9 @@ Kernel *Kernel::create(uint32_t productFamily, Module *module, } bool KernelImp::hasIndirectAllocationsAllowed() const { - return kernelHasIndirectAccess && unifiedMemoryControls.anyIndirectAllocationsAllowed(); + return (unifiedMemoryControls.indirectDeviceAllocationsAllowed || + unifiedMemoryControls.indirectHostAllocationsAllowed || + unifiedMemoryControls.indirectSharedAllocationsAllowed); } uint32_t KernelImp::getSlmTotalSize() const { diff --git a/level_zero/core/source/kernel/kernel_imp.h b/level_zero/core/source/kernel/kernel_imp.h index 9568901b0c..761dc923cf 100644 --- a/level_zero/core/source/kernel/kernel_imp.h +++ b/level_zero/core/source/kernel/kernel_imp.h @@ -139,7 +139,7 @@ struct KernelImp : Kernel { return ZE_RESULT_SUCCESS; } - bool hasIndirectAccess() const { + bool hasIndirectAccess() { return kernelHasIndirectAccess; } diff --git a/level_zero/core/test/unit_tests/fixtures/module_fixture.h b/level_zero/core/test/unit_tests/fixtures/module_fixture.h index c8fca96819..7c73fbee39 100644 --- a/level_zero/core/test/unit_tests/fixtures/module_fixture.h +++ b/level_zero/core/test/unit_tests/fixtures/module_fixture.h @@ -224,14 +224,13 @@ struct ModuleFixture : public DeviceFixture { module.reset(Module::create(device, &moduleDesc, moduleBuildLog, type)); } - void createKernel(bool kernelHasIndirectAccess = false) { + void createKernel() { ze_kernel_desc_t desc = {}; desc.pKernelName = kernelName.c_str(); kernel = std::make_unique>(); kernel->module = module.get(); kernel->initialize(&desc); - kernel->kernelHasIndirectAccess = kernelHasIndirectAccess; } void TearDown() { diff --git a/level_zero/core/test/unit_tests/mocks/mock_kernel.h b/level_zero/core/test/unit_tests/mocks/mock_kernel.h index c5252db844..0f873fc821 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_kernel.h +++ b/level_zero/core/test/unit_tests/mocks/mock_kernel.h @@ -45,7 +45,6 @@ struct WhiteBox<::L0::Kernel> : public ::L0::KernelImp { using ::L0::KernelImp::crossThreadData; using ::L0::KernelImp::crossThreadDataSize; using ::L0::KernelImp::groupSize; - using ::L0::KernelImp::kernelHasIndirectAccess; using ::L0::KernelImp::kernelImmData; using ::L0::KernelImp::kernelRequiresGenerationOfLocalIdsByRuntime; using ::L0::KernelImp::module; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp index 3975a15c11..b97472336d 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_1.cpp @@ -26,7 +26,7 @@ namespace ult { using CommandListAppendLaunchKernel = Test; HWTEST_F(CommandListAppendLaunchKernel, givenKernelWithIndirectAllocationsAllowedThenCommandListReturnsExpectedIndirectAllocationsAllowed) { - createKernel(true); + createKernel(); kernel->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true; kernel->unifiedMemoryControls.indirectSharedAllocationsAllowed = true; kernel->unifiedMemoryControls.indirectHostAllocationsAllowed = true; diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp index 36dfd27bc7..8394f43332 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_1.cpp @@ -784,7 +784,7 @@ HWTEST_F(CommandQueueIndirectAllocations, givenCommandQueueWhenExecutingCommandL auto gpuAlloc = device->getDriverHandle()->getSvmAllocsManager()->getSVMAllocs()->get(deviceAlloc)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex()); ASSERT_NE(nullptr, gpuAlloc); - createKernel(true); + createKernel(); kernel->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true; EXPECT_TRUE(kernel->getUnifiedMemoryControls().indirectDeviceAllocationsAllowed); @@ -843,7 +843,7 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDebugModeToTreatIndirectAllocatio auto gpuAlloc = device->getDriverHandle()->getSvmAllocsManager()->getSVMAllocs()->get(deviceAlloc)->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex()); ASSERT_NE(nullptr, gpuAlloc); - createKernel(true); + createKernel(); kernel->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true; EXPECT_TRUE(kernel->getUnifiedMemoryControls().indirectDeviceAllocationsAllowed); @@ -903,7 +903,6 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDeviceThatSupportsSubmittingIndir createKernel(); kernel->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true; - kernel->kernelHasIndirectAccess = true; EXPECT_TRUE(kernel->getUnifiedMemoryControls().indirectDeviceAllocationsAllowed); ze_group_count_t groupCount{1, 1, 1}; @@ -966,7 +965,6 @@ HWTEST_F(CommandQueueIndirectAllocations, givenDeviceThatSupportsSubmittingIndir createKernel(); kernel->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true; - kernel->kernelHasIndirectAccess = true; EXPECT_TRUE(kernel->getUnifiedMemoryControls().indirectDeviceAllocationsAllowed); static_cast(driverHandle.get()->getMemoryManager())->overrideAllocateAsPackReturn = 1u; diff --git a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp index 92ba3f17eb..bba9ca887b 100644 --- a/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp +++ b/level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp @@ -827,7 +827,6 @@ TEST_F(KernelIndirectPropertiesFromIGCTests, whenInitializingKernelWithNoKernelL module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgLoad = false; module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgStore = false; module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgAtomic = false; - module->mockKernelImmData->mockKernelInfo->hasIndirectStatelessAccess = false; kernel->initialize(&desc); @@ -856,7 +855,6 @@ TEST_F(KernelIndirectPropertiesFromIGCTests, whenInitializingKernelWithKernelLoa module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgLoad = true; module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgStore = false; module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgAtomic = false; - module->mockKernelImmData->mockKernelInfo->hasIndirectStatelessAccess = false; kernel->initialize(&desc); @@ -873,7 +871,6 @@ TEST_F(KernelIndirectPropertiesFromIGCTests, whenInitializingKernelWithKernelLoa module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgLoad = false; module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgStore = true; module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgAtomic = false; - module->mockKernelImmData->mockKernelInfo->hasIndirectStatelessAccess = false; kernel->initialize(&desc); @@ -890,24 +887,6 @@ TEST_F(KernelIndirectPropertiesFromIGCTests, whenInitializingKernelWithKernelLoa module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgLoad = false; module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgStore = false; module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgAtomic = true; - module->mockKernelImmData->mockKernelInfo->hasIndirectStatelessAccess = false; - - kernel->initialize(&desc); - - EXPECT_TRUE(kernel->hasIndirectAccess()); - } - - { - std::unique_ptr kernel; - kernel = std::make_unique(module.get()); - - ze_kernel_desc_t desc = {}; - desc.pKernelName = kernelName.c_str(); - - module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgLoad = false; - module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgStore = false; - module->mockKernelImmData->mockKernelDescriptor->kernelAttributes.hasNonKernelArgAtomic = false; - module->mockKernelImmData->mockKernelInfo->hasIndirectStatelessAccess = true; kernel->initialize(&desc); diff --git a/opencl/source/kernel/kernel.cpp b/opencl/source/kernel/kernel.cpp index d0910c901c..5b823f442f 100644 --- a/opencl/source/kernel/kernel.cpp +++ b/opencl/source/kernel/kernel.cpp @@ -259,8 +259,7 @@ cl_int Kernel::initialize() { this->kernelHasIndirectAccess |= kernelInfo.kernelDescriptor.kernelAttributes.hasNonKernelArgLoad || kernelInfo.kernelDescriptor.kernelAttributes.hasNonKernelArgStore || - kernelInfo.kernelDescriptor.kernelAttributes.hasNonKernelArgAtomic || - kernelInfo.hasIndirectStatelessAccess; + kernelInfo.kernelDescriptor.kernelAttributes.hasNonKernelArgAtomic; provideInitializationHints(); // resolve the new kernel info to account for kernel handlers @@ -1233,7 +1232,10 @@ void Kernel::makeResident(CommandStreamReceiver &commandStreamReceiver) { } gtpinNotifyMakeResident(this, &commandStreamReceiver); - if (kernelHasIndirectAccess && unifiedMemoryControls.anyIndirectAllocationsAllowed()) { + + if (unifiedMemoryControls.indirectDeviceAllocationsAllowed || + unifiedMemoryControls.indirectHostAllocationsAllowed || + unifiedMemoryControls.indirectSharedAllocationsAllowed) { this->getContext().getSVMAllocsManager()->makeInternalAllocationsResident(commandStreamReceiver, unifiedMemoryControls.generateMask()); } } diff --git a/opencl/test/unit_test/kernel/kernel_tests.cpp b/opencl/test/unit_test/kernel/kernel_tests.cpp index 3432541dd3..42262d2004 100644 --- a/opencl/test/unit_test/kernel/kernel_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_tests.cpp @@ -1543,13 +1543,12 @@ HWTEST_F(KernelResidencyTest, givenKernelWhenclSetKernelExecInfoWithUnifiedMemor EXPECT_FALSE(mockKernel.mockKernel->unifiedMemoryControls.indirectSharedAllocationsAllowed); } -HWTEST_F(KernelResidencyTest, givenKernelWithNoKernelArgLoadNorKernelArgStoreNorKernelArgAtomicNorHasIndirectStatelessAccessThenKernelHasIndirectAccessIsSetToFalse) { +HWTEST_F(KernelResidencyTest, givenKernelWithNoKernelArgLoadNorKernelArgStoreNorKernelArgAtomicThenKernelHasIndirectAccessIsSetToFalse) { auto pKernelInfo = std::make_unique(); pKernelInfo->kernelDescriptor.kernelAttributes.simdSize = 1; pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgLoad = false; pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgStore = false; pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgAtomic = false; - pKernelInfo->hasIndirectStatelessAccess = false; auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); commandStreamReceiver.storeMakeResidentAllocations = true; @@ -1575,7 +1574,6 @@ HWTEST_F(KernelResidencyTest, givenKernelWithNoKernelArgLoadThenKernelHasIndirec pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgLoad = true; pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgStore = false; pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgAtomic = false; - pKernelInfo->hasIndirectStatelessAccess = false; auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); commandStreamReceiver.storeMakeResidentAllocations = true; @@ -1601,7 +1599,6 @@ HWTEST_F(KernelResidencyTest, givenKernelWithNoKernelArgStoreThenKernelHasIndire pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgLoad = false; pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgStore = true; pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgAtomic = false; - pKernelInfo->hasIndirectStatelessAccess = false; auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); commandStreamReceiver.storeMakeResidentAllocations = true; @@ -1627,33 +1624,6 @@ HWTEST_F(KernelResidencyTest, givenKernelWithNoKernelArgAtomicThenKernelHasIndir pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgLoad = false; pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgStore = false; pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgAtomic = true; - pKernelInfo->hasIndirectStatelessAccess = false; - - auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); - commandStreamReceiver.storeMakeResidentAllocations = true; - - auto memoryManager = commandStreamReceiver.getMemoryManager(); - pKernelInfo->kernelAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize}); - - MockProgram program(toClDeviceVector(*pClDevice)); - MockContext ctx; - program.setContext(&ctx); - program.buildInfos[pDevice->getRootDeviceIndex()].globalSurface = new MockGraphicsAllocation(); - std::unique_ptr pKernel(new MockKernel(&program, *pKernelInfo, *pClDevice)); - ASSERT_EQ(CL_SUCCESS, pKernel->initialize()); - - EXPECT_TRUE(pKernel->getHasIndirectAccess()); - - memoryManager->freeGraphicsMemory(pKernelInfo->kernelAllocation); -} - -HWTEST_F(KernelResidencyTest, givenKernelWithhasIndirectStatelessAccessThenKernelHasIndirectAccessIsSetToTrue) { - auto pKernelInfo = std::make_unique(); - pKernelInfo->kernelDescriptor.kernelAttributes.simdSize = 1; - pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgLoad = false; - pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgStore = false; - pKernelInfo->kernelDescriptor.kernelAttributes.hasNonKernelArgAtomic = false; - pKernelInfo->hasIndirectStatelessAccess = true; auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver(); commandStreamReceiver.storeMakeResidentAllocations = true; diff --git a/shared/source/device_binary_format/zebin_decoder.cpp b/shared/source/device_binary_format/zebin_decoder.cpp index 7328f01a7b..3550563573 100644 --- a/shared/source/device_binary_format/zebin_decoder.cpp +++ b/shared/source/device_binary_format/zebin_decoder.cpp @@ -317,9 +317,6 @@ DecodeError readZeInfoExperimentalProperties(const NEO::Yaml::YamlParser &parser ConstStringRef context, std::string &outErrReason, std::string &outWarning) { bool validExperimentalProperty = true; - outExperimentalProperties.hasNonKernelArgLoad = true; - outExperimentalProperties.hasNonKernelArgStore = true; - outExperimentalProperties.hasNonKernelArgAtomic = true; for (const auto &experimentalPropertyNd : parser.createChildrenRange(node)) { for (const auto &experimentalPropertyMemberNd : parser.createChildrenRange(experimentalPropertyNd)) { auto key = parser.readKey(experimentalPropertyMemberNd); diff --git a/shared/source/kernel/kernel_descriptor.h b/shared/source/kernel/kernel_descriptor.h index 2d1c74ac82..e08efbfce9 100644 --- a/shared/source/kernel/kernel_descriptor.h +++ b/shared/source/kernel/kernel_descriptor.h @@ -156,9 +156,9 @@ struct KernelDescriptor { uint16_t numArgsToPatch = 0U; uint16_t numGrfRequired = 0U; uint8_t barrierCount = 0u; - bool hasNonKernelArgLoad = false; - bool hasNonKernelArgStore = false; - bool hasNonKernelArgAtomic = false; + bool hasNonKernelArgLoad = true; + bool hasNonKernelArgStore = true; + bool hasNonKernelArgAtomic = true; AddressingMode bufferAddressingMode = BindfulAndStateless; AddressingMode imageAddressingMode = Bindful; diff --git a/shared/source/unified_memory/unified_memory.h b/shared/source/unified_memory/unified_memory.h index 82324ed991..a93a15acf6 100644 --- a/shared/source/unified_memory/unified_memory.h +++ b/shared/source/unified_memory/unified_memory.h @@ -21,8 +21,4 @@ struct UnifiedMemoryControls { bool indirectDeviceAllocationsAllowed = false; bool indirectHostAllocationsAllowed = false; bool indirectSharedAllocationsAllowed = false; - - bool anyIndirectAllocationsAllowed() const { - return indirectDeviceAllocationsAllowed || indirectHostAllocationsAllowed || indirectSharedAllocationsAllowed; - } };