mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
Metrics Library Performance Counters implementation.
Signed-off-by: Piotr Maciejewski <piotr.maciejewski@intel.com> Change-Id: I0f00dca1892f4857baaebc75ba2208a4f33db1bf
This commit is contained in:
committed by
sys_ocldev
parent
369982995d
commit
d1d794c658
@@ -42,7 +42,7 @@ namespace ULT {
|
||||
TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenCorrectParamatersWhenCreatingPerfCountersCmdQThenCmdQIsCreatedAndPerfCountersAreEnabled) {
|
||||
cl_command_queue cmdQ = nullptr;
|
||||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = 1;
|
||||
cl_uint configuration = 0;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
ASSERT_NE(nullptr, cmdQ);
|
||||
@@ -99,7 +99,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenNullContextWhenCreatingP
|
||||
TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenMaximumGtdiConfigurationWhenCreatingPerfCountersCmdQThenOutOfResourcesErrorIsReturned) {
|
||||
cl_command_queue cmdQ = nullptr;
|
||||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = GTDI_CONFIGURATION_SET_MAX;
|
||||
cl_uint configuration = 4;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
|
||||
@@ -110,7 +110,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenMaximumGtdiConfiguration
|
||||
TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenCorrectCmdQWhenEventIsCreatedThenPerfCountersAreEnabled) {
|
||||
cl_command_queue cmdQ = nullptr;
|
||||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = 1;
|
||||
cl_uint configuration = 0;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
ASSERT_NE(nullptr, cmdQ);
|
||||
@@ -130,7 +130,7 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenInstrumentationEnabledIs
|
||||
hwInfo->capabilityTable.instrumentationEnabled = false;
|
||||
cl_command_queue cmdQ = nullptr;
|
||||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = 1;
|
||||
cl_uint configuration = 0;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
ASSERT_EQ(nullptr, cmdQ);
|
||||
@@ -148,4 +148,26 @@ TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenInvalidDeviceWhenCreatin
|
||||
ASSERT_EQ(CL_INVALID_DEVICE, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clCreatePerfCountersCommandQueueINTELTests, GivenInvalidMetricsLibraryWhenCreatingPerfCountersThenPerfCountersReturnError) {
|
||||
cl_command_queue cmdQ = nullptr;
|
||||
cl_queue_properties properties = CL_QUEUE_PROFILING_ENABLE;
|
||||
cl_uint configuration = 0;
|
||||
|
||||
cmdQ = clCreatePerfCountersCommandQueueINTEL(context.get(), clDevice, properties, configuration, &retVal);
|
||||
auto commandQueueObject = castToObject<CommandQueue>(cmdQ);
|
||||
ASSERT_NE(nullptr, cmdQ);
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
auto performanceCounters = commandQueueObject->getPerfCounters();
|
||||
auto metricsLibary = static_cast<MockMetricsLibrary *>(performanceCounters->getMetricsLibraryInterface());
|
||||
metricsLibary->validOpen = false;
|
||||
ASSERT_NE(nullptr, metricsLibary);
|
||||
EXPECT_TRUE(commandQueueObject->isPerfCountersEnabled());
|
||||
EXPECT_TRUE(commandQueueObject->setPerfCountersEnabled(false, 0));
|
||||
EXPECT_FALSE(commandQueueObject->setPerfCountersEnabled(true, 0));
|
||||
EXPECT_FALSE(commandQueueObject->isPerfCountersEnabled());
|
||||
|
||||
retVal = clReleaseCommandQueue(cmdQ);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
} // namespace ULT
|
||||
|
||||
@@ -265,7 +265,7 @@ class clEventProfilingWithPerfCountersTests : public DeviceInstrumentationFixtur
|
||||
commandQueue = std::make_unique<CommandQueue>(context.get(), device.get(), nullptr);
|
||||
event = std::make_unique<Event>(commandQueue.get(), 0, 0, 0);
|
||||
event->setStatus(CL_COMPLETE);
|
||||
commandQueue->getPerfCounters()->processEventReport(0, nullptr, ¶m_value_size, nullptr, nullptr, true);
|
||||
commandQueue->getPerfCounters()->getApiReport(0, nullptr, ¶m_value_size, true);
|
||||
event->setProfilingEnabled(true);
|
||||
|
||||
eventCl = static_cast<cl_event>(event.get());
|
||||
|
||||
@@ -25,13 +25,13 @@ struct clSetPerformanceConfigurationINTELTests : public DeviceInstrumentationFix
|
||||
};
|
||||
namespace ULT {
|
||||
|
||||
TEST_F(clSetPerformanceConfigurationINTELTests, positiveSetPerfConfig) {
|
||||
TEST_F(clSetPerformanceConfigurationINTELTests, negativeSetPerfConfig) {
|
||||
cl_int ret = CL_OUT_OF_RESOURCES;
|
||||
cl_uint offsets[2];
|
||||
cl_uint values[2];
|
||||
|
||||
ret = clSetPerformanceConfigurationINTEL(device.get(), 2, offsets, values);
|
||||
EXPECT_EQ(CL_SUCCESS, ret);
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, ret);
|
||||
}
|
||||
|
||||
TEST_F(clSetPerformanceConfigurationINTELTests, negativeInvalidDevice) {
|
||||
@@ -41,7 +41,7 @@ TEST_F(clSetPerformanceConfigurationINTELTests, negativeInvalidDevice) {
|
||||
cl_device_id clDevice = {0};
|
||||
|
||||
ret = clSetPerformanceConfigurationINTEL(clDevice, 2, offsets, values);
|
||||
EXPECT_EQ(CL_INVALID_DEVICE, ret);
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, ret);
|
||||
}
|
||||
|
||||
TEST_F(clSetPerformanceConfigurationINTELTests, negativeInstrumentationDisabled) {
|
||||
@@ -53,7 +53,7 @@ TEST_F(clSetPerformanceConfigurationINTELTests, negativeInstrumentationDisabled)
|
||||
hwInfo->capabilityTable.instrumentationEnabled = false;
|
||||
|
||||
ret = clSetPerformanceConfigurationINTEL(device.get(), 2, offsets, values);
|
||||
EXPECT_EQ(CL_PROFILING_INFO_NOT_AVAILABLE, ret);
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, ret);
|
||||
|
||||
hwInfo->capabilityTable.instrumentationEnabled = instrumentationEnabled;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user