Add Debug flags to force Pipe and Device Enqueue support

New flags are ForcePipeSupport and ForceDeviceEnqueueSupport.
Flag DisableDeviceEnqueue has been removed.

Change-Id: I8794222ee26dc8001af29c45cb9f63381e18e5c4
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski 2020-06-23 17:47:08 +02:00 committed by sys_ocldev
parent 251994149a
commit 5dc3aed5b9
8 changed files with 103 additions and 11 deletions

View File

@ -181,13 +181,16 @@ DeviceBitfield ClDevice::getDeviceBitfield() const {
} }
bool ClDevice::isDeviceEnqueueSupported() const { bool ClDevice::isDeviceEnqueueSupported() const {
if (DebugManager.flags.DisableDeviceEnqueue.get()) { if (DebugManager.flags.ForceDeviceEnqueueSupport.get() != -1) {
return false; return DebugManager.flags.ForceDeviceEnqueueSupport.get();
} }
return device.getHardwareInfo().capabilityTable.supportsDeviceEnqueue; return device.getHardwareInfo().capabilityTable.supportsDeviceEnqueue;
} }
bool ClDevice::arePipesSupported() const { bool ClDevice::arePipesSupported() const {
if (DebugManager.flags.ForcePipeSupport.get() != -1) {
return DebugManager.flags.ForcePipeSupport.get();
}
return device.getHardwareInfo().capabilityTable.supportsPipes; return device.getHardwareInfo().capabilityTable.supportsPipes;
} }

View File

@ -260,7 +260,7 @@ void ClDevice::initializeCaps() {
deviceInfo.minDataTypeAlignSize = 128; deviceInfo.minDataTypeAlignSize = 128;
deviceInfo.deviceEnqueueSupport = isDeviceEnqueueSupported(); deviceInfo.deviceEnqueueSupport = isDeviceEnqueueSupported();
if (isDeviceEnqueueSupported() || (enabledClVersion == 21)) { if (isDeviceEnqueueSupported()) {
deviceInfo.maxOnDeviceQueues = 1; deviceInfo.maxOnDeviceQueues = 1;
deviceInfo.maxOnDeviceEvents = 1024; deviceInfo.maxOnDeviceEvents = 1024;
deviceInfo.queueOnDeviceMaxSize = 64 * MB; deviceInfo.queueOnDeviceMaxSize = 64 * MB;

View File

@ -7,6 +7,7 @@
#include "opencl/source/platform/extensions.h" #include "opencl/source/platform/extensions.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/string.h" #include "shared/source/helpers/string.h"
@ -112,12 +113,16 @@ void getOpenclCFeaturesList(const HardwareInfo &hwInfo, StackVec<cl_name_version
} }
} }
if (hwInfo.capabilityTable.supportsDeviceEnqueue) { auto forceDeviceEnqueueSupport = DebugManager.flags.ForceDeviceEnqueueSupport.get();
if ((hwInfo.capabilityTable.supportsDeviceEnqueue && (forceDeviceEnqueueSupport == -1)) ||
(forceDeviceEnqueueSupport == 1)) {
strcpy_s(openClCFeature.name, CL_NAME_VERSION_MAX_NAME_SIZE, "__opencl_c_device_enqueue"); strcpy_s(openClCFeature.name, CL_NAME_VERSION_MAX_NAME_SIZE, "__opencl_c_device_enqueue");
openclCFeatures.push_back(openClCFeature); openclCFeatures.push_back(openClCFeature);
} }
if (hwInfo.capabilityTable.supportsPipes) { auto forcePipeSupport = DebugManager.flags.ForcePipeSupport.get();
if ((hwInfo.capabilityTable.supportsPipes && (forcePipeSupport == -1)) ||
(forcePipeSupport == 1)) {
strcpy_s(openClCFeature.name, CL_NAME_VERSION_MAX_NAME_SIZE, "__opencl_c_pipes"); strcpy_s(openClCFeature.name, CL_NAME_VERSION_MAX_NAME_SIZE, "__opencl_c_pipes");
openclCFeatures.push_back(openClCFeature); openclCFeatures.push_back(openClCFeature);
} }

View File

@ -343,7 +343,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenMedPriorityWhenCreatingOoqCom
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceEnqueueDisabledWhenCreatingDeviceQueueThenNullQueueAndInvalidQueuePropertiesErrorIsReturned) { TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceEnqueueDisabledWhenCreatingDeviceQueueThenNullQueueAndInvalidQueuePropertiesErrorIsReturned) {
DebugManagerStateRestore restorer; DebugManagerStateRestore restorer;
DebugManager.flags.DisableDeviceEnqueue.set(true); DebugManager.flags.ForceDeviceEnqueueSupport.set(0);
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)); auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockContext context{pClDevice.get()}; MockContext context{pClDevice.get()};
@ -357,7 +357,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceEnqueueDisabledWhenCrea
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceEnqueueDisabledWhenCreatingDefaultDeviceQueueThenNullQueueAndInvalidQueuePropertiesErrorIsReturned) { TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceEnqueueDisabledWhenCreatingDefaultDeviceQueueThenNullQueueAndInvalidQueuePropertiesErrorIsReturned) {
DebugManagerStateRestore restorer; DebugManagerStateRestore restorer;
DebugManager.flags.DisableDeviceEnqueue.set(true); DebugManager.flags.ForceDeviceEnqueueSupport.set(0);
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)); auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockContext context{pClDevice.get()}; MockContext context{pClDevice.get()};

View File

@ -90,7 +90,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenNullDevi
TEST_F(clSetDefaultDeviceCommandQueueApiTest, GivenDeviceNotSupportingDeviceEnqueueWhenSettingDefaultDeviceQueueThenClInvalidOperationErrorIsReturned) { TEST_F(clSetDefaultDeviceCommandQueueApiTest, GivenDeviceNotSupportingDeviceEnqueueWhenSettingDefaultDeviceQueueThenClInvalidOperationErrorIsReturned) {
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.DisableDeviceEnqueue.set(true); DebugManager.flags.ForceDeviceEnqueueSupport.set(0);
retVal = clSetDefaultDeviceCommandQueue(pContext, testedClDevice, nullptr); retVal = clSetDefaultDeviceCommandQueue(pContext, testedClDevice, nullptr);
ASSERT_EQ(CL_INVALID_OPERATION, retVal); ASSERT_EQ(CL_INVALID_OPERATION, retVal);

View File

@ -1152,7 +1152,7 @@ TEST(DeviceGetCaps, givenDebugFlagToDisableDeviceEnqueuesWhenCreatingDeviceThenD
} }
DebugManagerStateRestore dbgRestorer; DebugManagerStateRestore dbgRestorer;
DebugManager.flags.DisableDeviceEnqueue.set(true); DebugManager.flags.ForceDeviceEnqueueSupport.set(0);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)); auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
const auto &caps = device->getDeviceInfo(); const auto &caps = device->getDeviceInfo();
@ -1299,6 +1299,88 @@ TEST_F(DeviceGetCapsTest, givenOcl21DeviceWhenCheckingPipesSupportThenPipesAreSu
} }
} }
TEST_F(DeviceGetCapsTest, givenDeviceEnqueueSupportForcedWhenCheckingDeviceEnqueueSupportThenDeviceEnqueueIsCorrectlyReported) {
DebugManagerStateRestore dbgRestorer;
int32_t forceDeviceEnqueueSupportValues[] = {-1, 0, 1};
auto hwInfo = *defaultHwInfo;
for (auto isDeviceEnqueueSupportedByHw : ::testing::Bool()) {
hwInfo.capabilityTable.supportsDeviceEnqueue = isDeviceEnqueueSupportedByHw;
for (auto forceDeviceEnqueueSupport : forceDeviceEnqueueSupportValues) {
DebugManager.flags.ForceDeviceEnqueueSupport.set(forceDeviceEnqueueSupport);
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
auto &caps = pClDevice->getDeviceInfo();
size_t deviceEnqueueFeaturesCount = 0;
for (auto &openclCFeature : caps.openclCFeatures) {
if (0 == strcmp(openclCFeature.name, "__opencl_c_device_enqueue")) {
deviceEnqueueFeaturesCount++;
}
}
bool expectedDeviceEnqueueSupport =
((forceDeviceEnqueueSupport == -1) ? isDeviceEnqueueSupportedByHw : forceDeviceEnqueueSupport);
if (expectedDeviceEnqueueSupport) {
EXPECT_TRUE(pClDevice->isDeviceEnqueueSupported());
EXPECT_EQ(1024u, caps.maxOnDeviceEvents);
EXPECT_EQ(1u, caps.maxOnDeviceQueues);
EXPECT_EQ(64u * MB, caps.queueOnDeviceMaxSize);
EXPECT_EQ(128 * KB, caps.queueOnDevicePreferredSize);
EXPECT_EQ(static_cast<cl_command_queue_properties>(CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE),
caps.queueOnDeviceProperties);
EXPECT_EQ(1u, deviceEnqueueFeaturesCount);
} else {
EXPECT_FALSE(pClDevice->isDeviceEnqueueSupported());
EXPECT_EQ(0u, caps.maxOnDeviceEvents);
EXPECT_EQ(0u, caps.maxOnDeviceQueues);
EXPECT_EQ(0u, caps.queueOnDeviceMaxSize);
EXPECT_EQ(0u, caps.queueOnDevicePreferredSize);
EXPECT_EQ(static_cast<cl_command_queue_properties>(0), caps.queueOnDeviceProperties);
EXPECT_EQ(0u, deviceEnqueueFeaturesCount);
}
}
}
}
TEST_F(DeviceGetCapsTest, givenPipeSupportForcedWhenCheckingPipeSupportThenPipeIsCorrectlyReported) {
DebugManagerStateRestore dbgRestorer;
int32_t forcePipeSupportValues[] = {-1, 0, 1};
auto hwInfo = *defaultHwInfo;
for (auto isPipeSupportedByHw : ::testing::Bool()) {
hwInfo.capabilityTable.supportsPipes = isPipeSupportedByHw;
for (auto forcePipeSupport : forcePipeSupportValues) {
DebugManager.flags.ForcePipeSupport.set(forcePipeSupport);
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
auto &caps = pClDevice->getDeviceInfo();
size_t pipeFeaturesCount = 0;
for (auto &openclCFeature : caps.openclCFeatures) {
if (0 == strcmp(openclCFeature.name, "__opencl_c_pipes")) {
pipeFeaturesCount++;
}
}
bool expectedPipeSupport = ((forcePipeSupport == -1) ? isPipeSupportedByHw : forcePipeSupport);
if (expectedPipeSupport) {
EXPECT_TRUE(pClDevice->arePipesSupported());
EXPECT_EQ(16u, caps.maxPipeArgs);
EXPECT_EQ(1024u, caps.pipeMaxPacketSize);
EXPECT_EQ(1u, caps.pipeMaxActiveReservations);
EXPECT_EQ(1u, pipeFeaturesCount);
} else {
EXPECT_FALSE(pClDevice->arePipesSupported());
EXPECT_EQ(0u, caps.maxPipeArgs);
EXPECT_EQ(0u, caps.pipeMaxPacketSize);
EXPECT_EQ(0u, caps.pipeMaxActiveReservations);
EXPECT_EQ(0u, pipeFeaturesCount);
}
}
}
}
TEST(Device_UseCaps, givenCapabilityTableWhenDeviceInitializeCapsThenVmeVersionsAreSetProperly) { TEST(Device_UseCaps, givenCapabilityTableWhenDeviceInitializeCapsThenVmeVersionsAreSetProperly) {
HardwareInfo hwInfo = *defaultHwInfo; HardwareInfo hwInfo = *defaultHwInfo;

View File

@ -114,7 +114,6 @@ UseBindlessBuffers = 0
UseBindlessImages = 0 UseBindlessImages = 0
MakeAllBuffersResident = 0 MakeAllBuffersResident = 0
EnableCopyOnlyCommandListsAndCommandQueues = -1 EnableCopyOnlyCommandListsAndCommandQueues = -1
DisableDeviceEnqueue = 0
EnableIntelVme = -1 EnableIntelVme = -1
EnableIntelAdvancedVme = -1 EnableIntelAdvancedVme = -1
EnableBlitterOperationsSupport = -1 EnableBlitterOperationsSupport = -1
@ -140,6 +139,8 @@ RenderCompressedBuffersEnabled = -1
EnableSharedSystemUsmSupport = -1 EnableSharedSystemUsmSupport = -1
EnablePassInlineData = -1 EnablePassInlineData = -1
ForceFineGrainedSVMSupport = -1 ForceFineGrainedSVMSupport = -1
ForceDeviceEnqueueSupport = -1
ForcePipeSupport = -1
ForceSystemMemoryPlacement = 0 ForceSystemMemoryPlacement = 0
ForceNonSystemMemoryPlacement = 0 ForceNonSystemMemoryPlacement = 0
ForceOCLVersion = 0 ForceOCLVersion = 0

View File

@ -152,6 +152,8 @@ DECLARE_DEBUG_VARIABLE(int32_t, RenderCompressedBuffersEnabled, -1, "-1: default
DECLARE_DEBUG_VARIABLE(int32_t, EnableSharedSystemUsmSupport, -1, "-1: default, 0: shared system memory disabled, 1: shared system memory enabled") DECLARE_DEBUG_VARIABLE(int32_t, EnableSharedSystemUsmSupport, -1, "-1: default, 0: shared system memory disabled, 1: shared system memory enabled")
DECLARE_DEBUG_VARIABLE(int32_t, EnablePassInlineData, -1, "-1: default, 0: Do not allow to pass inline data 1: Enable passing of inline data") DECLARE_DEBUG_VARIABLE(int32_t, EnablePassInlineData, -1, "-1: default, 0: Do not allow to pass inline data 1: Enable passing of inline data")
DECLARE_DEBUG_VARIABLE(int32_t, ForceFineGrainedSVMSupport, -1, "-1: default, 0: Do not report Fine Grained SVM capabilties 1: Report SVM Fine Grained capabilities if device supports SVM") DECLARE_DEBUG_VARIABLE(int32_t, ForceFineGrainedSVMSupport, -1, "-1: default, 0: Do not report Fine Grained SVM capabilties 1: Report SVM Fine Grained capabilities if device supports SVM")
DECLARE_DEBUG_VARIABLE(int32_t, ForceDeviceEnqueueSupport, -1, "-1: default, 0: disabled, 1: enabled")
DECLARE_DEBUG_VARIABLE(int32_t, ForcePipeSupport, -1, "-1: default, 0: disabled, 1: enabled")
DECLARE_DEBUG_VARIABLE(int32_t, UseAsyncDrmExec, -1, "-1: default, 0: Disabled 1: Enabled. If enabled, pass EXEC_OBJECT_ASYNC to exec ioctl.") DECLARE_DEBUG_VARIABLE(int32_t, UseAsyncDrmExec, -1, "-1: default, 0: Disabled 1: Enabled. If enabled, pass EXEC_OBJECT_ASYNC to exec ioctl.")
DECLARE_DEBUG_VARIABLE(bool, EnablePackedYuv, true, "Enables cl_packed_yuv extension") DECLARE_DEBUG_VARIABLE(bool, EnablePackedYuv, true, "Enables cl_packed_yuv extension")
DECLARE_DEBUG_VARIABLE(bool, EnableDeferredDeleter, true, "Enables async deleter") DECLARE_DEBUG_VARIABLE(bool, EnableDeferredDeleter, true, "Enables async deleter")
@ -169,7 +171,6 @@ DECLARE_DEBUG_VARIABLE(bool, EnableFreeMemory, false, "Enable freeMemory in memo
DECLARE_DEBUG_VARIABLE(bool, ForceSamplerLowFilteringPrecision, false, "Force Low Filtering Precision Sampler mode") DECLARE_DEBUG_VARIABLE(bool, ForceSamplerLowFilteringPrecision, false, "Force Low Filtering Precision Sampler mode")
DECLARE_DEBUG_VARIABLE(bool, UseBindlessBuffers, false, "Force compiler to use bindless buffer addressing instead of stateful one") DECLARE_DEBUG_VARIABLE(bool, UseBindlessBuffers, false, "Force compiler to use bindless buffer addressing instead of stateful one")
DECLARE_DEBUG_VARIABLE(bool, UseBindlessImages, false, "Force compiler to use bindless image addressing instead of stateful one") DECLARE_DEBUG_VARIABLE(bool, UseBindlessImages, false, "Force compiler to use bindless image addressing instead of stateful one")
DECLARE_DEBUG_VARIABLE(bool, DisableDeviceEnqueue, false, "Disable support for device enqueue")
/*DRIVER TOGGLES*/ /*DRIVER TOGGLES*/
DECLARE_DEBUG_VARIABLE(bool, ForcePerDssBackedBufferProgramming, false, "Always program per-DSS memory backed buffer in preamble") DECLARE_DEBUG_VARIABLE(bool, ForcePerDssBackedBufferProgramming, false, "Always program per-DSS memory backed buffer in preamble")