mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
feature: Update Metrics Driver Code to use runtime enable & Disable APIs
Related-To: NEO-15339 Signed-off-by: Shreyas Kunder <shreyas.kunder@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2c5cbec033
commit
e4158208ae
@@ -832,12 +832,7 @@ bool runtimeEnableTest() {
|
||||
EXPECT(metricGroupCountBeforeEnable == 0u);
|
||||
LOG(zmu::LogLevel::INFO) << "MetricGroup Count Before Runtime Enabling: " << metricGroupCountBeforeEnable << "\n";
|
||||
|
||||
typedef ze_result_t (*pfzetIntelDeviceEnableMetricsExp)(zet_device_handle_t hDevice);
|
||||
pfzetIntelDeviceEnableMetricsExp zetIntelDeviceEnableMetricsExp = nullptr;
|
||||
ze_result_t result = zeDriverGetExtensionFunctionAddress(executionCtxt->getDriverHandle(0), "zetIntelDeviceEnableMetricsExp", reinterpret_cast<void **>(&zetIntelDeviceEnableMetricsExp));
|
||||
VALIDATECALL(result);
|
||||
|
||||
auto status = zetIntelDeviceEnableMetricsExp(executionCtxt->getDeviceHandle(0));
|
||||
auto status = zetDeviceEnableMetricsExp(executionCtxt->getDeviceHandle(0));
|
||||
VALIDATECALL(status);
|
||||
|
||||
uint32_t metricGroupCountAfterEnable = 0;
|
||||
|
||||
@@ -245,7 +245,7 @@ TEST_F(MetricRuntimeFixture, WhenRunTimeEnableIsDoneThenReturnSuccess) {
|
||||
auto deviceImp = static_cast<DeviceImp *>(device);
|
||||
deviceImp->metricContext.reset(mockDeviceContext);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelDeviceEnableMetricsExp(device->toHandle()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetDeviceEnableMetricsExp(device->toHandle()));
|
||||
deviceImp->metricContext.reset();
|
||||
}
|
||||
|
||||
@@ -260,9 +260,9 @@ TEST_F(MetricRuntimeFixture, WhenRunTimeEnableIsDoneMultipleTimesThenEnableIsDon
|
||||
auto deviceImp = static_cast<DeviceImp *>(device);
|
||||
deviceImp->metricContext.reset(mockDeviceContext);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelDeviceEnableMetricsExp(device->toHandle()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetDeviceEnableMetricsExp(device->toHandle()));
|
||||
EXPECT_EQ(metricSource->enableCallCount, 1u);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetIntelDeviceEnableMetricsExp(device->toHandle()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, zetDeviceEnableMetricsExp(device->toHandle()));
|
||||
EXPECT_EQ(metricSource->enableCallCount, 1u);
|
||||
deviceImp->metricContext.reset();
|
||||
}
|
||||
@@ -278,7 +278,7 @@ TEST_F(MetricRuntimeFixture, WhenRunTimeEnableIsDoneAndNoSourcesAreAvailableThen
|
||||
auto deviceImp = static_cast<DeviceImp *>(device);
|
||||
deviceImp->metricContext.reset(mockDeviceContext);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, zetIntelDeviceEnableMetricsExp(device->toHandle()));
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE, zetDeviceEnableMetricsExp(device->toHandle()));
|
||||
EXPECT_EQ(metricSource->enableCallCount, 1u);
|
||||
deviceImp->metricContext.reset();
|
||||
}
|
||||
|
||||
@@ -305,14 +305,14 @@ HWTEST2_F(MetricIpSamplingEnumerationTest, GivenEnumerationIsSuccessfulWhenMetri
|
||||
static_cast<DeviceImp *>(device)->activateMetricGroups();
|
||||
|
||||
// Disable Metrics
|
||||
EXPECT_EQ(zetIntelDeviceDisableMetricsExp(device->toHandle()), ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE);
|
||||
EXPECT_EQ(zetDeviceDisableMetricsExp(device->toHandle()), ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE);
|
||||
// De-Activate all metric groups.
|
||||
EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 0, nullptr), ZE_RESULT_SUCCESS);
|
||||
// Disable Metrics with all groups deactivated should return success
|
||||
EXPECT_EQ(zetIntelDeviceDisableMetricsExp(device->toHandle()), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(zetDeviceDisableMetricsExp(device->toHandle()), ZE_RESULT_SUCCESS);
|
||||
// Activate metric group on a disabled device should be failure.
|
||||
EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), device->toHandle(), 1, &metricGroups[0]), ZE_RESULT_ERROR_UNINITIALIZED);
|
||||
EXPECT_EQ(zetIntelDeviceEnableMetricsExp(device->toHandle()), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(zetDeviceEnableMetricsExp(device->toHandle()), ZE_RESULT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1673,13 +1673,13 @@ TEST_F(MultiDeviceMetricEnumerationTest, givenMultipleDevicesAndMetricsIsDisable
|
||||
// Activate metric group.
|
||||
EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), devices[0]->toHandle(), 1, &metricGroupHandle), ZE_RESULT_SUCCESS);
|
||||
// Disable Metrics with an activated metric group returns error
|
||||
EXPECT_EQ(zetIntelDeviceDisableMetricsExp(devices[0]->toHandle()), ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE);
|
||||
EXPECT_EQ(zetDeviceDisableMetricsExp(devices[0]->toHandle()), ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE);
|
||||
// De-Activate all metric groups.
|
||||
EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), devices[0]->toHandle(), 0, nullptr), ZE_RESULT_SUCCESS);
|
||||
// Disable Metrics with all groups deactivated should return success
|
||||
EXPECT_EQ(zetIntelDeviceDisableMetricsExp(devices[0]->toHandle()), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(zetDeviceDisableMetricsExp(devices[0]->toHandle()), ZE_RESULT_SUCCESS);
|
||||
// Multiple Disables continue to return success
|
||||
EXPECT_EQ(zetIntelDeviceDisableMetricsExp(devices[0]->toHandle()), ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(zetDeviceDisableMetricsExp(devices[0]->toHandle()), ZE_RESULT_SUCCESS);
|
||||
// Activate metric group on a disabled device should be failure
|
||||
EXPECT_EQ(zetContextActivateMetricGroups(context->toHandle(), devices[0]->toHandle(), 1, &metricGroupHandle), ZE_RESULT_ERROR_UNINITIALIZED);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user