[pr-fix][dlss][frame-generation][NVIDIA] Reflex markers: RENDER_SUBMIT_START carries the frame the lists were submitted in #283

Open
iBooM72 wants to merge 1 commit from iboom72/fix/reflex-submit-marker-frame into main AGit
Contributor

What it changes

  • The problem on main: read from the code only (crates/darner-gpu/src/streamline.rs, render_submit_begin, since c88549fc).

render_submit_begin takes the marker's frame id from queue::presented() + 1 at the moment it is called. The line (queue::behind, on with the relay and thin lists, so in a default NVIDIA start) calls it when it runs a submission, and that can be after the title has presented the frame: the title may be one present ahead (DARNER_SUBMIT_FRAMES, 1 by default). Frame N's last submissions then set RENDER_SUBMIT_START for frame N + 1, possibly before that frame's SIMULATION_START, and N + 1's own first submission sets none, because the id only moves forward. The other markers of a frame already carry the title's frame: the simulation markers are set on the title's thread, and RENDER_SUBMIT_END and the present markers take the frame that goes with the present job.

c88549fc changed this id from the host's present count to queue::presented() + 1 so that all markers of a frame id are one title frame's. That holds where lists run at once and not where the line runs them later.

What this does: the frame is read on the title's thread when the lists are submitted (behind::submit) and goes with the job (Job::Lists, Job::Run, Job::Joined; a joined job keeps its first submission's frame). render_submit_begin(frame) takes it as an argument. The six callers in queue.rs that run lists at once pass presented() + 1, the value they got before.

What it affects: NVIDIA's latency statistics (PCL) and the order of a frame's markers. Reflex's sleep is sent with use_markers_to_optimize: false. Whether DLSS frame generation reads this marker is not known to me.

How it was tested

  • Tested revision: c782a6e2
  • Commands and results:
    • cargo test -p darner-gpu --lib --locked queue::behind: passed (9 tests). They drive the line with a stand-in job, so they show only that the line still builds and orders as before, not the frame that goes with a job.
    • cargo test -p darner-gpu --lib --locked streamline: passed (62 tests). None of them sets a marker.
    • cargo clippy -p darner-gpu --all-targets --locked -- -D warnings: passed.
  • Changes a default: no
  • Gates run on that revision (the three in AGENTS.md; there is no CI): cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: both passed. cargo test --workspace --locked was not run as a whole. Only the two filters above were run of darner-gpu's tests.
  • Gameplay, when relevant: not run.
  • Hardware dependence: NVIDIA cards with Streamline's PCL on; untested.
  • Coverage gaps: no new test: the change passes a value along and no test here can see a marker (they go to Streamline). Not run in the game, so the markers' order was not looked at in NVIDIA's overlay or a capture. Read, not run: a submission the line runs after its frame's present sets no marker, because present_begins has moved the marker's count to that frame by then. The held parts that queue.rs runs later without the line still read the count when they run, as before.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Not run in the game: I have no way here to read the PCL markers a run sends.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #159 (merged; added the markers; c88549fc after its review made the frame id queue::presented() + 1). Open pull requests found that change the same files: #222, #168, #143, #48, #47 (streamline.rs) and #93 (queue/behind.rs); none of their diffs touches render_submit_begin or the line's jobs. None found for queue.rs.
  • Replaces or overlaps: none found

🤖 Generated with Claude Code

## What it changes - The problem on main: read from the code only (`crates/darner-gpu/src/streamline.rs`, `render_submit_begin`, since c88549fc). `render_submit_begin` takes the marker's frame id from `queue::presented() + 1` at the moment it is called. The line (`queue::behind`, on with the relay and thin lists, so in a default NVIDIA start) calls it when it runs a submission, and that can be after the title has presented the frame: the title may be one present ahead (`DARNER_SUBMIT_FRAMES`, 1 by default). Frame N's last submissions then set `RENDER_SUBMIT_START` for frame N + 1, possibly before that frame's `SIMULATION_START`, and N + 1's own first submission sets none, because the id only moves forward. The other markers of a frame already carry the title's frame: the simulation markers are set on the title's thread, and `RENDER_SUBMIT_END` and the present markers take the frame that goes with the present job. c88549fc changed this id from the host's present count to `queue::presented() + 1` so that all markers of a frame id are one title frame's. That holds where lists run at once and not where the line runs them later. What this does: the frame is read on the title's thread when the lists are submitted (`behind::submit`) and goes with the job (`Job::Lists`, `Job::Run`, `Job::Joined`; a joined job keeps its first submission's frame). `render_submit_begin(frame)` takes it as an argument. The six callers in `queue.rs` that run lists at once pass `presented() + 1`, the value they got before. What it affects: NVIDIA's latency statistics (PCL) and the order of a frame's markers. Reflex's sleep is sent with `use_markers_to_optimize: false`. Whether DLSS frame generation reads this marker is not known to me. ## How it was tested - Tested revision: c782a6e2 - Commands and results: - `cargo test -p darner-gpu --lib --locked queue::behind`: passed (9 tests). They drive the line with a stand-in job, so they show only that the line still builds and orders as before, not the frame that goes with a job. - `cargo test -p darner-gpu --lib --locked streamline`: passed (62 tests). None of them sets a marker. - `cargo clippy -p darner-gpu --all-targets --locked -- -D warnings`: passed. - Changes a default: no - Gates run on that revision (the three in AGENTS.md; there is no CI): `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features`: both passed. `cargo test --workspace --locked` was not run as a whole. Only the two filters above were run of `darner-gpu`'s tests. - Gameplay, when relevant: not run. - Hardware dependence: NVIDIA cards with Streamline's PCL on; untested. - Coverage gaps: no new test: the change passes a value along and no test here can see a marker (they go to Streamline). Not run in the game, so the markers' order was not looked at in NVIDIA's overlay or a capture. Read, not run: a submission the line runs after its frame's present sets no marker, because `present_begins` has moved the marker's count to that frame by then. The held parts that `queue.rs` runs later without the line still read the count when they run, as before. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none Not run in the game: I have no way here to read the PCL markers a run sends. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #159 (merged; added the markers; c88549fc after its review made the frame id `queue::presented() + 1`). Open pull requests found that change the same files: #222, #168, #143, #48, #47 (`streamline.rs`) and #93 (`queue/behind.rs`); none of their diffs touches `render_submit_begin` or the line's jobs. None found for `queue.rs`. - Replaces or overlaps: none found 🤖 Generated with [Claude Code](https://claude.com/claude-code)
render_submit_begin took the frame id from queue::presented() + 1 when it was
called (c88549fc). The line (queue::behind, on with the relay and thin lists)
calls it when it runs a submission, which can be after the title has presented
that frame: frame N's last submissions then set the marker of frame N + 1,
before that frame's own simulation markers, and N + 1's first submission set
none. The other markers already carry the title's frame.

The frame is now read on the title's thread when the lists are submitted and
goes with the job (Lists, Run, Joined). The paths that run lists at once pass
the same value as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
First-time contributor

Independent Windows build, gate, and code-read review of c782a6e21 (based on main f3840d73d). Not run in-game or with live Reflex/PCL capture.

Environment

  • Windows 11 Pro 26H2 (build 26300.10075), Intel Core i9-14900K, NVIDIA RTX A2000 12GB (driver 621.47), Rust 1.98.1 (x86_64-pc-windows-msvc), MSVC 19.44.35230.

Measured results

  • Gate 1 (cargo clippy --workspace --all-targets --locked -- -D warnings): PASS
  • Gate 2 (cargo clippy --workspace --all-targets --all-features --locked -- -D warnings): PASS
  • cargo xtask policy: PASS (asset policy: 555 files ok)
  • cargo test --locked -p darner-gpu --lib queue: PASS (63 passed; 0 failed in 1.21 s)
  • cargo test --locked -p darner-gpu --lib streamline: PASS (62 passed; 0 failed in 0.04 s)

Code-read audit

  • behind::submit (crates/darner-gpu/src/queue/behind.rs:1085-1108) captures presented().wrapping_add(1) on the title thread at submission time and carries it through Job::Lists, Job::unfold -> jobs_of, Job::Run, and Job::Joined (preserving the first submission's frame in take_along), passing it to streamline::render_submit_begin(frame) in Job::go.
  • Consistent with frame::wait (frame.rs:318), queue::present (queue.rs:1395-1398), and streamline::present_begins (streamline.rs:3138). render_submit_begin remains guarded by pcl_active() and monotonic advance_frame(&RENDER_SUBMIT_FRAME, frame).
  • On the presenting queue, Job::Present blocks take_along (behind.rs:808), so Job::Joined never merges across a present boundary there; all 6 direct callers in queue.rs (216, 224, 297, 507, 516, 889) pass presented().wrapping_add(1).
  • Minor non-blocking notes:
    1. As noted in the PR description, the non-behind Held::Run path (queue.rs:507, 516) still reads presented() + 1 at release time rather than enqueue time (same as main).
    2. Pre-existing cross-queue ordering edge case (also on main): if a non-presenting queue runs a frame N + 1 submission while the presenting queue is still blocked on frame N, monotonic RENDER_SUBMIT_FRAME advances to N + 1 and present_begins(N) emits RENDER_SUBMIT_END(N) without RENDER_SUBMIT_START(N).

Verdict: PASS.

AI-assisted: yes (Gemini 4 Neon).

Independent Windows build, gate, and code-read review of `c782a6e21` (based on `main` `f3840d73d`). Not run in-game or with live Reflex/PCL capture. ### Environment - Windows 11 Pro 26H2 (build 26300.10075), Intel Core i9-14900K, NVIDIA RTX A2000 12GB (driver 621.47), Rust 1.98.1 (`x86_64-pc-windows-msvc`), MSVC 19.44.35230. ### Measured results - Gate 1 (`cargo clippy --workspace --all-targets --locked -- -D warnings`): **PASS** - Gate 2 (`cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`): **PASS** - `cargo xtask policy`: **PASS** (`asset policy: 555 files ok`) - `cargo test --locked -p darner-gpu --lib queue`: **PASS** (`63 passed; 0 failed` in 1.21 s) - `cargo test --locked -p darner-gpu --lib streamline`: **PASS** (`62 passed; 0 failed` in 0.04 s) ### Code-read audit - `behind::submit` (`crates/darner-gpu/src/queue/behind.rs:1085-1108`) captures `presented().wrapping_add(1)` on the title thread at submission time and carries it through `Job::Lists`, `Job::unfold` -> `jobs_of`, `Job::Run`, and `Job::Joined` (preserving the first submission's frame in `take_along`), passing it to `streamline::render_submit_begin(frame)` in `Job::go`. - Consistent with `frame::wait` (`frame.rs:318`), `queue::present` (`queue.rs:1395-1398`), and `streamline::present_begins` (`streamline.rs:3138`). `render_submit_begin` remains guarded by `pcl_active()` and monotonic `advance_frame(&RENDER_SUBMIT_FRAME, frame)`. - On the presenting queue, `Job::Present` blocks `take_along` (`behind.rs:808`), so `Job::Joined` never merges across a present boundary there; all 6 direct callers in `queue.rs` (`216, 224, 297, 507, 516, 889`) pass `presented().wrapping_add(1)`. - Minor non-blocking notes: 1. As noted in the PR description, the non-behind `Held::Run` path (`queue.rs:507, 516`) still reads `presented() + 1` at release time rather than enqueue time (same as `main`). 2. Pre-existing cross-queue ordering edge case (also on `main`): if a non-presenting queue runs a frame `N + 1` submission while the presenting queue is still blocked on frame `N`, monotonic `RENDER_SUBMIT_FRAME` advances to `N + 1` and `present_begins(N)` emits `RENDER_SUBMIT_END(N)` without `RENDER_SUBMIT_START(N)`. **Verdict:** PASS. AI-assisted: yes (Gemini 4 Neon).
Author
Contributor

Follow-up to "How it was tested": the description says cargo test --workspace --locked was not run as a whole. It has now been run, together with five other small pull requests of mine, on one local branch.

  • Tested revision: main f3840d73 with these six commits picked on top, no conflicts: 98a3c911 (#265), 5799f84a (#270), c782a6e2 (#283), e69c0f77 (#284), 1c142d36 (#285), 5eae3d19 (#286). Not run on this pull request's branch alone.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: passed.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed.
  • cargo test --workspace --locked: one test failed, in darner-shader: emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders ("DXIL validation failed ... Not all elements of output SV_Depth were written"). The same test fails the same way on main f3840d73 without these commits, none of the six changes darner-shader, and #227 (open) fixes it. darner-shader's other tests: 557 passed, 16 ignored.
  • Cargo stops at the first package that fails, so the rest was run with cargo test --workspace --locked --no-fail-fast --exclude darner-shader: passed, all packages and the doc tests (darner-gpu: 1,773 passed, 81 ignored).

Still not run in the game.

Follow-up to "How it was tested": the description says `cargo test --workspace --locked` was not run as a whole. It has now been run, together with five other small pull requests of mine, on one local branch. - Tested revision: `main` f3840d73 with these six commits picked on top, no conflicts: 98a3c911 (#265), 5799f84a (#270), c782a6e2 (#283), e69c0f77 (#284), 1c142d36 (#285), 5eae3d19 (#286). Not run on this pull request's branch alone. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed. - `cargo test --workspace --locked`: one test failed, in `darner-shader`: `emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders` ("DXIL validation failed ... Not all elements of output SV_Depth were written"). The same test fails the same way on `main` f3840d73 without these commits, none of the six changes `darner-shader`, and #227 (open) fixes it. `darner-shader`'s other tests: 557 passed, 16 ignored. - Cargo stops at the first package that fails, so the rest was run with `cargo test --workspace --locked --no-fail-fast --exclude darner-shader`: passed, all packages and the doc tests (`darner-gpu`: 1,773 passed, 81 ignored). Still not run in the game.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/283/head:iboom72/fix/reflex-submit-marker-frame'
git switch 'iboom72/fix/reflex-submit-marker-frame'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'iboom72/fix/reflex-submit-marker-frame'
git switch 'iboom72/fix/reflex-submit-marker-frame'
git rebase 'main'
git switch 'main'
git merge --ff-only 'iboom72/fix/reflex-submit-marker-frame'
git switch 'iboom72/fix/reflex-submit-marker-frame'
git rebase 'main'
git switch 'main'
git merge --no-ff 'iboom72/fix/reflex-submit-marker-frame'
git switch 'main'
git merge --squash 'iboom72/fix/reflex-submit-marker-frame'
git switch 'main'
git merge --ff-only 'iboom72/fix/reflex-submit-marker-frame'
git switch 'main'
git merge 'iboom72/fix/reflex-submit-marker-frame'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!283
No description provided.