feat(log): a log line can be debug or trace, and the movie networks a card leaves out are trace lines #177

Merged
HumanBean merged 1 commit from HumanBean/Longshot:feat/log-levels into main 2026-11-13 12:58:38 +00:00
Owner

Why

On AMD and other cards that can't run the movie upscaler's networks, a build's details fill with a dozen vk: program … not translated: a network left out on this card lines. Those lines are expected, but players read them as errors. This gives the log levels, so the launcher can show info and above by default and keep the detail lines one click away.

What changed

  • host: hos_log_at(level, …) in host/hos_thread.c / host/hos.h (levels HOS_LOG_ERROR … HOS_LOG_TRACE). Info lines are written exactly as before. Other levels get a tag after the thread's tag: [hos host] [trace] vk: …. HOS_TRACE_CALL lines are trace.
  • renderer: logf_at(LogLevel, …) in gpu/vk/vk_main.cpp (vlogf), declared in gpu/vk/vk_internal.h. It writes the same tag at the start of the text the host logs. logf is unchanged. There is no change to MkwVkHost, so no API bump.
  • gpu/vk/vk_shader.cpp: a network left out on purpose (network_left_out) is a trace line, with a count of its own. Before, the dozen of them used up the 30 lines a real translation failure gets. Real failures stay info.
  • Moved to debug or trace (per-item lines a player can't act on): compute pipeline compiling (trace), dispatch/fallback draw left out: still compiling (debug) in vk_draw.cpp; pools mapped (vk_memory.cpp); sparse texture written / slow staging arena (vk_texture.cpp); Opus decoder (debug) and GetOpusPacketSize (trace) in nn_codec.c; recording copies let go in nvn_native.c (debug).
  • tests: new tests/test_log_levels.py compiles the host's hos_vlog and log_level_tag with host/hos.h's levels, and the renderer's vlogf, logf and logf_at, from the source. It checks every tag, the whole line an info, trace and debug call writes ([hos host] [trace] …\n, the tag after the thread's), and that the network line is trace (outside trial translations, as before) with its own count. tests/test_prepare_stall.py now also cuts out vlogf and the LogLevel enum that logf uses.
  • docs: Log levels in docs/development.md.

The launcher side, which reads the tags (level picker, search, follow at the bottom), is MagicBeanDev/LongshotLauncher: LongshotLauncher #30.

Flags and settings

None. The level is chosen in code; the log file keeps every line.

Measurements

main: c67cd4a0 (2026-11-13)
this PR: feat/log-levels @ 084481dd
Hardware: no game run (see Testing). The change writes log text only, with no new work on any frame or in the preparation.
Method: game-free checks. tests/test_log_levels.py compiles the real hos_vlog, log_level_tag, vlogf, logf and logf_at and checks the lines they write.

main @ c67cd4a0 this PR @ 084481dd
the network line [hos host] vk: program 095fca6f01e3030a not translated: a network left out on this card [hos host] [trace] vk: program 095fca6f01e3030a not translated: a network left out on this card
an info line (logf) vk: device 1 vk: device 1 (unchanged)
a real translation failure counted in the 30 lines the networks also used 30 lines of its own
PASS: the log's levels
PASS: a network left out is a trace line, counted apart from failures

Testing

Tested: python -I -B tests/run_all.py on Linux (CachyOS, clang): 466 passed, 2 failed, 69 skipped. The 2 failures are environment-only and fail on main too: test_bake_portability.py (no zstandard module here) and test_builder_log_read_only.py (no Tk). vk_main.cpp, vk_shader.cpp, vk_draw.cpp, vk_memory.cpp and vk_texture.cpp compile with the build's renderer flags (clang++ -fsyntax-only). The launcher's view of these lines was tested with a fake build in a headless window (launcher PR).

Not tested: a real preparation or a game run. This PC is NVIDIA, which doesn't print the network lines, and a full build wasn't run so as not to load the PC. hos_thread.c's hos_vlog is compiled by the check. nn_codec.c and nvn_native.c weren't compiled outside the game build (they need the generated a64_suyu.h); their change is two hos_log_at calls.

Needs other testers:

  • AMD (any): a build's details show the [trace] … a network left out on this card lines only under Trace, expecting none under Info (request to open)

Screenshots

A fake build in the launcher, on the launcher PR's branch (the game lines are this PR's format):

Info (default) Trace
Info Trace

Risk and rollback

Only lines with a tag change, so a script that matches ^\[hos \w+\] vk: on one of the lines moved to debug or trace no longer matches it. No script or check in this repository does (grepped). An older launcher or the Builders show the tag as text. Reverting the commit is enough.

Reviewer notes

Start with host/hos_thread.c (log_level_tag, hos_vlog) and gpu/vk/vk_main.cpp (vlogf). More lines can move to debug or trace in follow-ups. This PR moves only the per-item ones that were clear choices.

Issues

None.

Checklist

For everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description).
  • Rebased on current main.
  • python -I -B tests/run_all.py run and passing (any failure that also fails on main is named above).
  • Tested in the game, or what wasn't is named under Testing.
  • Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests).
  • Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (Not measured in the game: log text only, game-free checks above. See the question on the PR.)
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

If applicable

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Screenshots for a change that shows on screen.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.

🤖 Generated with Claude Code

## Why On AMD and other cards that can't run the movie upscaler's networks, a build's details fill with a dozen `vk: program … not translated: a network left out on this card` lines. Those lines are expected, but players read them as errors. This gives the log levels, so the launcher can show info and above by default and keep the detail lines one click away. ## What changed - host: `hos_log_at(level, …)` in `host/hos_thread.c` / `host/hos.h` (levels `HOS_LOG_ERROR` … `HOS_LOG_TRACE`). Info lines are written exactly as before. Other levels get a tag after the thread's tag: `[hos host] [trace] vk: …`. `HOS_TRACE_CALL` lines are trace. - renderer: `logf_at(LogLevel, …)` in `gpu/vk/vk_main.cpp` (`vlogf`), declared in `gpu/vk/vk_internal.h`. It writes the same tag at the start of the text the host logs. `logf` is unchanged. There is no change to `MkwVkHost`, so no API bump. - `gpu/vk/vk_shader.cpp`: a network left out on purpose (`network_left_out`) is a **trace** line, with a count of its own. Before, the dozen of them used up the 30 lines a real translation failure gets. Real failures stay info. - Moved to debug or trace (per-item lines a player can't act on): compute pipeline `compiling` (trace), dispatch/fallback draw `left out: still compiling` (debug) in `vk_draw.cpp`; `pools mapped` (`vk_memory.cpp`); sparse texture written / slow staging arena (`vk_texture.cpp`); Opus decoder (debug) and `GetOpusPacketSize` (trace) in `nn_codec.c`; recording copies let go in `nvn_native.c` (debug). - tests: new `tests/test_log_levels.py` compiles the host's `hos_vlog` and `log_level_tag` with `host/hos.h`'s levels, and the renderer's `vlogf`, `logf` and `logf_at`, from the source. It checks every tag, the whole line an info, trace and debug call writes (`[hos host] [trace] …\n`, the tag after the thread's), and that the network line is trace (outside trial translations, as before) with its own count. `tests/test_prepare_stall.py` now also cuts out `vlogf` and the `LogLevel` enum that `logf` uses. - docs: *Log levels* in `docs/development.md`. The launcher side, which reads the tags (level picker, search, follow at the bottom), is MagicBeanDev/LongshotLauncher: [LongshotLauncher #30](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/30). ## Flags and settings None. The level is chosen in code; the log file keeps every line. ## Measurements main: c67cd4a0 (2026-11-13) this PR: feat/log-levels @ 084481dd Hardware: no game run (see Testing). The change writes log text only, with no new work on any frame or in the preparation. Method: game-free checks. `tests/test_log_levels.py` compiles the real `hos_vlog`, `log_level_tag`, `vlogf`, `logf` and `logf_at` and checks the lines they write. | | main @ c67cd4a0 | this PR @ 084481dd | |---|---|---| | the network line | `[hos host] vk: program 095fca6f01e3030a not translated: a network left out on this card` | `[hos host] [trace] vk: program 095fca6f01e3030a not translated: a network left out on this card` | | an info line (`logf`) | `vk: device 1` | `vk: device 1` (unchanged) | | a real translation failure | counted in the 30 lines the networks also used | 30 lines of its own | ``` PASS: the log's levels PASS: a network left out is a trace line, counted apart from failures ``` ## Testing **Tested:** `python -I -B tests/run_all.py` on Linux (CachyOS, clang): 466 passed, 2 failed, 69 skipped. The 2 failures are environment-only and fail on `main` too: `test_bake_portability.py` (no `zstandard` module here) and `test_builder_log_read_only.py` (no Tk). `vk_main.cpp`, `vk_shader.cpp`, `vk_draw.cpp`, `vk_memory.cpp` and `vk_texture.cpp` compile with the build's renderer flags (`clang++ -fsyntax-only`). The launcher's view of these lines was tested with a fake build in a headless window (launcher PR). **Not tested:** a real preparation or a game run. This PC is NVIDIA, which doesn't print the network lines, and a full build wasn't run so as not to load the PC. `hos_thread.c`'s `hos_vlog` is compiled by the check. `nn_codec.c` and `nvn_native.c` weren't compiled outside the game build (they need the generated `a64_suyu.h`); their change is two `hos_log_at` calls. **Needs other testers:** - AMD (any): a build's details show the `[trace] … a network left out on this card` lines only under Trace, expecting none under Info (request to open) ## Screenshots A fake build in the launcher, on the launcher PR's branch (the game lines are this PR's format): | Info (default) | Trace | |---|---| | ![Info](https://git.magicbean.dev/attachments/13c769ea-ecbc-4843-b44d-6258fb534368) | ![Trace](https://git.magicbean.dev/attachments/083806f4-7603-4f26-bc52-c1c06ae90bc0) | ## Risk and rollback Only lines with a tag change, so a script that matches `^\[hos \w+\] vk: ` on one of the lines moved to debug or trace no longer matches it. No script or check in this repository does (grepped). An older launcher or the Builders show the tag as text. Reverting the commit is enough. ## Reviewer notes Start with `host/hos_thread.c` (`log_level_tag`, `hos_vlog`) and `gpu/vk/vk_main.cpp` (`vlogf`). More lines can move to debug or trace in follow-ups. This PR moves only the per-item ones that were clear choices. ## Issues None. ## Checklist ### For everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`). - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` run and passing (any failure that also fails on `main` is named above). - [x] Tested in the game, or what wasn't is named under Testing. - [x] Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests). - [ ] Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (Not measured in the game: log text only, game-free checks above. See the question on the PR.) - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### If applicable - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Screenshots for a change that shows on screen. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(log): a log line can be debug or trace, and the movie networks a card leaves out are trace lines
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
CI / Workflow lint (actionlint) (pull_request) Successful in 10s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Failing after 4s
084481dd7f
hos_log_at and the renderer's logf_at write a level after the thread's tag
("[hos host] [trace] vk: ..."); info lines are unchanged. The launcher's build
log reads it to show info and above. Per-program and per-decoder lines a player
can't act on are debug or trace, HOS_TRACE's calls are trace, and the networks
left out on purpose no longer use up the 30 lines a failed translation gets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

Self-review fixes: a network left out in a trial translation stays quiet as before; the check now compiles hos_vlog with hos.h's levels, so the tag's place after the thread tag is tested. Screenshots and the launcher PR link added.

Self-review fixes: a network left out in a trial translation stays quiet as before; the check now compiles hos_vlog with hos.h's levels, so the tag's place after the thread tag is tested. Screenshots and the launcher PR link added.
HumanBean changed title from WIP: feat(log): a log line can be debug or trace, and the movie networks a card leaves out are trace lines to feat(log): a log line can be debug or trace, and the movie networks a card leaves out are trace lines 2026-11-13 12:58:34 +00:00
HumanBean deleted branch feat/log-levels 2026-11-13 12:58:38 +00:00
Sign in to join this conversation.
No reviewers
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
MagicBeanDev/Longshot!177
No description provided.