Skip to content

fix(libkernel): omit inactive wait trace sites - #7156

Merged
oneandonlydean merged 14 commits into
boykopovar:mainfrom
Amoenus:codex/fix-wait-trace-empty-main47
Nov 4, 2026
Merged

oneandonlydean merged 14 commits into
boykopovar:mainfrom
Amoenus:codex/fix-wait-trace-empty-main47

Conversation

@Amoenus

@Amoenus Amoenus commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What

Fixes #7155. KernelTraceWait_nid_postfix resets each site's counters after reporting but copies inactive historical sites into later reports. They print x0 / avg nan ms and can occupy the eight displayed slots.

Filter zero-call sites from the temporary vector before sorting. Active zero-duration waits remain reportable. One production line; the existing collector, reporting interval and wait/wake behaviour are unchanged. No new runtime switch.

Found while tracing PPSA99902's loading stage (#3036); this corrects diagnostics and does not claim to unblock the title. The new fixture uses the existing APS5_TRACE_WAITS diagnostic and two real reporting windows. Its positive check requires an active zero-duration row, and its negative check rejects inactive x0 rows.

Tested

2 November evening refresh: d4ae221 includes main 8fa9727, with published ancestry preserved. Exact paired source pins, commands, logs, artifact hashes, advisory analysis and limits.

Full configured native-library/relinker/actual-fixture build; 0 focused physical-GPU and 1 CPU passes. Conventions/whitespace pass. Common main checks and new capability tests are distinguished in the report. Earlier controls keep their original pins. No full-suite, new Linux/title/FPS or future combined-dependency claim.

Independent GCC 16 Windows evidence: 002b909/main88e8 fails 5/5 restoring Time.cpp, passes 5/5 with the fix. This refresh rebuilds and runs the CPU wait-trace fixture.

Checklist

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4563 core/libs/prx/libkernel/CMakeLists.txt
PR 5021 core/libs/prx/libkernel/CMakeLists.txt
core/libs/prx/libkernel/Time/Time.cpp
PR 6936 core/libs/prx/libkernel/CMakeLists.txt
PR 7192 core/libs/prx/libkernel/CMakeLists.txt
PR 7804 core/libs/prx/libkernel/Time/Time.cpp
PR 9019 core/libs/prx/libkernel/CMakeLists.txt
PR 9156 core/libs/prx/libkernel/CMakeLists.txt
PR 9293 core/libs/prx/libkernel/CMakeLists.txt
PR 9297 core/libs/prx/libkernel/CMakeLists.txt
PR 9302 core/libs/prx/libkernel/CMakeLists.txt
PR 9383 core/libs/prx/libkernel/CMakeLists.txt
PR 9389 core/libs/prx/libkernel/CMakeLists.txt
PR 9557 core/libs/prx/libkernel/CMakeLists.txt
PR 9566 core/libs/prx/libkernel/CMakeLists.txt
PR 9938 core/libs/prx/libkernel/CMakeLists.txt
PR 11831 core/libs/prx/libkernel/CMakeLists.txt
PR 11896 core/libs/prx/libkernel/CMakeLists.txt
PR 11939 core/libs/prx/libkernel/CMakeLists.txt
PR 12130 core/libs/prx/libkernel/Time/Time.cpp
PR 12544 core/libs/prx/libkernel/CMakeLists.txt
PR 12642 core/libs/prx/libkernel/Time/Time.cpp
PR 12682 core/libs/prx/libkernel/CMakeLists.txt
PR 12688 core/libs/prx/libkernel/CMakeLists.txt
PR 12700 core/libs/prx/libkernel/CMakeLists.txt
PR 12965 core/libs/prx/libkernel/CMakeLists.txt
PR 12970 core/libs/prx/libkernel/CMakeLists.txt
PR 14264 core/libs/prx/libkernel/CMakeLists.txt
PR 14299 core/libs/prx/libkernel/CMakeLists.txt

@github-actions github-actions Bot added the fix error Closes an issue (Fixes #N) label Oct 17, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the current diff. The zero-call filter is applied only to the temporary report vector, so it removes stale inactive sites without changing stored counters and still retains active waits whose measured duration is zero. I found no correctness issue in this change; the documented focused regression and platform runs cover the reported behavior.

@Amoenus
Amoenus force-pushed the codex/fix-wait-trace-empty-main47 branch from e655149 to d5e18b3 Compare October 24, 2026 08:58
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@Dextroid17

Copy link
Copy Markdown
Contributor

Linux run on the current head, since the 2026-10-24 main refresh in the PR description notes that no new Linux run is claimed for that rebase.

Head d5e18b308 merged onto main 29f539a5f. CachyOS, kernel 7.3.0, GCC 16.2.1, Release, clean environment. Each arm is ctest -R '^guest_wait_trace$' three times, rebuilt before each arm.

PR merged on main                   3/3 pass
Time.cpp set to main, test kept     3/3 fail  (Regex=[wait_trace_inactive[^|]*x0])
restored, rebuilt                   3/3 pass

In the failing arm the second [waits] line fills its eight slots with wait_trace_active_zero x1 and seven sites from the first window (six wait_trace_inactive and wait_trace_active), all x0 ... (avg -nan ms, max 0 ms, ... tid 0). With the filter, that line holds wait_trace_active_zero x1 alone. The only difference between the arms is the one std::erase_if line.

AI-assisted: yes

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 847378a merged onto main 291e02d · tested 2026-11-01 15:49 UTC · 28 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 3,095 passed · 15 failed (0 new, 13 also fail on main, 2 unstable on main) · 58 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Vulkan validation ✅ no new validation IDs vs main (1246 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.2 s, ⚠️ agc_driver_graphics 111.8 s, ⚠️ agc_driver_graphics_maps_fallback 108.0 s, ⚠️ agc_driver_bda_device 59.4 s, ⚠️ agc_driver_lazy_resolved_abi_switch_set 37.6 s
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_array_layer_target_cpu: failed in 1 of the last 4 main runs
agc_driver_pipeline_journal: failed in 3 of the last 4 main runs
Failing on main too (13, not counted against this PR)
agc_driver_guest_memory_lifetime_direct
agc_driver_image_table
agc_driver_job_manager_compute_capacity
agc_driver_native_depth_bda_clear
agc_driver_native_depth_buffer_clear
agc_driver_native_depth_clears
agc_driver_native_multisample_depth
agc_driver_submit_progress
agc_idle_publish_wait
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Validated but not compared (6, not in the main baseline's validation pass)
agc_pipeline_binary_store
agc_pipeline_binary_vulkan
agc_pipeline_cache_allocation_incomplete
agc_pipeline_cache_allocation_periodic
agc_pipeline_cache_allocation_same-size
shader_scan
Validation IDs already present on main (5 IDs in 717 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (717 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, and 709 more
VUID-vkCmdCopyImage-srcImage-01548 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_storage_dispatch, and 3 more
VUID-vkCmdCopyImage-srcImage-01551 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_storage_dispatch, and 3 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
VUID-VkShaderModuleCreateInfo-pCode-08737 (1 test): agc_driver_image_sample_derivatives
Skipped (58)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_copied_writer_label_order_drain: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_image_table_vouched_lookups: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a watched imported table cannot be vouched for
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_driver_unit_shadow_budget: skipped, the device does not import watched host memory for unit shadows
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_pipeline_binary_vulkan: skipped, the device lacks VK_KHR_pipeline_binary
agc_shadowed_key_stores: skipped, the device imports no watched host memory under a unit shadow
agc_small_tiled_shadow_label: skipped, host imports are unavailable: the test block is not imported and watched
agc_storage_clear_hand_over: skipped, the device imports no watched host memory for the clear-key hand-over
agc_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipp
Reproduce
git fetch origin 847378af047a3d6da1537efe30d378bffeff1941 291e02d4877784d03d346962af51713b9df63b91
git checkout 291e02d4877784d03d346962af51713b9df63b91 && git merge --no-ff 847378af047a3d6da1537efe30d378bffeff1941
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@bunbeans2-arch

Copy link
Copy Markdown
Contributor

A Windows run with GCC 16: Windows 10.0.22631 (Windows 11), i9-9900K, MSYS2 UCRT64 GCC 16.1.0 (Rev5), Release, this PR (002b909f7b) merged into main 88e804b0a7.

Repro for #7155: this PR's guest_wait_trace, which records 1 wait on one active site and on 8 inactive ones, then reads the [waits] report.

  • ❌ Before: same tree with only Time.cpp put back to main. It failed in 5 of 5 runs. The report listed sites with 0 waits and NaN averages, e.g. wait_trace_inactive ... x0 0.0s (avg nan ms, max 0 ms, 0 timeouts, tid 0), as the issue reports.
  • ✅ After: with this PR it passed 5 of 5.

The wait report no longer lists sites with no waits and NaN averages, as #7155 asks 👍

AI-assisted: yes (Claude Code)

@oneandonlydean
oneandonlydean merged commit 5924ecf into boykopovar:main Nov 4, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build fix error Closes an issue (Fixes #N) libkernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libkernel: wait tracing reports inactive sites with NaN averages

7 participants