Add debug flag to override device enqueue support

Enabling the new debug flag will disable support of device enqueue feature.

Related-To: NEO-4368

Change-Id: Icd17b44986bb682873364a2603633b7e44723a06
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2020-04-28 13:00:33 +02:00
committed by sys_ocldev
parent bc9e2e1c6a
commit 22f9893495
26 changed files with 184 additions and 87 deletions

View File

@@ -318,7 +318,7 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
pDeviceProperties->onDemandPageFaultsSupported = true;
pDeviceProperties->maxCommandQueues = deviceInfo.maxOnDeviceQueues;
pDeviceProperties->maxCommandQueues = 1;
pDeviceProperties->numAsyncComputeEngines = static_cast<uint32_t>(hwHelper.getGpgpuEngineInstances(hardwareInfo).size());

View File

@@ -4782,7 +4782,6 @@ cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(cl_context conte
auto commandQueueProperties = getCmdQueueProperties<cl_command_queue_properties>(properties);
uint32_t maxOnDeviceQueueSize = pDevice->getDeviceInfo().queueOnDeviceMaxSize;
uint32_t maxOnDeviceQueues = pDevice->getSharedDeviceInfo().maxOnDeviceQueues;
if (commandQueueProperties & static_cast<cl_command_queue_properties>(CL_QUEUE_ON_DEVICE)) {
if (!(commandQueueProperties & static_cast<cl_command_queue_properties>(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE))) {
@@ -4790,7 +4789,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(cl_context conte
TRACING_EXIT(clCreateCommandQueueWithProperties, &commandQueue);
return commandQueue;
}
if (!pDevice->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
if (!pDevice->isDeviceEnqueueSupported()) {
err.set(CL_INVALID_QUEUE_PROPERTIES);
TRACING_EXIT(clCreateCommandQueueWithProperties, &commandQueue);
return commandQueue;
@@ -4804,7 +4803,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(cl_context conte
return commandQueue;
}
} else if (commandQueueProperties & static_cast<cl_command_queue_properties>(CL_QUEUE_ON_DEVICE)) {
if ((maxOnDeviceQueues == 0) || ((maxOnDeviceQueues == 1) && pContext->getDefaultDeviceQueue())) {
if (pContext->getDefaultDeviceQueue()) {
err.set(CL_OUT_OF_RESOURCES);
TRACING_EXIT(clCreateCommandQueueWithProperties, &commandQueue);
return commandQueue;
@@ -5059,14 +5058,22 @@ cl_int CL_API_CALL clSetDefaultDeviceCommandQueue(cl_context context,
"commandQueue", commandQueue);
Context *pContext = nullptr;
ClDevice *pClDevice = nullptr;
retVal = validateObjects(WithCastToInternal(context, &pContext), device);
retVal = validateObjects(WithCastToInternal(context, &pContext),
WithCastToInternal(device, &pClDevice));
if (CL_SUCCESS != retVal) {
TRACING_EXIT(clSetDefaultDeviceCommandQueue, &retVal);
return retVal;
}
if (pClDevice->isDeviceEnqueueSupported() == false) {
retVal = CL_INVALID_OPERATION;
TRACING_EXIT(clSetDefaultDeviceCommandQueue, &retVal);
return retVal;
}
auto pDeviceQueue = castToObject<DeviceQueue>(static_cast<_device_queue *>(commandQueue));
if (!pDeviceQueue) {

View File

@@ -7,6 +7,7 @@
#include "opencl/source/cl_device/cl_device.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/device/device.h"
#include "shared/source/device/sub_device.h"
#include "shared/source/execution_environment/root_device_environment.h"
@@ -179,4 +180,11 @@ DeviceBitfield ClDevice::getDeviceBitfield() const {
return device.getDeviceBitfield();
}
bool ClDevice::isDeviceEnqueueSupported() const {
if (DebugManager.flags.DisableDeviceEnqueue.get()) {
return false;
}
return device.getHardwareInfo().capabilityTable.supportsDeviceEnqueue;
}
} // namespace NEO

View File

@@ -118,6 +118,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
const std::string &peekCompilerExtensions() const;
std::unique_ptr<SyncBufferHandler> syncBufferHandler;
DeviceBitfield getDeviceBitfield() const;
bool isDeviceEnqueueSupported() const;
protected:
void initializeCaps();

View File

@@ -243,10 +243,19 @@ void ClDevice::initializeCaps() {
deviceInfo.memBaseAddressAlign = 1024;
deviceInfo.minDataTypeAlignSize = 128;
deviceInfo.maxOnDeviceEvents = 1024;
deviceInfo.queueOnDeviceMaxSize = 64 * MB;
deviceInfo.queueOnDevicePreferredSize = 128 * KB;
deviceInfo.queueOnDeviceProperties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
if (isDeviceEnqueueSupported()) {
deviceInfo.maxOnDeviceQueues = 1;
deviceInfo.maxOnDeviceEvents = 1024;
deviceInfo.queueOnDeviceMaxSize = 64 * MB;
deviceInfo.queueOnDevicePreferredSize = 128 * KB;
deviceInfo.queueOnDeviceProperties = CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
} else {
deviceInfo.maxOnDeviceQueues = 0;
deviceInfo.maxOnDeviceEvents = 0;
deviceInfo.queueOnDeviceMaxSize = 0;
deviceInfo.queueOnDevicePreferredSize = 0;
deviceInfo.queueOnDeviceProperties = 0;
}
deviceInfo.preferredInteropUserSync = 1u;

View File

@@ -83,6 +83,7 @@ struct ClDeviceInfo {
cl_bool linkerAvailable;
cl_uint queueOnDevicePreferredSize;
cl_uint queueOnDeviceMaxSize;
cl_uint maxOnDeviceQueues;
cl_uint maxOnDeviceEvents;
cl_bool preferredInteropUserSync;
cl_uint referenceCount;

View File

@@ -70,7 +70,6 @@ template<> struct Map<CL_DEVICE_IMAGE_SUPPORT > : public MapBa
template<> struct Map<CL_DEVICE_LOCAL_MEM_SIZE > : public MapBase<CL_DEVICE_LOCAL_MEM_SIZE, uint64_t, &DeviceInfo::localMemSize> {};
template<> struct Map<CL_DEVICE_MAX_CLOCK_FREQUENCY > : public MapBase<CL_DEVICE_MAX_CLOCK_FREQUENCY, uint32_t, &DeviceInfo::maxClockFrequency> {};
template<> struct Map<CL_DEVICE_MAX_MEM_ALLOC_SIZE > : public MapBase<CL_DEVICE_MAX_MEM_ALLOC_SIZE, uint64_t, &DeviceInfo::maxMemAllocSize> {};
template<> struct Map<CL_DEVICE_MAX_ON_DEVICE_QUEUES > : public MapBase<CL_DEVICE_MAX_ON_DEVICE_QUEUES, uint32_t, &DeviceInfo::maxOnDeviceQueues> {};
template<> struct Map<CL_DEVICE_MAX_PARAMETER_SIZE > : public MapBase<CL_DEVICE_MAX_PARAMETER_SIZE, size_t, &DeviceInfo::maxParameterSize> {};
template<> struct Map<CL_DEVICE_MAX_READ_IMAGE_ARGS > : public MapBase<CL_DEVICE_MAX_READ_IMAGE_ARGS, uint32_t, &DeviceInfo::maxReadImageArgs> {};
template<> struct Map<CL_DEVICE_MAX_SAMPLERS > : public MapBase<CL_DEVICE_MAX_SAMPLERS, uint32_t, &DeviceInfo::maxSamplers> {};
@@ -147,6 +146,7 @@ template<> struct Map<CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG > :
template<> struct Map<CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT > : public ClMapBase<CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, uint32_t, &ClDeviceInfo::preferredVectorWidthShort> {};
template<> struct Map<CL_DEVICE_PROFILE > : public ClMapBase<CL_DEVICE_PROFILE, const char *, &ClDeviceInfo::profile> {};
template<> struct Map<CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE > : public ClMapBase<CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE, uint32_t, &ClDeviceInfo::queueOnDeviceMaxSize> {};
template<> struct Map<CL_DEVICE_MAX_ON_DEVICE_QUEUES > : public ClMapBase<CL_DEVICE_MAX_ON_DEVICE_QUEUES, uint32_t, &ClDeviceInfo::maxOnDeviceQueues> {};
template<> struct Map<CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE > : public ClMapBase<CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE, uint32_t, &ClDeviceInfo::queueOnDevicePreferredSize> {};
template<> struct Map<CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES > : public ClMapBase<CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES, uint64_t, &ClDeviceInfo::queueOnDeviceProperties> {};
template<> struct Map<CL_DEVICE_QUEUE_ON_HOST_PROPERTIES > : public ClMapBase<CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, uint64_t, &ClDeviceInfo::queueOnHostProperties> {};

View File

@@ -17,6 +17,7 @@
#include "opencl/test/unit_test/helpers/unit_test_helper.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
#include "CL/cl_ext.h"
#include "cl_api_tests.h"
@@ -273,9 +274,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDefaultDeviceQueueWithoutQueu
}
HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenNumberOfDevicesGreaterThanMaxWhenCreatingCommandQueueWithPropertiesThenOutOfResourcesErrorIsReturned) {
if (!this->pContext->getDevice(0u)->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
GTEST_SKIP();
}
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pContext);
cl_int retVal = CL_SUCCESS;
auto pDevice = castToObject<ClDevice>(testedClDevice);
cl_queue_properties odq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE, 0, 0};
@@ -285,7 +284,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenNumberOf
EXPECT_EQ(retVal, CL_SUCCESS);
auto cmdq2 = clCreateCommandQueueWithProperties(pContext, testedClDevice, odq, &retVal);
if (pDevice->getSharedDeviceInfo().maxOnDeviceQueues > 1) {
if (pDevice->getDeviceInfo().maxOnDeviceQueues > 1) {
EXPECT_NE(nullptr, cmdq2);
EXPECT_EQ(retVal, CL_SUCCESS);
} else {
@@ -300,9 +299,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenNumberOf
}
HWCMDTEST_F(IGFX_GEN8_CORE, clCreateCommandQueueWithPropertiesApi, GivenFailedAllocationWhenCreatingCommandQueueWithPropertiesThenOutOfHostMemoryErrorIsReturned) {
if (!this->pContext->getDevice(0u)->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
GTEST_SKIP();
}
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pContext);
InjectedFunction method = [this](size_t failureIndex) {
cl_queue_properties ooq[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0};
auto retVal = CL_INVALID_VALUE;
@@ -344,6 +341,34 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenMedPriorityWhenCreatingOoqCom
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
}
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceEnqueueDisabledWhenCreatingDeviceQueueThenNullQueueAndInvalidQueuePropertiesErrorIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.DisableDeviceEnqueue.set(true);
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockContext context{pClDevice.get()};
cl_int retVal = CL_SUCCESS;
cl_queue_properties queueProperties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0, 0};
auto pCmdQ = clCreateCommandQueueWithProperties(&context, pClDevice.get(), queueProperties, &retVal);
EXPECT_EQ(nullptr, pCmdQ);
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
}
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenDeviceEnqueueDisabledWhenCreatingDefaultDeviceQueueThenNullQueueAndInvalidQueuePropertiesErrorIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.DisableDeviceEnqueue.set(true);
auto pClDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
MockContext context{pClDevice.get()};
cl_int retVal = CL_SUCCESS;
cl_queue_properties queueProperties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 0, 0};
auto pCmdQ = clCreateCommandQueueWithProperties(&context, pClDevice.get(), queueProperties, &retVal);
EXPECT_EQ(nullptr, pCmdQ);
EXPECT_EQ(retVal, CL_INVALID_QUEUE_PROPERTIES);
}
TEST_F(clCreateCommandQueueWithPropertiesApi, GivenInvalidPropertiesWhenCreatingOoqCommandQueueWithPropertiesThenInvalidValueErrorIsReturned) {
cl_int retVal = CL_SUCCESS;
cl_queue_properties properties = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;

View File

@@ -64,7 +64,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenValidPar
0};
auto pDevice = castToObject<ClDevice>(testedClDevice);
if (pDevice->getSharedDeviceInfo().maxOnDeviceQueues > 1) {
if (pDevice->getDeviceInfo().maxOnDeviceQueues > 1) {
auto newDeviceQueue = clCreateCommandQueueWithProperties(pContext, testedClDevice, properties, &retVal);
ASSERT_NE(nullptr, newDeviceQueue);
ASSERT_EQ(CL_SUCCESS, retVal);
@@ -88,6 +88,14 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenNullDevi
ASSERT_EQ(CL_INVALID_DEVICE, retVal);
}
TEST_F(clSetDefaultDeviceCommandQueueApiTest, GivenDeviceNotSupportingDeviceEnqueueWhenSettingDefaultDeviceQueueThenClInvalidOperationErrorIsReturned) {
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.DisableDeviceEnqueue.set(true);
retVal = clSetDefaultDeviceCommandQueue(pContext, testedClDevice, nullptr);
ASSERT_EQ(CL_INVALID_OPERATION, retVal);
}
HWCMDTEST_F(IGFX_GEN8_CORE, clSetDefaultDeviceCommandQueueApiTest, GivenNullDeviceQueueWhenSettingDefaultDeviceQueueThenClInvalidCommandQueueErrorIsReturned) {
retVal = clSetDefaultDeviceCommandQueue(pContext, testedClDevice, nullptr);
ASSERT_EQ(CL_INVALID_COMMAND_QUEUE, retVal);

View File

@@ -21,6 +21,7 @@
#include "opencl/test/unit_test/mocks/mock_deferred_deleter.h"
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
#include "gtest/gtest.h"
@@ -123,6 +124,7 @@ TEST_F(ContextTest, WhenSettingSpecialQueueThenQueueIsAvailable) {
}
TEST_F(ContextTest, WhenSettingDefaultQueueThenQueueIsAvailable) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(context);
EXPECT_EQ(nullptr, context->getDefaultDeviceQueue());
auto dq = new DeviceQueue();
context->setDefaultDeviceQueue(dq);
@@ -148,6 +150,7 @@ TEST_F(ContextTest, givenCmdQueueWithoutContextWhenBeingCreatedNextDeletedThenCo
}
TEST_F(ContextTest, givenDeviceQueueWithoutContextWhenBeingCreatedNextDeletedThenContextRefCountShouldNeitherBeIncrementedNorNextDecremented) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(context);
MockContext context((ClDevice *)devices[0]);
EXPECT_EQ(1, context.getRefInternalCount());
@@ -177,6 +180,7 @@ TEST_F(ContextTest, givenCmdQueueWithContextWhenBeingCreatedNextDeletedThenConte
}
TEST_F(ContextTest, givenDeviceCmdQueueWithContextWhenBeingCreatedNextDeletedThenContextRefCountShouldBeIncrementedNextDecremented) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(context);
MockContext context((ClDevice *)devices[0]);
EXPECT_EQ(1, context.getRefInternalCount());
@@ -189,6 +193,7 @@ TEST_F(ContextTest, givenDeviceCmdQueueWithContextWhenBeingCreatedNextDeletedThe
}
TEST_F(ContextTest, givenDefaultDeviceCmdQueueWithContextWhenBeingCreatedNextDeletedThenContextRefCountShouldBeIncrementedNextDecremented) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(context);
MockContext context((ClDevice *)devices[0]);
EXPECT_EQ(1, context.getRefInternalCount());
@@ -438,4 +443,4 @@ TEST(Context, givenContextWithMultipleSubDevicesWhenGettingDeviceBitfieldForAllo
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(expectedDeviceBitfield.to_ulong(), context->getDeviceBitfieldForAllocation().to_ulong());
context->release();
}
}

View File

@@ -146,12 +146,20 @@ TEST_F(DeviceGetCapsTest, WhenCreatingDeviceThenCapsArePopulatedCorrectly) {
EXPECT_EQ(sharedCaps.maxWorkGroupSize / hwHelper.getMinimalSIMDSize(), caps.maxNumOfSubGroups);
EXPECT_EQ(1024u, caps.maxOnDeviceEvents);
EXPECT_EQ(1u, sharedCaps.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);
if (defaultHwInfo->capabilityTable.supportsDeviceEnqueue) {
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);
} else {
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(64u, caps.preferredGlobalAtomicAlignment);
EXPECT_EQ(64u, caps.preferredLocalAtomicAlignment);
@@ -952,6 +960,20 @@ TEST(DeviceGetCaps, givenDebugFlagToUseCertainWorkgroupSizeWhenDeviceIsCreatedIt
EXPECT_EQ(16u, device->getDeviceInfo().maxWorkGroupSize);
}
TEST(DeviceGetCaps, givenDebugFlagToDisableDeviceEnqueuesWhenCreatingDeviceThenDeviceQueueCapsAreSetCorrectly) {
DebugManagerStateRestore dbgRestorer;
DebugManager.flags.DisableDeviceEnqueue.set(true);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
const auto &caps = device->getDeviceInfo();
EXPECT_EQ(0u, caps.queueOnDeviceProperties);
EXPECT_EQ(0u, caps.queueOnDevicePreferredSize);
EXPECT_EQ(0u, caps.queueOnDeviceMaxSize);
EXPECT_EQ(0u, caps.maxOnDeviceQueues);
EXPECT_EQ(0u, caps.maxOnDeviceEvents);
}
HWTEST_F(DeviceGetCapsTest, givenDeviceThatHasHighNumberOfExecutionUnitsWhenMaxWorkgroupSizeIsComputedItIsLimitedTo1024) {
HardwareInfo myHwInfo = *defaultHwInfo;
GT_SYSTEM_INFO &mySysInfo = myHwInfo.gtSystemInfo;

View File

@@ -483,6 +483,7 @@ class DeviceQueueHwWithKernel : public ExecutionModelKernelFixture {
public:
void SetUp() override {
ExecutionModelKernelFixture::SetUp();
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(defaultHwInfo);
cl_queue_properties properties[5] = {
CL_QUEUE_PROPERTIES,
CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,
@@ -501,16 +502,22 @@ class DeviceQueueHwWithKernel : public ExecutionModelKernelFixture {
ASSERT_NE(nullptr, devQueue);
}
void TearDown() override {
delete devQueue;
delete context;
delete clDevice;
if (devQueue) {
delete devQueue;
}
if (context) {
delete context;
}
if (clDevice) {
delete clDevice;
}
ExecutionModelKernelFixture::TearDown();
}
Device *device;
ClDevice *clDevice;
DeviceQueue *devQueue;
MockContext *context;
Device *device = nullptr;
ClDevice *clDevice = nullptr;
DeviceQueue *devQueue = nullptr;
MockContext *context = nullptr;
};
HWCMDTEST_P(IGFX_GEN8_CORE, DeviceQueueHwWithKernel, WhenSetiingIUpIndirectStateThenDshIsNotUsed) {
@@ -649,7 +656,13 @@ INSTANTIATE_TEST_CASE_P(DeviceQueueHwWithKernel,
::testing::Values(binaryFile),
::testing::ValuesIn(KernelNames)));
typedef testing::Test TheSimplestDeviceQueueFixture;
struct TheSimplestDeviceQueueFixture : testing::Test {
void SetUp() override {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(defaultHwInfo);
}
void TearDown() override {
}
};
HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, WhenResettingDeviceQueueThenEarlyReturnValuesAreSet) {

View File

@@ -48,11 +48,9 @@ class DeviceQueueTest : public DeviceHostQueueFixture<DeviceQueue> {
using BaseClass = DeviceHostQueueFixture<DeviceQueue>;
void SetUp() override {
BaseClass::SetUp();
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pContext);
device = pContext->getDevice(0);
if (!device->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
GTEST_SKIP();
}
ASSERT_NE(device, nullptr);
}
@@ -71,19 +69,9 @@ class DeviceQueueTest : public DeviceHostQueueFixture<DeviceQueue> {
ClDevice *device;
};
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, createDeviceQueueWhenNoDeviceQueueIsSupported) {
auto maxOnDeviceQueues = device->getSharedDeviceInfo().maxOnDeviceQueues;
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = 0;
auto deviceQueue = createQueueObject();
EXPECT_EQ(deviceQueue, nullptr);
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = maxOnDeviceQueues;
}
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, createDeviceQueuesWhenSingleDeviceQueueIsSupported) {
auto maxOnDeviceQueues = device->getSharedDeviceInfo().maxOnDeviceQueues;
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = 1;
auto maxOnDeviceQueues = device->getDeviceInfo().maxOnDeviceQueues;
const_cast<ClDeviceInfo *>(&device->getDeviceInfo())->maxOnDeviceQueues = 1;
auto deviceQueue1 = createQueueObject();
ASSERT_NE(deviceQueue1, nullptr);
@@ -94,27 +82,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, createDeviceQueuesWhenSingleDeviceQ
delete deviceQueue1;
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = maxOnDeviceQueues;
}
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, createDeviceQueuesWhenMultipleDeviceQueuesAreSupported) {
auto maxOnDeviceQueues = device->getSharedDeviceInfo().maxOnDeviceQueues;
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = 2;
auto deviceQueue1 = createQueueObject();
ASSERT_NE(deviceQueue1, nullptr);
EXPECT_EQ(deviceQueue1->getReference(), 1);
auto deviceQueue2 = createQueueObject();
ASSERT_NE(deviceQueue2, nullptr);
EXPECT_EQ(deviceQueue2->getReference(), 1);
EXPECT_NE(deviceQueue2, deviceQueue1);
delete deviceQueue1;
delete deviceQueue2;
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = maxOnDeviceQueues;
const_cast<ClDeviceInfo *>(&device->getDeviceInfo())->maxOnDeviceQueues = maxOnDeviceQueues;
}
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, GivenDeviceQueueWhenEventPoolIsCreatedThenTimestampResolutionIsSet) {
@@ -238,8 +206,8 @@ typedef DeviceQueueTest DefaultDeviceQueue;
HWCMDTEST_F(IGFX_GEN8_CORE, DefaultDeviceQueue, createOnlyOneDefaultDeviceQueueWhenSingleDeviceQueueIsSupported) {
cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0, 0};
auto maxOnDeviceQueues = device->getSharedDeviceInfo().maxOnDeviceQueues;
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = 1;
auto maxOnDeviceQueues = device->getDeviceInfo().maxOnDeviceQueues;
const_cast<ClDeviceInfo *>(&device->getDeviceInfo())->maxOnDeviceQueues = 1;
auto deviceQueue1 = createQueueObject(properties);
ASSERT_NE(deviceQueue1, nullptr);
@@ -258,14 +226,14 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DefaultDeviceQueue, createOnlyOneDefaultDeviceQueueW
deviceQueue1->release();
deviceQueue2->release();
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = maxOnDeviceQueues;
const_cast<ClDeviceInfo *>(&device->getDeviceInfo())->maxOnDeviceQueues = maxOnDeviceQueues;
}
HWCMDTEST_F(IGFX_GEN8_CORE, DefaultDeviceQueue, createOnlyOneDefaultDeviceQueueWhenMultipleDeviceQueuesAreSupported) {
cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES, CL_QUEUE_ON_DEVICE_DEFAULT, 0, 0, 0};
auto maxOnDeviceQueues = device->getSharedDeviceInfo().maxOnDeviceQueues;
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = 2;
auto maxOnDeviceQueues = device->getDeviceInfo().maxOnDeviceQueues;
const_cast<ClDeviceInfo *>(&device->getDeviceInfo())->maxOnDeviceQueues = 2;
auto deviceQueue1 = createQueueObject(properties);
ASSERT_NE(deviceQueue1, nullptr);
@@ -284,7 +252,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DefaultDeviceQueue, createOnlyOneDefaultDeviceQueueW
deviceQueue1->release();
deviceQueue2->release();
const_cast<DeviceInfo *>(&device->getSharedDeviceInfo())->maxOnDeviceQueues = maxOnDeviceQueues;
const_cast<ClDeviceInfo *>(&device->getDeviceInfo())->maxOnDeviceQueues = maxOnDeviceQueues;
}
typedef DeviceQueueTest DeviceQueueEventPool;

View File

@@ -17,9 +17,7 @@ class GetDeviceQueueInfoTest : public DeviceHostQueueFixture<DeviceQueue> {
void SetUp() override {
BaseClass::SetUp();
if (!this->pContext->getDevice(0u)->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
GTEST_SKIP();
}
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pContext);
deviceQueue = createQueueObject(deviceQueueProperties::allProperties);
ASSERT_NE(deviceQueue, nullptr);
}

View File

@@ -11,6 +11,7 @@
#include "opencl/source/device_queue/device_queue.h"
#include "opencl/source/device_queue/device_queue_hw.h"
#include "opencl/test/unit_test/api/cl_api_tests.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
#include "test.h"
using namespace NEO;
@@ -59,9 +60,7 @@ class DeviceQueueHwTest : public DeviceHostQueueFixture<DeviceQueue> {
BaseClass::SetUp();
device = castToObject<ClDevice>(testedClDevice);
ASSERT_NE(device, nullptr);
if (!device->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
GTEST_SKIP();
}
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device);
}
void TearDown() override {

View File

@@ -13,10 +13,12 @@
#include "opencl/test/unit_test/command_queue/command_queue_fixture.h"
#include "opencl/test/unit_test/fixtures/execution_model_kernel_fixture.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
class DeviceQueueFixture {
public:
void SetUp(Context *context, ClDevice *device) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device);
cl_int errcodeRet = 0;
cl_queue_properties properties[3];

View File

@@ -384,6 +384,8 @@ TEST_F(CloneKernelTest, GivenArgSamplerWhenCloningKernelThenKernelInfoIsCorrect)
}
HWCMDTEST_F(IGFX_GEN8_CORE, CloneKernelTest, GivenArgDeviceQueueWhenCloningKernelThenKernelInfoIsCorrect) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pClDevice);
cl_queue_properties queueProps[5] = {
CL_QUEUE_PROPERTIES,
CL_QUEUE_ON_DEVICE | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE,

View File

@@ -18,9 +18,7 @@ struct KernelArgDevQueueTest : public DeviceHostQueueFixture<DeviceQueue> {
protected:
void SetUp() override {
DeviceHostQueueFixture<DeviceQueue>::SetUp();
if (!this->pDevice->getHardwareInfo().capabilityTable.supportsDeviceEnqueue) {
GTEST_SKIP();
}
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pDevice);
pDeviceQueue = createQueueObject();

View File

@@ -24,6 +24,7 @@
#include "opencl/test/unit_test/mocks/mock_mdi.h"
#include "opencl/test/unit_test/mocks/mock_program.h"
#include "opencl/test/unit_test/mocks/mock_sampler.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
#include "patch_list.h"
@@ -643,6 +644,7 @@ TEST(KernelReflectionSurfaceTestSingle, CreateKernelReflectionSurfaceCalledOnNon
}
TEST(KernelReflectionSurfaceTestSingle, ObtainKernelReflectionSurfaceWithoutKernelArgs) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(defaultHwInfo);
MockContext context;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program(*device->getExecutionEnvironment());
@@ -694,6 +696,7 @@ TEST(KernelReflectionSurfaceTestSingle, ObtainKernelReflectionSurfaceWithoutKern
}
TEST(KernelReflectionSurfaceTestSingle, ObtainKernelReflectionSurfaceWithDeviceQueueKernelArg) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(defaultHwInfo);
MockContext context;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
MockProgram program(*device->getExecutionEnvironment());
@@ -1029,6 +1032,7 @@ INSTANTIATE_TEST_CASE_P(KernelReflectionSurfaceTest,
::testing::ValuesIn(KernelNames)));
HWCMDTEST_P(IGFX_GEN8_CORE, KernelReflectionSurfaceWithQueueTest, ObtainKernelReflectionSurfacePatchesBlocksCurbe) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pPlatform->getClDevice(0));
if (std::string(pPlatform->getClDevice(0)->getDeviceInfo().clVersion).find("OpenCL 2.") != std::string::npos) {
BlockKernelManager *blockManager = pProgram->getBlockKernelManager();
@@ -1904,6 +1908,7 @@ TEST_F(ReflectionSurfaceHelperFixture, PatchBlocksCurbeWithConstantValuesWithUnd
typedef ParentKernelCommandQueueFixture ReflectionSurfaceTestForPrintfHandler;
TEST_F(ReflectionSurfaceTestForPrintfHandler, PatchReflectionSurfacePatchesPrintfBufferWhenPrintfHandlerIsPassed) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device);
MockContext context(device);
cl_queue_properties properties[3] = {0};
@@ -1932,6 +1937,7 @@ TEST_F(ReflectionSurfaceTestForPrintfHandler, PatchReflectionSurfacePatchesPrint
}
TEST_F(ReflectionSurfaceTestForPrintfHandler, PatchReflectionSurfaceDoesNotPatchPrintfBufferWhenPrintfSurfaceIsNotCreated) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device);
MockContext context(device);
cl_queue_properties properties[3] = {0};
@@ -2126,6 +2132,7 @@ TEST_F(ReflectionSurfaceConstantValuesPatchingTest, GivenBlockWithConstantMemory
using KernelReflectionMultiDeviceTest = MultiRootDeviceFixture;
TEST_F(KernelReflectionMultiDeviceTest, ObtainKernelReflectionSurfaceWithoutKernelArgs) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device.get());
MockProgram program(*device->getExecutionEnvironment());
KernelInfo *blockInfo = new KernelInfo;
KernelInfo &info = *blockInfo;
@@ -2176,6 +2183,7 @@ TEST_F(KernelReflectionMultiDeviceTest, ObtainKernelReflectionSurfaceWithoutKern
}
TEST_F(KernelReflectionMultiDeviceTest, ObtainKernelReflectionSurfaceWithDeviceQueueKernelArg) {
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(device.get());
MockProgram program(*device->getExecutionEnvironment());
KernelInfo *blockInfo = new KernelInfo;

View File

@@ -7,6 +7,7 @@
#include "opencl/test/unit_test/fixtures/device_fixture.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
#include "test.h"
#include "gtest/gtest.h"
@@ -17,6 +18,7 @@ class SchedulerSourceTest : public testing::Test {
public:
void SetUp() override {
pDevice = new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr)};
REQUIRE_DEVICE_ENQUEUE_OR_SKIP(pDevice);
}
void TearDown() override {
delete pDevice;

View File

@@ -113,6 +113,7 @@ UseBindlessBuffers = 0
UseBindlessImages = 0
MakeAllBuffersResident = 0
EnableCopyOnlyCommandListsAndCommandQueues = 0
DisableDeviceEnqueue = 0
EnableIntelVme = -1
EnableIntelAdvancedVme = -1
EnableBlitterOperationsSupport = -1

View File

@@ -8,6 +8,7 @@
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
#include "shared/source/device/device_info.h"
#include "shared/source/helpers/hw_info.h"
#include "opencl/source/cl_device/cl_device.h"
#include "opencl/source/context/context.h"
@@ -25,3 +26,13 @@ bool TestChecks::supportsImages(const Context *pContext) {
bool TestChecks::supportsOcl21(const Context *pContext) {
return pContext->getDevice(0)->getEnabledClVersion() >= 21;
}
bool TestChecks::supportsDeviceEnqueue(const ClDevice *pClDevice) {
return pClDevice->getHardwareInfo().capabilityTable.supportsDeviceEnqueue;
}
bool TestChecks::supportsDeviceEnqueue(const Context *pContext) {
return supportsDeviceEnqueue(pContext->getDevice(0));
}
bool TestChecks::supportsDeviceEnqueue(const std::unique_ptr<HardwareInfo> &pHardwareInfo) {
return pHardwareInfo->capabilityTable.supportsDeviceEnqueue;
}

View File

@@ -7,14 +7,20 @@
#pragma once
#include <memory>
namespace NEO {
class ClDevice;
class Context;
struct HardwareInfo;
namespace TestChecks {
bool supportsSvm(const ClDevice *pClDevice);
bool supportsImages(const Context *pContext);
bool supportsOcl21(const Context *pContext);
bool supportsDeviceEnqueue(const ClDevice *pClDevice);
bool supportsDeviceEnqueue(const Context *pContext);
bool supportsDeviceEnqueue(const std::unique_ptr<HardwareInfo> &pHardwareInfo);
} // namespace TestChecks
} // namespace NEO
@@ -30,3 +36,8 @@ bool supportsOcl21(const Context *pContext);
if (NEO::TestChecks::supportsOcl21(param) == false) { \
GTEST_SKIP(); \
}
#define REQUIRE_DEVICE_ENQUEUE_OR_SKIP(param) \
if (NEO::TestChecks::supportsDeviceEnqueue(param) == false) { \
GTEST_SKIP(); \
}

View File

@@ -133,6 +133,7 @@ DECLARE_DEBUG_VARIABLE(bool, UseBindlessBuffers, false, "Force compiler to use b
DECLARE_DEBUG_VARIABLE(bool, UseBindlessImages, false, "Force compiler to use bindless image addressing instead of stateful one")
DECLARE_DEBUG_VARIABLE(bool, MakeAllBuffersResident, false, "Make all buffers resident after creation")
DECLARE_DEBUG_VARIABLE(bool, EnableCopyOnlyCommandListsAndCommandQueues, false, "Enable copy only commandlists and commandQueues")
DECLARE_DEBUG_VARIABLE(bool, DisableDeviceEnqueue, false, "Disable support for device enqueue")
DECLARE_DEBUG_VARIABLE(int32_t, EnableIntelVme, -1, "-1: default, 0: disabled, 1: Enables cl_intel_motion_estimation extension")
DECLARE_DEBUG_VARIABLE(int32_t, EnableIntelAdvancedVme, -1, "-1: default, 0: disabled, 1: Enables cl_intel_advanced_motion_estimation extension")
DECLARE_DEBUG_VARIABLE(int32_t, EnableBlitterOperationsSupport, -1, "-1: default, 0: disable, 1: enable")

View File

@@ -63,8 +63,6 @@ void Device::initializeCaps() {
deviceInfo.profilingTimerResolution = getProfilingTimerResolution();
deviceInfo.outProfilingTimerResolution = static_cast<size_t>(deviceInfo.profilingTimerResolution);
deviceInfo.maxOnDeviceQueues = 1;
// OpenCL 1.2 requires 128MB minimum
deviceInfo.maxMemAllocSize = std::min(std::max(deviceInfo.globalMemSize / 2, static_cast<uint64_t>(128llu * MB)), this->hardwareCapabilities.maxMemAllocSize);

View File

@@ -37,7 +37,6 @@ struct DeviceInfo {
uint32_t imageSupport;
uint32_t maxClockFrequency;
uint32_t maxFrontEndThreads;
uint32_t maxOnDeviceQueues;
uint32_t maxReadImageArgs;
uint32_t maxSamplers;
uint32_t maxWriteImageArgs;