feat(agc): support unnormalized MC coordinate precision #20891
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20891"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-15T17:38:16Z.
What
Earlier review follow-up
e181aaff2ebe: MC_COORD_TRUNC combined with texel offsets now throws until native offset/quantization ordering is measured, with 24 compiler regression cases. Existing offset-free MC coverage is preserved.A proven unnormalized sampler using MC_COORD_TRUNC currently throws. Direct 1D/2D samples now apply the measured coordinate transform: 8 fractional bits with ties-even rounding, or floor with TRUNC_COORD, followed by half-texel truncation for bilinear MC. Clamp modes 0, 1, 2, 3 and 6 are supported. Negative mirrored point indices map to exact texel centers; linear mirroring uses the reflected quantized coordinate. Large finite coordinates avoid scaling overflow.
The existing sampler-transform specialization word carries MC/TRUNC/effective-mag-filter state. Converted filtering and min/max reduction retain explicit refusals. Normalized MC precision remains unimplemented. Native evidence is local RX 6650 XT gfx1032, not PS5 gfx1013 equivalence: 240 initialized procedural RGBA8 dispatches and 5,632 prospective vector checks across ties, both axes, border and mirrored coordinates. Unmeasured formats, 1D native behavior and other gaps are recorded in debt.
Native measurement inputs, kernels and prospective checks, mirror-composition evidence. Structural shader fixtures follow bounded identity-copy chains while retaining their coordinate, arithmetic, dimension, LOD and NoContraction assertions.
Tested
Precision-boundary regression qualification (2026-11-23), public head
d226a8de67d6.Added the four coordinate pairs proposed by @Helldiverr in the R9700 follow-up:
1 - 3/1024,0.5 - 3/1024,1 - 3/2048, and0.5 - 3/2048, each as{x, x}. All 128 original points and the1e-4tolerance stay intact; successful MC runs now report the actual 132-pair count. Production code is unchanged.Same byte-identical fixture source and 41 physical Vulkan cases on RX 6650 XT/RADV Mesa 26.3.1, Linux 7.3.5, with required Vulkan, no shader caches and Khronos validation 1.4.363:
d795f93238fdplus test-only fixture/registration changes (f8823873c4b8)0f9ee68369a5)493f1a8c6f41)fde9b61c5a89)Every 7-bit failure reaches a newly added point (lane 128 or later), closing the original coverage gap. TRUNC cases deliberately remain insensitive to precision. Physical device and actual layer insertion are checked in every process; zero skips, VUIDs or synchronization-hazard identifiers. Frozen banks remain unchanged, builder source/configuration restored. These are focused builds, not new complete SDK/native-title or CPU shader-suite qualifications.
A separate direct native gfx1032 2D unnormalized-MC probe measures the four new points over five clamp modes, both filters and both TRUNC settings: 20 configurations, 40 dispatches, with repeated lanes and dispatches agreeing. Raw samples match predictions saved before execution for the 8-bit model (maximum absolute component error
1.1102826e-08). Both 7-bit and 9-bit models differ above1e-4in all 10 non-TRUNC native configurations. This extends local RX 6650 XT evidence; it does not establish PS5 gfx1013, native 1D or tie-rule equivalence. Native HSA does not use Vulkan validation.Helldiverr independently reports Windows 11 Pro 26300, AMD Radeon AI PRO R9700/gfx1201, driver 32.0.31044.16, GCC 15.2 Release and Khronos 1.4.363: head
e181aaff2emerged onto maindfe428e798as24e377815d, 41/41 in three runs with per-process validation insertion and zero VUIDs. The same report's private four-point extension passes and makes both precision mutations fail all 20 non-TRUNC cases. Those are contributor-reported Windows results; the native gfx1201 sweep was not completed. The existing1e-4bound is retained.Source bundles/patches, exact pins, builds, raw verbose CTest/JUnit, prospective predictions, native raw samples/kernels and independent review, SHA256
ae44471f0d36170245a74e35d4a5056b56e3c256399900b437c03e24e1cf20b3; uploaded archive downloaded and all 107 manifest payloads verified. Local conventions checks pass with zero errors and the existing debt-length warning. No title, FPS/speedup or console-equivalence claim.Earlier 2026-11-23 review correction: public head
e181aaff2ebe, privately integrated onto maind795f93238fdasb387b4aca5e2. The prior961d429793d8plus the new CPU witness fails as expected; current main and the fixed integration pass the shader-memory suite, including all 24 new cases on the integration. Same GPU fixture source/registrations on both arms: main plus probe-only instrumentation has one ordinary pass and 40 expected MC refusals; fixed integration passes all 41. RX6650XT/RADV, required Vulkan/no shader cache, validation1.4.363: 41 physical selections and layer insertions per arm, zero skips/VUIDs, frozen banks unchanged, builder restored. Conventions: zero errors, existing debt-length warnings. No new title/FPS/console-equivalence/Windows claim. Full qualification evidence, SHA256f18d913292cbe61ce26e855f8d48a4f4361584804e74c0bfc3bfd0d4067fcc88(download and all34 payload hashes verified). Integration merge is private; published branch remains a linear follow-up.Historical qualifications below retain their original source pins.
Refreshed without merge commits onto measured main
0694c4cbd6f2. Upstream advanced to1ac29cd4105bduring qualification; fresh local merge-tree checks are clean against that tip. The newer main was not rebuilt in this run; the measured pins below are unchanged. Main's non-MC mirror-once-border (clamp 7) support and minimum-0.5 mirrored coordinate fold are retained; MC clamp 7 remains explicitly unsupported in the descriptor proof. The refreshed production transform selects the existing non-MC fold independently from the measured MC fold.Linux, RX 6650 XT / RADV Mesa 26.2.7, kernel 7.2.14-arch1-1, GCC 16.2.1. Validation layer 1.4.363 (headers 1.4.335),
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, CTest verbose, frozen independent binaries/libraries. No skips or VUIDs in any current arm; logs confirm layer insertion. Main's own five focused checks pass.Current source pins, exact patches, configure/build/full test logs, JUnit and binary hashes. Archive SHA-256
a210aa8dfade7211557d739429fb475803f0a17dd92292769345000011f689a9, downloaded archive and all 54 payload hashes verified. These are focused-target builds and regression runs, not a new full-SDK or native-game qualification. No new Windows/macOS, title-unblock or performance claim. The physical Windows worker remains user-paused. Changed-file convention checks report zero errors, with one debt-length warning. The global debt-fold command encounters an unchanged main NKWebKit fragment selector error, recorded separately in the bundle.Exact refreshed head
edce8b2bc190d4847a4b0d6c7d7d663e337aad13:0694c4cThe negative-control dynamic library path and raw AGC hash are checked; all failures match the expected unsupported cases. Candidate CPU shader fixtures remain candidate-compiled in that identical-executable comparison; the separate five-check main arm uses main's own build. The GPU matrix contains 40 weighted MC configurations with 128 coordinate pairs each, scalar 1D and 2D, both filters and TRUNC values. Existing non-MC unnormalized sampling, including mirror-border, remains covered.
Both full CPU shader-memory tests pass with SPIRV-Tools ON (included above) and OFF (2/2). The identity-copy fix is retained; no assertion is relaxed to accept different arithmetic or a bypassed offset.
Historical broader matched full-SDK qualification remains available in 47-case original validation; those archived pins are historical, not the new heads above.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T02:19:28Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the inspected implementation and reported validation support merging.
What I ran
Reviewed head
961d429793d81b04a59f41192e9de70a09ba72bbusing the prepared diff andrepo_read.py. No commands or tests were run in this session; validation details in the PR description are author-reported.Results
ShaderMemory.cppfull text was excluded as too large.Findings
Blocking
None identified in the changed code read.
Non-blocking
None.
Not verified
The full
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas excluded and only its diff hunks were inspected, so this review does not establish that file's complete behavior. No tests were run independently. Native behavior on PS5 gfx1013, other GPUs, and unmeasured formats and sampling modes remains unverified; the PR description explicitly limits its evidence to local RX 6650 XT gfx1032 measurements.Files read:
GuestSamplerResource.cpp,GuestSamplerResource.cpptests,ImageSampleUnnormalized.cpp,agc_driver_image_sample_mc_coord_trunc_tests.cmake,DescriptorBindingBuilder.cpp,SpirvImageEmitter.cpp,agc-unnormalized-mc-coord-trunc.md, plusdescription.md,commits.md,manifest.jsonanddiff.patch. Excluded: fullShaderMemory.cpp(too large for the review folder).Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T05:04:49Z.
Review: CHANGES_REQUESTED
The offset-free MC matrix passes on Windows/Ada, but one newly accepted combination still needs to preserve the old refusal or gain native evidence.
SamplerUseOffsetis allowed throughProveUnnormalized, while this PR's hardware oracle and all 40 MC fixtures exclude offsets. The emitter folds the integer offset into the f32 coordinate before MC quantization. That ordering is observable: with TRUNC_COORD=1, coordinate-2^-26, and offset+1, add-first rounds to1.0and selects texel 1, while quantize-first produces255/256and selects texel 0. Before this PR every unnormalized MC case was refused.Please reject MC+offset in the new MC gate and add a refusal regression, or provide native edge measurements and a runtime test for the ordering. The successful 3×41 RTX 4070 run does not exercise offsets and therefore does not resolve this point.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T06:28:26Z.
Review: APPROVED
Re-reviewed exact head
e181aaff2ebe3506883265e5cd47de8dd7b4a9b7. This resolves my offset-ordering request:ProveUnnormalizednow rejects every live MC sampler that hasSamplerUseOffsetbefore MC specialization/emission, while leaving the measured offset-free path unchanged.The regression grid covers both TRUNC values, constant and lane-dynamic offsets, and all six offset sample forms (24 refusal cases) with the specific diagnostic. The author also supplied an independent fixed-integration CPU-suite and RX 6650 XT/RADV result in the review thread. I did not execute
agc_shader_memorylocally on this revision; my earlier 3×41 RTX 4070 matrix remains evidence only for the byte-identical offset-free GPU path. Hosted checks on this published head are still running and remain a separate merge gate.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T06:44:00Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected implementation has no verified blocking defect, but the full review is incomplete because
ShaderMemory.cppwas excluded and no checks were run.What I ran
Inspected the prepared diff and targeted source at head
e181aaff2ebe3506883265e5cd47de8dd7b4a9b7using therepo_read.pyreader. No tests or builds were run.Results
ShaderMemory.cppexcludedFindings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas excluded because it was too large for the review folder. No tests, build, or runtime behavior were independently verified; the qualification claims in the description are author-reported.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T14:43:01Z.
Review: COMMENTED
Non-blocking follow-up on exact head
e181aaff2ebe3506883265e5cd47de8dd7b4a9b7; my approval remains.I independently reproduced the reported mutation-coverage gap with a CPU model using the exact 128 coordinates from this Git tree, f32 rounding, the actual 40 RGBA8 modes, and the
1e-4comparison. The checked-in matrix detects 0/40 modes for a 7-bit quantizer and 4/40 for a 9-bit quantizer; the intended 8-bit model remains 0/40.The proposed hardening can be reduced to two diagonal pairs without losing coverage:
{1 - 3/1024, 1 - 3/1024}and{1 - 3/2048, 1 - 3/2048}make the 7-/8-/9-bit models fail 20/0/20 modes, spanning point and linear filtering, 1D and 2D, and every clamp in this fixture. Because the point boundary at1.0is also a half-grid boundary for linear filtering, the two analogous0.5 - ...pairs add mutant detections but no new configuration category here. The smallest maximum channel error among a detected mode is about 0.07255, so this does not argue for tightening the tolerance.I recommend adding those two pairs in this PR or a test-only follow-up. I do not make it a blocker: the 8-bit behavior already has native gfx1032 evidence, the new gfx1201 run supports the implementation, and this is regression sensitivity rather than a contradictory result. I did not perform a new build or GPU run for this CPU-model check.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T15:01:06Z.
Review: APPROVED
Re-reviewed exact head
d226a8de67d6c8948d1469f091f3f4b11fee30f2. The previously approved implementation and MC+offset refusal are unchanged; this head only adds the four reported precision-boundary coordinate pairs and makes the success count dynamic.My independent f32 CPU model using the exact fixture modes confirms the new matrix distinguishes the intended precision: the 7-bit and 9-bit quantizer mutations each fail all 20
TRUNC_COORD=0modes, while the intended 8-bit model fails none.git diff --checkpasses.I did not run a new build or GPU test. The Radeon gfx1201 41/41 run with these four added coordinates is from the contributor's report and is not counted as mine. Hosted checks for this head are pending. Within that scope, the test-coverage gap is resolved and my approval now applies to the exact head above.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T09:19:49Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation documents its measurement limits and retains refusals for unmeasured paths.
What I ran
Reviewed head
d226a8de67d6c8948d1469f091f3f4b11fee30f2from the prepared diff and targeted source reads. No tests were run.repo_read.pywas used to inspect the review bundle and selected source ranges.Results
ShaderMemory.cppwas read only around changed hunksFindings
Blocking
None.
Non-blocking
None.
Not verified
Read:
GuestSamplerResource.cpp,GuestSamplerResourcetests,ShaderMemory.cppchanged-hunk ranges, the new CMake test registration,ImageSampleUnnormalized.cpp,DescriptorBindingBuilder.cpp,SpirvImageEmitter.cpp, and the new debt entry, plus the description, commits, manifest, and diff.ShaderMemory.cppwas excluded from the bundle because it was too large; only the changed-hunk ranges were read. No test execution, build, or independent hardware measurement was performed. The reported RX 6650 XT and contributor Windows qualifications are author-reported, not run in this review.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:18:19Z.
Review: COMMENTED
The trial merge onto
a1b75b0947was clean. I also attempted a composition with exact #20944, which conflicts inImageSampleUnnormalized.cppand theMC_COORD_TRUNCdebt fragment. Please preserve this PR’s truncation and ties-even boundary cases when the two branches land together. The shared transform is gated to the proven unnormalized direct cases, so the normalized and unsupported controls still matter. Paired shader-memory and sampling controls are pending.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.