mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
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 <joshua.santosh.ranjan@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
da982b41be
commit
4cb7c1014a
@@ -48,8 +48,6 @@ struct MetricContextImp : public MetricContext {
|
||||
~MetricContextImp() override;
|
||||
|
||||
bool loadDependencies() override;
|
||||
void setMetricCollectionEnabled(bool enable) override;
|
||||
bool getMetricCollectionEnabled() override;
|
||||
bool isInitialized() override;
|
||||
void setInitializationState(const ze_result_t state) override;
|
||||
Device &getDevice() override;
|
||||
@@ -79,7 +77,6 @@ struct MetricContextImp : public MetricContext {
|
||||
MetricStreamer *pMetricStreamer = nullptr;
|
||||
uint32_t subDeviceIndex = 0;
|
||||
bool useCompute = false;
|
||||
bool metricCollectionIsEnabled = true;
|
||||
};
|
||||
|
||||
MetricContextImp::MetricContextImp(Device &deviceInput)
|
||||
@@ -120,14 +117,6 @@ bool MetricContextImp::loadDependencies() {
|
||||
return result;
|
||||
}
|
||||
|
||||
void MetricContextImp::setMetricCollectionEnabled(bool enable) {
|
||||
metricCollectionIsEnabled = enable;
|
||||
}
|
||||
|
||||
bool MetricContextImp::getMetricCollectionEnabled() {
|
||||
return metricCollectionIsEnabled;
|
||||
}
|
||||
|
||||
bool MetricContextImp::isInitialized() {
|
||||
return initializationState == ZE_RESULT_SUCCESS;
|
||||
}
|
||||
@@ -212,10 +201,7 @@ ze_result_t MetricContext::enableMetricApi() {
|
||||
|
||||
// Initialize root device.
|
||||
auto rootDevice = L0::Device::fromHandle(rootDeviceHandle);
|
||||
auto &rootMetricContext = rootDevice->getMetricContext();
|
||||
failed |= !rootMetricContext.loadDependencies();
|
||||
|
||||
rootMetricContext.setMetricCollectionEnabled(!rootDevice->isMultiDeviceCapable());
|
||||
failed |= !rootDevice->getMetricContext().loadDependencies();
|
||||
|
||||
// Sub devices count.
|
||||
uint32_t subDeviceCount = 0;
|
||||
|
||||
@@ -33,8 +33,6 @@ struct MetricContext {
|
||||
static std::unique_ptr<MetricContext> create(struct Device &device);
|
||||
static bool isMetricApiAvailable();
|
||||
virtual bool loadDependencies() = 0;
|
||||
virtual void setMetricCollectionEnabled(bool enable) = 0;
|
||||
virtual bool getMetricCollectionEnabled() = 0;
|
||||
virtual bool isInitialized() = 0;
|
||||
virtual void setInitializationState(const ze_result_t state) = 0;
|
||||
virtual Device &getDevice() = 0;
|
||||
|
||||
@@ -67,13 +67,9 @@ bool MetricEnumeration::isInitialized() {
|
||||
|
||||
ze_result_t MetricEnumeration::initialize() {
|
||||
if (initializationState == ZE_RESULT_ERROR_UNINITIALIZED) {
|
||||
if (!this->metricContext.getMetricCollectionEnabled()) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s",
|
||||
"metrics collection is disabled on the root device\n");
|
||||
initializationState = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
} else if (hMetricsDiscovery &&
|
||||
openMetricsDiscovery() == ZE_RESULT_SUCCESS &&
|
||||
cacheMetricInformation() == ZE_RESULT_SUCCESS) {
|
||||
if (hMetricsDiscovery &&
|
||||
openMetricsDiscovery() == ZE_RESULT_SUCCESS &&
|
||||
cacheMetricInformation() == ZE_RESULT_SUCCESS) {
|
||||
initializationState = ZE_RESULT_SUCCESS;
|
||||
} else {
|
||||
initializationState = ZE_RESULT_ERROR_UNKNOWN;
|
||||
|
||||
@@ -2657,19 +2657,6 @@ TEST_F(MetricEnumerationTest, givenSubDeviceWhenLoadDependenciesIsCalledThenOpen
|
||||
EXPECT_EQ(mockMetricEnumeration->baseIsInitialized(), false);
|
||||
}
|
||||
|
||||
TEST_F(MetricEnumerationTest, givenMetricContextWhenEnablingOrDisablingCollectionThenExpectProperFlagSet) {
|
||||
|
||||
auto &metricContext = device->getMetricContext();
|
||||
metricContext.setMetricCollectionEnabled(true);
|
||||
EXPECT_EQ(metricContext.getMetricCollectionEnabled(), true);
|
||||
metricContext.setMetricCollectionEnabled(false);
|
||||
EXPECT_EQ(metricContext.getMetricCollectionEnabled(), false);
|
||||
|
||||
uint32_t metricGroupCount = 0;
|
||||
EXPECT_EQ(zetMetricGroupGet(device->toHandle(), &metricGroupCount, nullptr), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
|
||||
EXPECT_EQ(metricGroupCount, 0u);
|
||||
}
|
||||
|
||||
class MetricEnumerationTestMetricTypes : public MetricEnumerationTest,
|
||||
public ::testing::WithParamInterface<MetricsDiscovery::TMetricType> {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user