isa, decoder, shader: move the SOPP control forms into the semantic registry (#215)

The six supported gfx1030 SOPP compute control forms are now described in
crates/isa/semantics/rdna2/sopp.toml, and the decoder and shader dispatch
from the registry. A sweep over all 128 SOPP opcodes, 13 SIMM16 values and
two stream positions (3,328 records) is identical before and after.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
This commit is contained in:
elforeign committed 2026-11-24 10:00:42 -06:00
1 parent fb0544652b
commit 131c8669cf
13 files changed
+730 -133

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ Guest execution uses original, purpose-built test programs. Commercial Xbox game
remains unsupported.
### Changed
- Moved the six supported gfx1030 SOPP compute control forms into the semantic registry, preserving instruction decoding and shader lowering. Part of #215.
- Moved gfx1030 `s_mov_b32` (SOP1) into the semantic registry, preserving its existing decode domain and shader output. The move operand rule retains explicit VCC and EXEC half destinations. Part of #215.
- Moved the six hand-written gfx1030 VOP2 logical and shift forms (`v_and_b32`, `v_or_b32`, `v_xor_b32`, `v_lshlrev_b32`, `v_lshrrev_b32`, `v_ashrrev_i32`, AMD guide section 12.7) into the semantic registry under a new VGPR-only operand rule `vop2_vgpr2`, with no behaviour change: a sweep of 132,608 VOP2, VOP1 and SOP1 words decodes to the same text, length and error before and after, the MSL goldens are unchanged, and the runtime-region allowlist admits exactly the same six forms. The per-lane `VectorBinary` gained `And`, `Or`, `Xor` and the three shifts (count masked to S0[4:0]); 6 hand-written instruction variants and their decoder and lowering arms are gone (17 hand-written forms remain). Part of #215.
- Added non-blocking Metal compute submission through `submit_words` and `wait`, with completion-aware resource retirement and a sixteen-dispatch in-flight limit. Synchronous calls keep their existing behavior. The benchmark reports the host submission split and compares synchronous and pipelined batches.
+20 -54
View File
@@ -5,11 +5,10 @@ use std::fmt;
pub use xenora_isa::{
Architecture, CompareRelation, ExportTarget, Instruction, InterpolationPhase, ScalarAluOp,
ScalarCompareOp, ScalarImmediateCompareOp, ScalarImmediateOp, ScalarSource, ScalarUnaryOp,
VectorAluOp, VectorAluVop3Op, VectorCompareOp, VectorSource,
SoppControlOp, VectorAluOp, VectorAluVop3Op, VectorCompareOp, VectorSource,
};
use xenora_isa::{
BUFFER_LOAD_DWORD, BUFFER_STORE_DWORD, EXP, IMAGE_SAMPLE_LZ, S_BRANCH, S_CBRANCH_EXECZ,
S_CBRANCH_SCC0, S_CBRANCH_VCCZ, S_ENDPGM, S_WAITCNT, S_WAITCNT_VSCNT, V_ADD_F32,
BUFFER_LOAD_DWORD, BUFFER_STORE_DWORD, EXP, IMAGE_SAMPLE_LZ, S_WAITCNT_VSCNT, V_ADD_F32,
V_INTERP_P1_F32, V_INTERP_P2_F32, V_MOV_B32, V_MUL_F32, VCC_LO,
};
@@ -40,17 +39,11 @@ const fn concat_forms<const N: usize>() -> [(&'static str, EncodingFamily); N] {
}
/// Decoded forms not yet described by the semantic registry.
const HANDWRITTEN_FORMS: [(&str, EncodingFamily); 16] = [
const HANDWRITTEN_FORMS: [(&str, EncodingFamily); 10] = [
("BUFFER_LOAD_DWORD", EncodingFamily::Mubuf),
("BUFFER_STORE_DWORD", EncodingFamily::Mubuf),
("EXP", EncodingFamily::Exp),
("IMAGE_SAMPLE_LZ", EncodingFamily::Mimg),
("S_BRANCH", EncodingFamily::Sopp),
("S_CBRANCH_EXECZ", EncodingFamily::Sopp),
("S_CBRANCH_SCC0", EncodingFamily::Sopp),
("S_CBRANCH_VCCZ", EncodingFamily::Sopp),
("S_ENDPGM", EncodingFamily::Sopp),
("S_WAITCNT", EncodingFamily::Sopp),
("S_WAITCNT_VSCNT", EncodingFamily::Sopk),
("V_ADD_F32", EncodingFamily::Vop2),
("V_INTERP_P1_F32", EncodingFamily::Vintrp),
@@ -379,34 +372,25 @@ fn decode_gfx1030(bytes: &[u8], offset: usize) -> Result<(Instruction, u8), Deco
let simm16 = first as u16;
return Ok((Instruction::ScalarImmediateCompare { op, src, simm16 }, 4));
}
if S_BRANCH.matches(first) {
let target = branch_target(first, offset, "s_branch")?;
return Ok((Instruction::Branch { target }, S_BRANCH.byte_len()));
if let Some(op) = SoppControlOp::from_word(first) {
let immediate = first as u16;
if op
.required_immediate()
.is_some_and(|exact| immediate != exact)
{
let detail = if op == SoppControlOp::EndProgram {
"expected zero immediate"
} else {
"expected vmcnt(0) alone"
};
return Err(unsupported(op.mnemonic(), detail));
}
let instruction = op.decode(|| branch_target(immediate, offset, op.mnemonic()))?;
return Ok((instruction, 4));
}
if let Some(op) = ScalarAluOp::from_word(first) {
return scalar_alu(op, first, bytes);
}
if S_CBRANCH_SCC0.matches(first) {
let target = branch_target(first, offset, "s_cbranch_scc0")?;
return Ok((
Instruction::BranchSccZero { target },
S_CBRANCH_SCC0.byte_len(),
));
}
if S_CBRANCH_EXECZ.matches(first) {
let target = branch_target(first, offset, "s_cbranch_execz")?;
return Ok((
Instruction::BranchExecZero { target },
S_CBRANCH_EXECZ.byte_len(),
));
}
if S_CBRANCH_VCCZ.matches(first) {
let target = branch_target(first, offset, "s_cbranch_vccz")?;
return Ok((
Instruction::BranchVccZero { target },
S_CBRANCH_VCCZ.byte_len(),
));
}
if let Some(op) = VectorAluOp::from_word(first) {
// VOP2: SRC0 in bits 0-8, VSRC1 in bits 9-16, VDST in bits 17-24.
let dst = ((first >> 17) & 0xff) as u8;
@@ -443,15 +427,6 @@ fn decode_gfx1030(bytes: &[u8], offset: usize) -> Result<(Instruction, u8), Deco
V_MUL_F32.byte_len(),
));
}
if S_WAITCNT.matches(first) {
return scalar_form(
first,
S_WAITCNT.byte_len(),
0xbf8c_3f70,
Instruction::WaitLoad,
"expected vmcnt(0) alone",
);
}
if S_WAITCNT_VSCNT.matches(first) {
return scalar_form(
first,
@@ -461,15 +436,6 @@ fn decode_gfx1030(bytes: &[u8], offset: usize) -> Result<(Instruction, u8), Deco
"expected null, 0",
);
}
if S_ENDPGM.matches(first) {
return scalar_form(
first,
S_ENDPGM.byte_len(),
0xbf81_0000,
Instruction::EndProgram,
"expected zero immediate",
);
}
Err(DecodeErrorKind::UnsupportedOpcode { word: first })
}
@@ -526,11 +492,11 @@ fn scalar_source(
}
fn branch_target(
first: u32,
immediate: u16,
offset: usize,
mnemonic: &'static str,
) -> Result<usize, DecodeErrorKind> {
let displacement = first as u16 as i16;
let displacement = immediate as i16;
let words = usize::try_from(displacement)
.map_err(|_| unsupported(mnemonic, "expected a forward branch"))?;
offset
+98 -2
View File
@@ -49,7 +49,20 @@ VARIANT_KEYS = {"of", "family", "opcode", "operands", "spec", "verify"}
# The assembler suffix LLVM prints for a variant's encoding family.
ASSEMBLY_SUFFIX = {"VOP3": "_e64"}
# Control effects select an existing typed instruction and its operand contract.
# The XML records SCC as a separate implicit input. VCC and EXEC predicates
# have fieldless mask inputs instead.
CONTROL_OPERATIONS = {
"end_program": ("EndProgram", "sopp_end", None),
"branch": ("Branch", "sopp_branch", None),
"branch_scc_zero": ("BranchSccZero", "sopp_branch", None),
"branch_vcc_zero": ("BranchVccZero", "sopp_branch", "OPR_VCC"),
"branch_exec_zero": ("BranchExecZero", "sopp_branch", "OPR_SDST_EXEC"),
"wait_load": ("WaitLoad", "sopp_wait", None),
}
OPERATIONS = {
**{name: variant for name, (variant, _, _) in CONTROL_OPERATIONS.items()},
"add": "Add", "sub": "Sub", "and": "And", "or": "Or", "xor": "Xor",
"andn2": "AndNot", "orn2": "OrNot", "nand": "Nand", "nor": "Nor", "xnor": "Xnor",
"lshl": "ShiftLeft", "lshr": "LogicalShiftRight", "ashr": "ArithmeticShiftRight",
@@ -143,7 +156,7 @@ WAVE = {"any": "Any", "wave32": "Wave32"}
# wave size: the lane-mask compares, whose one entry point is the Wave32
# compute fixture ABI (docs/shaders/vector-compare.md section 2). Every other
# kind must be "any".
WAVE_BY_KIND = {"vector_compare": "wave32"}
WAVE_BY_KIND = {"control": "wave32", "vector_compare": "wave32"}
EVIDENCE = {
"reference": "Reference",
"independent": "Independent",
@@ -260,6 +273,28 @@ UNSUPPORTED_COMBOS = {
VOP3_COMBOS = {"src_sgpr", "src_inline", "src_literal", "modifiers", "src2"}
ALL_COMBOS = UNSUPPORTED_COMBOS | {"src_vcc_hi", "src_null"} | VOP3_COMBOS
OPERAND_RULES = {
"sopp_end": {
"rust": "SoppEnd",
"enum": "SoppControlOp",
"shape": {"family": "SOPP", "src": [], "max_literals": 0, "immediate": 0},
"unsupported": set(),
"kind": "control",
},
"sopp_branch": {
"rust": "SoppBranch",
"enum": "SoppControlOp",
"shape": {"family": "SOPP", "src": [{"field": "SIMM16", "class": "label"}], "max_literals": 0},
"unsupported": set(),
"kind": "control",
},
"sopp_wait": {
"rust": "SoppWait",
"enum": "SoppControlOp",
"shape": {"family": "SOPP", "src": [{"field": "SIMM16", "class": "waitcnt"}],
"max_literals": 0, "immediate": 0x3f70},
"unsupported": set(),
"kind": "control",
},
"sop2_sgpr": {
"rust": "Sop2Sgpr",
"enum": "ScalarAluOp",
@@ -600,10 +635,16 @@ def _check_xml(form, rule, snapshot, errors):
scc_in = scc_out = False
implicit = set()
vcc_writes = []
for field, data_format, kind, size, is_input, is_output, _implicit, _encoded in variant["operands"]:
control_mask = CONTROL_OPERATIONS.get(form["operation"], (None, None, None))[2]
mask_inputs = 0
for field, data_format, kind, size, is_input, is_output, is_implicit, encoded in variant["operands"]:
if kind == "OPR_SSRC_SPECIAL_SCC":
scc_in |= is_input
scc_out |= is_output
elif control_mask and (field, kind, data_format, size, is_input, is_output, is_implicit, encoded) == (
"", control_mask, "FMT_NUM_M64", 64, True, False, True, True
):
mask_inputs += 1
elif field:
operands[field] = (data_format, size, is_input, is_output)
else:
@@ -617,6 +658,8 @@ def _check_xml(form, rule, snapshot, errors):
if vcc_writes != [(False, True)]:
errors.append(f"{label}: vcc lane_mask but the XML has no implicit VCC output")
implicit.discard("OPR_VCC")
if control_mask and mask_inputs != 1:
errors.append(f"{label}: expected one implicit {control_mask} input in the XML")
if implicit:
errors.append(f"{label}: XML implicit operands {sorted(implicit)} are not declared")
if scc_in != (form["carry_in"] == "scc"):
@@ -637,6 +680,14 @@ def _check_xml(form, rule, snapshot, errors):
errors.append(f"{label}: XML has no operand {field}")
continue
data_format, size, is_input, is_output = operands[field]
if field == "SIMM16" and _rule_kind(form) == "control":
expected_kind, expected_format = (
("OPR_LABEL", "FMT_NUM_I16") if form["operands"] == "sopp_branch"
else ("OPR_WAITCNT", "FMT_NUM_B16")
)
if [field, expected_format, expected_kind, 16, True, False, False, True] not in variant["operands"]:
errors.append(f"{label}: SIMM16 is not an encoded {expected_kind} input")
continue
if field == "SIMM16":
# The 16-bit immediate: signed forms read it as FMT_NUM_I16 (sign
# extended), unsigned compares as FMT_NUM_U16 (zero extended).
@@ -821,6 +872,14 @@ def validate(registry, snapshot):
if form["carry_in"] != "none":
errors.append(f"{label}: carry_in {form['carry_in']} contradicts compare")
primitive = (scc, None, False)
elif form["operation"] in CONTROL_OPERATIONS:
variant, operand_rule, _ = CONTROL_OPERATIONS[form["operation"]]
signedness = "signed" if operand_rule == "sopp_branch" else "bitwise"
if (form["variant"], form["operands"], form["signedness"]) != (variant, operand_rule, signedness):
errors.append(f"{label}: control operation requires {variant}, {operand_rule}, {signedness}")
if RELATION_KEY in form or form["width"] != 32:
errors.append(f"{label}: control operation requires width 32 and no relation")
primitive = ("unchanged", None, form["operation"] == "branch_scc_zero")
elif _rule_kind(form) == "vector":
if RELATION_KEY in form:
errors.append(f"{label}: {RELATION_KEY} on a non-compare operation")
@@ -856,6 +915,7 @@ def validate(registry, snapshot):
form["operation"] == "mov" and form["family"] == "SOP1"
)
else "vector" if _rule_kind(form) == "vector" and form["operation"] not in UNARY
else "control" if form["operation"] in CONTROL_OPERATIONS
else "immediate" if _rule_kind(form) == "immediate"
else "alu"
):
@@ -1289,6 +1349,42 @@ def _render_enum(rule_name, forms, snapshot, positions):
" }]",
" }",
]
if kind == "control":
out += [
"",
" /// Exact SIMM16 required by the fixture, or None for a displacement.",
" pub const fn required_immediate(self) -> Option<u16> {",
" match self {",
]
for form in forms:
exact = OPERAND_RULES[form["operands"]]["shape"].get("immediate")
value = "None" if exact is None else f"Some({exact:#x})"
out.append(f" Self::{form['variant']} => {value},")
out += [
" }",
" }",
"",
" /// Constructs the existing decoded instruction, resolving a target only for a branch.",
" pub fn decode<E>(",
" self,",
" target: impl FnOnce() -> Result<usize, E>,",
" ) -> Result<crate::Instruction, E> {",
" Ok(match self {",
]
for form in forms:
variant = form["variant"]
fields = " { target: target()? }" if form["operands"] == "sopp_branch" else ""
out.append(f" Self::{variant} => crate::Instruction::{variant}{fields},")
out += [" })", " }", "}", "", "impl crate::Instruction {",
" /// The registry operation corresponding to a decoded SOPP control.",
f" pub const fn sopp_control(self) -> Option<{enum}> {{",
" match self {"]
for form in forms:
variant = form["variant"]
fields = " { .. }" if form["operands"] == "sopp_branch" else ""
out.append(f" Self::{variant}{fields} => Some({enum}::{variant}),")
out += [" _ => None,", " }", " }", "}"]
return out
if kind == "immediate":
out += [
"",
+1
View File
@@ -24,6 +24,7 @@ include = [
"rdna2/vop2.toml",
"rdna2/vopc.toml",
"rdna2/vop3.toml",
"rdna2/sopp.toml",
]
# Named public documents that spec references point at.
+123
View File
@@ -0,0 +1,123 @@
# Existing gfx1030 compute controls, AMD RDNA 2 ISA guide §12.5.
[operand_rules.sopp_end]
family = "SOPP"
src = []
max_literals = 0
unsupported = []
immediate = 0
[operand_rules.sopp_branch]
family = "SOPP"
src = [{ field = "SIMM16", class = "label" }]
max_literals = 0
unsupported = []
[operand_rules.sopp_wait]
family = "SOPP"
src = [{ field = "SIMM16", class = "waitcnt" }]
max_literals = 0
unsupported = []
immediate = 0x3f70
[[form]]
name = "S_ENDPGM"
family = "SOPP"
opcode = 1
variant = "EndProgram"
operation = "end_program"
signedness = "bitwise"
carry_in = "none"
width = 32
scc = "unchanged"
vcc = "unchanged"
exec = "unchanged"
wave = "wave32"
operands = "sopp_end"
spec = [{ document = "guide", section = "12.5", page = 124 }, { document = "guide", section = "13.1.5", page = 245 }]
verify = ["reference", "independent", "metal", "llvm_encoding"]
[[form]]
name = "S_BRANCH"
family = "SOPP"
opcode = 2
variant = "Branch"
operation = "branch"
signedness = "signed"
carry_in = "none"
width = 32
scc = "unchanged"
vcc = "unchanged"
exec = "unchanged"
wave = "wave32"
operands = "sopp_branch"
spec = [{ document = "guide", section = "12.5", page = 124 }, { document = "guide", section = "13.1.5", page = 245 }]
verify = ["reference", "independent", "metal", "llvm_encoding"]
[[form]]
name = "S_CBRANCH_SCC0"
family = "SOPP"
opcode = 4
variant = "BranchSccZero"
operation = "branch_scc_zero"
signedness = "signed"
carry_in = "scc"
width = 32
scc = "unchanged"
vcc = "unchanged"
exec = "unchanged"
wave = "wave32"
operands = "sopp_branch"
spec = [{ document = "guide", section = "12.5", page = 124 }, { document = "guide", section = "13.1.5", page = 245 }]
verify = ["reference", "independent", "metal", "llvm_encoding"]
[[form]]
name = "S_CBRANCH_VCCZ"
family = "SOPP"
opcode = 6
variant = "BranchVccZero"
operation = "branch_vcc_zero"
signedness = "signed"
carry_in = "none"
width = 32
scc = "unchanged"
vcc = "unchanged"
exec = "unchanged"
wave = "wave32"
operands = "sopp_branch"
spec = [{ document = "guide", section = "12.5", page = 124 }, { document = "guide", section = "13.1.5", page = 245 }]
verify = ["reference", "independent", "metal", "llvm_encoding"]
[[form]]
name = "S_CBRANCH_EXECZ"
family = "SOPP"
opcode = 8
variant = "BranchExecZero"
operation = "branch_exec_zero"
signedness = "signed"
carry_in = "none"
width = 32
scc = "unchanged"
vcc = "unchanged"
exec = "unchanged"
wave = "wave32"
operands = "sopp_branch"
spec = [{ document = "guide", section = "12.5", page = 125 }, { document = "guide", section = "13.1.5", page = 245 }]
verify = ["reference", "independent", "metal", "llvm_encoding"]
[[form]]
name = "S_WAITCNT"
family = "SOPP"
opcode = 12
variant = "WaitLoad"
operation = "wait_load"
signedness = "bitwise"
carry_in = "none"
width = 32
scc = "unchanged"
vcc = "unchanged"
exec = "unchanged"
wave = "wave32"
operands = "sopp_wait"
spec = [{ document = "guide", section = "12.5", page = 125 }, { document = "guide", section = "13.1.5", page = 245 }]
verify = ["reference", "independent", "metal", "llvm_encoding"]
+1 -1
View File
@@ -20,7 +20,7 @@ pub use rdna2::{
};
pub use semantics_gen::{
ScalarAluOp, ScalarCompareOp, ScalarImmediateCompareOp, ScalarImmediateOp, ScalarUnaryOp,
VectorAluOp, VectorAluVop3Op, VectorCompareOp,
SoppControlOp, VectorAluOp, VectorAluVop3Op, VectorCompareOp,
};
/// SGPR index of `vcc_lo`, the Wave32 vector condition code.
+18
View File
@@ -94,6 +94,18 @@ pub enum Operation {
Move,
/// SOPK: SDST receives the sign-extended SIMM16 when SCC is set.
ConditionalMove,
/// Terminate the program.
EndProgram,
/// Unconditional PC-relative branch.
Branch,
/// Branch when SCC is clear.
BranchSccZero,
/// Branch when VCC is zero.
BranchVccZero,
/// Branch when EXEC is zero.
BranchExecZero,
/// Complete an outstanding vector load.
WaitLoad,
}
/// The per-lane integer operation a vector form lowers to. One reusable MSL
@@ -218,6 +230,12 @@ pub enum OperandRule {
/// SOPK integer compare: SDST (s0-s105) is the left operand, SIMM16 the right
/// (sign-extended for `_i32`, zero-extended for `_u32`); only SCC is written.
SopkCompare,
/// SOPP termination with zero in the reserved immediate field.
SoppEnd,
/// SOPP branch with a signed dword displacement from the next instruction.
SoppBranch,
/// SOPP wait with exactly vmcnt(0) and the other counters disabled.
SoppWait,
/// VOPC vector compare: the destination is `vcc_lo` (Wave32); SRC0 is a VGPR,
/// s0-s105, `vcc_lo`, an inline integer -16..64 or a literal word; VSRC1 is a
/// VGPR. Everything else is rejected as unsupported.
+371 -3
View File
@@ -1503,6 +1503,242 @@ impl ScalarImmediateOp {
}
}
/// SOPP operations declared in the semantic registry (operand rules `sopp_branch`, `sopp_end`, `sopp_wait`).
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum SoppControlOp {
/// `s_endpgm` (SOPP opcode 1): bitwise end_program, SCC = unchanged.
EndProgram,
/// `s_branch` (SOPP opcode 2): signed branch, SCC = unchanged.
Branch,
/// `s_cbranch_scc0` (SOPP opcode 4): signed branch_scc_zero plus SCC, SCC = unchanged.
BranchSccZero,
/// `s_cbranch_vccz` (SOPP opcode 6): signed branch_vcc_zero, SCC = unchanged.
BranchVccZero,
/// `s_cbranch_execz` (SOPP opcode 8): signed branch_exec_zero, SCC = unchanged.
BranchExecZero,
/// `s_waitcnt` (SOPP opcode 12): bitwise wait_load, SCC = unchanged.
WaitLoad,
}
/// SoppControlOp by SOPP OP field value; `None` for undeclared opcodes.
const SOPP_CONTROL_OP_BY_OPCODE: [Option<SoppControlOp>; 128] = [
None,
Some(SoppControlOp::EndProgram),
Some(SoppControlOp::Branch),
None,
Some(SoppControlOp::BranchSccZero),
None,
Some(SoppControlOp::BranchVccZero),
None,
Some(SoppControlOp::BranchExecZero),
None,
None,
None,
Some(SoppControlOp::WaitLoad),
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
];
impl SoppControlOp {
/// Every operation, in registry order.
pub const ALL: [Self; 6] = [
Self::EndProgram,
Self::Branch,
Self::BranchSccZero,
Self::BranchVccZero,
Self::BranchExecZero,
Self::WaitLoad,
];
/// Selects the operation from a first instruction word: the SOPP encoding
/// bits (mask 0xff80_0000) and then the OP field (bits 16-22).
pub const fn from_word(word: u32) -> Option<Self> {
if word & 0xff80_0000 != 0xbf80_0000 {
return None;
}
SOPP_CONTROL_OP_BY_OPCODE[((word >> 16) & 0x7f) as usize]
}
/// Lower-case mnemonic.
pub const fn mnemonic(self) -> &'static str {
match self {
Self::EndProgram => "s_endpgm",
Self::Branch => "s_branch",
Self::BranchSccZero => "s_cbranch_scc0",
Self::BranchVccZero => "s_cbranch_vccz",
Self::BranchExecZero => "s_cbranch_execz",
Self::WaitLoad => "s_waitcnt",
}
}
/// The validated registry row.
pub fn semantics(self) -> &'static FormSemantics {
&FORMS[match self {
Self::EndProgram => 107,
Self::Branch => 108,
Self::BranchSccZero => 109,
Self::BranchVccZero => 110,
Self::BranchExecZero => 111,
Self::WaitLoad => 112,
}]
}
/// Exact SIMM16 required by the fixture, or None for a displacement.
pub const fn required_immediate(self) -> Option<u16> {
match self {
Self::EndProgram => Some(0x0),
Self::Branch => None,
Self::BranchSccZero => None,
Self::BranchVccZero => None,
Self::BranchExecZero => None,
Self::WaitLoad => Some(0x3f70),
}
}
/// Constructs the existing decoded instruction, resolving a target only for a branch.
pub fn decode<E>(
self,
target: impl FnOnce() -> Result<usize, E>,
) -> Result<crate::Instruction, E> {
Ok(match self {
Self::EndProgram => crate::Instruction::EndProgram,
Self::Branch => crate::Instruction::Branch { target: target()? },
Self::BranchSccZero => crate::Instruction::BranchSccZero { target: target()? },
Self::BranchVccZero => crate::Instruction::BranchVccZero { target: target()? },
Self::BranchExecZero => crate::Instruction::BranchExecZero { target: target()? },
Self::WaitLoad => crate::Instruction::WaitLoad,
})
}
}
impl crate::Instruction {
/// The registry operation corresponding to a decoded SOPP control.
pub const fn sopp_control(self) -> Option<SoppControlOp> {
match self {
Self::EndProgram => Some(SoppControlOp::EndProgram),
Self::Branch { .. } => Some(SoppControlOp::Branch),
Self::BranchSccZero { .. } => Some(SoppControlOp::BranchSccZero),
Self::BranchVccZero { .. } => Some(SoppControlOp::BranchVccZero),
Self::BranchExecZero { .. } => Some(SoppControlOp::BranchExecZero),
Self::WaitLoad => Some(SoppControlOp::WaitLoad),
_ => None,
}
}
}
/// VOP2 operations declared in the semantic registry (operand rules `vop2_vgpr`, `vop2_vgpr2`).
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum VectorAluOp {
@@ -2292,13 +2528,13 @@ impl VectorAluVop3Op {
/// The validated registry row of this encoding.
pub fn semantics(self) -> &'static FormSemantics {
&FORMS[match self {
Self::AddNcU32 => 107,
Self::AddNcU32 => 113,
}]
}
}
/// Identity of every registry form and encoding variant, in registry order.
pub const FORM_IDS: [(&str, EncodingFamily); 108] = [
pub const FORM_IDS: [(&str, EncodingFamily); 114] = [
("S_ADD_U32", EncodingFamily::Sop2),
("S_SUB_U32", EncodingFamily::Sop2),
("S_ADD_I32", EncodingFamily::Sop2),
@@ -2406,11 +2642,17 @@ pub const FORM_IDS: [(&str, EncodingFamily); 108] = [
("V_CMP_T_I32", EncodingFamily::Vopc),
("V_CMP_F_U32", EncodingFamily::Vopc),
("V_CMP_T_U32", EncodingFamily::Vopc),
("S_ENDPGM", EncodingFamily::Sopp),
("S_BRANCH", EncodingFamily::Sopp),
("S_CBRANCH_SCC0", EncodingFamily::Sopp),
("S_CBRANCH_VCCZ", EncodingFamily::Sopp),
("S_CBRANCH_EXECZ", EncodingFamily::Sopp),
("S_WAITCNT", EncodingFamily::Sopp),
("V_ADD_NC_U32", EncodingFamily::Vop3),
];
/// One validated row per registry form, in registry order.
pub static FORMS: [FormSemantics; 108] = [
pub static FORMS: [FormSemantics; 114] = [
FormSemantics {
name: "S_ADD_U32",
family: EncodingFamily::Sop2,
@@ -4658,6 +4900,132 @@ pub static FORMS: [FormSemantics; 108] = [
spec: &[SpecRef { document: Document::Guide, section: "12.9", page: 150 }, SpecRef { document: Document::Guide, section: "3.9", page: 19 }],
verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding],
},
FormSemantics {
name: "S_ENDPGM",
family: EncodingFamily::Sopp,
opcode: 1,
operation: Operation::EndProgram,
signedness: Signedness::Bitwise,
carry_in: CarryIn::None,
width: 32,
shift_count_bits: 0,
shift_amount: 0,
swap_sources: false,
source_bits: 32,
relation: None,
scc: SccEffect::Unchanged,
vcc: MaskEffect::Unchanged,
exec: MaskEffect::Unchanged,
wave: Wave::Wave32,
operands: OperandRule::SoppEnd,
spec: &[SpecRef { document: Document::Guide, section: "12.5", page: 124 }, SpecRef { document: Document::Guide, section: "13.1.5", page: 245 }],
verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding],
},
FormSemantics {
name: "S_BRANCH",
family: EncodingFamily::Sopp,
opcode: 2,
operation: Operation::Branch,
signedness: Signedness::Signed,
carry_in: CarryIn::None,
width: 32,
shift_count_bits: 0,
shift_amount: 0,
swap_sources: false,
source_bits: 32,
relation: None,
scc: SccEffect::Unchanged,
vcc: MaskEffect::Unchanged,
exec: MaskEffect::Unchanged,
wave: Wave::Wave32,
operands: OperandRule::SoppBranch,
spec: &[SpecRef { document: Document::Guide, section: "12.5", page: 124 }, SpecRef { document: Document::Guide, section: "13.1.5", page: 245 }],
verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding],
},
FormSemantics {
name: "S_CBRANCH_SCC0",
family: EncodingFamily::Sopp,
opcode: 4,
operation: Operation::BranchSccZero,
signedness: Signedness::Signed,
carry_in: CarryIn::Scc,
width: 32,
shift_count_bits: 0,
shift_amount: 0,
swap_sources: false,
source_bits: 32,
relation: None,
scc: SccEffect::Unchanged,
vcc: MaskEffect::Unchanged,
exec: MaskEffect::Unchanged,
wave: Wave::Wave32,
operands: OperandRule::SoppBranch,
spec: &[SpecRef { document: Document::Guide, section: "12.5", page: 124 }, SpecRef { document: Document::Guide, section: "13.1.5", page: 245 }],
verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding],
},
FormSemantics {
name: "S_CBRANCH_VCCZ",
family: EncodingFamily::Sopp,
opcode: 6,
operation: Operation::BranchVccZero,
signedness: Signedness::Signed,
carry_in: CarryIn::None,
width: 32,
shift_count_bits: 0,
shift_amount: 0,
swap_sources: false,
source_bits: 32,
relation: None,
scc: SccEffect::Unchanged,
vcc: MaskEffect::Unchanged,
exec: MaskEffect::Unchanged,
wave: Wave::Wave32,
operands: OperandRule::SoppBranch,
spec: &[SpecRef { document: Document::Guide, section: "12.5", page: 124 }, SpecRef { document: Document::Guide, section: "13.1.5", page: 245 }],
verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding],
},
FormSemantics {
name: "S_CBRANCH_EXECZ",
family: EncodingFamily::Sopp,
opcode: 8,
operation: Operation::BranchExecZero,
signedness: Signedness::Signed,
carry_in: CarryIn::None,
width: 32,
shift_count_bits: 0,
shift_amount: 0,
swap_sources: false,
source_bits: 32,
relation: None,
scc: SccEffect::Unchanged,
vcc: MaskEffect::Unchanged,
exec: MaskEffect::Unchanged,
wave: Wave::Wave32,
operands: OperandRule::SoppBranch,
spec: &[SpecRef { document: Document::Guide, section: "12.5", page: 125 }, SpecRef { document: Document::Guide, section: "13.1.5", page: 245 }],
verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding],
},
FormSemantics {
name: "S_WAITCNT",
family: EncodingFamily::Sopp,
opcode: 12,
operation: Operation::WaitLoad,
signedness: Signedness::Bitwise,
carry_in: CarryIn::None,
width: 32,
shift_count_bits: 0,
shift_amount: 0,
swap_sources: false,
source_bits: 32,
relation: None,
scc: SccEffect::Unchanged,
vcc: MaskEffect::Unchanged,
exec: MaskEffect::Unchanged,
wave: Wave::Wave32,
operands: OperandRule::SoppWait,
spec: &[SpecRef { document: Document::Guide, section: "12.5", page: 125 }, SpecRef { document: Document::Guide, section: "13.1.5", page: 245 }],
verify: &[Evidence::Reference, Evidence::Independent, Evidence::Metal, Evidence::LlvmEncoding],
},
FormSemantics {
name: "V_ADD_NC_U32",
family: EncodingFamily::Vop3,
+69 -59
View File
@@ -8,6 +8,7 @@ mod graphics;
pub use graphics::{PIXEL_ENTRY_POINT, VERTEX_ENTRY_POINT, compile_graphics};
pub use xenora_decoder::Architecture;
use xenora_decoder::SoppControlOp;
use xenora_decoder::{
DecodeError, DecodedInstruction, Instruction, ScalarSource, ScalarUnaryOp, VectorAluOp,
VectorAluVop3Op, VectorBinary, VectorCompareOp, VectorSource,
@@ -597,18 +598,18 @@ fn lift(decoded: &[DecodedInstruction], code_len: usize) -> Result<Vec<(usize, O
// contract, even when a known branch skips it.
for (index, instruction) in decoded.iter().enumerate() {
let offset = instruction.offset;
if let Some(target) = instruction.branch_target()
&& (target <= offset
|| decoded
.binary_search_by_key(&target, |instruction| instruction.offset)
.is_err())
{
return Err(CompileError::Verify {
offset,
reason: "branch target must be a forward instruction boundary",
});
}
let reason = match instruction.instruction {
Instruction::Branch { target }
| Instruction::BranchSccZero { target }
| Instruction::BranchExecZero { target }
| Instruction::BranchVccZero { target }
if target <= offset
|| decoded
.binary_search_by_key(&target, |instruction| instruction.offset)
.is_err() =>
{
"branch target must be a forward instruction boundary"
}
Instruction::BufferLoadDword {
index, resource, ..
} if (index, resource) != (0, 0) => "unsupported resource or buffer index",
@@ -766,12 +767,6 @@ fn lift(decoded: &[DecodedInstruction], code_len: usize) -> Result<Vec<(usize, O
store_pending = true;
(None, Op::Store(read(data)?))
}
Instruction::WaitLoad => {
if let Some((register, value)) = pending_load.take() {
registers[register] = Some(value);
}
continue;
}
Instruction::WaitStore => {
store_pending = false;
continue;
@@ -993,43 +988,66 @@ fn lift(decoded: &[DecodedInstruction], code_len: usize) -> Result<Vec<(usize, O
lane_vcc = Some(mask);
continue;
}
Instruction::BranchVccZero { target } if let Some(mask) = lane_vcc => {
if pending_load.is_some() {
return Err(error(
"a runtime s_cbranch_vccz requires no outstanding vector load",
));
}
region = Some((target, mask, registers));
(None, Op::RuntimeBranch { mask, target })
}
Instruction::BranchSccZero { target }
| Instruction::BranchExecZero { target }
| Instruction::BranchVccZero { target } => {
let taken = match instruction.instruction {
Instruction::BranchSccZero { .. } => {
!scc.ok_or_else(|| error("conditional branch reads uninitialized SCC"))?
Instruction::Branch { .. }
| Instruction::BranchSccZero { .. }
| Instruction::BranchExecZero { .. }
| Instruction::BranchVccZero { .. }
| Instruction::WaitLoad
| Instruction::EndProgram => {
match instruction
.instruction
.sopp_control()
.expect("decoded SOPP control")
{
SoppControlOp::WaitLoad => {
if let Some((register, value)) = pending_load.take() {
registers[register] = Some(value);
}
continue;
}
Instruction::BranchVccZero { .. } => {
scalars[106]
.ok_or_else(|| error("conditional branch reads uninitialized VCC_LO"))?
== 0
SoppControlOp::EndProgram => {
if !stored || store_pending || pending_load.is_some() {
return Err(error(
"termination requires one completed store and no pending loads",
));
}
return Ok(operations);
}
op => {
let target = instruction.branch_target().expect("decoded SOPP branch");
if op == SoppControlOp::BranchVccZero
&& let Some(mask) = lane_vcc
{
if pending_load.is_some() {
return Err(error(
"a runtime s_cbranch_vccz requires no outstanding vector load",
));
}
region = Some((target, mask, registers));
(None, Op::RuntimeBranch { mask, target })
} else {
let taken = match op {
SoppControlOp::Branch => true,
SoppControlOp::BranchSccZero => !scc.ok_or_else(|| {
error("conditional branch reads uninitialized SCC")
})?,
SoppControlOp::BranchVccZero => {
scalars[106].ok_or_else(|| {
error("conditional branch reads uninitialized VCC_LO")
})? == 0
}
SoppControlOp::BranchExecZero => exec == 0,
SoppControlOp::WaitLoad | SoppControlOp::EndProgram => {
unreachable!()
}
};
if taken {
skip_before = target;
}
(None, Op::ScalarBranch { target, taken })
}
}
_ => exec == 0,
};
if taken {
skip_before = target;
}
(None, Op::ScalarBranch { target, taken })
}
Instruction::Branch { target } => {
skip_before = target;
(
None,
Op::ScalarBranch {
target,
taken: true,
},
)
}
Instruction::VectorAlu {
op,
@@ -1084,14 +1102,6 @@ fn lift(decoded: &[DecodedInstruction], code_len: usize) -> Result<Vec<(usize, O
"graphics instruction is unsupported in a compute fixture",
));
}
Instruction::EndProgram => {
if !stored || store_pending || pending_load.is_some() {
return Err(error(
"termination requires one completed store and no pending loads",
));
}
return Ok(operations);
}
};
let value_bits = match operation {
Op::Constant(bits) => KnownBits::constant(bits),
+6 -6
View File
@@ -14,12 +14,12 @@ The wider LLVM operand matrix exercises decoding only. ABI means application bin
| Form | Operands | Size or word | Recognized | Decoded | LLVM | Lowering | Reference | CPU | GPU |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `buffer_load_dword` | MUBUF, VGPR data/index, four normal SGPRs, `idxen`, zero offsets and remaining flags | 8 B | yes | yes | three-way passed | MSL load | implemented | fixture verified | fixture verified |
| `s_waitcnt vmcnt(0)` | SOPP, exact immediate `0x3f70`; other counters disabled by their maximum values | 4 B | yes | yes | three-way passed | verified load wait | implemented | fixture verified | fixture verified |
| `s_waitcnt vmcnt(0)` | SOPP, exact immediate `0x3f70`; other counters disabled by their maximum values (semantic registry) | 4 B | yes | yes | three-way passed | verified load wait | implemented | fixture verified | fixture verified |
| `v_mov_b32_e32` | VOP1, VGPR destination, VGPR, normal SGPR (wave-uniform, known during translation), vcc_lo (known or a compare mask) or inline integer or literal source, plus the inline bit pattern for +1.0f | 4 or 8 B | yes | yes | three-way passed | constant or register value | implemented | fixture verified | fixture verified |
| `v_add_nc_u32_e64` | VOP3, VGPR destination and two VGPR inputs, modifier fields clear, third source field encoded as inline zero | 8 B | yes | yes | three-way passed | MSL unsigned add | implemented | fixture verified | fixture verified |
| `buffer_store_dword` | MUBUF, VGPR data/index, four normal SGPRs, `idxen`, zero offsets and remaining flags | 8 B | yes | yes | three-way passed | MSL store | implemented | fixture verified | fixture verified |
| `s_waitcnt_vscnt null, 0` | SOPK, exact null source and zero immediate | 4 B | yes | yes | three-way passed | verified store wait | implemented | fixture verified | fixture verified |
| `s_endpgm` | SOPP, zero immediate | 4 B | yes | yes | three-way passed | verified termination | implemented | fixture verified | fixture verified |
| `s_endpgm` | SOPP, zero immediate (semantic registry) | 4 B | yes | yes | three-way passed | verified termination | implemented | fixture verified | fixture verified |
| `s_mov_b32` | Normal SGPR or EXEC/VCC half destination and normal SGPR, inline integer or literal source | `BE880387` | yes | yes | three-way passed | resolved scalar state | implemented | fixture verified | fixture verified |
| `s_not_b32` | SOP1, normal SGPR destination; normal SGPR, inline integer or literal source; D = ~S0; SCC = D != 0 | `BE890708` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_brev_b32` | SOP1, normal SGPR destination; normal SGPR, inline integer or literal source; D = S0 bit-reversed; SCC unchanged | `BE8A0B08` | yes | yes | three-way passed | resolved scalar state and SCC | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
@@ -109,8 +109,8 @@ The wider LLVM operand matrix exercises decoding only. ABI means application bin
| `v_cmp_t_i32_e32` | VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0 (signed); VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & true, fully written | `7D0E0501` | yes | yes | three-way passed | per-thread Wave32 mask over the dispatch's own 32 lanes, reading no operand bits; runtime s_cbranch_vccz as a join select | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `v_cmp_f_u32_e32` | VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0 (unsigned); VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & false, fully written | `7D800501` | yes | yes | three-way passed | per-thread Wave32 mask over the dispatch's own 32 lanes, reading no operand bits; runtime s_cbranch_vccz as a join select | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `v_cmp_t_u32_e32` | VOPC, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0 (unsigned); VGPR VSRC1; VCC_LO[n] = EXEC_LO[n] & true, fully written | `7D8E0501` | yes | yes | three-way passed | per-thread Wave32 mask over the dispatch's own 32 lanes, reading no operand bits; runtime s_cbranch_vccz as a join select | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_cbranch_scc0` | Nonnegative signed dword displacement | `BF840002` | yes | yes | three-way passed | resolved conditional branch | implemented | fixture verified | fixture verified |
| `s_branch` | Nonnegative signed dword displacement | `BF820001` | yes | yes | three-way passed | resolved branch | implemented | fixture verified | fixture verified |
| `s_cbranch_scc0` | Nonnegative signed dword displacement (semantic registry) | `BF840002` | yes | yes | three-way passed | resolved conditional branch | implemented | fixture verified | fixture verified |
| `s_branch` | Nonnegative signed dword displacement (semantic registry) | `BF820001` | yes | yes | three-way passed | resolved branch | implemented | fixture verified | fixture verified |
| `v_and_b32_e32` | Two VGPR sources and one VGPR destination | `36020702` | yes | yes | three-way passed | MSL bitwise AND | implemented | fixture verified | fixture verified |
| `v_xor_b32_e32` | Two VGPR sources and one VGPR destination | `3A020702` | yes | yes | three-way passed | MSL bitwise XOR | implemented | fixture verified | fixture verified |
| `v_add_f32_e32` | Two VGPR sources and one VGPR destination | `06020702` | yes | yes | three-way passed | MSL FP32 add | implemented | fixture verified | fixture verified |
@@ -119,8 +119,8 @@ The wider LLVM operand matrix exercises decoding only. ABI means application bin
| `v_lshlrev_b32_e32` | Two VGPR sources and one VGPR destination | `34020501` | yes | yes | three-way passed | MSL logical left shift with a five-bit count | implemented | fixture verified | fixture verified on Apple M5 |
| `v_lshrrev_b32_e32` | Two VGPR sources and one VGPR destination | `2DFFFF01` | yes | yes | three-way passed | MSL logical right shift with a five-bit count | implemented | fixture verified | fixture verified on Apple M5 |
| `v_ashrrev_i32_e32` | Two VGPR sources and one VGPR destination | `31FFFF01` | yes | yes | three-way passed | MSL signed right shift with a five-bit count | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_cbranch_execz` | Nonnegative signed dword displacement | `BF880001` | yes | yes | three-way passed | resolved Wave32 EXEC_LO zero check | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_cbranch_vccz` | Nonnegative signed dword displacement | `BF860001` | yes | yes | three-way passed | resolved Wave32 VCC_LO zero check, or a wave-uniform join select after a vector compare | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_cbranch_execz` | Nonnegative signed dword displacement (semantic registry) | `BF880001` | yes | yes | three-way passed | resolved Wave32 EXEC_LO zero check | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `s_cbranch_vccz` | Nonnegative signed dword displacement (semantic registry) | `BF860001` | yes | yes | three-way passed | resolved Wave32 VCC_LO zero check, or a wave-uniform join select after a vector compare | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `v_mul_i32_i24_e32` | VOP2, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1 and VDST; inactive lanes keep VDST; D = low 32 bits of sext(S0[23:0]) * sext(S1[23:0]) | `120402C3` | yes | yes | three-way passed | per-thread typed integer template over the lane's own VGPRs; partial EXEC as a lane merge | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `v_mul_hi_i32_i24_e32` | VOP2, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1 and VDST; inactive lanes keep VDST; D = bits 63:32 of sext(S0[23:0]) * sext(S1[23:0]) | `14060208` | yes | yes | three-way passed | per-thread typed integer template over the lane's own VGPRs; partial EXEC as a lane merge | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
| `v_mul_u32_u24_e32` | VOP2, Wave32; VGPR, normal SGPR (known during translation), vcc_lo, inline integer or literal SRC0; VGPR VSRC1 and VDST; inactive lanes keep VDST; D = low 32 bits of S0[23:0] * S1[23:0] | `160802FF 00123456` | yes | yes | three-way passed | per-thread typed integer template over the lane's own VGPRs; partial EXEC as a lane merge | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending |
+5 -2
View File
@@ -28,7 +28,7 @@ acceptance remain outside the verified count. All results concern synthetic fixt
| SOP2 | 51 | 33 | 33 | 33 | 33 | 33 | 0 | 0 | 12 |
| SOPC | 18 | 12 | 12 | 12 | 12 | 12 | 1 | 1 | 7 |
| SOPK | 27 | 17 | 16 | 17 | 17 | 17 | 1 | 1 | 5 |
| SOPP | 36 | 6 | 0 | 6 | 6 | 6 | 4 | 4 | 0 |
| SOPP | 36 | 6 | 6 | 6 | 6 | 6 | 4 | 4 | 0 |
| VINTRP | 3 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 |
| VOP1 | 81 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 |
| VOP2 | 47 | 20 | 18 | 20 | 20 | 20 | 7 | 7 | 11 |
@@ -36,7 +36,7 @@ acceptance remain outside the verified count. All results concern synthetic fixt
| VOP3P | 29 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| VOP3SDST | 10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| VOPC | 190 | 16 | 16 | 16 | 16 | 16 | 0 | 0 | 7 |
| **Total** | 1465 | 120 | 108 | 124 | 120 | 120 | 18 | 18 | 65 |
| **Total** | 1465 | 120 | 114 | 124 | 120 | 120 | 18 | 18 | 65 |
## Unsupported operand variants
@@ -50,6 +50,9 @@ The table counts distinct variant names per family across registry operand rules
| SOPC | `sopc_scalar` | `src_exec`, `src_float_inline`, `src_m0`, `src_special`, `src_ttmp`, `src_vcc`, `two_literals` |
| SOPK | `sopk_compare` | `dst_exec`, `dst_m0`, `dst_null`, `dst_ttmp`, `dst_vcc` |
| SOPK | `sopk_sgpr` | `dst_exec`, `dst_m0`, `dst_null`, `dst_ttmp`, `dst_vcc` |
| SOPP | `sopp_branch` | None listed |
| SOPP | `sopp_end` | None listed |
| SOPP | `sopp_wait` | None listed |
| VOP2 | `vop2_vgpr` | `src_exec`, `src_float_inline`, `src_m0`, `src_null`, `src_special`, `src_ttmp`, `src_vcc_hi` |
| VOP2 | `vop2_vgpr2` | `src_exec`, `src_float_inline`, `src_inline`, `src_literal`, `src_m0`, `src_null`, `src_sgpr`, `src_special`, `src_ttmp`, `src_vcc` |
| VOP3 | `vop3_vgpr2` | `modifiers`, `src2`, `src_exec`, `src_float_inline`, `src_inline`, `src_literal`, `src_m0`, `src_null`, `src_sgpr`, `src_special`, `src_ttmp`, `src_vcc` |
+11
View File
@@ -210,6 +210,17 @@ The XML must give SIMM16 as 16-bit `FMT_NUM_I16` (`FMT_NUM_U16` for `unsigned`).
The word never takes a literal dword. The details are in
[scalar-immediate.md](scalar-immediate.md).
The SOPP control rules (AMD RDNA 2 ISA guide §§12.5 and 13.1.5) generate
`SoppControlOp` for the existing Wave32 compute subset. `sopp_end` accepts
`s_endpgm` with zero in SIMM16. `sopp_wait` accepts only `s_waitcnt vmcnt(0)`
(`0x3f70`), completing a pending vector load. `sopp_branch` accepts
`s_branch`, `s_cbranch_scc0`, `s_cbranch_vccz` and `s_cbranch_execz` with a
nonnegative signed SIMM16 displacement in dwords from the next instruction.
The decoder and compiler require a valid target boundary. The conditional
branches read SCC, VCC_LO or EXEC_LO without writing those registers.
Other SOPP forms, including `s_nop`, the nonzero branches, `s_sendmsg`,
`s_trap`, `s_sethalt` and `s_setprio`, remain unsupported.
Behaviour is chosen only from these declared fields, never from the mnemonic.
## What the validator checks
+6 -6
View File
@@ -53,7 +53,7 @@ llvm = "three-way passed"
[[instruction]]
form = "s_waitcnt vmcnt(0)"
encoding = "SOPP, exact immediate `0x3f70`; other counters disabled by their maximum values"
encoding = "SOPP, exact immediate `0x3f70`; other counters disabled by their maximum values (semantic registry)"
representation = "4 B"
lowering = "verified load wait"
reference = "implemented"
@@ -113,7 +113,7 @@ llvm = "three-way passed"
[[instruction]]
form = "s_endpgm"
encoding = "SOPP, zero immediate"
encoding = "SOPP, zero immediate (semantic registry)"
representation = "4 B"
lowering = "verified termination"
reference = "implemented"
@@ -1192,7 +1192,7 @@ llvm = "three-way passed"
[[instruction]]
form = "s_cbranch_scc0"
encoding = "Nonnegative signed dword displacement"
encoding = "Nonnegative signed dword displacement (semantic registry)"
representation = "`BF840002`"
lowering = "resolved conditional branch"
reference = "implemented"
@@ -1204,7 +1204,7 @@ llvm = "three-way passed"
[[instruction]]
form = "s_branch"
encoding = "Nonnegative signed dword displacement"
encoding = "Nonnegative signed dword displacement (semantic registry)"
representation = "`BF820001`"
lowering = "resolved branch"
reference = "implemented"
@@ -1312,7 +1312,7 @@ llvm = "three-way passed"
[[instruction]]
form = "s_cbranch_execz"
encoding = "Nonnegative signed dword displacement"
encoding = "Nonnegative signed dword displacement (semantic registry)"
representation = "`BF880001`"
lowering = "resolved Wave32 EXEC_LO zero check"
reference = "implemented"
@@ -1324,7 +1324,7 @@ llvm = "three-way passed"
[[instruction]]
form = "s_cbranch_vccz"
encoding = "Nonnegative signed dword displacement"
encoding = "Nonnegative signed dword displacement (semantic registry)"
representation = "`BF860001`"
lowering = "resolved Wave32 VCC_LO zero check, or a wave-uniform join select after a vector compare"
reference = "implemented"