GLM-5.3-Flash EXL3 on 2x DGX Spark with TensorFold
Python
Fix NVMe Spill Tier infinite reloading liveloop on NoRoom in GlmScheduler (patches/0088)
nanashi66ed72319c56d7
diff --git a/patches/0088-glm-spill-tier.patch b/patches/0088-glm-spill-tier.patchindex 51097ef..42aa8cd 100644--- a/patches/0088-glm-spill-tier.patch+++ b/patches/0088-glm-spill-tier.patch@@ -2421,7 +2421,7 @@ index af9769e..ce427a1 100644else:try:left = until - time.monotonic() if until is not None else 0.0-@@ -1895,9 +2405,24 @@ class GlmScheduler(Scheduler):+@@ -1895,17 +2405,33 @@ class GlmScheduler(Scheduler):if self._cancel_item(item):continuestream, box = item@@ -2442,11 +2442,20 @@ index af9769e..ce427a1 100644+ if read is not None:+ self.loading.append((read, item))+ continue-+ self.staged.discard(id(stream))self.boxes[id(stream)] = boxtry:self.decoder.admit(stream)-@@ -1912,10 +2437,20 @@ class GlmScheduler(Scheduler):++ self.staged.discard(id(stream))+ except NoRoom:+ self.boxes.pop(id(stream))+ self.held = item+ break+ except Exception as exc: # noqa: BLE001 (this request fails, the others go on)++ self.staged.discard(id(stream))+ self.boxes.pop(id(stream)).put(("error", exc))+ continue+ if stream.done:+@@ -1912,10 +2439,20 @@ class GlmScheduler(Scheduler):done.append(stream)return done@@ -2468,7 +2477,7 @@ index af9769e..ce427a1 100644returnlive = list(self.decoder.streams.values())stream = next((s for s in reversed(live) if s.background and not s.done and s.constraint is None-@@ -1956,7 +2491,10 @@ class GlmScheduler(Scheduler):+@@ -1956,7 +2493,10 @@ class GlmScheduler(Scheduler):def _iteration(self) -> None:self._cancel_waiting()self._yield()diff --git a/tools/test_queued_cancellation.py b/tools/test_queued_cancellation.pyindex f0c90e3..5e5de23 100644--- a/tools/test_queued_cancellation.py+++ b/tools/test_queued_cancellation.py@@ -162,6 +162,42 @@ def main():assert obj.held is None and not obj.decoder.admittedchecks.append("memory-held cancellation")+ # A request held by NoRoom must not repeat prestage on every retry round.+ # On stock code with discard before admit, each NoRoom re-runs prestage+ # (6 reads across 6 rounds); with deferred discard it runs exactly once.+ reads = []+ class SpillDecoder(Decoder):+ def __init__(self):+ super().__init__()+ self.can_admit = False++ def prestage(self, stream):+ reads.append(stream)+ return None++ def admit(self, stream):+ if not self.can_admit:+ raise ns["NoRoom"]("no room in KV cache")+ super().admit(stream)++ obj = scheduler()+ obj.decoder = SpillDecoder()+ thread, reply = ask(obj, lambda: False)+ for _ in range(6):+ obj._iteration()+ assert len(reads) == 1 and obj.held is not None and not obj.decoder.admitted+ obj.decoder.can_admit = True+ obj._iteration()+ assert len(reads) == 1 and obj.held is None+ stream = next(iter(obj.decoder.streams.values()))+ assert obj.decoder.admitted == [stream] and id(stream) not in obj.staged+ stream.take([2])+ stream.done = True+ obj._iteration()+ thread.join(2)+ assert not thread.is_alive() and reply.get("stats") is not None+ checks.append("repeated NoRoom does not re-prestage held request")+obj = scheduler()thread, reply = ask(obj, lambda: True)obj._admit(obj.waiting.get_nowait())