Skip to content

Commit e24cb90

Browse files
committed
v0.2.1: generic XBAR bank detection via positive-offset 127-point window, remove GB202 fallback
1 parent b355c2a commit e24cb90

1 file changed

Lines changed: 26 additions & 10 deletions

File tree

‎src/xbar5090/vf_points.py‎

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,31 @@ def detect_xbar_bank(api: NvApi, info_id: int = VF_INFO, status_id: int = VF_STA
136136
# whose first record is XBAR type 0xD. No validated-layout shortcut is
137137
# used; the scan works from the live STATUS buffer.
138138
buf = get_status(api, active, status_id=status_id)
139+
rec_base, rec_stride = _STATUS_LAYOUT or discover_status_layout(api, active, status_id=status_id)
140+
141+
# Primary generic detection: a 127-point contiguous window where every
142+
# record is XBAR type 0xD and has a positive total frequency offset.
143+
# This uniquely identifies the XBAR bank on the validated RTX 5090 and is
144+
# intended to be generic across RTX 50-series cards.
145+
if len(active) >= 127:
146+
active_set = set(active)
147+
for s in range(active[0], active[-1] - 126 + 1):
148+
ok = True
149+
for i in range(s, s + 127):
150+
if i not in active_set:
151+
ok = False
152+
break
153+
rec = rec_base + i * rec_stride
154+
if get_u32(buf, rec) != 0xD:
155+
ok = False
156+
break
157+
if i32(get_u32(buf, rec + 0x64)) <= 0:
158+
ok = False
159+
break
160+
if ok:
161+
return (s, s + 126)
162+
163+
# Fallback: look for a 127-point contiguous active range with type 0xD.
139164
ranges = []
140165
start = prev = active[0]
141166
for x in active[1:]:
@@ -145,7 +170,6 @@ def detect_xbar_bank(api: NvApi, info_id: int = VF_INFO, status_id: int = VF_STA
145170
prev = x
146171
ranges.append((start, prev))
147172

148-
rec_base, rec_stride = _STATUS_LAYOUT or discover_status_layout(api, active, status_id=status_id)
149173
candidates = []
150174
for s, e in ranges:
151175
if e - s + 1 == 127:
@@ -154,15 +178,7 @@ def detect_xbar_bank(api: NvApi, info_id: int = VF_INFO, status_id: int = VF_STA
154178
candidates.append((s, e))
155179

156180
if not candidates:
157-
profile_bank = _profile_bank()
158-
if profile_bank is not None:
159-
return profile_bank
160-
# Validated fallback for the exact GB202 648-active-flat layout.
161-
# This is not a blanket assumption: it only triggers when the live
162-
# active mask matches the known RTX 5090 layout.
163-
if len(active) == 648 and active[0] == 0 and active[-1] == 647:
164-
return (127, 253)
165-
return None
181+
return _profile_bank()
166182

167183
for s, e in candidates:
168184
if s == 127:

0 commit comments

Comments
 (0)