Add toggle for enabling indirect access

Change-Id: I35d3e1580cd51fea5f6b139d524737e400f6e1bc
Signed-off: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2020-09-08 00:08:03 -07:00
parent 145fd87f5d
commit 9ceff528b5
4 changed files with 48 additions and 0 deletions

View File

@ -359,6 +359,10 @@ ze_result_t KernelImp::suggestMaxCooperativeGroupCount(uint32_t *totalGroupCount
}
ze_result_t KernelImp::setIndirectAccess(ze_kernel_indirect_access_flags_t flags) {
if (NEO::DebugManager.flags.DisableIndirectAccess.get() == 1) {
return ZE_RESULT_SUCCESS;
}
if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE) {
this->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true;
}

View File

@ -347,6 +347,48 @@ HWTEST_F(KernelPropertiesTests, givenValidKernelIndirectAccessFlagsThenFlagsSetC
EXPECT_EQ(true, unifiedMemoryControls.indirectSharedAllocationsAllowed);
}
HWTEST_F(KernelPropertiesTests, givenValidKernelWithIndirectAccessFlagsAndDisableIndirectAccessSetToZeroThenFlagsAreSet) {
DebugManagerStateRestore restorer;
NEO::DebugManager.flags.DisableIndirectAccess.set(0);
UnifiedMemoryControls unifiedMemoryControls = kernel->getUnifiedMemoryControls();
EXPECT_EQ(false, unifiedMemoryControls.indirectDeviceAllocationsAllowed);
EXPECT_EQ(false, unifiedMemoryControls.indirectHostAllocationsAllowed);
EXPECT_EQ(false, unifiedMemoryControls.indirectSharedAllocationsAllowed);
ze_kernel_indirect_access_flags_t flags = ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE |
ZE_KERNEL_INDIRECT_ACCESS_FLAG_HOST |
ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED;
auto res = kernel->setIndirectAccess(flags);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
unifiedMemoryControls = kernel->getUnifiedMemoryControls();
EXPECT_TRUE(unifiedMemoryControls.indirectDeviceAllocationsAllowed);
EXPECT_TRUE(unifiedMemoryControls.indirectHostAllocationsAllowed);
EXPECT_TRUE(unifiedMemoryControls.indirectSharedAllocationsAllowed);
}
HWTEST_F(KernelPropertiesTests, givenValidKernelWithIndirectAccessFlagsAndDisableIndirectAccessSetToOneThenFlagsAreNotSet) {
DebugManagerStateRestore restorer;
NEO::DebugManager.flags.DisableIndirectAccess.set(1);
UnifiedMemoryControls unifiedMemoryControls = kernel->getUnifiedMemoryControls();
EXPECT_EQ(false, unifiedMemoryControls.indirectDeviceAllocationsAllowed);
EXPECT_EQ(false, unifiedMemoryControls.indirectHostAllocationsAllowed);
EXPECT_EQ(false, unifiedMemoryControls.indirectSharedAllocationsAllowed);
ze_kernel_indirect_access_flags_t flags = ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE |
ZE_KERNEL_INDIRECT_ACCESS_FLAG_HOST |
ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED;
auto res = kernel->setIndirectAccess(flags);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
unifiedMemoryControls = kernel->getUnifiedMemoryControls();
EXPECT_FALSE(unifiedMemoryControls.indirectDeviceAllocationsAllowed);
EXPECT_FALSE(unifiedMemoryControls.indirectHostAllocationsAllowed);
EXPECT_FALSE(unifiedMemoryControls.indirectSharedAllocationsAllowed);
}
HWTEST_F(KernelPropertiesTests, givenValidKernelIndirectAccessFlagsSetThenExpectKernelIndirectAllocationsAllowedTrue) {
EXPECT_EQ(false, kernel->hasIndirectAllocationsAllowed());

View File

@ -146,6 +146,7 @@ ForceDeviceEnqueueSupport = -1
ForcePipeSupport = -1
ForceSystemMemoryPlacement = 0
ForceNonSystemMemoryPlacement = 0
DisableIndirectAccess = -1
ForceOCLVersion = 0
ForceOCL21FeaturesSupport = -1
ForcePreemptionMode = -1

View File

@ -200,6 +200,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, ForceLocalMemoryAccessMode, -1, "-1: don't overr
DECLARE_DEBUG_VARIABLE(int32_t, ForceUserptrAlignment, -1, "-1: no force (4kb), >0: n kb alignment")
DECLARE_DEBUG_VARIABLE(int64_t, ForceSystemMemoryPlacement, 0, "0: default, >0: (bitmask) for given Graphics Allocation Type, force system memory placement")
DECLARE_DEBUG_VARIABLE(int64_t, ForceNonSystemMemoryPlacement, 0, "0: default, >0: (bitmask) for given Graphics Allocation Type, force non-system memory placement")
DECLARE_DEBUG_VARIABLE(int64_t, DisableIndirectAccess, -1, "0: default, 0: Indirect access for L0 kernels is enabled, 1: Indirect is disabled")
DECLARE_DEBUG_VARIABLE(bool, UseMaxSimdSizeToDeduceMaxWorkgroupSize, false, "With this flag on, max workgroup size is deduced using SIMD32 instead of SIMD8, this causes the max wkg size to be 4 times bigger")
DECLARE_DEBUG_VARIABLE(bool, ReturnRawGpuTimestamps, false, "Driver returns raw GPU tiemstamps instead of calculated ones.")
DECLARE_DEBUG_VARIABLE(bool, ForcePerDssBackedBufferProgramming, false, "Always program per-DSS memory backed buffer in preamble")