Move ClCoreHelper ownership to RootDeviceEnvironment 2/n

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

Use RootDeviceEnvironment getHelper<ClCoreHelper> for
- allowCompressionForContext
- getAdditionalDisabledQueueFamilyCapabilities
This commit is contained in:
Kamil Kopryk
2022-11-15 11:46:45 +00:00
committed by Compute-Runtime-Automation
parent a17df8fa86
commit ca06046f84
4 changed files with 13 additions and 11 deletions

View File

@ -216,7 +216,7 @@ cl_command_queue_capabilities_intel ClDevice::getQueueFamilyCapabilitiesAll() {
}
cl_command_queue_capabilities_intel ClDevice::getQueueFamilyCapabilities(EngineGroupType type) {
auto &clHwHelper = NEO::ClHwHelper::get(getHardwareInfo().platform.eRenderCoreFamily);
auto &clCoreHelper = this->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
cl_command_queue_capabilities_intel disabledProperties = 0u;
if (EngineHelper::isCopyOnlyEngineType(type)) {
@ -227,7 +227,7 @@ cl_command_queue_capabilities_intel ClDevice::getQueueFamilyCapabilities(EngineG
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_IMAGE_INTEL); // clEnqueueCopyBufferToImage
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_BUFFER_INTEL); // clEnqueueCopyImageToBuffer
}
disabledProperties |= clHwHelper.getAdditionalDisabledQueueFamilyCapabilities(type);
disabledProperties |= clCoreHelper.getAdditionalDisabledQueueFamilyCapabilities(type);
if (disabledProperties != 0) {
return getQueueFamilyCapabilitiesAll() & ~disabledProperties;

View File

@ -110,9 +110,8 @@ bool MemObjHelper::isSuitableForCompression(bool compressionSupported, const Mem
}
for (auto &pClDevice : context.getDevices()) {
auto rootDeviceIndex = pClDevice->getRootDeviceIndex();
auto &hwInfo = pClDevice->getHardwareInfo();
auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
if (!clHwHelper.allowCompressionForContext(*pClDevice, context)) {
auto &clCoreHelper = pClDevice->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
if (!clCoreHelper.allowCompressionForContext(*pClDevice, context)) {
return false;
}
@ -121,7 +120,7 @@ bool MemObjHelper::isSuitableForCompression(bool compressionSupported, const Mem
return false;
}
//for unrestrictive and default context, turn on compression only for read only surfaces with no host access.
// for unrestrictive and default context, turn on compression only for read only surfaces with no host access.
bool isContextSpecialized = (context.peekContextType() == ContextType::CONTEXT_TYPE_SPECIALIZED);
bool isReadOnlyAndHostNoAccess = (properties.flags.readOnly && properties.flags.hostNoAccess);
if (!isContextSpecialized && !isReadOnlyAndHostNoAccess) {

View File

@ -54,7 +54,8 @@ template <>
inline bool ClHwHelperHw<Family>::allowCompressionForContext(const ClDevice &clDevice, const Context &context) const {
auto rootDeviceIndex = clDevice.getRootDeviceIndex();
auto &hwInfo = clDevice.getHardwareInfo();
if (context.containsMultipleSubDevices(rootDeviceIndex) && HwHelperHw<Family>::get().isWorkaroundRequired(REVISION_A0, REVISION_A1, hwInfo)) {
auto &coreHelper = clDevice.getRootDeviceEnvironment().getHelper<CoreHelper>();
if (context.containsMultipleSubDevices(rootDeviceIndex) && coreHelper.isWorkaroundRequired(REVISION_A0, REVISION_A1, hwInfo)) {
return false;
}
return true;

View File

@ -376,7 +376,6 @@ TEST(MemObjHelper, givenDifferentCapabilityAndDebugFlagValuesWhenCheckingBufferC
DebugManagerStateRestore debugRestore;
VariableBackup<bool> renderCompressedBuffersCapability{&defaultHwInfo->capabilityTable.ftrRenderCompressedBuffers};
int32_t enableMultiTileCompressionValues[] = {-1, 0, 1};
auto &clHwHelper = ClHwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
for (auto ftrRenderCompressedBuffers : ::testing::Bool()) {
renderCompressedBuffersCapability = ftrRenderCompressedBuffers;
@ -385,6 +384,8 @@ TEST(MemObjHelper, givenDifferentCapabilityAndDebugFlagValuesWhenCheckingBufferC
MockSpecializedContext context;
auto &device = context.getDevice(0)->getDevice();
auto &clCoreHelper = device.getRootDeviceEnvironment().getHelper<ClCoreHelper>();
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, &device);
bool compressionEnabled = MemObjHelper::isSuitableForCompression(HwHelper::compressedBuffersSupported(*defaultHwInfo), memoryProperties, context, true);
@ -393,7 +394,7 @@ TEST(MemObjHelper, givenDifferentCapabilityAndDebugFlagValuesWhenCheckingBufferC
memoryProperties, context, compressionEnabled, false);
bool expectBufferCompressed = ftrRenderCompressedBuffers && (enableMultiTileCompressionValue == 1);
if (expectBufferCompressed && clHwHelper.allowCompressionForContext(*context.getDevice(0), context)) {
if (expectBufferCompressed && clCoreHelper.allowCompressionForContext(*context.getDevice(0), context)) {
EXPECT_TRUE(compressionEnabled);
} else {
EXPECT_FALSE(compressionEnabled);
@ -416,7 +417,6 @@ TEST(MemObjHelper, givenDifferentValuesWhenCheckingBufferCompressionSupportThenC
ContextType::CONTEXT_TYPE_UNRESTRICTIVE};
__REVID steppingValues[] = {REVISION_A0, REVISION_B};
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
auto &clHwHelper = ClHwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
for (auto stepping : steppingValues) {
hardwareStepping = hwInfoConfig.getHwRevIdFromStepping(stepping, *defaultHwInfo);
@ -446,6 +446,8 @@ TEST(MemObjHelper, givenDifferentValuesWhenCheckingBufferCompressionSupportThenC
for (auto flagsIntel : flagsIntelValues) {
auto &device = context.getDevice(0)->getDevice();
auto &clCoreHelper = device.getRootDeviceEnvironment().getHelper<ClCoreHelper>();
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel,
0, &device);
@ -460,7 +462,7 @@ TEST(MemObjHelper, givenDifferentValuesWhenCheckingBufferCompressionSupportThenC
bool isMultiTile = (numSubDevices > 1);
if (expectBufferCompressed && isMultiTile) {
bool isBufferReadOnly = isValueSet(flags, CL_MEM_READ_ONLY | CL_MEM_HOST_NO_ACCESS);
expectBufferCompressed = clHwHelper.allowCompressionForContext(*context.getDevice(0), context) &&
expectBufferCompressed = clCoreHelper.allowCompressionForContext(*context.getDevice(0), context) &&
((contextType == ContextType::CONTEXT_TYPE_SPECIALIZED) || isBufferReadOnly);
}