Skip to content

prefetch: guard against no offload (CORE-149)#13703

Merged
comfyanonymous merged 1 commit intoComfy-Org:masterfrom
rattus128:prs/urgent/ltx-full-load-prefetch-crahser
May 4, 2026
Merged

prefetch: guard against no offload (CORE-149)#13703
comfyanonymous merged 1 commit intoComfy-Org:masterfrom
rattus128:prs/urgent/ltx-full-load-prefetch-crahser

Conversation

@rattus128
Copy link
Copy Markdown
Contributor

(Urgent) crasher fix for LTX2.3 on RTX5090 or greater.

Example test conditions:

RTX5090, linux LTX2.3 FP8

image

Before:

  File "/home/rattus/ComfyUI/comfy/ldm/lightricks/av_model.py", line 1067, in forward
    return super().forward(
           ^^^^^^^^^^^^^^^^
  File "/home/rattus/ComfyUI/comfy/ldm/lightricks/model.py", line 879, in forward
    return comfy.patcher_extension.WrapperExecutor.new_class_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rattus/ComfyUI/comfy/patcher_extension.py", line 112, in execute
    return self.original(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rattus/ComfyUI/comfy/ldm/lightricks/model.py", line 932, in _forward
    x = self._process_transformer_blocks(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rattus/ComfyUI/comfy/ldm/lightricks/av_model.py", line 915, in _process_transformer_blocks
    comfy.model_prefetch.prefetch_queue_pop(prefetch_queue, vx.device, block)
  File "/home/rattus/ComfyUI/comfy/model_prefetch.py", line 40, in prefetch_queue_pop
    offload_stream.wait_stream(comfy.model_management.current_stream(device))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'wait_stream'

After:

Model VideoVAE prepared for dynamic VRAM loading. 1384MB Staged. 0 patches attached.
Prompt executed in 23.79 seconds

cast_ will return no stream if there is no work to do. guard against
this is the consume logic.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cc2b855b-8ac1-4dcd-931e-5842c3f48265

📥 Commits

Reviewing files that changed from the base of the PR and between f3ea976 and 85d7141.

📒 Files selected for processing (1)
  • comfy/model_prefetch.py

📝 Walkthrough

Walkthrough

The pull request modifies prefetch_queue_pop() in comfy/model_prefetch.py to conditionally execute the offload_stream.wait_stream() call only when offload_stream is not None. Previously, this call was made unconditionally after consuming a queue entry. The guard prevents the function from attempting to wait on a missing stream. The remainder of the consumed-entry cleanup flow, including unpacking prefetch_state and conditionally calling cleanup_prefetched_modules(), remains unchanged.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'prefetch: guard against no offload' directly describes the main change: adding a guard to handle cases where offload_stream is None, which is exactly what the changeset accomplishes.
Description check ✅ Passed The description is directly related to the changeset, providing context about the bug (AttributeError when offload_stream is None), reproducing conditions, and the fix's effectiveness.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@comfyanonymous comfyanonymous merged commit c47633f into Comfy-Org:master May 4, 2026
14 checks passed
@alexisrolland alexisrolland changed the title prefetch: guard against no offload prefetch: guard against no offload (CORE-149) May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants