geopm 3.2.1.dev529+g9f1c3b01c
GEOPM - Global Extensible Open Power Manager
Loading...
Searching...
No Matches
LevelZeroDevicePoolImp.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 - 2026 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef LEVELZERODEVICEPOOLIMP_HPP_INCLUDE
7#define LEVELZERODEVICEPOOLIMP_HPP_INCLUDE
8
9#include <string>
10#include <cstdint>
11#include <map>
12
14#include "LevelZero.hpp"
15
16#include "geopm_time.h"
17
18namespace geopm
19{
23 {
24 uint64_t last_raw = 0;
25 uint64_t offset = 0;
26 bool is_init = false;
27 };
28
30 {
31 public:
34 virtual ~LevelZeroDevicePoolImp() = default;
35 int num_gpu(int domain_type) const override;
36 double frequency_status(int domain, unsigned int domain_idx,
37 int l0_domain) const override;
38 double frequency_efficient(int domain, unsigned int domain_idx,
39 int l0_domain) const override;
40 double frequency_min(int domain, unsigned int domain_idx,
41 int l0_domain) const override;
42 double frequency_max(int domain, unsigned int domain_idx,
43 int l0_domain) const override;
44 double frequency_step(int domain, unsigned int domain_idx,
45 int l0_domain) const override;
46 uint32_t frequency_throttle_reasons(int domain, unsigned int domain_idx,
47 int l0_domain) const override;
48 std::pair <double, double> frequency_range(int domain,
49 unsigned int domain_idx,
50 int l0_domain) const override;
51 double temperature_max(int domain, unsigned int domain_idx,
52 int l0_domain) const override;
53 std::pair<uint64_t, uint64_t> active_time_pair(int domain,
54 unsigned int device_idx,
55 int l0_domain) const override;
56 double active_time(int domain, unsigned int device_idx,
57 int l0_domain) const override;
58 double active_time_timestamp(int domain, unsigned int device_idx,
59 int l0_domain) const override;
60 int32_t power_limit_tdp(int domain, unsigned int domain_idx,
61 int l0_domain) const override;
62 int32_t power_limit_min(int domain, unsigned int domain_idx,
63 int l0_domain) const override;
64 int32_t power_limit_max(int domain, unsigned int domain_idx,
65 int l0_domain) const override;
66 std::pair<uint64_t, uint64_t> energy_pair(int domain, unsigned int domain_idx,
67 int l0_domain) const override;
68 uint64_t energy(int domain, unsigned int domain_idx, int l0_domain) const override;
69 uint64_t energy_timestamp(int domain, unsigned int domain_idx,
70 int l0_domain) const override;
71 double performance_factor(int domain,
72 unsigned int domain_idx,
73 int l0_domain) const override;
74 void frequency_control(int domain, unsigned int domain_idx,
75 int l0_domain, double range_min,
76 double range_max) const override;
77 void performance_factor_control(int domain, unsigned int domain_idx,
78 int l0_domain,
79 double setting) const override;
80 double ras_reset_count_correctable(int domain, unsigned int domain_idx,
81 int l0_domain) const override;
82 double ras_programming_errcount_correctable(int domain, unsigned int domain_idx,
83 int l0_domain) const override;
84 double ras_driver_errcount_correctable(int domain, unsigned int domain_idx,
85 int l0_domain) const override;
86 double ras_compute_errcount_correctable(int domain, unsigned int domain_idx,
87 int l0_domain) const override;
88 double ras_noncompute_errcount_correctable(int domain, unsigned int domain_idx,
89 int l0_domain) const override;
90 double ras_cache_errcount_correctable(int domain, unsigned int domain_idx,
91 int l0_domain) const override;
92 double ras_display_errcount_correctable(int domain, unsigned int domain_idx,
93 int l0_domain) const override;
94 double ras_reset_count_uncorrectable(int domain, unsigned int domain_idx,
95 int l0_domain) const override;
96 double ras_programming_errcount_uncorrectable(int domain, unsigned int domain_idx,
97 int l0_domain) const override;
98 double ras_driver_errcount_uncorrectable(int domain, unsigned int domain_idx,
99 int l0_domain) const override;
100 double ras_compute_errcount_uncorrectable(int domain, unsigned int domain_idx,
101 int l0_domain) const override;
102 double ras_noncompute_errcount_uncorrectable(int domain, unsigned int domain_idx,
103 int l0_domain) const override;
104 double ras_cache_errcount_uncorrectable(int domain, unsigned int domain_idx,
105 int l0_domain) const override;
106 double ras_display_errcount_uncorrectable(int domain, unsigned int domain_idx,
107 int l0_domain) const override;
108
109 //ZET Metrics
110 double metric_sample(int domain, unsigned int domain_idx,
111 std::string metric_name) const override;
112 uint32_t metric_update_rate(int domain, unsigned int domain_idx) const override;
113
114 void metric_read(int domain, unsigned int domain_idx) const override;
115
116 private:
117 LevelZero &m_levelzero;
118
119 void check_idx_range(int domain, unsigned int domain_idx) const;
120 void check_domain_exists(int size, const char *func, int line) const;
121 std::pair<unsigned int, unsigned int> subdevice_device_conversion(unsigned int idx) const;
122 mutable std::map<int, std::vector<ActivityCounterState> > m_active_time_state; // Map from l0_domain to vector over gpu chips
123 mutable std::map<int, std::vector<ActivityCounterState> > m_active_timestamp_state; // Map from l0_domain to vector over gpu chips
124 };
125}
126#endif
Definition LevelZeroDevicePool.hpp:19
Definition LevelZeroDevicePoolImp.hpp:30
double frequency_min(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device mininmum frequency in MHz.
Definition LevelZeroDevicePool.cpp:128
double metric_sample(int domain, unsigned int domain_idx, std::string metric_name) const override
Definition LevelZeroDevicePool.cpp:810
void performance_factor_control(int domain, unsigned int domain_idx, int l0_domain, double setting) const override
Set performance factor for LevelZero device.
Definition LevelZeroDevicePool.cpp:518
double ras_compute_errcount_correctable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of correctable errors that have occurred in the compute accelerator...
Definition LevelZeroDevicePool.cpp:593
double ras_display_errcount_correctable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of correctable errors that have occurred in the display.
Definition LevelZeroDevicePool.cpp:647
double ras_driver_errcount_correctable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of low level driver communication correctable errors have occurred.
Definition LevelZeroDevicePool.cpp:575
double frequency_status(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device actual frequency in MHz.
Definition LevelZeroDevicePool.cpp:92
uint32_t frequency_throttle_reasons(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device frequency throttle reasons.
Definition LevelZeroDevicePool.cpp:192
double temperature_max(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero domain maximum temperature in Celsius.
Definition LevelZeroDevicePool.cpp:230
double performance_factor(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device performance factor.
Definition LevelZeroDevicePool.cpp:482
double ras_cache_errcount_correctable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of correctable errors that have occurred in caches (L1/L3/register ...
Definition LevelZeroDevicePool.cpp:629
double ras_cache_errcount_uncorrectable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of uncorrectable errors that have occurred in caches (L1/L3/registe...
Definition LevelZeroDevicePool.cpp:757
LevelZeroDevicePoolImp()
Definition LevelZeroDevicePool.cpp:32
double frequency_step(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device frequency step in MHz.
Definition LevelZeroDevicePool.cpp:164
double ras_compute_errcount_uncorrectable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of uncorrectable errors that have occurred in the compute accelerat...
Definition LevelZeroDevicePool.cpp:721
double frequency_efficient(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device efficient frequency in MHz.
Definition LevelZeroDevicePool.cpp:110
void frequency_control(int domain, unsigned int domain_idx, int l0_domain, double range_min, double range_max) const override
Set min and max frequency for LevelZero device.
Definition LevelZeroDevicePool.cpp:498
virtual ~LevelZeroDevicePoolImp()=default
std::pair< double, double > frequency_range(int domain, unsigned int domain_idx, int l0_domain) const override
Definition LevelZeroDevicePool.cpp:210
uint64_t energy(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device energy in microjoules.
Definition LevelZeroDevicePool.cpp:455
int32_t power_limit_min(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device minimum power limit in milliwatts.
Definition LevelZeroDevicePool.cpp:353
double frequency_max(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device maximum frequency in MHz.
Definition LevelZeroDevicePool.cpp:146
double ras_noncompute_errcount_uncorrectable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of uncorrectable errors that have occurred in the fixed-function ac...
Definition LevelZeroDevicePool.cpp:739
double active_time_timestamp(int domain, unsigned int device_idx, int l0_domain) const override
Get the LevelZero device timestamp for the active time value in microseconds.
Definition LevelZeroDevicePool.cpp:304
double ras_programming_errcount_correctable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of correctable hardware exceptions generated by the way workloads h...
Definition LevelZeroDevicePool.cpp:557
std::pair< uint64_t, uint64_t > energy_pair(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device energy in microjoules and timestamp in microseconds.
Definition LevelZeroDevicePool.cpp:394
double ras_reset_count_uncorrectable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of uncorrectable accelerator engine resets attempted by the driver.
Definition LevelZeroDevicePool.cpp:667
double ras_reset_count_correctable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of correctable accelerator engine resets attempted by the driver.
Definition LevelZeroDevicePool.cpp:539
double ras_programming_errcount_uncorrectable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of uncorrectable hardware exceptions generated by the way workloads...
Definition LevelZeroDevicePool.cpp:685
uint64_t energy_timestamp(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device energy timestamp in microseconds.
Definition LevelZeroDevicePool.cpp:424
double active_time(int domain, unsigned int device_idx, int l0_domain) const override
Get the LevelZero device timestamp for the active time value in microseconds.
Definition LevelZeroDevicePool.cpp:329
int32_t power_limit_max(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device maximum power limit in milliwatts.
Definition LevelZeroDevicePool.cpp:366
double ras_driver_errcount_uncorrectable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of low level driver communication uncorrectable errors have occurre...
Definition LevelZeroDevicePool.cpp:703
double ras_noncompute_errcount_correctable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of correctable errors that have occurred in the fixed-function acce...
Definition LevelZeroDevicePool.cpp:611
int32_t power_limit_tdp(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero device default power limit in milliwatts.
Definition LevelZeroDevicePool.cpp:380
std::pair< uint64_t, uint64_t > active_time_pair(int domain, unsigned int device_idx, int l0_domain) const override
Get the LevelZero device active time and timestamp in microseconds.
Definition LevelZeroDevicePool.cpp:249
int num_gpu(int domain_type) const override
Number of GPUs on the platform.
Definition LevelZeroDevicePool.cpp:37
uint32_t metric_update_rate(int domain, unsigned int domain_idx) const override
Definition LevelZeroDevicePool.cpp:835
double ras_display_errcount_uncorrectable(int domain, unsigned int domain_idx, int l0_domain) const override
Get the LevelZero count of number of uncorrectable errors that have occurred in the display.
Definition LevelZeroDevicePool.cpp:775
void metric_read(int domain, unsigned int domain_idx) const override
Definition LevelZeroDevicePool.cpp:795
Definition LevelZero.hpp:18
Definition Agg.cpp:20
LevelZero & levelzero()
Definition LevelZero.cpp:33
Definition LevelZeroDevicePoolImp.hpp:23
bool is_init
Definition LevelZeroDevicePoolImp.hpp:26
uint64_t offset
Definition LevelZeroDevicePoolImp.hpp:25
uint64_t last_raw
Definition LevelZeroDevicePoolImp.hpp:24