Skip to content

fix(agc): honor the requested GPU trace capacity - #20372

Open
JJenkx wants to merge 2 commits into
boykopovar:mainfrom
JJenkx:fix/agc-gpu-trace-capacity-20261114
Open

JJenkx wants to merge 2 commits into
boykopovar:mainfrom
JJenkx:fix/agc-gpu-trace-capacity-20261114

Conversation

@JJenkx

@JJenkx JJenkx commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What

Honor APS5_TRACE_EVENTS for GPU ranges using the same validated capacity parser as CPU trace buffers. Previously the GPU vector always reserved 262144 entries and used its allocation capacity as the limit, so increasing the setting still lost GPU events and reducing it was ignored. Store and enforce the requested logical limit when the capture window opens.

A Kao diagnostic motivated this change: requesting 4194304 events still lost 11257 GPU timeline ranges. This fixes capture configuration; it makes no FPS or title-unblock claim.

The Windows regression now sets its trace directory with _wputenv_s, matching the runtime’s wide environment reader. GpuRange() and its private GPU state definitions reside in the driver translation unit, so the test EXE inserts into the same DLL-owned capture state as Present(). This addresses both reported fixture failures.

Tested

Source-only refresh 2026-11-23: head 3972ceb8ad3abf229e6cf9fe7c9bccf868147464 rebased onto main b8b8f49250f3054cb450636839b4d8c9a905f7d1 as two linear commits, with no merge commits. Both patches are unchanged by git range-diff; newer upstream header declarations and summaryFile.close() are preserved. Diff/conventions checks pass. Windows (2026-11-23, verified on this exact head): RX 6700 XT, Khronos validation 1.4.309. agc_gpu_trace_capacity_small and _large pass 3/3 with the validation layer inserted in every run, 0 VUID-, nothing skipped; agc_performance_trace passes 3/3. The control (main b8b8f49250 plus only this PR's test files) fails both capacity cases 3/3 with the runtime GPU trace ignored the requested capacity. Windows result. The Linux qualification below retains its original pins.

Current-main refresh (2026-11-19): head b8f38e1c0c031c7e401464003cda724f5b394b37 is one linear commit on main aa698cdc084344c180836f3bc6fee58a4051384b. Resolved the documentation conflict while preserving main’s newer trace-digest loss explanation. Production and fixture added/removed lines are unchanged from the previous head. Same five registrations and fixture sources on both sides: the fixed-capacity control passes the CPU trace and two depth rendering tests, failing only the two capacity witnesses; the change passes all five. Control requested 1/submitted 2 retains 2, and requested 262145 retains 262144. The change retains exactly 1 with 1 lost range and all 262145 without loss. The control includes the shared SDK-owned state seam while retaining the fixed capacity, so it is main plus test instrumentation. Both arms have four calibrated-device/rendering cases with validation-layer insertion and AMD selection, zero skips or VUIDs. The two capacity cases inject synthetic ranges; the two depth cases execute rendering. Full SDK/relinker builds pass, frozen banks stay unchanged and builder source/configuration are restored. No new native-title, FPS, Windows or NVIDIA execution claim; earlier external evidence retains its original pins. Build logs, verbose CTest/JUnit, exact patches, symbol ownership and bank manifests, SHA-256 d1786f7d565ef2c398d0bf834067b85f5efbac31c80214360dd641b22d990aff (download and all payload hashes verified).

Historical qualification below retains its own source pins.

Refreshed on main 324dc5aae57113ce9ed9fa707eb2ef0814eb76dc; change 0476b63b8ae4bc58017c481306b2c1991d30f281. Same Linux AMD Radeon RX 6650 XT, RADV/Mesa 26.2.7, validation 1.4.363 (headers 335), required Vulkan and no shader cache:

  • Control 1870731ecd2d79785096a7c31db5445db8410cd9 includes identical fixtures and the state-ownership bridge, retaining main’s original capacity behavior. CPU trace and two depth GPU cases pass. Both capacity cases fail as expected: requested 1/submitted 2 retains 2; requested/submitted 262145 retains 262144. This is main plus instrumentation, not an unmodified-main executable.
  • Change passes all five cases. Small retains exactly 1 and reports exactly 1 lost GPU range; large retains all 262145 with no loss. Each GPU arm records four real-device selections and validation-layer insertions, zero skips, missing-layer diagnostics or VUIDs.
  • Full SDK/relinker and focused test builds pass for both arms. Both 835-file frozen banks remain unchanged. Capture cases inject calibrated synthetic ranges into the actual runtime; the existing depth tests execute GPU rendering.
  • Dynamic symbol inspection confirms the Linux test EXE imports GpuRange() and defines none of its GPU capture state; insertion and storage are defined by the driver.
  • Conventions pass. Official scan: 1547 open PRs. Manually reconciled self-overlap fix(agc): honor the requested GPU trace capacity #20372, fail-closed shared files perf(shader): size the result memo from host memory #12828/perf(agc): record transfers in the encoder stream without waiting #18029 and adjacent feat(agc): reuse unchanged untracked storage snapshots #13809. The latter adds a private storage-counter field beside the buffering declaration; a rebase must preserve both changes. No semantic dependency.
  • Latest source-only merge is clean (exact snapshot in the artifact). No native-title or FPS claim; Windows is confirmed on 3972ceb8ad in the 2026-11-23 result above.

Full refreshed qualification evidence, SHA-256 17de82ad5456431db72d1f480e3fe1f2939e915c9480e48c0dcfd17eeac55190. All 42 members verified after download, including source/control patches, build logs, verbose CTest/JUnit, symbol inspection, frozen-bank manifests and overlap review. Earlier Linux evidence remains in the PR history.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none (instrumentation correctness)
  • GPUs tested: AMD Radeon RX 6650 XT; RADV/Mesa 26.2.7; Arch Linux, kernel 7.2.14-arch1-1
  • AI-assisted: yes

@github-actions github-actions Bot added build agc libSceAgc* labels Nov 15, 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 — looks good

The GPU trace capacity change and all four changed files were reviewed at head 9b0be379eca36276da8cea403cc32ad387ac0fd8; the capacity is parsed and enforced consistently, and the new tests cover small and large limits.

What I ran

No build or test commands were run. I inspected the prepared diff and used the pinned repository reader for changed lines and targeted context.

Results

Check Result Note
Changed code review passed All changed files read
Build and tests not run Author reports Linux qualification; not independently verified

Findings

Blocking

None.

Non-blocking

None.

Not verified

Build and test results, including the author-reported Linux qualification, were not independently verified. Windows behavior was not verified. No files were excluded from the review; all four changed files listed in the manifest were read.

To get this to a good state

Nothing is required.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 13809 core/libs/prx/libSceAgcDriver/Execution/include/PerformanceTrace.hpp L982-983
PR 26613 docs/dev/BUILD.md L421
PR 26615 docs/dev/BUILD.md L420-421

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 1835 docs/dev/BUILD.md
PR 11435 docs/dev/BUILD.md
PR 11436 docs/dev/BUILD.md
PR 12828 core/libs/prx/libSceAgcDriver/Execution/include/PerformanceTrace.hpp
core/libs/prx/libSceAgcDriver/Execution/src/PerformanceTrace.cpp
PR 15136 docs/dev/BUILD.md
PR 15456 docs/dev/BUILD.md
PR 16793 docs/dev/BUILD.md
PR 18208 docs/dev/BUILD.md
PR 18210 docs/dev/BUILD.md
PR 19557 docs/dev/BUILD.md
PR 19610 docs/dev/BUILD.md
PR 19635 docs/dev/BUILD.md
PR 19645 docs/dev/BUILD.md
PR 19670 docs/dev/BUILD.md
PR 19720 docs/dev/BUILD.md
PR 20315 docs/dev/BUILD.md
PR 21222 docs/dev/BUILD.md
PR 21229 docs/dev/BUILD.md
PR 21939 docs/dev/BUILD.md
PR 22004 docs/dev/BUILD.md
PR 22434 docs/dev/BUILD.md
PR 22594 docs/dev/BUILD.md
PR 22647 docs/dev/BUILD.md
PR 23196 docs/dev/BUILD.md
PR 24402 docs/dev/BUILD.md
PR 26131 docs/dev/BUILD.md
PR 26173 docs/dev/BUILD.md
PR 26358 docs/dev/BUILD.md

@malekaifa

Copy link
Copy Markdown
Contributor

I reproduced two Windows-specific problems in the new regression at head 9b0be379eca36276da8cea403cc32ad387ac0fd8, applying the test-only patch and test+fix patch separately onto exact main 37cba9159c8c404d6c3af1b7e79e13f5d59c3bc4.

Machine: Windows 10.0.26200, NVIDIA GeForce RTX 5080, NVIDIA 621.14, Vulkan validation 1.4.363.

I ran the same command on both trees with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, and ANYPS5_GPU="RTX 5080":
ctest --test-dir build -R '^agc_gpu_trace_capacity_(small|large)$' -V

Both tests fail before the capacity assertion with the runtime did not write a GPU trace capture. The runtime logs that it wrote aps5-trace-*.json.gz, but the files are in the CTest working directory, not the temporary directory the test enumerates. On Windows the test sets APS5_TRACE_DIR through SDL_setenv, while TraceFile::Directory() reads _wgetenv(L"APS5_TRACE_DIR").

There is a second Windows issue after reading those misplaced captures: both contain zero gpu-capacity-probe events. nm -C shows separate PerformanceTrace::buffering, gpuRanges, gpuCapacity, and gpuLost definitions in the test EXE and libSceAgcDriver.prx. The test calls inline GpuRange() from the EXE while Present() mutates the DLL copy, so the injected ranges do not reach the capture on Windows.

The loader inserted VK_LAYER_KHRONOS_validation from SDK 1.4.363 in both runs. Neither log contains was not found but was requested or any VUID- line.

I did not verify the intended red/green capacity result because the Windows regression fixture does not reach it.

@JJenkx

JJenkx commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Fixed both issues in 0476b63b8ae4bc58017c481306b2c1991d30f281: the trace-directory setter now uses the wide CRT API, and GpuRange() plus its private GPU capture state are defined in the driver translation unit. The test EXE imports the insertion function and defines none of that state in the Linux symbol check.

Refreshed matched qualification on main 324dc5aae57113ce9ed9fa707eb2ef0814eb76dc: control has three passing tests and the two expected capacity failures; change passes all five, with four real-device/layer insertions per GPU arm and zero skips/VUIDs. Full evidence, SHA-256 17de82ad5456431db72d1f480e3fe1f2939e915c9480e48c0dcfd17eeac55190. Windows execution is still pending; I am not treating the Linux run as Windows confirmation.

AI-assisted: yes

@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 — looks good

Nothing blocks this change; the implementation uses the validated capacity parser and enforces the requested GPU range limit.

What I ran

Reviewed head 0476b63b8ae4bc58017c481306b2c1991d30f281 using the prepared diff and the pinned repo_read.py reader. No build or tests were run in this review.

Results

Check Result Note
Changed code review passed Capacity and state ownership inspected
Build and tests not run Author-reported qualification was not independently run

Findings

Blocking

None.

Non-blocking

None.

Not verified

Windows execution, console behavior, and the author-reported Linux builds and GPU test runs were not independently verified. Read all four changed files listed in the manifest: PerformanceTrace.hpp, PerformanceTrace.cpp, GpuTraceCapacity.cpp, and agc_gpu_trace_capacity_tests.cmake. The bundle's files.json was unavailable; no excluded-file inventory was verified.

To get this to a good state

Nothing is required.

@malekaifa

Copy link
Copy Markdown
Contributor

I reran the Windows arm at head 0476b63b8ae4bc58017c481306b2c1991d30f281, merged cleanly without committing onto exact current main 954f55962926205dd00d787b5ffbaea8572b2302.

Machine: Windows 10.0.26200, NVIDIA GeForce RTX 5080, NVIDIA 621.14, Vulkan validation 1.4.363. I used the same environment as my earlier run and:
ctest --test-dir build -R '^agc_gpu_trace_capacity_(small|large)$' -V

The two fixture problems I reported earlier are fixed. Both tests now write their trace into the test temp directory, and the driver-owned GPU insertion state is exercised. The resulting captures have the intended capacity behavior:

  • capacity 1: submitted 2, retained 1; summary reports gpu.events_lost=1.
  • capacity 262145: submitted 262145, retained 262145; summary has no GPU lost-event entry.

The validation layer was inserted for both runs; the combined log has 0 VUID- lines and 0 requested-layer-missing lines.

CTest is still red on Windows, though: both cases exit 0xc0000409 after the trace has been written. The captured stack reaches __wrap_main at the instruction immediately after call main; the wrapper then enters _cexit(), and the process aborts during CRT/global cleanup before its normal LibcTerminate_nid_no_patch path. I did not change code.

So the requested-capacity behavior now checks out on this Windows machine, but the Windows regression itself still does not pass because of the teardown abort.

@JJenkx

JJenkx commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the rerun. The teardown abort is the test's: it returned from main without shutting the driver down, so its threads were still running when the CRT's global cleanup started, which on Windows ends in 0xc0000409 after the checks had passed. ca97bf46c256 calls AgcDriverShutdown_nid_postfix() on every path out of main (success, skip and failure), as execution/RegistrationTrace.cpp does; the capacity checks are unchanged.

Linux 7.2.14, RX 6650 XT, RADV, Release: ctest -R "^agc_gpu_trace_capacity" --repeat until-fail:5 passes (both cases 5 of 5), and both run directly exit 0. I can't run Windows here, so I haven't confirmed that this clears the abort there. Could you rerun the Windows arm at ca97bf46c256 when you have a moment?

AI-assisted: yes

@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 — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Exact head: 83b67d71336339ec3d07337910cdcfbee4740c80, base main.
  • Read the description, commits and manifest, and the changed hunks of all five changed files in diff.patch.
  • Targeted reads at head with the repository reader:
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Execution/src/PerformanceTrace.cpp 330 400
python3 repo_read.py search ParseCapacity
python3 repo_read.py search VulkanTestSkipped
python3 repo_read.py search "cmake/agc_"
python3 repo_read.py search GpuRangeCapacity
python3 repo_read.py search "262,144"
  • Nothing was built or compiled. No test was run in this pass.
  • Approval is withheld: the hosted CI state for this head is not in the run folder, and files.json was not opened.

Results

Check Result Note
Changed hunks (5 files) passed Read through diff.patch
Window-open path passed ParseCapacity runs only when a window opens
Test registration passed Fragment is picked up by the file(GLOB) in CMakeLists.txt
Doc consistency failed BUILD.md:324 still says 262,144 ranges
Build and test runs not run No build in this pass
Hosted CI not run No CI state in the run folder

Findings

Blocking

None.

Non-blocking

  1. docs/dev/BUILD.md:314 — The new sentence says the GPU range buffer "uses the same count". The unchanged line docs/dev/BUILD.md:324 still says "The track keeps up to 262,144 ranges; more set trace_dropped", which is wrong for a windowed trace now. Changing that line to the APS5_TRACE_EVENTS count would keep the two in step.
  2. core/libs/prx/libSceAgcDriver/Execution/src/PerformanceTrace.cpp:378 — gpuRanges.reserve(gpuCapacity) allocates when the window opens. The memory paragraph at docs/dev/BUILD.md:314 only counts the slice buffers. At 4194304 the reservation is that count times sizeof(TraceGpuRange); I did not check the struct size. The doc should mention the GPU range reservation.

Not verified

  • Building libSceAgcDriver and the new agc_gpu_trace_capacity_tests executable, on Linux or Windows.
  • The author's Linux results: the 11257 lost ranges, the five-case pass, the frozen 835-file banks and the symbol inspection. These are the author's report, not runs I performed.
  • The Windows _wputenv_s branch and the DLL-owned GPU state.
  • The overlap scan and the note on #12828, #18029 and #13809.
  • Hosted CI for head 83b67d7.
  • Full text: none of the five changed files was read in full from files/. The review covers their diff hunks and the targeted head reads above. files.json was not opened.
  • Cost: GpuRange moved from the header into the .cpp, so each call is now out of line. No measurement was made.

To get this to a good state

Nothing is required.

Optional: update docs/dev/BUILD.md:324 to the APS5_TRACE_EVENTS count, and add the GPU range reservation to the memory note at docs/dev/BUILD.md:314.

@JJenkx

JJenkx commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. Both doc points are in 2ee94649b654 (docs/dev/BUILD.md only):

  • The gpu track paragraph now says the track keeps up to the APS5_TRACE_EVENTS count of ranges (262,144 by default), instead of a fixed 262,144.
  • The APS5_TRACE_EVENTS paragraph now counts the GPU range buffer as well: it is reserved once when the window opens, at 32 bytes per range (TraceGpuRange is a pointer, two doubles and a uint64_t), so 8 MiB at the default and 128 MiB at the maximum.

The test teardown change for the Windows abort (ca97bf46c256) is still waiting on a Windows rerun.

AI-assisted: yes

@domx4q

domx4q commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Ran the trace capacity tests with the Khronos validation layer on Linux and an NVIDIA GPU; the runs so far are RADV and Windows.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684, Ada, subgroup 32), proprietary driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head 2ee94649b6 merged onto main 1adc0e2f4b with --no-ff, clean merge. Main baseline is a Release build of 1adc0e2f4b on the same machine.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build -R '^(agc_gpu_trace_capacity_.*|agc_performance_trace)$' -V
main 1adc0e2f4b this PR
Result 1 of 1 passed 3 of 3 passed
Insert instance layer "VK_LAYER_KHRONOS_validation" 0 2
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

agc_gpu_trace_capacity_small and agc_gpu_trace_capacity_large are new and do not exist on main; both pass and both device selections picked the RTX 4090. agc_performance_trace creates no device and passes on both sides.

No new VUID- errors; all focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added docs needs rebase Conflicts with main, rebase needed labels Nov 17, 2026
@JJenkx
JJenkx force-pushed the fix/agc-gpu-trace-capacity-20261114 branch from 2ee9464 to b8f38e1 Compare November 19, 2026 19:44
@JJenkx

JJenkx commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Current-main refresh (2026-11-19): head b8f38e1c0c031c7e401464003cda724f5b394b37 is one linear commit on main aa698cdc084344c180836f3bc6fee58a4051384b. Resolved the documentation conflict while preserving main’s newer trace-digest loss explanation. Production and fixture added/removed lines are unchanged from the previous head. Same five registrations and fixture sources on both sides: the fixed-capacity control passes the CPU trace and two depth rendering tests, failing only the two capacity witnesses; the change passes all five. Control requested 1/submitted 2 retains 2, and requested 262145 retains 262144. The change retains exactly 1 with 1 lost range and all 262145 without loss. The control includes the shared SDK-owned state seam while retaining the fixed capacity, so it is main plus test instrumentation. Both arms have four calibrated-device/rendering cases with validation-layer insertion and AMD selection, zero skips or VUIDs. The two capacity cases inject synthetic ranges; the two depth cases execute rendering. Full SDK/relinker builds pass, frozen banks stay unchanged and builder source/configuration are restored. No new native-title, FPS, Windows or NVIDIA execution claim; earlier external evidence retains its original pins. Build logs, verbose CTest/JUnit, exact patches, symbol ownership and bank manifests, SHA-256 d1786f7d565ef2c398d0bf834067b85f5efbac31c80214360dd641b22d990aff (download and all payload hashes verified).

AI-assisted: yes

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 19, 2026
@JJenkx

JJenkx commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Windows rerun of head b8f38e1c0c, as asked on Nov 17. The teardown still fails on Windows, but the cause is now pinned down, and it is not in the change under test.

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, AMD Radeon RX 6700 XT (driver 32.0.21045.29003), ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1.

Result on the head as is (merged onto main 3def8a393a): agc_gpu_trace_capacity_small and agc_gpu_trace_capacity_large both fail in 3 of 3 runs, right after [trace] wrote ... and its line in aps5-summary.jsonl:

FATAL: C++ exception NSt10filesystem7__cxx1116filesystem_errorE raised on thread ... cannot be delivered: ... agc_gpu_trace_capacity_tests.exe+0x33cf has no unwind data

Cause: under gdb with catch throw (head merged onto main e7f9480265), the exception is thrown on the main thread from Run. The disassembly shows +0x33cf is the return address of the call to std::filesystem::remove_all(const path&), the final cleanup in GpuTraceCapacity.cpp:

    std::ifstream summaryFile(directory / "aps5-summary.jsonl");
    ...
    std::filesystem::remove_all(directory);   // summaryFile is still open here

summaryFile still holds aps5-summary.jsonl open when the directory is removed. Windows refuses to delete an open file, so remove_all throws; Linux allows it, which is why this only shows up on Windows. That cleanup runs only after every Check has passed, so the capacity behaviour itself is fine.

Fix, checked here: closing the stream before the cleanup:

    summaryFile.close();
    std::filesystem::remove_all(directory);

With only that line added (test-only, private build), both tests pass in 3 of 3 runs, none skipped, and the captures are as intended:

  • requested=1 submitted=2 retained=1, summary "gpu":{"events_lost":1,...}
  • requested=262145 submitted=262145 retained=262145

A non-throwing remove_all(directory, error) for the cleanup would also keep a leftover temp file from failing the test. I have not pushed anything to this branch.

AI-assisted: yes.

@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 — looks good

Nothing blocks this change; the inspected implementation and tests support merging.

What I ran

Reviewed head b8f38e1c0c031c7e401464003cda724f5b394b37. I read the prepared description, commits, manifest, diff, and all five changed files. I did not run commands or tests; the build and test outcomes in the PR description are author-reported.

Results

Check Result Note
Changed code review passed Capacity is parsed and enforced at window open.
Tests and builds not run Reported results were not independently verified.

Findings

Blocking

None.

Non-blocking

None.

Not verified

No tests or builds were run. Windows, native-title behavior, and the attached qualification evidence were not independently verified. All five changed files listed in the manifest were read; files.json was not available through the reader. No changed files were excluded by the manifest.

To get this to a good state

Nothing is required.

@malekaifa

Copy link
Copy Markdown
Contributor

@JJenkx Your Windows rerun has isolated the remaining red to the test cleanup, after the capacity checks pass: summaryFile still owns aps5-summary.jsonl when std::filesystem::remove_all(directory) runs, so Windows throws. Since you already verified that summaryFile.close(); before cleanup makes both capacity cases pass 3/3, please fold that test-only cleanup into the branch and rerun the Windows arm. No production behavior change looks necessary for this failure. AI-assisted: yes

@malekaifa malekaifa 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.

@JJenkx The production capacity change still looks sound, but current head b8f38e1c0c031c7e401464003cda724f5b394b37 has a confirmed Windows regression in its new test cleanup. Your Nov. 20 rerun showed both capacity assertions complete successfully, then std::filesystem::remove_all(directory) throws because summaryFile still has aps5-summary.jsonl open; adding summaryFile.close() before cleanup makes both cases pass 3/3. Please fold that test-only close into the branch and rerun the Windows capacity cases. No production behavior change is requested. AI-assisted: yes

@JJenkx

JJenkx commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Pushed 1d123d90681c, a fast-forward follow-up to reviewed b8f38e1c0c: the test now closes summaryFile immediately after reading its contents, before the final remove_all(directory). Production code and capacity assertions are unchanged.

git diff --check and tools/check_conventions.py --base origin/main pass. The prior Windows private build established that this cleanup change passes both capacity cases in three repeats; I have requested a Windows rerun of the published head and will retain the exact source/integration pins with that result. This is not a claim that the new head has already been executed on Windows.

AI-assisted: yes

@malekaifa malekaifa 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.

Verified the requested Windows test-cleanup correction on exact head 1d123d90681cdd231125ab193fc0ee219b5026da. It is a one-commit fast-forward from reviewed b8f38e1c0c and changes only GpuTraceCapacity.cpp by closing summaryFile before the final std::filesystem::remove_all(directory). That is exactly the requested fix for the confirmed Windows open-file teardown failure; production GPU-capacity behavior is unchanged. The earlier Windows reproduction reported both capacity cases passing 3/3 with this close in place. No remaining code blocker from my review. AI-assisted: yes

@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 — looks good

Nothing blocks this change; the requested GPU trace capacity is enforced and a regression test covers small and large limits.

What I ran

Reviewed head 1d123d90681cdd231125ab193fc0ee219b5026da using the prepared diff and pinned reader. No commands or tests were run.

Results

Check Result Note
Changed code review passed All five changed files read
Tests not run Author-reported results only

Findings

Blocking

None.

Non-blocking

None.

Not verified

Tests and runtime behavior were not independently executed. The author reports Linux AMD validation; Windows confirmation remains pending. Read all five files marked reviewed; no files were excluded.

To get this to a good state

Nothing is required.

@malekaifa

Copy link
Copy Markdown
Contributor

@JJenkx Exact-head review is clear, but GitHub now reports 1d123d90681cdd231125ab193fc0ee219b5026da non-mergeable against current main b8b8f49250f3054cb450636839b4d8c9a905f7d1. I checked the upstream movement from this PR's merge base: among the five PR files, only core/libs/prx/libSceAgcDriver/Execution/include/PerformanceTrace.hpp changed upstream. The other four PR files do not overlap. Please refresh the branch against current main, preserving the current upstream header additions plus this PR's reviewed changes that move GpuRange out-of-line and add the explicit GPU range capacity/state declarations. No production redesign is requested. Please keep the new summaryFile.close() test cleanup. AI-assisted: yes

@JJenkx
JJenkx force-pushed the fix/agc-gpu-trace-capacity-20261114 branch from 1d123d9 to 3972ceb Compare November 23, 2026 06:36
@JJenkx

JJenkx commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Rebased and pushed 3972ceb8ad3abf229e6cf9fe7c9bccf868147464 onto main b8b8f49250f3054cb450636839b4d8c9a905f7d1. The branch has two linear commits above main and no merge commits. git range-diff marks both reviewed patches unchanged (=): GPU capacity/state ownership and the GpuRange out-of-line definition are retained, alongside main's newer header declarations. The summaryFile.close() cleanup is retained.

git diff --check and tools/check_conventions.py --base origin/main pass. GitHub currently reports mergeable: True. This is a source-only refresh; no fresh runtime pass is claimed. The Windows worker has received the new exact head for a paired current-main/control comparison and repeated capacity checks; any already-running old-head test is being preserved with its original source pins.

AI-assisted: yes

@JJenkx

JJenkx commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Windows check of head 3972ceb8ad (exact head, one linear pair on main b8b8f49250, no merge), paired with a control. It passes, and the new test catches the bug on main.

Setup: Windows 11 Enterprise 22621, AMD Ryzen 9 5950X, AMD Radeon RX 6700 XT (driver 32.0.21045.29003), WinLibs GCC 15.2 UCRT r7, Ninja, Release, BUILD_TESTING=ON, a fresh build directory. ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer. Khronos validation layer 1.4.309 (vulkan-sdk-1.4.309.0, local build). ctest -R "^(agc_gpu_trace_capacity_(small|large)|agc_performance_trace)$" -V, three runs per arm.

  • Control: main b8b8f49250 plus only this PR's tests/GpuTraceCapacity.cpp and tests/cmake/agc_gpu_trace_capacity_tests.cmake (both files exactly as at this head; no runtime change).
  • Change: this head.
Case Control (3 runs) This head (3 runs)
agc_gpu_trace_capacity_small fails 3/3: the runtime GPU trace ignored the requested capacity passes 3/3
agc_gpu_trace_capacity_large fails 3/3: requested=262145 submitted=262145 retained=0, same message passes 3/3
agc_performance_trace (CPU trace) passes 3/3 passes 3/3

Per case, in every run of both arms:

  • Each capacity case's log has one Insert instance layer "VK_LAYER_KHRONOS_validation" line and names AMD Radeon RX 6700 XT as the selected GPU. No was not found line, no VUID- line, no Validation Error, and nothing skipped.
  • agc_performance_trace doesn't create a Vulkan instance, so it has no loader lines to check.

The teardown failure from my Nov 20 report is gone: the tests no longer abort while removing their trace directory.

AI-assisted: yes.

@malekaifa malekaifa 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.

Re-reviewed exact head 3972ceb8ad3abf229e6cf9fe7c9bccf868147464 after the current-main refresh. The conflict was limited to PerformanceTrace.hpp; the refreshed diff preserves main's newer header content plus the previously reviewed out-of-line GpuRange, explicit GPU capacity/state storage, and requested APS5_TRACE_EVENTS enforcement. The test still closes summaryFile before Windows cleanup. No new production behavior was introduced by the rebase, and GitHub reports the PR mergeable again. No remaining code blocker from my review. AI-assisted: yes

@malekaifa

Copy link
Copy Markdown
Contributor

@MarcZX10 Current exact head 3972ceb8ad3abf229e6cf9fe7c9bccf868147464 is mergeable and all hosted checks are terminal/green. The author reports both reviewed commits are unchanged by git range-diff after the current-main refresh, the Windows cleanup fix is retained, and the new paired Windows run on this exact head passes the capacity cases 3/3 while the main+test control fails 3/3 with the expected capacity witness. I have also re-reviewed this exact head with no code blocker. Could you please re-review 3972ceb8ad3a when convenient? AI-assisted: yes

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants