Skip to content

Commit 4cb7c10

Browse files
Revert "Add flexibility to disable root device metrics"
Reverted the change which disabled metrics collection for multi-device Related-To: LOCI-2580 Signed-off-by: Joshua Santosh Ranjan <[email protected]>
1 parent da982b4 commit 4cb7c10

File tree

4 files changed

+4
-37
lines changed

4 files changed

+4
-37
lines changed

level_zero/tools/source/metrics/metric.cpp

+1-15
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ struct MetricContextImp : public MetricContext {
4848
~MetricContextImp() override;
4949

5050
bool loadDependencies() override;
51-
void setMetricCollectionEnabled(bool enable) override;
52-
bool getMetricCollectionEnabled() override;
5351
bool isInitialized() override;
5452
void setInitializationState(const ze_result_t state) override;
5553
Device &getDevice() override;
@@ -79,7 +77,6 @@ struct MetricContextImp : public MetricContext {
7977
MetricStreamer *pMetricStreamer = nullptr;
8078
uint32_t subDeviceIndex = 0;
8179
bool useCompute = false;
82-
bool metricCollectionIsEnabled = true;
8380
};
8481

8582
MetricContextImp::MetricContextImp(Device &deviceInput)
@@ -120,14 +117,6 @@ bool MetricContextImp::loadDependencies() {
120117
return result;
121118
}
122119

123-
void MetricContextImp::setMetricCollectionEnabled(bool enable) {
124-
metricCollectionIsEnabled = enable;
125-
}
126-
127-
bool MetricContextImp::getMetricCollectionEnabled() {
128-
return metricCollectionIsEnabled;
129-
}
130-
131120
bool MetricContextImp::isInitialized() {
132121
return initializationState == ZE_RESULT_SUCCESS;
133122
}
@@ -212,10 +201,7 @@ ze_result_t MetricContext::enableMetricApi() {
212201

213202
// Initialize root device.
214203
auto rootDevice = L0::Device::fromHandle(rootDeviceHandle);
215-
auto &rootMetricContext = rootDevice->getMetricContext();
216-
failed |= !rootMetricContext.loadDependencies();
217-
218-
rootMetricContext.setMetricCollectionEnabled(!rootDevice->isMultiDeviceCapable());
204+
failed |= !rootDevice->getMetricContext().loadDependencies();
219205

220206
// Sub devices count.
221207
uint32_t subDeviceCount = 0;

level_zero/tools/source/metrics/metric.h

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ struct MetricContext {
3333
static std::unique_ptr<MetricContext> create(struct Device &device);
3434
static bool isMetricApiAvailable();
3535
virtual bool loadDependencies() = 0;
36-
virtual void setMetricCollectionEnabled(bool enable) = 0;
37-
virtual bool getMetricCollectionEnabled() = 0;
3836
virtual bool isInitialized() = 0;
3937
virtual void setInitializationState(const ze_result_t state) = 0;
4038
virtual Device &getDevice() = 0;

level_zero/tools/source/metrics/metric_enumeration_imp.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,9 @@ bool MetricEnumeration::isInitialized() {
6767

6868
ze_result_t MetricEnumeration::initialize() {
6969
if (initializationState == ZE_RESULT_ERROR_UNINITIALIZED) {
70-
if (!this->metricContext.getMetricCollectionEnabled()) {
71-
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s",
72-
"metrics collection is disabled on the root device\n");
73-
initializationState = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
74-
} else if (hMetricsDiscovery &&
75-
openMetricsDiscovery() == ZE_RESULT_SUCCESS &&
76-
cacheMetricInformation() == ZE_RESULT_SUCCESS) {
70+
if (hMetricsDiscovery &&
71+
openMetricsDiscovery() == ZE_RESULT_SUCCESS &&
72+
cacheMetricInformation() == ZE_RESULT_SUCCESS) {
7773
initializationState = ZE_RESULT_SUCCESS;
7874
} else {
7975
initializationState = ZE_RESULT_ERROR_UNKNOWN;

level_zero/tools/test/unit_tests/sources/metrics/test_metric_enumeration_1.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -2657,19 +2657,6 @@ TEST_F(MetricEnumerationTest, givenSubDeviceWhenLoadDependenciesIsCalledThenOpen
26572657
EXPECT_EQ(mockMetricEnumeration->baseIsInitialized(), false);
26582658
}
26592659

2660-
TEST_F(MetricEnumerationTest, givenMetricContextWhenEnablingOrDisablingCollectionThenExpectProperFlagSet) {
2661-
2662-
auto &metricContext = device->getMetricContext();
2663-
metricContext.setMetricCollectionEnabled(true);
2664-
EXPECT_EQ(metricContext.getMetricCollectionEnabled(), true);
2665-
metricContext.setMetricCollectionEnabled(false);
2666-
EXPECT_EQ(metricContext.getMetricCollectionEnabled(), false);
2667-
2668-
uint32_t metricGroupCount = 0;
2669-
EXPECT_EQ(zetMetricGroupGet(device->toHandle(), &metricGroupCount, nullptr), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
2670-
EXPECT_EQ(metricGroupCount, 0u);
2671-
}
2672-
26732660
class MetricEnumerationTestMetricTypes : public MetricEnumerationTest,
26742661
public ::testing::WithParamInterface<MetricsDiscovery::TMetricType> {
26752662
public:

0 commit comments

Comments
 (0)