Commit Graph
8 Commits
Author SHA1 Message Date
elforeign 06ded40d54 isa, scripts: registry loader and variant validation give diagnostics, not tracebacks (#215)
- A standalone registry (no include) no longer needs a family directory.
- A variant of an incomplete form reports the form instead of a KeyError.
- A non-array encoding_variant, or a non-table entry, is a diagnostic in
  the loader, the validator and the coverage report.
Each case has a test that fails on the previous code. The split-registry
test now compares the whole merged result with a hand concatenation, and
vop3.toml cites guide 12.7.1 for the VOP3 opcode offset.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:26:23 -06:00
elforeign 6bc88d6c51 isa, scripts: review fixes for the registry split and encoding variants (#215)
- Includes must be `<root stem>/<family>.toml`, so a family file cannot
  live outside the registry directory or be aliased past the repeat
  guard. The coverage report (and through it the RDNA2 planner) now uses
  the generator's loader, so the family-file guards apply to every
  consumer.
- A variant's explicit XML operand formats, destination included, must
  equal its base encoding's; malformed variant fields are diagnosed
  instead of raising.
- Variants get their own generated enum (VectorAluVop3Op: from_word,
  base, assembly_name, semantics), so Instruction::VectorAluVop3 cannot
  name an undeclared encoding and formatting cannot panic.
- The planner no longer counts a variant-only operand rule as a rule that
  can host new forms of its family (V_FMA_F32 was shown as reuse-ready).
- The isa test checks that no first word of another 64-bit family
  (VOP3B) selects a VOP3 variant; docs describe the variant files.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 08:01:18 -06:00
elforeign 516976fb9f isa, decoder, shader: registry encoding variants; v_add_nc_u32_e64 as the first (#215)
An [[encoding_variant]] re-encodes a declared form in another family: it
names the form, the family, its opcode there and that encoding's operand
rule, and inherits the rest. The XML check runs on the inherited
declaration, and the generator rejects variants of undeclared forms, in
the form's own family, duplicates, rules that cannot encode the form and
forms that use a variant-only rule. It emits from_<family>_word and
<family>_assembly_name on the base enum and one FORMS row per variant.

rdna2/vop3.toml declares the vop3_vgpr2 rule (the subset the hand-written
decoder accepted: VGPR sources, no modifiers, unused SRC2) and the VOP3
encoding of V_ADD_NC_U32. The decoder dispatches it through
VectorAluOp::from_vop3_word into Instruction::VectorAluVop3, which replaces
AddNoCarryU32; the shader lowers it through the VOP2 form's template and
still admits only v_add_nc_u32_e64 inside a runtime s_cbranch_vccz region.
Goldens, known answers and the LLVM oracle are unchanged.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 07:53:50 -06:00
elforeign 2384bed8b4 isa: split the semantic registry into one file per encoding family (#215)
crates/isa/semantics/rdna2.toml keeps the schema, architecture, snapshot
hash, cited documents and field meanings, and lists the family files under
`include`: rdna2/{sop2,sopc,sop1,vop2,vopc}.toml, each holding only the
operand rules and forms of the family it is named after. The generator
merges them in include order, and rejects a form or rule of another
family, a rule declared twice, root keys in a family file and a missing or
repeated include. The merged registry equals the former single file, and
semantics_gen.rs is byte-identical (generate_semantics.py --check passes
unchanged). The coverage report and the RDNA2 planner read the merged
registry; their output is unchanged. Parallel work on different families
no longer edits the same file.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 07:49:07 -06:00
elforeign dffa50cd9c semantics: run the generator unit tests in CI and fail clearly below Python 3.11 (#215)
Align the merged generator tests with the pinned documents and the
complete unsupported list, add tests for the rules added after review,
run them in the existing CI step next to the coverage tests, and give
the coverage script the same explicit Python 3.11 error as the
generator instead of a traceback.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 03:40:52 -06:00
elforeign 440856a997 semantics: pin cited documents and reject a boolean schema; reject duplicate generated rows in coverage (#215)
Follow-up to the independent review: a citation can no longer point at
another file, schema = true no longer passes as 1, the coverage reader
fails on a duplicated FORM_IDS row, and 'not yet' lowering is not
counted.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 03:38:49 -06:00
elforeign afd936b20b semantics: close validation gaps found in review; check generated files in CI (#215)
The generator now rejects float widths, reserved variant names,
out-of-range pages and opcodes, Wave32 restrictions the decoder cannot
enforce yet, operand rules whose unsupported list differs from what the
decoder rejects, and undeclared or empty guide documents. The coverage
report reads decoder support from the compiled FORM_IDS table instead of
the registry, needs a decoding row before counting reference or Metal
evidence, and fails on unimplemented lowering. CI runs both --check
modes and the coverage unit tests so a stale generated file fails.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 03:36:18 -06:00
elforeign e616583c3f audit: add the semantic coverage report (#215 stage F slice)
Counts identified, encoding-validated, declared, decoder, IR/MSL,
reference and Metal evidence per encoding family, reading evidence only
from docs/status.toml so registry requirements never count as results.
Unrecognized inputs fail instead of being skipped. --check never writes.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 03:31:57 -06:00