Skip to content

fix: honor the requested hires sampling step count - #2227

Merged
leejet merged 1 commit into
leejet:masterfrom
Project516:fix/hires-step-count
Oct 27, 2026
Merged

leejet merged 1 commit into
leejet:masterfrom
Project516:fix/hires-step-count

Conversation

@Project516

@Project516 Project516 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Trim the hires sigma schedule using the requested effective step count. Recomputing the count from the expanded schedule and denoising strength can add an extra sampling interval. For example, 2 hires steps at strength 0.5 currently run 3 steps; this change runs 2.

The existing schedule expansion, bounds clamp and custom-sigma handling remain unchanged.

Related Issue / Discussion

Fixes #2226.

Additional Information

  • Vulkan Release build succeeded.
  • Direct SD 1.5 CLI checks passed for hires step/strength pairs 1/0.5, 2/0.5, 2/0.7, 2/1.0, 4/0.4 and 7/0.35. Each resulting sigma schedule has exactly the requested number of intervals.
  • A local C++ harness exercising the source function passed 900 combinations, default-step handling and custom-sigma passthrough. The unmodified source fails the same check.
  • Test code is kept local in accordance with the contribution guidelines. Other backends were not tested.

Checklist

Summary by CodeRabbit

  • Bug Fixes
    • High-resolution generation now calculates the denoising schedule trim point from the effective number of steps. This keeps the trim point aligned with the steps used for generation, helping ensure the selected denoising strength is applied consistently. The scheduler’s step count and bounds checking remain unchanged.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e88b69f9-cc62-473d-93fd-5d6ceecdcee7
Commits

Reviewing files that changed from the base of the PR and between be48649 and 1d4fe1d.

Files selected for processing: 1
  • src/pipeline/request.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The hires sigma schedule now sets its trim index from effective_steps - 1 instead of scaling the scheduler step count by denoising strength. The scheduler step count and subsequent bounds check remain unchanged.

Changes: Hires sigma schedule

Layer / File(s) Summary
Set the hires schedule trim index
src/pipeline/request.cpp
The trim index now uses effective_steps - 1. The scheduler step count and bounds check remain unchanged.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: leejet

Merge Risk: Minimal · up to 1d4fe

The hires trim correction matches the requested interval count on established paths, with no concrete PR-introduced failure identified.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: making hires sampling honor the requested step count.
Description check Passed The description includes all required sections, explains the cause and fix, references the related issue, reports verification results, and completes the checklist.
Linked Issues check Passed Issue #2226 requires the hires pass to run the requested number of sampling steps, including strengths where the current schedule adds an extra interval. The whole-PR diff against the merge base chang…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes one line in src/pipeline/request.cpp, inside make_hires_sigma_schedule. That line is the direct cause named in #2226. The PR description states that sc…
Full details: Linked Issues check

Explanation

Issue #2226 requires the hires pass to run the requested number of sampling steps, including strengths where the current schedule adds an extra interval. The whole-PR diff against the merge base changes one line in make_hires_sigma_schedule (src/pipeline/request.cpp). The line now sets t_enc = effective_steps - 1 instead of scheduler_steps * denoising_strength. The existing trim index (scheduler_steps - t_enc - 1, as described in the issue) and the clamp against scheduler_steps are unchanged. With N intervals kept, the trimmed schedule has t_enc + 2 sigmas, which gives effective_steps intervals. Example from the issue: 2 steps at strength 0.5 gives scheduler_steps = 4, t_enc = 1, start index 2, and 3 sigmas (2 intervals). The denoising strength still sets scheduler_steps, so it still affects the starting sigma. The author reports CLI checks for six step/strength pairs and a local harness for 900 combinations. Those results are not in the repository, so they are not independently verified. The file read was truncated, so the trim line and the definition of effective_steps were checked only through the diff context and the issue text. No automated tests are included in the PR.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes one line in src/pipeline/request.cpp, inside make_hires_sigma_schedule. That line is the direct cause named in #2226. The PR description states that schedule expansion, bounds clamping, and custom-sigma handling are unchanged. The diff matches that statement. No other files are changed, and no unrelated behavior is modified.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Cppcheck (2.22.0)
src/pipeline/request.cpp

Cppcheck timed out; analysis of this file is incomplete

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

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

@leejet
leejet merged commit 9bfc4d1 into leejet:master Oct 27, 2026
11 of 12 checks passed
@Project516
Project516 deleted the fix/hires-step-count branch October 27, 2026 17:33
@vmobilis

vmobilis commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

@Project516, hello, by the way, the t_enc can now safely use int type, if I'm not mistaken.
It's used only with effective_steps and scheduler_steps, and they are the integers in range 1...max.
Therefore t_enc is now predictably in range 0...max-1, will be compared with positive integer and then casted to <int>, so probably it can simply be int.

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.

[Bug] Hires pass runs an extra step at some denoising strengths

3 participants