illustrated-cluster / src /lib /linkedFocus.ts
joeddav's picture
Publish WIP HF Space snapshot
1f77aa7
raw
history blame contribute delete
671 Bytes
export type LinkedFocus = {
source: 'transformer'
label: string
stage: number | null
tpLane: number | null
cpShard: number | null
sequenceBand: number | null
}
type FocusableGpu = {
active: boolean
stage: number
tpLane: number
cpShard: number
}
export function matchesLinkedFocus(gpu: FocusableGpu, focus: LinkedFocus | null) {
if (!focus || !gpu.active) {
return false
}
if (focus.stage !== null && gpu.stage !== focus.stage) {
return false
}
if (focus.tpLane !== null && gpu.tpLane !== focus.tpLane) {
return false
}
if (focus.cpShard !== null && gpu.cpShard !== focus.cpShard) {
return false
}
return true
}