Conflicts: CHANGELOG.md, where both entries are kept; the generated
crates/loader/src/x86_table.rs, rebuilt with generate_x86.py from the
merged instructions.toml; and one sentence of
docs/cpu/instruction-registry.md, where the list of rejected
instructions now drops both RCL/RCR (from #351) and the fences.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
`xenora probe` and `xenora imports sync` defaulted to a folder named after
one commercial game. Give both one shared default, `diagnostics/probe`, and
ignore it in Git. Keep the old ignore rules so existing local reports stay
out of commits.
Closes#364
Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>
The instruction registry document listed fences among the forms
rejected on purpose. This branch accepts them and explains why in the
new memory-ordering section, so the list no longer names them.
Signed-off-by: sahib453 <117431595+sahib453@users.noreply.github.com>
The instruction registry document listed RCL and RCR among the forms
rejected on purpose. This branch implements them, so the list no longer
names them. SHLD and SHRD stay on it.
Signed-off-by: sahib453 <117431595+sahib453@users.noreply.github.com>
Both engines refused the three fences as illegal instructions, and no
document said what ordering guest memory accesses have.
- instructions.toml, x86_table.rs (generated): the register forms of
0F AE digits 5, 6 and 7. The memory forms stay undeclared.
- x86_exec.rs: a fence changes nothing. Each engine runs one guest
instruction at a time on one host thread and completes its loads and
stores before the next, so accesses are already totally ordered.
- docs/cpu/instruction-registry.md: states that ordering, why the
fences are no-ops under it, and that it holds only while guest
threads do not run on several host threads.
- Tests: five single-thread known-answer cases, three assembled
fixtures, two rejected memory forms, and MASKMOVDQU as the refused
SSE2 instruction in cpu_features.rs now that MFENCE runs.
No multi-thread behaviour is established.
Signed-off-by: sahib453 <117431595+sahib453@users.noreply.github.com>
- Check the mapping budget before anything is mapped, and map the header
bytes straight from the file instead of copying them first.
- Refuse bytes that are not the PE32+ headers that were parsed: the
optional header magic and size, the section count, the preferred base
and SizeOfHeaders must agree before anything is patched.
- Write the load base into the mapped ImageBase field after relocations
are applied, so a DIR64 entry aimed at that field cannot move it twice.
- Describe the ImageBase rewrite as Xenora's policy, and document the
zero fill past SizeOfHeaders and the stricter page rule.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
With the overflow exception unmasked, an overflow whose result is exact
before the exponent is bounded set the MXCSR precision flag as well as
the overflow flag. The Intel SDM (Vol. 1, D.4.2.3, Table D-16) reports
precision there only if rounding with an unbounded exponent is inexact.
- softfloat.rs: Control reads the overflow mask, and round() reports
precision on an unmasked overflow only when the result was rounded.
The masked response is unchanged.
- cpu_known_answers.rs: the five exact-overflow cases are no longer an
ignored defect, three more cover the other rounding modes, and the
scalar and conversion sweeps now compare the precision flag here.
- docs/cpu/instruction-registry.md: the behaviour is no longer listed
as unasserted.
Signed-off-by: sahib453 <117431595+sahib453@users.noreply.github.com>
Address review feedback: introduce AMD RDNA2 desktop GPU (gfx1030) before the internal codename, define the LLVM three-way decoder check, document the Apple M5 status spelling, use GitHub logins in acceptance records, and mark the independence rule as proposed pending maintainer confirmation.
Signed-off-by: Vedant Dadhich <vedantdadhich21@gmail.com>
* isa, decoder: VOP3 encodings of the eleven registry VOP2 integer forms (#215)
Eleven [[encoding_variant]] entries re-encode the VOP2 integer forms as
VOP3A (_e64) under operand rule vop3_vgpr2: two VGPR sources, no
modifiers, SRC2 the unused inline zero. Opcodes from the pinned XML,
checked against llvm-mc. Decoder known words and per-bit rejections.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* fixtures, decoder, shader: LLVM-assembled fixture and goldens for the eleven VOP3 VOP2 variants (#215)
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* ref, validation: independent guide-derived oracle for VOP3 integer VOP2 forms and Wave32 VOP3 compares (#215)
crates/ref and tests/validation/independent_ref.rs decode and run the eleven
VOP3A (_e64) integer VOP2 forms and the sixteen V_CMP_*_{I32,U32}_e64 compares
writing a 32-bit lane mask to one SGPR (s0-s105) or vcc_lo, derived from the
AMD RDNA 2 guide only. New suites vop3_integer.rs and vop3_compare.rs, with
ignored native Metal parts.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* isa, decoder, shader: add VOP3A encodings for the sixteen integer compares (#215)
Sixteen gfx1030 Wave32 integer compares gain their VOP3A (_e64) encoding
as registry variants, with an explicit SGPR mask destination (guide 3.9,
13.3.3; pinned XML OPR_SREG), VCCZ branching through vcc_lo and
translation errors for reads of runtime-only SGPR results.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* fixtures, shader, validation: VOP3A compare fixture and native Metal runs (#215)
A fixture with all sixteen VOP3A integer compares (vcc_lo destination,
runtime s_cbranch_vccz) ties the new variants to fixture coverage, with
IR and MSL goldens. The VOP3 integer and compare Metal oracles now run in
the GPU gate: the translator they waited for is in this branch.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* changelog: VOP3A integer and compare encodings (#215)
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* shader, fixtures, docs: e64 compare names in the IR; status rows for the 27 VOP3A forms (#215)
The IR names a VOP3A compare by its _e64 mnemonic and prints its SGPR
destination; VOPC output is unchanged. The compare fixture now uses a
mid-range second source (so swapped unsigned opcodes change the golden)
and one plain SGPR destination. docs/status.toml and the rendered
instruction table list the 27 new forms.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* docs: use a recognized lowering phrase for the VOP3A integer rows (#215)
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* isa: VOP3A variants exist only for the 32-bit VOPC compares (#215)
After main gained the 16-bit compares (#327), the dispatch test expected a
VOP3A encoding for every non-64-bit compare. Only the 32-bit ones have one.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
---------
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* gpu: bind a texture and sampler to guest draws through descriptor tables (#303)
A guest command list had no way to bind a texture: GraphicsCommand stopped
at vertex and index buffers. This adds the smallest D3D12-shaped binding the
translated image_sample_lz pixel stage needs: shader-visible CBV_SRV_UAV and
sampler heaps, CreateShaderResourceView for one-level RGBA8 and BC1 2D
textures, a point/clamp CreateSampler, a root signature with one pixel-stage
SRV table and one sampler table, and SetDescriptorHeaps and
SetGraphicsRootDescriptorTable. Everything else fails explicitly before any
draw.
The native path hands the bound level to a textured backend.
NativeCompute::render_rgba8_sampled_bc1 binds a BC1 level natively to
fragment texture 0 and sampler 0. The software reference point-samples with
clamp addressing.
BC1 fixtures use only endpoint colours. Apple's hardware decoder gives
171/84 for the interpolated palette entries where the spec-exact decoder
gives 170/85.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* gpu: tighten guest texture binding after independent review (#303)
The independent review found binding rules that diverged from D3D12:
changing descriptor heaps kept tables bound in the old heaps, setting the
same root signature again cleared its tables, and unsupported draw shapes
were drawn as one triangle. Now heap changes and a different root signature
invalidate tables, while redundant sets keep them. Table bases are checked
against the bound heap of their type when bound. Textured draws other than
one instance of three vertices fail, and zero vertices or instances draw
nothing.
Descriptor handle offsets can no longer carry into another heap's ID. SRVs
of array or multi-level textures are rejected. A texture whose state
excludes pixel-shader reads is not sampled. Vertex buffer offsets are
overflow-checked. The tests now cover swapped root parameters, a second
sampler slot, off-centre and out-of-range coordinates, state transitions,
draw shapes and resource bounds.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* loader: format the guest texture test (#303)
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
* gpu: close the review's remaining texture-binding gaps (#303)
The re-review found three partial fixes. The public software reference
could overflow on a huge viewport. A texture in a combined write and read
state could be sampled. The sampler-slot test used two identical filled
slots. The viewport is now bounded to 4096 pixels. A sampled texture must be
COMMON or a read-only state that includes PIXEL_SHADER_RESOURCE. The sampler
heap now leaves its middle slot empty. The docs now state the start-instance
rule and when table bases are checked.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
---------
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
Windows maps the first SizeOfHeaders bytes of an image read-only at its
base, and programs read them: the mingw-w64 C runtime walks its own
section table before main. The loader mapped sections only, so that read
faulted.
Map the headers in whole 4 KiB pages before the sections, with the
optional header's ImageBase field set to the base the image is loaded
at. Refuse the load with PeError::InvalidHeaderSize when SizeOfHeaders
ends before the section table, runs past the file, or its pages reach
into a section. The header pages count toward the mapping budget.
ParsedPe::parse is unchanged.
The hand-built image in pe_mapping_limits.rs wrote SizeOfHeaders as
zero; it now writes a valid value.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
Add the promotion rule for moving desktop gfx1030 forms from local CPU and Metal results to fixture verified. The rule records clean-commit evidence, independent-runner requirements, exact commands, raw-log location, review-log summaries, failure handling and status regeneration. This is documentation only: no status rows, tests or fixtures change. Part of #302.
Signed-off-by: Vedant Dadhich <vedantdadhich21@gmail.com>
scripts/test-gpu.sh now runs vop2_vcc_matches_guide_on_native_metal,
which passes under API and shader validation.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
scripts/test-gpu.sh now runs vopc16_match_the_guide_on_native_metal:
1,572 cases in 1,420 programs pass under API and shader validation.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
v_cmp_{lt,eq,le,gt,ne,ge}_{i16,u16}_e32 (opcodes 137-142, 169-174) now
compile for gfx1030: both operands use bits 15:0 of the VGPR, SGPR or
VCC_LO source, inline integers at 16 bits, literals rejected, writing the
Wave32 VCC mask. The B1 oracle's last native Metal skip is removed.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
Declare MOVS and STOS for 8- to 64-bit elements through a new string
encoding that accepts REP, and add the direction flag with CLD and STD.
A REP form runs one element per step and stays on the instruction until
RCX is zero. Every element therefore counts against the step budget, a
repeat can stop part-way and resume, and a fault keeps the elements
already done. FS and GS apply to the MOVS source only. Both engines use
the shared semantics; there is no bulk-copy path.
Fourteen SDM-derived cases already in cpu_known_answers.rs move from
refused to verified, and ten more are now refused at their second
instruction because CLD runs. tests/cpu_rep.rs adds a byte-array model
over every form, direction and count.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
v_cndmask_b32, v_add_co_ci_u32, v_sub_co_ci_u32 and v_subrev_co_ci_u32
(VOP2 e32, Wave32) read VCC_LO as the per-lane select or carry-in; the
co_ci forms write the carry-out to VCC_LO. An independent guide-derived
oracle, tests/validation/tests/vop2_vcc.rs, checks both CPU interpreters;
its native Metal half is ignored until the lead runs it.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
scripts/test-gpu.sh now runs vopc64_match_the_guide_on_native_metal:
4,640 cases in 3,818 programs pass under API and shader validation.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
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>
v_cmp_{f,lt,eq,le,gt,ne,ge,t}_{i64,u64}_e32 (opcodes 160-167, 224-231) now
compile for gfx1030: VGPR pairs, even-aligned SGPR pairs and sign-extended
inline integers, writing the Wave32 VCC mask. The 16-bit compares stay
rejected; their native Metal oracle keeps its skip.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
CPUID returns a fixed table that never reads the host: a synthetic
vendor, and a feature bit only when every instruction of that feature
is implemented. Today that is CMOV, POPCNT, LZCNT and long mode. SSE
and SSE2 stay unreported while parts of them are rejected. Unlisted
leaves return zeros.
tests/cpu_features.rs pins every leaf in both engines, requires each
reported feature's instruction set among the executed fixtures, and
holds a refused witness instruction for each unreported feature, so a
bit cannot be set early or forgotten later.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
Declare XADD and CMPXCHG in the instruction registry for 8- to 64-bit
register and memory destinations. The LOCK prefix is accepted on the
forms the registry marks lockable and only with a memory destination;
every other use stays an illegal instruction.
Both engines run the new forms on the shared semantics. A failed
CMPXCHG still writes its destination, so it faults on memory that
cannot be written, and a fault changes nothing. The registry document
states the ordering, alignment, compare-failure and fault rules a guest
scheduler has to preserve. Nothing is lowered to ARM64 atomics.
Fourteen SDM-derived cases already in cpu_known_answers.rs move from
refused to verified. Adds 62 LLVM-assembled fixtures with reference
arms, generator checks for the lock key and tests/x86_atomic.rs.
Signed-off-by: zachdoxsee <zachdoxsee36@gmail.com>
scripts/test-gpu.sh now runs the oracle on native Metal: 752 cases in
613 programs pass under API and shader validation. Also states which half
of the oracle checks values and which checks rejection offsets (review nit).
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
The B3 oracle (#309) checks v_not_b32, v_bfrev_b32, v_ffbh_u32,
v_ffbl_b32, v_ffbh_i32 and v_swap_b32 against the guide on both CPU
interpreters, but its native Metal half was skipped because the
translator did not accept the forms. This adds the VOP1 registry file and
operand rule, decoder dispatch, IR and MSL lowering (v_swap_b32 writes
both VGPRs, each merged under EXEC), fixture and goldens, and removes
the oracle's skip from scripts/test-gpu.sh.
A new CPU test checks that the compiler accepts every case of the
oracle and rejects each of its rejections at the same word.
v_mov_b32 stays hand-written.
Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>