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) { 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; cl_command_queue_capabilities_intel disabledProperties = 0u;
if (EngineHelper::isCopyOnlyEngineType(type)) { 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_BUFFER_IMAGE_INTEL); // clEnqueueCopyBufferToImage
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_BUFFER_INTEL); // clEnqueueCopyImageToBuffer 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) { if (disabledProperties != 0) {
return getQueueFamilyCapabilitiesAll() & ~disabledProperties; return getQueueFamilyCapabilitiesAll() & ~disabledProperties;

View File

@ -110,9 +110,8 @@ bool MemObjHelper::isSuitableForCompression(bool compressionSupported, const Mem
} }
for (auto &pClDevice : context.getDevices()) { for (auto &pClDevice : context.getDevices()) {
auto rootDeviceIndex = pClDevice->getRootDeviceIndex(); auto rootDeviceIndex = pClDevice->getRootDeviceIndex();
auto &hwInfo = pClDevice->getHardwareInfo(); auto &clCoreHelper = pClDevice->getRootDeviceEnvironment().getHelper<ClCoreHelper>();
auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily); if (!clCoreHelper.allowCompressionForContext(*pClDevice, context)) {
if (!clHwHelper.allowCompressionForContext(*pClDevice, context)) {
return false; return false;
} }
@ -121,7 +120,7 @@ bool MemObjHelper::isSuitableForCompression(bool compressionSupported, const Mem
return false; 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 isContextSpecialized = (context.peekContextType() == ContextType::CONTEXT_TYPE_SPECIALIZED);
bool isReadOnlyAndHostNoAccess = (properties.flags.readOnly && properties.flags.hostNoAccess); bool isReadOnlyAndHostNoAccess = (properties.flags.readOnly && properties.flags.hostNoAccess);
if (!isContextSpecialized && !isReadOnlyAndHostNoAccess) { if (!isContextSpecialized && !isReadOnlyAndHostNoAccess) {

View File

@ -54,7 +54,8 @@ template <>
inline bool ClHwHelperHw<Family>::allowCompressionForContext(const ClDevice &clDevice, const Context &context) const { inline bool ClHwHelperHw<Family>::allowCompressionForContext(const ClDevice &clDevice, const Context &context) const {
auto rootDeviceIndex = clDevice.getRootDeviceIndex(); auto rootDeviceIndex = clDevice.getRootDeviceIndex();
auto &hwInfo = clDevice.getHardwareInfo(); 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 false;
} }
return true; return true;

View File

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