Support for enabling perf counters with clCreateCommandQueueWithProperties

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-03-22 09:02:03 +00:00
committed by Compute-Runtime-Automation
parent 073e15d75e
commit 0fd8b850a6
3 changed files with 102 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -179,4 +179,57 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, givenInvalidMetricsLibraryWhe
EXPECT_EQ(CL_OUT_OF_RESOURCES, retVal);
}
struct clCreateCommandQueueWithPropertiesMdapiTests : public clCreatePerfCountersCommandQueueINTELTests {
cl_queue_properties queueProperties[7] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE,
CL_QUEUE_MDAPI_PROPERTIES_INTEL, CL_QUEUE_MDAPI_ENABLE_INTEL,
CL_QUEUE_MDAPI_CONFIGURATION_INTEL, 0,
0};
};
TEST_F(clCreateCommandQueueWithPropertiesMdapiTests, givenCorrectParamsWhenCreatingQueueWithPropertiesThenEnablePerfCounters) {
auto cmdQ = clCreateCommandQueueWithProperties(context.get(), deviceId, queueProperties, &retVal);
ASSERT_NE(nullptr, cmdQ);
EXPECT_EQ(CL_SUCCESS, retVal);
auto commandQueueObject = castToObject<CommandQueue>(cmdQ);
EXPECT_TRUE(commandQueueObject->isPerfCountersEnabled());
clReleaseCommandQueue(cmdQ);
}
TEST_F(clCreateCommandQueueWithPropertiesMdapiTests, givenParamsWithDisabledPerfCounterWhenCreatingQueueWithPropertiesThenCreateRegularQueue) {
queueProperties[3] = 0;
auto cmdQ = clCreateCommandQueueWithProperties(context.get(), deviceId, queueProperties, &retVal);
ASSERT_NE(nullptr, cmdQ);
EXPECT_EQ(CL_SUCCESS, retVal);
auto commandQueueObject = castToObject<CommandQueue>(cmdQ);
EXPECT_FALSE(commandQueueObject->isPerfCountersEnabled());
clReleaseCommandQueue(cmdQ);
}
TEST_F(clCreateCommandQueueWithPropertiesMdapiTests, givenIncorrectConfigurationWhenCreatingQueueWithPropertiesThenFail) {
queueProperties[5] = 1;
auto cmdQ = clCreateCommandQueueWithProperties(context.get(), deviceId, queueProperties, &retVal);
EXPECT_EQ(nullptr, cmdQ);
EXPECT_NE(CL_SUCCESS, retVal);
}
TEST_F(clCreateCommandQueueWithPropertiesMdapiTests, givenInvalidMdapiOpenWhenCreatingQueueWithPropertiesThenFail) {
auto performanceCounters = device->getPerformanceCounters();
auto metricsLibary = static_cast<MockMetricsLibrary *>(performanceCounters->getMetricsLibraryInterface());
metricsLibary->validOpen = false;
auto cmdQ = clCreateCommandQueueWithProperties(context.get(), deviceId, queueProperties, &retVal);
EXPECT_EQ(nullptr, cmdQ);
EXPECT_NE(CL_SUCCESS, retVal);
}
} // namespace ULT