Allow multiple combinations of kernel indirect access flags

Change-Id: I96c96e1626f97dae22004eab9ea09ccd2313cb22
Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@intel.com>
This commit is contained in:
Aravind Gopalakrishnan
2020-08-04 12:14:22 -07:00
parent 5baba5e1ca
commit 513d9bdb83
2 changed files with 32 additions and 2 deletions

View File

@@ -361,9 +361,11 @@ ze_result_t KernelImp::suggestMaxCooperativeGroupCount(uint32_t *totalGroupCount
ze_result_t KernelImp::setIndirectAccess(ze_kernel_indirect_access_flags_t flags) {
if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE) {
this->unifiedMemoryControls.indirectDeviceAllocationsAllowed = true;
} else if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_HOST) {
}
if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_HOST) {
this->unifiedMemoryControls.indirectHostAllocationsAllowed = true;
} else if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED) {
}
if (flags & ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED) {
this->unifiedMemoryControls.indirectSharedAllocationsAllowed = true;
}

View File

@@ -329,6 +329,34 @@ HWTEST_F(KernelPropertiesTests, givenValidKernelThenPropertiesAreRetrieved) {
sizeof(kernelProperties.uuid.mid)));
}
HWTEST_F(KernelPropertiesTests, givenValidKernelIndirectAccessFlagsThenFlagsSetCorrectly) {
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_EQ(true, unifiedMemoryControls.indirectDeviceAllocationsAllowed);
EXPECT_EQ(true, unifiedMemoryControls.indirectHostAllocationsAllowed);
EXPECT_EQ(true, unifiedMemoryControls.indirectSharedAllocationsAllowed);
}
HWTEST_F(KernelPropertiesTests, givenValidKernelIndirectAccessFlagsSetThenExpectKernelIndirectAllocationsAllowedTrue) {
EXPECT_EQ(false, kernel->hasIndirectAllocationsAllowed());
ze_kernel_indirect_access_flags_t flags = ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE;
auto res = kernel->setIndirectAccess(flags);
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
EXPECT_EQ(true, kernel->hasIndirectAllocationsAllowed());
}
HWTEST_F(KernelPropertiesTests, givenValidKernelAndNoMediavfestateThenSpillMemSizeIsZero) {
ze_kernel_properties_t kernelProperties = {};