Repository navigation
Conversation
|
@PrivacyOnion @MarcZX10 Exact head |
|
Update 2026-11-27, head Update 2026-11-26 20:11Z: fixed. Head This head does not compile with WinLibs GCC 15.2.0 (Windows, merged onto The PR adds AI-assisted (Claude Code). |
|
Fixed the reported Windows compile failure on new head |
|
@PrivacyOnion @MarcZX10 Superseding my earlier handoff: current exact head is |
|
Local exact-head validation update for
This validates the regression coverage and specifically proves the final target-option propagation is required. I still do not claim a physical run on the affected AMD proprietary driver/version; that exact driver is not available on this workstation. AI-assisted: yes |
|
Test report, NVIDIA on Windows, head
Single run of the full set. AI-assisted (Claude Code). |
|
The emission is gated to AMD proprietary 2.0.331 mesh shaders and the cache key bit is there, and other vendors' output is unchanged. Two things before this can go in:
|
|
@oneandonlydean Your second point is valid. I traced |
|
@oneandonlydean @Plyxen The early- The software rendezvous is now enabled only when every guest Regression coverage now uses a dynamic VCC branch (
Negative control: I rebuilt after removing only the final I still do not claim the decisive physical affected-driver run. @Plyxen, the offered PPSA85300 test on AMD proprietary 24.30.36 / Vulkan driver 2.0.331 remains the requested target-driver validation for this revised head. AI-assisted: yes |
|
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.
|
|
@malekaifa @oneandonlydean before going back to 2.0.331 I checked Setup: Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7, Release.
Local diagnostic patch (not for merging)--- a/core/libs/prx/libSceAgcDriver/Execution/include/SubgroupBarrier.hpp
+++ b/core/libs/prx/libSceAgcDriver/Execution/include/SubgroupBarrier.hpp
@@ -3,6 +3,7 @@
#include <vulkan/vulkan.h>
#include <cstdint>
+#include <cstdlib>
@@ -23,7 +24,7 @@
inline bool MeshSoftwareControlBarriersRequired(VkDriverId driver, std::uint32_t driverVersion) {
- return driver == VK_DRIVER_ID_AMD_PROPRIETARY && driverVersion == VK_MAKE_API_VERSION(0, 2, 0, 331);
+ return (driver == VK_DRIVER_ID_AMD_PROPRIETARY && driverVersion == VK_MAKE_API_VERSION(0, 2, 0, 331)) || std::getenv("APS5_TMP_FORCE_MESH_SW") != nullptr;
}
--- a/core/shader/recompiler/Recompiler.cpp
+++ b/core/shader/recompiler/Recompiler.cpp
@@ -916,7 +916,8 @@ CompiledVariant emitVariant(const RecompileRequest& request, IrProgram& program)
- targetOptions.meshSoftwareControlBarriers = request.target.meshSoftwareControlBarriers && program.Metadata().meshSoftwareControlBarriersSafe;
+ targetOptions.meshSoftwareControlBarriers = request.target.meshSoftwareControlBarriers && (program.Metadata().meshSoftwareControlBarriersSafe || std::getenv("APS5_TMP_IGNORE_SAFE") != nullptr);
+ if (request.target.meshSoftwareControlBarriers && std::getenv("APS5_TMP_DUMP_SPV") != nullptr) std::fprintf(stderr, "[tmp-mesh-sw] program 0x%llx safe=%d software=%d\n", static_cast<unsigned long long>(request.shader.codeAddress), program.Metadata().meshSoftwareControlBarriersSafe ? 1 : 0, targetOptions.meshSoftwareControlBarriers ? 1 : 0);
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
@@ -610,6 +610,11 @@
const auto words = demoted.empty() ? shader.spirv.Words() : std::span<const std::uint32_t>(demoted);
+ if (const char* dumpDir = std::getenv("APS5_TMP_DUMP_SPV")) {
+ static std::atomic<unsigned> dumped{0};
+ const auto name = std::string(dumpDir) + "/stage" + std::to_string(static_cast<unsigned>(VulkanStage(shaders[i].stage))) + "_" + std::to_string(words.size() * 4) + "_" + std::to_string(dumped++) + ".spv";
+ if (FILE* file = std::fopen(name.c_str(), "wb")) { std::fwrite(words.data(), 4, words.size(), file); std::fclose(file); }
+ }
_modules[i] = CreateShaderModule(context, words.data(), words.size() * sizeof(std::uint32_t), "vkCreateShaderModule graphics");AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
Nothing blocks this change; the focused build and test were not run locally, so I cannot recommend a formal approval from the inspected evidence.
What I ran
Reviewed head 98ab2ac89f1277e934fee980f78c02974f79d0f1 using the prepared diff and repo_read.py at the pinned head. No build or test command was run. The description reports that local target generation was blocked by the workstation's GCC toolchain; that report was not independently verified.
Results
| Check | Result | Note |
|---|---|---|
| Patch and targeted source review | passed | Inspected the barrier path and related setup |
| Focused build and tests | not run | Not executed during this review |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The runtime behavior on AMD proprietary Vulkan 2.0.331 hardware, the local build limitation reported in the PR description, and hosted CI results were not verified. Read the prepared description, commits, manifest, and diff, plus SubgroupBarrier.hpp, VulkanDevice.cpp around the target setting, the focused test, and the changed recompiler and SPIR-V emitter ranges. The manifest identifies VulkanDevice.cpp as excluded from the prepared full-text files; its relevant range was read through repo_read.py. Other changed files were not read in full, and files.json was unavailable.
To get this to a good state
Nothing is required.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — comments
Nothing blocks this change; the focused build and test were not run in this review, so the evidence does not support approval.
What I ran
Reviewed head 21cbd40d51ab208239f03c0d8e6d9524d0647261 using the pinned repo_read.py reader. No build, tests, or precheck commands were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed code review | passed | Reviewed all changed lines |
| Build and focused tests | not run | Author reports a local toolchain gate |
| Prechecks | not run | Not run in this review |
Findings
Blocking
None.
Non-blocking
The software rendezvous and its safety gate have focused regression coverage in the diff, but that coverage was not executed in this review.
Not verified
The actual AMD proprietary Vulkan 2.0.331 driver behavior and hosted CI results were not independently verified. All 14 changed files were reviewed at their changed lines, including VulkanDevice.cpp through the reader; no changed file was excluded from review. The full text of VulkanDevice.cpp was omitted from the prepared review folder because of its size.
To get this to a good state
Nothing is required. Optional: run the focused agc_subgroup_barrier_tests on a supported toolchain and confirm the hosted CI results before merge.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
Changes are required before merge: fix mesh software barrier participation so every rendezvous counts the same invocations that can reach it.
What I ran
Reviewed head 17f4499db4deb9184a2457fc0f1091926094edb6 using the prepared diff and repo_read.py; no tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | failed | Barrier participant count can diverge |
| Tests | not run | Author reports hosted CI validation |
Findings
Blocking
core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp:1464: the rendezvous uses the configured workgroup local size as its participant count, but the safety gate only checks that each barrier dominates every return (core/shader/recompiler/Recompiler.cpp:203). That does not ensure all invocations take the same barrier path. For example, a shader with a conditional barrier and no returns is marked safe even if some invocations skip it; the participating invocations then wait forever for tickets from invocations that never arrive. Require a proof that each barrier is reached uniformly by the whole workgroup, or retain the normal barrier path for unproven cases.
Non-blocking
None.
Sources
Behavior claims above are based on the changed barrier gate and rendezvous implementation at the reviewed head.
Not verified
No tests or builds were run. The prepared bundle excludes the full text of core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp; its changed target-setting line was inspected in the pinned repository reader. Other changed files were included in the bundle and inspected as relevant.
To get this to a good state
Prove that every invocation reaches each software barrier uniformly, or disable the workaround for shaders where that cannot be established; then run the focused regression tests.
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — comments
The driver quirk and software rendezvous are covered by focused tests, but this review could not confirm that the mesh barrier safety analysis handles every control-flow shape that may occur in shaders.
What I ran
Reviewed head 9b8bc33643ba24fab6fabef09f113f4dedac7bf0. No build or tests were run by me; the description reports the local build was blocked by the toolchain and hosted CI is the validation for this head.
Results
| Check | Result | Note |
|---|---|---|
| Source review | passed | Changed implementation and tests inspected |
| Build and tests | not run | Local toolchain gate reported |
| Console behavior | not run | No hardware validation reported |
Findings
Blocking
None.
Non-blocking
- The barrier safety predicate checks each barrier's reachability and excludes barriers inside natural loops, but the reviewed code does not establish that all reachable loop/control-flow shapes are represented by those checks. Consider documenting the CFG invariants that make this sufficient and adding tests for nested loops, irreducible/bypass paths, and multiple sequential barriers. The workaround fails closed only for cases detected by this analysis. (
core/shader/recompiler/Recompiler.cpp:201)
Not verified
- The full
VulkanDevice.cppwas excluded from the prepared files because it was too large; the changed target-selection line was inspected in the diff and its surrounding code through the pinned reader. - No build, test command, CI result, or AMD console behavior was independently verified. The description reports the local build could not proceed due to the workstation toolchain.
- Read the prepared description, commits, manifest, diff, and all included changed source/test files.
files.jsonwas not available as a review-folder document; the file listing recordsVulkanDevice.cppas excluded for size. No generated or distribution files were listed as changed.
To get this to a good state
Nothing is required. Optional: add explicit coverage or rationale for the CFG cases noted above.
|
@malekaifa Plyxen's run on 98ab2ac showed VLC's mesh program is marked unsafe: its 4 barriers sit in one selection construct, so there is a path to the return that skips them. The gate on 9b8bc33 also rejects any such path, so from reading the code (I have not rerun it) VLC still gets the native barriers on 2.0.331 and would crash as before. The gate needs to admit that program, for example by proving the branch condition is the same across the workgroup. After that, please get a run of the rendezvous (forcing it on with a local patch on a newer driver is enough for a first check, as Plyxen did), then PPSA85300 on 24.30.36. |
…orm-rendezvous-20261128 # Conflicts: # core/shader/recompiler/tests/SpannedUniformityTests.cpp
|
Addressed in the updated head: the CFG-only eligibility gate is replaced by a fail-closed analysis of the native SPIR-V barrier sites. It admits the workgroup-uniform WorkgroupID plus push-constant-addressed storage-buffer fixture, while divergent branch/switch bypasses and barriers nested in divergent loops retain the native path. The software rendezvous also reconverges the release/non-release arms before the acquire loop and excludes the final ticket from the wait ballot. Validation is recorded in the PR description: 7/7 focused CTest, 8/8 Vulkan 1.3 SPIR-V validation, and the mesh runtime suite on an RTX 5080 (including a temporary forced-software-path run). The AMD proprietary 2.0.331 driver remains unavailable here. |
|
@malekaifa I'll run this on my Radeon (gfx1036, Windows) tomorrow morning. First the current head on the driver I have now (2.0.353), to see whether VLC's mesh program passes the new gate, with the software rendezvous forced on. Then I'll roll the driver back to 24.30.36 and run PPSA85300. I'll post both results here. AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head eab01438422ae432a59d0c262e326384a070275e using the prepared diff and repo_read.py for targeted source ranges. No shell commands or tests were run; author-reported test results were not independently verified.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | Inspected all 13 changed-file hunks |
| Focused tests | not run | Results in the description are author-reported |
| Exact target driver | not run | AMD Vulkan 2.0.331 was unavailable |
Negative control
Not run; no tests were executed in this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
- The workaround gate matches the AMD proprietary driver and exact version, and the option is carried through the cache key and emitter state: SubgroupBarrier.hpp, CacheKey.hpp, SpirvEmitter.cpp.
- The software barrier uses workgroup arrival and generation counters, and mesh entry initializes them before guest code: SpirvFlowEmitter.cpp, SpirvModuleEmitter.cpp.
Not verified
The focused build, CTest, SPIR-V validation, hardware runs, and exact AMD Vulkan 2.0.331 behavior were not independently verified. I inspected the changed hunks for all 13 changed files and targeted source ranges for the relevant gate, cache propagation, emitter, subgroup, initialization, and documentation. VulkanDevice.cpp full text was excluded from the prepared bundle; its changed range was read through repo_read.py.
To get this to a good state
Nothing is required. Optional: validate the workaround on AMD proprietary Vulkan driver 2.0.331 when available.
|
@malekaifa @oneandonlydean I ran Setup: Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7, Release. Radeon gfx1036 iGPU ( AMD 26.11.2, Vulkan driver 2.0.353 (target bit forced on)
The device loss I saw on AMD 24.30.36, Vulkan driver 2.0.331 (target bit set by the driver check)
While VLC sat with no frame, one thread used 4.4 s of CPU in 5 s. gdb puts it in The other 17 focused tests pass on 2.0.331 with the exact head: Validation: So on 2.0.331 this trades the null-read crash for a pipeline that never compiles, and it breaks three mesh tests that pass without the workaround. I don't know which part of the rendezvous the old compiler can't handle: the loop on an atomic load, the ballot inside it, or the four copies. This machine is the only 2.0.331 I have. Local diagnostic patch (not for merging)--- a/core/libs/prx/libSceAgcDriver/Execution/include/SubgroupBarrier.hpp
+++ b/core/libs/prx/libSceAgcDriver/Execution/include/SubgroupBarrier.hpp
@@ -3,6 +3,7 @@
#include <vulkan/vulkan.h>
#include <cstdint>
+#include <cstdlib>
@@ -26,7 +27,7 @@
inline bool MeshSoftwareControlBarriersRequired(VkDriverId driver, std::uint32_t driverVersion) {
- return driver == VK_DRIVER_ID_AMD_PROPRIETARY && driverVersion == VK_MAKE_API_VERSION(0, 2, 0, 331);
+ return (driver == VK_DRIVER_ID_AMD_PROPRIETARY && driverVersion == VK_MAKE_API_VERSION(0, 2, 0, 331)) || std::getenv("APS5_TMP_FORCE_MESH_SW") != nullptr;
}
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
@@ -902,6 +902,11 @@
const auto words = patched.empty() ? shader.spirv.Words() : std::span<const std::uint32_t>(patched);
+ if (const char* dumpDir = std::getenv("APS5_TMP_DUMP_SPV")) {
+ static std::atomic<unsigned> dumped{0};
+ const auto name = std::string(dumpDir) + "/stage" + std::to_string(static_cast<unsigned>(VulkanStage(shaders[i].stage))) + "_" + std::to_string(words.size() * 4) + "_" + std::to_string(dumped++) + ".spv";
+ if (FILE* file = std::fopen(name.c_str(), "wb")) { std::fwrite(words.data(), 4, words.size(), file); std::fclose(file); }
+ }
_modules[i] = CreateShaderModule(context, words.data(), words.size() * sizeof(std::uint32_t), "vkCreateShaderModule graphics");
--- a/core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp
+++ b/core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp
@@ -266,7 +266,11 @@
const auto nativeWords = Emit(program, inputInfo, bindings, nativeTarget, info);
- if (SpannedBarrierInDivergentFlow(nativeWords)) return nativeWords;
+ const auto tmpReason = SpannedBarrierInDivergentFlow(nativeWords);
+ const bool tmpDivergent = tmpReason.has_value();
+ const bool tmpIgnore = std::getenv("APS5_TMP_IGNORE_SAFE") != nullptr;
+ if (std::getenv("APS5_TMP_DUMP_SPV") != nullptr) std::fprintf(stderr, "[tmp-mesh-sw] hash=0x%llx divergent=%d software=%d reason=%s\n", static_cast<unsigned long long>(program.Resources().shaderHash), tmpDivergent ? 1 : 0, tmpDivergent && !tmpIgnore ? 0 : 1, tmpDivergent ? tmpReason->c_str() : "-");
+ if (tmpDivergent && !tmpIgnore) return nativeWords;AI-assisted: yes (Claude Code) |
|
Thanks — this is decisive target-driver evidence. On 2.0.331 the workaround is selected, but the AMD pipeline compiler does not complete: it eventually returns VK_ERROR_OUT_OF_HOST_MEMORY, VLC produces no frame, and three mesh tests regress. The forced path works on 2.0.353, so this is now a driver-version-specific compiler compatibility failure, not a general SPIR-V validity failure. I agree this head is not merge-ready as a fix for 2.0.331. Could you attach the exact mesh-stage SPIR-V emitted for the failing 2.0.331 VLC pipeline (plus SHA-256 and byte size), and the corresponding 2.0.353 module if it differs? The 52,720-byte / four-rendezvous module is the key isolation target. Please keep the local diagnostic patch off the branch. I will keep the PR open and investigate a reduced emission shape (one rendezvous vs four; subgroup ballot in the acquire loop vs no ballot) before proposing another code change. |
|
@malekaifa Here are the mesh modules from my The 2.0.331 module and the forced 2.0.353 module are byte-identical, so there's only one software module to isolate:
Each block below is the module gzipped and base64-encoded. Save a block as
|
|
Tested
GPU (software Vulkan): 5 GPU tests (AGC, shader recompiler, Vulkan) passed twice on Mesa lavapipe (Mesa 25.2.8-0ubuntu0.24.04.5 (LLVM 20.1.2)) on a GitHub-hosted Ubuntu 24.04 runner, with the Khronos validation layer on and the shader cache off, alongside main Not covered: GPU hardware. lavapipe runs Vulkan on the CPU, so this says nothing about how real GPU drivers handle the changed paths. AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports. |
|
I independently unpacked the two SPIR-V modules attached in Plyxen's 2026-11-30 report, verified their exact sizes and SHA-256 hashes, and ran spirv-val --target-env vulkan1.3 from Vulkan SDK 1.4.363.0. Both modules pass structural validation. Disassembly counts (software vs native-barrier control):
The four EmitMeshSoftwareBarrier expansions account exactly for the deltas: each adds two atomic increments, two atomic loads, two subgroup-any ballot reductions, and one polling loop. This makes the added atomic/ballot polling control flow a concrete candidate for the 2.0.331 compiler failure. It is a hypothesis, not a proven root cause. For the next diagnostic-only target run, please compare (a) replacing the release-side subgroup-any lowering with OpGroupNonUniformAny while retaining the wait-loop reduction, (b) doing the same only for the wait-loop reduction, and (c) both together, if GroupNonUniformVote is supported. A one-rendezvous versus four-rendezvous compile-time comparison would also show whether the compiler failure scales with the barrier expansion. Please capture exact module hashes, compile time, pipeline result, and functional output on both 2.0.331 and 2.0.353. No variant is being proposed as a merge-ready fix. The 2.0.331 pipeline failure remains unresolved; SPIR-V validation and lavapipe do not establish target-driver success. PR remains not merge-ready for that driver. |
|
One more useful isolation detail from the emitter source: EmitHostSubgroupAny currently lowers each reduction to OpGroupNonUniformBallot, four OpCompositeExtracts, an OR reduction, and an OpINotEqual. It is called twice per EmitMeshSoftwareBarrier expansion. That matches the eight extra ballot instructions exactly. A low-risk diagnostic variant, if the target advertises VK_SUBGROUP_FEATURE_VOTE_BIT / GroupNonUniformVote, is to lower only these two mesh-barrier reductions to OpGroupNonUniformAny (one site at a time), preserving subgroup-any semantics while removing the ballot-vector extraction/OR sequence. Keep this diagnostic-only until the resulting module is compiled and functionally checked on 2.0.331 and 2.0.353. |
|
For a concrete diagnostic A/B (not a proposed merge change), the replacement reduction can be as small as: std::uint32_t EmitHostSubgroupAnyVote(SpirvEmitterState& state, std::uint32_t predicate) { Also emit spv::CapabilityGroupNonUniformVote in SpirvModuleSetup.cpp for this diagnostic and make SpirvEmitter.cpp reject the variant unless target.supportedCapabilities contains that capability. Keep GroupNonUniformBallot enabled because the other site remains ballot-based in the one-site variants. Then test these separate source variants, changing only the indicated call site: For each variant please attach the exact SPIR-V hash, whether the target advertises GroupNonUniformVote, pipeline-creation time/result, and functional mesh output on AMD 2.0.331 and 2.0.353. If 2.0.331 does not advertise GroupNonUniformVote, these A/B variants are not applicable and we should focus on reducing ballot polling/control flow instead. Keep the current PR unmerged until the original 2.0.331 reproducer succeeds. |
|
Kept this PR in draft and explicitly not merge-ready. The AMD 2.0.331 target pipeline still fails with VK_ERROR_OUT_OF_HOST_MEMORY; SPIR-V validation and 2.0.353 rendering do not establish success on 2.0.331. The “Software rendezvous verified on AMD proprietary Vulkan 2.0.331” checklist item intentionally remains unchecked. The OpGroupNonUniformAny A/B suggestions are diagnostic-only until exact target-driver compilation and functional output succeed. |
ligmaSec
left a comment
There was a problem hiding this comment.
meshSoftwareControlBarriers is in the compiler key but is absent from RequestSerializer. Replaying an affected AMD device’s request therefore compiles a different barrier path by default, complicating diagnosis of the driver crash. Could the capture store the selected flag and test round-trip compatibility with earlier requests?
Source review at eab0143842. The head trial-merges onto 192c4e45a0. Paired Linux checks are queued.
AI-assisted: yes.
DRAFT — NOT MERGE-READY: AMD proprietary Vulkan 2.0.331 selects the workaround but its pipeline compiler fails with VK_ERROR_OUT_OF_HOST_MEMORY. The software rendezvous is not verified on the target driver; the corresponding checklist item intentionally remains unchecked.
What
On AMD's proprietary Vulkan driver reporting version 2.0.331, mesh guest control barriers can hit a driver compiler crash. This change selects an exact driver/version quirk and replaces guest mesh barriers with a cyclic workgroup rendezvous backed by atomic arrival and generation counters. Other drivers and adjacent AMD driver versions keep the normal control-barrier path.
The target bit is carried through the shader cache key and SPIR-V emitter state. The mesh entry point initializes the rendezvous state before entering guest code, and s_barrier emission uses the software rendezvous only for the affected target. APS5_NO_MESH_SOFTWARE_BARRIERS disables the workaround for A/B/debugging.
Focused regression coverage checks the exact AMD driver/version gate and recompiles the same mesh fixture with the workaround on and off, asserting the normal control-barrier form versus the atomic rendezvous/loop form.
Overlap audit: #25322 changes wave LDS barriers on older NVIDIA drivers; #14217 and #14218 change MoltenVK coherent-buffer/LDS-atomic behavior; #7392 handles BDA fault lanes and explicitly leaves mesh barrier handling outside its scope. They share some plumbing files but do not implement this AMD mesh compiler workaround.
Tested
Hosted CI
Checklist
Summary by CodeRabbit