Skip to content

fix(agc): detect AMD proprietary narrow clock - #1632

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
MarcZX10:fix/amd-proprietary-subgroup-clock
Oct 10, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
MarcZX10:fix/amd-proprietary-subgroup-clock

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1615.

What

Pass the Vulkan physical-device ID into NarrowSubgroupClock. On AMD's proprietary Vulkan driver, select the device clock only for devices with measured 20-bit subgroup clocks:

Other device IDs and driver IDs keep their existing behavior. Tests cover all three measured devices, adjacent unmatched IDs, and other driver IDs. TechnicalDebt records the measurements and the limits of what they establish.

Tested

Current head is 02005c86d27d7ffa36ce7a9c426e2e4510166b94, based on upstream main at fff9bd31852ae605ede355ad230a50321b4b4ec9.

  • Linux x86-64, GCC 12.2: built libSceAgcDriver and agc_subgroup_clock_tests; focused CTest agc_subgroup_clock passes (1/1). python3 tools/check_conventions.py --base upstream/main and git diff --check upstream/main...HEAD pass locally.
  • Windows 11 Pro 10.0.26200, RX 7800 XT (0x747e), AMD driver 32.0.31041.1004, WinLibs GCC 15.2.0 r7, Release: a contributor tested this exact head without local changes. The log reports narrowSubgroupClock=1; agc_driver_shader_clock passed 100/100 and agc_subgroup_clock passed. Full CTest reported 536 passed, 2 failed, 1 skipped (539 total): agc_driver_vopc_compare_table (agc_driver_vopc_compare_table fails in wave32 for LG compares in the e32 encoding on AMD RDNA 3.5 #825), patched_libraries (the existing Windows VideoOut duplicate-export issue Windows build fails on main: duplicate patched export name: LibwuIonIBw in libSceVideoOut (since #1339) #2462), and guest_video_out_wqhd_detection_no_vulkan skipped. The Windows run used ninja -k 0 after the unrelated patching failure. See the exact-head RX 7800 XT report. No title tested.
  • Earlier Windows hardware results for the RX 860M (0x1114) and RX 7900 XT (0x744c) are from previous heads and remain linked below; they are not current-head retests.
  • GitHub eligibility, report, and all three relinker jobs pass for this head. Conventions is currently queued. The automated PR workflow skipped full Linux and Windows Build jobs; under CONTRIBUTING, a collaborator with write access must start those. The existing approval predates the 0x744c and 0x747e additions, so those extensions still need maintainer review.

Evidence for 0x744c

On Windows 11 with an RX 7900 XT and AMD driver 32.0.31041.1004, the unmodified detector reproduced the clock wrap. The contributor's extension to 0x744c fixed the regression; an adjacent device ID and non-proprietary driver cases retained the existing behavior. Their report and test results are in the hardware report and the exact-head retest. No title testing was reported.

Evidence for 0x747e

A contributor tested the Radeon RX 7800 XT (0x747e, RDNA 3) on Windows 11 with AMD driver 32.0.31041.1004. On the reported main head 5694d3fd, agc_driver_shader_clock failed 8/8 runs with narrowSubgroupClock=0; on earlier PR head e7f2e31e, it failed 47/50. Adding 0x747e made the detector log narrowSubgroupClock=1 and the test pass 100/100. An adjacent 0x747f negative case was added and agc_subgroup_clock passed. A subsequent run on current exact head 02005c86 passed agc_driver_shader_clock 100/100 and agc_subgroup_clock; the contributor's full CTest result and unrelated failures are summarized in Tested above. See the initial hardware report and exact-head RX 7800 XT report. No title was tested.

Checklist

  • Based on current main; no other open PR implements the same detector change
  • One topic: select narrow subgroup clocks for measured AMD proprietary device IDs
  • No code comments added
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation files, or images added
  • No third-party code added
  • Generic behavior based on measured device IDs, not a title-specific special case
  • Depends on: none
  • AI-assisted: yes

@klosixgaming-arch klosixgaming-arch 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.

LGTM. Targeted fix that correctly identifies the AMD proprietary driver's 20-bit subgroup clock issue on device 0x1114 (Radeon 860M) while leaving other devices unchanged until measured. The test coverage is good - adding cases for the reported device, a neighboring device ID to verify specificity, and confirming other drivers aren't affected. Good update to TechnicalDebt documenting the measured behavior and remaining uncertainty about other AMD proprietary devices.

@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 8, 2026
@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from 12340bf to 97cc19e Compare October 8, 2026 19:38
@MarcZX10

MarcZX10 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review and approval!

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from 97cc19e to 258c85a Compare October 8, 2026 21:21
@MarcZX10

MarcZX10 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Rebased the approved change onto current upstream main (364a56b; head 258c85af). The complete five-file diff remains limited to device-ID-specific subgroup clock detection, its tests, and TechnicalDebt. Conventions and git diff --check pass; the focused test source compiles and passes directly on this head. The prior CTest run passed (1/1). No checks are reported for this head yet, and no local AMD hardware test is claimed.

@MarcZX10

MarcZX10 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

The Build/Conventions workflow runs for current head 258c85af684ff649a80819ca15dcf641f4b88adc are marked action_required and have no jobs, so upstream CI has not run yet. CONTRIBUTING requires maintainer approval for fork workflows. Could an authorized maintainer approve these current-head runs?

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from 258c85a to 85959bc Compare October 8, 2026 21:43
@MarcZX10

MarcZX10 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

The latest main merge (#533) touched TechnicalDebt.md; I rebased this PR again onto 94b1eecb and checked that both the shader min/max notes from main and the Radeon 860M note remain. Current head is 85959bc8. Conventions, git diff --check, and the directly compiled focused test pass on this head. Its Build/Conventions/Progress runs are again action_required; could a maintainer approve the current workflows?

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from 85959bc to 73f30f1 Compare October 9, 2026 00:24
@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current upstream main (f145139676a48306681d3a4d5fabf83938759daf) at head 73f30f1226ace788838ac6f404be755404a16234. Reviewed the complete five-file diff; the device-ID-specific change and TechnicalDebt evidence remain intact. The focused agc_subgroup_clock test passes (1/1), libSceAgcDriver builds, and conventions plus git diff --check pass. Upstream checks need to run on this rebased head.

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Rebased head 73f30f1226ace788838ac6f404be755404a16234 is on current upstream main (f145139676a48306681d3a4d5fabf83938759daf). The focused CTest and full library build pass locally. No checks are reported for this fork head. Under CONTRIBUTING's workflow policy, could an authorized maintainer approve Build and Conventions?

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

The fork Build for current head 73f30f1226ace788838ac6f404be755404a16234 completed successfully: Linux, Windows, and relinker jobs on Ubuntu, Windows, and macOS passed. I added the run link to the PR description. Upstream still reports no checks for this fork head.

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from 73f30f1 to 88c546c Compare October 9, 2026 08:29
@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Found and fixed the prior Conventions failure: the PR body did not fill the required Depends on field. The updated body states none, and the source conventions check passes locally. Rebased the reviewed five-file diff onto current main 6cc0503d, pushed head 88c546cd, and reran the focused agc_subgroup_clock CTest (1/1 pass). Fork Build 37905279099 is running. Could an authorized maintainer approve the exact-head upstream Conventions run if GitHub marks it action_required under the fork workflow policy?

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Latest fork Build completed with the same baseline failure on Linux and Windows: agc_shader_fusion_tests cannot include spirv/unified1/spirv.hpp from VulkanTestDevice.hpp. The relinker jobs passed. This matches #2093; I recorded the exact result in the PR description and kept this PR's scope separate.

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from 88c546c to 378c25b Compare October 9, 2026 09:22
@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Updated to current upstream main d9484c71 (head 378c25b3). The complete five-file diff is unchanged in scope; the focused subgroup-clock test was compiled and run on this head, local Conventions pass, and the exact-head upstream Conventions check is green. The earlier full Build on a prior head passed; a collaborator-triggered full Build is still required under #2113, and the previous approval is attached to the old head. Could an upstream collaborator run the Build workflow for PR #1632 and re-review this updated head?

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch 6 times, most recently from aac9313 to f4fec65 Compare October 9, 2026 10:10
@joelfernandes23

Copy link
Copy Markdown
Contributor

I reproduced #1615's clock wrap on an RX 7900 XT and tested a small extension to this PR for measured device ID 0x744c.

Environment: Windows 11 Pro 10.0.26200, Ryzen 7 7700X, 32 GB DDR5, RX 7900 XT, AMD driver 32.0.31041.1004, Vulkan 1.4.349. WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7, Release, BUILD_TESTING=ON, SPIRV-Tools OFF. ANYPS5_GPU=7900 XT and ANYPS5_REQUIRE_VULKAN=1.

On unchanged main d70b89989473ba1f6ae13e44e079e67f1f8a44b0:

Shader clock driver=1 narrowSubgroupClock=0
memtime: lane 0 went back from 1031570 to 4600

Applied your PR head f4fec653e98954de46d6fc484d676a4a6fe2a2aa to that main and added 0x744c alongside 0x1114 in the proprietary-driver check. The local extension patch changes only the detector, its existing tests and TechnicalDebt. Your prerequisite commit's authorship is preserved locally.

  • The new 0x744c regression fails without the extension and passes with it; a neighboring unmeasured ID and AMD's open-source driver retain their existing behavior.
  • agc_driver_shader_clock passed 100/100 consecutive runs with the extension (128 dispatches per run). The verbose run confirms narrowSubgroupClock=1 on the RX 7900 XT.
  • Full build and explicit libs target pass. Full CTest: 505 passed, 1 failed, 1 skipped (507 total). The remaining failure is the unchanged agc_driver_vopc_compare_table / agc_driver_vopc_compare_table fails in wave32 for LG compares in the e32 encoding on AMD RDNA 3.5 #825. The skip is guest_video_out_wqhd_detection_no_vulkan.
  • Conventions, whitespace and test-registration checks pass.

The device-clock timing approximation is recorded in TechnicalDebt. No title testing or other 0x744c boards tested.

I can share the extension patch if useful.

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the RX 7900 XT measurement and test report. I incorporated device ID 0x744c into #1632, added a positive case plus an adjacent unmatched-ID case, and updated TechnicalDebt with the evidence. The updated head is 504ac892; the focused agc_subgroup_clock test passes 1/1. Your full CTest result and the unrelated #825 failure are recorded in the PR description.

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from 504ac89 to a230723 Compare October 9, 2026 13:18
@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Rebased #1632 onto current upstream main d70b899 after the RX 7900 XT update. The new exact head is a230723. The focused agc_subgroup_clock CTest passes 1/1, Conventions and diff checks pass, and the PR now records the measured 0x744c behavior and the reported full-suite result (including its unrelated #825 failure). Under CONTRIBUTING, could an authorized collaborator run Actions → Build for this current head? The previous request was for the pre-rebase head.

@danielradosa

danielradosa commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

A data point for an unmeasured device on AMD's Windows driver: the RDNA 2 iGPU of a Ryzen 5 7600 (gfx1036, device 0x164e), driver 32.0.21045.5002, does not wrap.

Windows 11 Pro 10.0.26300, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON, ANYPS5_GPU="Radeon(TM) Graphics", ANYPS5_REQUIRE_VULKAN=1. Tree: main 0fdda7b plus #1748, which only touches libkernel, so the detector is main's.

Selected GPU name=AMD Radeon(TM) Graphics vendor=0x1002 device=0x164e subgroup=64
Shader clock driver=1 narrowSubgroupClock=0
shader clock tests passed

agc_driver_shader_clock passed 600/600 consecutive runs (128 dispatches each) on the subgroup clock. On the 860M in #1615 the same test failed 49 of 160. So on this driver the subgroup clock of 0x164e is not 20 bits, and leaving it out of the list is right for this device. The RADV wrap reported on #1615 for the Ryzen 5 7600X iGPU (also gfx1036) does not show through AMD's Windows driver here, which fits SleglJan's hw-oracle reads above: s_memtime on gfx1036 is wider than 20 bits.

AI-assisted: yes (Claude Code).

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the Windows 0x164e data point and the 600/600 run record. I added it to the PR description as a boundary measurement: it supports leaving that device unmatched, without generalizing the result to all gfx1036 hardware or AMD proprietary drivers. No detector change is needed for this device.

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from a230723 to df3efca Compare October 9, 2026 17:45
@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Rebased this PR onto current main at head df3efcae. The changed sources build into libSceAgcDriver, and agc_subgroup_clock passes 1/1; Conventions and diff checks pass. The recorded Windows hardware runs predate this rebase, so current-head Windows and the required upstream Build matrix are still outstanding.

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

The PR description now reflects current head df3efcae on main f8c2f072 and separates the current Linux checks from the pre-rebase Windows hardware evidence. It also records that the existing approval predates the 0x744c addition.

The RX 7900 XT measurement is documented in the linked report, with positive and adjacent-ID negative coverage in the current diff. Could a maintainer review the added 0x744c case and run the required Linux/Windows Build and relinker matrix against this exact head before merge?

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from df3efca to d8f4f20 Compare October 9, 2026 19:17
@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Rebased the existing PR linearly onto current main (ae3d5f95) at head d8f4f207. The complete diff remains five files. On this head, the production libSceAgcDriver and agc_subgroup_clock_tests build on Linux, and agc_subgroup_clock passes (1/1). Local and GitHub Conventions pass. The RX 7900 XT hardware report remains explicitly labeled as pre-rebase evidence, and the earlier approval predates this device-ID addition.\n\nCould a maintainer review the 0x744c case and a collaborator with write access run the required upstream Linux/Windows Build and relinker matrix on this exact head under #2113?

@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from d8f4f20 to e7f2e31 Compare October 9, 2026 19:48
@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Updated head and evidence

I rebased the existing branch linearly onto upstream main at 8b393b6e and pushed head e7f2e31e. The full five-file diff is unchanged in scope. On the rebased source, Linux libSceAgcDriver and agc_subgroup_clock_tests build, and the focused CTest passes (1/1); Conventions and git diff --check pass. The Windows hardware runs remain explicitly labeled as pre-rebase evidence, and the 0x164e negative coverage plus RDNA2 s_memtime measurements are recorded in the description.

The existing approval predates the measured 0x744c extension. Could a maintainer review that addition and, if acceptable, run Actions → Build for PR #1632 on this current head? The full upstream Linux/Windows and relinker matrix has not run for it.

@LeandroLP23

Copy link
Copy Markdown
Contributor

Tested on the device this PR names first, the Radeon 860M (RDNA 3.5, 0x1114), at the current head. Windows 11 (26300), AMD driver 32.0.13058.8001, WinLibs GCC 15.2.0 r7, Release, agc_driver_shader_clock run 100 times in a row:

Build Log agc_driver_shader_clock
main 00159cf Shader clock driver=1 narrowSubgroupClock=0 68 passed, 32 failed, e.g. memtime: lane 0 went back from 1045940 to 16475
this PR, e7f2e31e Shader clock driver=1 narrowSubgroupClock=1 100 passed

agc_subgroup_clock passes on both.

@PYTHONRETARDE

Copy link
Copy Markdown
Contributor

RX 7800 XT (device 0x747e, RDNA 3) wraps the same way and isn't covered by the current device list.

Windows 11 Pro 10.0.26200, AMD driver 32.0.31041.1004, Vulkan 1.4.349, WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7, Release, BUILD_TESTING=ON.

Build narrowSubgroupClock agc_driver_shader_clock
main 5694d3f 0 failed 8 of 8
this PR, head e7f2e31e 0 failed 47 of 50, e.g. memtime: lane 0 went back from 1029437 to 3329
this PR + 0x747e 1 passed 100 of 100

Every failure has the first read just under 2^20 (1,029,437 to 1,047,608) and the second small; the step back plus the wrap is about 22,300 cycles in every run.

The change tested, on top of e7f2e31e:

-    if (driver == VK_DRIVER_ID_AMD_PROPRIETARY && (deviceId == 0x1114u || deviceId == 0x744cu)) return true;
+    if (driver == VK_DRIVER_ID_AMD_PROPRIETARY && (deviceId == 0x1114u || deviceId == 0x744cu || deviceId == 0x747eu)) return true;

plus {VK_DRIVER_ID_AMD_PROPRIETARY, 0x747e, "AMD Radeon RX 7800 XT", true} and an adjacent 0x747f → false case in tests/SubgroupClock.cpp; agc_subgroup_clock passes. Full CTest with it: 509 passed, 1 failed, 1 skipped (511). The failure is agc_driver_vopc_compare_table / #825; the skip is guest_video_out_wqhd_detection_no_vulkan.

With 0x1114, 0x744c and now 0x747e (RDNA 3.5 and two RDNA 3 boards on the same driver) all wrapping, matching device IDs one at a time may not scale; #1615's option 2 (a GFX11 device-ID range) might be worth reconsidering. No title tested.

AI-assisted: yes (Claude Code).

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 9, 2026
@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from e7f2e31 to afae311 Compare October 9, 2026 21:51
@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

I updated the Tested section with Leandro's Radeon 860M report on the exact previous head: the main baseline failed 32/100 shader-clock runs, while this PR passed 100/100 and selected the narrow subgroup clock. The report is identified as pre-rebase evidence.

GitHub marked the PR conflicting after main advanced, so I rebased the existing branch onto 292d854e and preserved the newer RADV TechnicalDebt text together with the measured 0x1114 and 0x744c entries. Current head is afae311c; Linux driver/test build, agc_subgroup_clock (1/1), Conventions, and git diff --check pass. The PR is mergeable again.

The 100-run hardware report is still from the prior head, and the official upstream Build/relinker matrix plus maintainer review of the 0x744c addition remain outstanding.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 9, 2026
@MarcZX10
MarcZX10 force-pushed the fix/amd-proprietary-subgroup-clock branch from afae311 to 02005c8 Compare October 9, 2026 22:05
@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the RX 7800 XT measurements. I updated the existing PR with the measured 0x747e ID, an adjacent 0x747f negative case, and the TechnicalDebt evidence. The branch is rebased on fff9bd31 at 02005c86; libSceAgcDriver and agc_subgroup_clock_tests build, the focused CTest passes (1/1), and local conventions/diff checks pass. The 100/100 hardware result is recorded as the contributor’s test atop prior head e7f2e31e, not as a run of current head. I kept the selection to measured IDs rather than extending it to an unmeasured GFX11 range.

@PYTHONRETARDE

PYTHONRETARDE commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Retested exact head 02005c86 on the RX 7800 XT (0x747e), same setup as above (Windows 11 Pro 10.0.26200, AMD driver 32.0.31041.1004, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON), no local changes.

No title tested.

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up on the patched_libraries failure

Thanks for the exact-head RX 7800 XT rerun. The 100/100 agc_driver_shader_clock result on 0x747e confirms the current subgroup-clock change.

The Windows patched_libraries failure is the separate VideoOut duplicate-export issue #2462. Celegans12 opened #2473 with the two-line alias removal. Its Build eligibility, Conventions, intake, and report checks are still queued; they have not validated that PR yet.

I independently built libSceVideoOut and nid_patcher on Linux/GCC 12.2 Release, and the patched ELF contains each NID once. This does not exercise the Windows PE patcher. Once #2473's Windows Build runs, rerun patched_libraries to confirm the Windows failure is gone. The agc_driver_vopc_compare_table failure remains tracked separately as #825.

AI-assisted: yes.

oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
@oneandonlydean
oneandonlydean merged commit 9fd45aa into boykopovar:main Oct 10, 2026
9 of 11 checks passed
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
…-subgroup-clock

fix(agc): detect AMD proprietary narrow clock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

s_memtime goes backwards on AMD's Windows driver too: #1383's narrow-clock check only matches RADV

8 participants