[PR #3467] [MERGED] Far terrain: sample on up to 6 threads when the machine has 12 or more, behind the game #5001

Closed
opened 2026-11-03 05:09:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3467
Author: @AHHhHHHHH-H
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: pr/far-sampling-threads


📝 Commits (3)

  • 940b642 Far terrain: sample on up to 6 threads when the machine has 12 or more, behind the game
  • 584a59a Merge remote-tracking branch 'origin/main' into upd/3467
  • 5c18ae8 Drop a stray doc line after MAX_LEVEL

📊 Changes

2 files changed (+59 additions, -8 deletions)

View changed files

📝 crates/horizon-client-render/src/lod.rs (+58 -7)
📝 docs/graphics.md (+1 -1)

📄 Description

🤖 Opened by AHHhHHHHH-H's AI agent (Claude Code), not by AHHhHHHHH-H themselves.

What and why

Far terrain sampling used at most 3 threads. On a 12-thread machine a cold 1024-chunk LOD loaded in 17.4-19.4 s (5 runs); with 6 sampling threads it took 13.5-13.8 s. Alone that made the near chunks slower to appear (1.1-2.5 s against 0.9 s), so the far threads now also run horizon_threads::behind_server() like the chunk workers, and the extra in-flight sample slots only open once the nearby chunks are loaded. With both: 13.7 / 13.9 s to a full LOD and 0.9 / 0.7 s until the near chunks are ready.

Machines with 12 or more threads use min(cores / 2, 6) sampling threads; the others keep a quarter of their threads, at most 3 (unchanged for 4 or fewer). Frame time percentiles during the load were too noisy on this 2 GiB card to claim anything about them.

Tests: an assertion in the existing real-mesh test that the extra sample slots stay closed while the near terrain loads and open afterwards, and extra_sampling_threads_only_on_large_machines.

Possible overlap: #3391 and #3368 also touch far terrain loading (different code paths: decoding saved chunks and biome lookups).

Vanilla reference

Horizon-only (far terrain scheduling).

Self-check

pr_ready (tools/pr_ready.py --quick on a local machine, against origin/main at c6af85743, 3 min 9 s)

Check Result
Scope ✅ 2 files, +60 −8
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 408 passed (40 s)
rustfmt ✅ (7 s)
clippy ❌ failed (15 s)
tests: horizon-client ❌ failed (1 min 26 s)
doc tests ✅ 0 passed (40 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

On this machine (GTX 750, Rust 1.97.1) the block above shows two failures that are not caused by this change:

  • clippy stops in horizon-world (manual_range_contains, worldgen/aquifer/noise_based.rs:450), a file this PR does not touch, so horizon-client is never linted by that run. cargo clippy -p horizon-client --all-targets -- -D warnings -A clippy::manual_range_contains is clean.
  • horizon-client tests die with SIGSEGV in a different GPU test each run on the NVIDIA driver. With the software Vulkan driver (VK_DRIVER_FILES=.../lvp_icd.x86_64.json) cargo test -p horizon-client passes: 1120 lib tests + the integration tests, 0 failed.

CI is the authority; I have not run the vanilla parity harnesses (--quick).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3467 **Author:** [@AHHhHHHHH-H](https://github.com/AHHhHHHHH-H) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `pr/far-sampling-threads` --- ### 📝 Commits (3) - [`940b642`](https://github.com/horizon-rust/horizon/commit/940b642233826e35d418b8ee3c21dbdfd333564a) Far terrain: sample on up to 6 threads when the machine has 12 or more, behind the game - [`584a59a`](https://github.com/horizon-rust/horizon/commit/584a59ad8cfec7a57fe1b5d23c0030c1a287c31a) Merge remote-tracking branch 'origin/main' into upd/3467 - [`5c18ae8`](https://github.com/horizon-rust/horizon/commit/5c18ae844bddcae98f4dfc288520fcba760658e6) Drop a stray doc line after MAX_LEVEL ### 📊 Changes **2 files changed** (+59 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/lod.rs` (+58 -7) 📝 `docs/graphics.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by AHHhHHHHH-H's AI agent (Claude Code), not by AHHhHHHHH-H themselves. ## What and why Far terrain sampling used at most 3 threads. On a 12-thread machine a cold 1024-chunk LOD loaded in 17.4-19.4 s (5 runs); with 6 sampling threads it took 13.5-13.8 s. Alone that made the near chunks slower to appear (1.1-2.5 s against 0.9 s), so the far threads now also run `horizon_threads::behind_server()` like the chunk workers, and the extra in-flight sample slots only open once the nearby chunks are loaded. With both: 13.7 / 13.9 s to a full LOD and 0.9 / 0.7 s until the near chunks are ready. Machines with 12 or more threads use `min(cores / 2, 6)` sampling threads; the others keep a quarter of their threads, at most 3 (unchanged for 4 or fewer). Frame time percentiles during the load were too noisy on this 2 GiB card to claim anything about them. Tests: an assertion in the existing real-mesh test that the extra sample slots stay closed while the near terrain loads and open afterwards, and `extra_sampling_threads_only_on_large_machines`. Possible overlap: #3391 and #3368 also touch far terrain loading (different code paths: decoding saved chunks and biome lookups). ## Vanilla reference Horizon-only (far terrain scheduling). ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on a local machine, against origin/main at c6af85743, 3 min 9 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +60 −8 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 408 passed (40 s) | | rustfmt | ✅ (7 s) | | clippy | ❌ failed (15 s) | | tests: horizon-client | ❌ failed (1 min 26 s) | | doc tests | ✅ 0 passed (40 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | On this machine (GTX 750, Rust 1.97.1) the block above shows two failures that are not caused by this change: - clippy stops in `horizon-world` (`manual_range_contains`, `worldgen/aquifer/noise_based.rs:450`), a file this PR does not touch, so `horizon-client` is never linted by that run. `cargo clippy -p horizon-client --all-targets -- -D warnings -A clippy::manual_range_contains` is clean. - `horizon-client` tests die with SIGSEGV in a different GPU test each run on the NVIDIA driver. With the software Vulkan driver (`VK_DRIVER_FILES=.../lvp_icd.x86_64.json`) `cargo test -p horizon-client` passes: 1120 lib tests + the integration tests, 0 failed. CI is the authority; I have not run the vanilla parity harnesses (`--quick`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:09:30 +07:00
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5001
No description provided.