Repository navigation
feat(shader): decode all gfx1013 reference memory forms - #21993
Hampter588 wants to merge 1 commit into
Conversation
|
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.
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.
|
|
Head No new failures and no new validation messages on either GPU.
Layer runs used AI-assisted: yes |
|
Hi, I've tested this branch locally under Kali Linux (x86_64). I checked out the PR branch (test-gfx1013-decode), rebuilt the project, and ran the relevant test suites: · python -m unittest discover -s tools/tests -p test_shader_scan.py All tests passed on my end, and the decoder correctly reports 1,560/1,560 (100%) for gfx1013 reference forms. Since the author tested mainly on Windows 11, I hope this independent Linux verification is helpful for the review. Thanks! |
|
Cross-check of the decoder against LLVM's gfx1013 encodings, alongside the other open PRs for the same forms (#19479, #24729, #19452). Method. AMD's Windows driver ships
Every decoded opcode number matches LLVM's encoding in all four PRs. This PR's decoded fields agree with what LLVM's assembler accepts: stores and atomics without One disagreement, DS src2 64-bit forms with an odd offset field. Here the second address is
The 32-bit forms agree ( Not checked: this PR only decodes, and nothing here translates these forms. The 152 gfx1013 words (LLVM via amd_comgr)Decode harness#include "RdnaDecoder/RdnaInstructionDecoder.hpp"
#include "RdnaDecoder/RdnaInstruction.hpp"
#include <cstdint>
#include <cstdio>
#include <exception>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
using namespace ShaderRecompiler;
static std::string Operand(const RdnaOperand& operand) {
char text[64];
std::snprintf(text, sizeof(text), "%d:%u/%u", static_cast<int>(operand.kind), operand.reg, operand.value);
return text;
}
int main(int argc, char** argv) {
std::ifstream input(argv[1]);
std::string line;
while (std::getline(input, line)) {
std::istringstream fields(line);
std::string form;
fields >> form;
std::vector<std::uint32_t> words;
std::string word;
while (fields >> word) words.push_back(static_cast<std::uint32_t>(std::stoul(word, nullptr, 16)));
words.push_back(0xbf810000u);
std::printf("%s ", form.c_str());
try {
const auto instruction = DecodeRdnaInstruction(0, words, 0);
std::printf("op=%d id=%u fam=%d words=%u dst=%s s0=%s s1=%s s2=%s n=%u off=%u dd=%u dc=%u glc=%d dlc=%d sec=%d\n", static_cast<int>(instruction.op), instruction.opcodeId,
static_cast<int>(instruction.family), instruction.wordCount, Operand(instruction.destination).c_str(), Operand(instruction.source0).c_str(),
Operand(instruction.source1).c_str(), Operand(instruction.source2).c_str(), instruction.sourceCount, instruction.memoryOffset,
instruction.dataDwordCount, instruction.dataComponents, instruction.glc ? 1 : 0, instruction.dlc ? 1 : 0, static_cast<int>(instruction.secondaryOffset));
} catch (const std::exception& error) {
std::printf("THROW %s\n", error.what());
}
}
return 0;
}Built per PR head: AI-assisted: yes (Claude Code assembled the words, ran the harness and the tests, and wrote this comment). |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The decoder changes at head 09cc2b658dd5dae26e889f2676b31609cdc425e8 show no verified blocking defect in the inspected hunks; several changed files were not fully read, so approval is not justified. Nothing blocks this; the points below are optional.
What I ran
No commands were run. I read the prepared description, commit summary, manifest, and diff, then inspected RdnaMemoryOpDecoder.cpp and RdnaOpcode.cpp at the pinned head. The author reports passing tests and paired validation in the PR description; I did not independently run those checks.
Results
| Check | Result | Note |
|---|---|---|
| Targeted decoder review | passed | No blocking defect verified in inspected code |
| Automated checks | not run | Results are author-reported |
| Full changed-file review | not run | Several changed files were not fully read |
Findings
Blocking
None verified in the inspected code.
Non-blocking
- The description discloses overlap with PRs #19452 and #19479, including a direct conflict with #19479. Reconcile the competing implementations before merging this decoder-only alternative.
Not verified
I read review/description.md, review/commits.md, review/manifest.json, and review/diff.patch, plus targeted ranges from core/shader/recompiler/RdnaDecoder/src/RdnaMemoryOpDecoder.cpp and core/shader/recompiler/RdnaDecoder/src/RdnaOpcode.cpp. The manifest marks all seven changed files as included, but their full texts were not all read: DecoderReferenceForms.cpp, agc_decoder_reference_forms_tests.cmake, RdnaOpcode.hpp, the remainder of RdnaMemoryOpDecoder.cpp, the remainder of RdnaOpcode.cpp, feat-shader-gfx1013-memory-decoding.md, and test_shader_scan.py. The test claims, hardware behavior, full operand validation, and overlap report were not independently verified.
To get this to a good state
Nothing is required. Optional: coordinate with the authors of the overlapping PRs and reconcile the conflicting decoder changes.
|
macOS check of
Decoder-only change, so this shows the decoding and no regression on macOS, not execution of the new forms. Not tested with a title. |
|
I'm holding this until there is console evidence for these memory forms. The team's ruling on the instructions RDNA2 dropped is to keep a decode or translate PR only when a captured PS5 shader or a console probe uses one of them. Please post that on this PR (a shader hash from a title, or a probe result per form) and I'll lift the hold and send it to review. Without it, the forms stay unreachable on retail code, so I'd rather not merge them on the reference ISA alone. |
There was a problem hiding this comment.
I built and ran the exact 09cc2b658d decoder fixture on Linux. All 76 reference forms passed the operand, width, offset, flag, and truncated or reserved encoding checks. The new forms are represented in the decoder and still throw at translation, as the debt fragment records. This is decoder coverage. Execution on gfx1013 is unverified locally.
On Linux lavapipe, agc_decoder_modifiers and agc_driver_gcn_scalar_buffer_base passed against main a9cbd48cb0 and this head. The change-only agc_decoder_reference_forms CTest passed as well. The loader inserted VK_LAYER_KHRONOS_validation 1.4.369 on both GPU runs, with zero missing-layer warnings and zero VUIDs.
AI-assisted: yes.
What
The pinned gfx1013 public reference has 76 forms with no decoder mapping. This change adds all 15 64-bit DS SRC2 forms and all 61 SMEM store/atomic forms, raising reference decoding from 1,484/1,560 (95.13%) to 1,560/1,560 (100%). DS reaches 154/154; SMEM reaches 84/84. DPP remains 200/200.
DS reuses the existing SRC2 displacement path. SMEM reuses field extraction and adds explicit SDATA inputs, GLC-controlled return destinations, descriptor and data-tuple validation, and DLC preservation for the new forms. Existing opcode values are preserved by appending new enumerators.
This is decoding coverage, not execution support. Translation remains 1,484/1,560; all newly decoded forms have no IR translation and throw. Address-derived DS SRC2 offsets still throw. The debt fragment records these limits.
Overlap / draft status: #19452 implements the same 15 DS forms and adds translation; #19479 implements the same 61 SMEM forms and adds translation. This PR is a decoder-only alternative with a complete reference-coverage regression and independent operand/encoding tests. It is not intended to be merged alongside those implementations without reconciliation. The first checklist item is deliberately unchecked because its no-overlap condition is false.
Authenticated
tools/pr_overlap.py --repo boykopovar/AnyPS5 --base main --branch feat/shader-gfx1013-reference-decoding --jobs 6completed with exit 0 after probing 1,599 open PRs. It found three sharing files or exports, successfully merged all three into its base for comparison, and reports a direct conflict with #19479 inRdnaMemoryOpDecoder.cpp. The semantic duplication with #19452 is separately disclosed above.Encoding sources: LLVM
llvmorg-19.1.0SMInstructions.td L1155-L1340, DSInstructions.td L1526-L1555, and gfx10_asm_smem.s. SMEM operand constraints follow AMD RDNA 1 ISA sections 7.1 and 13.2.1. DS SRC2 uses the existing signed 15-bit displacement scaled by four; AMD MI100 ISA section 12.13 documents that address rule. No new instruction behavior has been measured on gfx1013 hardware.Tested
python -m unittest discover -s tools/tests -p test_shader_scan.py: 30 tests pass.python -m unittest discover -s tools/tests -p 'test_progress*.py': 176 tests, 175 pass and one skip.python tools/check_conventions.py --base origin/mainandgit diff --check origin/main...HEAD: pass.python tools/debt_fold.py --checknow fails on an unchanged upstream conflict:libressl3-20171-inventory.mdandfeat-libressl3-evp-pkey-new-mac-key-v2.mdboth change the samelibSceLibreSsl3entry. This change does not touch either fragment.Fresh paired validation after rebasing onto
main3b7ffd7a05cba491584a6e82af164654e0cf85bf(PR head09cc2b658dd5dae26e889f2676b31609cdc425e8):NVIDIA GeForce RTX 5090 vendor=0x10de device=0x2b85 subgroup=32on the same machine, driver 610.88.ctest --test-dir build/gpu-validation -R '^agc_decoder_reference_forms$' --output-on-failure: passes on the rebased head.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)All 76 originally missing reference forms and implementation order
Difficulty is for decoding, not execution: 15 DS SRC2 forms; nine SMEM stores; 24 ordinary 32-bit atomics; 24 ordinary 64-bit atomics; two 32-bit compare-swap forms; two 64-bit compare-swap forms.
DS: 15 forms
SMEM: 61 forms