0
# Performance Control
1
2
GPU overclocking, performance levels, power profiles, and system configuration management. These functions require elevated privileges and can significantly impact system stability and power consumption.
3
4
## Capabilities
5
6
### Clock Frequency Control
7
8
Set GPU clock frequencies for performance tuning and overclocking.
9
10
```cpp { .api }
11
amdsmi_status_t amdsmi_set_gpu_clk_freq(amdsmi_processor_handle processor_handle,
12
amdsmi_clk_type_t clk_type,
13
uint64_t freq_bitmask);
14
```
15
16
**Usage Example:**
17
```cpp
18
// Set graphics clock to specific frequency level
19
// freq_bitmask is a bitmask where each bit represents a frequency level
20
uint64_t freq_mask = 0x04; // Enable frequency level 2
21
amdsmi_status_t status = amdsmi_set_gpu_clk_freq(gpu_handle,
22
AMDSMI_CLK_TYPE_SYS,
23
freq_mask);
24
25
if (status == AMDSMI_STATUS_SUCCESS) {
26
printf("Graphics clock frequency set successfully\n");
27
} else if (status == AMDSMI_STATUS_PERMISSION) {
28
printf("Insufficient permissions to set clock frequency\n");
29
}
30
```
31
32
### Performance Level Control
33
34
Control GPU performance levels for power/performance balance.
35
36
```cpp { .api }
37
amdsmi_status_t amdsmi_set_gpu_perf_level(amdsmi_processor_handle processor_handle,
38
amdsmi_dev_perf_level_t perf_level);
39
```
40
41
```cpp { .api }
42
amdsmi_status_t amdsmi_get_gpu_perf_level(amdsmi_processor_handle processor_handle,
43
amdsmi_dev_perf_level_t* perf);
44
```
45
46
**Performance Levels:**
47
```cpp { .api }
48
typedef enum {
49
AMDSMI_DEV_PERF_LEVEL_AUTO = 0, // Automatic performance level
50
AMDSMI_DEV_PERF_LEVEL_LOW, // Low performance, low power
51
AMDSMI_DEV_PERF_LEVEL_HIGH, // High performance
52
AMDSMI_DEV_PERF_LEVEL_MANUAL, // Manual control
53
AMDSMI_DEV_PERF_LEVEL_STABLE_STD, // Stable standard performance
54
AMDSMI_DEV_PERF_LEVEL_STABLE_PEAK, // Stable peak performance
55
AMDSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK, // Stable minimum memory clock
56
AMDSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK, // Stable minimum system clock
57
AMDSMI_DEV_PERF_LEVEL_DETERMINISM // Deterministic performance
58
} amdsmi_dev_perf_level_t;
59
```
60
61
### Power Cap Control
62
63
Set power consumption limits for thermal and power management.
64
65
```cpp { .api }
66
amdsmi_status_t amdsmi_set_power_cap(amdsmi_processor_handle processor_handle,
67
uint32_t sensor_ind,
68
uint64_t cap);
69
```
70
71
```cpp { .api }
72
amdsmi_status_t amdsmi_reset_power_cap(amdsmi_processor_handle processor_handle,
73
uint32_t sensor_ind);
74
```
75
76
### Fan Speed Control
77
78
Control fan speeds for thermal management (where supported).
79
80
```cpp { .api }
81
amdsmi_status_t amdsmi_set_fan_speed(amdsmi_processor_handle processor_handle,
82
uint32_t sensor_idx,
83
uint64_t speed);
84
```
85
86
```cpp { .api }
87
amdsmi_status_t amdsmi_reset_fan(amdsmi_processor_handle processor_handle,
88
uint32_t sensor_idx);
89
```
90
91
## Language Interface Examples
92
93
### Python
94
```python
95
import amdsmi
96
97
gpu_handles = amdsmi.amdsmi_get_processor_handles(amdsmi.AmdSmiProcessorType.AMD_GPU)
98
if gpu_handles:
99
gpu_handle = gpu_handles[0]
100
101
try:
102
# Set performance level to high performance
103
amdsmi.amdsmi_set_gpu_perf_level(gpu_handle,
104
amdsmi.AmdSmiDevPerfLevel.HIGH)
105
print("Performance level set to HIGH")
106
107
# Set power cap to 200W
108
amdsmi.amdsmi_set_power_cap(gpu_handle, 0, 200)
109
print("Power cap set to 200W")
110
111
except amdsmi.AmdSmiParameterException:
112
print("Insufficient permissions for performance control")
113
```
114
115
### Rust
116
```rust
117
use amdsmi::{set_gpu_perf_level, set_power_cap, DevPerfLevel};
118
119
// Set performance level
120
match set_gpu_perf_level(gpu_handle, DevPerfLevel::High) {
121
Ok(_) => println!("Performance level set to HIGH"),
122
Err(e) => println!("Failed to set performance level: {:?}", e),
123
}
124
125
// Set power cap
126
match set_power_cap(gpu_handle, 0, 200) {
127
Ok(_) => println!("Power cap set to 200W"),
128
Err(e) => println!("Failed to set power cap: {:?}", e),
129
}
130
```
131
132
## Performance Control Best Practices
133
134
1. **Permissions**: Requires root/administrator privileges
135
2. **Stability**: Test changes gradually to avoid system instability
136
3. **Cooling**: Ensure adequate cooling before increasing performance limits
137
4. **Power Supply**: Verify PSU capacity before raising power limits
138
5. **Reset Options**: Always provide reset functionality for safety