TT Zephyr Platforms 19.5.0-rc1
Tenstorrent Firmware
Loading...
Searching...
No Matches
throttler.c File Reference
#include <zephyr/sys/util.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/zbus/zbus.h>
#include "throttler.h"
#include "aiclk_ppm.h"
#include "cm2dm_msg.h"
#include <zephyr/drivers/misc/bh_fwtable.h>
#include "telemetry_internal.h"
#include "telemetry.h"
#include "noc2axi.h"
#include "tensix_state_msg.h"

Data Structures

struct  ThrottlerLimitRange
struct  ThrottlerParams
struct  Throttler

Macros

#define kThrottlerAiclkScaleFactor   500.0F
#define DEFAULT_BOARD_POWER_LIMIT   150
#define ADVANCE_CIRCULAR_POINTER(pointer, array)

Enumerations

enum  ThrottlerId {
  kThrottlerTDP ,
  kThrottlerFastTDC ,
  kThrottlerTDC ,
  kThrottlerThm ,
  kThrottlerBoardPower ,
  kThrottlerGDDRThm ,
  kThrottlerDopplerSlow ,
  kThrottlerCount
}

Functions

 LOG_MODULE_REGISTER (throttler)
static void SetThrottlerLimit (ThrottlerId id, float limit)
static void BroadcastKernelThrottleState (void)
static void InitKernelThrottling (void)
static void SendKernelThrottlingMessage (bool throttle)
static void doppler_tensix_state_callback (const struct zbus_channel *chan)
 ZBUS_LISTENER_DEFINE (doppler_tensix_state_listener, doppler_tensix_state_callback)
 ZBUS_CHAN_ADD_OBS (tensix_state_chan, doppler_tensix_state_listener, 0)
void InitThrottlers (void)
static void UpdateThrottler (ThrottlerId id, float value)
static void UpdateThrottlerArb (ThrottlerId id)
static uint16_t UpdateMovingAveragePower (uint16_t current_power)
static bool DopplerActive (void)
static void UpdateDoppler (const TelemetryInternalData *telemetry)
void CalculateThrottlers (void)
int32_t Dm2CmSetBoardPowerLimit (const uint8_t *data, uint8_t size)

Variables

static uint32_t power_limit
static bool doppler
static bool doppler_slow
static bool doppler_t2
static bool doppler_t3
static const bool thermal_throttling = true
static const struct device *const fwtable_dev = DEVICE_DT_GET(DT_NODELABEL(fwtable))
static const ThrottlerLimitRange throttler_limit_ranges [kThrottlerCount]
static Throttler throttler [kThrottlerCount]
static uint32_t throttle_counter
static const uint32_t kKernelThrottleAddress = 0x10
static bool tensixes_enabled = true
static uint16_t board_power_history [1000]
static uint16_tboard_power_history_cursor = board_power_history
static uint32_t board_power_sum
static bool kernel_nops_enabled
static uint8_t t2_count
static uint8_t t3_count

Macro Definition Documentation

◆ ADVANCE_CIRCULAR_POINTER

#define ADVANCE_CIRCULAR_POINTER ( pointer,
array )
Value:
do { \
if (++(pointer) == (array) + ARRAY_SIZE(array)) \
(pointer) = (array); \
} while (false)
#define ARRAY_SIZE(array)

◆ DEFAULT_BOARD_POWER_LIMIT

#define DEFAULT_BOARD_POWER_LIMIT   150

◆ kThrottlerAiclkScaleFactor

#define kThrottlerAiclkScaleFactor   500.0F

Enumeration Type Documentation

◆ ThrottlerId

Enumerator
kThrottlerTDP 
kThrottlerFastTDC 
kThrottlerTDC 
kThrottlerThm 
kThrottlerBoardPower 
kThrottlerGDDRThm 
kThrottlerDopplerSlow 
kThrottlerCount 

Function Documentation

◆ BroadcastKernelThrottleState()

void BroadcastKernelThrottleState ( void )
static

◆ CalculateThrottlers()

void CalculateThrottlers ( void )

◆ Dm2CmSetBoardPowerLimit()

int32_t Dm2CmSetBoardPowerLimit ( const uint8_t * data,
uint8_t size )

◆ doppler_tensix_state_callback()

void doppler_tensix_state_callback ( const struct zbus_channel * chan)
static

◆ DopplerActive()

bool DopplerActive ( void )
static

◆ InitKernelThrottling()

void InitKernelThrottling ( void )
static

◆ InitThrottlers()

void InitThrottlers ( void )

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( throttler )

◆ SendKernelThrottlingMessage()

void SendKernelThrottlingMessage ( bool throttle)
static

◆ SetThrottlerLimit()

void SetThrottlerLimit ( ThrottlerId id,
float limit )
static

◆ UpdateDoppler()

void UpdateDoppler ( const TelemetryInternalData * telemetry)
static

◆ UpdateMovingAveragePower()

uint16_t UpdateMovingAveragePower ( uint16_t current_power)
static

◆ UpdateThrottler()

void UpdateThrottler ( ThrottlerId id,
float value )
static

◆ UpdateThrottlerArb()

void UpdateThrottlerArb ( ThrottlerId id)
static

◆ ZBUS_CHAN_ADD_OBS()

ZBUS_CHAN_ADD_OBS ( tensix_state_chan ,
doppler_tensix_state_listener ,
0  )

◆ ZBUS_LISTENER_DEFINE()

ZBUS_LISTENER_DEFINE ( doppler_tensix_state_listener ,
doppler_tensix_state_callback  )

Variable Documentation

◆ board_power_history

uint16_t board_power_history[1000]
static

◆ board_power_history_cursor

uint16_t* board_power_history_cursor = board_power_history
static

◆ board_power_sum

uint32_t board_power_sum
static

◆ doppler

bool doppler
static

◆ doppler_slow

bool doppler_slow
static

◆ doppler_t2

bool doppler_t2
static

◆ doppler_t3

bool doppler_t3
static

◆ fwtable_dev

const struct device* const fwtable_dev = DEVICE_DT_GET(DT_NODELABEL(fwtable))
static

◆ kernel_nops_enabled

bool kernel_nops_enabled
static

◆ kKernelThrottleAddress

const uint32_t kKernelThrottleAddress = 0x10
static

◆ power_limit

uint32_t power_limit
static

◆ t2_count

uint8_t t2_count
static

◆ t3_count

uint8_t t3_count
static

◆ tensixes_enabled

bool tensixes_enabled = true
static

◆ thermal_throttling

const bool thermal_throttling = true
static

◆ throttle_counter

uint32_t throttle_counter
static

◆ throttler

Throttler throttler[kThrottlerCount]
static

◆ throttler_limit_ranges

const ThrottlerLimitRange throttler_limit_ranges[kThrottlerCount]
static
Initial value:
= {
[kThrottlerTDP] = { .min = 50, .max = 500, },
[kThrottlerFastTDC] = { .min = 50, .max = 500, },
[kThrottlerTDC] = { .min = 50, .max = 400, },
[kThrottlerThm] = { .min = 50, .max = 100, },
[kThrottlerBoardPower] = { .min = 50, .max = 600, },
[kThrottlerGDDRThm] = { .min = 50, .max = 100, },
[kThrottlerDopplerSlow] = { .min = 50, .max = 1200, },
}
@ kThrottlerTDC
Definition throttler.c:38
@ kThrottlerGDDRThm
Definition throttler.c:41
@ kThrottlerFastTDC
Definition throttler.c:37
@ kThrottlerThm
Definition throttler.c:39
@ kThrottlerTDP
Definition throttler.c:36
@ kThrottlerDopplerSlow
Definition throttler.c:42
@ kThrottlerBoardPower
Definition throttler.c:40