host: use zero-allocation wide_each_scoped in sift_front and sift_refreshes #3332

Closed
Maverick0351a wants to merge 1 commit from upstream-pr/3332 into main
Maverick0351a commented 2026-11-29 21:54:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Maverick0351a on 2026-11-29T21:54:29Z.


Summary

  • sift_front (VICTORY_FRONT_SIFT=1, on by default) and sift_refreshes (VICTORY_FLUSH_SIFT=1) currently call wide_each(sift.len(), 32, ...) when !new_batch && sift.len() >= 128.
  • Unlike wide_each_scoped, wide_each wraps the closure in an Arc<dyn Fn(usize) + Send + Sync> per dispatch, prevents borrowing stack slices directly (&self.resources, &ranges, &sift, &out) without SendPtr wrappers, and is bypassed entirely if VICTORY_NEW_BATCH=1 is set (which runs nothing_new_all single-threaded on the submitting thread and allocates a Vec<u64> per span while locking j.written).
  • Replacing wide_each + SendPtr in sift_front and sift_refreshes with wide_each_scoped(sift.len(), 32, ...) eliminates the per-flush Arc heap allocation and SendPtr boilerplate while keeping lock-free parallel WRITTEN_EPOCHS sifting across the worker pool.

Live Telemetry (RTX 5080 Laptop GPU 16 GB, GTA VI v1.0.2.1)

  • With VICTORY_FRONT_SIFT=1 and VICTORY_FLUSH_SIFT=1 using wide_each_scoped(..., 32, ...):
    • refreshes dropped from 22.9 ms/frame (35.4-37.9 ms/frame with VICTORY_NEW_BATCH=1) down to 11.9-14.2 ms/frame across 41-44 flushes of 6,728-11,196 spans (5,674-9,918 sifted out as known to copy nothing, 1,048-1,271 refreshed across worker threads).
    • Total submitting-thread preparing per frame dropped to 35.6 ms/frame (24.8 ms in the lists' steps).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5555535187 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3332). Originally posted by [Maverick0351a](https://github.com/Maverick0351a) on 2026-11-29T21:54:29Z. --- ## Summary - `sift_front` (`VICTORY_FRONT_SIFT=1`, on by default) and `sift_refreshes` (`VICTORY_FLUSH_SIFT=1`) currently call `wide_each(sift.len(), 32, ...)` when `!new_batch && sift.len() >= 128`. - Unlike `wide_each_scoped`, `wide_each` wraps the closure in an `Arc<dyn Fn(usize) + Send + Sync>` per dispatch, prevents borrowing stack slices directly (`&self.resources`, `&ranges`, `&sift`, `&out`) without `SendPtr` wrappers, and is bypassed entirely if `VICTORY_NEW_BATCH=1` is set (which runs `nothing_new_all` single-threaded on the submitting thread and allocates a `Vec<u64>` per span while locking `j.written`). - Replacing `wide_each` + `SendPtr` in `sift_front` and `sift_refreshes` with `wide_each_scoped(sift.len(), 32, ...)` eliminates the per-flush `Arc` heap allocation and `SendPtr` boilerplate while keeping lock-free parallel `WRITTEN_EPOCHS` sifting across the worker pool. ## Live Telemetry (RTX 5080 Laptop GPU 16 GB, GTA VI `v1.0.2.1`) - With `VICTORY_FRONT_SIFT=1` and `VICTORY_FLUSH_SIFT=1` using `wide_each_scoped(..., 32, ...)`: - `refreshes` dropped from `22.9 ms/frame` (`35.4-37.9 ms/frame` with `VICTORY_NEW_BATCH=1`) down to `11.9-14.2 ms/frame` across 41-44 flushes of `6,728-11,196` spans (`5,674-9,918` sifted out as `known to copy nothing`, `1,048-1,271` refreshed across worker threads). - Total submitting-thread `preparing per frame` dropped to `35.6 ms/frame` (`24.8 ms in the lists' steps`).
Maverick0351a commented 2026-11-30 21:32:05 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Maverick0351a on 2026-11-30T21:32:05Z.


Superseded by 79b22c5 and #3762 (d7f42429), which landed wide_each_scoped +
othing_new_with in sift_spans on main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7292541915 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3332#issuecomment-7292541915). Originally posted by [Maverick0351a](https://github.com/Maverick0351a) on 2026-11-30T21:32:05Z. --- Superseded by 79b22c5 and #3762 (d7f42429), which landed wide_each_scoped + othing_new_with in sift_spans on main.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!3332
No description provided.