Move ClCoreHelper ownership to RootDeviceEnvironment 6/n

Related-To: NEO-6853
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>

Use RootDeviceEnvironment getHelper<ClCoreHelper> for
- allowImageCompression
- isFormatRedescribable
This commit is contained in:
Kamil Kopryk
2022-11-18 11:25:53 +00:00
committed by Compute-Runtime-Automation
parent 74d29214e6
commit 3b97ca8709
4 changed files with 10 additions and 11 deletions

View File

@ -158,11 +158,11 @@ Image *Image::create(Context *context,
return nullptr;
}
auto &clHwHelper = context->getDevice(0)->getRootDeviceEnvironment().getHelper<ClHwHelper>();
auto &clCoreHelper = context->getDevice(0)->getRootDeviceEnvironment().getHelper<ClHwHelper>();
bool preferCompression = MemObjHelper::isSuitableForCompression(!imgInfo.linearStorage, memoryProperties,
*context, true);
preferCompression &= clHwHelper.allowImageCompression(surfaceFormat->OCLImageFormat);
preferCompression &= !clHwHelper.isFormatRedescribable(surfaceFormat->OCLImageFormat);
preferCompression &= clCoreHelper.allowImageCompression(surfaceFormat->OCLImageFormat);
preferCompression &= !clCoreHelper.isFormatRedescribable(surfaceFormat->OCLImageFormat);
MemoryManager *memoryManager = context->getMemoryManager();
size_t hostPtrMinSize = getHostPtrMinSize(imageDesc->image_type, surfaceFormat->OCLImageFormat,

View File

@ -142,15 +142,14 @@ HWCMDTEST_F(IGFX_GEN8_CORE, ClHwHelperTest, givenCLImageFormatsWhenCallingIsForm
{CL_RGBA, CL_UNSIGNED_INT32},
};
auto &clHwHelper = ClHwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
const ArrayRef<const ClSurfaceFormatInfo> formats = SurfaceFormats::readWrite();
auto &clCoreHelper = getHelper<ClCoreHelper>();
auto formats = SurfaceFormats::readWrite();
for (const auto &format : formats) {
const cl_image_format oclFormat = format.OCLImageFormat;
bool expectedResult = true;
for (const auto &nonRedescribableFormat : redescribeFormats) {
expectedResult &= (memcmp(&oclFormat, &nonRedescribableFormat, sizeof(cl_image_format)) != 0);
}
EXPECT_EQ(expectedResult, clHwHelper.isFormatRedescribable(oclFormat));
EXPECT_EQ(expectedResult, clCoreHelper.isFormatRedescribable(oclFormat));
}
}

View File

@ -22,7 +22,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, ClHwHelperTestXeHpAndLater, givenCLImageFormatsWhen
{CL_RG, CL_UNSIGNED_INT32},
{CL_RGBA, CL_UNSIGNED_INT32},
};
MockContext context;
auto &clCoreHelper = getHelper<ClCoreHelper>();
for (const auto &format : redescribeFormats) {
EXPECT_EQ(false, clCoreHelper.isFormatRedescribable(format));

View File

@ -114,11 +114,11 @@ XE_HPG_CORETEST_F(ClHwHelperTestsXeHpgCore, givenDifferentCLImageFormatsWhenCall
{{CL_R, CL_UNORM_INT8}, true},
{{CL_R, CL_UNORM_INT16}, true},
};
MockContext context;
auto &clHwHelper = ClHwHelper::get(context.getDevice(0)->getHardwareInfo().platform.eRenderCoreFamily);
auto &clCoreHelper = getHelper<ClCoreHelper>();
for (const auto &format : imageFormats) {
bool result = clHwHelper.allowImageCompression(format.imageFormat);
bool result = clCoreHelper.allowImageCompression(format.imageFormat);
EXPECT_EQ(format.isCompressable, result);
}
}