You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// calculatePoolUtil calculates the utilization of a ResourceSlice pool, accounting for both partitionable (shared counter) and atomic (non-partitionable) devices.
75
+
// The calculation is comprised of steps:
76
+
//
77
+
// 1. Partitionable (Shared) Utilization:
78
+
// Identifies the single highest utilization ratio across all shared counters
79
+
// in the entire pool. This ratio represents the most constrained resource within the pool.
80
+
// For example, if a GPU pool has shared counters for memory and compute cycles, and the memory's shared counter is at 80% utilization, and the compute cycles' counter is at 50%,
81
+
// the partitionable utilization for the pool would be 80%.
82
+
//
83
+
// 2. Atomic (Non-partitionable) Utilization:
84
+
// Calculated as the simple ratio of allocated devices to total devices for all devices
85
+
// that do not support shared counters.
86
+
//
87
+
// 3. Final Weighted Average:
88
+
// The result is a weighted average of the two types based on their population count in the pool.
89
+
// This ensures that in mixed pools, the fullness of one resource type doesn't disproportionately
90
+
// mask or amplify the state of the other.
91
+
//
92
+
// Example (3 total devices: 2 atomic, 1 partitionable):
93
+
// - 2 atomic allocated, partitionable at 0% util:
94
+
// Result: (1.0 * 2/3) + (0.0 * 1/3) = 66.6%
95
+
// - 0 atomic allocated, partitionable at 100% util:
96
+
// Result: (0.0 * 2/3) + (1.0 * 1/3) = 33.3%
97
+
// - 1 atomic allocated, partitionable at 50% util:
// when a pool has both atomic and partitionable devices, we sum their utilizations since they are mutually exclusive
157
+
// when a pool has both atomic and partitionable devices, we sum their utilizations since they are mutually exclusive (a partitionable device can't be allocated as an atomic device and vice versa).
0 commit comments