feature: check indirect access for kernel

Do not make indirect allocations resident if kernel does not use
indirect access.
For both level zero and opencl.
Currently disabled by default, enable with debug flag
DetectIndirectAccessInKernel

Related-To: NEO-7712

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek
2023-03-07 15:22:10 +00:00
committed by Compute-Runtime-Automation
parent c7311bc140
commit 69a16fd3ed
20 changed files with 354 additions and 54 deletions

View File

@@ -162,4 +162,32 @@ TEST_F(KernelHelperTest, GivenScratchEqualsZeroAndPrivetGreaterThanZeroWhenCheck
attributes.perThreadScratchSize[0] = 0;
attributes.perThreadScratchSize[1] = 0;
EXPECT_EQ(KernelHelper::checkIfThereIsSpaceForScratchOrPrivate(attributes, pDevice), KernelHelper::ErrorCode::SUCCESS);
}
TEST_F(KernelHelperTest, GivenNoPtrByValueWhenCheckingIsAnyArgumentPtrByValueThenFalseIsReturned) {
KernelDescriptor kernelDescriptor;
auto pointerArg = ArgDescriptor(ArgDescriptor::ArgTPointer);
auto valueArg = ArgDescriptor(ArgDescriptor::ArgTValue);
ArgDescValue::Element element;
element.isPtr = false;
valueArg.as<ArgDescValue>().elements.push_back(element);
kernelDescriptor.payloadMappings.explicitArgs.push_back(pointerArg);
kernelDescriptor.payloadMappings.explicitArgs.push_back(valueArg);
EXPECT_FALSE(KernelHelper::isAnyArgumentPtrByValue(kernelDescriptor));
}
TEST_F(KernelHelperTest, GivenPtrByValueWhenCheckingIsAnyArgumentPtrByValueThenTrueIsReturned) {
KernelDescriptor kernelDescriptor;
auto pointerArg = ArgDescriptor(ArgDescriptor::ArgTPointer);
auto valueArg = ArgDescriptor(ArgDescriptor::ArgTValue);
ArgDescValue::Element element;
element.isPtr = true;
valueArg.as<ArgDescValue>().elements.push_back(element);
kernelDescriptor.payloadMappings.explicitArgs.push_back(pointerArg);
kernelDescriptor.payloadMappings.explicitArgs.push_back(valueArg);
EXPECT_TRUE(KernelHelper::isAnyArgumentPtrByValue(kernelDescriptor));
}

View File

@@ -10,6 +10,7 @@
#include "shared/source/aub_mem_dump/aub_mem_dump.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/local_memory_access_modes.h"
#include "shared/source/kernel/kernel_descriptor.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/unified_memory/usm_memory_support.h"
#include "shared/test/common/fixtures/device_fixture.h"
@@ -686,4 +687,14 @@ HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckingIsUnlockingLockedPtrNe
HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckDummyBlitWaRequiredThenReturnFalse) {
EXPECT_FALSE(productHelper->isDummyBlitWaRequired());
}
HWTEST_F(ProductHelperTest, givenProductHelperAndKernelBinaryFormatsWhenCheckingIsDetectIndirectAccessInKernelSupportedThenCorrectValueIsReturned) {
KernelDescriptor kernelDescriptor;
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::Patchtokens;
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor));
kernelDescriptor.kernelAttributes.binaryFormat = DeviceBinaryFormat::Zebin;
EXPECT_FALSE(productHelper->isDetectIndirectAccessInKernelSupported(kernelDescriptor));
}