Tighten fault-path comments added by the video/diffusion hardening pass

This commit is contained in:
Daniel Han 2026-07-13 17:33:01 +00:00
commit 7e1bc5cbde
7 changed files with 22 additions and 33 deletions

View file

@ -452,9 +452,8 @@ def main(argv = None) -> int:
)
t0 = time.perf_counter()
pipe = _build_pipe(repo, force_fp32)
# _build_pipe returns a CPU pipeline (the bench applies levers first, then places on CUDA).
# The ablation captures a forward directly with a CUDA generator and reads the DiT off the
# GPU below, so place the pipeline on CUDA here rather than crashing on a cpu/cuda mismatch.
# _build_pipe returns a CPU pipeline; the ablation captures a forward with a CUDA generator,
# so place it on CUDA here to avoid a cpu/cuda mismatch.
pipe = pipe.to("cuda")
print(f"[load] pipe built in {time.perf_counter()-t0:.1f}s", flush = True)

View file

@ -30,8 +30,7 @@ def timed(fn, iters = 20):
torch.cuda.synchronize()
return (time.perf_counter() - t0) / iters * 1e3
except torch.OutOfMemoryError:
# An occupied / too-small cuda:0 OOMs on the dense NxN mask; that is a memory limit,
# not a backend rejecting the mask, so don't mislabel it UNSUPPORTED.
# OOM on the dense NxN mask is a memory limit, not a backend rejecting it; don't mislabel UNSUPPORTED.
torch.cuda.empty_cache()
return "OOM"
except Exception as e: # noqa: BLE001

View file

@ -623,8 +623,8 @@ def _timed_video(
marker = getattr(transformer, "_unsloth_step_cache", None)
if not marker or str(marker).endswith(f"#s{int(steps)}"):
return "magcache" # already sized for these steps
# Fail closed like production: reapplying over a cache that would not disengage
# double-hooks the transformer and times a stale/stacked curve as if it were fresh.
# Fail closed: reapplying over a cache that would not disengage double-hooks the
# transformer and times a stale curve as if it were fresh.
if not _disengage_step_cache(
transformer,
reason = f"explicit magcache re-interpolating for {steps} steps",