CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/go-amdsmi

AMD System Management Interface (AMD SMI) Go library for unified GPU and CPU management and monitoring

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

performance-control.mddocs/

Performance Control

GPU overclocking, performance levels, power profiles, and system configuration management. These functions require elevated privileges and can significantly impact system stability and power consumption.

Capabilities

Clock Frequency Control

Set GPU clock frequencies for performance tuning and overclocking.

amdsmi_status_t amdsmi_set_gpu_clk_freq(amdsmi_processor_handle processor_handle,
                                       amdsmi_clk_type_t clk_type,
                                       uint64_t freq_bitmask);

Usage Example:

// Set graphics clock to specific frequency level
// freq_bitmask is a bitmask where each bit represents a frequency level
uint64_t freq_mask = 0x04; // Enable frequency level 2
amdsmi_status_t status = amdsmi_set_gpu_clk_freq(gpu_handle, 
                                                AMDSMI_CLK_TYPE_SYS, 
                                                freq_mask);

if (status == AMDSMI_STATUS_SUCCESS) {
    printf("Graphics clock frequency set successfully\n");
} else if (status == AMDSMI_STATUS_PERMISSION) {
    printf("Insufficient permissions to set clock frequency\n");
}

Performance Level Control

Control GPU performance levels for power/performance balance.

amdsmi_status_t amdsmi_set_gpu_perf_level(amdsmi_processor_handle processor_handle,
                                         amdsmi_dev_perf_level_t perf_level);
amdsmi_status_t amdsmi_get_gpu_perf_level(amdsmi_processor_handle processor_handle,
                                         amdsmi_dev_perf_level_t* perf);

Performance Levels:

typedef enum {
    AMDSMI_DEV_PERF_LEVEL_AUTO = 0,     // Automatic performance level
    AMDSMI_DEV_PERF_LEVEL_LOW,          // Low performance, low power
    AMDSMI_DEV_PERF_LEVEL_HIGH,         // High performance
    AMDSMI_DEV_PERF_LEVEL_MANUAL,       // Manual control
    AMDSMI_DEV_PERF_LEVEL_STABLE_STD,   // Stable standard performance
    AMDSMI_DEV_PERF_LEVEL_STABLE_PEAK,  // Stable peak performance
    AMDSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK, // Stable minimum memory clock
    AMDSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK,  // Stable minimum system clock
    AMDSMI_DEV_PERF_LEVEL_DETERMINISM   // Deterministic performance
} amdsmi_dev_perf_level_t;

Power Cap Control

Set power consumption limits for thermal and power management.

amdsmi_status_t amdsmi_set_power_cap(amdsmi_processor_handle processor_handle,
                                    uint32_t sensor_ind,
                                    uint64_t cap);
amdsmi_status_t amdsmi_reset_power_cap(amdsmi_processor_handle processor_handle,
                                      uint32_t sensor_ind);

Fan Speed Control

Control fan speeds for thermal management (where supported).

amdsmi_status_t amdsmi_set_fan_speed(amdsmi_processor_handle processor_handle,
                                    uint32_t sensor_idx,
                                    uint64_t speed);
amdsmi_status_t amdsmi_reset_fan(amdsmi_processor_handle processor_handle,
                                uint32_t sensor_idx);

Language Interface Examples

Python

import amdsmi

gpu_handles = amdsmi.amdsmi_get_processor_handles(amdsmi.AmdSmiProcessorType.AMD_GPU)
if gpu_handles:
    gpu_handle = gpu_handles[0]
    
    try:
        # Set performance level to high performance
        amdsmi.amdsmi_set_gpu_perf_level(gpu_handle, 
                                        amdsmi.AmdSmiDevPerfLevel.HIGH)
        print("Performance level set to HIGH")
        
        # Set power cap to 200W
        amdsmi.amdsmi_set_power_cap(gpu_handle, 0, 200)
        print("Power cap set to 200W")
        
    except amdsmi.AmdSmiParameterException:
        print("Insufficient permissions for performance control")

Rust

use amdsmi::{set_gpu_perf_level, set_power_cap, DevPerfLevel};

// Set performance level
match set_gpu_perf_level(gpu_handle, DevPerfLevel::High) {
    Ok(_) => println!("Performance level set to HIGH"),
    Err(e) => println!("Failed to set performance level: {:?}", e),
}

// Set power cap
match set_power_cap(gpu_handle, 0, 200) {
    Ok(_) => println!("Power cap set to 200W"),
    Err(e) => println!("Failed to set power cap: {:?}", e),
}

Performance Control Best Practices

  1. Permissions: Requires root/administrator privileges
  2. Stability: Test changes gradually to avoid system instability
  3. Cooling: Ensure adequate cooling before increasing performance limits
  4. Power Supply: Verify PSU capacity before raising power limits
  5. Reset Options: Always provide reset functionality for safety

Install with Tessl CLI

npx tessl i tessl/go-amdsmi

docs

cpu-management.md

device-info.md

events.md

gpu-performance.md

index.md

initialization.md

memory.md

performance-control.md

power-thermal.md

topology-ras.md

tile.json