diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6a0a332a83..400e1d0d8d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,6 +27,9 @@ methods are still open. ## Working on the code - Python tools run with `python -I` and use only the standard library unless a file says otherwise. +- A text file a tool writes (JSON, CSV, a manifest, an assembly listing) names its line ending: `open(path, "w", + encoding="utf-8", newline="\n")`, so the output is LF on Windows too and the same input gives the same bytes on every + platform. `tests/test_text_write_line_endings.py` fails for a writer that forgets it. - `tools/rpf9dump` needs the submodule: `git submodule update --init`. - A new shader-translator rule goes into the contract table in `docs/design.md`, with how it was confirmed: a GPU test, a Mesa/LLVM reference, or a count over the corpus. diff --git a/docs/README.md b/docs/README.md index 57b9540a39..cb4a79cb97 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,8 +17,8 @@ method, scope and caveats. No game data is included. | Document | Measured content | |---|---| +| [models.md](models.md) | 382,781 models (0 decode failures) at the `e293917` pin, including 159,511 drawable-dictionary children; the other archives measure 4,686 fragments, 30,343 bone-bound and 126,301,454 triangles, while the `levels.rpf` geometry cells are not independently reproduced; the re-count table is in models.md. | | [models.md](models.md) | 382,781 models (2.64 billion triangles, 0 decode failures) at the `e293917` pin, including 159,511 drawable-dictionary children and 55,417 fragments; the re-count table is in models.md. | -| [models.md](models.md) | 350,251 models at the `917e9b9` pin, including 159,486 drawable-dictionary children; the `e293917` re-count adds 3,203 rows outside `levels.rpf`, almost all recovered fragments; `levels.rpf` recovers 343,327 models (+29,327) but was not fully exported. The per-archive table is in models.md. | | [character_models.md](character_models.md) | `packs.rpf` character parts at `e293917`: 26,585 rows / 11,335 unique names, 2,865 fragments (all a flat 25-vertex / 32-triangle 5x5 bounds grid at z=0), Lucia's 22 named records and the decoded 13-part export, the `player_story000_00` drawable set, slot-name token counts, texture coverage (184/215), and what is not decoded (fragment children, ped variation, hair, bind pose). | | [character_skeleton.md](character_skeleton.md) | Character `.#ft` fragments: the 597-name shared skeleton table (596 `joaat32` hashes), the 597-record instance tree with 580 measured parents, the model-side bone-hash mapping, and the measured vertex joint-index/skin-weight layouts (`tools/skin_streams.py`); the reference TRS is not the bind pose. | | [resource_names.md](resource_names.md) | RPF9 named-resource index: bounded-inflate lookup for `name.#dr`/`#ft`/`#dd` without the TOC. | @@ -46,8 +46,6 @@ method, scope and caveats. No game data is included. | Document | Measured content | |---|---| | [audio.md](audio.md) | AWC banks: Opus, PCM and XMA2; lossless Ogg Opus repack and WAV paths; stream names from dictionary hits with a salted control; names and subtitles written into the Ogg Opus tags. | -| [rsc8_audio.md](rsc8_audio.md) | 641,428 `RSC8` v8001 resources across 4 archives: 100% AWC tag `0x5c` facial/lip-sync `crClipDictionary` paired with 48 kHz mono Opus dialogue, 0 hidden audio containers. | -| [audio.md](audio.md) | AWC banks: Opus, PCM and XMA2; lossless Ogg Opus repack and WAV paths. | | [rsc8_audio.md](rsc8_audio.md) | 641,428 `RSC8` v8001 resources across 4 archives: 100% AWC tag `0x5c` facial/lip-sync `crClipDictionary` paired with 48 kHz mono Opus dialogue, 0 hidden audio containers; the undocumented `0x5a`/`0xd9` companion tags (1,185 `audio.rpf` streams) decoded structurally. | | [awc_shorts.md](awc_shorts.md) | Export short streamed-music idents/stings by duration; stereo-aware, no re-encode. | | [audio_config.md](audio_config.md) | The music/radio record table: 1,589 records, exact durations, AWC stream ids; no start offsets. | @@ -73,9 +71,10 @@ method, scope and caveats. No game data is included. | [buffer_bounds.md](buffer_bounds.md) | V# `OOB_SELECT` bounds measured natively: RDNA2 (gfx1036) follows Mesa's GFX11 column (729/732 cases), not GFX10; raw mode also counts `soffset`. | | [fssm_crosscheck.md](fssm_crosscheck.md) | FSSM/RDNA2 facts cross-checked against SCARAB; code starts at `code_off + 0x28`. | | [fspx.md](fspx.md) | `FSPX`, the FidelityFX DLL's native compute programs (its shaders' `ACCC` part): directory as the DLL reads it, kind-0 dispatch state, the hash prologue, `gfx1030` for its `v_dot4` code; 13 of 29 translate with `tools/fspx_unpack.py`. | +| [embedded_shaders.md](embedded_shaders.md) | DXBC containers embedded in the package's DLLs: 52 in `XboxBvhBuilder.dll` (console `FSSM` via the `XDAT`/`XBCH` record; 42/52 pass `spirv-val` today) and 29 `ACCC`/`FSPX` in the FidelityFX upscaler; the scan/extract tool and the four rules still missing. | | [coder.md](coder.md) | The compressed mass in `story000_script.rpf`: entry framing (`align16(entry+8)` payload), the 32-value tag alphabet, deflate-shaped but proprietary, variable-length 7/8-bit LSB-first codes with no stored table, and the `n7 = 116..127` search that finishes it. | | [mission_logic.md](mission_logic.md) | Mission state tables: 0x20 record layout (band counter, byte offsets), the 64-byte pool element with world transforms, case-folding joaat keys, 53.5 % of states named, 113 state-set clusters covering 82.4 % of files. | ## Other languages -Community quickstarts (stable onboarding text only; English docs remain authoritative): [i18n/README.md](i18n/README.md) (`fr`, `pt-BR`, `zh-CN`, `pl-PL`, `tr`). +Community quickstarts (stable onboarding text only; English docs remain authoritative): [i18n/README.md](i18n/README.md) (`fr`, `pt-BR`, `zh-CN`, `pl-PL`, `tr`, `ru`, `ja`). diff --git a/docs/audio.md b/docs/audio.md index 481157c9d2..d02f07d07b 100644 --- a/docs/audio.md +++ b/docs/audio.md @@ -339,7 +339,10 @@ the audio itself is not. See the ground rules in [design.md](design.md#ground-ru ## What has been checked -- 300 random Opus streams decode with ffmpeg with no errors; their lengths match the declared sample counts. +- 20 real Opus streams (6 at 48 kHz, 14 at 32 kHz) decode with ffmpeg to exactly their declared + per-channel frame counts after the EOS fix; 300 random streams decode with no errors. The earlier + "lengths match" check read the granule-derived duration, not decoded frames, so it did not catch + the backwards-EOS case. - All 1,818 XMA2 streams decode after `rpf9dump xma`. - A 4-channel streamed-music bank gives four 42.0 s mono channels with real levels and no decoder errors. - A 1-channel streamed-music descriptor can carry stereo Opus packets; it exports as one stereo Ogg with the diff --git a/docs/bvh.md b/docs/bvh.md index 16472f49ab..3c6e99ecc5 100644 --- a/docs/bvh.md +++ b/docs/bvh.md @@ -367,8 +367,18 @@ children it already points to. The tree is kept, so a refit is valid for any mot the sort. It takes 0.07 ms for 1,000 triangles and 9.8 ms for 1,000,000 on an RTX 2050, against 0.19 ms and 22 ms for a build, but the tree traverses more slowly as the geometry moves away from where it was built. -Not done yet: pairing triangles into TRI1 leaves, BOX16 nodes, compaction and copies. A higher-quality build (SAH) -would also come later. +**Copies and postbuild info.** `CopyRaytracingAccelerationStructure` with `CLONE` or `COMPACT` copies the +structure's bytes. The records are position-independent: node pointers count from the structure's start, and a TLAS +names its BLASes by address, which a clone keeps. The size comes from the source header (`totalSizeIn64BNodes`), so +a copy can follow a build in the same command list, and it is bounded by the destination resource. A build is +already exactly its layout's size, so `COMPACTED_SIZE` and `CURRENT_SIZE` (from +`EmitRaytracingAccelerationStructurePostbuildInfo` or the postbuild descs of a build) are both +`totalSizeIn64BNodes * 64`, and compaction saves nothing. Serialization, deserialization and the tools-visualization +mode are refused at replay as unsupported, not faked. In `LEONIDA_RT_AS=khr` mode the postbuild descs stay ignored, +as before. + +Not done yet: pairing triangles into TRI1 leaves, BOX16 nodes, serialization. A higher-quality build (SAH) would also +come later. ```powershell python -I tools/xdxr_bvh.py selftest --seed 1 --rays 400 # build BLASes, compare closest hits with brute force diff --git a/docs/character_models.md b/docs/character_models.md index 1838a05221..e3b5eb5755 100644 --- a/docs/character_models.md +++ b/docs/character_models.md @@ -45,7 +45,11 @@ The decoded export used by the previews contains 13 parts: Two caveats that matter for any render: -- **`body` is not a base body.** The only Lucia full-body record in `packs.rpf` is the +- **`body` is the shared player/cutscene body.** The only `lucia`-named full-body record in + `packs.rpf` is `cs_lucia_legacypedcs_fr1_000_fullbody_ws00_full` (874- and 640-vertex rows; + 1,748 / 1,816 decoded). Its `FragName` is byte-identical to `cs_monalisa` and `cs_mandy`, so it + is the shared player/cutscene body, not a unique high-detail mesh. Do not present it as a + high-detail hero body. - **`body` is not a base body.** The only `lucia`-named full-body record in `packs.rpf` is the `cs_lucia_legacypedcs` clothed legacy ped. The decoded part is 1,748 vertices / 1,816 triangles, and the manifest lists 874- and 640-vertex rows of the same drawable. Do not present @@ -126,6 +130,26 @@ have **no albedo**, so a preview must render them as clay rather than invent a c The blue in an earlier preview came from the authored `baseColorFactor` `(0.200, 0.270, 0.400)`, not from this atlas. +## Bodies + +A geometry-first census — every `packs.rpf` drawable and fragment, all 50,802 `levels.rpf` +fragments, 178,073 of 184,778 `levels.rpf` drawables (96.4%; the 6,705 above 3 MB were not +decoded), all 4,195 `story000.rpf` drawables, and the `anim.rpf` rig dictionaries — found no +Lucia or Mandy body. `story000.rpf` is mission map cells, not ped actors, and `anim.rpf`'s +`LOD0_Body_Shapes_Female` is a rig program with no mesh. + +The only **nude** continuous human-skeleton meshes are a **generic female mannequin** in +`levels.rpf`: `gmt_mannequin_proxy_f_01a` (15,488 vertices / 27,725 triangles, 95 bones, +1.72 m, A-pose) and `gmt_mannequin_f_01b` (the same body posed mid-stride). It has no Lucia or +Mandy name or texture link, and its rig is a clothing form, not the 596-bone ped skeleton (78 +of 95 bone names are shared, with mirrored limb pivots), so it is a base proxy for a +reconstruction, not Lucia's body. + +The player and cutscene body is a separate shared **clothed** fragment, +`cs_lucia_legacypedcs_fr1_000_fullbody_ws00_full` (874 v), used by `cs_lucia`, `cs_monalisa` +and `cs_mandy` (their `FragName` is identical). It is the body the game uses; it is low-poly and +clothed, so it is not a high-detail nude body. + ## What is not decoded - **Fragment children.** All 2,865 fragments export as the 25-vertex bounds cube described above. @@ -154,8 +178,11 @@ have **no albedo**, so a preview must render them as clay rather than invent a c placeholders. Across all characters, 241 of 329 hair rows are 3-vertex placeholders, but 68 have more than 100 vertices, so real hair geometry does exist for some characters. A static export of Lucia is bald by design, not by a missing decode. -- **`levels.rpf` names.** The archive has not been name-enumerated in this workspace; the negative - for a Lucia body is scoped to the named `packs.rpf` records above. +- **`levels.rpf`.** The full archive was name-enumerated: 1,116,073 streams, 98.32% inflated, + 235,814 named streams, 318,266 unique names. It contains no Lucia, Mandy, `player_story` or + `ambient_female` drawable; the Lucia and Mandy hits are props (photos, frames, luggage, a + curtain). The only human-skeleton meshes in `levels.rpf` are the generic mannequin pair in + **Bodies**. - **Bind pose and full skinning.** The delivered GLBs use identity inverse-bind matrices and do not apply the 8-influence bone-palette skinning. Prior art places inverse bind matrices at the skeleton header `+0x08`; that is not yet reproduced here, so the reference TRS remains the only diff --git a/docs/character_skeleton.md b/docs/character_skeleton.md index 757c115216..489a21c949 100644 --- a/docs/character_skeleton.md +++ b/docs/character_skeleton.md @@ -243,6 +243,39 @@ Caveats: `levels.rpf` was prefix-bounded at 4 MiB per inflated stream, raw RSC8 Bink/opaque regions were not decoded, and the encrypted RPF9 table of contents prevents a full path enumeration (27 top-level entries remain). The evidence supports a shared ped-appearance actor assembled from existing components, not a unique `mandy` resource. +The mission binding is now measured. `COM_KBOS_NEIGHB` is the internal id of the "Pipework" +mission: the replay table carries that ``, and the mission text names "Mandy's +house", "Follow Mandy" and "Bert died". Five PSIN state tables in +`pack/story000/story000_script.rpf` (`03fe4000`, `03fe8000`, `03feb000`, `03fee000`, +`03ff0000`) contain both characters as entity link hashes: `0x03A885E6` (`Mandy`) and +`0xE34ACBC8` (`Bert`); the schedule pack hash is `0x865F0DA9` +(`PSP_KeyLento_perschars_peds`). + +The model binding is also decoded. `PERSCHARS_INFO` (`data.rpf@0x1AA5F000`, record 3499) maps +`Name = 0x03A885E6` (`mandy`) to `ModelSetName = 0x03A885E6`; `CPedModelInfo__InitData` +(`packs.rpf@0x11D1FF000`, record 1219) maps that link to `cs_mandy` (`0xD7C0CDFF`). `cs_mandy` +is a live model id — a `story000.rpf` cutscene actor/voice table uses it — but there is **no +named `cs_mandy` drawable**. Its 64-bit `ModelName` is `0x009B33B7D7C0CDFF`, and its `FragName` +`0xC9888B65009B33B7` is byte-identical to `cs_lucia` and `cs_monalisa`: the shared female +cutscene-ped fragment set. The realistic full-body in that family is `cs_lucia_legacypedcs` +(874 v), so Mandy uses the same body as Lucia. Her nine-entry variation table has 18 u32 hashes; +16 are unique to her, but none resolves to a shipped drawable or texture name. + +The entities linked to Mandy carry three different per-state archetype hashes +(`0x18BB2550`, `0x73E83886`, `0x57DDFFC2`), which fits her outfit changing between states, not +three models. None of those hashes resolves through the package name dictionary, any drawable +or prop name pool, the `packs.rpf` PSOs, or a `0x7a` meta hash scan, so they are state/archetype +ids, not model names. The archetype-to-component-set table is not in the readable archives; +whether it is in the missing executable or an undecoded store is not established. + +`Mandy_FirstTingle`, `Mandy_ComingUp` and `Drug_Mandy_*` in `common.rpf` are MDMA drug effects, +not the character. They are a red herring in any `mandy` name search. + +Caveats: the RPF9 table of contents is still not decoded; names come from carving and recovery +(318,266 unique `levels.rpf` names, 24,034 `packs.rpf` names), and raw RSC8 bodies and +Bink/opaque regions were not decoded. The evidence supports a shared ped-appearance actor: a +`cs_mandy` model id, a body fragment shared with `cs_lucia` and `cs_monalisa`, and a variation +table, not a unique `mandy` drawable. ## Reproduction diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md index 6834672b70..d302291384 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md @@ -300,8 +300,6 @@ What is implemented (all of it testable without the game): yet; - `CreateRenderTargetView` / `CreateDepthStencilView` for whole resources, `TEXTURE2D`, `TEXTURE2DMS`, `TEXTURE2DARRAY` and `TEXTURE2DMSARRAY` (a slice range; 1D and 1D-array DSVs wait for 1D textures, D3D-63); - - `CreateRenderTargetView` / `CreateDepthStencilView` for whole resources, `TEXTURE2D`, `TEXTURE2DMS` and - `TEXTURE2DARRAY`; - `CopyDescriptors` / `CopyDescriptorsSimple`. A descriptor is the bytes of its slot, so a copy is a byte copy: the destination and source range lists are walked together, one descriptor at a time, and null size arrays mean one descriptor per range; @@ -380,7 +378,9 @@ What is implemented (all of it testable without the game): | `CreateCommandQueue1`'s creator ID | ignored | `CreatePlacedResource1/2` wrap the placed path above; `2` carries the castable-format list. `CreateHeap1` - remains a stub. + wraps `CreateHeap` and refuses a protected session. Both refuse, as the host does (RX 5700 and WARP, D3D-238), + an alignment other than 0, 64 KiB and 4 MiB, a heap type outside the enum, a custom heap without a CPU page + property and memory pool or a non-custom heap with either, and a heap with all three `DENY_*` flags. - `CreateSampler2` as a wrapper over `CreateSampler` (D3D-28, part 2). Without flags it writes the same S#. `D3D12_SAMPLER_FLAG_UINT_BORDER_COLOR` reads the union as integers. `(0,0,0,0)`, `(0,0,0,1)` and `(1,1,1,1)` take the S#'s transparent-black, opaque-black and opaque-white types. The S# has no separate integer types, @@ -498,9 +498,12 @@ side inwards: - `flush()` also uploads the table to its buffer: device-local memory, written from a mapped staging copy when the buffers are created (first use or growth) and with `vkCmdUpdateBuffer` for slot changes. Adding a key only puts a new entry in an empty slot, and the copy of an entry is not atomic; a running lookup that does not know - the key cannot resolve to it, which is accepted. Erasing a key compacts its probe cluster, which moves other - keys' entries, and a table that has grown gets a new buffer behind binding 2: `flush_needs_idle()` says when a - flush would do either, and the device waits for the queue before flushing in that case. + the key cannot resolve to it, which is accepted. Erasing a key empties its slot and moves no other entry + (every lookup, CPU and shader, compares all eight probe slots and never stops at an empty one), so it is + uploaded like an add. Replacing a live key's index, an insert that relocates a live entry, and a table that + has grown (a new buffer behind binding 2) change what running lookups see: `flush_needs_idle()` says when a + flush would do one of those, and the device waits for the queue before flushing in that case. Erasing used to + compact the probe cluster, which moved other keys and made every texture release wait for the whole GPU. - **`runtime/src/gfx10_descriptors.h`**: the T#, S# and V# structures (section 5.3), encoded and decoded, with their mapping to Vulkan formats, view types, component mappings and samplers. Field positions are Mesa's (`src/amd/registers/gfx10-rsrc.json`) and agree with what the translator and the GPU tests already use. Bits @@ -543,8 +546,9 @@ which has one array layer. `d3d12_descriptor_test` checks samples at four W coor volume, plus minimum-LOD clamped views (inside the mip range via `VK_EXT_image_view_min_lod`, at or below `MostDetailedMip`, and above the last mip). -Known gaps in the descriptor path: buffer shader-resource and unordered-access views and constant-buffer views -(the V# a shader would load for them; the structure is in `gfx10_descriptors.h`, the views are not written); +Known gaps in the descriptor path: buffer shader-resource views and constant-buffer views (the V# a shader would +load for them; the structure is in `gfx10_descriptors.h`, the views are not written; buffer UAVs of every kind are, +section 3.4 "Buffer UAVs", `d3d12_m4_compute_test` and `d3d12_buffer_uav_test`); 1D-array SRVs, 1D and 3D storage views, other typeless volume formats, multisampled depth/stencil and typeless color SRVs, and shader-translator lowering for multisample loads. Single-sampled depth-plane views (`R24_UNORM_X8_TYPELESS`, `R32_FLOAT_X8X24_TYPELESS`) are a T# of the texture's depth format (8_24_UNORM, X24_8_32_FLOAT) through the @@ -1148,6 +1152,38 @@ The layer's descriptor model: - image T# → `VkImageView` (format, view type, mip range, array layers) → bindless image index; - sampler S# → `VkSampler` (filter, address modes, LOD, compare, anisotropy) → bindless sampler index; - buffer V# / CBV → no Vulkan view; the descriptor already contains a console VA the shader dereferences. +- **Buffer UAVs.** `CreateUnorderedAccessView` on a buffer writes a V# in the first 16 bytes of the slot (the rest of + the 32 bytes is zero): `BASE_ADDRESS` = the resource's GPU VA + `FirstElement` * the element size, and by view kind + - *raw* (`R32_TYPELESS` + `RAW`): stride 0, `NUM_RECORDS` = bytes, `OOB_SELECT` 3 (raw); + - *structured* (`UNKNOWN` + `StructureByteStride`): stride, `NUM_RECORDS` = records, `OOB_SELECT` 0; + - *typed* (any other format the typed-UAV table has: `uav_clear.h` layouts that `gfx10_descriptors.h`'s + `format_table` names with a code below 128): `FORMAT` = the `GFX10_FORMAT_*` code, stride = the element size in + bytes, `NUM_RECORDS` = elements, `DST_SEL` = the format's own channel order (`format_swizzle`: R8 reads as + (x, 0, 0, 1), B8G8R8A8 as (z, y, x, w)), `OOB_SELECT` 1 (structured: only the index is checked against + `NUM_RECORDS`, `docs/buffer_bounds.md`). This is what `buffer_load_format_*` / `buffer_store_format_*` / the + `buffer_atomic_*` of a translated `RWBuffer` read; the translator decodes the element from the V#'s `FORMAT` + at run time (`rdna2spirv.py` `FORMATS`) and bounds-checks the whole element against `NUM_RECORDS`. A format the + layer cannot name (a typeless or 96-bit one, a compressed one, anything whose code is 128 or more, `R16G16_SNORM` + and the other texture formats `vulkan_format` has no row for) leaves a null slot, logged once. Typed clears + (`ClearUnorderedAccessViewUint/Float`) read the same V# back, so they work on these views and on game-built ones. + - **UAV counters** (`pCounterResource` + `CounterOffsetInBytes`, structured views only). D3D12 keeps the counter in + an application-visible buffer: there is no `CopyStructureCount` (that is D3D11); a game copies the counter with + `CopyBufferRegion` from `pCounterResource` at `CounterOffsetInBytes` (this is "CopyStructureCount" in D3D12 and + needs nothing from the layer), and resets it with `ClearUnorderedAccessViewUint` on a raw view of that word or a + copy from an upload buffer. The layer refuses (null slot, logged once) a counter on a non-structured view, a + counter resource that is not a buffer created with `ALLOW_UNORDERED_ACCESS`, an offset that is not a multiple of + `D3D12_UAV_COUNTER_PLACEMENT_ALIGNMENT` (4096) or leaves no room for 4 bytes, and a non-zero offset with no counter + resource, the combinations D3D12 documents as invalid. **Hypothesis for the console contract (not measured):** the + shader gets the counter as a second V#, raw, 4 bytes (stride 0, `NUM_RECORDS` 4, `OOB_SELECT` 3) at address + counter VA + offset, in **bytes 16..31 of the same descriptor slot**, which is otherwise unused for a buffer + (a V# is 16 bytes in a 32-byte slot), and `AppendStructuredBuffer` / `ConsumeStructuredBuffer` compile to + `buffer_atomic_add` / `buffer_atomic_sub` with `glc` on it, the returned old value (minus one for consume) being + the record index. Why this guess: the translator has no `ds_append` / `ds_consume` / GDS path and the corpus scan + (open-questions table below, row 10) found no GDS instruction, so a counter in memory is the only form left; where the + counter V# sits (a second slot, a user SGPR pair, a spill) is open until a shader that uses one is traced + (row 16 of the same table). `d3d12_buffer_uav_test` runs `cs_buf_counter.asm`, a hand-written shader of exactly that shape: + 256 lanes append, 128 consume, the counter reads 256 and then 128 through `CopyBufferRegion`, and the 256 + appended records are each present once. If the console puts the counter elsewhere, only `write_buffer_uav` moves. - Unbounded descriptor ranges (`NumDescriptors = UINT_MAX`) have no end. Scan from the table handle to the end of the bound heap, and cache parsed descriptors by key so unchanged slots cost nothing. **Open:** whether the game uses unbounded tables; the trace will show the root-signature ranges. @@ -1170,9 +1206,6 @@ The layer's descriptor model: `VK_EXT_image_view_min_lod`. Vulkan allows the image-view minimum to be rounded down to an integer. With nearest mip filtering, the UHD 770 and Arrow Lake Xe-LPG returned mip 0 for a 2D minimum of 0.75. The Xe-LPG also returned mip 1 for a 2D-array minimum of 1.75. RTX and Radeon returned mips 1 and 2. - On Intel integrated GPUs the layer therefore passes the clamp rounded to the nearest level - (`ceil(minLod + 0.5) - 1`), which point mip filtering selects exactly; linear mip filtering then blends from that - whole level instead of the fraction (D3D-219). `LEONIDA_MIN_LOD_INTEGER=1` or `0` forces the rounding on or off. See [Vulkan image-level selection](https://docs.vulkan.org/spec/latest/chapters/textures.html#textures-image-level-selection) and the [Intel readbacks](https://github.com/ItsNotRexed/Leonida/pull/1015#issuecomment-7075135647). If the logical device lacks the feature, the runtime logs the unsupported view @@ -1389,12 +1422,13 @@ The trace will enumerate them. - `D3D12_FEATURE_LEVELS`: report the highest feature level the Vulkan device can satisfy (12_2 when mesh/RT features are present). - `D3D12_FEATURE_SHADER_MODEL`: answer the shader model the layer can honour, not the driver's maximum. Nothing in - the runtime compiles DXIL: the game's shaders arrive as SPIR-V from the offline translator, and the only DXIL path - (the BVH builder) is lowered to standard DXIL, whose baseline is 6.0. A request above it is clamped down to 6.0, - a request for 5.1 is answered with 5.1 (D3D12's own baseline, which a caller asking for the minimum expects), and a - value below 5.1 is refused with `E_INVALIDARG`. Measured against the host PC runtime (616.86) on an RTX 5070: - 5.1-6.8 echo the request, 6.9 clamps to 6.8, and `0` is `E_INVALIDARG`; `0x5f` crashed the host runtime, which the - test records in a comment rather than repeating. WARP answers a 5.1 request the same way. + the runtime compiles DXIL: the game's shaders arrive as SPIR-V from the offline translator, and the BVH + builder's container also carries a console FSSM program that the same translator handles. A request above 6.0 is + clamped down to 6.0, a request for 5.1 is answered with 5.1 (D3D12's own baseline, which a caller asking for the + minimum expects), and a value below 5.1 is refused with `E_INVALIDARG`. Measured against the host PC runtime + (616.86) on an RTX 5070: 5.1-6.8 echo the request, 6.9 clamps to 6.8, and `0` is `E_INVALIDARG`; `0x5f` crashed + the host runtime, which the test records in a comment rather than repeating. WARP answers a 5.1 request the same + way. - `D3D12_FEATURE_ROOT_SIGNATURE`: 1.1, the version the proxy can always produce. A 1.2 blob is rewritten as 1.1 when the host's serializer stops at 1.1 and nothing is lost (`d3d12_xs_rootsig.cpp`), and Windows 10's `d3d12.dll` stops there, so 1.1 is what the game can rely on everywhere. A higher request is clamped down like the shader model, and @@ -1434,8 +1468,9 @@ The trace will enumerate them. - `MIP` wherever the image can have more than one level. - `SHADER_GATHER` with `SHADER_SAMPLE` (not `A8_UNORM`, whose swizzled view isn't verified for gathers). - `UAV_TYPED_LOAD` with every typed UAV. Typed UAV texture reads use the sampled binding (`image_read_typed`), - not a storage-image read. Typed buffer UAVs share the store side's gaps: the layer creates no buffer UAV - views yet, and `rdna2spirv.py` `FORMATS` decodes only some buffer formats (no SINT, 8/16-bit UINT, 10_11_11). + not a storage-image read. Typed buffer UAVs: the layer now writes their V# (section 3.4, "Buffer UAVs"); the + gap left is `rdna2spirv.py` `FORMATS`, which decodes only some buffer formats (the 32-bit SINT ones, but no + 8/16-bit SINT/UINT other than the RGBA8 and RGBA16 UINT ones, and no 10_11_11). - The UAV atomic bits other than exchange for `R32_UINT`, whose UAV views get the `r32ui` storage view. Today that works on 2D UAVs only: the translator's image atomics and the `r32ui` slots cover 2D and 3D, and the layer creates no 3D UAV views yet. There is no `image_atomic_swap`, and `R32_SINT` gets no `r32ui` view. @@ -2156,24 +2191,23 @@ own names use the `XDXR` prefix for Xbox's raytracing path: node format: node id = address >> 3 | type, box16/box32/triangle nodes, 256-byte base units. That is the format the runtime must produce for the game's compute traversal. -**The builder's own shaders are a separate problem.** They are Xbox DXIL using `@xbox.*` intrinsics, not FSSM -RDNA2: prior art found 44 of the 53 call non-standard `@xbox.*` functions and fail the PC D3D12 shader compiler, -and 22 have been lowered to standard DXIL and accepted as pipelines on an RX 7800 XT. Thirty-one of the 53 use raw -64-bit addresses (global load/store/atomic and `s_load`), so lowering also needs an address-to-resource mapping. -The existing FSSM translator does not cover these shaders, and their results are not yet checked against a -reference. If the game uses the builder, the layer needs a DXIL path (or a substitute builder); this is on the -critical path for the RT effects, not a footnote. +**The builder's own shaders are console FSSM, not Xbox DXIL.** Each of the 52 containers carries an LLVM +bitcode blob and an `XDAT`/`XBCH` record; the PC experiment below compiled the bitcode, but the console runtime +executes the `XBCH` record. Measured from that record: 52/52 unpack to `FSSM`, 42 translate and all 42 pass +`spirv-val` with the same translator the game's 26,503 shaders use; the 10 left need `global_atomic_fmax`/`fmin`, +`buffer_load_ushort` and `tbuffer_load_format_x` with format 8 ([embedded_shaders.md](embedded_shaders.md)). The +raw 64-bit addresses are the corpus's existing raw-address path, not a separate lowering. Open: whether the game +uses the builder at all (RT-5) and whether the translated programs match a reference on a GPU. The design choice follows from that: **build AMD-format BVH data, not a `VkAccelerationStructureKHR`, unless the shaders are changed to `OpTraceRayKHR`.** The game's 64 RT compute shaders traverse the nodes themselves; a Vulkan AS would be invisible to them. Two paths: 1. If `XboxBvhBuilder` does the build with its own compute dispatches (the likely case, given it ships as a DLL - with a device and command lists), the layer must translate and run its Xbox DXIL compute shaders — it cannot - feed DXIL to Vulkan directly. Buffers, UAVs, descriptors, barriers and indirect dispatch are necessary but not - sufficient; the 53 builder shaders need the DXIL path described above, and the 31 raw-address shaders need a - VA-to-resource mapping. The standard `BuildRaytracingAccelerationStructure` calls may never reach our command - list. + with a device and command lists), the layer must translate and run its compute shaders. The console programs + are `FSSM` and 41 of the 52 already pass `spirv-val`; the ten above still need their four rules. Buffers, + UAVs, descriptors, barriers and indirect dispatch are necessary but not sufficient. The standard + `BuildRaytracingAccelerationStructure` calls may never reach our command list. 2. If the game calls `ID3D12GraphicsCommandList4::BuildRaytracingAccelerationStructure`, the layer must implement it. Produce the AMD node layout in the arena, with the same geometry/instance rules the translator assumes, and make `GetRaytracingAccelerationStructurePrebuildInfo` return sizes for that layout. @@ -2183,7 +2217,9 @@ Vulkan AS would be invisible to them. Two paths: and answers `GetRaytracingAccelerationStructurePrebuildInfo` from its layout, exactly. Acceleration-structure buffers then keep their console VAs, the addresses the records name each other by. `LEONIDA_RT_AS=khr` keeps #743's `VkAccelerationStructureKHR` builds (for `RayQueryKHR`), which the game's shaders can't read. Updates refit - the source structure instead of rebuilding it ([bvh.md](bvh.md) §7a); compaction, copies, serialization and the Xbox batched/streaming builds are not implemented. The + the source structure instead of rebuilding it, `CopyRaytracingAccelerationStructure` clones and compacts, and the + postbuild compacted and current sizes are written ([bvh.md](bvh.md) §7a). Serialization and the Xbox + batched/streaming builds are not implemented. The reported `RaytracingTier` is unchanged (`NOT_SUPPORTED`). Checked by `runtime/test/d3d12_xdxr_rt_test.cpp` through the D3D12 API. @@ -2423,10 +2459,10 @@ M0–M2 do not need the executable. | **M1** | Root signature with root constants (mask the measured `0x03000000` flag byte on a copy), one translated VS+PS, PSO, vertex buffer in the arena, draw, push constants `s0..s31` + heap base | PSO translation, shader hash lookup, vertex input, root-constant packing, heap base, present | The triangle matches a CPU/GPU reference; the existing texture-test style comparison passes with error 0. **Met with stand-in shaders** by `d3d12_draw_test`: every pixel of two indexed draws and a culled triangle matches, through the proxy, validation clean. With translated game shaders most of them declare bindings, which M2 (pipelines bind set 0) lets through. **M1.5 (D3D-53) met with translator output** by `d3d12_translated_draw_test`: see below | | **M1.5** | The same, with real translator output: hand-written RDNA2 VS+PS, PSO found by FSSM hash, vertex fetch through a V# loaded from the user-data table, a root constant, a table in the arena, the code base | The push-constant, vertex-fetch and code-base contracts on translated code | Met by `d3d12_translated_draw_test`: three draws, every pixel off the triangle's edge exact in a float target, validation clean on the AMD Radeon 880M and the RTX 5070 Laptop. An upload buffer behind a V# is not supported (section 3.3) | | **M2** | Descriptor heap (heap slots 9/10 return in RAX), `CreateShaderResourceView`, sampler, root descriptor table, hash-table insert, bindless sampling | The full D3D12 descriptor path and the shader's T#/S# contract | A textured quad matches the synthetic 8×8 gradient or a known texture with error 0; the hash table has the expected entries. **Synthetic part met** by `d3d12_m2_textured_test`: through the proxy, D3D12 API only, a shader-visible CBV/SRV/UAV heap and a sampler heap (start handles from slots 9/10), two 8×8 textures uploaded with `Map` + `CopyTextureRegion`, `CreateShaderResourceView` and a POINT `CreateSampler`, a root signature of two descriptor tables, `SetDescriptorHeaps`, `SetGraphicsRootDescriptorTable` and `DrawIndexedInstanced` of a quad whose PS is translator output (`ps_m2.asm`: `s_load` of the T# and the S# from the tables, `image_sample`). Every one of the 4096 pixels matches the CPU-computed gradient (left half) and its point reflection (right half, second table) with error 0, and the hash table holds a distinct non-zero index for each of the two T#s and the S# and none for bytes nothing created; validation clean on the AMD Radeon 880M and the RTX 5070 Laptop. The layer change it needed: pipelines whose shader declares set-0 bindings (graphics and compute) were refused; their layout now holds the device's bindless set 0 and replay binds it at every draw and dispatch. Still open: shaders of the game itself (direct heap indexing, unbounded tables, static samplers, descriptors the game writes itself), no host D3D12/WARP byte comparison (the reference is computed on the CPU), and texture formats other than R8G8B8A8_UNORM, mips and arrays through a PSO (the descriptor test covers views and sampling on a compute shader) | -| **M3** | Depth/stencil, multiple render targets, resource barriers, render passes, occlusion queries, fences, 2–3 frames in flight; run the game's first frames | Real frame structure and the first game code | The game reaches its first rendered frame (loading screen/menu or whatever the executable does) or stops on a single unsupported call with a clean report. **Synthetic part met** by `d3d12_m3_frame_test`: through the proxy, D3D12 API only, six frames through a ring of three slots (three frames in flight; each slot has its own allocator, list, targets, depth buffer, query and fence, and a frame waits with `SetEventOnCompletion` + an event for the fence its slot signalled three frames earlier before reading back and recording the slot again). Pass 1 draws three rectangles from root constants with translator-output shaders (`vs_m3.asm`, `ps_m3.asm`, hand-written RDNA2) through `OMSetRenderTargets` into two render targets (R8G8B8A8_UNORM and R32_FLOAT) and a `D24_UNORM_S8_UINT` depth/stencil buffer (the layer substitutes D32_SFLOAT_S8_UINT on the Radeon; the RTX has it natively): depth LESS with write, stencil REPLACE with references 1 and 2, then a draw with no depth test whose stencil test is EQUAL; the far rectangle runs inside `BeginQuery`/`EndQuery(OCCLUSION)` and `ResolveQueryData` writes its sample count to a readback buffer. Resource barriers move the first target RENDER_TARGET → PIXEL_SHADER_RESOURCE\|COPY_SOURCE and the second to COPY_SOURCE (and back at the next frame, from resources created in those states). Pass 2 samples the first target through an SRV in a descriptor table (the M2 path) with `ps_m3_post.asm` into a third target. Every pixel of all three targets (the float one bit for bit) matches the CPU reference with error 0 in each of the six frames, and the occlusion count equals the exact visible area of the far rectangle in each frame (3555 samples over the six frames); validation (with synchronization validation) clean on the AMD Radeon 880M and the RTX 5070 Laptop. **Still open for M3:** render passes (`BeginRenderPass`, D3D-27) are not exercised, nor `BINARY_OCCLUSION`, occlusion during pipeline statistics (D3D-162), MSAA or depth/stencil copies and read-only DSV states in this test; the game's own first frames need the executable | -| **M4** | Compute PSOs, UAVs, storage images, indirect dispatch, copy queues, async streaming | Asset loading and GPU compute | The world's streaming path runs without device loss; compute results match a CPU/reference check | +| **M3** | Depth/stencil, multiple render targets, resource barriers, render passes, occlusion queries, fences, 2–3 frames in flight; run the game's first frames | Real frame structure and the first game code | The game reaches its first rendered frame (loading screen/menu or whatever the executable does) or stops on a single unsupported call with a clean report. **Synthetic part met** by `d3d12_m3_frame_test`: through the proxy, D3D12 API only, six frames through a ring of three slots (three frames in flight; each slot has its own allocator, list, targets, depth buffer, query and fence, and a frame waits with `SetEventOnCompletion` + an event for the fence its slot signalled three frames earlier before reading back and recording the slot again). Pass 1 draws three rectangles from root constants with translator-output shaders (`vs_m3.asm`, `ps_m3.asm`, hand-written RDNA2) through `OMSetRenderTargets` into two render targets (R8G8B8A8_UNORM and R32_FLOAT) and a `D24_UNORM_S8_UINT` depth/stencil buffer (the layer substitutes D32_SFLOAT_S8_UINT on the Radeon; the RTX has it natively): depth LESS with write, stencil REPLACE with references 1 and 2, then a draw with no depth test whose stencil test is EQUAL; the far rectangle runs inside `BeginQuery`/`EndQuery(OCCLUSION)` and `ResolveQueryData` writes its sample count to a readback buffer. Resource barriers move the first target RENDER_TARGET → PIXEL_SHADER_RESOURCE\|COPY_SOURCE and the second to COPY_SOURCE (and back at the next frame, from resources created in those states). Pass 2 samples the first target through an SRV in a descriptor table (the M2 path) with `ps_m3_post.asm` into a third target. Every pixel of all three targets (the float one bit for bit) matches the CPU reference with error 0 in each of the six frames, and the occlusion count equals the exact visible area of the far rectangle in each frame (3555 samples over the six frames); validation (with synchronization validation) clean on the AMD Radeon 880M and the RTX 5070 Laptop. @whattheflop's run on #1584 (GeForce RTX 3080 and a Ryzen 7 9800X3D Radeon iGPU) sampled the fences with nonblocking reads after each submit and saw 1, 2, 3, 1, 2, 3 slots still incomplete on NVIDIA and 1, 1, 1, 1, 1, 1 on AMD: up to three slots in flight on NVIDIA, one on AMD (sampled fence completion; GPU execution overlap was not measured). **Still open for M3:** render passes (`BeginRenderPass`, D3D-27) are not exercised, nor `BINARY_OCCLUSION`, occlusion during pipeline statistics (D3D-162), MSAA or depth/stencil copies and read-only DSV states in this test; the game's own first frames need the executable | +| **M4** | Compute PSOs, UAVs, storage images, indirect dispatch, copy queues, async streaming | Asset loading and GPU compute | The world's streaming path runs without device loss; compute results match a CPU/reference check. **Synthetic part met** by `d3d12_m4_compute_test`: through the proxy, D3D12 API only, with translator-output compute shaders (`cs_m4_fill.asm` and `cs_m4_indirect.asm`, hand-written RDNA2). A COPY queue streams an input buffer in (`CopyBufferRegion` from an UPLOAD buffer into a DEFAULT buffer created in COMMON), `Signal`; a COMPUTE queue `Wait`s on it and runs one list: a compute root signature (four root constants and a descriptor table of five UAVs: a structured buffer, three raw buffers and an `R32_UINT` `RWTexture2D`), a compute PSO and `Dispatch` (256 threads) that fills the structured buffer and the image from the input and writes the arguments of the next dispatch into a raw buffer; barriers (the argument buffer to `INDIRECT_ARGUMENT`, UAV barriers on the buffer and the image); `ExecuteIndirect` with a dispatch command signature running a second PSO for the 3 groups the first dispatch asked for, which reads the buffer and the image back (`image_load`) and writes a raw output; then everything to COMMON and `Signal`. A COPY queue `Wait`s on that fence, copies the five results (the image through `CopyTextureRegion`) to a readback buffer, and the CPU waits with `SetEventOnCompletion`. Each D3D12 queue has its own `VkQueue` where the family has two (both test GPUs); all 1,924 result words match the CPU reference with error 0; validation (with synchronization validation) clean on the AMD Radeon 880M and the RTX 5070 Laptop. Layer gaps this test found, closed with it: buffer UAVs (structured and raw) were not written (`CreateUnorderedAccessView` stubbed them, now a V# in the slot); `ExecuteIndirect` of a dispatch ran whatever pipeline and root arguments the command buffer had bound instead of the list's (now recorded with the command, as `Dispatch` does); an image created in `UNORDERED_ACCESS` and first used by a shader was zero-filled by the first barrier or copy that named it, losing the shader's writes (now moved to GENERAL, zeroed, by the first submission after its UAV view is created that is not on a copy queue and dispatches or draws; every other queue's next submission waits for that one). **Still open for M4:** the storage-image initialization is tied to the first shader-running submission, not to the list that uses the image, so a list that only reaches an image through a barrier or copy before any dispatch or draw is submitted still zero-fills it first (as before), and an image used by a shader only on a queue that never runs one of its own dispatches or draws first relies on another queue's submission; buffer SRVs and CBVs as V#s (typed buffer UAVs and UAV counters are done: `d3d12_buffer_uav_test`, section 3.4 "Buffer UAVs"), a queue submitted before the queue whose fence it waits on, when a resource's layout is handed over between them (the layout tracker follows submission order, so the copy list was replayed against the layout from before the compute list ran and the run stopped on a validation error; d3d12_queue_wait_test covers Wait-before-Signal without a resource), `ExecuteIndirect` signatures that change root arguments or use count buffers for dispatches, and async streaming itself and the world's streaming path, which need the game | | **M5** | Mesh shaders, `ExecuteIndirect`, bindless-table pressure, multi-threaded command lists, pipeline cache | World rendering | A stable open-world frame at any frame rate; then profile and optimise | -| **M6** | Ray tracing/XDXR: standard AS builds or the shipped `XboxBvhBuilder` compute path; BVH node format; Xbox DXIL path for the builder's 53 shaders (22 lowered so far) | RT shadows and any RT effects | RT output matches a reference; the builder's shaders run through the DXIL path or a substitute; no unknown XDXR call remains | +| **M6** | Ray tracing/XDXR: standard AS builds or the shipped `XboxBvhBuilder` compute path; BVH node format; the builder's 52 console `FSSM` programs (42 pass `spirv-val`, four rules left: [embedded_shaders.md](embedded_shaders.md)) | RT shadows and any RT effects | RT output matches a reference; the builder's shaders run through the `FSSM` translator or a substitute; no unknown XDXR call remains | | **M7** | HDR, VRS, `PresentX` planes (2-plane HDR + GameDVR compose, `ImmediateThresholdPercent`), resize, alt-tab, `SuspendX`/`ResumeX`, frame pacing and `GetFrameStatisticsX` | Presentation polish | HDR and resize work on the target display; no validation errors over a long run. **Partly met:** `ImmediateThresholdPercent` (late frame flipped at once through `VK_KHR/EXT_swapchain_maintenance1` IMMEDIATE/FIFO_RELAXED, section 4.5; checked on the fake-clock decision and on the Vulkan present mode, 0 VUIDs in our runs with `LEONIDA_VK_VALIDATION=1` on two GPUs, no tearing observed on a display; the console's real semantics are unmeasured). `SuspendX`/`ResumeX`, frame pacing and a minimal `GetFrameStatisticsX` exist; HDR, VRS, plane compose, alt-tab are open | ### 6.1 Minimum API set for the first frame @@ -2480,7 +2516,7 @@ DLLs were executed against a PC D3D12 device through the Xbox-ABI proxy. | Xbox root-signature descriptors carry flags `0x03000000`. The PC serializer rejects them with `E_INVALIDARG`; the proxy clears the high byte on a copy. The v1.0 `D3D12SerializeRootSignature` path keeps flags at +32, and `0x3000001` also fails on the PC runtime. | *Run* — [PLATFORM_SURFACE.md](https://github.com/realdody/americas-recomp/blob/xbox-series/docs/xbox/PLATFORM_SURFACE.md) | Narrows the root-signature reflection risk. Mask the high byte on a private copy; the meaning of the bits remains **Open**. See section 3.5. | | The BVH builder's constructor creates 53 compute pipelines through device slot 62, called with a compute-PSO shape (a plain `D3D12_COMPUTE_PIPELINE_STATE_DESC`, two zero words, iid, out). On the PC interface the prior art forwards to, slot 62 is `CreateStateObject` (wrong arity), so the proxy overrides it. | *Run* — [PLATFORM_SURFACE.md](https://github.com/realdody/americas-recomp/blob/xbox-series/docs/xbox/PLATFORM_SURFACE.md) | Corrects the assumption that the whole device vtable is public order. Slot 62 must be compute-PSO creation for the builder, not a state object. Slots 1/15/18/19/27/38 did match the desktop order. | | A reusable `xbox_device_proxy.h` forwards every slot to a PC object, counts hits per slot and logs first calls with `XS_TRACE=1`; the observed device slots include 1, 14, 15, 16, 18, 19, 27, 38, 62 and 76. Their `xgr` stand-in covers 48 of 398 methods; Xodus (LGPL-2.1) covers 152 of 396 via IDL-generated stubs. | *Run* — [platform README](https://github.com/realdody/americas-recomp/blob/xbox-series/tools/xbox/platform/README.md), [PLATFORM_SURFACE.md](https://github.com/realdody/americas-recomp/blob/xbox-series/docs/xbox/PLATFORM_SURFACE.md) | Confirms the trace-first approach and shows the long tail. We adopt the *method* (per-slot counters, first-call logging), not the code. | -| The BVH builder's 53 compute shaders are Xbox DXIL with `@xbox.*` intrinsics; 44 of 53 fail the PC D3D12 shader compiler, 22 have been lowered to standard DXIL and accepted as pipelines, and 31 use raw 64-bit GPU addresses. | *Run* — [PLATFORM_SURFACE.md](https://github.com/realdody/americas-recomp/blob/xbox-series/docs/xbox/PLATFORM_SURFACE.md) | A separate translation path from the FSSM RDNA2 corpus. See section 4.8 and the paragraph below. | +| The BVH builder's 53 compute shaders are Xbox DXIL with `@xbox.*` intrinsics; 44 of 53 fail the PC D3D12 shader compiler, 22 have been lowered to standard DXIL and accepted as pipelines, and 31 use raw 64-bit GPU addresses. | *Run* — [PLATFORM_SURFACE.md](https://github.com/realdody/americas-recomp/blob/xbox-series/docs/xbox/PLATFORM_SURFACE.md) | A separate translation path from the FSSM RDNA2 corpus when measured on the **bitcode**. Measured later on the console `XBCH` record of the same containers: 52 programs, 42 pass `spirv-val` through the FSSM translator ([embedded_shaders.md](embedded_shaders.md)). | ### 7.1 What this confirms, corrects and narrows @@ -2509,9 +2545,9 @@ DLLs were executed against a PC D3D12 device through the Xbox-ABI proxy. Xbox value and slot 76. - **Root signatures.** The `0x03000000` flags must be masked on a copy before the host serializer/deserializer. Our earlier "forward the blob to the host" was too simple; the PC serializer rejects the Xbox bits. -- **BVH builder.** Its shaders are Xbox DXIL, not FSSM. "Run the builder's dispatches" therefore needs a DXIL - translation/lowering path plus an address-to-resource mapping for the raw-address shaders; the FSSM translator - does not cover them. +- **BVH builder.** Its console programs are `FSSM`; the bitcode in the same container is the representation the + PC compiler consumed. "Run the builder's dispatches" therefore takes the same FSSM → SPIR-V path as the game, + with four rules still missing ([embedded_shaders.md](embedded_shaders.md)). **Narrows.** @@ -2526,16 +2562,18 @@ DLLs were executed against a PC D3D12 device through the Xbox-ABI proxy. - The `xgr` 48/398 and Xodus 152/396 coverage numbers show how large the long tail is. They do not change the plan: implement what the game calls, in the order it calls it. -### 7.2 The BVH builder's Xbox DXIL path +### 7.2 The BVH builder's shader path -The builder's 53 compute shaders are a second shader front end. They are Xbox DXIL with `@xbox.*` intrinsics that -map one-to-one to RDNA instructions (global load/store/atomic with 64-bit addresses, `s_load`, min/med/max, -bitfield insert, alignbyte, cndmask, packed f16 min/max and lane/wave operations). The standard PC DXIL compiler -rejects 44 of the 53; 22 have been lowered to standard DXIL and compile; the 31 that use raw 64-bit addresses also -need a table mapping those addresses to resources. This is separate from the FSSM RDNA2 translator, which covers -the game's 26,503 shaders. A port that uses `XboxBvhBuilder` needs both: FSSM → SPIR-V for the game, and an Xbox -DXIL → standard DXIL → SPIR-V path (or a substitute builder) for the BVH helper. The prior art has compiled -lowered shaders but has no reference output yet, so correctness is unverified. +The builder's 52 compute shaders are a second *corpus*, not a second shader front end. Each container carries an +LLVM bitcode blob and an `XDAT`/`XBCH` record; the bitcode is what the PC D3D12 compiler experiment consumed +(44 of 53 rejected, 22 lowered), while the console runtime executes the `XBCH` record. That record decompresses +to `FSSM`, the same container the game's own compute shaders use: 52/52 unpack, 42 translate and all 42 pass +`spirv-val` with `tools/rdna2spirv.py`. The 10 left stop at `global_atomic_fmax`/`fmin` (6 programs), +`buffer_load_ushort` (3) and `tbuffer_load_format_x` with format 8 (1); [embedded_shaders.md](embedded_shaders.md) +lists them. The raw 64-bit addresses are the translator's existing raw-address path, so no address-to-resource +table is needed on top. A port that runs `XboxBvhBuilder` therefore needs the FSSM translator plus four rules, +not a DXIL front end (a substitute builder remains the alternative). +Correctness is still unverified on a GPU and the call sites need the executable (RT-5). ### 7.3 Licence @@ -2558,7 +2596,7 @@ Xodus is LGPL-2.1 and is cited only for its coverage number, not as a code sourc absent executable. - The prior art's measured Xbox ABI (section 7): 6 Xbox-specific static imports across the 16 DLLs, `D3D12XboxCreateDevice`, device slots 62/76, descriptor-heap start handles in RAX, root-signature flags - `0x03000000`, and the BVH builder's Xbox DXIL shaders. + `0x03000000`, and the BVH builder's container format (a DXIL bitcode blob plus the console `XBCH` record). ### 8.2 Unknown / open questions @@ -2570,7 +2608,7 @@ Xodus is LGPL-2.1 and is cited only for its coverage number, not as a code sourc | 4 | Are Xbox descriptor bytes GFX10 T#/S#, and what are the heap increments? Does the game use `Create*View` or build descriptors itself? | Dump a shader-visible heap after the first `CreateShaderResourceView` and after the first draw; compare the bytes the shader loads with the T# parser. The start-handle return ABI is known (RAX); the increment values still need measuring. | | 5 | What is the buffer/descriptor/code VA range, and what arena capacity is needed? | Log every `GetGPUVirtualAddress` and every descriptor base; track the high-water mark. Choose a capacity; grow at a frame boundary if needed. | | 6 | Which swapchain/present path is used: DXGI, `PresentX`, or both? | **Partly answered from public samples (§4.5):** GDKX samples use `PresentX` + frame events and no DXGI swapchain (DXGI only for `IDXGIDevice1`→adapter→output). Hypothesis for the game, not observed: same. Still open: vtable slots, `D3D12XBOX_*` layouts, and whether the game also creates a swapchain. Check imports and the first present call. Implement the `PresentX` + frame-event presenter first; keep DXGI swapchain as fallback. | -| 7 | Does the game build acceleration structures through the standard D3D12 calls or through `XboxBvhBuilder`'s own compute path? | Log `BuildRaytracingAccelerationStructure`, `CopyRaytracingAccelerationStructure`, `Emit...PostbuildInfo`, and the builder's command-list method calls on the first RT frame. The builder's 53 shaders are Xbox DXIL; 44/53 fail the PC compiler and 22 have been lowered. If the builder path is used, the layer needs a DXIL plan. | +| 7 | Does the game build acceleration structures through the standard D3D12 calls or through `XboxBvhBuilder`'s own compute path? | Log `BuildRaytracingAccelerationStructure`, `CopyRaytracingAccelerationStructure`, `Emit...PostbuildInfo`, and the builder's command-list method calls on the first RT frame. The builder's container carries a DXIL bitcode blob and a console `XBCH` record; the record is `FSSM` and 42 of 52 programs pass `spirv-val` ([embedded_shaders.md](embedded_shaders.md)). If the builder path is used, translate the `XBCH` record rather than the bitcode. | | 8 | What are the layouts of `D3D12XBOX_XDXR_STREAM_DESC`, the batched build desc, and the offline statistics desc? | **Measured** from `XboxBvhBuilder.dll`'s reads ([xdxr.md](xdxr.md)): `BATCHED_DESC2` (`0x50`) and `XDXR_STREAM_DESC` (`0x10`) with every field's offset, and the stream records' offsets, types and defaults. Still open: the record names, and the offline statistics layout, which the DLL never writes (it rejects that postbuild type). | | 9 | Xbox texture creation is device slot 76 with layout `0x101` (tiled) or `0x1` (row-major). What is the tiled data layout, and does the game upload console-tiled or DCC data? | Trace slot 76, `CopyTextureRegion` and the resource descs. If the game uploads console-tiled data, add a detile step or a matching layout. | | 11 | What should `CheckFeatureSupport` answer for UMA, resource binding tier, mesh tier, RT tier? | **Implemented** (D3D-11). Reports truthful host architecture (discrete desktop GPU: non-UMA), ResourceBindingTier 3 (descriptor indexing / bindless support), 48-bit GPU virtual address support matching the arena, and maps `D3D12_FEATURE_FORMAT_SUPPORT` to Vulkan format properties plus multisample render-target/resolve support and one quality level per supported sample count. | @@ -2579,11 +2617,12 @@ Xodus is LGPL-2.1 and is cited only for its coverage number, not as a code sourc | 10 | Does the game use binning, DCC, VRS, wave MMA, stream output, tessellation, or amplification shaders? | **Shaders: answered** by `tools/feature_scan.py` over all 26,503 (1.0.2.1): no hull, domain or amplification shader (DXIL program kinds: 2,236 VS, 12,101 PS, 195 GS, 2,689 CS, 9,282 MS); no `WAVE_MMA` or `SHADING_RATE` in any SFI0, and no `v_mfma`/`v_wmma`/`v_smfmac` in the disassembly; no output-signature element on a stream other than 0 (all 195 GS write stream 0 only) and no GDS / `ds_ordered_count` / GWS instruction, so no stream-output path. Also from SFI0: 10 PS need ROVs (pixel interlock), 30 shaders `TILED_RESOURCES` (see #18), 685 `ATOMIC_INT64_ON_TYPED_RESOURCE`. Binning and DCC are not shader-visible; they stay open for the PSO/stream subobjects. | | 14 | Are there PSOs with two code-base stages? | Count from the PSO/shader hash table and the index metadata. If yes, implement per-stage code-base slots (section 5.2). **Per stage, measured** (`tools/feature_scan.py`, `s_getpc_b64` kept for data rather than a far branch): 54 VS, 93 PS, 266 MS, 263 CS, 0 GS; the translator's `uses_code_base` gives the same counts (with LLVM 23 that needs #223, without which these 1,471 shaders are rejected). So VS+PS and MS+PS pipelines with two code-base stages are possible; whether any exists depends on which shaders a PSO pairs, which is in the executable, not in `shaders.rpf`. | | 15 | Is `ExecuteIndirect` used with signatures Vulkan cannot express directly? | Trace `CreateCommandSignature` and `ExecuteIndirect`; implement simple signatures first, expand the complex ones with compute. The simple signatures are D3D-17 (#313). | -| 16 | Does the game use append/consume UAV counters or typed buffer formats the translator does not model? | Trace UAV descs and shader `buffer_*` ops; extend the translator/runtime together. | +| 16 | Does the game use append/consume UAV counters or typed buffer formats the translator does not model? | **Shaders: answered** by `tools/feature_scan.py` over all 26,503 (1.0.2.1, disassembled with LLVM 21.1.8 for gfx1013; SHADER-65). **No append/consume counters:** none of the 445,394 PSV0 binding records is a structured UAV with a counter, and there is no `ds_append`/`ds_consume`/GDS instruction. Typed buffers are declared in 5,359 shaders as SRVs (17,328 records) and in 2,177 as UAVs (4,005). **MTBUF** (format in the instruction): 52,890 loads in 10,278 shaders, all in five formats the translator decodes (`16_16_SNORM` 24,881, `8_8_8_8_UNORM` 19,835, `8_8_8_8_UINT` 5,099, `2_10_10_10_UNORM` 2,648, `16_16_16_16_UINT` 427), and no MTBUF store. **MUBUF** `buffer_*_format_*` (format from V# word 3): 90,316 accesses (84,908 loads, 5,408 stores) in 11,591 shaders; word 3 comes from a scalar load in 88,924 of them, is computed in 1,390, and is a literal in 2 (FORMAT 0, INVALID, which reads 0 on the hardware and in the translator). So the shaders fix no MUBUF format: the descriptors the executable writes decide it. Still open: which formats those descriptors carry; the runtime can log a V# format outside `Gen.FORMATS` (those read 0 today) when the descriptor is created or copied. | +| 16 | Does the game use append/consume UAV counters or typed buffer formats the translator does not model? | Trace UAV descs and shader `buffer_*` ops; extend the translator/runtime together. **Runtime side done, console side open:** the layer writes typed buffer V#s and a counter V# (a hypothesis for where the shader finds it, section 3.4 "Buffer UAVs"); whether the game uses either is for the trace. | | 17 | Do upload/readback resources ever reach shaders (as vertex/index buffers or descriptors), and does the `-heap_base` bias work for them? | Trace `CreateCommittedResource` heap types and every VB/IB/descriptor that points at an upload resource; test the bias with a synthetic draw. | | 18 | Does the game alias buffers/images in a heap, or use reserved/tiled resources? | Trace `CreatePlacedResource` ranges, aliasing barriers, `CreateReservedResource` and tile mappings. If yes, implement shared memory per heap range or fall back to linear allocations with a clear log. Shaders: 30 declare `TILED_RESOURCES` in SFI0 (`tools/feature_scan.py`), so reserved/tiled resources are likely used. Placed resources are D3D-16 and reserved resources D3D-20 (#313). | | 19 | What do the `0x03000000` root-signature flag bits mean? | Masking them on a copy works around the PC serializer; the semantics remain unknown. Compare against the public flag enum and observe the game's behaviour with and without the mask. | -| 20 | Which of the BVH builder's 53 Xbox DXIL shaders does the game actually use, and can the 31 raw-address shaders be lowered without a reference? | Dump the slot-62 compute PSOs on the first RT frame; lower and compile each; compare against the builder's CPU validation (`CpuValidateResultX`) or a captured reference. | +| 20 | Which of the BVH builder's 52 `FSSM` programs does the game actually use, and do the translated programs match a reference? | Dump the slot-62 compute PSOs on the first RT frame and map each to its container by the `ILDN` name; 42/52 pass `spirv-val` today and the four missing rules are named in [embedded_shaders.md](embedded_shaders.md); compare against the builder's CPU validation (`CpuValidateResultX`) or a captured reference. | | 21 | Which `Metadata` values and blob format does the console's PIX use for `SetMarker`/`BeginEvent`? The layer reads 0 and 1 as strings and labels 2 (the PC PIX3 blob) `PIX event` (section 4.10). | Log the `Metadata` values the game passes; if it is 2, decode the console blob from the executable's PIX calls rather than assuming the PC WinPixEventRuntime layout. | ## 9. Risks and non-goals @@ -2601,9 +2640,6 @@ Xodus is LGPL-2.1 and is cited only for its coverage number, not as a code sourc game's buffer working set may exceed `maxBufferSize` or PC VRAM. Host-visible arenas are slow; device-local arenas need staging and careful upload/readback handling. This is the main performance risk. - **Hash-table cost.** Every image/sampler access hashes a T#/S# and probes a storage buffer. **Measured (D3D-56, section 5.1)** on an RTX 5080 (driver 616.56): in `DEVICE_LOCAL` VRAM the lookup itself stays fast up to 100k entries (`3.0–3.7 us/1M` net wave-uniform full sweeps, `17.2–28.9 us/1M` net divergent hits), whereas `HOST_VISIBLE | HOST_COHERENT` system memory drops 9.6x–28x on uniform full sweeps and 59x–755x on divergent lookups at 10k–100k entries, and linear probing's 8-probe limit doubles a 100k table to `80.00 MiB` (`4.8%` load). **The runtime now keeps that table in `DEVICE_LOCAL` memory** and uploads only the slots that changed, from a mapped staging copy, with the copy and its barrier in the command buffer that will read it (D3D-76; 46.2x on a divergent miss at 100k on an RTX 2060 SUPER). Improving slot placement within the 8-probe window is the open optimisation (SHADER-100); Intel, RTX 5070 Ti Laptop and AMD RDNA3 are measured in section 5.1; Apple numbers remain open via `vk_descriptor_bench`. -- **Wave64.** On NVIDIA, wave64 shaders use the translator's 32-wide approximation; cross-half ops are approximate. - AMD GPUs with 64-wide subgroups are exact. This is a known fidelity gap, not specific to the layer. -- **Hash-table cost.** Every image/sampler access hashes a T#/S# and probes a storage buffer. **Measured (D3D-56, section 5.1)** on an RTX 5080 (driver 616.56): in `DEVICE_LOCAL` VRAM the lookup itself stays fast up to 100k entries (`3.0–3.7 us/1M` net wave-uniform full sweeps, `17.2–28.9 us/1M` net divergent hits), whereas `HOST_VISIBLE | HOST_COHERENT` system memory drops 9.6x–28x on uniform full sweeps and 59x–755x on divergent lookups at 10k–100k entries, and linear probing's 8-probe limit doubles a 100k table to `80.00 MiB` (`4.8%` load). **The runtime now keeps that table in `DEVICE_LOCAL` memory** and uploads only the slots that changed, from a mapped staging copy, with the copy and its barrier in the command buffer that will read it (D3D-76; 46.2x on a divergent miss at 100k on an RTX 2060 SUPER). Improving slot placement within the 8-probe window is the open optimisation (SHADER-100); AMD/Intel/Apple numbers remain open via `vk_descriptor_bench`. - **Wave64.** A native wave64 shader needs a 64-wide subgroup in its stage: AMD (Windows driver, RADV on GFX10+) can require it for compute, mesh and pixel shaders, NVIDIA cannot (32 only). There, compute and mesh shaders translated with `--wave64-emulate` are exact; wave64 pixel, vertex and geometry shaders have no emulation and keep the @@ -2611,9 +2647,10 @@ Xodus is LGPL-2.1 and is cited only for its coverage number, not as a code sourc the layer. - **Xbox tiling/DCC.** Slot 76 and layout `0x101` are known, but the tiled data layout, detile path and DCC remain unknown. If the game assumes console tiling or compression metadata, the layer needs a detile/repack step. -- **BVH builder DXIL.** 44 of the builder's 53 Xbox DXIL shaders fail the PC compiler; 22 have been lowered to - standard DXIL and compile, and 31 use raw 64-bit addresses. The lowered shaders have no reference output yet, and - this is a separate front end from the FSSM translator. +- **BVH builder shaders.** The container's DXIL bitcode is Xbox DXIL that PC drivers reject; its console `XBCH` + record is `FSSM`, and 41 of the 52 programs already pass `spirv-val` through the same translator as the game + ([embedded_shaders.md](embedded_shaders.md)). The 10 left need four small rules. Translation is not execution: + there is no GPU reference for any of the 52 yet. - **Ray tracing.** The game's RT work includes 64 compute shaders that traverse AMD-format BVH nodes, and it ships a BVH builder; a standard D3D12 AS path may also exist. If it is used, the layer must build AMD-format nodes, not a Vulkan AS. @@ -2731,8 +2768,8 @@ on a PC device behind the Xbox-ABI proxy). Measured: `(desc, riid, out)`, so the first call returned `E_POINTER` and the constructor threw it. - With slot 62 read that way, on **WARP** the constructor returns after 62 ms: 17 root signatures (slot 16) and 53 compute PSOs (slot 62, 53 of 53 `S_OK`), CS bytecode 4–75 KB each. `~XboxBvhBuilder` returns and makes no device - call. Created is not the same as correct: the shaders are Xbox DXIL with `@xbox.*` intrinsics (section 7.2), and - nothing has been dispatched yet. + call. Created is not the same as correct: the container's DXIL bitcode is Xbox DXIL with `@xbox.*` intrinsics + (section 7.2), its console `XBCH` record is `FSSM`, and nothing has been dispatched yet. - **NVIDIA (RT-54).** On an RTX 3060 (616.64), an RTX 4090 (621.14) and an RTX 5070 Ti (621.24), all on Windows 11, the first 48 PSOs return `S_OK`, and the 49th (38,248 bytes) never does. Some runs return `E_OUTOFMEMORY` for it, which the constructor throws. Other runs end the process inside `nvwgf2umx.dll` with `0xC0000409`, after the @@ -2740,7 +2777,7 @@ on a PC device behind the Xbox-ABI proxy). Measured: can't be caught. The D3D12 debug layer prints nothing first. - **Cause: the input, not Leonida.** The proxy passes the bytecode through unchanged, so nothing is wrong in what it forwards. The input is the problem: `LEONIDA_BVH_RECORD62=1 LEONIDA_BVH_DXIL=1` shows that every one of the - 53 containers is signed, has the same 9 parts, and is shader model 6.5 / DXIL 1.5. But dxil.dll (Windows SDK + 53 PSO calls (52 distinct containers) is signed, has the same 9 parts, and is shader model 6.5 / DXIL 1.5. But dxil.dll (Windows SDK 10.0.26100) rejects all 53 (`0x80aa0009`): the target triple is `dxil-ms-xb2` and the module carries `xbox.compiler.options` metadata. Most also have Xbox-only externals (44 of 53), `extractvalue` on non-DXIL types (16) or other disallowed instruction types (5). No PC driver has to accept this, and WARP happens to. @@ -2752,8 +2789,10 @@ on a PC device behind the Xbox-ABI proxy). Measured: So `bvh_builder_test` uses WARP whenever there is a hardware adapter, unless `LEONIDA_BVH_HARDWARE=1`, and it prints the reason with the adapter's PCI vendor id. WARP creates all 53 PSOs, and the constructor and destructor return. - - **The runtime itself still shouldn't hand Xbox DXIL to a PC driver.** These shaders need lowering to PC DXIL or a - translation of their own (section 7.2, M6) before they can run on hardware. + - **The runtime itself still shouldn't hand Xbox DXIL to a PC driver.** The same container carries the console + `XBCH` record, which decompresses to `FSSM`; 41 of the 52 programs translate and pass `spirv-val` today + ([embedded_shaders.md](embedded_shaders.md)). Translating that record is the path that avoids a DXIL lowering + front end (section 7.2, M6); the bitcode is a second representation. ### A.3 `amd_fidelityfx_upscaler_xbox.dll` diff --git a/docs/descriptor_lookup_ada.md b/docs/descriptor_lookup_ada.md index 490648e542..c5a6fced3d 100644 --- a/docs/descriptor_lookup_ada.md +++ b/docs/descriptor_lookup_ada.md @@ -51,6 +51,8 @@ foreach ($memory in 'device', 'host', 'rebar') { } ``` +These commands predate `--warmup-ms` (TEST-277, default 300 ms of extra warm-up). With a current build add `--warmup-ms 0` to reproduce them as run. + Device 0 was the RTX 4070 SUPER, the only Vulkan device. For the full 12-round series, let A, B and C denote 1k, 10k and 100k. The rounds used the same size orders and starting memory types as the M3 Max run. The first six size orders were ABC, CBA, BAC, CAB, ACB and BCA, starting with device, host, device, device, host and host respectively. The next six reversed the sequence of rounds and swapped the starting memory type in each. Each round ran the other of device and host second, and ReBAR third. ## System diff --git a/docs/descriptor_lookup_apple.md b/docs/descriptor_lookup_apple.md index dbc3c1f798..fad071ec68 100644 --- a/docs/descriptor_lookup_apple.md +++ b/docs/descriptor_lookup_apple.md @@ -43,4 +43,6 @@ for memory in device host; do done ``` +These commands predate `--warmup-ms` (TEST-277, default 300 ms of extra warm-up). With a current build add `--warmup-ms 0` to reproduce them as run. + Device 0 was the M3 Max. For the full 12-round series, let A, B and C denote 1k, 10k and 100k. The first six size orders were ABC, CBA, BAC, CAB, ACB and BCA, starting with device, host, device, device, host and host respectively. The next six reversed the sequence of rounds and swapped the starting memory type in each. diff --git a/docs/design.md b/docs/design.md index 3f0dfbe8ec..7f70bf52f1 100644 --- a/docs/design.md +++ b/docs/design.md @@ -103,7 +103,7 @@ add a source file, add it to `runtime\CMakeLists.txt` and to the file list in `b | Shaders | 26,503 carved from `shaders.rpf`, native RDNA2 code unpacked (`FSSM`), disassembled, and translated to SPIR-V; all validate (see *Translator status*). | `\shaders\` (`.dxbc`, `fssm\`, `disasm\`, `spirv\`) | | Textures | **Solved.** Headers are in CPU segments: GPU pointer at q[k], u16 width/height/depth and DXGI format at q[k+4], mip count at byte 2 of q[k+5]. Data is AMD `SW_4K_S` tiled, largest mip first. The GPU segment is the blob run after the CPU blob. On 200 samples, 173 decode at least 1.5× smoother detiled than untiled (median 2.56×). Exports the top mip, slice 0, as DDS. **22,342 exported (1.23 GiB)**: every header whose GPU data follows its CPU blob. World and model textures are handled by the TXD and TTPF exporters below. GPU offsets must be 256-byte aligned, which drops the false headers in `navmeshes`/`anim`. | `tools\tex_headers.py`, `tools\tex_export.py`, `\textures\` | | Models | **Done: 382,781 models measured at the `e293917` pin** (`levels.rpf` 343,327, `packs` 26,585, `story000` 7,461, `data` 3,175, `shared_minigame000` 1,294, `core_restofworld` 936, `story000_restofworld` 3; 0 decode failures across all 382,781 models; **159,511 drawable-dictionary children**, **223,270 standalone**, **55,417 fragments**, **89,887 bone-bound**, **2.64 billion triangles** [`2,636,248,990`], 1,805 embedded textures; 72 unrecovered scan candidates vs 1,282 at `917e9b9`). Earlier baselines: 350,248 at `917e9b9` (159,483 dictionary children, 190,765 standalone) and 190,792 at `c3708fb`; the +32,533 gain at `e293917` comes from upstream `v1.2` PRs #8–#12 (optional fragment pointers, texture-dictionary filtering, probe-cap parity, and zero-radius drawables; see [models.md](models.md)). Exported with `tools\rpf9dump` (built on breadbbbb/rpf9-explorer's Core; see below). Resources are found at page offset +16 after 16 zero bytes, followed by a zlib system blob with a drawable/fragment header and then the following zlib blocks as graphics data. Positions are quantized: `bias + scale * ((q >> 8) & 0xFFFFFF)`. Output is OBJ (positions, UVs, indices) plus a manifest with real model names (e.g. `cvar_int_grg2b_toys_1`), bounds, per-mesh shader index and material texture references (parameter hash, name hash, 64-bit asset key). My earlier `0x1380`/`0x1601` descriptor notes stand, but the "data not located" blocker was wrong. Character skeletons are separate: the shared 597-name `.#ft` table and its model-side bone-hash mapping are in [character_skeleton.md](character_skeleton.md). | `\assets\\models\` | -| Models | **Done: 350,251 models measured at the `917e9b9` pin** (the submodule pin is now `e293917`, which also pulls in upstream `v1.2` model-discovery PRs #8-#12 plus BCPack PR #7; the non-`levels.rpf` archives have been re-counted at `e293917`: 39,454 rows, +3,203, almost all recovered fragments; `levels.rpf` has a recovery count of 343,327 models (+29,327) but no full OBJ export). At `917e9b9`: `levels.rpf` 314,000, `story000` 7,460, `packs` 24,034, `data` 2,581, `shared_minigame000` 1,288, `core_restofworld` 885, `story000_restofworld` 3; 0 decode failures in the re-count. The `c3708fb` export was 190,792; the new entries are **159,486 drawable-dictionary children** (levels 130,225, packs 23,720, story 4,156, data 268, shared 317, core 797, story_restofworld 3) plus raw-tail/mixed-block pages. The standalone total is 190,765. Triangle totals were not re-run. Exported with `tools\rpf9dump` (built on breadbbbb/rpf9-explorer's Core; see below). Resources are found at page offset +16 after 16 zero bytes, followed by a zlib system blob with a drawable/fragment header and then the following zlib blocks as graphics data. Positions are quantized: `bias + scale * ((q >> 8) & 0xFFFFFF)`. Output is OBJ (positions, UVs, indices) plus a manifest with real model names (e.g. `cvar_int_grg2b_toys_1`), bounds, per-mesh shader index and material texture references (parameter hash, name hash, 64-bit asset key). My earlier `0x1380`/`0x1601` descriptor notes stand, but the "data not located" blocker was wrong. Character skeletons are separate: the shared 597-name `.#ft` table and its model-side bone-hash mapping are in [character_skeleton.md](character_skeleton.md). | `\assets\\models\` | +| Models | **Done: 382,781 models measured at the `e293917` pin** (`levels.rpf` 343,327, `packs` 26,585, `story000` 7,461, `data` 3,175, `shared_minigame000` 1,294, `core_restofworld` 936, `story000_restofworld` 3; 0 decode failures across all 382,781 models; **159,511 drawable-dictionary children**, **223,270 standalone**; the other archives measure **4,686 fragments**, **30,343 bone-bound**, **126,301,454 triangles** and 512 embedded textures, while the `levels.rpf` fragments/bone-bound/triangles/embedded cells are **not independently reproduced** (no `levels.rpf` manifest; the count harness emits no such fields); 72 unrecovered scan candidates vs 1,282 at `917e9b9`). Earlier baselines: 350,251 at `917e9b9` (159,486 dictionary children, 190,765 standalone) and 190,792 at `c3708fb`; the +32,530 gain at `e293917` comes from upstream `v1.2` PRs #8–#12 (optional fragment pointers, texture-dictionary filtering, probe-cap parity, and zero-radius drawables; see [models.md](models.md)). Exported with `tools\rpf9dump` (built on breadbbbb/rpf9-explorer's Core; see below). Resources are found at page offset +16 after 16 zero bytes, followed by a zlib system blob with a drawable/fragment header and then the following zlib blocks as graphics data. Positions are quantized: `bias + scale * ((q >> 8) & 0xFFFFFF)`. Output is OBJ (positions, UVs, indices) plus a manifest with real model names (e.g. `cvar_int_grg2b_toys_1`), bounds, per-mesh shader index and material texture references (parameter hash, name hash, 64-bit asset key). My earlier `0x1380`/`0x1601` descriptor notes stand, but the "data not located" blocker was wrong. Character skeletons are separate: the shared 597-name `.#ft` table and its model-side bone-hash mapping are in [character_skeleton.md](character_skeleton.md). | `\assets\\models\` | | Texture dictionaries | Same tool: TXD resources become DDS per texture. | `\assets\\textures\` | | World textures (TTPF) | **Done: 308,895 textures from all 57 pools, 0 failures, 48,220 entries skipped by the original exporter** (33,507 BCPack, 14,030 compact mapping, 678 arrays/volumes, 5 unsupported format, 0 unmapped). The compact-tail tool resolves 14,011 of the 14,030 layouts and reconstructs 305,264 complete chains (206,661 newly complete, 1,100,865 mips, 4.59 GiB), and the multi-slice pass resolves all 697 arrays/cubemaps/volumes ([textures_arrays.md](textures_arrays.md)). BCPack was the hard blocker: `tools/bcpack.py` decodes all six active modes (BC1, BC3, BC4, BC5, BC6H, BC7), and `rpf9dump`'s C# `TtpfReader` (`e293917` pin, `breadbbbb/rpf9-explorer#7`) now decodes compact tails, multi-slice layouts, DXGI 11, and strict BCPack BC1/BC3/BC4/BC5 directly; BC6H/BC7 and provisional-history chunks remain skipped by `rpf9dump` and can be completed by `tools/ttpf_assets.py` ([textures.md](textures.md)). 46 pools are in `data\ttdb\**`, 11 in `pack\\data\ttdb\**` (exported under `ttpf_pack\\`). `data\ttdb\**\*.ttpf` (57 pools, 58 GiB) are loose RDS5 texture pools, **not** inside RPFs. rpf9-explorer's `TtpfReader` reads the catalog and detiles them; checked visually (`ttdb_graphics`: scope reticles, clean lines). Names are generated (`texture_N_`); models reference textures by asset key. Some rows are skipped; the measured breakdown and next steps are in [textures.md](textures.md). | `\assets\ttpf\\` + `manifest.json` | | Animation | Indexed without the TOC: 130,470 zlib streams (4,203,762,662 stored / 11,593,460,132 inflated), 95.4% readable. New RAGE page directories (`0DRP`, version 122), `MoVE` (version 19), 273 `pack:/` name tables (2,298 paths), and a tail `RBF0` rig-set manager (`rage__crRigSetManager`: 1,126 rig sets, 6,677 source→rig entries, 3,669 distinct rigs; 56 empty). Bone data: one standalone 28-name table and 3 motion-matcher streams with embedded bone tables (30-name union, 19 joaat32 hashes present, 4 motionmatcher paths); no rig→skeleton link was found. Clip dictionaries are system-only RAGE resources (page map at the `+0x08` pointer). `tools/anim_clips.py` decodes 191,042 of 191,042 animations in 61,505 of them to per-frame values (channel types 0–5, 7, 8 and the GTA VI type 10) and resolves 111,948 of 159,584 `.motion` children to a clip. For each `.motion` it reads the per-child durations and time curves and, on 10,171 of 17,247, the one-axis parameter node (axis name hash, sorted sample values, range). The 2/3 packed streams are second pages of `0DRP` resources, which are not decoded. No `YCD`/`RSC7` at any stream start. The `rpf9_carve` tail overread is measured in `docs/animation.md`. | `tools\anim_index.py`, `\anim-index\` | @@ -217,7 +217,6 @@ How the generated SPIR-V expects the runtime to work: | Execution model | One invocation = one lane. A wave = a subgroup, so cross-lane ops (`ds_swizzle`, `v_permlane*`, `v_readlane`/`v_writelane`, `v_mbcnt`) become subgroup shuffles. **Requires subgroup size == wave size** (wave32 maps directly onto NVIDIA GPUs; wave64 shaders need a 64-wide subgroup or emulation). `v_readlane_b32`/`v_writelane_b32` mask the lane select with 63 in wave64 (`S1[5:0]`) and 31 in wave32 (`S1[4:0]`); until SHADER-52 both used 63, so a wave32 select ≥ 32 pointed past a 32-wide subgroup. GPU-checked with `cs_w32_lane_wrap.asm` (lane 40 → 8). | | DPP | VOP1/VOP2 `_dpp` applies to src0. DPP16 controls (`quad_perm`, `row_shl/shr/ror/share/xmask/mirror/half_mirror`) and DPP8 (`dpp8` + `fi`) select the source lane, then `row_mask` (one bit per 16-lane row) and `bank_mask` (one bit per 4-lane bank) decide which destination lanes update. A lane whose row/bank is off is not written. A source lane outside the row is invalid: `bound_ctrl` 1 uses 0 as src0, otherwise the lane is not written. A source lane inactive under EXEC is used when `fi` is 1; otherwise `bound_ctrl` decides. DPP8 always writes an enabled lane: `fi` 1 reads the inactive source, `fi` 0 uses 0. DPP16/8 never leaves its 16/8-lane group, so this is exact on every subgroup at least that wide; under `--wave64-emulate` the exchange goes through the workgroup buffer like the other cross-lane ops. GPU-checked with `runtime/test/shaders/cs_dpp*.asm` on an RTX 3070 and hardware-measured on an RX 6800. Semantics from the RDNA2 ISA, AMD LLVM modifier syntax and the GPUOpen DPP notes. | | EXEC | A per-invocation `active` flag. VALU writes and exports are masked by it, scalar ops aren't, and `v_cmpx`, saveexec and EXEC writes update it. A pixel lane that was inactive at the last `exp ... vm` it executed is discarded, and on a path without one, a lane inactive at the end (EXEC is kept at the export only where a path can write it afterwards). **The `vm` rule is from the RDNA2 ISA reference guide (30-November-2020, §11.1 and §11.2.1: EXEC at the export is the valid mask and the final one sent is used), not measured on hardware**; checked on the CPU by `tests/semantic/test_export_valid_mask.py`. VALU scalar lane-mask destinations (`v_cmp_*`, `v_add_co_u32`, `v_add_co_ci_u32`, `v_sub_co_u32`, `v_sub_co_ci_u32`, `v_subrev_co_u32`, `v_subrev_co_ci_u32`, `v_mad_u64_u32`, `v_mad_i64_i32`) write 0 for lanes off in EXEC (`SDST[lane] = EXEC[lane] ? bit : 0`, AMD RDNA2 ISA). Until 2026-11-22 the six `*_co_*` ops and `v_mad_u64_u32`/`v_mad_i64_i32` did not AND the carry/sign bit with `active`, so inactive lanes leaked 1 bits into `VCC`/SGPR masks (`s_bcnt1`, `s_cbranch_vccz`, `v_cndmask_b32`). Checked on the CPU by `tests/semantic/test_carry_exec_mask.py` (wave32, wave64, and `--wave64-emulate` structure), **not yet GPU-verified**. | -| EXEC | A per-invocation `active` flag. VALU writes and exports are masked by it, scalar ops aren't, and `v_cmpx`, saveexec and EXEC writes update it. A pixel lane still inactive at the end is discarded. VALU scalar lane-mask destinations (`v_cmp_*`, `v_add_co_u32`, `v_add_co_ci_u32`, `v_sub_co_u32`, `v_sub_co_ci_u32`, `v_subrev_co_u32`, `v_subrev_co_ci_u32`, `v_mad_u64_u32`, `v_mad_i64_i32`) write 0 for lanes off in EXEC (`SDST[lane] = EXEC[lane] ? bit : 0`, AMD RDNA2 ISA). Until 2026-11-22 the six `*_co_*` ops and `v_mad_u64_u32`/`v_mad_i64_i32` did not AND the carry/sign bit with `active`, so inactive lanes leaked 1 bits into `VCC`/SGPR masks (`s_bcnt1`, `s_cbranch_vccz`, `v_cndmask_b32`). Checked on the CPU by `tests/semantic/test_carry_exec_mask.py` (wave32, wave64, and `--wave64-emulate` structure), **not yet GPU-verified**. | | `s_*_saveexec_b32/b64`, `s_andn1/andn2_wrexec_b32/b64` | RDNA2 ISA SOP1. saveexec: `D = EXEC; EXEC = f(S0, EXEC); SCC = (EXEC != 0)`. wrexec: `EXEC = f(S0, EXEC); D = EXEC`. `f` is one of `and`, `or`, `xor`, `andn1` (`~S0 & EXEC`), `andn2` (`S0 & ~EXEC`), `orn1`, `orn2`, `nand`, `nor`, `xnor`, the table in `Gen.EXEC_LOGIC`. The definitions match `tools/cf_ref.py` `_SAVEEXEC`, the FUZZ-8 model. Each invocation holds its own lane's bit (0 or ~0), so `f` is the bitwise op on that bit. A lane EXEC had off becomes active when `f` gives 1 for it (`nand`, `nor`, `orn1`, `orn2`, `xnor`, ...), as on hardware, and SCC is the wave vote. Until 2026-11-22 only `and`/`or`/`andn2_saveexec` and `andn2_wrexec` were translated. CPU-checked by `tests/semantic/test_saveexec_variants.py` (all ten saveexec kinds in wave32 and wave64, both wrexec kinds, partial EXEC and S0, an empty result, every lane against `cf_ref._SAVEEXEC`) and by `tools/cf_diff.py` (300 programs × wave32/64 still pass). **Not GPU-verified** for the seven new kinds. | | Control flow | Reducible graphs use structured branches and natural loops. Irreducible graphs use the dispatch-loop form, which can also be forced with `--dispatch-loop` for comparisons. The control-flow unit test checks 18,228 generated graphs. AMD A/B checks compare the two forms for selected pixel shaders with defined test inputs. For shaders that never export colour, the comparison checks pixel coverage. | | User data | **Push constants, 144 bytes:** dwords 0–31 = initial s0–s31 (the user SGPRs the console driver loads from the root signature: descriptor-table pointers, constants and so on), dwords 32–33 = the 64-bit **heap base**, dwords 34–35 = the **code base**: the Xbox VA where the runtime uploaded this shader's whole FSSM blob. `--mesh-compute` modules add dwords 36–37, the output buffer address (152 bytes; see "Mesh shaders as compute"). The runtime has to reproduce the console driver's root-signature-to-user-SGPR mapping; that comes from the exe or driver behaviour. | @@ -225,30 +224,25 @@ How the generated SPIR-V expects the runtime to work: | Code-embedded data | 155 VS/PS had "undecodable words". They're **constant tables inside the code range** (float values like 0x3EF7…, plus zeros), read through `s_getpc_b64` + `s_add_u32`/`s_addc_u32` + `s_load` (147 of 155). The translator re-anchors each instruction to its true FSSM offset by matching encodings, translates only code reachable from entry (a branch into data is rejected), and turns `s_getpc_b64` into code base + next-instruction offset. **The runtime uploads each shader's FSSM blob into the heap and passes that VA as the code base.** Re-anchoring compares bytes exactly, except that VOP3P `op_sel_hi[2]` (bit 14) is ignored on two-source packed ops: the compiler stores 0 there, and LLVM prints its default of 1. Unused VOP3/VOP3P `SRC1` (bits 49:41) and `SRC2` (bits 58:50) fields are also ignored when stored as 0 and printed as `0x80`: LLVM 23 re-encodes a source it doesn't read as inline constant 0 (one-source `v_rcp`/`v_log`/`v_sqrt_f32_e64`, two-source `v_sub_f32_e64`/`v_cmp_*_e64`/`v_mul_lo_u32`/`v_pk_mul_f16`). A source it does read prints as decoded (raw 0 is `s0`), so this can't hide a real difference. Confirmed by a count over the corpus with LLVM 23.1.5: without it, 1,471 of the 1,473 shaders with embedded data are rejected ("reachable instruction with normalized encoding"); with it, all 1,473 translate and pass `spirv-val`. Runs with LLVM 21 already translated all of them, so older LLVMs presumably print the stored 0 (not re-checked). Data words that decode with ignored fields set are printed re-encoded (e.g. `0xbe8d2242` as `s_rfe_b64` `0xbe802242`), so they can never match. Since the decoder consumed the same length, they are anchored in sequence and marked. A shader that can *reach* a marked word is rejected; none of the corpus does. All 155 now translate. | | Global memory | `global_load/store_dword*`: address = (64-bit SGPR base + zero-extended 32-bit VGPR offset, or a 64-bit VGPR address) + the instruction offset, translated through the heap base. Inactive lanes don't access memory, and loads merge their previous values with OpPhi. The offset is the **signed 12-bit** byte value as llvm-mc prints it, -2048..2047 (`offset:-4` is the field 0xffc; llvm-mc rejects `offset:0xffc` and disassembles that field as `offset:-4`, so no repo path delivers the raw unsigned field), added to the address as is; a tool that printed the raw field (`0xffc`) would mean the same offset, and a value outside 12 bits is rejected. Measured on an AMD Radeon RX 6800 (gfx1030) running `global_load_dword` as a raw compute kernel, wave32 and wave64 alike, with the dword at byte n = 0x10000000+n and the pointer at 0x1000: offset 0 reads 0x10001000, -4 0x10000ffc, -2048 0x10000800, 2044 0x100017fc, -1024 0x10000c00. The translator used to subtract 0x1000 from an already negative value (4096 bytes too low). Checked by `tests/semantic/test_global_mem_offset.py` (both addressing modes, dword/x2/x4, byte/short loads and stores at -4, -2048, 2047 and 0) and the GPU test `runtime/test/shaders/cs_global_neg_offset.asm` (`vk_compute_test ... 40 dump`). | | Global atomics (`global_atomic_*`, 32-bit) | `add`, `sub`, `smin/umin`, `smax/umax`, `and`, `or`, `xor`, `swap` and `cmpswap` at the `global_load/store` address (same `Gen.global_address`: saddr pair plus zero-extended vaddr, or a 64-bit vaddr with `off`, plus the signed 12-bit offset), as one `OpAtomic*` on the PhysicalStorageBuffer dword, device scope, guarded so inactive lanes don't touch memory. With `glc` the pre-op value lands in `vdst`, the first operand; without `glc` there is no `vdst`, and the first-read analysis counts operand 0 as the address (a source). `cmpswap` takes `vdata` as the pair {DATA, CMP}: `M = (M == CMP) ? DATA : M`, as `buffer_atomic_cmpswap`. `and/or/xor/swap_x2` work on a 64-bit element (two dwords, low first) as one 32-bit atomic per dword: a bitwise op or an exchange leaves the same memory that way, with no Int64 atomics. **Approximation:** the returned pair comes from two reads, so another lane's 64-bit op on the same element between them can show up half done (as for `ds_and/or/xor_b64`). Still `Unsupported`: the other `_x2` forms (`add/sub/min/max_x2` carry or compare across the dwords, and `cmpswap_x2` compares all 64 bits), `inc`/`dec`, the float atomics, and `slc`/`dlc`. Until 2026-11-22 every global atomic was rejected. CPU-checked by `tests/semantic/test_global_atomics.py` (all ten ops on a value grid with and without `glc`, `cmpswap`, offsets from -2048 to 2044, `off` addressing, seeded values, rejected forms, the first-read analysis) and `tests/semantic/test_global_atomics_x2.py` (the four `_x2` forms with and without `glc`, an offset, seeded values, the carrying forms rejected). **Not GPU-verified.** | -| Global atomics (`global_atomic_*`, 32-bit) | `add`, `sub`, `smin/umin`, `smax/umax`, `and`, `or`, `xor`, `swap` and `cmpswap` at the `global_load/store` address (same `Gen.global_address`: saddr pair plus zero-extended vaddr, or a 64-bit vaddr with `off`, plus the signed 12-bit offset), as one `OpAtomic*` on the PhysicalStorageBuffer dword, device scope, guarded so inactive lanes don't touch memory. With `glc` the pre-op value lands in `vdst`, the first operand; without `glc` there is no `vdst`, and the first-read analysis counts operand 0 as the address (a source). `cmpswap` takes `vdata` as the pair {DATA, CMP}: `M = (M == CMP) ? DATA : M`, as `buffer_atomic_cmpswap`. Still `Unsupported`: the `_x2` 64-bit forms, `inc`/`dec`, the float atomics, and `slc`/`dlc`. Until 2026-11-22 every global atomic was rejected. CPU-checked by `tests/semantic/test_global_atomics.py` (all ten ops on a value grid with and without `glc`, `cmpswap`, offsets from -2048 to 2044, `off` addressing, seeded values, rejected forms, the first-read analysis). **Not GPU-verified.** | | 8/16-bit global stores and d16 loads | `global_store_byte`/`short` write the low 8/16 bits of the data VGPR (the `_d16_hi` forms its high half). `global_load_{u,s}byte_d16` and `global_load_short_d16` write the low 16 bits of `vdst` (the `_hi` forms the high 16) and keep the other half; `ubyte` zero-extends and `sbyte` sign-extends the byte to 16 bits. The address is the `global_load/store` one (`Gen.global_address`). The access goes one byte at a time, so a 16-bit access that crosses a dword (at byte 3) is exact too. A store merges each byte into its dword with atomic and/or, which keeps neighbouring bytes even when another lane writes them, as buffer byte stores do. A load reads each byte. Inactive lanes neither store nor load. The first-read analysis counts a d16 load's `vdst` as read, for the half it keeps. `global_load/store_dword_addtid` (lane-id and M0 addressing) raise `Unsupported`; until 2026-11-22 they crashed with `IndexError`, and the ten sub-dword ops raised `Unsupported`. CPU-checked by `tests/semantic/test_global_sub_dword.py` (every byte offset 0 to 7 for each op, an inactive lane, rejected forms, the first-read analysis). **Not GPU-verified.** | | Literal samplers | Some shaders build their S# from immediates (for example `0x92, 0xC00000, 0x14500000, 0`). The runtime registers those in the descriptor hash table too, by scanning the translated shaders' constant S# values, not only S#s the game binds. | | Scalar/buffer memory | `s_load*`, `s_buffer_load*`, `buffer_load*` and `buffer_store*` use buffer device addresses (`PhysicalStorageBuffer64`). The base comes from the 64-bit SGPR pointer or the V# (dword0 \| dword1[15:0] << 32), and the stride is V# dword1[29:16]. **The runtime must put the game's GPU heap in buffer-device-addressable memory at the same addresses the game writes into descriptors** (or remap them). `s_load*` and `s_buffer_load*` take an immediate or an SGPR offset, or both at once (llvm-mc prints `sOFF offset:IMM`). Rules, measured on AMD Radeon RX 6800 (gfx1030, Windows driver 32.0.21045.29003) by running the instructions as a raw compute kernel, wave32 and wave64 (155 runs, every result either 0 or the stored data, wave32 = wave64 in every dword): **address** = (base & ~3) + (sOFF & ~3) + (IMM & ~3) + 4·i for dword i: base, sOFF and IMM are each truncated to a multiple of 4, then added (`s_buffer_load_dword s9, s[24:27], 0x3` with base & 3 = 1 reads +0, not bytes 4..7; sOFF 3 + IMM 3 reads +0 and sOFF 2 + IMM 6 reads +4, where truncating the sum gives +4 and +8; sOFF 8 + IMM 4 reads +12; the same for `s_load*` with pointer & 3 = 1 or 3). **`s_buffer_load*` bound**: dword i is 0, and memory is not read, when (sOFF & ~3) + (IMM & ~3) + 4·i + 4 > limit, with limit = NUM_RECORDS (V# dword2) bytes when the stride is 0 and NUM_RECORDS × stride bytes when it is not. Per dword (x4 at 0xc with NUM_RECORDS 21: data, data, 0, 0; x8 at 0 with 21: five data, three 0), on the truncated offset (IMM 0x10 with NUM_RECORDS 18: 0; IMM 0x13 with 21: the dword at +0x10; sOFF 0xe + IMM 2 with 16: the dword at +0xc; sOFF 0x10 + IMM 4 with 20: 0), not seeing base & 3 (base & 3 = 3, IMM 0x13, NUM_RECORDS 20: data); with a stride the test is still on bytes (stride 4, NUM_RECORDS 5: IMM 0x10 data, 0x14 0; stride 1, NUM_RECORDS 17: IMM 0x10 is 0, so it is not an index test). IMM is unsigned (0xffffc reads +0xffffc). OOB_SELECT (V# word3[29:28]) 0, 1, 2 and 3 gave the same pattern (7 probes per value). **`s_load*`**: no bound (+0x1ffffc reads the dword there); IMM is sign-extended from 21 bits and added in 64 bits (sOFF 8 + IMM −4 reads +4 where zero-extension reads 4 GiB further; sOFF 0xb + IMM −1 reads +4, so the negative IMM is truncated on its own: −1 → −4). Not measured: `s_load`/`s_buffer_load` with sOFF + IMM < 0 (a negative IMM without sOFF included; the translator uses the 64-bit signed sum, an inference), an `s_buffer_load` IMM with bit 20 set (llvm-mc rejects it) or a negative one (kept as the 32-bit value: for stride 0 that is past any NUM_RECORDS below 4 GiB), `x16` (gets the x8 rule), sOFF ≥ 2^31, NUM_RECORDS ≥ 2^31 and NUM_RECORDS × stride ≥ 2^32, V# dword1[31:30], and gfx1013 (PS5) itself. The translator checks each `s_buffer_load` dword with its own structured `if` and an `OpPhi` with 0, so an out-of-range dword issues no load (when descriptor limit and offset are compile-time constants, in-range dwords fold to straight-line loads and out-of-range dwords emit constant zero without branches); `s_load` stays straight-line. Before this the translator added base + sOFF + IMM unaligned, had no `s_buffer_load` bound and zero-extended a negative `s_load` IMM. Checked by `tests/semantic/test_scalar_mem_smem.py` (`SmemHardwareRuleTests`, the measurement's rows, values and the addresses read; `SmemSoffsetImmTranslatorTests`) and by the GPU tests `runtime/test/shaders/cs_smem_soffset_imm.asm`, `cs_smem_bounds.asm`, `cs_smem_stride_align.asm` and `cs_smem_sload_neg.asm` (never run that one with a translator that zero-extends the immediate: it reads 4 GiB past the heap), all in `check.py` and `scripts/run_gpu_tests.py`, which pass on the RX 6800 (Vulkan, driver 26.11.2). See *Buffer bounds checking* below for the MUBUF `num_records` checks. | | 2D array resource dimensions | For `image_get_resinfo` on a 2D array, X/Y are the width/height at the requested mip, Z is the view layer count and W is its mip count. The query reads the sampled array at binding 3. A native gfx1036 kernel returned (19,11,5,3), (9,5,5,3) and (4,2,5,3) for the three mips of a synthetic array. On RTX 5080 and Radeon Graphics the translated query matched those tuples and returned (4,2,3,2) at relative mip 1 with a view starting at mip 1 and covering three layers. The registered `ps_array_resinfo` draw checks all 4096 pixels against (8,8,12,1). | | Scalar/buffer memory | `s_load*`, `s_buffer_load*`, `buffer_load*` and `buffer_store*` use buffer device addresses (`PhysicalStorageBuffer64`). The base comes from the 64-bit SGPR pointer or the V# (dword0 \| dword1[15:0] << 32), and the stride is V# dword1[29:16]. **The runtime must put the game's GPU heap in buffer-device-addressable memory at the same addresses the game writes into descriptors** (or remap them). `s_load*` and `s_buffer_load*` take an immediate or an SGPR offset, or both at once (llvm-mc prints `sOFF offset:IMM`). Rules, measured on AMD Radeon RX 6800 (gfx1030, Windows driver 32.0.21045.29003) by running the instructions as a raw compute kernel, wave32 and wave64 (155 runs, every result either 0 or the stored data, wave32 = wave64 in every dword): **address** = (base & ~3) + (sOFF & ~3) + (IMM & ~3) + 4·i for dword i: base, sOFF and IMM are each truncated to a multiple of 4, then added (`s_buffer_load_dword s9, s[24:27], 0x3` with base & 3 = 1 reads +0, not bytes 4..7; sOFF 3 + IMM 3 reads +0 and sOFF 2 + IMM 6 reads +4, where truncating the sum gives +4 and +8; sOFF 8 + IMM 4 reads +12; the same for `s_load*` with pointer & 3 = 1 or 3). **`s_buffer_load*` bound**: dword i is 0, and memory is not read, when (sOFF & ~3) + (IMM & ~3) + 4·i + 4 > limit, with limit = NUM_RECORDS (V# dword2) bytes when the stride is 0 and NUM_RECORDS × stride bytes when it is not. Per dword (x4 at 0xc with NUM_RECORDS 21: data, data, 0, 0; x8 at 0 with 21: five data, three 0), on the truncated offset (IMM 0x10 with NUM_RECORDS 18: 0; IMM 0x13 with 21: the dword at +0x10; sOFF 0xe + IMM 2 with 16: the dword at +0xc; sOFF 0x10 + IMM 4 with 20: 0), not seeing base & 3 (base & 3 = 3, IMM 0x13, NUM_RECORDS 20: data); with a stride the test is still on bytes (stride 4, NUM_RECORDS 5: IMM 0x10 data, 0x14 0; stride 1, NUM_RECORDS 17: IMM 0x10 is 0, so it is not an index test). IMM is unsigned (0xffffc reads +0xffffc). OOB_SELECT (V# word3[29:28]) 0, 1, 2 and 3 gave the same pattern (7 probes per value). **`s_load*`**: no bound (+0x1ffffc reads the dword there); IMM is sign-extended from 21 bits and added in 64 bits (sOFF 8 + IMM −4 reads +4 where zero-extension reads 4 GiB further; sOFF 0xb + IMM −1 reads +4, so the negative IMM is truncated on its own: −1 → −4). Not measured: `s_load`/`s_buffer_load` with sOFF + IMM < 0 (a negative IMM without sOFF included; the translator uses the 64-bit signed sum, an inference), an `s_buffer_load` IMM with bit 20 set (llvm-mc rejects it) or a negative one (kept as the 32-bit value: for stride 0 that is past any NUM_RECORDS below 4 GiB), `x16` (gets the x8 rule), sOFF ≥ 2^31, NUM_RECORDS ≥ 2^31 and NUM_RECORDS × stride ≥ 2^32, V# dword1[31:30], and gfx1013 (PS5) itself. The translator checks each `s_buffer_load` dword with its own structured `if` and an `OpPhi` with 0, so an out-of-range dword issues no load (when descriptor limit and offset are compile-time constants, in-range dwords fold to straight-line loads and out-of-range dwords emit constant zero without branches); `s_load` stays straight-line. Before this the translator added base + sOFF + IMM unaligned, had no `s_buffer_load` bound and zero-extended a negative `s_load` IMM. Checked by `tests/semantic/test_scalar_mem_smem.py` (`SmemHardwareRuleTests`, the measurement's rows, values and the addresses read; `SmemSoffsetImmTranslatorTests`) and by the GPU tests `runtime/test/shaders/cs_smem_soffset_imm.asm`, `cs_smem_bounds.asm`, `cs_smem_stride_align.asm` and `cs_smem_sload_neg.asm` (never run that one with a translator that zero-extends the immediate: it reads 4 GiB past the heap), all in `check.py` and `scripts/run_gpu_tests.py`, which pass on the RX 6800 (Vulkan, driver 26.11.2). See *Buffer bounds checking* below for the MUBUF `num_records` checks. | | Images and samplers | `image_sample_l` on 2D arrays used to read its LOD from the array layer; it now reads the LOD after all coordinates. `image_get_lod` and `image_gather4_lz` also work on 2D arrays. With `d16` every sample result is f16, packed two to a VGPR from the low half (the packed D16 of GFX10, as LLVM returns D16 image data); `image_sample_c_lz`/`_c_lz_o` follow it too, and until 2026-11-21 their compare result was written as f32 bits, which read as 0 in the low half. Checked by `tests/test_translate.py` (`test_depth_compare_sample_result_width`) and GPU-checked with `runtime/test/shaders/ps_sample_c_lz.asm` (`vk_texture_test dref`: a D32 texture and a LESS_OR_EQUAL compare sampler) on an NVIDIA GeForce RTX 2060 SUPER (Linux, driver 620.70.06): 4096/4096 pixels exact for f32 and `d16`; with the old translator the `d16` result read 0 in the 2048 pixels whose compare passes. | -| Typed buffer loads | The format is V# word3[18:12] (GFX10_FORMAT, from Mesa's `gfx10-rsrc.json`, saved as `tools\gfx10_formats.json`). Supported: f32 ×1–4, u32 ×1–4, i32 ×1–4 (formats 21/63/73/76), f16 ×1/2/4, unorm8 ×1/2/4, snorm8 ×1/2/4, uint8 ×4, unorm16 ×1/2/4, snorm16 ×1/2/4, 10-10-10-2 and 2-10-10-10 unorm. Others give 0. Full-width SINT accesses preserve integer bits. D16 SINT loads saturate to signed 16-bit and D16 stores sign-extend, covered by the synthetic `cs_fmt_sint32.asm` readback. DST_SEL swizzle is applied (0→0, 1→1.0f for float/norm or integer 1 for UINT/SINT, 4..7→X..W). Missing channels repeat the format's own (component *c* = *c* mod *n*), measured on an RX 6700 (SHADER-86). UNORM/SNORM give the correctly rounded quotient by (2ⁿ−1), as the hardware does (0 mismatches vs hardware over 395,776 conversions on that GPU). It is built with integer ops (`Gen.norm_bits`): x/(2ⁿ−1) in binary is x's bits repeated, so a 64-bit multiply by the repeat pattern, `FindUMsb` and the round bit give the f32 exactly (the tail never ends, so there are no ties). `OpFDiv` is not enough on the GPU: Vulkan allows it 2.5 ULP, and on an RX 6700 (AMD Windows 26.11.2) and an RTX 5090 it returned the reciprocal-multiply bits (8_UNORM 130/256 exact, #599). Checked against exact values in `tests/semantic/test_norm_decode.py` (every value up to 8 bits, edges and the reciprocal-multiply misses for 10, 15 and 16 bits). 8_SNORM (2), 16_SNORM (8) and 8_8_SNORM (15) were missing until 2026-11-22 and decoded to 0. Format names list the channel widths from the top bit, so `2_10_10_10` (50) is R10G10B10A2 and `10_10_10_2` (44) has a 2-bit x (Mesa `gfx10_format_table.py`, `ac_formats.c`). Until 2026-11-22 the two were swapped, in stores too. Until 2026-11-21 an element that started mid-dword re-read dword 0 for its tail (`need` was `ceil(size/4)` and only the first dword was shifted); loads now take `need = ceil((byte_shift + size) / 4)` dwords and shift the whole window so the packed stream starts at the element (FUZZ-5, leftover from #234). The 10:10:10:2 order is checked by `cs_fmt_1010102` in `tests/semantic/test_value_semantics.py` (the shader decodes the format, so a GPU run can't check it). Mid-dword spanning elements are checked by `tests/semantic/test_buffer_load_format.py` (`CrossingDwordBoundary`); repeat / UNORM / DST_SEL 1 by the SHADER-86 cases in the same file. | | Images and samplers (core) | Bindless. Set 0: binding 0 = 2D sampled images, 1 = samplers, 2 = descriptor hash table (storage buffer), 3 = 2D-array images (**cube textures are bound here as 6-layer 2D-array views**, cube arrays as 6N layers: the shader already selected the face with `v_cube*`), 4 = r32ui storage images, 5 = 1D, 6 = 3D. A cube sample's s and t come in [1, 2] and its third coordinate is 8·slice + face, as the hardware takes them (Mesa `ac_nir_lower_tex_coords.c`, LLPC `ImageBuilder.cpp`); the view is read at (s − 1, t − 1), layer 6·slice + face. GPU-checked with `runtime/test/shaders/ps_cube_sample.asm` (`vk_texture_test cube`). For a native Metal path, `tools/spirv_metal_set0.py` sizes set 0's runtime arrays from `vulkan_bindless.h` and moves each binding to its own argument-buffer ID range (binding b starts at the capacities of bindings 0..b-1 added up), to convert with SPIRV-Cross `--msl-decoration-binding`: SPIRV-Cross 1.4.363.0 otherwise puts every runtime array at one ID and comments all but one out as "Overlapping binding" (SHADER-161). `cs_imgstore` converted this way writes all 3×64 texels correctly in a native Metal dispatch on an Apple A18 Pro. | | Typed buffer loads | The format is V# word3[18:12] (GFX10_FORMAT, from Mesa's `gfx10-rsrc.json`, saved as `tools\gfx10_formats.json`). Supported: f32 ×1–4, u32 ×1–4, i32 ×1–4 (formats 21/63/73/76), f16 ×1/2/4, unorm8 ×1/2/4, snorm8 ×1/2/4, uint8 ×4, unorm16 ×1/2/4, snorm16 ×1/2/4, 10-10-10-2 and 2-10-10-10 unorm. Others give 0. Full-width SINT accesses preserve integer bits. D16 SINT loads saturate to signed 16-bit and D16 stores sign-extend, covered by the synthetic `cs_fmt_sint32.asm` readback. DST_SEL swizzle is applied (0→0, 1→1.0f for float/norm or integer 1 for UINT/SINT, 4..7→X..W). Missing channels repeat the format's own (component *c* = *c* mod *n*), measured on an RX 6700 (SHADER-86). UNORM/SNORM give the correctly rounded quotient by (2ⁿ−1), as the hardware does (0 mismatches vs hardware over 395,776 conversions on that GPU). It is built with integer ops (`Gen.norm_bits`): x/(2ⁿ−1) in binary is x's bits repeated, so a 64-bit multiply by the repeat pattern, `FindUMsb` and the round bit give the f32 exactly (the tail never ends, so there are no ties). `OpFDiv` is not enough on the GPU: Vulkan allows it 2.5 ULP, and on an RX 6700 (AMD Windows 26.11.2) and an RTX 5090 it returned the reciprocal-multiply bits (8_UNORM 130/256 exact, #599). Checked against exact values in `tests/semantic/test_norm_decode.py` (every value up to 8 bits, edges and the reciprocal-multiply misses for 10, 15 and 16 bits). 8_SNORM (2), 16_SNORM (8) and 8_8_SNORM (15) were missing until 2026-11-22 and decoded to 0. Format names list the channel widths from the top bit, so `2_10_10_10` (50) is R10G10B10A2 and `10_10_10_2` (44) has a 2-bit x (Mesa `gfx10_format_table.py`, `ac_formats.c`). Until 2026-11-22 the two were swapped, in stores too. Until 2026-11-21 an element that started mid-dword re-read dword 0 for its tail (`need` was `ceil(size/4)` and only the first dword was shifted); loads now take `need = ceil((byte_shift + size) / 4)` dwords and shift the whole window so the packed stream starts at the element (FUZZ-5, leftover from #234). The 10:10:10:2 order is checked by `cs_fmt_1010102` in `tests/semantic/test_value_semantics.py` (the shader decodes the format, so a GPU run can't check it). Mid-dword spanning elements are checked by `tests/semantic/test_buffer_load_format.py` (`CrossingDwordBoundary`); repeat / UNORM / DST_SEL 1 by the SHADER-86 cases in the same file. The `_xy` and `_xyz` forms (buffer and tbuffer) are GPU-checked by `cs_fmt_xy_xyz.asm`, whose words were measured natively on a Radeon 680M (gfx1035, RDNA2): they write only their 2 or 3 VGPRs, and missing channels repeat there too (TEST-185). | +| Typed buffer loads | The format is V# word3[18:12] (GFX10_FORMAT, from Mesa's `gfx10-rsrc.json`, saved as `tools\gfx10_formats.json`). Supported: f32 ×1–4, u32 ×1–4, i32 ×1–4 (formats 21/63/73/76), f16 ×1/2/4, unorm8 ×1/2/4, snorm8 ×1/2/4, uint8 ×1/2/4, sint8 ×1/2/4, unorm16 ×1/2/4, snorm16 ×1/2/4, uint16 ×1/2/4, sint16 ×1/2/4, 10-10-10-2 and 2-10-10-10 unorm. Others give 0. The 8- and 16-bit UINT/SINT formats 5, 6, 11, 12, 18, 19, 28, 61 and 70 were missing until 2026-11-22 and read 0: UINT channels zero-extend, SINT channels sign-extend, d16 packs them as 16-bit integers, measured natively on gfx1036 (wave32 and wave64) with `tools/hw_oracle` and checked word for word by `tests/semantic/test_buffer_format_narrow_int.py`. Full-width SINT accesses preserve integer bits. D16 SINT loads saturate to signed 16-bit and D16 stores sign-extend, covered by the synthetic `cs_fmt_sint32.asm` readback. DST_SEL swizzle is applied (0→0, 1→1.0f for float/norm or integer 1 for UINT/SINT, 4..7→X..W). Missing channels repeat the format's own (component *c* = *c* mod *n*), measured on an RX 6700 (SHADER-86). UNORM/SNORM give the correctly rounded quotient by (2ⁿ−1), as the hardware does (0 mismatches vs hardware over 395,776 conversions on that GPU). It is built with integer ops (`Gen.norm_bits`): x/(2ⁿ−1) in binary is x's bits repeated, so a 64-bit multiply by the repeat pattern, `FindUMsb` and the round bit give the f32 exactly (the tail never ends, so there are no ties). `OpFDiv` is not enough on the GPU: Vulkan allows it 2.5 ULP, and on an RX 6700 (AMD Windows 26.11.2) and an RTX 5090 it returned the reciprocal-multiply bits (8_UNORM 130/256 exact, #599). Checked against exact values in `tests/semantic/test_norm_decode.py` (every value up to 8 bits, edges and the reciprocal-multiply misses for 10, 15 and 16 bits). 8_SNORM (2), 16_SNORM (8) and 8_8_SNORM (15) were missing until 2026-11-22 and decoded to 0. Format names list the channel widths from the top bit, so `2_10_10_10` (50) is R10G10B10A2 and `10_10_10_2` (44) has a 2-bit x (Mesa `gfx10_format_table.py`, `ac_formats.c`). Until 2026-11-22 the two were swapped, in stores too. Until 2026-11-21 an element that started mid-dword re-read dword 0 for its tail (`need` was `ceil(size/4)` and only the first dword was shifted); loads now take `need = ceil((byte_shift + size) / 4)` dwords and shift the whole window so the packed stream starts at the element (FUZZ-5, leftover from #234). The 10:10:10:2 order is checked by `cs_fmt_1010102` in `tests/semantic/test_value_semantics.py` (the shader decodes the format, so a GPU run can't check it). Mid-dword spanning elements are checked by `tests/semantic/test_buffer_load_format.py` (`CrossingDwordBoundary`); repeat / UNORM / DST_SEL 1 by the SHADER-86 cases in the same file. | +| Images and samplers (core) | Bindless. Set 0: binding 0 = 2D sampled images, 1 = samplers, 2 = descriptor hash table (storage buffer), 3 = 2D-array images (**cube textures are bound here as 6-layer 2D-array views**, cube arrays as 6N layers: the shader already selected the face with `v_cube*`), 4 = r32ui storage images, 5 = 1D, 6 = 3D. A cube sample's s and t come in [1, 2] and its third coordinate is 8·slice + face, as the hardware takes them (Mesa `ac_nir_lower_tex_coords.c`, LLPC `ImageBuilder.cpp`); the view is read at (s − 1, t − 1), layer 6·slice + face. GPU-checked with `runtime/test/shaders/ps_cube_sample.asm` (`vk_texture_test cube`). For a native Metal path, `tools/spirv_metal_set0.py` sizes set 0's runtime arrays from `vulkan_bindless.h` and moves each binding to its own argument-buffer ID range (binding b starts at the capacities of bindings 0..b-1 added up), to convert with SPIRV-Cross `--msl-decoration-binding`: SPIRV-Cross 1.4.363.0 otherwise puts every runtime array at one ID and comments all but one out as "Overlapping binding" (SHADER-161). `cs_imgstore` converted this way writes all 3×64 texels correctly in a native Metal dispatch on an Apple A18 Pro. | +| Typed buffer loads | The format is V# word3[18:12] (GFX10_FORMAT, from Mesa's `gfx10-rsrc.json`, saved as `tools\gfx10_formats.json`). Supported: f32 ×1–4, u32 ×1–4, i32 ×1–4 (formats 21/63/73/76), f16 ×1/2/4, unorm8 ×1/2/4, snorm8 ×1/2/4, uint8 ×1/2/4, sint8 ×1/2/4, unorm16 ×1/2/4, snorm16 ×1/2/4, uint16 ×1/2/4, sint16 ×1/2/4, 10-10-10-2 and 2-10-10-10 unorm. Others give 0. The 8- and 16-bit UINT/SINT formats 5, 6, 11, 12, 18, 19, 28, 61 and 70 were missing until 2026-11-22 and read 0: UINT channels zero-extend, SINT channels sign-extend, d16 packs them as 16-bit integers, measured natively on gfx1036 (wave32 and wave64) with `tools/hw_oracle` and checked word for word by `tests/semantic/test_buffer_format_narrow_int.py`. Full-width SINT accesses preserve integer bits. D16 SINT loads saturate to signed 16-bit and D16 stores sign-extend, covered by the synthetic `cs_fmt_sint32.asm` readback. DST_SEL swizzle is applied (0→0, 1→1.0f for float/norm or integer 1 for UINT/SINT, 4..7→X..W). Missing channels repeat the format's own (component *c* = *c* mod *n*), measured on an RX 6700 (SHADER-86). UNORM/SNORM give the correctly rounded quotient by (2ⁿ−1), as the hardware does (0 mismatches vs hardware over 395,776 conversions on that GPU). It is built with integer ops (`Gen.norm_bits`): x/(2ⁿ−1) in binary is x's bits repeated, so a 64-bit multiply by the repeat pattern, `FindUMsb` and the round bit give the f32 exactly (the tail never ends, so there are no ties). `OpFDiv` is not enough on the GPU: Vulkan allows it 2.5 ULP, and on an RX 6700 (AMD Windows 26.11.2) and an RTX 5090 it returned the reciprocal-multiply bits (8_UNORM 130/256 exact, #599). Checked against exact values in `tests/semantic/test_norm_decode.py` (every value up to 8 bits, edges and the reciprocal-multiply misses for 10, 15 and 16 bits). 8_SNORM (2), 16_SNORM (8) and 8_8_SNORM (15) were missing until 2026-11-22 and decoded to 0. Format names list the channel widths from the top bit, so `2_10_10_10` (50) is R10G10B10A2 and `10_10_10_2` (44) has a 2-bit x (Mesa `gfx10_format_table.py`, `ac_formats.c`). Until 2026-11-22 the two were swapped, in stores too. Until 2026-11-21 an element that started mid-dword re-read dword 0 for its tail (`need` was `ceil(size/4)` and only the first dword was shifted); loads now take `need = ceil((byte_shift + size) / 4)` dwords and shift the whole window so the packed stream starts at the element (FUZZ-5, leftover from #234). The 10:10:10:2 order is checked by `cs_fmt_1010102` in `tests/semantic/test_value_semantics.py` (the shader decodes the format, so a GPU run can't check it). Mid-dword spanning elements are checked by `tests/semantic/test_buffer_load_format.py` (`CrossingDwordBoundary`); repeat / UNORM / DST_SEL 1 by the SHADER-86 cases in the same file. The `_xy` and `_xyz` forms (buffer and tbuffer) are GPU-checked by `cs_fmt_xy_xyz.asm`, whose words were measured natively on a Radeon 680M (gfx1035, RDNA2): they write only their 2 or 3 VGPRs, and missing channels repeat there too (TEST-185). | | Images and samplers (core) | Bindless. Set 0: binding 0 = 2D sampled images, 1 = samplers, 2 = descriptor hash table (storage buffer), 3 = 2D-array images (**cube textures are bound here as 6-layer 2D-array views**, cube arrays as 6N layers: the shader already selected the face with `v_cube*`), 4 = r32ui storage images, 5 = 1D, 6 = 3D. A cube sample's s and t come in [1, 2] and its third coordinate is 8·slice + face, as the hardware takes them (Mesa `ac_nir_lower_tex_coords.c`, LLPC `ImageBuilder.cpp`); the view is read at (s − 1, t − 1), layer 6·slice + face. GPU-checked with `runtime/test/shaders/ps_cube_sample.asm` (`vk_texture_test cube`). | | Descriptor hash table | `uint mask; entries[mask+1] of 10 uints: key[0..7], index, pad`. The key is a T# or a padded S#. FNV-1a over the eight key words selects the first slot. The shared SPIR-V lookup probes up to eight slots and returns index 0 on a miss. The runtime supplies a fallback at index 0 and maps live descriptor keys to bindless indices. | | Packed sample addresses | GFX10 `image_sample_d` with `a16` keeps the non-G16 gradients as f32 and packs the following coordinates as f16 pairs, following LLVM's GFX10 operand layout. `test_a16_sample_gradients_use_full_vgprs` checks the emitted gradient operands, and `ps_texture_grad_a16` checks coordinate selection with a single-mip texture on RTX 5080. The same holds for every extra argument before the coordinates (LLVM `getAddrSizeMIMGOp`: one word each, then the gradients, then the packed halves; llvm-mc takes `v[0:2]` for a 2D `image_sample_c_b ... a16`): an `image_sample_b` bias keeps its VGPR with the f16 in the low half, an `image_sample_c_lz` z-compare its f32 VGPR, and `image_sample_d_cl` its four f32 gradients, with the clamp the half right after the coordinates (an f16 pad may follow it). Until 2026-11-21 those were unpacked as pairs too, and the clamp was taken from the last half. GPU-checked on an NVIDIA GeForce RTX 2060 SUPER (Linux, driver 620.70.06) with `ps_texture_bias_a16`, `ps_sample_c_lz_a16` (`vk_texture_test dref_a16`) and `ps_texture_grad_cl_a16`, which draws on the `--two-mip` texture with the clamp 0 on the left half and 1 on the right: 4096/4096 pixels exact each. The old reading got 4,032 bias pixels and both depth-compare results in 2,048 pixels wrong, a clamp taken from the pad read mip 1 on the left half, and the sample without its clamp mip 0 on the right half (2,048 pixels each). | | Vertex fetch | `s_swappc_b64` at the start of a VS calls a driver-generated fetch program that isn't in the blob. It's replaced by Vulkan vertex inputs: each `ISG1` input-signature element (DXBC container) becomes an input at **location = its D3D input register**, typed by its component type, and is written to **v(4 + 4·register + component)**. That rule was checked over all 788 fetch-calling shaders: in 783 every read-before-write VGPR is predicted by it (715 exact). Reads of components the element doesn't declare (e.g. `.w` of an `xyz` position, 3 VS) are allowed: the fetch returns the format defaults (0, 0, 1), and Vulkan fills a `vec4` input from a narrower format the same way. Inputs are declared as `vec4`. **The runtime must bind vertex buffers by the game's D3D12 input layout, location = input register.** | -| PS system inputs | v0–v1 = barycentrics (consumed by `v_interp`, which becomes attribute inputs). **v2.. = the `SV_Position` components the shader reads, packed in order**. Verified on 2,531 of 3,000 PS: the VGPRs they read before writing equal exactly the position components their input signature reads. Filled from `FragCoord`: xy/z directly, and **w directly too**, because AMD's position-w register holds 1/w (Mesa lowers `load_frag_coord_w_rcp` straight to `frag_pos[3]`, `ac_nir_lower_intrinsics_to_args.c`), the same as Vulkan's `FragCoord.w`. **Front face** follows the used position components when the signature declares `SV_IsFrontFace`, as ±1.0 (Mesa: `load_front_face` = `front_face > 0`). Only enabled inputs are packed, in hardware order (Mesa `radv_shader_args.c`: barycentric pairs, POS_X/Y/Z/W, FRONT_FACE, ANCILLARY, SAMPLE_COVERAGE, POS_FIXED_PT). That explains the earlier "unverified" shaders: 102 read pos.xy + front face, and 76 read pos.x/y/w + front face. **Raw barycentric reads** (321 PS, e.g. `v_readfirstlane_b32 s41, v1`): AMD interpolates P = P0 + i(P1 − P0) + j(P2 − P0), so i/j are the weights of vertices 1/2, which is `BaryCoordKHR.y`/`.z` (`VK_KHR_fragment_shader_barycentric`). GPU-checked with `runtime/test/shaders/ps_bary.asm`: raw i/j equal the interpolated weights on every pixel. This assumes the pair is perspective-center, the only pair this layout models. A PS that reads any other unexplained register inside the system-input range is still rejected (none left in the corpus). Reads past the last hardware input are values undefined on some path, so zero stands in for them. All register arrays start at zero, so translated shaders are deterministic. | -| Inputs and outputs | VS: `v0` = `VertexIndex` (**unverified**: if the console runs vertex shaders as NGG, the input VGPR layout differs). `exp pos0` → `Position`, `exp pos1..pos3` → `ClipDistance` / `CullDistance` (and `Layer`/`ViewportIndex` in VS when `pos1` is the misc vector), `exp paramN` → location N. RDNA2/GFX10 packs clip distances before cull distances contiguously across 4-component `pos` exports (up to 8 floats total), starting at `pos2` when a misc vector (`PointSize`, `EdgeFlag`, `ShadingRate`, `Layer`, `ViewportIndex`; GFX9+ packs `Layer` in `z[10:0]` and `ViewportIndex` in `z[19:16]`) occupies `pos1`, and at `pos1` otherwise (Mesa `src/amd/common/nir/ac_nir_prerast_utils.c`: `ac_nir_export_position`; AMD LLPC `lgc/lowering/LowerInOut.cpp`: `LowerInOut::visitReturnInst`). Slot assignment follows the DXBC `OSG1` signature (`SV_ClipDistance` = 2, `SV_CullDistance` = 3, `SV_RenderTargetArrayIndex` = 4, `SV_ViewportArrayIndex` = 5, `SV_ShadingRate` = 23), ordered by `(semantic_index, register, component)` with clip before cull; when `OSG1` is absent (or declares none of those system values), `pos1..pos3` exports are discarded. PS: `v_interp_*` attribute N → input location N (a location any `*_f16` interp reads is a `PerVertexKHR` array of the producer's raw words instead: see "16-bit interpolation"). A param channel carries the export's raw 32 bits either way. `exp mrtN` → location N, `exp mrtz` x → `FragDepth` when x is on and the export isn't `compr` (RGBA = Z, stencil, sample mask, alpha: Mesa `ac_get_spi_shader_z_format`; the 16-bit compressed mrtz holds stencil and sample mask and never Z, `ac_nir_lower_ps_late.c` `emit_ps_mrtz_export`). Until 2026-11-22 an mrtz export without a depth wrote one anyway (0.0, or an f16 half of the stencil word) and declared `DepthReplacing`. Checked by `tests/test_translate.py` (`test_mrtz_depth_only_from_an_enabled_x`). Stencil, sample mask and alpha exports aren't modelled. | -| 16-bit results | From Mesa ACO (`aco_ir.cpp`: `instr_is_16bit`, `can_use_opsel`) for GFX10: **f16 VOP1/VOP2 ops** (`v_add/sub/subrev/mul/max/min_f16`, `v_fmac_f16`, `v_cvt_f16_f32`, f16 unary) and **opsel-capable VOP3 ops** (`v_fma_f16`, `_e64` forms of the 16-bit integer ops) are **partial writes that keep the high half**. The **VOP2 (`_e32`) 16-bit integer ops** (`v_lshrrev_b16`…) define the whole register, so the high half is modelled as zero. An op_sel destination bit writes the high half. The translator used to clear the high half on f16 ops; that's fixed. **op_sel on f16 VOP3 ops** (`v_fma_f16`, `v_med3_f16`, `v_add/sub/subrev/mul/max/min_f16`, f16 unary, `v_fmac_f16`): bit i (i < number of sources) reads the high half of source i, the last bit writes the high half of the destination; neg/abs apply to the selected half. Source: Mesa ACO `can_use_opsel` and the RDNA2 ISA VOP3 `OP_SEL` field. Checked by the structural tests in `tests/test_f16_op_sel.py` (which half is read, where the result goes) and the value tests in `tests/test_f16_op_sel_values.py`. **Hardware-verified** on an AMD RX 6800 (gfx1030), the instructions run as a raw compute kernel in wave32 and in wave64 (IEEE off, DX10 clamp on, denormals kept, round to nearest; the bytes assemble identically for gfx1013 and gfx1030): **`v_med3_f16`** with all 16 `op_sel` patterns, with neg/abs on a selected high half, with `clamp`, and with the destination also a source; the **plain forms** `v_add/sub/mul/max/min_f16` (`_e32`, and `_e64` with neg/abs/`clamp`), `v_fmac_f16` (`_e32`, and `_e64` with neg/abs; the accumulator is the low half of the destination), `v_rndne/floor/ceil/trunc/fract/sqrt/rcp/rsq_f16` (`_e32` and `_e64`) and `v_cvt_f16_f32`: low halves in, low half out, high half of the destination kept. 336 words per wave size (plus `v_rsq_f16_e64` and `v_ceil_f16_e64` in a later run), all as the rule says and as the translator computes. **Vulkan** (AMD Radeon RX 6800, Windows, driver 26.11.2; the nine `ps_f16_*` fixtures also pass on an NVIDIA RTX 4050 Laptop and an AMD Radeon 740M (RADV), both Linux): `ps_f16_med3_opsel`, `ps_f16_med3_mods`, `ps_f16_vop2`, `ps_f16_vop2b`, `ps_f16_vop1`, `ps_f16_vop1b`, whose expected words are the hardware ones (`tests/test_f16_hw_words.py` checks them against the rule and the translator without a GPU). **Not expressible, so not verified:** `op_sel` on the VOP2 and VOP1 ops in VOP3 encoding (`v_add/sub/mul/max/min_f16_e64`, `v_fmac_f16_e64`, the unary `_e64` forms, `v_cvt_f16_f32_e64`): llvm-mc 21 rejects the modifier for gfx1013 and gfx1030, and its disassembler prints bytes that have those bits set without it (`03 08 32 d5 01 05 02 00` comes back as `v_add_f16_e64 v3, v1, v2`). The translator's `op_sel` handling for these forms is therefore never reached from a disassembly listing and rests on the ISA field description alone; whether the hardware honours the bits there is unknown, and a blob that set them would be translated as if they were clear. Also unverified: NaN and denormal operands, other rounding and IEEE modes, outside the f16 transcendentals (measured, see the f16 transcendentals row). **Driver quirk (AMD Windows driver 26.11.1, RX 9070):** `valu_fuzz` f16 seed 3 programme 38 loses the high half of v26: `v_add_f16_e32 v26, v29, v32` then `v_sub_nc_u16_e64 v28, v32, v27 op_sel:[1,1,0]` then `v_add_f16_e64 v26, v26, v28` — the final add should keep `0xCD52` in the high half, but the GPU returns `0xEEEEEEEE` (native) / `0x00000000` (`--emulate`), all 64 threads. Bisected to the pair: the add's two sources must both have been produced by earlier partial writes; either alone, a NaN input alone, or `dst==src0` alone all pass. The emitted SPIR-V was checked with `spirv-dis` in both modes: the keep (load old v26, `AND 0xFFFF0000`, `OR` new low half, store to index 26) is present and correctly addressed, so the translator is clear and this is the driver miscompiling the pattern. Minimal reproducer: the three ops above with programme 38's inits (v26 `0xCD524000`, v28 `0xC692D243`, v29 `0xBC004200`, v32 `0xB35ABD4B`, v27 `0xB48ABA06`). Pinned by `tests/test_values.py` (`v_add_f16_e64_keep_hi`, `v_add_f16_e32_keep_hi`), which check the translator's keep, not the driver. Found and bisected by 1TrickOmen, reported on #634. | -| PS system inputs | v0–v1 = barycentrics (consumed by `v_interp`, which becomes attribute inputs). **v2.. = the `SV_Position` components the shader reads, packed in order**. Verified on 2,531 of 3,000 PS: the VGPRs they read before writing equal exactly the position components their input signature reads. Filled from `FragCoord`: xy/z directly, and **w directly too**, because AMD's position-w register holds 1/w (Mesa lowers `load_frag_coord_w_rcp` straight to `frag_pos[3]`, `ac_nir_lower_intrinsics_to_args.c`), the same as Vulkan's `FragCoord.w`. **Front face** follows the used position components when the signature declares `SV_IsFrontFace`, as ±1.0 (Mesa: `load_front_face` = `front_face > 0`). Only enabled inputs are packed, in hardware order (Mesa `radv_shader_args.c`: barycentric pairs, POS_X/Y/Z/W, FRONT_FACE, ANCILLARY, SAMPLE_COVERAGE, POS_FIXED_PT). That explains the earlier "unverified" shaders: 102 read pos.xy + front face, and 76 read pos.x/y/w + front face. **Raw barycentric reads** (321 PS, e.g. `v_readfirstlane_b32 s41, v1`): AMD interpolates P = P0 + i(P1 − P0) + j(P2 − P0), so i/j are the weights of vertices 1/2, which is `BaryCoordKHR.y`/`.z` (`VK_KHR_fragment_shader_barycentric`). GPU-checked with `runtime/test/shaders/ps_bary.asm`: raw i/j equal the interpolated weights on every pixel. The pair is perspective-center, the only pair this layout models; that holds for every corpus PS (row "PS interpolation modes"). A PS that reads any other unexplained register inside the system-input range is still rejected (none left in the corpus). Reads past the last hardware input are values undefined on some path, so zero stands in for them. All register arrays start at zero, so translated shaders are deterministic. | -| Inputs and outputs | VS: `v0` = `VertexIndex` (**unverified**: if the console runs vertex shaders as NGG, the input VGPR layout differs). `exp pos0` → `Position`, `exp pos1..pos3` → `ClipDistance` / `CullDistance` (and `Layer`/`ViewportIndex` in VS when `pos1` is the misc vector), `exp paramN` → location N. RDNA2/GFX10 packs clip distances before cull distances contiguously across 4-component `pos` exports (up to 8 floats total), starting at `pos2` when a misc vector (`PointSize`, `EdgeFlag`, `ShadingRate`, `Layer`, `ViewportIndex`; GFX9+ packs `Layer` in `z[10:0]` and `ViewportIndex` in `z[19:16]`) occupies `pos1`, and at `pos1` otherwise (Mesa `src/amd/common/nir/ac_nir_prerast_utils.c`: `ac_nir_export_position`; AMD LLPC `lgc/lowering/LowerInOut.cpp`: `LowerInOut::visitReturnInst`). Slot assignment follows the DXBC `OSG1` signature (`SV_ClipDistance` = 2, `SV_CullDistance` = 3, `SV_RenderTargetArrayIndex` = 4, `SV_ViewportArrayIndex` = 5, `SV_ShadingRate` = 23), ordered by `(semantic_index, register, component)` with clip before cull; when `OSG1` is absent (or declares none of those system values), `pos1..pos3` exports are discarded. PS: `v_interp_*` attribute N → input location N. `exp mrtN` → location N, `exp mrtz` x → `FragDepth` when x is on and the export isn't `compr` (RGBA = Z, stencil, sample mask, alpha: Mesa `ac_get_spi_shader_z_format`; the 16-bit compressed mrtz holds stencil and sample mask and never Z, `ac_nir_lower_ps_late.c` `emit_ps_mrtz_export`). Until 2026-11-22 an mrtz export without a depth wrote one anyway (0.0, or an f16 half of the stencil word) and declared `DepthReplacing`. Checked by `tests/test_translate.py` (`test_mrtz_depth_only_from_an_enabled_x`). Stencil, sample mask and alpha exports aren't modelled. | -| 16-bit results | From Mesa ACO (`aco_ir.cpp`: `instr_is_16bit`, `can_use_opsel`) for GFX10: **f16 VOP1/VOP2 ops** (`v_add/sub/subrev/mul/max/min_f16`, `v_fmac_f16`, `v_cvt_f16_f32`, f16 unary) and **opsel-capable VOP3 ops** (`v_fma_f16`, `_e64` forms of the 16-bit integer ops) are **partial writes that keep the high half**. The **VOP2 (`_e32`) 16-bit integer ops** (`v_lshrrev_b16`…) define the whole register, so the high half is modelled as zero. An op_sel destination bit writes the high half. The translator used to clear the high half on f16 ops; that's fixed. **op_sel on f16 VOP3 ops** (`v_fma_f16`, `v_med3_f16`, `v_add/sub/subrev/mul/max/min_f16`, f16 unary, `v_fmac_f16`): bit i (i < number of sources) reads the high half of source i, the last bit writes the high half of the destination; neg/abs apply to the selected half. Source: Mesa ACO `can_use_opsel` and the RDNA2 ISA VOP3 `OP_SEL` field. Checked by the structural tests in `tests/test_f16_op_sel.py` (which half is read, where the result goes) and the value tests in `tests/test_f16_op_sel_values.py`. **Hardware-verified** on an AMD RX 6800 (gfx1030), the instructions run as a raw compute kernel in wave32 and in wave64 (IEEE off, DX10 clamp on, denormals kept, round to nearest; the bytes assemble identically for gfx1013 and gfx1030): **`v_med3_f16`** with all 16 `op_sel` patterns, with neg/abs on a selected high half, with `clamp`, and with the destination also a source; the **plain forms** `v_add/sub/mul/max/min_f16` (`_e32`, and `_e64` with neg/abs/`clamp`), `v_fmac_f16` (`_e32`, and `_e64` with neg/abs; the accumulator is the low half of the destination), `v_rndne/floor/ceil/trunc/fract/sqrt/rcp/rsq_f16` (`_e32` and `_e64`) and `v_cvt_f16_f32`: low halves in, low half out, high half of the destination kept. 336 words per wave size (plus `v_rsq_f16_e64` and `v_ceil_f16_e64` in a later run), all as the rule says and as the translator computes. **Vulkan** (AMD Radeon RX 6800, Windows, driver 26.11.2; the nine `ps_f16_*` fixtures also pass on an NVIDIA RTX 4050 Laptop and an AMD Radeon 740M (RADV), both Linux): `ps_f16_med3_opsel`, `ps_f16_med3_mods`, `ps_f16_vop2`, `ps_f16_vop2b`, `ps_f16_vop1`, `ps_f16_vop1b`, whose expected words are the hardware ones (`tests/test_f16_hw_words.py` checks them against the rule and the translator without a GPU). **Not expressible, so not verified:** `op_sel` on the VOP2 and VOP1 ops in VOP3 encoding (`v_add/sub/mul/max/min_f16_e64`, `v_fmac_f16_e64`, the unary `_e64` forms, `v_cvt_f16_f32_e64`): llvm-mc 21 rejects the modifier for gfx1013 and gfx1030, and its disassembler prints bytes that have those bits set without it (`03 08 32 d5 01 05 02 00` comes back as `v_add_f16_e64 v3, v1, v2`). The translator's `op_sel` handling for these forms is therefore never reached from a disassembly listing and rests on the ISA field description alone; whether the hardware honours the bits there is unknown, and a blob that set them would be translated as if they were clear. Also unverified: NaN and denormal operands, other rounding and IEEE modes, outside the f16 transcendentals (measured, see the f16 transcendentals row). | | PS system inputs | v0–v1 = barycentrics (consumed by `v_interp`, which becomes attribute inputs). **v2.. = the `SV_Position` components the shader reads, packed in order**. Verified on 2,531 of 3,000 PS: the VGPRs they read before writing equal exactly the position components their input signature reads. Filled from `FragCoord`: xy/z directly, and **w directly too**, because AMD's position-w register holds 1/w (Mesa lowers `load_frag_coord_w_rcp` straight to `frag_pos[3]`, `ac_nir_lower_intrinsics_to_args.c`), the same as Vulkan's `FragCoord.w`. **Front face** follows the used position components when the signature declares `SV_IsFrontFace`, as ±1.0 (Mesa: `load_front_face` = `front_face > 0`). Only enabled inputs are packed, in hardware order (Mesa `radv_shader_args.c`: barycentric pairs, POS_X/Y/Z/W, FRONT_FACE, ANCILLARY, SAMPLE_COVERAGE, POS_FIXED_PT). That explains the earlier "unverified" shaders: 102 read pos.xy + front face, and 76 read pos.x/y/w + front face. **Raw barycentric reads** (321 PS, e.g. `v_readfirstlane_b32 s41, v1`): AMD interpolates P = P0 + i(P1 − P0) + j(P2 − P0), so i/j are the weights of vertices 1/2, which is `BaryCoordKHR.y`/`.z` (`VK_KHR_fragment_shader_barycentric`). GPU-checked with `runtime/test/shaders/ps_bary.asm`: raw i/j equal the interpolated weights on every pixel. The pair is perspective-center, the only pair this layout models; that holds for every corpus PS (row "PS interpolation modes"). A PS that reads any other unexplained register inside the system-input range is still rejected (none left in the corpus). Reads past the last hardware input are values undefined on some path, so zero stands in for them. All register arrays start at zero, so translated shaders are deterministic. | | Inputs and outputs | VS: `v0` = `VertexIndex` (**unverified**: if the console runs vertex shaders as NGG, the input VGPR layout differs). `exp pos0` → `Position`, `exp pos1..pos3` → `ClipDistance` / `CullDistance` (and `Layer`/`ViewportIndex` in VS when `pos1` is the misc vector), `exp paramN` → location N. RDNA2/GFX10 packs clip distances before cull distances contiguously across 4-component `pos` exports (up to 8 floats total), starting at `pos2` when a misc vector (`PointSize`, `EdgeFlag`, `ShadingRate`, `Layer`, `ViewportIndex`; GFX9+ packs `Layer` in `z[10:0]` and `ViewportIndex` in `z[19:16]`) occupies `pos1`, and at `pos1` otherwise (Mesa `src/amd/common/nir/ac_nir_prerast_utils.c`: `ac_nir_export_position`; AMD LLPC `lgc/lowering/LowerInOut.cpp`: `LowerInOut::visitReturnInst`). Slot assignment follows the DXBC `OSG1` signature (`SV_ClipDistance` = 2, `SV_CullDistance` = 3, `SV_RenderTargetArrayIndex` = 4, `SV_ViewportArrayIndex` = 5, `SV_ShadingRate` = 23), ordered by `(semantic_index, register, component)` with clip before cull; when `OSG1` is absent (or declares none of those system values), `pos1..pos3` exports are discarded. PS: `v_interp_*` attribute N → input location N (a location any `*_f16` interp reads is a `PerVertexKHR` array of the producer's raw words instead: see "16-bit interpolation"). A param channel carries the export's raw 32 bits either way. `exp mrtN` → location N, `exp mrtz` x → `FragDepth` when x is on and the export isn't `compr` (RGBA = Z, stencil, sample mask, alpha: Mesa `ac_get_spi_shader_z_format`; the 16-bit compressed mrtz holds stencil and sample mask and never Z, `ac_nir_lower_ps_late.c` `emit_ps_mrtz_export`). Until 2026-11-22 an mrtz export without a depth wrote one anyway (0.0, or an f16 half of the stencil word) and declared `DepthReplacing`. Checked by `tests/test_translate.py` (`test_mrtz_depth_only_from_an_enabled_x`). Stencil, sample mask and alpha exports aren't modelled. | | 16-bit results | From Mesa ACO (`aco_ir.cpp`: `instr_is_16bit`, `can_use_opsel`) for GFX10: **f16 VOP1/VOP2 ops** (`v_add/sub/subrev/mul/max/min_f16`, `v_fmac_f16`, `v_cvt_f16_f32`, f16 unary) and **opsel-capable VOP3 ops** (`v_fma_f16`, `_e64` forms of the 16-bit integer ops) are **partial writes that keep the high half**. The **VOP2 (`_e32`) 16-bit integer ops** (`v_lshrrev_b16`…) define the whole register, so the high half is modelled as zero. An op_sel destination bit writes the high half. The translator used to clear the high half on f16 ops; that's fixed. **op_sel on f16 VOP3 ops** (`v_fma_f16`, `v_med3_f16`, `v_add/sub/subrev/mul/max/min_f16`, f16 unary, `v_fmac_f16`): bit i (i < number of sources) reads the high half of source i, the last bit writes the high half of the destination; neg/abs apply to the selected half. Source: Mesa ACO `can_use_opsel` and the RDNA2 ISA VOP3 `OP_SEL` field. Checked by the structural tests in `tests/test_f16_op_sel.py` (which half is read, where the result goes) and the value tests in `tests/test_f16_op_sel_values.py`. **Hardware-verified** on an AMD RX 6800 (gfx1030), the instructions run as a raw compute kernel in wave32 and in wave64 (IEEE off, DX10 clamp on, denormals kept, round to nearest; the bytes assemble identically for gfx1013 and gfx1030): **`v_med3_f16`** with all 16 `op_sel` patterns, with neg/abs on a selected high half, with `clamp`, and with the destination also a source; the **plain forms** `v_add/sub/mul/max/min_f16` (`_e32`, and `_e64` with neg/abs/`clamp`), `v_fmac_f16` (`_e32`, and `_e64` with neg/abs; the accumulator is the low half of the destination), `v_rndne/floor/ceil/trunc/fract/sqrt/rcp/rsq_f16` (`_e32` and `_e64`) and `v_cvt_f16_f32`: low halves in, low half out, high half of the destination kept. 336 words per wave size (plus `v_rsq_f16_e64` and `v_ceil_f16_e64` in a later run), all as the rule says and as the translator computes. **Vulkan** (AMD Radeon RX 6800, Windows, driver 26.11.2; the nine `ps_f16_*` fixtures also pass on an NVIDIA RTX 4050 Laptop and an AMD Radeon 740M (RADV), both Linux): `ps_f16_med3_opsel`, `ps_f16_med3_mods`, `ps_f16_vop2`, `ps_f16_vop2b`, `ps_f16_vop1`, `ps_f16_vop1b`, whose expected words are the hardware ones (`tests/test_f16_hw_words.py` checks them against the rule and the translator without a GPU). **Not expressible, so not verified:** `op_sel` on the VOP2 and VOP1 ops in VOP3 encoding (`v_add/sub/mul/max/min_f16_e64`, `v_fmac_f16_e64`, the unary `_e64` forms, `v_cvt_f16_f32_e64`): llvm-mc 21 rejects the modifier for gfx1013 and gfx1030, and its disassembler prints bytes that have those bits set without it (`03 08 32 d5 01 05 02 00` comes back as `v_add_f16_e64 v3, v1, v2`). The translator's `op_sel` handling for these forms is therefore never reached from a disassembly listing and rests on the ISA field description alone; whether the hardware honours the bits there is unknown, and a blob that set them would be translated as if they were clear. Also unverified: NaN and denormal operands, other rounding and IEEE modes, outside the f16 transcendentals (measured, see the f16 transcendentals row). **Driver quirk (AMD Windows driver 26.11.1, RX 9070):** `valu_fuzz` f16 seed 3 programme 38 loses the high half of v26: `v_add_f16_e32 v26, v29, v32` then `v_sub_nc_u16_e64 v28, v32, v27 op_sel:[1,1,0]` then `v_add_f16_e64 v26, v26, v28` — the final add should keep `0xCD52` in the high half, but the GPU returns `0xEEEEEEEE` (native) / `0x00000000` (`--emulate`), all 64 threads. Bisected to the pair: the add's two sources must both have been produced by earlier partial writes; either alone, a NaN input alone, or `dst==src0` alone all pass. The emitted SPIR-V was checked with `spirv-dis` in both modes: the keep (load old v26, `AND 0xFFFF0000`, `OR` new low half, store to index 26) is present and correctly addressed, so the translator is clear and this is the driver miscompiling the pattern. Minimal reproducer: the three ops above with programme 38's inits (v26 `0xCD524000`, v28 `0xC692D243`, v29 `0xBC004200`, v32 `0xB35ABD4B`, v27 `0xB48ABA06`). Pinned by `tests/test_values.py` (`v_add_f16_e64_keep_hi`, `v_add_f16_e32_keep_hi`), which check the translator's keep, not the driver. Found and bisected by 1TrickOmen, reported on #634. | -| f16 inline constants | An inline float constant (`0.5`, `1.0`, `2.0`, `4.0`, their negatives, `0.15915494`) in an operand of a 16-bit float op is the **f16 value in the low half with a zero high half**, not f32 bits (the translator used to unpack the f32 pattern, whose low half is 0, so `v_add_f16 d, 1.0, v` added 0.0). Measured on an AMD RX 6800 (gfx1030) raw kernel, wave32 and wave64: `v_add/mul/max_f16`, `v_sub_f16_e64`, `v_fma_f16`, `v_fmac_f16`, `v_rcp_f16`, `v_med3_f16`, `v_cmp_lt_f16`, `v_cvt_f32_f16` (`0.5` gives `0x3f000000`), `v_cos_f16`, `v_pk_add_f16`/`v_pk_mul_f16` (the high result half sees 0.0), `v_pack_b32_f16`; `0.15915494` is `0x3118`; the high half `op_sel` selects from a constant reads +0.0 (`v_med3_f16`, `v_fma_f16`, `v_pack_b32_f16`, `v_pk_add_f16` with swapped halves). GPU tests `ps_f16_const`, `ps_f16_const2` and `ps_f16_pack` (Vulkan: AMD Radeon RX 6800, Windows, driver 26.11.2; all three fail without the fix). Constants in `v_fma_mix_f32`/`v_fma_mixlo/mixhi_f16` operands follow the same rule per operand (measured on an RDNA2 iGPU, gfx1036, SHADER-135): f32 bits where `op_sel_hi` makes the operand f32, the f16 constant with a zero high half where it makes it f16, so `op_sel` with `op_sel_hi` reads +0.0; an integer constant is its 32-bit integer. The translator gives the same words (docs/shader_validation.md, "f16 output modifiers, clamp and `v_fma_mix*` operands on RDNA2"). | +| f16 inline constants | An inline float constant (`0.5`, `1.0`, `2.0`, `4.0`, their negatives, `0.15915494`) in an operand of a 16-bit float op is the **f16 value in the low half with a zero high half**, not f32 bits (the translator used to unpack the f32 pattern, whose low half is 0, so `v_add_f16 d, 1.0, v` added 0.0). Measured on an AMD RX 6800 (gfx1030) raw kernel, wave32 and wave64: `v_add/mul/max_f16`, `v_sub_f16_e64`, `v_fma_f16`, `v_fmac_f16`, `v_rcp_f16`, `v_med3_f16`, `v_cmp_lt_f16`, `v_cvt_f32_f16` (`0.5` gives `0x3f000000`), `v_cos_f16`, `v_pk_add_f16`/`v_pk_mul_f16` (the high result half sees 0.0), `v_pack_b32_f16`; `0.15915494` is `0x3118`; the high half `op_sel` selects from a constant reads +0.0 (`v_med3_f16`, `v_fma_f16`, `v_pack_b32_f16`, `v_pk_add_f16` with swapped halves). GPU tests `ps_f16_const`, `ps_f16_const2` and `ps_f16_pack` (Vulkan: AMD Radeon RX 6800, Windows, driver 26.11.2; all three fail without the fix). Constants in `v_fma_mix_f32`/`v_fma_mixlo/mixhi_f16` operands follow the same rule per operand (measured on an RDNA2 iGPU, gfx1036, SHADER-135): f32 bits where `op_sel_hi` makes the operand f32, the f16 constant with a zero high half where it makes it f16, so `op_sel` with `op_sel_hi` reads +0.0; an integer constant is its 32-bit integer. The translator gives the same words for the float constants in every `op_sel`/`op_sel_hi` combination and for the integer constants as f16 halves, but not for `1` and `64` as f32 operands: their bits are f32 denormals, which gfx1036 flushes to a zero of their sign (`denorm_mode_32 = 0`, the MODE the translator assumes for the game) and the translator keeps (difference 4 in docs/shader_validation.md, "f16 output modifiers, clamp and `v_fma_mix*` operands on RDNA2"). | | `v_pack_b32_f16` input `neg` | A VOP3 `neg` on an operand of this instruction flips the sign bit of **the 16-bit half that operand contributes**, not of the whole 32-bit source, and only that half: measured on gfx1036 (RDNA2 iGPU, AMD Windows driver 32.0.21044.64) with 192 raw kernels, `0x7c01` gives `0xfc01` under IEEE mode 0 and `0xfe01` under mode 1, in either half and with `op_sel`. The translator moved the bits unchanged and refused every modifier; it now XORs `0x8000` into the selected half. `abs` is still refused, because its rule on this instruction is unmeasured (SHADER-260), and the mode-1 quieting of a signalling-NaN half is not modelled while SHADER-190 is open; under mode 0, where the bits move unchanged, the translation is exact. Checked on the CPU by `tests/test_values.py` and `tests/semantic/test_vop3_const_mods.py`; the gfx1036 measurement above is @Sanonymous01's, not repeated here. | | Packed 16-bit integer ops (`v_pk_add/sub_u16/i16`, `v_pk_mul_lo_u16`, `v_pk_mad_u16/i16`, `v_pk_max/min_u16/i16`) | VOP3P: result half 0 takes each source's half from `op_sel[i]`, result half 1 from `op_sel_hi[i]` (defaults `[0,..]` and `[1,..]`), as for `v_pk_lshlrev_b16`. Each half is computed on its own and wraps to 16 bits. `clamp` (add, sub, mad) saturates the half to its type's range; the exact value fits in 32 bits. `neg_lo`/`neg_hi` are float-only and raise `Unsupported`, as does `clamp` on the other ops. A constant operand reads as its low 16 bits. Its high half under `op_sel`/`op_sel_hi` is **not measured** for integer ops (for f16 constants it reads +0.0, see the row above), so a constant whose high half would be read raises `Unsupported` instead of guessing; the compiler's usual form, `op_sel_hi:[1,0]` with the constant second, reads only the low half. Until 2026-11-22 all eleven ops raised `Unsupported`. CPU-checked by `tests/semantic/test_alu_pk_int16.py` (value grids, seeded `mad`, `op_sel`/`op_sel_hi` combinations, `clamp` including the unsigned `sub` floor, constants, rejected forms). **Not GPU-verified.** | | `v_sin_f32`, `v_cos_f32`, `v_sin_f16`, `v_cos_f16` | The operand is an angle in turns (the ISA says valid over +-256; the measurement below finds no such limit on gfx1030). `turn_angle` reduces it in turns first, `x - RoundEven(x)` (exact in binary32, in [-0.5, 0.5]), then scales by `2*pi` and calls `Sin`/`Cos`, so the angle stays in [-pi, pi], the only range where GLSL guarantees them (2^-11 absolute). Scaling first rounded the fractional turn away (about 1.2e-4 rad near 255 turns, #594); the first fix (#1283) reduced with `Fract`, which rounds `1 - |x|` for a negative x and lost `-2^-26` (it returned +0; absolute errors up to ~1.7e-7 at -0.1 turns), so the reduction is `RoundEven`-centred. `RoundEven` rather than `Round` so +-0.5 turn reduce symmetrically. inf and NaN still give NaN, and a zero operand is passed through unreduced so `sin(-0)` stays -0. CPU-checked by `tests/semantic/test_alu_sincos.py` against `sin`/`cos(2*pi*x)` in double (large angles, tiny arguments, whole turns of either sign, +-0, inf/NaN, modifiers, f16) and `tests/semantic/test_valu_sin_cos_turns.py` (#1283). GPU test `cs_w32_sincos` (large angles within 1e-3, since the driver `Sin` is only good to 2^-11) is a regression guard, not proof the old form failed on a given driver. Measured on an AMD Radeon RX 6800 (gfx1030, not the console's gfx1013) by @shelbykb2 (#616): whole and half turns of either sign give +0 (only `sin(-0)` is -0, so no sign needs copying onto a zero result, as here); there is no +-256 limit on that card (any finite x reduces exactly: `sin(300.25)` = 1, `sin(2^24)` = +0); the f16 forms reduce the same way as the f32 ones; +-inf gives a NaN and a NaN passes through, quieted with IEEE mode on. Known differences from this translation: at half turns `Sin` of the rounded pi gives about -+8.7e-8 where the hardware returns exactly 0, likewise `cos` at quarter turns; for |x| <= 2^-12 the hardware multiplies by `0x40c90fd5`, not the rounded 2*pi; the inf/NaN words are whatever the host driver returns. Not checked on gfx1013. | @@ -265,19 +259,21 @@ How the generated SPIR-V expects the runtime to work: | Mesh shaders as compute (`--mesh-compute`) | For devices without `VK_EXT_mesh_shader` (NVIDIA Pascal, for one). Each mesh shader becomes a `GLCompute` module with the same workgroup size and code; only the epilogue changes. Instead of `OpSetMeshOutputsEXT` and the mesh outputs, after the same barrier lane 0 writes the vertex and primitive counts, lane i < vertex count writes its vertex and lane i < primitive count its primitive into this workgroup's **slot** of an output buffer: slot = linear workgroup index (x + y·nx + z·nx·ny) × `slot_bytes`, computed in 64 bits. The buffer's device address is in push-constant dwords 36–37, so these modules declare 152 bytes. Slot layout (`rdna2spirv.mesh_compute_layout`, recorded per shader as `mesh_compute` in the index), all 16-byte aligned: a header (vertex count, primitive count), then `max_vertices` vertices, each holding the position, the clip and then cull distances padded to whole vec4s, and one vec4 per param location; then `max_primitives` primitives of three vertex indices plus 1 if culled. The modules need no mesh capability, extension or `shaderClipDistance`. `tools/mesh_compute_vs.py` writes the vertex shader that draws the slots with a non-indexed `vkCmdDraw(groups × max_primitives × 3)`: vertex v is workgroup v / (3·max_primitives), primitive (v / 3) mod max_primitives, corner v mod 3. A primitive past the count, or one culled, gets one position outside the clip volume at all three corners and is clipped. Otherwise the corner's index, clamped to `max_vertices` − 1, selects the vertex, and its position, distances and params go out at the mesh shader's locations, so the pixel shader is unchanged. One draw rasterizes in vertex order, which is workgroup then primitive order, as with mesh workgroups. Corpus: all 9,282 mesh shaders are 128×1×1 with 128/128 outputs, wave64, 0–18 params, clip distances in 1,906, cull distances and per-primitive attributes in none, no task shaders. On a 32-wide device combine it with `--wave64-emulate`. GPU-checked on an NVIDIA GeForce GTX 1060 6GB (Pascal: no mesh shaders; driver 560.94, Windows 10) with `LEONIDA_MESH_COMPUTE=1 LEONIDA_W64_EMULATE=1`: `ms_tri`, `ms_w64x_ballot` and `ms_wave_info_s3` 4096/4096 pixels exact, `ms_clip` 2048/4096 covered as expected, `ms_v5_workgroup` 24/24 workgroup coordinates, zero Khronos validation messages. Checked in `tests/test_mesh_compute.py`. The runtime side, turning a `DispatchMesh` into that dispatch, a barrier and the draw, is the follow-up (it needs the graphics pipelines of #291). Unused primitives still run the vertex shader; compaction with an indirect draw would avoid that. | | Geometry shaders | All 195 are `$GS_VoxelizeGeneric` permutations: legacy (merged ES/GS) wave32 programs on LDS rings, with no `exp`. Inputs: vertex i sits at the dword offset in v0 lo / v0 hi / v1 lo; an LDS read at vertex base + 4·(4·reg + comp) is input-signature register reg, component comp (checked: SV_Position xyz in dwords 0–2 and TEXCOORD0.xy in 4–5, as ISG1 declares). Outputs: emitted vertex k is dwords [k·4·nreg, (k+1)·4·nreg) of the lane's GSVS area, dword = 4·reg + comp of the output signature (20 dwords = 5 OSG1 registers; every write matches a declared mask). Translation: synthetic offsets (vertex i at dword 64·i), LDS reads → `gl_in[i]` inputs, LDS writes → staged slots, `MSG_GS EMIT` → copy slot (emit count) to the outputs + `OpEmitVertex`, `CUT` → `OpEndPrimitive`, `GS_DONE` → nothing. The prologue's `s_bfm_b64`/`s_cselect` EXEC setup is fed s3 = 64 << 8. GPU-checked with `runtime/test/shaders/gs_tri.asm` (`VKH_GS=… vk_harness`): 0 error. Without a geometry stage (Apple GPUs: Metal, MoltenVK), `tools/spirv_gs_to_compute.py` lowers the translated module to a compute capture pass, one invocation per input primitive: inputs come from a buffer, each `OpEmitVertex` writes the outputs to a record buffer, and a meta buffer holds each primitive's vertex count and strip ends, for an ordinary draw afterwards (SHADER-159). `gs_tri` lowered this way, converted with SPIRV-Cross and run natively on an Apple A18 Pro: 195/195 records exact for 65 random triangles, and the captured fullscreen triangle drawn from the records matches all 4096 gradient pixels. Not done: wiring it into a draw path, and GS that use cross-lane operations or more than one invocation. | | Integer clamp | The VOP3 `clamp` bit on `v_add_nc_u32`, `v_sub_nc_u32`, `v_subrev_nc_u32` saturates the result to [0, 0xFFFFFFFF], and on `v_add_nc_i32`/`v_sub_nc_i32` to [0x80000000, 0x7FFFFFFF]; without it they wrap. GFX9+ semantics: LLVM selects `uaddsat`/`usubsat` and `saddsat`/`ssubsat` to exactly these ops with clamp set. **Until this change clamp was silently ignored on the unsigned ops** (and the signed ones were `Unsupported`). Checked on the CPU by `tests/semantic/test_alu_add_nc_clamp.py`. The 16-bit unsigned add/sub (`v_add_nc_u16`, `v_sub_nc_u16`, and the `v_add_u16`/`v_sub_u16`/`v_subrev_u16` `_e64` names) saturate to [0, 0xFFFF] with `clamp` (llvm-mc 21 gfx1030 encodes the bit on them, and LLVM selects i16 `uaddsat`/`usubsat` to them); **until 2026-11-22 the translator wrapped instead**. `clamp` on any other 16-bit integer op raises `Unsupported`. CPU-checked by `tests/semantic/test_alu_u16_clamp.py` (the high half of the destination is kept). **Hardware-verified on RDNA2** (AMD Radeon 680M, `gfx1035`, Windows 11, driver `26.5.1`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137): all 32-bit and 16-bit `*_nc_*` `clamp` cases (including `op_sel` and kept destination half on u16) match hardware bit-for-bit. **Open divergence measured on the same hardware:** `v_add_co_u32`, `v_sub_co_u32`, `v_subrev_co_u32`, `v_add_co_ci_u32`, `v_sub_co_ci_u32` and `v_subrev_co_ci_u32` with `clamp` saturate D (`0xFFFFFFFF` / `0`) while still reporting the real carry/borrow in `sdst`, whereas the translator currently ignores `clamp` on these carry-out ops. | +| Integer clamp | The VOP3 `clamp` bit on `v_add_nc_u32`, `v_sub_nc_u32`, `v_subrev_nc_u32` saturates the result to [0, 0xFFFFFFFF], and on `v_add_nc_i32`/`v_sub_nc_i32` to [0x80000000, 0x7FFFFFFF]; without it they wrap. GFX9+ semantics: LLVM selects `uaddsat`/`usubsat` and `saddsat`/`ssubsat` to exactly these ops with clamp set. **Until this change clamp was silently ignored on the unsigned ops** (and the signed ones were `Unsupported`). Checked on the CPU by `tests/semantic/test_alu_add_nc_clamp.py`. The carry-out unsigned ops (`v_add_co_u32`, `v_sub_co_u32`, `v_subrev_co_u32`, `v_add_co_ci_u32`, `v_sub_co_ci_u32`, `v_subrev_co_ci_u32`) with VOP3 `clamp` likewise saturate D to `0xFFFFFFFF` on add carry or `0` on sub borrow while still reporting the real carry/borrow bit in `sdst` (**until 2026-11-22 the translator ignored `clamp` on all six**); confirmed natively on RDNA2 (AMD Radeon 680M `gfx1035` wave32 & wave64 via `tools/hw_oracle`, and independently on `gfx1036` in #1746) and CPU-checked by `tests/semantic/test_alu_add_co_clamp.py`. The 16-bit unsigned add/sub (`v_add_nc_u16`, `v_sub_nc_u16`, and the `v_add_u16`/`v_sub_u16`/`v_subrev_u16` `_e64` names) saturate to [0, 0xFFFF] with `clamp` (llvm-mc 21 gfx1030 encodes the bit on them, and LLVM selects i16 `uaddsat`/`usubsat` to them); **until 2026-11-22 the translator wrapped instead**. `clamp` on any other 16-bit integer op raises `Unsupported`. CPU-checked by `tests/semantic/test_alu_u16_clamp.py` (the high half of the destination is kept), **not GPU-verified**. | | Gather sampler LOD | Before choosing the mip for the four fetches in `image_gather4_l(_o)`, clamp the requested LOD to S# word 1's MIN_LOD [11:0] and MAX_LOD [23:12] (unsigned 4.8). `ps_gather_sampler_lod.asm` reads the S# from the heap. On RTX 5080 and Radeon Graphics, a maximum of 0.25 selects the base quadrants and a minimum of 0.75 selects the cyan mip across the 64×64 draw. Without these bounds half of each frame reads the wrong level. Radeon also agreed with native `OpImageGather Lod` (`VK_AMD_texture_gather_bias_lod`) for those bounds. At exactly 0.5, with bounds [0,1], that native draw selected mip 1; the emulation now computes the mip as `Floor(LOD + 0.5)`, ties up, and also selects mip 1 (before SHADER-152 it used `RoundEven`, which selected mip 0). | | `s_absdiff_i32`, `s_mul_hi_i32` | `s_absdiff_i32`: D = \|S0 − S1\| with the 32-bit difference wrapped first (0x7FFFFFFF − 0x80000000 → 1; a difference of −2³¹ stays 0x80000000), SCC = D ≠ 0. `s_mul_hi_i32`: high word of the signed 64-bit product, SCC kept. From the RDNA2 ISA pseudocode; checked on the CPU by `tests/semantic/test_salu_absdiff_mul_hi.py`. **Hardware-verified** on an AMD Radeon RX 7900 XTX (gfx1100, Windows 11, driver 26.10.1) as raw wave32 kernels through `tools/hw_oracle`: `s_absdiff_i32(0x7FFFFFFF, 0x80000000)` = 1 and `s_absdiff_i32(0x80000000, 0)` = 0x80000000, both with SCC = 1, and equal operands give 0 with SCC = 0; `s_mul_hi_i32(0x7FFFFFFF, 0x7FFFFFFF)` = 0x3FFFFFFF and `s_mul_hi_i32(-1, 1)` = 0xFFFFFFFF, with SCC left as it was. | | SCC from scalar ALU | `s_and/or/xor/andn2/orn2/nand/nor/xnor_b32` and `s_lshl/lshr_b32` set SCC = result ≠ 0, `s_add/sub_i32` and `s_addk_i32` set it to signed overflow, `s_min_u32`/`s_max_u32` to S0 < S1 / S0 > S1, and `s_min_i32`/`s_max_i32` to the same compared signed: SCC is 1 when S0 is the one chosen, and a tie chooses S1 (RDNA2 ISA, S_MIN_I32: D = S0 < S1 ? S0 : S1, SCC = 1 if S0 is chosen). **Before this fix these ops left SCC unchanged**, so a following `s_cbranch_scc*` read a stale flag, and until 2026-11-21 `s_min_i32`/`s_max_i32` set SCC on a tie. 32-bit scalar shifts now mask the amount to 5 bits. GPU-checked with `runtime/test/shaders/ps_scc.asm` and `ps_scc_minmax.asm` (NVIDIA GeForce RTX 2060 SUPER, Linux, driver 620.70.06: 4096/4096 pixels exact, and all 4096 differ with the old translator). **On lane masks in a wave32 program** (a source is EXEC, VCC or a mask SGPR, or the result goes to EXEC) the 32-bit bitwise ops' result is the whole wave's mask, so SCC is a subgroup vote (`OpGroupNonUniformAny`), as for the `_b64` forms. Until 2026-11-22 each lane took its own bit: `s_and_b32 s0, vcc_lo, exec_lo; s_cbranch_scc0` skipped the block in lanes whose bit was 0, and a loop closed by `s_andn2_b32 exec_lo, ...; s_cbranch_scc1` let each lane leave early. Found and checked by `tools/cf_diff.py` (FUZZ-8, CPU differential against the ISA model); GPU test `runtime/test/shaders/ps_scc_mask32.asm` passes (s5 == 8 on 2,048 pixels, 192 of them with bit 0, and s5 == 7 on 2,048) on an NVIDIA RTX 4050 Laptop (Linux, driver 620.73.04, natively and under `LEONIDA_W64_EMULATE=1`) and an AMD Radeon 740M (RADV, Mesa 26.3.1), and on an RTX 2060 SUPER per #634. A 32-bit op on one half of a wave64 mask still takes the lane's bit (its SCC would be a vote of that half). | | Far branches | `s_getpc_b64; s_add_u32 K; s_addc_u32 0/−1; s_setpc_b64` on the same pair is a branch beyond `s_branch`'s ±32K-dword range. It's folded into one branch to (address after `s_getpc`) + K before CFG construction. | | No-op SOPP/SMEM (`s_icache_inv`, `s_ttracedata`, `s_ttracedata_imm`, `s_code_end`, `s_version`, `ds_nop`, `v_clrexcp`) | Instruction-cache invalidate, thread-trace data, end-of-code padding, the ISA version marker and the DS no-operation have no register, memory, SCC, VCC or EXEC effect, so they are in `NOOPS` with `s_nop` / `v_nop` / `v_pipeflush`. `v_clrexcp` clears the TRAPSTS exception bits, which nothing translated reads (`s_getreg_b32` is unsupported and there are no traps), so it is a no-op too (since 2026-11-22; before, both it and `ds_nop` raised `Unsupported`). The data-cache invalidations (`buffer_gl0_inv`, `buffer_gl1_inv`, `s_dcache_inv`, `s_gl1_inv`) concern coherence between waves and stay `Unsupported`. Source: RDNA2 ISA SOPP/SOPK/SMEM/DS/VOP1. CPU-checked by `tests/semantic/test_sopp_noops.py` (values, SCC and VCC survive; the data-cache invalidations are still rejected). | -| Buffer format stores | `buffer_store_format_*` and `_d16_*` encode every format the loads decode (the same FORMATS table: f32/u32, f16, unorm/snorm 8/16/10-10-10-2, uint 8/16). 1–2-byte elements are merged into their dword with atomic and/or so neighbours are kept. The atomics use element 0 of the array at the aligned dword address, which also compiles on MoltenVK 1.4.0 (checked with `cs_store` on an Apple M3 Max and Mesa llvmpipe). d16 data is unpacked first (f16 → float for float kinds, 16-bit integers for integer kinds). Before this, only four f32 formats, rgba16f and rgba8 unorm were stored, and everything else silently stored nothing. GPU-checked with `runtime/test/shaders/cs_store.asm` (rgba8 unorm, R10G10B10A2 (`2_10_10_10`), two r16f halves of one dword, d16 rgba16f: exact, neighbours untouched). `buffer_load_format_d16_*` packs pairs the same way. UNORM/SNORM stores convert NaN to zero before clamping. On native gfx1036, `buffer_store_format_d16_xyzw` into RGBA8_UNORM/SNORM matched clamp, scale by 255/127 and round to nearest even for all 63,488 finite binary16 encodings. Both infinities saturated and all 2,046 NaNs stored zero in both wave32 and wave64. The translated sweep matched all 65,536 bytes per format on RTX 5080 and Radeon Graphics. A store with fewer components than its format writes the whole element, with 0 for the components it doesn't give (`_xy` into 32_32_32_32 leaves z = w = 0, `_xyz` into 16_16_16_16 leaves w = 0); into a one-channel format only x is written. Measured natively on a Radeon 680M (gfx1035, RDNA2), and GPU-checked by `cs_fmt_xy_xyz.asm` for 32_32_32_32, 16_16_16_16, 8_8_8_8 UNORM and UINT and 32 (TEST-185). Unsigned integer stores saturate to the destination channel width. On native gfx1036, RGBA8_UINT, RG16_UINT and RGBA16_UINT clipped overflowing inputs to 255 or 65535, with RGBA32_UINT as a full-width control. `tbuffer_store_format_*` is not translated. | +| Buffer format stores | `buffer_store_format_*` and `_d16_*` encode every format the loads decode (the same FORMATS table: f32/u32, f16, unorm/snorm 8/16/10-10-10-2, uint 8/16). 1–2-byte elements are merged into their dword with atomic and/or so neighbours are kept. The atomics use element 0 of the array at the aligned dword address, which also compiles on MoltenVK 1.4.0 (checked with `cs_store` on an Apple M3 Max and Mesa llvmpipe). d16 data is unpacked first (f16 → float for float kinds, 16-bit integers for integer kinds). Before this, only four f32 formats, rgba16f and rgba8 unorm were stored, and everything else silently stored nothing. GPU-checked with `runtime/test/shaders/cs_store.asm` (rgba8 unorm, R10G10B10A2 (`2_10_10_10`), two r16f halves of one dword, d16 rgba16f: exact, neighbours untouched). `buffer_load_format_d16_*` packs pairs the same way. UNORM/SNORM stores convert NaN to zero before clamping. On native gfx1036, `buffer_store_format_d16_xyzw` into RGBA8_UNORM/SNORM matched clamp, scale by 255/127 and round to nearest even for all 63,488 finite binary16 encodings. Both infinities saturated and all 2,046 NaNs stored zero in both wave32 and wave64. The translated sweep matched all 65,536 bytes per format on RTX 5080 and Radeon Graphics. A store with fewer components than its format writes the whole element, with 0 for the components it doesn't give (`_xy` into 32_32_32_32 leaves z = w = 0, `_xyz` into 16_16_16_16 leaves w = 0); into a one-channel format only x is written. Measured natively on a Radeon 680M (gfx1035, RDNA2), and GPU-checked by `cs_fmt_xy_xyz.asm` for 32_32_32_32, 16_16_16_16, 8_8_8_8 UNORM and UINT and 32 (TEST-185). Unsigned integer stores saturate to the destination channel width. On native gfx1036, RGBA8_UINT, RG16_UINT and RGBA16_UINT clipped overflowing inputs to 255 or 65535, with RGBA32_UINT as a full-width control. `tbuffer_store_format_*` and its `_d16_*` forms take the instruction's format instead of the V#'s, as the tbuffer loads do: only that format is encoded, and its element size decides the bounds check (an 8_UNORM byte is stored where the V#'s 16-byte element would not fit; a 16-byte element is dropped where the V#'s 4-byte one would fit). A V# whose FORMAT is 0 (INVALID) still disables the store. No `format:` modifier is GFX10's default, BUF_FMT_8_UNORM; a format FORMATS has no encoder for stays `Unsupported`. Measured natively on a Radeon 680M (gfx1035, wave32 = wave64) and GPU-checked by `cs_tbuffer_store.asm` (13 stores: f32, f16, 8_8_8_8 UINT and UNORM, 2_10_10_10, d16, the default format, more and fewer components than the format has, both bounds cases, a V# with FORMAT 0; exact on an RTX 3050 and the 680M); CPU-checked by `tests/semantic/test_tbuffer_store.py`. | | Buffer format stores | `buffer_store_format_*` and `_d16_*` encode every format the loads decode (the same FORMATS table: f32/u32, f16, unorm/snorm 8/16/10-10-10-2, uint 8/16). 1–2-byte elements are merged into their dword with atomic and/or so neighbours are kept. The atomics use element 0 of the array at the aligned dword address, which also compiles on MoltenVK 1.4.0 (checked with `cs_store` on an Apple M3 Max and Mesa llvmpipe). d16 data is unpacked first (f16 → float for float kinds, 16-bit integers for integer kinds). Before this, only four f32 formats, rgba16f and rgba8 unorm were stored, and everything else silently stored nothing. GPU-checked with `runtime/test/shaders/cs_store.asm` (rgba8 unorm, R10G10B10A2 (`2_10_10_10`), two r16f halves of one dword, d16 rgba16f: exact, neighbours untouched). `buffer_load_format_d16_*` packs pairs the same way. UNORM/SNORM stores convert NaN to zero before clamping. On native gfx1036, `buffer_store_format_d16_xyzw` into RGBA8_UNORM/SNORM matched clamp, scale by 255/127 and round to nearest even for all 63,488 finite binary16 encodings. Both infinities saturated and all 2,046 NaNs stored zero in both wave32 and wave64. The translated sweep matched all 65,536 bytes per format on RTX 5080 and Radeon Graphics. For normalized stores with format 56 (8/8/8/8) or 50 (10/10/10/2), a Z,Y,X,W descriptor exchanges the red and blue memory fields after filling absent input components with zero. Native gfx1036 confirmed both channel orders at all four instruction widths for packed and ordinary stores in wave32 and wave64. | +| Buffer format stores | `buffer_store_format_*` and `_d16_*` encode every format the loads decode (the same FORMATS table: f32/u32, f16, unorm/snorm 8/16/10-10-10-2, uint 8/16). 1–2-byte elements are merged into their dword with atomic and/or so neighbours are kept. The atomics use element 0 of the array at the aligned dword address, which also compiles on MoltenVK 1.4.0 (checked with `cs_store` on an Apple M3 Max and Mesa llvmpipe). d16 data is unpacked first (f16 → float for float kinds, 16-bit integers for integer kinds). Before this, only four f32 formats, rgba16f and rgba8 unorm were stored, and everything else silently stored nothing. GPU-checked with `runtime/test/shaders/cs_store.asm` (rgba8 unorm, R10G10B10A2 (`2_10_10_10`), two r16f halves of one dword, d16 rgba16f: exact, neighbours untouched). `buffer_load_format_d16_*` packs pairs the same way. UNORM/SNORM stores convert NaN to zero before clamping. On native gfx1036, `buffer_store_format_d16_xyzw` into RGBA8_UNORM/SNORM matched clamp, scale by 255/127 and round to nearest even for all 63,488 finite binary16 encodings. Both infinities saturated and all 2,046 NaNs stored zero in both wave32 and wave64. The translated sweep matched all 65,536 bytes per format on RTX 5080 and Radeon Graphics. A store with fewer components than its format writes the whole element, with 0 for the components it doesn't give (`_xy` into 32_32_32_32 leaves z = w = 0, `_xyz` into 16_16_16_16 leaves w = 0); into a one-channel format only x is written. Measured natively on a Radeon 680M (gfx1035, RDNA2), and GPU-checked by `cs_fmt_xy_xyz.asm` for 32_32_32_32, 16_16_16_16, 8_8_8_8 UNORM and UINT and 32 (TEST-185). Unsigned integer stores saturate to the destination channel width. On native gfx1036, RGBA8_UINT, RG16_UINT and RGBA16_UINT clipped overflowing inputs to 255 or 65535, with RGBA32_UINT as a full-width control. For normalized stores with format 56 (8/8/8/8) or 50 (10/10/10/2), a Z,Y,X,W descriptor exchanges the red and blue memory fields after filling absent input components with zero. Native gfx1036 confirmed both channel orders at all four instruction widths for packed and ordinary stores in wave32 and wave64. `tbuffer_store_format_*` is not translated. | +| Buffer format stores | `buffer_store_format_*` and `_d16_*` encode every format the loads decode (the same FORMATS table: f32/u32, f16, unorm/snorm 8/16/10-10-10-2, uint 8/16). 1–2-byte elements are merged into their dword with atomic and/or so neighbours are kept. The atomics use element 0 of the array at the aligned dword address, which also compiles on MoltenVK 1.4.0 (checked with `cs_store` on an Apple M3 Max and Mesa llvmpipe). d16 data is unpacked first (f16 → float for float kinds, 16-bit integers for integer kinds). Before this, only four f32 formats, rgba16f and rgba8 unorm were stored, and everything else silently stored nothing. GPU-checked with `runtime/test/shaders/cs_store.asm` (rgba8 unorm, R10G10B10A2 (`2_10_10_10`), two r16f halves of one dword, d16 rgba16f: exact, neighbours untouched). `buffer_load_format_d16_*` packs pairs the same way. UNORM/SNORM stores convert NaN to zero before clamping. On native gfx1036, `buffer_store_format_d16_xyzw` into RGBA8_UNORM/SNORM matched clamp, scale by 255/127 and round to nearest even for all 63,488 finite binary16 encodings. Both infinities saturated and all 2,046 NaNs stored zero in both wave32 and wave64. The translated sweep matched all 65,536 bytes per format on RTX 5080 and Radeon Graphics. A store with fewer components than its format writes the whole element, with 0 for the components it doesn't give (`_xy` into 32_32_32_32 leaves z = w = 0, `_xyz` into 16_16_16_16 leaves w = 0); into a one-channel format only x is written. Measured natively on a Radeon 680M (gfx1035, RDNA2), and GPU-checked by `cs_fmt_xy_xyz.asm` for 32_32_32_32, 16_16_16_16, 8_8_8_8 UNORM and UINT and 32 (TEST-185). Unsigned integer stores saturate to the destination channel width. On native gfx1036, RGBA8_UINT, RG16_UINT and RGBA16_UINT clipped overflowing inputs to 255 or 65535, with RGBA32_UINT as a full-width control. `tbuffer_store_format_*` is not translated. 8- and 16-bit SINT stores clamp the signed 32-bit value to [-2^(w-1), 2^(w-1) - 1] (300 stores 127 into 8_SINT, -129 stores -128), and the 8/16-bit UINT formats 5, 11 and 18 saturate like the others; measured natively on gfx1036 for x, xy and xyzw stores with the runtime's selectors (X001, XY01, XYZW) and checked by `tests/semantic/test_buffer_format_narrow_int.py` (until 2026-11-22 those formats stored nothing). | +| Buffer format stores | `buffer_store_format_*` and `_d16_*` encode every format the loads decode (the same FORMATS table: f32/u32, f16, unorm/snorm 8/16/10-10-10-2, uint 8/16). 1–2-byte elements are merged into their dword with atomic and/or so neighbours are kept. The atomics use element 0 of the array at the aligned dword address, which also compiles on MoltenVK 1.4.0 (checked with `cs_store` on an Apple M3 Max and Mesa llvmpipe). d16 data is unpacked first (f16 → float for float kinds, 16-bit integers for integer kinds). Before this, only four f32 formats, rgba16f and rgba8 unorm were stored, and everything else silently stored nothing. GPU-checked with `runtime/test/shaders/cs_store.asm` (rgba8 unorm, R10G10B10A2 (`2_10_10_10`), two r16f halves of one dword, d16 rgba16f: exact, neighbours untouched). `buffer_load_format_d16_*` packs pairs the same way. UNORM/SNORM stores convert NaN to zero before clamping. On native gfx1036, `buffer_store_format_d16_xyzw` into RGBA8_UNORM/SNORM matched clamp, scale by 255/127 and round to nearest even for all 63,488 finite binary16 encodings. Both infinities saturated and all 2,046 NaNs stored zero in both wave32 and wave64. The translated sweep matched all 65,536 bytes per format on RTX 5080 and Radeon Graphics. For normalized stores with format 56 (8/8/8/8) or 50 (10/10/10/2), a Z,Y,X,W descriptor exchanges the red and blue memory fields after filling absent input components with zero. Native gfx1036 confirmed both channel orders at all four instruction widths for packed and ordinary stores in wave32 and wave64. 8- and 16-bit SINT stores clamp the signed 32-bit value to [-2^(w-1), 2^(w-1) - 1] (300 stores 127 into 8_SINT, -129 stores -128), and the 8/16-bit UINT formats 5, 11 and 18 saturate like the others; measured natively on gfx1036 for x, xy and xyzw stores with the runtime's selectors (X001, XY01, XYZW) and checked by `tests/semantic/test_buffer_format_narrow_int.py` (until 2026-11-22 those formats stored nothing). | | `s_lshl1..4_add_u32` | D = (S0 << N) + S1. SCC = the sum taken in 64 bits is ≥ 2³², so a bit shifted out of S0 sets it as well as a carry out of the add (RDNA ISA pseudocode: `tmp = (64'U(S0) << N) + 64'U(S1)`). Checked on the CPU by `tests/semantic/test_salu_lshl_add.py`. **Hardware-verified** on the same gfx1100 part through `tools/hw_oracle`: `s_lshl1_add_u32(0x80000000, 0)` = 0 with SCC = 1 (the bit shifted out of S0 sets it, with no carry out of the add), `s_lshl2_add_u32(5, 3)` = 0x17 with SCC = 0, `s_lshl4_add_u32(1, 0)` = 0x10. | | Other additions | `image_gather4_l(_o)`: no explicit-LOD gather in core Vulkan, so four `OpImageFetch` at mip `Floor(clamp(LOD, S# MIN_LOD, MAX_LOD) + 0.5)` (ties up, as native) in gather order. With `d16` those four taps round to binary16 and pack low half first into two consecutive VGPRs. The packed words and the first untouched VGPR were checked with `ps_gather_wrap.asm` on RTX 5080 and Radeon Graphics. Each of the four texel coordinates goes through the S#'s own address mode, read from S# word0 (`CLAMP_X` = bits [2:0], `CLAMP_Y` = [5:3]; fields from Mesa `src/amd/registers/gfx10-rsrc.json`, values `SQ_TEX_*` in Mesa `gfx6.json`, matching RADV's `radv_tex_wrap` mapping of Vulkan address modes): 0 wrap (`c mod n`), 1 mirror (`c mod 2n`, reflected), 2 clamp to the last texel, 3 mirror-once (`-1-c` for negative `c`, then clamped), as in Vulkan's address-mode definitions. A literal S# (`s_mov_b32` earlier in the block) is decoded at translation time; otherwise the mode is read from the SGPR at run time. A literal S# with a border mode (4-7: half-border, border colour) or `FORCE_UNNORMALIZED` is `Unsupported`; a run-time S# can't be judged, so modes 4-7 act as clamp-to-edge there and `FORCE_UNNORMALIZED` (word0 bit 15) is not applied (coordinates are still scaled by the image size). Those two are the remaining approximations; the unnormalized rules (texel-unit coordinates, mip 0) weren't confirmed on hardware, so they were not guessed. GPU-checked with `runtime/test/shaders/ps_gather_wrap.asm` (`vk_texture_test`; expected values derived by hand in its header; six border cases, three literal and three run-time S#) on AMD (Radeon 880M, wave64) and NVIDIA RTX 5070. `image_gather4_lz_o`: `OpImageGather … Offset`. `image_store` on 1D (bindings 17–19, `Image1D`) and with a16 coordinates. `ds_swizzle BITMASK_PERM` ("pippi" masks; GPU-checked). `v_add_f64`, `v_cvt_f32_f64` (`Float64`). `v_mul/mad_i32_i24`, `v_alignbyte_b32`, `v_xnor_b32`, `v_ffbh_i32`, `v_swap_b32`, `s_abs_i32`, `s_bfm_b32/b64`, 64-bit ordered and `v_cmpx` compares, 16-bit compares, 8/16-bit global loads, `neg(…)` constant operands (GPU-checked where listed in `runtime/test/shaders`). | | `v_mad_u64_u32`, `v_mad_i64_i32` | {sdst, D} = S0 × S1 + S2 as a 65-bit result (RDNA ISA pseudocode), the product unsigned or signed. sdst (a lane mask) gets bit 64 for active lanes and 0 for lanes off in EXEC (`EXEC[lane] ? bit64 : 0`, matching `v_cmp_*` and `*_co_*`): the carry out for u64, and for i64 the sign of the exact sum (bit 64 of a 65-bit two's-complement value), not a signed-overflow flag. `tools/lane_masks.py` tracks sdst as a lane mask (until 2026-11-22 it only matched `*_co_*`, so `s_bcnt1`/`s_ff1`/`v_mbcnt` on sdst read each lane's own mask word as plain data). `clamp` is rejected. Checked on the CPU by `tests/test_lane_masks.py`, `tests/semantic/test_alu_mad64.py` (including 64-lane `s_bcnt1_i32_b64`/`s_ff1_i32_b64` ballot tests), and `tests/semantic/test_carry_exec_mask.py` (EXEC masking on inactive lanes). **Hardware-verified on RDNA2** (AMD Radeon 680M, `gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137): unsigned carry, signed positive overflow `(-2³¹)² + INT64_MAX` giving `sdst = 0`, negative sum giving `sdst = 1`, and inactive EXEC lane leaving D untouched with `sdst = 0` all match bit-for-bit. | | Ray tracing | `image_bvh_intersect_ray` / `image_bvh64_intersect_ray` (64 CS: RT shadows) are one traversal step against AMD's hardware BVH node format. The traversal loop lives in the game's shader. The step is emulated over buffer reads following Mesa RADV's software path (`radv_nir_rt_common.c`, `intersect_ray_amd_software_box/_tri`; node layouts from `bvh_defines.h`). Node id = address >> 3 \| type (0–3 triangle, 4 box16, 5 box32). Box nodes give the four child ids, with misses and NaN boxes = `0xFFFFFFFF`, sorted by entry distance when descriptor bit 63 (box_sort_enable) is set. Triangle nodes read their three vertices from the slots the node type picks: TRI0 (0,1,2), TRI1 (1,3,2), TRI2 (2,3,4), TRI3 (2,4,0), 12 bytes each. They use the watertight test with RADV's shared edge/vertex tie-breaks and give (t/\|det\|, sign(det), b_i/\|det\|, b_j/\|det\|), or (inf, 1, 0, 0) on a miss. The weights i and j are chosen by the node type's byte of the triangle-ID word at +60: bits [1:0] and [3:2], 0/1/2 = vertex 0/1/2; `0x09` gives RADV's (v, w). Vertex slots and remap follow AMD GPURT (`CalcTriangleCompressionVertexIndices`, `SwizzleBarycentrics`) and the public XDXR software path ([bvh.md](bvh.md) §7a). These two references agree; no game BVH is decoded yet to count over. A GPU can't confirm the rule either, because every GPU runs this emulation and none runs the native instruction. `tests/semantic/test_image_bvh_tri.py` runs every node type and remap byte on the interpreter. The game's code divides by `.y` exactly as for the hardware's numerator/denominator. Address = descriptor base + ((node & ~7) << 3), base = descriptor bits [39:0] in 256-byte units (**assumption**: RADV only uses base 0). **The runtime must build the game's acceleration structures in this AMD node format** (RADV's GPU BVH builder produces it) wherever the game's D3D12 calls build them. Far branches with `s_sub_u32`/`s_subb_u32` (backward) are folded too. GPU-checked with `runtime/test/shaders/cs_bvh.asm`: sorted box children and the triangle result are exact. The 32-bit form (11 address dwords: the node id has no high dword) runs the same scene in `cs_bvh32.asm` and gives the same eight words. | -| Coverage | Every shader in the corpus translates. The remaining fidelity gap is wave64 cross-half code on 32-wide subgroups in VS/PS/GS; compute and mesh shaders are exact there with `--wave64-emulate` (see the wave-size and wave64 rows). | -| Ray tracing | `image_bvh_intersect_ray` / `image_bvh64_intersect_ray` (64 CS: RT shadows) are one traversal step against AMD's hardware BVH node format. The traversal loop lives in the game's shader. The step is emulated over buffer reads following Mesa RADV's software path (`radv_nir_rt_common.c`, `intersect_ray_amd_software_box/_tri`; node layouts from `bvh_defines.h`). Node id = address >> 3 \| type (0–3 triangle, 4 box16, 5 box32). Box nodes give the four child ids, with misses and NaN boxes = `0xFFFFFFFF`, sorted by entry distance when descriptor bit 63 (box_sort_enable) is set. Triangle nodes use the watertight test with RADV's shared edge/vertex tie-breaks and give (t/\|det\|, sign(det), v/\|det\|, w/\|det\|), or (inf, 1, 0, 0) on a miss. The game's code divides by `.y` exactly as for the hardware's numerator/denominator. Address = descriptor base + ((node & ~7) << 3), base = descriptor bits [39:0] in 256-byte units (**assumption**: RADV only uses base 0). **The runtime must build the game's acceleration structures in this AMD node format** (RADV's GPU BVH builder produces it) wherever the game's D3D12 calls build them. Far branches with `s_sub_u32`/`s_subb_u32` (backward) are folded too. GPU-checked with `runtime/test/shaders/cs_bvh.asm`: sorted box children and the triangle result are exact. | | Coverage | Every shader in the corpus translates. The remaining fidelity gap is wave64 cross-half code on 32-wide subgroups in VS/PS/GS (tier C of the *Wave64 graphics* row; tiers A and B are exact); compute and mesh shaders are exact there with `--wave64-emulate` (see the wave-size and wave64 rows). | | Flat pixel inputs | A pixel input location read only by `v_interp_mov_f32` is declared `Flat`. Locations read with `v_interp_p1/p2` remain interpolated. The `ps_flat` GPU test passes integer IDs through the first vertex alongside interpolated UVs. | | v_interp operand guards (SHADER-177) | The single-lane model reads the attribute's own value for `v_interp_p1/p2`, which is only right when the VGPR source really holds the barycentric coordinate that op interpolates with — **p1 reads I = v0 and p2 reads J = v1, per op** — and `v_interp_mov_f32` models only the p0 provoking vertex. A p1/p2 (f32 and f16 forms) whose source is not its own coordinate — v0 for p1, v1 for p2, each either the hardware register or a plain `v_mov_b32` copy rooted at it (the copy's single write in the whole shader, defined before the use, copy chains followed, and its source v0/v1 itself unwritten up to the copy: a copy of an already-overwritten v0/v1 carries a computed value — zeroing the source before copying renders (0,0) on hardware — while a write after the copy is fine, the copy saved the value) — is **Unsupported**, naming the register and the role, so a swapped p1(v1)/p2(v0) pair, a both-v0 pair, or a copy of an overwritten source is refused rather than silently mistranslated; `v_interp_mov_f32` with p10/p20 is **Unsupported**, naming the select. A **direct** v0/v1 read stays accepted even when the shader overwrites v0/v1 first (evaluate-at-offset/snapped barycentrics; up to 213 PS, #1218): modelling that computed value is the separate provenance follow-up. Zero corpus cost: over the 26,503-shader corpus every f32 I/J source is v0/v1 (117,001 / 116,997) except one PS whose four `v_interp_p2_f32` read J through `v_mov_b32 v14, v1` (its v1 unwritten up to the copy; the later overwrites are the saved-copy case), which the copy rule keeps translating (bit-identical .spv), every f16 source is v0/v1 (58,950 / 58,950), and all 6,926 `v_interp_mov_f32` use p0. Confirmed by `tests/semantic/test_interp_guards.py` (refusals name the operand and its role, including swapped and both-v0 pairs, a wrong-root copy, and a copy of an overwritten source; the copy, copy-chain, matching-role and saved-from-later-zero cases translate and compute; a second write or a dpp copy no longer qualifies; a mutation check that the guard consults the copy analysis) and by re-translating a 200-shader corpus slice plus that PS before and after: translated/valid counts and every .spv unchanged. | @@ -288,9 +284,7 @@ How the generated SPIR-V expects the runtime to work: | Whole-wave masks | `tools/lane_masks.py` tracks per-lane mask bits through scalar registers, vector operations and saved EXEC spills. Whole-mask counts, first-set-lane queries and equality use subgroup operations. `cs_wavemask` checks all 64 lanes with a partially active EXEC mask. A physical 32-lane subgroup cannot directly exchange mask bits with the other half of a wave64, so `cs_wavemask` and the `cs_wave64_ballot` / `cs_wm_*` tests are exact only on 64-wide subgroups (AMD): on an RTX 4090 (subgroup 32) `s_bcnt1_i32_b64` of lanes 16–47 counts 16, one half (#101). `check.py` skips them where the GPU has no 64-wide compute subgroup. | | Floating-point operations | Separate floating-point instructions carry `NoContraction` so the driver preserves their individual rounding. The instructions that fuse multiply-add (`v_fma_f32`, `v_fmac_f32`, `v_fmaak_f32`, `v_fmamk_f32`, `v_fma_mix*`) round **once** on RDNA2 (measured on gfx1150 by `tools/f32_fuzz.py --oracle hw`: 72 of 72 cancellation probes fused). SPIR-V has two ways to say that. `GLSL.std.450 Fma` is the default (`--fma glsl`), but the Vulkan SPIR-V environment gives it the precision "inherited from `OpFMul` followed by `OpFAdd`", so a driver may legally round twice; `tools/f32_fuzz.py` and `runtime/test/shaders/cs_fma_fused.asm` are the tests that notice. `--fma khr` emits `OpFmaKHR` (`SPV_KHR_fma`, capability `FMAKHR`; "correctly rounded"), which needs `VK_KHR_shader_fma` with `shaderFmaFloat32` on the device. The index then lists capability `FMAKHR`, extension `SPV_KHR_fma` and feature `shaderFmaFloat32` for exactly the shaders that use it, and the output of every shader without a fused multiply-add is byte-identical under both options. `khr` is not the default because a device without the extension would fail pipeline creation; a runtime that knows its device has `shaderFmaFloat32` should translate with `--fma khr`. The f16 forms (`v_fma_f16`, `v_fmac_f16`, `v_pk_fma_f16`) never use either: they are exact round-to-odd arithmetic built from `OpFMul`/`OpFAdd` with `NoContraction` (`Gen.fma_f16_odd`), so a fused f32 `Fma` would not change them (`v_fma_mixlo_f16`/`v_fma_mixhi_f16` under the toward-zero MODE are the exception: `fma_mix_odd` needs the exact product error `Fma(x, y, -p)`, which is only guaranteed with `OpFmaKHR`), and an f16 `OpFmaKHR` (`shaderFmaFloat16`) is not used. There is no f64 fused multiply-add in the translator yet (`v_add_f64` only). | | `NoContraction` cost on MoltenVK (SHADER-234) | MoltenVK's SPIRV-Cross turns each `NoContraction` `OpFAdd`, `OpFSub` and `OpFMul` into a call to a `[[clang::optnone]]` helper (`spvFAdd`, `spvFSub`, `spvFMul`), and Metal does not inline it. MoltenVK 1.4.2 and `main` up to at least `5189f8de` are affected. SPIRV-Cross `98cbb7c0` inlines the helpers from MSL 3.2 with bit-identical output, and MoltenVK on macOS 26 or newer compiles MSL 4.0. On an Apple M3 Max, a translated compute shader of `v_mul_f32`, `v_add_f32` and `v_sub_f32` in a loop took 7.6 to 15.7 times as long on the GPU with the optnone helpers as with `98cbb7c0`. With independent operations and no `NoContraction`, it took two thirds of the `98cbb7c0` time, which is the cost of the decoration itself ([measurement](https://github.com/ItsNotRexed/Leonida/issues/1380#issuecomment-7078722086)). The same `spvFMul` helper drops the sign of a -0 product (SHADER-182, #1376). | -| Floating-point operations | Separate floating-point instructions carry `NoContraction` so the driver preserves their individual rounding. Instructions that explicitly fuse multiply-add still emit `Fma`. | | `NoContraction` multiply on MoltenVK (SHADER-182) | On MoltenVK, a multiply whose exact product is a negative zero (`+0 × -1.5`, `-0 × 1.0`) returns +0 in f32, f16 and packed f16 (#1203). MoltenVK's SPIRV-Cross turns every `NoContraction` `OpFMul` into its `spvFMul` helper, which returns `fma(l, r, T(0))`. A -0 product plus +0 is +0. The f16 multiplies are `OpFMul` on `float` or `v2float`, so they take the same path. So does the product inside `fma_f16_odd`: `v_fma_f16`, `v_fmac_f16` and `v_pk_fma_f16` return +0 for a -0 product plus a -0 addend. SPIRV-Cross [300681bb](https://github.com/KhronosGroup/SPIRV-Cross/commit/300681bbcb8365a8d1eacdacdbdd0249bbf1d6b1) changes the addend to `T(-0.0)`. MoltenVK 1.4.2 has the old helper, and so does MoltenVK `main` at `5189f8de` (2026-10-13), which pins the parent commit `aa217aeb`. The translator does not change for this. `MVK_CONFIG_FAST_MATH_ENABLED=0` does not help, because the helper itself adds +0, and per #1203 neither does `SignedZeroInfNanPreserve` (#664). Measured on an Apple M3 Max (macOS 27.3): Metal keeps the sign for `a * b` and for `fma(a, b, -0.0)` with `MTLMathModeFast` and with `MTLMathModeSafe`, and loses it only with the +0 addend. With `valu_fuzz.py --family f16`, MoltenVK `5189f8de` as pinned matches 49/50 programs with `--seed 1 --wave 32`, 98/100 with `--seed 1 --emulate` and 98/100 with `--seed 4 --emulate`, and Homebrew MoltenVK 1.4.2 gives the same counts. Each mismatch is a -0 product read as +0. The same build with SPIRV-Cross `300681bb` matches 50/50, 100/100 and 100/100, as does KosmicKrisp (Mesa 26.3.1). For the FMA path, `--seed 330 --wave 32` with `--skip-op v_mul_f16 --skip-op v_pk_mul_f16` matches 49/50 with `aa217aeb` (a `v_fmac_f16` result) and 50/50 with `300681bb` and on KosmicKrisp. | -| `NoContraction` multiply on MoltenVK (SHADER-182) | On MoltenVK, a multiply with an exact zero result and a negative sign (`+0 × -1.5`, `-0 × 1.0`) returns +0 in f32, f16 and packed f16 (#1203). The f16 multiplies are `OpFMul` on `float`, so all three go through the same path. MoltenVK's SPIRV-Cross turns a `NoContraction` `OpFMul` into its `spvFMul` helper, which returns `fma(l, r, T(0))`. A -0 product plus +0 is +0. SPIRV-Cross [300681bb](https://github.com/KhronosGroup/SPIRV-Cross/commit/300681bbcb8365a8d1eacdacdbdd0249bbf1d6b1) changes the addend to `T(-0.0)`. MoltenVK 1.4.2 and MoltenVK `main` at `5189f8de` (2026-10-13), which pins the parent commit `aa217aeb`, have the old helper. The translator does not change for this. `MVK_CONFIG_FAST_MATH_ENABLED=0` and `SignedZeroInfNanPreserve` (#664) do not help on MoltenVK, because the helper itself adds +0. Measured on an Apple M3 Max (macOS 27.3). Metal keeps the sign for `a * b` and for `fma(a, b, -0.0)` with `MTLMathModeFast` and with `MTLMathModeSafe`, and loses it only with the +0 addend. With `valu_fuzz.py --family f16`, MoltenVK `5189f8de` matches 49/50 programs with `--seed 1 --wave 32`, 98/100 with `--seed 1 --emulate` and 98/100 with `--seed 4 --emulate`. Each mismatch is a -0 product read as +0. The same build with SPIRV-Cross `300681bb` matches 50/50, 100/100 and 100/100, as does KosmicKrisp (Mesa 26.3.1). Homebrew MoltenVK 1.4.2 gives the `aa217aeb` counts. | | MoltenVK fast-math (SHADER-234, NaN compares) | MoltenVK compiles every shader's MSL with Metal's fast-math on by default (`MVK_CONFIG_FAST_MATH_ENABLED`, default 1), and with it Metal folds an f32 compare of a NaN with itself as if the NaN were an ordinary number: `v_cmpx_eq_f32` and `v_cmpx_le_f32` on (NaN, NaN) give true where the ISA, AMD and NVIDIA give false (`ps_vcmpx_forms`, #1374: word 1 `0xf05e8e16`, want `0xf05e8a12`, bits 2 and 10; found by @zneel and @DomasUrbonas). The translation is not involved: the compare is `OpFOrdEqual` / `OpFOrdLessThanEqual`, and the MSL MoltenVK generates (`MVK_CONFIG_SHADER_DUMP_DIR`) is byte-identical with fast-math on and off, so it is Metal's compile option. `MVK_CONFIG_FAST_MATH_ENABLED=2` (on demand) does not help, because translated modules don't declare an execution mode that asks for IEEE behaviour; 0 does. The test tools (`runtime/test/vulkan_loader.h`, which every Vulkan test program uses to load MoltenVK) set `MVK_CONFIG_FAST_MATH_ENABLED=0` before MoltenVK reads its configuration, unless the variable is already set, so a user's own value still wins; the variable also reaches MoltenVK through the Vulkan loader. A runtime that loads MoltenVK on a Mac must do the same. Fast-math off does **not** remove the `[[clang::optnone]]` `spvFAdd`/`spvFSub`/`spvFMul` helpers SPIRV-Cross emits for `NoContraction` (11 calls in `ps_ops`'s MSL either way: their cost is the other part of SHADER-234), and it does not fix the row above (SHADER-182): `valu_fuzz.py --family f16 --seed 1` gives the same `v_mul_f16` +0 mismatch with fast-math on and off. Confirmed on an Apple A18 Pro (macOS 26.6.2, MoltenVK 1.4.2): `ps_vcmpx_forms` fails on all 4,096 pixels with fast-math on and matches all 4,096 with it off, natively and with wave64 emulation; no other `run_gpu_tests.py` result and none of the 25 `ctest` tests changes. | | Denormal flush and special results in `v_rcp_f32`, `v_rsq_f32`, `v_sqrt_f32`, `v_log_f32`, `v_exp_f32`, `v_rcp_iflag_f32` | Measured on an RX 6800 (gfx1030, not the console's gfx1013) with raw kernels in both wave sizes and all four IEEE/DX10_CLAMP combinations: all six read a denormal input as a zero of its sign and flush a denormal result, even with MODE's denormal field set to keep them. `v_rcp_f32(±0)` = ±inf, `v_rsq_f32(-0)` = -inf, `v_sqrt_f32(-0)` = -0, `v_log_f32(±0)` = -inf, `v_rcp_f32(FLT_MAX)` = +0, `v_exp_f32(-127)` = +0, `v_exp_f32(128)` = +inf, and every invalid result (`v_sqrt_f32`/`v_rsq_f32`/`v_log_f32` of a negative, …) is `0xffc00000`. Each is within 1 ulp of correctly rounded on the values tried, and `v_rcp_iflag_f32` is bit-identical to `v_rcp_f32`. **Not modelled yet:** the translator leaves all six on Vulkan's default denormal handling, and the ±0 and negative inputs above stay undefined in the emitted SPIR-V (`OpFDiv` by zero, `Sqrt`/`Log2` of a negative), as listed in the multiply-add and output modifiers row; the `clamp`/`omod` bits on `v_cvt_f32_*` and `v_rcp_iflag_f32` are modelled there. Source: [@shelbykb2's hardware words](https://github.com/ItsNotRexed/Leonida/issues/634#issuecomment-7074348963), not the ISA text. The corpus only ever writes MODE's FP_ROUND field and carries `mul:2`/`mul:4`/`div:2` on 102,365 float instructions (a compiler does not emit one that is ignored), so the inferred f32 state, IEEE off with denormals flushed, is the one to model. Corpus count (`tools/shader_profile.py`, 26,503 shaders; the shader count of each op deduplicates its `_e32`/`_e64` forms): `v_rcp_f32` 17,393 shaders / 424,863 occurrences, `v_rsq_f32` 17,221 / 269,310, `v_sqrt_f32` 14,511 / 201,422, `v_log_f32` 8,454 / 90,199, `v_exp_f32` 8,603 / 148,846, `v_rcp_iflag_f32` 7,395 / 34,852; 20,193 shaders (76.2%) use at least one, 1,169,492 occurrences (2.6% of the corpus's 44,406,870 instructions). | | f16 transcendentals (`v_exp_f16`, `v_log_f16`, `v_rcp_f16`, `v_rsq_f16`, `v_sqrt_f16`, `v_sin_f16`, `v_cos_f16`) | Measured on an RX 6700 XT (gfx1031, not the console's gfx1013) with `tools/f16_trans_sweep.py`: all 65,536 inputs of each op, wave32 and wave64 (identical on every input), five MODEs (FUZZ-29). With f16 denormals kept (`denorm_mode_16_64 = 3`, the assembler default and what the translator assumes), `v_exp/log/rcp/rsq/sqrt_f16` are **correctly rounded on every input that is not a NaN** (0 ulp). `v_sin/v_cos_f16` take turns and reduce them exactly over the whole f16 range (no ±256 limit): compared with sin/cos(2πx), every result for |x| > 1 is bit-exact, and for |x| ≤ 1 only 14 (sin) and 4 (cos) of 30,722 are 1 ulp off. So the translator's rule (widen to f32, the GLSL.std.450 function, round to nearest even back to f16) matches the hardware as far as the driver's f32 function is accurate. For sin/cos that holds only once the angle is reduced in turns first (#594): with the f32 product 6.2831855 · x, 16,366 sin and 2,036 cos inputs are more than 1 ulp off, up to 9,944 ulp (sin of 64,640 turns: 0.0267 instead of 0). With `denorm_mode_16_64 = 0`, a denormal operand reads as a zero of its sign, and a denormal result is written as a zero of its sign. That differs from the f32 ops in the row above, which flush in both modes. The f16 field of FP_ROUND is ignored: round toward zero gives the same words as round to nearest on every input. IEEE changes only signalling NaNs. With IEEE off they pass through unchanged; with IEEE on they are quieted (bit 9 set). Payload and sign are kept either way, and quiet NaNs pass unchanged in every mode. Where SPIR-V leaves the result undefined, the hardware gives: log(±0) = -inf, rcp(±0) = ±inf, rsq(+0) = +inf, rsq(-0) = -inf, sqrt(-0) = -0, and `0xfe00` for log/rsq/sqrt of a negative (-inf included) and for sin/cos(±inf). `v_exp_f16`/`v_log_f16` give the same counts on gfx1036 (RDNA2, AMD Windows driver; SHADER-135). **Not modelled yet:** `Gen.f16_bits` quiets every NaN (the hardware keeps a signalling NaN with IEEE off), and the undefined cases above are left to the driver. | @@ -304,8 +298,7 @@ How the generated SPIR-V expects the runtime to work: | Float min/max/med3 with NaN, `v_fract` | Measured on an AMD Radeon RX 6800 (gfx1030, not the console's gfx1013) with the hw-oracle tool from the AnyPS5 project, 537 input rows in all four IEEE/DX10_CLAMP combinations and in wave32 and wave64, the same for every combination with quiet NaNs. `v_min_f32`/`v_max_f32`, `v_min_f16`/`v_max_f16` and each half of `v_pk_min_f16`/`v_pk_max_f16`: one NaN operand gives the other operand, bits unchanged; both NaN give src0; -0 < +0. `v_min3`/`v_max3` = f(f(s0, s1), s2) with that min/max. `v_med3_f32`/`_f16`: with any NaN operand the result is min3(s0, s1, s2), otherwise the median (-0 < +0). `v_fract_f32` rounds x − floor(x) once and returns 0x3f7fffff (the largest float below 1) where that gives 1.0, e.g. fract(-1e-10); f16 gives 0x3bff; fract(-0) = +0, fract(±inf) = NaN, a NaN passes through. The translator emits `NMin`/`NMax` for these min/max ops (before: `FMin`/`FMax`, whose NaN result GLSL.std.450 leaves to the implementation). med3 is `FClamp(z, NMin(x, y), NMax(x, y))`, and when an operand can be a NaN, `OpIsNan` of each such operand (none for an inline or literal constant that is not a NaN) selects `NMin(NMin(x, y), z)` instead. `v_fract_f32` is `Fract` followed by `OpFOrdEqual` with 1.0 and an `OpSelect` of 0x3f7fffff, so the NaN of fract(±inf) is kept; `v_fract_f16` does the same before packing and then replaces a packed 0x3c00 with 0x3bff (not after an output multiplier, where 1.0 can be a true result). Other `FMin`/`FMax`/`FClamp` uses (the `clamp` bit, LOD and conversion clamps, `v_cvt_pk_u8_f32`, the BVH slab test) are unchanged. Not modelled: signalling NaNs under IEEE mode; NaN under the `clamp` bit (hardware gives +0 with DX10_CLAMP=1 and the NaN with DX10_CLAMP=0; the translator still emits `FClamp`); the NaN payload when both operands are NaN (`NMin` only promises a NaN); and without the `SignedZeroInfNanPreserve` execution mode Vulkan does not strictly guarantee NaN or signed-zero behaviour, so these rules hold where the driver keeps them. With an output modifier (`mul:2`, `mul:4`, `div:2`) on `v_fract_f16` the translator applies the modifier to the f32 fract before narrowing to f16; the hardware order of rounding and modifier for that case was not measured, so a result can differ by one f16 step for tiny negative inputs (e.g. x = -1e-4 with `div:2`). GPU-checked with `runtime/test/shaders/ps_fnan_med3.asm` and `ps_fnan_fract.asm` (inputs read from memory at run time) on an AMD Radeon RX 6800, Windows 11, driver 26.11.2: 4096/4096 pixels exact; on that driver the two med3 words differed before the change (0x40e00000 and 0x40600000 instead of 0x40a00000 and 0xc0200000), and so did the f16 fract word (0x3c00 instead of 0x3bff) once f16 results were narrowed with integer round-to-nearest; the f32 fract and the min/max words were already the hardware words there. `tests/semantic/test_float_nan_fract.py` runs the measured rows through the translator and the interpreter. | | Wave64 handling | Wave size is detected per shader from the code (64-bit EXEC writes, `exec_hi`, `v_mbcnt_hi`, `*_saveexec_b64`/`*_wrexec_b64`, and 64-bit lane-mask SOP ops `s_bcnt[01]_i32_b64` / `s_ff[01]_i32_b64` / `s_wqm_b64` / `s_bfm_b64` even when the mask is an ordinary SGPR pair; mesh shaders are always wave64). Until 2026-11-21 a mask-only wave64 program with no EXEC markers was translated as wave32, so `s_bcnt1_i32_b64` counted one half (#210). GPU-checked with `runtime/test/shaders/cs_w64_mask_detect.asm` (48 set bits of `(lane & 5) != 0`) on NVIDIA GeForce RTX 5060 under `LEONIDA_W64_EMULATE=1`. The hardware lane is exact in compute and mesh shaders (LocalInvocationIndex mod 64 or 32) and is used by `v_mbcnt` and EXEC writes. In other stages it's the subgroup lane. Constant EXEC writes (`s_mov_b32 exec_lo/exec_hi, K`) set each lane from its own bit of K, as `(K >> lane) & 1` (shift and mask: Intel's Windows driver evaluated `OpBitFieldUExtract` of a constant that fits in 16 bits with the lane taken mod 16, so `exec_lo = 0xffff` ran all 32 lanes; GPU-checked with `runtime/test/shaders/cs_exec_const.asm` on Intel UHD Graphics 770, driver 32.0.101.6129, and NVIDIA GeForce RTX 4080 SUPER); before, any non-zero constant turned every lane on. A register written to `exec_hi` sets lanes 32–63 only. VCC's halves follow the same rule while VCC holds a lane mask: a 32-bit write to `vcc_lo` sets lanes 0–31 of the mask and one to `vcc_hi` lanes 32–63 (until 2026-11-22 a `vcc_lo` write set all 64 lanes and a `vcc_hi` write never reached the mask that `s_cbranch_vccz`/`v_cndmask` read; CPU-checked by `tests/semantic/test_wave64_vcc_half_write.py`, not GPU-checked). GPU-checked with `runtime/test/shaders/cs_exec64.asm`: lanes 16–47 enabled from two constants, exact on a 32-wide-subgroup GPU. Still approximate on 32-wide subgroups: cross-lane ops between the two halves of a wave64 (readlane/permlane/DPP/shuffles across lane 31/32, wave-wide reductions). The metadata index marks every wave64 shader so a runtime can request `requiredSubgroupSize = 64` where supported (AMD), which makes those exact too. | | Lane select (`v_readlane_b32` / `v_writelane_b32`) | The lane is **S1[4:0] in wave32** and S1[5:0] in wave64, from an SGPR or a constant, and EXEC is ignored (RDNA 3 ISA guide pseudocode for both opcodes; RDNA 2 has the same encoding and gives no pseudocode). **Until #488 (SHADER-52) a wave32 shader masked with 63 as well**: a lane select of 32 or more wrote no lane, and a read shuffled from a lane past the end of a 32-wide subgroup, which SPIR-V leaves undefined (NVIDIA wraps it, so reads happened to come out right there). Found by the FUZZ-7 cross-lane fuzzer: 23 of 100 random wave32 programs, each minimized to `s_mov_b32 s28, K; v_writelane_b32 vD, x, s28` with K ≥ 32. GPU-checked with `runtime/test/shaders/cs_w32_lane_wrap.asm` (25 16 777 777) on NVIDIA GeForce RTX 5060 (#488) and RTX 4090 (subgroup 32, driver 621.14); `tests/test_translate.py` checks the masks in the SPIR-V, and `tests/semantic/test_wave32_lane_select.py` runs the shader across 32 lanes, where a mask of 63 is an out-of-range shuffle. | -| Wave64 emulation (`--wave64-emulate`) | Wave64 compute and mesh shaders exact on **any** subgroup size (32-wide NVIDIA, Intel, AMD in wave32 mode), with no subgroup operation at all. One invocation is still one lane. Everything a lane needs from the rest of its wave goes through a Workgroup buffer `%x_buf`: votes (`s_cbranch_vccz/vccnz/execz/execnz`, SCC of mask ops, `s_cmp` of masks), whole-mask words (`s_bcnt1`, `s_ff1`, `v_mbcnt`), `v_readlane`, `v_readfirstlane`, `ds_bpermute`, `ds_swizzle`, `v_permlane16/x16`. The program runs in rounds: in each round every wave that is neither done nor waiting at `s_barrier` runs one segment of its program (a basic block, cut at each cross-lane op), then the whole workgroup meets at one `OpControlBarrier` (Workgroup, AcquireRelease, workgroup + uniform + image memory) that sits in uniform control flow, because every invocation runs every round. A cross-lane op ends its segment after the lane has stored its value (per-lane data, double-buffered by round parity) or ORed its bit (two mask words per wave, three slots by round mod 3, each slot cleared two rounds after it was read); the code after it runs one round later, when all 64 lanes have written. SSA values live across a cut go through Function variables. `s_barrier` is a scheduler state: the wave stops running segments until every wave that isn't done is waiting, which is also how hardware counts finished waves. A memory access that conflicts with an earlier one in the same segment (read after write, write after read, write after write; LDS and buffer/image memory separately) starts a new round, so two halves of a wave in different subgroups access memory in instruction order, as the lanes of one hardware wave do; not ordered: scalar loads of memory the wave wrote, and sampling an image it wrote. The missing lanes of a partial last wave read as 0. Without the flag the output is unchanged, apart from two fixes that apply to every wave64 compute/mesh shader: `v_writelane_b32` selects the lane by the wave lane (on a 32-wide subgroup writes to lanes 32–63 were lost; `cs_w64x_writelane`), and `ds_bpermute_b32` (see the LDS row). Fewer rounds, same results: a whole-mask read (`s_bcnt1`, `v_mbcnt_lo/hi`, ...) of the value of the same register (or EXEC) that an earlier read in the block already exchanged reuses that exchange (the value's identity is the SSA id last stored to the register, forgotten at block start and at any label); and a block that ends in a voted branch (`s_cbranch_vccz/vccnz/execz/execnz`) runs its successor in the round that reads the vote, since that segment only reads the vote and picks the next block (an inner loop in the scheduler, flag `%x_chain`). Both rules are pinned by `cs_w64x_mask_reuse` (a mask register and EXEC rewritten between reads), `cs_w64x_mask_reuse2` (EXEC read twice, a read after a buffer store, one half of a mask pair rewritten while the other is kept, a voted branch whose successor starts with a load of the other half's earlier store) and `cs_w64x_chain_barrier` (a voted branch whose successor starts with `s_barrier`, two waves): expected values from the ISA, first run on the AMD 880M with its native 64-wide subgroup, then emulated on both GPUs; `tests/test_translate.py` counts the exchanges in the SPIR-V (one per value, a new one after a rewrite of the register or EXEC), and the translator refuses (`Unsupported`) a voted branch whose segment was not started by the vote's own round. `scripts/bench_wave64.py` times `cs_bench_mix` native and emulated and checks the emulated output bytes against the native AMD run. Cost: one workgroup barrier per segment, and `%x_buf` = (2·L + 6·W + 7) dwords for L invocations in W waves, counted in `lds_bytes`. GPU-checked on NVIDIA GeForce RTX 5070 Laptop (subgroup 32, driver 617.42) and AMD Radeon 880M (subgroup 64, AMD driver 26.11.2 LLPC): `check.py` 38/39 (the mesh test runs in the other script) and `scripts/run_gpu_tests.py` 40/40 on both with `LEONIDA_W64_EMULATE=1`, including every wave64 test (`cs_wavemask`, `cs_wave64_ballot`, `cs_wm_*`) and the cross-half suite `cs_w64x_*` / `ms_w64x_ballot`: readlane and writelane at lanes ≥ 32, readfirstlane with only upper lanes active, branches voted by one lane of either half, ballot + `v_mbcnt_lo/hi` compaction over 64 lanes (also in a mesh shader, 4096/4096 pixels), a 128-thread workgroup whose two waves take different branches, `s_barrier` between waves with different loop counts, LDS read-after-write and write-after-read across the halves without a barrier, a load, ballot and load in one block, and a partial wave (group 40). Without the flag the same RTX 5070 passes 19/37 (the wave64 tests skip there). Not covered: VS/PS/GS (no workgroup memory or barrier there). Known driver bug: AMD's Windows shader compiler for RDNA2 crashes (access violation in `vkCreateComputePipelines`) on many emulated compute shaders with LDS (#857: drivers 32.0.21030 to 32.0.21045.29003, iGPUs and RX 6000; 23.20.44, RDNA3, RDNA4, RADV and NVIDIA are fine), so `make_game.py --wave64-emulate auto` leaves emulation off when the runtime's GPU is such a device and runs wave64 natively (`rdna2_amd_windows` in `tools/vk_subgroup_info.py`, by PCI device ID and driver ID). | -| Wave64 emulation (`--wave64-emulate`) | Wave64 compute and mesh shaders exact on **any** subgroup size (32-wide NVIDIA, Intel, AMD in wave32 mode), with no subgroup operation at all. One invocation is still one lane. Everything a lane needs from the rest of its wave goes through a Workgroup buffer `%x_buf`: votes (`s_cbranch_vccz/vccnz/execz/execnz`, SCC of mask ops, `s_cmp` of masks), whole-mask words (`s_bcnt1`, `s_ff1`, `v_mbcnt`), `v_readlane`, `v_readfirstlane`, `ds_bpermute`, `ds_swizzle`, `v_permlane16/x16`. The program runs in rounds: in each round every wave that is neither done nor waiting at `s_barrier` runs one segment of its program (a basic block, cut at each cross-lane op), then the whole workgroup meets at one `OpControlBarrier` (Workgroup, AcquireRelease, workgroup + uniform + image memory) that sits in uniform control flow, because every invocation runs every round. A cross-lane op ends its segment after the lane has stored its value (per-lane data, double-buffered by round parity) or ORed its bit (two mask words per wave, three slots by round mod 3, each slot cleared two rounds after it was read); the code after it runs one round later, when all 64 lanes have written. SSA values live across a cut go through Function variables. `s_barrier` is a scheduler state: the wave stops running segments until every wave that isn't done is waiting, which is also how hardware counts finished waves. A memory access that conflicts with an earlier one in the same segment (read after write, write after read, write after write; LDS and buffer/image memory separately) starts a new round, so two halves of a wave in different subgroups access memory in instruction order, as the lanes of one hardware wave do. A scalar load (`s_load*`, `s_buffer_load*`) counts as a buffer read: until #1587 it was left out, so a store and a later scalar load of the same address shared a segment and the half in the other subgroup could load before this half had stored (`valu_fuzz.py --family mem --emulate`: lanes 32-63 read the fill pattern after an `s_buffer_load`/`s_load` of the slot lane 0 had written, on RDNA1 RADV and an RTX 5060; `v_readfirstlane_b32`, which gives that slot, already reads the whole wave). Pinned by `tests/semantic/test_w64x_scalar_load_order.py` (no segment of the emitted rounds accesses buffer memory after a write or writes after a read; three of its five cases fail without the rule). Confirmed by that CPU test and the ordering argument above; the race does not show on an RX 7900 XTX (AMD 26.10.1 LLPC, Windows 11): `valu_fuzz.py --family mem --seed 5 --programs 21 --wave 64 --emulate` matches 21/21 before and after the rule (3 runs each), so a GPU reproduction on RDNA1/RADV (where #1587 was found) is still pending. Not ordered: sampling an image the wave wrote. The missing lanes of a partial last wave read as 0. Without the flag the output is unchanged, apart from two fixes that apply to every wave64 compute/mesh shader: `v_writelane_b32` selects the lane by the wave lane (on a 32-wide subgroup writes to lanes 32–63 were lost; `cs_w64x_writelane`), and `ds_bpermute_b32` (see the LDS row). Fewer rounds, same results: a whole-mask read (`s_bcnt1`, `v_mbcnt_lo/hi`, ...) of the value of the same register (or EXEC) that an earlier read in the block already exchanged reuses that exchange (the value's identity is the SSA id last stored to the register, forgotten at block start and at any label); and a block that ends in a voted branch (`s_cbranch_vccz/vccnz/execz/execnz`) runs its successor in the round that reads the vote, since that segment only reads the vote and picks the next block (an inner loop in the scheduler, flag `%x_chain`). Both rules are pinned by `cs_w64x_mask_reuse` (a mask register and EXEC rewritten between reads), `cs_w64x_mask_reuse2` (EXEC read twice, a read after a buffer store, one half of a mask pair rewritten while the other is kept, a voted branch whose successor starts with a load of the other half's earlier store) and `cs_w64x_chain_barrier` (a voted branch whose successor starts with `s_barrier`, two waves): expected values from the ISA, first run on the AMD 880M with its native 64-wide subgroup, then emulated on both GPUs; `tests/test_translate.py` counts the exchanges in the SPIR-V (one per value, a new one after a rewrite of the register or EXEC), and the translator refuses (`Unsupported`) a voted branch whose segment was not started by the vote's own round. `scripts/bench_wave64.py` times `cs_bench_mix` native and emulated and checks the emulated output bytes against the native AMD run. Cost: one workgroup barrier per segment, and `%x_buf` = (2·L + 6·W + 7) dwords for L invocations in W waves, counted in `lds_bytes`. GPU-checked on NVIDIA GeForce RTX 5070 Laptop (subgroup 32, driver 617.42) and AMD Radeon 880M (subgroup 64, AMD driver 26.11.2 LLPC): `check.py` 38/39 (the mesh test runs in the other script) and `scripts/run_gpu_tests.py` 40/40 on both with `LEONIDA_W64_EMULATE=1`, including every wave64 test (`cs_wavemask`, `cs_wave64_ballot`, `cs_wm_*`) and the cross-half suite `cs_w64x_*` / `ms_w64x_ballot`: readlane and writelane at lanes ≥ 32, readfirstlane with only upper lanes active, branches voted by one lane of either half, ballot + `v_mbcnt_lo/hi` compaction over 64 lanes (also in a mesh shader, 4096/4096 pixels), a 128-thread workgroup whose two waves take different branches, `s_barrier` between waves with different loop counts, LDS read-after-write and write-after-read across the halves without a barrier, a load, ballot and load in one block, and a partial wave (group 40). Without the flag the same RTX 5070 passes 19/37 (the wave64 tests skip there). Not covered: VS/PS/GS (no workgroup memory or barrier there). | +| Wave64 emulation (`--wave64-emulate`) | Wave64 compute and mesh shaders exact on **any** subgroup size (32-wide NVIDIA, Intel, AMD in wave32 mode), with no subgroup operation at all. One invocation is still one lane. Everything a lane needs from the rest of its wave goes through a Workgroup buffer `%x_buf`: votes (`s_cbranch_vccz/vccnz/execz/execnz`, SCC of mask ops, `s_cmp` of masks), whole-mask words (`s_bcnt1`, `s_ff1`, `v_mbcnt`), `v_readlane`, `v_readfirstlane`, `ds_bpermute`, `ds_swizzle`, `v_permlane16/x16`. The program runs in rounds: in each round every wave that is neither done nor waiting at `s_barrier` runs one segment of its program (a basic block, cut at each cross-lane op), then the whole workgroup meets at one `OpControlBarrier` (Workgroup, AcquireRelease, workgroup + uniform + image memory) that sits in uniform control flow, because every invocation runs every round. A cross-lane op ends its segment after the lane has stored its value (per-lane data, double-buffered by round parity) or ORed its bit (two mask words per wave, three slots by round mod 3, each slot cleared two rounds after it was read); the code after it runs one round later, when all 64 lanes have written. SSA values live across a cut go through Function variables. `s_barrier` is a scheduler state: the wave stops running segments until every wave that isn't done is waiting, which is also how hardware counts finished waves. A memory access that conflicts with an earlier one in the same segment (read after write, write after read, write after write; LDS and buffer/image memory separately) starts a new round, so two halves of a wave in different subgroups access memory in instruction order, as the lanes of one hardware wave do. A scalar load (`s_load*`, `s_buffer_load*`) counts as a buffer read: until #1587 it was left out, so a store and a later scalar load of the same address shared a segment and the half in the other subgroup could load before this half had stored (`valu_fuzz.py --family mem --emulate`: lanes 32-63 read the fill pattern after an `s_buffer_load`/`s_load` of the slot lane 0 had written, on RDNA1 RADV and an RTX 5060; `v_readfirstlane_b32`, which gives that slot, already reads the whole wave). Pinned by `tests/semantic/test_w64x_scalar_load_order.py` (no segment of the emitted rounds accesses buffer memory after a write or writes after a read; three of its five cases fail without the rule). Confirmed by that CPU test and the ordering argument above; the race does not show on an RX 7900 XTX (AMD 26.10.1 LLPC, Windows 11): `valu_fuzz.py --family mem --seed 5 --programs 21 --wave 64 --emulate` matches 21/21 before and after the rule (3 runs each), so a GPU reproduction on RDNA1/RADV (where #1587 was found) is still pending. Not ordered: sampling an image the wave wrote. The missing lanes of a partial last wave read as 0. Without the flag the output is unchanged, apart from two fixes that apply to every wave64 compute/mesh shader: `v_writelane_b32` selects the lane by the wave lane (on a 32-wide subgroup writes to lanes 32–63 were lost; `cs_w64x_writelane`), and `ds_bpermute_b32` (see the LDS row). Fewer rounds, same results: a whole-mask read (`s_bcnt1`, `v_mbcnt_lo/hi`, ...) of the value of the same register (or EXEC) that an earlier read in the block already exchanged reuses that exchange (the value's identity is the SSA id last stored to the register, forgotten at block start and at any label); and a block that ends in a voted branch (`s_cbranch_vccz/vccnz/execz/execnz`) runs its successor in the round that reads the vote, since that segment only reads the vote and picks the next block (an inner loop in the scheduler, flag `%x_chain`). Both rules are pinned by `cs_w64x_mask_reuse` (a mask register and EXEC rewritten between reads), `cs_w64x_mask_reuse2` (EXEC read twice, a read after a buffer store, one half of a mask pair rewritten while the other is kept, a voted branch whose successor starts with a load of the other half's earlier store) and `cs_w64x_chain_barrier` (a voted branch whose successor starts with `s_barrier`, two waves): expected values from the ISA, first run on the AMD 880M with its native 64-wide subgroup, then emulated on both GPUs; `tests/test_translate.py` counts the exchanges in the SPIR-V (one per value, a new one after a rewrite of the register or EXEC), and the translator refuses (`Unsupported`) a voted branch whose segment was not started by the vote's own round. `scripts/bench_wave64.py` times `cs_bench_mix` native and emulated and checks the emulated output bytes against the native AMD run. Cost: one workgroup barrier per segment, and `%x_buf` = (2·L + 6·W + 7) dwords for L invocations in W waves, counted in `lds_bytes`. GPU-checked on NVIDIA GeForce RTX 5070 Laptop (subgroup 32, driver 617.42) and AMD Radeon 880M (subgroup 64, AMD driver 26.11.2 LLPC): `check.py` 38/39 (the mesh test runs in the other script) and `scripts/run_gpu_tests.py` 40/40 on both with `LEONIDA_W64_EMULATE=1`, including every wave64 test (`cs_wavemask`, `cs_wave64_ballot`, `cs_wm_*`) and the cross-half suite `cs_w64x_*` / `ms_w64x_ballot`: readlane and writelane at lanes ≥ 32, readfirstlane with only upper lanes active, branches voted by one lane of either half, ballot + `v_mbcnt_lo/hi` compaction over 64 lanes (also in a mesh shader, 4096/4096 pixels), a 128-thread workgroup whose two waves take different branches, `s_barrier` between waves with different loop counts, LDS read-after-write and write-after-read across the halves without a barrier, a load, ballot and load in one block, and a partial wave (group 40). Without the flag the same RTX 5070 passes 19/37 (the wave64 tests skip there). Not covered: VS/PS/GS (no workgroup memory or barrier there). Known driver bug: AMD's Windows shader compiler for RDNA2 crashes (access violation in `vkCreateComputePipelines`) on many emulated compute shaders with LDS (#857: drivers 32.0.21030 to 32.0.21045.29003, iGPUs and RX 6000; 23.20.44, RDNA3, RDNA4, RADV and NVIDIA are fine), so `make_game.py --wave64-emulate auto` leaves emulation off when the runtime's GPU is such a device and runs wave64 natively (`rdna2_amd_windows` in `tools/vk_subgroup_info.py`, by PCI device ID and driver ID). | | Barycentric fallback (`--bary-fallback`) | For devices without `VK_KHR_fragment_shader_barycentric` (NVIDIA Pascal, for one). The raw pair a PS reads ("PS system inputs": 321 PS) comes from an ordinary vec3 input, `%bary`, at the lowest location none of the shader's attributes uses, instead of `BuiltIn BaryCoordKHR`. The module then needs neither the `FragmentBarycentricKHR` capability nor the extension, and the index records the location as `bary_fallback_input`. The stage before the PS writes (1,0,0), (0,1,0), (0,0,1) at the triangle's three vertices: `tools/bary_fallback_gs.py` writes that pass-through geometry shader from the index (Position and the PS's input locations copied unchanged). Default (perspective) interpolation of those weights is the perspective-correct barycentric, the value `BaryCoordKHR` has, so `.y`/`.z` stay AMD's i/j; shaders that don't read the pair translate to the same module either way. GPU-checked on an NVIDIA GeForce GTX 1060 6GB (Pascal, no barycentric extension; driver 560.94, Windows 10) with `LEONIDA_BARY_FALLBACK=1`: `ps_bary` 4096/4096 pixels exact, and `ps_uniform_branch` and `ps_scc_mask32` pass, through `run_gpu_tests.py` and `build.py` + `check.py`, with zero Khronos validation messages. Checked in `tests/semantic/test_bary_fallback.py`. For a known VS/PS pair, `python -I tools/bary_fallback_gs.py DIR --pair VS PS` builds `PS.bary_gs.clipN.spv`. It copies the producer’s `ClipDistance[N]` at each emitted vertex, using the VS index field `clip_distance_count`. On RTX 5080 and Radeon integrated graphics, two independently shifted clip planes yielded 512, 1024, 2048 or 4096 covered pixels, matching the native barycentric path. For a cull-only VS the pair writes `PS.bary_gs.cullN.spv` from `cull_distance_count`. A two-plane synthetic draw on the same GPUs covered 0 pixels when every vertex was negative for either plane and all 4096 when each plane had a nonnegative vertex. The helper rejects mixed clip/cull arrays. The runtime building that GS per pipeline is the follow-up (it needs the graphics pipelines of #291). | | Metadata index | `spirv/index.json`: one entry per translated shader with its stage, `wave64` / `subgroup_size`, SPIR-V capabilities and extensions, the Vulkan **features** to enable (barycentrics, interlock, mesh, geometry, Float64, Int64, buffer device address, write-without-format, `shaderFmaFloat32` for `--fma khr`, …), `needs_maintenance8`, the descriptor bindings it uses (set 0), push-constant size, `local_size`, `user_sgprs` (CS), `lds_bytes`, mesh `max_vertices`/`max_primitives`/`params`, geometry inputs/outputs, vertex-input locations and types, full `vertex_input_signature` (ISG1 register/mask/system-value/component-type, for PSO lookup), `wave64_emulated` (true for VS/PS/GS wave64, which the translator emits as per-subgroup code with no cross-half exchange, and for compute/mesh translated with `--wave64-emulate`; the runtime does not use it: it reads `wave64`, `subgroup_size` and `wave64_exchange`), `dynamic_format` (runtime V# FORMAT: codes outside FORMATS decode to 0) / `fixed_format_codes`, `src_sha256` and optional `fssm_sha256` (via `--fssm-dir`), PS system inputs, `bary_fallback_input` (`--bary-fallback`: the location of the barycentric input), `mesh_compute` (`--mesh-compute`: the slot layout and push-constant size), and input/output locations. A shader translated with `--wave64-emulate` carries `wave64_exchange: "workgroup"` and `subgroup_size: null`: any subgroup size is exact, request none. Otherwise `subgroup_size` (64 for wave64, 32) is what the PSO asks for through `VkPipelineShaderStageRequiredSubgroupSizeCreateInfo` where the device lists the stage in `requiredSubgroupSizeStages` (docs/d3d12_vulkan.md section 3.2): that list is the driver's, not "compute/mesh only". The AMD Windows driver reports FRAGMENT, COMPUTE, TASK and MESH (measured on a Radeon 880M, driver 26.11.2, sizes 32..64), and current Mesa RADV on GFX10+ reports COMPUTE, FRAGMENT and task/mesh (`src/amd/vulkan/radv_physical_device.c`, `requiredSubgroupSizeStages`, Mesa main at 152b9cde; older Mesa: compute only), so wave64 pixel shaders can run exact there. NVIDIA lists every stage but only size 32, so there a native wave64 shader cannot get 64 and wave64 PS/VS/GS stay 2x32. A runtime can create every pipeline at load time from it without parsing SPIR-V. | | Full-corpus pipeline build | `vk_pipeline_check pipeline_cache.bin --jobs 4` on an RTX 4060 Ti (NVIDIA 595 driver): **all 26,503 shaders become real pipelines, 0 failures** (cs 2,689, ps 12,101, ms 9,282, vs 2,236, gs 195; graphics stages with generated stub partners). Compile time 40,784 s of CPU (2.84 h wall on 4 threads): cs 23,633 s (mean 8.8 s; the ray-tracing ScreenProbes/RTShadowTrace shaders take 2-19 min each), ps 11,481 s, ms 5,395 s, vs 275 s. The resulting `VkPipelineCache` is 3.81 GB; seeding a run with it makes those pipelines instant, which is what a fast first boot needs. The cache is per driver and GPU, and a shader whose SPIR-V changes compiles again (the checker resumes from the file). Neither register storage (one variable per register) nor smaller SPIR-V cut NVIDIA compile time: the big ray-tracing shaders are expensive as such, so the runtime should compile them in the background rather than block on them. | @@ -314,22 +307,16 @@ How the generated SPIR-V expects the runtime to work: | Signed-byte dot products | `v_dot4_i32_i8 D, S0, S1, S2` (VOP3P) is S2 plus the sum of the four products of the sign-extended bytes of S0 and S1, modulo 2^32; `v_dot4c_i32_i8 D, S0, S1` (VOP2) adds the same sum to D. Emitted as four pairs of `OpBitFieldSExtract`, `OpIMul` and `OpIAdd`. **Confirmed on RDNA2 hardware** (gfx1036, raw kernels through `tools/hw_oracle`): 10 operand sets, both instructions and both source orders of the accumulating one, with sign-mixed bytes and sums that wrap; the measured words are the table in `tests/semantic/test_alu_dot4_i8.py`. Two modifiers were measured too and are Unsupported: `clamp` saturates `v_dot4_i32_i8` to a signed 32-bit value (the two overflowing sets), and `op_sel` 2 with `op_sel_hi` 5 exchanges the 16-bit halves of S1 before the products (5 sets; the form of the 89 words `llvm-mc` does not decode, [fspx.md](fspx.md)). Counts: the 29 FSPX programs use the pair 27,271 times (`v_dot4c_i32_i8` 25,813, `v_dot4_i32_i8` 1,458), all in 13 programs; none of the game's own 26,503 shaders has either encoding (0 of the 12,791 words `llvm-mc` cannot decode there with gfx1013). With the rule 17 of the 29 programs translate and pass `spirv-val` (13 before). | | Workgroup barriers | `s_barrier` (cs/ms) is one `OpControlBarrier` (workgroup scope, workgroup memory). On RDNA every `s_barrier` counts against the same workgroup barrier and a wave that has ended no longer counts, while Vulkan requires a barrier to be reached by every invocation in uniform control flow. Under `--wave64-emulate` the round loop keeps a single barrier at the top level, so this holds. **Native wave32 compute shaders run in barrier rounds** when an `s_barrier` sits anywhere but a top-level block of the structured tree (one every invocation runs): under a guard, in a loop, or in the dispatch loop (`needs_barrier_rounds`, `bar_scheduler`). That is the emulated loop without its cross-lane part: `s_barrier` ends a segment, each invocation runs its blocks until its next `s_barrier` or the end, then the whole workgroup meets at one `OpControlBarrier` (the same workgroup/acquire-release/workgroup-memory semantics) at the end of the round. A wave that is done no longer holds the others, and a per-round count of the invocations not done (three `Workgroup` words, by round mod 3) ends the loop. Cross-lane operations stay subgroup operations, as in the dispatch loop, since a wave's lanes run the same segment. A barrier in a top-level block keeps the single `OpControlBarrier` in place. In the 1.0.2.1 corpus 43 of the 55 wave32 cs shaders with `s_barrier` have one nested (SHADER-91's count), so those 43 now run in rounds. Why: an Intel GPU does not survive the nested form. `cs_barrier_divergent.asm` (two barrier sites in different branches), `cs_barrier_early_end.asm` (the other waves end without a barrier) and `cs_barrier_loop.asm` (a barrier in a loop whose trip count differs per wave) each lose the device (`vkQueueWaitIdle` → `VK_ERROR_DEVICE_LOST`) on an Intel Arrow Lake Xe-LPG iGPU (Windows 32.0.101.8132), and `cs_barrier_divergent` hangs or writes nothing on a UHD 770 (101.6129, #634). With barrier rounds all three pass there and on an RTX 5070 Ti Laptop (617.42). NVIDIA passed them before too (RTX 4070 Ti on 610.88 and 621.24, RTX 5090 on Linux 595.99, RTX 5070 Ti). **Still not proven on the native wave64 path** (wave64 cs and every ms, run natively only on AMD's 64-wide subgroups): there the barrier stays where `s_barrier` is, inside a selection or loop construct in every ms and most wave64 cs shaders of the corpus. Branches are scalar, so whole waves take the same path, and RDNA's own barrier counts the way the shader expects. | | LDS | A `Workgroup` uint array sized from LDS_SIZE, rounded up to a power of two that also covers every constant offset (15 of 486 shaders index past LDS_SIZE). Covers `ds_read/write_b32..b128`, `read2/write2` (+`st64`), `u16`/`i16`/`u8`/`i8` reads (also `ds_read_u16_d16`/`_d16_hi` and, since SHADER-85, `ds_read_u8_d16`/`_d16_hi` and `ds_read_i8_d16`/`_d16_hi`: the byte is zero- or sign-extended 8→16 into one half of the destination VGPR and the other half is kept, per the RDNA2 ISA DS opcode descriptions (opcodes 162–165) and as for the u16 d16 reads; GPU-checked with `cs_w32_lds_u8_d16.asm`, byte values 0x80/0xFF/0x7F with a non-zero `offset:`), `b16`/`b8` writes (atomic and/or, so neighbouring lanes don't race), the add/sub/min/max/and/or/xor atomics with and without return, `wrxchg`, `cmpst` (`OpAtomicCompareExchange` with DATA as comparator and DATA2 as value), and `ds_bpermute_b32` as a subgroup shuffle. `ds_permute_b32`, its forward (scatter) form, has no Vulkan equivalent: each source lane that is on in EXEC publishes `((vAddr + offset) >> 2) mod 32` and each destination lane scans the 32 sources of its half and keeps the last one that targets it (a shuffle of target and data per source lane; under `--wave64-emulate` two buffer rounds and a Function variable instead). Per the ISA pseudocode (`tmp[0..63] = 0`; `next if !EXEC[i]` on the source; `VGPR[VDST][i] = tmp[i]` only `if EXEC[i]`): a destination lane nobody targets gets 0, an off source sends nothing, an off destination keeps its VDST, and the half rule above applies as for `ds_bpermute_b32`. When several sources target one lane the ISA leaves the winner unpredictable ("the value from one of the writers"; its pseudocode says the highest-numbered); the translator takes the highest, and nothing may depend on it. Confirmed by the GPU tests `cs_w32_permute.asm` and, per half of a wave64, `cs_w64x_permute.asm` (SHADER-90: rotation, offset, unwritten lane = 0, off destination keeps its value, off source does not win) and `tests/semantic/test_ds_permute.py`. A source lane that is off in EXEC reads 0 and an off destination lane keeps its value (RDNA ISA §10.4.4), in wave32 as in wave64. In wave64 the permute also runs as two wave32s: each half reads lanes of its own half. Until 2026-11-21 lanes 32–63 of a 64-wide subgroup read the low half and inactive sources kept their value (`cs_w64x_bpermute`, AMD Radeon 880M); the wave32 path shuffled the raw value until the same day (`cs_bpermute32`: wave32, EXEC without lanes 8–15, so lane 6 reads 0; GPU-checked on RTX 5070 and Radeon 880M). A source lane that doesn't exist, in the missing lanes of a partial wave, also reads 0: the shuffle result is kept only where a ballot of the running invocations has the source lane, since SPIR-V leaves a shuffle from an invocation that isn't running undefined. Before this, RADV returned stale register values that changed between runs (`cs_w64x_partial`, a 40-thread group, native wave64 on AMD RX 6700 XT, RADV Mesa 26.3.1). Writes and atomics run only in active lanes. Indices wrap at the array size, where hardware would return 0 for out-of-range reads. `s_barrier` = `OpControlBarrier` Workgroup/Workgroup, AcquireRelease + WorkgroupMemory. | -| `ds_cmpst_b32` | The non-returning compare-and-store: `M = (M == data0) ? data1 : M`, the same `OpAtomicCompareExchange` as `ds_cmpst_rtn_b32` with the old value dropped (operands vaddr, data0, data1). Source: RDNA2 ISA DS_CMPST_B32. CPU-checked by `tests/semantic/test_lds_atomics_values.py`. **Not GPU-verified.** | +| `ds_cmpst_b32` | The non-returning compare-and-store: `M = (M == data0) ? data1 : M`, the same `OpAtomicCompareExchange` as `ds_cmpst_rtn_b32` with the old value dropped (operands vaddr, data0, data1). Source: RDNA2 ISA DS_CMPST_B32. CPU-checked by `tests/semantic/test_lds_atomics_values.py`; GPU-checked by `runtime/test/shaders/cs_lds_b64_cmpst.asm` (hit and miss on an RTX 3070, driver 621.01, Windows 11). | | `ds_wrxchg2_rtn_b32`, `ds_wrxchg2st64_rtn_b32` | Two atomic exchanges, addressed as `ds_write2_b32` addresses its dwords: `vaddr + offset0 * 4` and `vaddr + offset1 * 4` (times 64 for st64). `M[A0] = data0` and `M[A1] = data1`, and `vdst` (a VGPR pair) gets the two old words. Both exchanges run before either result is written, so `vdst` may alias the address or data VGPRs. When both offsets name one dword, the second exchange returns `data0`. Each exchange is atomic on its own, not the pair together, as on hardware (two DS operations). Until 2026-11-22 both ops raised `Unsupported`. CPU-checked by `tests/semantic/test_lds_wrxchg2.py` (offsets, st64 = 256-byte steps, the same dword twice, aliasing, a single-VGPR `vdst` rejected). **Not GPU-verified.** | | `ds_wrxchg_rtn_b64`, `ds_wrxchg2_rtn_b64`, `ds_wrxchg2st64_rtn_b64` | 64-bit LDS exchanges (two dwords, low first): `M[A] = DATA`, and `vdst` gets the old 64 bits. `wrxchg_rtn_b64` has one element at `vaddr + offset`. The `2` forms have two, at `vaddr + offset0/offset1 * 8` (times 64 for st64), as `ds_write2_b64` addresses them, and `vdst` is four VGPRs. Each dword is its own 32-bit `OpAtomicExchange`, so the memory ends as a 64-bit exchange leaves it, without Int64 atomics on Workgroup memory. All exchanges run before `vdst` is written. **Approximation:** the returned pair comes from two reads, so another lane's 64-bit op on the same element between them can show up half done (as for `ds_and/or/xor_b64`). Until 2026-11-22 these three raised `Unsupported`. CPU-checked by `tests/semantic/test_lds_wrxchg_b64.py` (values, `offset:`, `vdst` aliasing the data, both 2 forms, st64 = 512-byte steps, bad operands rejected). **Not GPU-verified.** | | `ds_and_b64`, `ds_or_b64`, `ds_xor_b64` (and `_rtn_`) | `M = M op DATA` on the 64-bit LDS element at `vaddr + offset` (two dwords, low first); the `_rtn_` form returns the old 64 bits in a VGPR pair. A bitwise op works on each bit alone, so it is emitted as one 32-bit `OpAtomicAnd/Or/Xor` per dword. That leaves exactly the memory a 64-bit atomic would, without Int64 atomics on Workgroup memory (optional in Vulkan). **Approximation:** the returned pair comes from two reads, so another lane's 64-bit op on the same element between them can show up half done; the memory result is exact. The other 64-bit LDS atomics (`add/sub/min/max_u64`, `wrxchg_b64`, `cmpst_b64`) carry between dwords or need the pair to move together, and still raise `Unsupported`. Until 2026-11-22 these three were rejected as well. CPU-checked by `tests/semantic/test_lds_bitwise_b64.py` (all six forms, offsets, `vdst` aliasing the data, seeded values). **Not GPU-verified.** | | `ds_bpermute_b32` subgroup convergence | Native wave32 and wave64 apply bitwise masks to the shuffle result and the destination write so both the ballot and shuffle execute before lane predication. If the ballot has no source lane, the shuffle reads the calling lane before the result is masked to zero. MoltenVK 1.4.2 lowered the scalar selects to nested Metal ternaries, placing the subgroup operations in divergent control flow. The `cs_bpermute32` inactive-source case returned 64 on an Apple M1 Max, and all eight fixture words match with bitwise masking. | -| LDS 2-address b64 (`ds_read2_b64`, `ds_write2_b64`, `ds_read2st64_b64`, `ds_write2st64_b64`) | Two elements at vaddr + offset0·unit and vaddr + offset1·unit, unit = 8 bytes (×64 for st64); each element is two consecutive dwords, low first. `read2_b64` fills v[d:d+3] after all four loads (a vdst overlapping vaddr is safe); `write2_b64` takes two VGPR pairs. The b32 forms share the code with unit 4. Source: RDNA2 ISA DS 2-address forms. CPU-checked by `tests/semantic/test_lds_read2_write2_b64.py` (compute listings, LDS as a Workgroup variable). **Not GPU-verified.** | +| LDS 2-address b64 (`ds_read2_b64`, `ds_write2_b64`, `ds_read2st64_b64`, `ds_write2st64_b64`) | Two elements at vaddr + offset0·unit and vaddr + offset1·unit, unit = 8 bytes (×64 for st64); each element is two consecutive dwords, low first. `read2_b64` fills v[d:d+3] after all four loads (a vdst overlapping vaddr is safe); `write2_b64` takes two VGPR pairs. The b32 forms share the code with unit 4. Source: RDNA2 ISA DS 2-address forms. CPU-checked by `tests/semantic/test_lds_read2_write2_b64.py` (compute listings, LDS as a Workgroup variable); GPU-checked by `runtime/test/shaders/cs_lds_b64_cmpst.asm` (unit 8 and the 512-byte st64 forms, plus vdst/vaddr overlap, on an RTX 3070, driver 621.01, Windows 11). | | Compute workgroup IDs Y/Z | With four user SGPRs and only TGID_Y and TGID_Z enabled (RSRC2 `0x308`), s4 receives Y and s5 receives Z. The synthetic `cs_workgroup_yz.asm` fixture checks a 2 × 3 × 4 dispatch and each of its 24 origins against a CPU reference. | | Typed image stores | `image_store` (2D, 2D array, 3D) writes the dmask components (missing ones = 0). The image's numeric type lives in the T# (word 1 FORMAT [28:20], 512 GFX10 formats), so it is decided at run time. A 512-bit table built from `tools/gfx10_formats.json` (30 UINT and 15 SINT formats) picks a **sint**, **uint** or **float** view (bindings 8 + 3·dim + class; dim 0 = 2D, 1 = 2D array, 2 = 3D; class 0 float, 1 uint, 2 sint). Views have Unknown format (`shaderStorageImageWriteWithoutFormat`). **The runtime binds every storage image into all three arrays of its dimension, or at least the one matching its format.** The earlier path wrote only component 0 as `r32ui`, which was wrong for every other format. GPU-checked with `runtime/test/shaders/cs_imgstore.asm` through `runtime/test/vk_store_test.cpp`: rgba8 unorm, r32 uint and r32 sint images, every texel correct. | -| Typed image loads | `image_load` on 1D/2D/2D-array/3D images uses the same T# FORMAT tables as stores, and fetches every format with `OpImageFetch` from the sampled array of its dimension (bindings 0, 3, 6, 5): UINT/SINT formats through **uint/sint aliases of that array** (same set and binding, an `OpTypeImage` of `%uint`/`%int`; Vulkan allows several variables on one binding when the descriptor type fits), everything else through the float array. A lookup miss (index 0) takes the float path, since the fallback there is RGBA8_UNORM. Results are the raw bits of the dmask components. **The runtime binds each image's view in its own format at its index of the sampled array** (what `bind_image` in `runtime/shims/d3d12_vulkan_device.cpp` already does for SRVs and UAVs), so the view's numeric type matches the alias that reads it. No storage image is read, so shaders that only load need neither `shaderStorageImageReadWithoutFormat` (missing on Intel Xe-LP, #619) nor `shaderStorageImageWriteWithoutFormat` (SHADER-151). Until 2026-11-22 integer formats were read with `OpImageRead` from the uint/sint storage arrays (bindings 8–19), which hold only unordered-access views and 256 entries: a read-only integer texture found the fallback there, or an index past the array's end. Like the float path, the fetch goes through the texture path, so it sees writes made before the dispatch, not ones made earlier in the same dispatch. **d16 loads take the same branch** (#1136) and pack the dmask components two per VGPR, low half first: f16 (round to nearest even, integer ops, no `PackHalf2x16`) from the float array, the low 16 bits of each value from the uint/sint aliases (truncated). Before #1136, a d16 load always read the float view, so a `Texture2D` `Load` returned garbage. CPU-checked by `tests/test_image_load_typed.py` (capabilities, bindings and component types for every dimension; the branch for all 512 FORMAT values, found and missed). GPU-checked with `runtime/test/shaders/cs_imgload.asm` through `vk_store_test load`, on a device made without `shaderStorageImageReadWithoutFormat`: r32 uint and r32 sint images filled before the dispatch, both read with `image_load` and their sum stored, every texel exact on an RTX 2080 Ti (NVIDIA 621.14, Windows 11), clean under the validation layer with GPU-assisted validation; the test fails a module that declares `StorageImageReadWithoutFormat`. d16: CPU-checked by `tests/test_image_load_d16_typed.py` (the uint/sint fetches go through the aliases, no storage image is read, the SPIR-V validates); GPU-checked with `runtime/test/shaders/cs_imgload_d16.asm` through `vk_store_test load`: both pre-filled texels read with d16 loads (the sint one sign-extended from bit 15 in the shader) and their sum stored, every texel exact on the RTX 2080 Ti with GPU-assisted validation (#1136 checked its first form, a store and d16 read-back in one dispatch, on an RTX 5070). 2D `image_load_mip` uses the same numeric-type selection and passes the address register's mip to each fetch. Checked on RTX 5080 and Radeon Graphics with R8G8B8A8 UINT, SINT and UNORM textures: level 1 matched the CPU reference at every pixel with GPU-assisted validation, and forcing level 0 changed all 4096 pixels for each format. Native gfx1036 saturated 32-bit UINT/SINT texels to the unsigned/signed 16-bit range in both D16 load forms; the translated 2D load matched both limits on RTX 5080 and Radeon Graphics. D16 loads on 1D, 2D-array and 3D images still lack GPU checks. | -| Typed 2D gathers | `image_gather4_lz(_o)` takes one channel from four taps. The T# FORMAT selects the float, UINT or SINT sampled image at binding 0. For d16, integer taps are packed low half first, two per VGPR; float taps round to f16. | AMD RDNA 2 ISA §8.2 (MIMG D16). RTX 5080 and Radeon Graphics matched a CPU clamp-to-edge gather over all 4096 RGBA32F pixels for 8-bit UINT, SINT and UNORM, both packed and unpacked, with zero offset and with (+1,-1). Selecting red in place of green changed all 4096 pixels. Native gfx1036 saturates out-of-range integer taps as in the typed image loads below. | -| Typed image loads | `image_load` on 1D/2D/2D-array/3D images uses the same T# FORMAT tables as stores, and fetches every format with `OpImageFetch` from the sampled array of its dimension (bindings 0, 3, 6, 5): UINT/SINT formats through **uint/sint aliases of that array** (same set and binding, an `OpTypeImage` of `%uint`/`%int`; Vulkan allows several variables on one binding when the descriptor type fits), everything else through the float array. A lookup miss (index 0) takes the float path, since the fallback there is RGBA8_UNORM. Results are the raw bits of the dmask components. **The runtime binds each image's view in its own format at its index of the sampled array** (what `bind_image` in `runtime/shims/d3d12_vulkan_device.cpp` already does for SRVs and UAVs), so the view's numeric type matches the alias that reads it. No storage image is read, so shaders that only load need neither `shaderStorageImageReadWithoutFormat` (missing on Intel Xe-LP, #619) nor `shaderStorageImageWriteWithoutFormat` (SHADER-151). Until 2026-11-22 integer formats were read with `OpImageRead` from the uint/sint storage arrays (bindings 8–19), which hold only unordered-access views and 256 entries: a read-only integer texture found the fallback there, or an index past the array's end. Like the float path, the fetch goes through the texture path, so it sees writes made before the dispatch, not ones made earlier in the same dispatch. **d16 loads take the same branch** (#1136) and pack the dmask components two per VGPR, low half first: f16 (round to nearest even, integer ops, no `PackHalf2x16`) from the float array, the low 16 bits of each value from the uint/sint aliases (truncated). Before #1136, a d16 load always read the float view, so a `Texture2D` `Load` returned garbage. CPU-checked by `tests/test_image_load_typed.py` (capabilities, bindings and component types for every dimension; the branch for all 512 FORMAT values, found and missed). GPU-checked with `runtime/test/shaders/cs_imgload.asm` through `vk_store_test load`, on a device made without `shaderStorageImageReadWithoutFormat`: r32 uint and r32 sint images filled before the dispatch, both read with `image_load` and their sum stored, every texel exact on an RTX 2080 Ti (NVIDIA 621.14, Windows 11), clean under the validation layer with GPU-assisted validation; the test fails a module that declares `StorageImageReadWithoutFormat`. d16: CPU-checked by `tests/test_image_load_d16_typed.py` (the uint/sint fetches go through the aliases, no storage image is read, the SPIR-V validates); GPU-checked with `runtime/test/shaders/cs_imgload_d16.asm` through `vk_store_test load`: both pre-filled texels read with d16 loads (the sint one sign-extended from bit 15 in the shader) and their sum stored, every texel exact on the RTX 2080 Ti with GPU-assisted validation (#1136 checked its first form, a store and d16 read-back in one dispatch, on an RTX 5070). 2D `image_load_mip` uses the same numeric-type selection and passes the address register's mip to each fetch. Its D16 form packs the selected components in ascending order, two per VGPR. An RGBA8 two-level texture was checked on RTX 5080 and Radeon Graphics: all four exported halves matched the CPU reference for UINT, SINT and UNORM, and forcing level 0 changed every pixel. Checked on RTX 5080 and Radeon Graphics with R8G8B8A8 UINT, SINT and UNORM textures: level 1 matched the CPU reference at every pixel with GPU-assisted validation, and forcing level 0 changed all 4096 pixels for each format. Native gfx1036 saturated 32-bit UINT/SINT texels to the unsigned/signed 16-bit range in both D16 load forms; the translated 2D load matched both limits on RTX 5080 and Radeon Graphics. D16 loads on 1D, 2D-array and 3D images still lack GPU checks. | -| Typed image loads | `image_load` on 1D/2D/2D-array/3D images uses the same T# FORMAT tables as stores, and fetches every format with `OpImageFetch` from the sampled array of its dimension (bindings 0, 3, 6, 5): UINT/SINT formats through **uint/sint aliases of that array** (same set and binding, an `OpTypeImage` of `%uint`/`%int`; Vulkan allows several variables on one binding when the descriptor type fits), everything else through the float array. A lookup miss (index 0) takes the float path, since the fallback there is RGBA8_UNORM. Results are the raw bits of the dmask components. **The runtime binds each image's view in its own format at its index of the sampled array** (what `bind_image` in `runtime/shims/d3d12_vulkan_device.cpp` already does for SRVs and UAVs), so the view's numeric type matches the alias that reads it. No storage image is read, so shaders that only load need neither `shaderStorageImageReadWithoutFormat` (missing on Intel Xe-LP, #619) nor `shaderStorageImageWriteWithoutFormat` (SHADER-151). Until 2026-11-22 integer formats were read with `OpImageRead` from the uint/sint storage arrays (bindings 8–19), which hold only unordered-access views and 256 entries: a read-only integer texture found the fallback there, or an index past the array's end. Like the float path, the fetch goes through the texture path, so it sees writes made before the dispatch, not ones made earlier in the same dispatch. **d16 loads take the same branch** (#1136) and pack the dmask components two per VGPR, low half first: f16 (round to nearest even, integer ops, no `PackHalf2x16`) from the float array, the low 16 bits of each value from the uint/sint aliases (truncated). For odd component counts (1 or 3 in `dmask`), the trailing destination VGPR preserves its existing high 16 bits (`write_lo16`), matching native `gfx1036` hardware where a seeded `0x5a5a` high half survived 1-component UINT/SINT `image_load` and `image_load_mip`; until 2026-11-22 the unused high half was zeroed. Before #1136, a d16 load always read the float view, so a `Texture2D` `Load` returned garbage. CPU-checked by `tests/test_image_load_typed.py` (capabilities, bindings and component types for every dimension; the branch for all 512 FORMAT values, found and missed). GPU-checked with `runtime/test/shaders/cs_imgload.asm` through `vk_store_test load`, on a device made without `shaderStorageImageReadWithoutFormat`: r32 uint and r32 sint images filled before the dispatch, both read with `image_load` and their sum stored, every texel exact on an RTX 2080 Ti (NVIDIA 621.14, Windows 11), clean under the validation layer with GPU-assisted validation; the test fails a module that declares `StorageImageReadWithoutFormat`. d16: CPU-checked by `tests/test_image_load_d16_typed.py` (the uint/sint fetches go through the aliases, no storage image is read, the SPIR-V validates); GPU-checked with `runtime/test/shaders/cs_imgload_d16.asm` through `vk_store_test load`: both pre-filled texels read with d16 loads (the sint one sign-extended from bit 15 in the shader) and their sum stored, every texel exact on the RTX 2080 Ti with GPU-assisted validation (#1136 checked its first form, a store and d16 read-back in one dispatch, on an RTX 5070). 2D `image_load_mip` uses the same numeric-type selection and passes the address register's mip to each fetch. Checked on RTX 5080 and Radeon Graphics with R8G8B8A8 UINT, SINT and UNORM textures: level 1 matched the CPU reference at every pixel with GPU-assisted validation, and forcing level 0 changed all 4096 pixels for each format. Native gfx1036 saturated 32-bit UINT/SINT texels to the unsigned/signed 16-bit range in both D16 load forms; the translated 2D load matched both limits on RTX 5080 and Radeon Graphics. D16 loads on 1D, 2D-array and 3D images still lack GPU checks. | -| Typed image loads | `image_load` on 1D/2D/2D-array/3D images uses the same T# FORMAT tables as stores, and fetches every format with `OpImageFetch` from the sampled array of its dimension (bindings 0, 3, 6, 5): UINT/SINT formats through **uint/sint aliases of that array** (same set and binding, an `OpTypeImage` of `%uint`/`%int`; Vulkan allows several variables on one binding when the descriptor type fits), everything else through the float array. A lookup miss (index 0) takes the float path, since the fallback there is RGBA8_UNORM. Results are the raw bits of the dmask components. **The runtime binds each image's view in its own format at its index of the sampled array** (what `bind_image` in `runtime/shims/d3d12_vulkan_device.cpp` already does for SRVs and UAVs), so the view's numeric type matches the alias that reads it. No storage image is read, so shaders that only load need neither `shaderStorageImageReadWithoutFormat` (missing on Intel Xe-LP, #619) nor `shaderStorageImageWriteWithoutFormat` (SHADER-151). Until 2026-11-22 integer formats were read with `OpImageRead` from the uint/sint storage arrays (bindings 8–19), which hold only unordered-access views and 256 entries: a read-only integer texture found the fallback there, or an index past the array's end. Like the float path, the fetch goes through the texture path, so it sees writes made before the dispatch, not ones made earlier in the same dispatch. **d16 loads take the same branch** (#1136) and pack the dmask components two per VGPR, low half first: f16 (round to nearest even, integer ops, no `PackHalf2x16`) from the float array, the low 16 bits of each value from the uint/sint aliases (truncated). Before #1136, a d16 load always read the float view, so a `Texture2D` `Load` returned garbage. CPU-checked by `tests/test_image_load_typed.py` (capabilities, bindings and component types for every dimension; the branch for all 512 FORMAT values, found and missed). GPU-checked with `runtime/test/shaders/cs_imgload.asm` through `vk_store_test load`, on a device made without `shaderStorageImageReadWithoutFormat`: r32 uint and r32 sint images filled before the dispatch, both read with `image_load` and their sum stored, every texel exact on an RTX 2080 Ti (NVIDIA 621.14, Windows 11), clean under the validation layer with GPU-assisted validation; the test fails a module that declares `StorageImageReadWithoutFormat`. d16: CPU-checked by `tests/test_image_load_d16_typed.py` (the uint/sint fetches go through the aliases, no storage image is read, the SPIR-V validates); GPU-checked with `runtime/test/shaders/cs_imgload_d16.asm` through `vk_store_test load`: both pre-filled texels read with d16 loads (the sint one sign-extended from bit 15 in the shader) and their sum stored, every texel exact on the RTX 2080 Ti with GPU-assisted validation (#1136 checked its first form, a store and d16 read-back in one dispatch, on an RTX 5070). 2D `image_load_mip` uses the same numeric-type selection and passes the address register's mip to each fetch. Checked on RTX 5080 and Radeon Graphics with R8G8B8A8 UINT, SINT and UNORM textures: level 1 matched the CPU reference at every pixel with GPU-assisted validation, and forcing level 0 changed all 4096 pixels for each format. Unverified: whether AMD saturates out-of-range integers instead of truncating (Mesa sets `integer_dest_saturates`), and d16 loads on 1D, 2D-array and 3D images on a GPU. | -| Typed 2D gathers | `image_gather4_lz(_o)` takes one channel from four taps. For `image_gather4_l(_o)` the four manual fetches share the rounded, clamped mip and addressed footprint. The T# FORMAT selects the float, UINT or SINT sampled image at binding 0. For d16, integer taps are packed low half first, two per VGPR; float taps round to f16. | AMD RDNA 2 ISA §8.2 (MIMG D16). RTX 5080 and Radeon Graphics matched a CPU clamp-to-edge gather over all 4096 RGBA32F pixels for 8-bit UINT, SINT and UNORM, both packed and unpacked, with zero offset and with (+1,-1). Selecting red in place of green changed all 4096 pixels. Explicit LOD 1 on two-level UINT, SINT and UNORM images also matched all 4096 pixels for both offset forms on both GPUs. Forcing mip 0 changed every pixel. Out-of-range integer narrowing has the same limitation as typed image loads below. | -| Typed image loads | `image_load` on 1D/2D/2D-array/3D images uses the same T# FORMAT tables as stores, and fetches every format with `OpImageFetch` from the sampled array of its dimension (bindings 0, 3, 6, 5): UINT/SINT formats through **uint/sint aliases of that array** (same set and binding, an `OpTypeImage` of `%uint`/`%int`; Vulkan allows several variables on one binding when the descriptor type fits), everything else through the float array. A lookup miss (index 0) takes the float path, since the fallback there is RGBA8_UNORM. Results are the raw bits of the dmask components. **The runtime binds each image's view in its own format at its index of the sampled array** (what `bind_image` in `runtime/shims/d3d12_vulkan_device.cpp` already does for SRVs and UAVs), so the view's numeric type matches the alias that reads it. No storage image is read, so shaders that only load need neither `shaderStorageImageReadWithoutFormat` (missing on Intel Xe-LP, #619) nor `shaderStorageImageWriteWithoutFormat` (SHADER-151). Until 2026-11-22 integer formats were read with `OpImageRead` from the uint/sint storage arrays (bindings 8–19), which hold only unordered-access views and 256 entries: a read-only integer texture found the fallback there, or an index past the array's end. Like the float path, the fetch goes through the texture path, so it sees writes made before the dispatch, not ones made earlier in the same dispatch. **d16 loads take the same branch** (#1136) and pack the dmask components two per VGPR, low half first: f16 (round to nearest even, integer ops, no `PackHalf2x16`) from the float array, the low 16 bits of each value from the uint/sint aliases (truncated). Before #1136, a d16 load always read the float view, so a `Texture2D` `Load` returned garbage. CPU-checked by `tests/test_image_load_typed.py` (capabilities, bindings and component types for every dimension; the branch for all 512 FORMAT values, found and missed). GPU-checked with `runtime/test/shaders/cs_imgload.asm` through `vk_store_test load`, on a device made without `shaderStorageImageReadWithoutFormat`: r32 uint and r32 sint images filled before the dispatch, both read with `image_load` and their sum stored, every texel exact on an RTX 2080 Ti (NVIDIA 621.14, Windows 11), clean under the validation layer with GPU-assisted validation; the test fails a module that declares `StorageImageReadWithoutFormat`. d16: CPU-checked by `tests/test_image_load_d16_typed.py` (the uint/sint fetches go through the aliases, no storage image is read, the SPIR-V validates); GPU-checked with `runtime/test/shaders/cs_imgload_d16.asm` through `vk_store_test load`: both pre-filled texels read with d16 loads (the sint one sign-extended from bit 15 in the shader) and their sum stored, every texel exact on the RTX 2080 Ti with GPU-assisted validation (#1136 checked its first form, a store and d16 read-back in one dispatch, on an RTX 5070). 2D `image_load_mip` uses the same numeric-type selection and passes the address register's mip to each fetch. Its D16 form packs the selected components in ascending order, two per VGPR. An RGBA8 two-level texture was checked on RTX 5080 and Radeon Graphics: all four exported halves matched the CPU reference for UINT, SINT and UNORM, and forcing level 0 changed every pixel. Checked on RTX 5080 and Radeon Graphics with R8G8B8A8 UINT, SINT and UNORM textures: level 1 matched the CPU reference at every pixel with GPU-assisted validation, and forcing level 0 changed all 4096 pixels for each format. Unverified: whether AMD saturates out-of-range integers instead of truncating (Mesa sets `integer_dest_saturates`), and d16 loads on 1D, 2D-array and 3D images on a GPU. | -| Typed image loads | `image_load` on 1D/2D/2D-array/3D images uses the same T# FORMAT tables as stores, and fetches every format with `OpImageFetch` from the sampled array of its dimension (bindings 0, 3, 6, 5): UINT/SINT formats through **uint/sint aliases of that array** (same set and binding, an `OpTypeImage` of `%uint`/`%int`; Vulkan allows several variables on one binding when the descriptor type fits), everything else through the float array. A lookup miss (index 0) takes the float path, since the fallback there is RGBA8_UNORM. Results are the raw bits of the dmask components. **The runtime binds each image's view in its own format at its index of the sampled array** (what `bind_image` in `runtime/shims/d3d12_vulkan_device.cpp` already does for SRVs and UAVs), so the view's numeric type matches the alias that reads it. No storage image is read, so shaders that only load need neither `shaderStorageImageReadWithoutFormat` (missing on Intel Xe-LP, #619) nor `shaderStorageImageWriteWithoutFormat` (SHADER-151). Until 2026-11-22 integer formats were read with `OpImageRead` from the uint/sint storage arrays (bindings 8–19), which hold only unordered-access views and 256 entries: a read-only integer texture found the fallback there, or an index past the array's end. Like the float path, the fetch goes through the texture path, so it sees writes made before the dispatch, not ones made earlier in the same dispatch. **d16 loads take the same branch** (#1136) and pack the dmask components two per VGPR, low half first: f16 (round to nearest even, integer ops, no `PackHalf2x16`) from the float array, the low 16 bits of each value from the uint/sint aliases (truncated). For odd component counts (1 or 3 in `dmask`), the trailing destination VGPR preserves its existing high 16 bits (`write_lo16`), matching native `gfx1036` hardware where a seeded `0x5a5a` high half survived 1-component UINT/SINT `image_load` and `image_load_mip`; until 2026-11-22 the unused high half was zeroed. Before #1136, a d16 load always read the float view, so a `Texture2D` `Load` returned garbage. CPU-checked by `tests/test_image_load_typed.py` (capabilities, bindings and component types for every dimension; the branch for all 512 FORMAT values, found and missed). GPU-checked with `runtime/test/shaders/cs_imgload.asm` through `vk_store_test load`, on a device made without `shaderStorageImageReadWithoutFormat`: r32 uint and r32 sint images filled before the dispatch, both read with `image_load` and their sum stored, every texel exact on an RTX 2080 Ti (NVIDIA 621.14, Windows 11), clean under the validation layer with GPU-assisted validation; the test fails a module that declares `StorageImageReadWithoutFormat`. d16: CPU-checked by `tests/test_image_load_d16_typed.py` (the uint/sint fetches go through the aliases, no storage image is read, the SPIR-V validates); GPU-checked with `runtime/test/shaders/cs_imgload_d16.asm` through `vk_store_test load`: both pre-filled texels read with d16 loads (the sint one sign-extended from bit 15 in the shader) and their sum stored, every texel exact on the RTX 2080 Ti with GPU-assisted validation (#1136 checked its first form, a store and d16 read-back in one dispatch, on an RTX 5070). 2D `image_load_mip` uses the same numeric-type selection and passes the address register's mip to each fetch. Checked on RTX 5080 and Radeon Graphics with R8G8B8A8 UINT, SINT and UNORM textures: level 1 matched the CPU reference at every pixel with GPU-assisted validation, and forcing level 0 changed all 4096 pixels for each format. Unverified: whether AMD saturates out-of-range integers instead of truncating (Mesa sets `integer_dest_saturates`), and d16 loads on 1D, 2D-array and 3D images on a GPU. | +| Typed image loads | `image_load` on 1D/2D/2D-array/3D images uses the same T# FORMAT tables as stores, and fetches every format with `OpImageFetch` from the sampled array of its dimension (bindings 0, 3, 6, 5): UINT/SINT formats through **uint/sint aliases of that array** (same set and binding, an `OpTypeImage` of `%uint`/`%int`; Vulkan allows several variables on one binding when the descriptor type fits), everything else through the float array. A lookup miss (index 0) takes the float path, since the fallback there is RGBA8_UNORM. Results are the raw bits of the dmask components. **The runtime binds each image's view in its own format at its index of the sampled array** (what `bind_image` in `runtime/shims/d3d12_vulkan_device.cpp` already does for SRVs and UAVs), so the view's numeric type matches the alias that reads it. No storage image is read, so shaders that only load need neither `shaderStorageImageReadWithoutFormat` (missing on Intel Xe-LP, #619) nor `shaderStorageImageWriteWithoutFormat` (SHADER-151). Until 2026-11-22 integer formats were read with `OpImageRead` from the uint/sint storage arrays (bindings 8–19), which hold only unordered-access views and 256 entries: a read-only integer texture found the fallback there, or an index past the array's end. Like the float path, the fetch goes through the texture path, so it sees writes made before the dispatch, not ones made earlier in the same dispatch. **d16 loads take the same branch** (#1136) and pack the dmask components two per VGPR, low half first: f16 (round to nearest even, integer ops, no `PackHalf2x16`) from the float array, the low 16 bits of each value from the uint/sint aliases (truncated). For odd component counts (1 or 3 in `dmask`), the trailing destination VGPR preserves its existing high 16 bits (`write_lo16`), matching native `gfx1036` hardware where a seeded `0x5a5a` high half survived 1-component UINT/SINT `image_load` and `image_load_mip`; until 2026-11-22 the unused high half was zeroed. Before #1136, a d16 load always read the float view, so a `Texture2D` `Load` returned garbage. CPU-checked by `tests/test_image_load_typed.py` (capabilities, bindings and component types for every dimension; the branch for all 512 FORMAT values, found and missed). GPU-checked with `runtime/test/shaders/cs_imgload.asm` through `vk_store_test load`, on a device made without `shaderStorageImageReadWithoutFormat`: r32 uint and r32 sint images filled before the dispatch, both read with `image_load` and their sum stored, every texel exact on an RTX 2080 Ti (NVIDIA 621.14, Windows 11), clean under the validation layer with GPU-assisted validation; the test fails a module that declares `StorageImageReadWithoutFormat`. d16: CPU-checked by `tests/test_image_load_d16_typed.py` (the uint/sint fetches go through the aliases, no storage image is read, the SPIR-V validates); GPU-checked with `runtime/test/shaders/cs_imgload_d16.asm` through `vk_store_test load`: both pre-filled texels read with d16 loads (the sint one sign-extended from bit 15 in the shader) and their sum stored, every texel exact on the RTX 2080 Ti with GPU-assisted validation (#1136 checked its first form, a store and d16 read-back in one dispatch, on an RTX 5070). 2D `image_load_mip` uses the same numeric-type selection and passes the address register's mip to each fetch. Its D16 form packs the selected components in ascending order, two per VGPR. An RGBA8 two-level texture was checked on RTX 5080 and Radeon Graphics: all four exported halves matched the CPU reference for UINT, SINT and UNORM, and forcing level 0 changed every pixel. Checked on RTX 5080 and Radeon Graphics with R8G8B8A8 UINT, SINT and UNORM textures: level 1 matched the CPU reference at every pixel with GPU-assisted validation, and forcing level 0 changed all 4096 pixels for each format. Native gfx1036 saturated 32-bit UINT/SINT texels to the unsigned/signed 16-bit range in both D16 load forms; the translated 2D load matched both limits on RTX 5080 and Radeon Graphics. D16 loads on 1D, 2D-array and 3D images still lack GPU checks. | +| Typed 2D gathers | `image_gather4_lz(_o)` takes one channel from four taps. For `image_gather4_l(_o)` the four manual fetches share the rounded, clamped mip and addressed footprint. The T# FORMAT selects the float, UINT or SINT sampled image at binding 0. For d16, integer taps are packed low half first, two per VGPR; float taps round to f16. | AMD RDNA 2 ISA §8.2 (MIMG D16). RTX 5080 and Radeon Graphics matched a CPU clamp-to-edge gather over all 4096 RGBA32F pixels for 8-bit UINT, SINT and UNORM, both packed and unpacked, with zero offset and with (+1,-1). Selecting red in place of green changed all 4096 pixels. Explicit LOD 1 on two-level UINT, SINT and UNORM images also matched all 4096 pixels for both offset forms on both GPUs. Forcing mip 0 changed every pixel. Native gfx1036 saturates out-of-range integer taps as in the typed image loads below. | | Image atomics, size and LOD queries | `image_atomic_add/sub/and/or/xor/smin/smax/umin/umax` are `OpAtomicIAdd/ISub/And/Or/Xor/SMin/SMax/UMin/UMax` on the texel (`OpImageTexelPointer`) of an r32ui storage image, binding 4 for 2D and 7 for 3D, at the T#'s index (the view `StorageViews::r32ui` of `runtime/src/vulkan_bindless.h`). The data VGPR is the operand; with `glc` it receives the texel's previous value, without it it is not written (RDNA2 ISA, MIMG: the previous value is returned if glc is 1). `image_atomic_cmpswap` takes two data VGPRs, the new value and then the comparand (`OpAtomicCompareExchange`). A lane that EXEC turns off leaves memory alone: cmpswap is skipped, the others run with the operand that changes nothing. `image_get_resinfo` (2D, no sampler) gives, for the mip level in its address VGPR, width, height, depth (1) and the level count in VGPRs 0..3 (ISA: {num_mip_levels, depth, height, width} in VGPRs 3..0; `OpImageQuerySizeLod`, `OpImageQueryLevels`). `image_get_lod` (pixel shaders; 2D and 2D array, the slice ignored) gives the clamped LOD and the calculated LOD in VGPRs 0..1 (ISA: {rawLOD, clampedLOD} in VGPRs 1..0; `OpImageQueryLod`). In both, dmask keeps components and packs them into consecutive VGPRs. GPU-checked (TEST-184) on an RX 7900 XTX and a Ryzen 9 7950X3D integrated GPU (RADV, Mesa 26.3.1) and on Mesa llvmpipe, with the expected words derived by hand in each `.asm` header: `cs_imgatomic.asm` (every op on a 2D image: 0xfffffff0 tells the signed min/max from the unsigned ones, each with a case that goes the other way; cmpswap hit and miss; an op without `glc`; 63 lanes off; 64 threads adding to one texel) and `cs_imgatomic3d.asm` (six cases on a 4x4x4 volume, the three coordinates all different), through `vk_store_test words`; `cs_resinfo.asm` (a 16x4 image with five levels: levels 0, 1 and 3 in full, then dmask 0x3, 0xa and 0x8); `ps_get_lod.asm` and `ps_get_lod_array.asm` through `vk_texture_test` (calculated LOD 1 and 3 on the two-mip texture, the clamped LOD held at the last level, and at 0 by a sampler MAX_LOD of 0.25; 2 and -3 on the one-level array). Unverified: resinfo's depth word on hardware (1 is what the T#'s DEPTH field says for a 2D image), the clamped LOD under a linear mip filter (the test's sampler is point-filtered, where 0.25 selects level 0), and the order of u and v in the LOD query (the test textures are square, where it makes no difference). `image_get_resinfo` on other dimensions is `Unsupported`. A host quirk the LOD test steps around: Mesa llvmpipe 26.3.1 does not apply a sampler's LOD range to `OpImageQueryLod` when its minimum and maximum are equal (0..0 gave level 1), so the second draw uses 0..0.25. | | SDWA | `_sdwa` forms: each source is narrowed to `src0_sel`/`src1_sel` (BYTE_n/WORD_n, zero-extended, or sign-extended under `sext()`) **before** neg/abs and the op. A VGPR result goes to `dst_sel`, with `dst_unused` setting the other bits: PAD = 0, SEXT = sign copies above the field, PRESERVE = old bits kept. VOPC has no `dst_sel`, and GFX10 `v_cmpx` has no written destination. **Until 2026-11-20 the selects were silently ignored.** That affected 3,826 of the 13,926 translated shaders: they passed `spirv-val` but computed wrong values. GPU-checked with `runtime/test/shaders/ps_sdwa.asm` and `ps_ops.asm` (also `v_pk_fma_f16`, `v_min3_u32`, `v_max3_i32`, `v_bfe_i32`): byte/word source selects, `sext()`, `UNUSED_PRESERVE` into WORD_1 and `UNUSED_SEXT` at BYTE_2 all match on every pixel. | | Byte permute | `v_perm_b32`: result byte i = BYTE_PERMUTE({src0, src1}, selector byte i), src1 = bytes 0–3 (AMD "RDNA 2" ISA reference, VOP3 opcode 836 V_PERM_B32, `byte_permute` pseudocode, page 189 of the PDF). Selector 0–7 picks that byte; **8, 9, 10, 11 give 0xff if bit 7 of byte 1, 3, 5, 7 is set, else 0x00**; 12 gives 0x00; 13 and above give 0xff. **Until 2026-11-21 selectors 8–11 gave 0x00 regardless of the sign bit**. In the 26,503-shader disassembled corpus (measured via `tools/feature_scan.py`), 0 of 10,500 shaders (11,930 `v_perm_b32` instructions) use selectors 8–11 or >= 13: all 11,258 immediate and 672 constant-register selectors (0 unresolved) use only bytes 0–7 (36,234) and 12 (11,486). GPU-checked with `runtime/test/shaders/ps_ops7.asm` (also `v_alignbit_b32` with a shift of 36, `v_med3_i32` vs `v_med3_u32`) and `ps_ops8.asm` (`v_mul_hi_u32/i32`, `v_bcnt_u32_b32`, `v_ffbl_b32`, `v_ffbh_u32` of 0, `v_xad_u32`, `v_add3_u32`), 4096/4096 pixels on an AMD Radeon iGPU (Ryzen 7 9800X3D, RDNA2, AMD driver 25.10.36) and an NVIDIA GeForce RTX 5070 (driver 621.24); before the fix `ps_ops7` gave 0x00000000 for the sign-selector word on both. Also executed by `tests/semantic/test_value_semantics.py`. | @@ -354,23 +341,24 @@ How the generated SPIR-V expects the runtime to work: | 64-bit scalar bitwise ops (`s_and_b64`, `s_or_b64`, `s_xor_b64`, `s_andn2_b64`, `s_orn2_b64`, `s_nand_b64`, `s_nor_b64`, `s_xnor_b64`, `s_not_b64`) | Dispatched like `s_cselect_b64`: when destination is `exec`/`vcc` or any source is a lane mask (`holds_lane_mask` or `exec`/`vcc`), uses the per-lane mask path (`mask_src`/`mask_dst` including `null` dst) and votes SCC across the wave (`scc_from_mask`). Otherwise operates on both 32-bit dwords of non-mask 64-bit scalar data (SGPR pairs, sign-extended inline/literal immediates, `null` = 0), reads all source dwords before storing (preserving destination aliasing), accepts `null` destination, and sets `SCC = ((D.lo \| D.hi) != 0)`. Until 2026-11-22 these ops always took the lane-mask path, duplicating D.lo into D.hi and voting SCC on D.lo alone. `s_nand/nor/xnor_b64` compute `~(S0 op S1)` on both paths (a lane's mask value is 0 or ~0, so the NOT is per lane); until 2026-11-22 they were rejected as unsupported. Source: RDNA2 ISA SOP1/SOP2. CPU-checked by `tests/semantic/test_salu64_bitwise_data.py` (all 9 ops, 4-corner SCC, immediates, aliasing, stale mask overwrite, wave32/wave64 lane-mask regression, and `--wave64-emulate`). **Hardware-verified** on the same part through `tools/hw_oracle` for the plain-data path: `s_and_b64(0xFFFFFFFF_00000000, 0x0F0F0F0F_0F0F0F0F)` = 0x0F0F0000_00000000, `s_xnor_b64(0xFFFF0000_00000000, 0_FFFFFFFF)` = 0x0000FFFF_00000000, `s_nand_b64(0xFFFF0000_0, 0)` = 0xFFFFFFFF_FFFFFFFF, `s_not_b64(0x0000FFFF_0)` = 0xFFFF0000_FFFFFFFF and `s_andn2_b64(0xFFFF0000_0, 0)` = 0xFFFF0000_0, all with SCC 1, while `s_or_b64(0, 0)` = 0 with SCC 0: SCC = ((D.lo ≠ 0) or (D.hi ≠ 0)). The lane-mask path (EXEC/VCC sources, or a mask destination) is a translator model and cannot be measured this way. | | Constant lane masks (`Gen.mask_src` immediates) | A constant read as a lane mask is one bit per lane: lane L takes bit L. The 64-bit forms (`s_and/or/andn2_saveexec_b64`, `s_andn2_wrexec_b64`, `s_mov_b64`/`s_not_b64` into EXEC or VCC, `s_and/or/xor/andn2/orn2_b64` and `s_cselect_b64` on the lane-mask path) read the 64-bit value, an inline constant sign-extended (`-16` = lanes 4-63) and a literal with a zero high word, as `src64_data` reads 64-bit constants; the b32 forms (`s_*_saveexec_b32`, `s_andn2_wrexec_b32`) read the 32-bit value at bit L mod 32. 0 and -1 still give no lane and every lane, with no per-lane code. `s_bcnt0/1_i32_b64` of a constant counts the constant's 64 bits (scalar data, like `s_ff0/1_i32_b64`). **Before this fix every lane took bit 0 of the constant**: `s_and_saveexec_b32 s7, 0xff00` with all 32 lanes on left none on, `5` left all 32 on, and `s_bcnt1_i32_b64 s0, 0xff00ff` gave 32. llvm-mc rejects a constant as the mask operand of `v_cndmask_b32_e64` / `v_add_co_ci_u32_e64` and decodes one as "Invalid immediate", so those VALU callers never see a constant. Not covered here: SGPRs read as masks (#293) and a literal with bit 31 set in a 64-bit position (zero- vs sign-extension not measured). GPU-checked with `runtime/test/shaders/cs_w32_mask_imm.asm` and `cs_w64_mask_imm.asm` on an NVIDIA GeForce RTX 5080 (driver 616.92; wave64 with `LEONIDA_W64_EMULATE=1`) and an AMD Radeon RDNA2 iGPU (driver 26.10.1, native 64-wide subgroup): both failed before on both GPUs. Run across every lane in `tests/semantic/test_value_semantics.py` (`LaneMaskConstants`). | | Vector integer additions (`v_mul_hi_u32_u24`/`v_mul_hi_i32_i24`, `v_lshrrev_b64`/`v_ashrrev_i64`, `v_qsad_pk_u16_u8`/`v_mqsad_pk_u16_u8`) | `v_mul_hi_*24`: the high 32 bits of the 48-bit product of the low 24 bits, zero-extended (u24) or sign-extended from bit 23 (i24); the high halves of `v_mul_u32_u24` / `v_mul_i32_i24`. `v_lshrrev_b64` / `v_ashrrev_i64`: the pair (or a 64-bit constant) shifted right by S0 & 63, logically or arithmetically, through the `v_lshlrev_b64` code. `v_qsad_pk_u16_u8` / `v_mqsad_pk_u16_u8`: D.u16[k] = (S2.u16[k] + byte SAD of the 32-bit window S0[8k+31:8k] against S1) & 0xFFFF; the m form skips bytes where S1's byte is 0; `clamp` raises `Unsupported`. Source: RDNA ISA pseudocode. CPU-checked by `tests/semantic/test_alu_mul_hi_24.py`, `test_alu_shift_b64.py`, `test_alu_qsad.py`; run on NVIDIA by reviewers (`v_mul_hi_*24`: RTX 5090 and RTX 5070 in #440; `v_qsad`/`v_mqsad`: 24 cases bit-exact on an RTX 3060 in #623). **Hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137). | +| Constant lane masks (`Gen.mask_src` immediates) | A constant read as a lane mask is one bit per lane: lane L takes bit L. The 64-bit forms (`s_and/or/andn2_saveexec_b64`, `s_andn2_wrexec_b64`, `s_mov_b64`/`s_not_b64` into EXEC or VCC, `s_and/or/xor/andn2/orn2_b64` and `s_cselect_b64` on the lane-mask path) read the 64-bit value, an inline constant sign-extended (`-16` = lanes 4-63) and a literal with a zero high word, as `src64_data` reads 64-bit constants; the b32 forms (`s_*_saveexec_b32`, `s_andn2_wrexec_b32`) read the 32-bit value at bit L mod 32. 0 and -1 still give no lane and every lane, with no per-lane code. `s_bcnt0/1_i32_b64` of a constant counts the constant's 64 bits (scalar data, like `s_ff0/1_i32_b64`). **Before this fix every lane took bit 0 of the constant**: `s_and_saveexec_b32 s7, 0xff00` with all 32 lanes on left none on, `5` left all 32 on, and `s_bcnt1_i32_b64 s0, 0xff00ff` gave 32. llvm-mc rejects a constant as the mask operand of `v_cndmask_b32_e64` / `v_add_co_ci_u32_e64` and decodes one as "Invalid immediate", so those VALU callers never see a constant. **A constant held in an SGPR** (`s_mov_b32 s20, 0x3ffffc00`) is read the same way when it reaches a mask consumer: `mask_src` takes bit L of an SGPR that `holds_lane_mask` doesn't flag (a pair in a wave64 64-bit context: the high SGPR for lanes 32-63). In a wave32 program a 32-bit bitwise SOP2 (`s_and/or/xor/andn2/orn2/nand/nor/xnor_b32`, `s_cselect_b32`) that writes EXEC/VCC reads both operands through `mask_src` (`Gen.sop2_b32_srcs`); into a plain SGPR it stays a data read, because `lane_masks.py` classifies that SGPR as data when the other operand is a constant (`s_and_b32 s20, exec_lo, 1` then `s_bcnt1` must count the wave's bits: found by @Pierre-Kookis on #1792, GPU-reproduced), and `s_mov_b32 exec_lo/exec_hi, sN` takes each lane's bit. A real mask is unchanged: it holds 0 or ~0 per lane, and bit L of that is the same 0 or 1. Until 2026-11-22 these took the value whole, so `s_and_saveexec_b32 s6, s20` with that constant, or `s_and_b32 exec_lo, exec_lo, 0xff00`, left every lane on (found writing `cs_w32_saveexec_ext`, #1771; CPU-checked by `tests/semantic/test_mask_src_sgpr_const.py`, and `tools/cf_diff.py` / `tools/salu_diff.py` still pass). Not covered: a b32 op on one half of a wave64 mask, masks read as data (#293), and a literal with bit 31 set in a 64-bit position (zero- vs sign-extension not measured). GPU-checked with `runtime/test/shaders/cs_w32_mask_imm.asm` and `cs_w64_mask_imm.asm` on an NVIDIA GeForce RTX 5080 (driver 616.92; wave64 with `LEONIDA_W64_EMULATE=1`) and an AMD Radeon RDNA2 iGPU (driver 26.10.1, native 64-wide subgroup): both failed before on both GPUs. Run across every lane in `tests/semantic/test_value_semantics.py` (`LaneMaskConstants`). | +| Vector integer additions (`v_mul_hi_u32_u24`/`v_mul_hi_i32_i24`, `v_lshrrev_b64`/`v_ashrrev_i64`, `v_qsad_pk_u16_u8`/`v_mqsad_pk_u16_u8`) | `v_mul_hi_*24`: the high 32 bits of the 48-bit product of the low 24 bits, zero-extended (u24) or sign-extended from bit 23 (i24); the high halves of `v_mul_u32_u24` / `v_mul_i32_i24`. `v_lshrrev_b64` / `v_ashrrev_i64`: the pair (or a 64-bit constant) shifted right by S0 & 63, logically or arithmetically, through the `v_lshlrev_b64` code. `v_qsad_pk_u16_u8` / `v_mqsad_pk_u16_u8`: D.u16[k] = (S2.u16[k] + byte SAD of the 32-bit window S0[8k+31:8k] against S1) & 0xFFFF; the m form skips bytes where S1's byte is 0; `clamp` raises `Unsupported`. Source: RDNA ISA pseudocode. CPU-checked by `tests/semantic/test_alu_mul_hi_24.py`, `test_alu_shift_b64.py`, `test_alu_qsad.py`; run on NVIDIA by reviewers (`v_mul_hi_*24`: RTX 5090 and RTX 5070 in #440; `v_qsad`/`v_mqsad`: 24 cases bit-exact on an RTX 3060 in #623). **Not measured on RDNA2.** | | Constant and ordered VOPC, `v_cmp(x)_nlg_*`, `v_cvt_off_f32_i4`, `v_pipeflush` | `v_cmp(x)_f_*` is always false, `v_cmp(x)_t_*` (integers) and `v_cmp(x)_tru_*` (floats) always true; `v_cmp(x)_o_{f32,f16}` is true when neither source is NaN, `_u_` when either is (`OpIsNan`), and `_nlg_` when `x == y` or either source is NaN (`OpFUnordEqual`, completing all 16 IEEE-754 RDNA2 float VOPC predicates; LLVM `gfx10_asm_vopc.s`); the result goes through the usual VOPC path (VCC, an SGPR mask, or EXEC for `v_cmpx`; off lanes give 0). `v_cvt_off_f32_i4`: D = sext(S0[3:0]) / 16 (the ISA's CVT_OFF_TABLE, -0.5 .. 0.4375), exact, output modifiers apply. `v_pipeflush` only flushes the VALU pipeline and is translated as nothing, like `v_nop`. Source: RDNA2 ISA VOPC and VOP1. CPU-checked by `tests/semantic/test_vopc_const_ordered.py`, `tests/semantic/test_float_compares.py` (`nlg`; GPU-checked by `ps_cmp_nlg.asm`: f32 and f16 with ±0, quiet and signalling NaN, ±inf and ignored f16 high halves, the e64 form with `abs`/`neg`, and `v_cmpx_nlg` on equal and NaN operands, Tesla V100 (NVIDIA 580.95.05, Linux)), `test_alu_cvt_off.py` (GPU-checked by `ps_cvt_off.asm`, upper bits ignored and `mul:4` with and without `clamp`), `test_valu_pipeflush.py`; the constant/ordered float compares were run on an RTX 5090 (16 draws, quiet and signalling NaNs) and the suite on RTX 4050 / Radeon 740M in #620; `v_pipeflush` on RTX 5090 / RTX 3060 in #735. | | Relative VGPR moves (`v_movrel*`) | The VGPR file is a Function-scope uint array, so `v_movrels_b32`/`v_movreld_b32`/`v_movrelsd_b32` become dynamic array accesses at `reg + M0` (the whole of M0, as the RDNA2 ISA's opcode descriptions say). `v_movrelsd_2_b32` (VOP1 opcode 72) offsets each side by its own field: VGPR[D + M0[25:16]] = VGPR[S0 + M0[9:0]], other M0 bits ignored (RDNA2 ISA §12.8 opcode description and the RDNA3 ISA; the RDNA2 §6.6 summary table prints M0[7:0] for the source). The write keeps inactive lanes. Not modelled: the hardware's range check against the wave's VGPR allocation (an out-of-range source reads VGPR0, an out-of-range write is dropped). CPU-checked by `tests/semantic/test_alu_movrelsd_2.py` (including set ignored M0 bits); GPU-checked with `runtime/test/shaders/cs_movrelsd_2.asm` (the ISA's own example, v25 ← v17 with M0 = (20 << 16) \| 10) on NVIDIA RTX 4050 Laptop (Ada) and AMD Radeon 740M (RADV). | -| Relative SGPR reads (`s_movrels_b32`, `s_movrels_b64`) | `D = SGPR[S0 + M0]`; the b64 form reads the pair at `S0 + M0` and `S0 + M0 + 1` (RDNA2 ISA SOP1). The SGPR file is a Function-scope uint array, so this is a dynamic load, as for `v_movrels`. Every SGPR write stores into that array (`store_reg`), so the load sees the current value. All reads happen before the destination is written, so D may overlap the source. SCC is not written. The index wraps to the 128 array slots, so it cannot reach the lane-mask parking slots past them. **Not modelled:** the hardware's range check, and reads past s105 landing on VCC and the other special registers. `s_movreld_b32/b64`, the relative writes, stay `Unsupported`, because the translator keeps translate-time knowledge of SGPR values (literal S# words, descriptor caches) that a dynamic write would invalidate. Until 2026-11-22 both reads raised `Unsupported`. CPU-checked by `tests/semantic/test_salu_movrels.py` (M0 from 0 to 5 and from a register, the b64 pair, an overlapping destination, SCC kept, `s_movreld` rejected). **Not GPU-verified.** | | `v_swaprel_b32` | GFX10 VOP1 opcode 104: swap `VGPR[D + M0[25:16]]` and `VGPR[S0 + M0[9:0]]`, the two M0 fields `v_movrelsd_2_b32` uses; the other M0 bits are ignored (RDNA2 ISA opcode description). Both registers are read before either is written. When both name one register it keeps its value. Inactive lanes keep both registers (`OpSelect` on `active`). As for `v_movrel*`, the hardware's range check against the VGPR allocation is not modelled. A non-VGPR operand raises `Unsupported`. Until 2026-11-22 the op raised `Unsupported`. CPU-checked by `tests/semantic/test_alu_swaprel.py` (both fields, ignored M0 bits, a self-swap, a register-file model). **Not GPU-verified.** | | Relative SGPR reads (`s_movrels_b32`, `s_movrels_b64`) | `D = SGPR[S0 + M0]`; the b64 form reads the pair at `S0 + M0` and `S0 + M0 + 1` (RDNA2 ISA SOP1). The SGPR file is a Function-scope uint array, so this is a dynamic load, as for `v_movrels`. Every SGPR write stores into that array (`store_reg`), so the load sees the current value. All reads happen before the destination is written, so D may overlap the source. SCC is not written. The index wraps to the 128 array slots, so it cannot reach the lane-mask parking slots past them. An SGPR that `lane_masks.py` marks as a lane mask (a saved EXEC, a `v_cmp` result) holds only this lane's bit, so the whole wave's mask word is collected for each such SGPR (as for `s_bcnt1`) and read instead when the index lands on it; D then holds the mask as data (SHADER-284, CPU-checked by `tests/semantic/test_salu_movrels_lane_mask.py`, wave32 and wave64). **Not modelled:** the hardware's range check, and reads past s105 landing on VCC and the other special registers. `s_movreld_b32/b64`, the relative writes, stay `Unsupported`, because the translator keeps translate-time knowledge of SGPR values (literal S# words, descriptor caches) that a dynamic write would invalidate. Until 2026-11-22 both reads raised `Unsupported`. CPU-checked by `tests/semantic/test_salu_movrels.py` (M0 from 0 to 5 and from a register, the b64 pair, an overlapping destination, SCC kept, `s_movreld` rejected). **Not GPU-verified.** | | Relative SGPR reads (`s_movrels_b32`, `s_movrels_b64`) | `D = SGPR[S0 + M0]`; the b64 form reads the pair at `S0 + M0` and `S0 + M0 + 1` (RDNA2 ISA SOP1). The SGPR file is a Function-scope uint array, so this is a dynamic load, as for `v_movrels`. Every SGPR write stores into that array (`store_reg`), so the load sees the current value. All reads happen before the destination is written, so D may overlap the source. SCC is not written. The index wraps to the 128 array slots, so it cannot reach the lane-mask parking slots past them. **Not modelled:** the hardware's range check, and reads past s105 landing on VCC and the other special registers. `s_movreld_b32/b64`, the relative writes, stay `Unsupported`, because the translator keeps translate-time knowledge of SGPR values (literal S# words, descriptor caches) that a dynamic write would invalidate. Until 2026-11-22 both reads raised `Unsupported`. CPU-checked by `tests/semantic/test_salu_movrels.py` (M0 from 0 to 5 and from a register, the b64 pair, an overlapping destination, SCC kept, `s_movreld` rejected). **Hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137, SCC kept). | | d16 and f16 format narrowing | The f16 of every d16 result (image samples and gathers, the `image_sample_c_lz` compare result, typed buffer loads) and of the f16 formats a typed buffer store writes is narrowed with integer round to nearest even (`Gen.f16_bits`; #489, #711), not with `PackHalf2x16`. AMD drivers lower `PackHalf2x16` to `v_cvt_pkrtz_f16_f32`, which rounds toward zero (#489), and there about half of all unorm8, unorm16 and snorm8 values loaded with d16 came out 1 ulp low (123 of 256, 31,742 of 65,536 and 110 of 256). Packed MUBUF and MTBUF loads clamp unsigned 32-bit channels to 65535 before writing each half. On native gfx1036, values 65534 and 65535 survived, while 65536, 65537 and 0xffffffff all produced 0xffff, across all four load widths in wave32 and wave64. Packed `buffer_load_format_d16_x` and `_xyz` write only the low 16 bits of the final VGPR. Its upper half survives even when the load is out of bounds. Native gfx1036 wave32 and wave64 confirmed this with RGBA8_UINT and RGBA8_UNORM, two destination seeds, and both even-component loads as full-write controls. Full pairs are packed by `pack_f16_pair_int` and an odd final buffer component is narrowed with `f16_bits` for float/normalized formats. These memory conversions do not use `f16_pack2`: they come from the texture and buffer units, not the VALU whose rounding `MODE.FP_ROUND` sets (#753). Round to nearest even for these conversions is inferred, as in #489, not measured. #489's own narrower, `f32_to_f16_int`, was folded into `f16_bits` on 2026-11-22: the two gave the same bits on 30,648 inputs (every f32 exponent, ties, the subnormal and overflow edges, NaN), and `f16_bits` lost its one GLSL.std.450 instruction (`UMin`) so the packer stays free of them. Checked by `tests/test_translate.py` (`test_depth_compare_sample_result_width`, `test_buffer_format_f16_narrowing_avoids_packhalf2x16`), `tests/test_d16_pack.py` and `tests/semantic/test_buffer_load_format.py` (`D16NormalizedRounding`). | +| d16 and f16 format narrowing | The f16 of every d16 result (image samples and gathers, the `image_sample_c_lz` compare result, typed buffer loads) and of the f16 formats a typed buffer store writes is narrowed with integer round to nearest even (`Gen.f16_bits`; #489, #711), not with `PackHalf2x16`. AMD drivers lower `PackHalf2x16` to `v_cvt_pkrtz_f16_f32`, which rounds toward zero (#489), and there about half of all unorm8, unorm16 and snorm8 values loaded with d16 came out 1 ulp low (123 of 256, 31,742 of 65,536 and 110 of 256). Packed MUBUF and MTBUF loads clamp unsigned 32-bit channels to 65535 before writing each half. On native gfx1036, values 65534 and 65535 survived, while 65536, 65537 and 0xffffffff all produced 0xffff, across all four load widths in wave32 and wave64. Packed `buffer_load_format_d16_x` and `_xyz` write only the low 16 bits of the final VGPR. Its upper half survives even when the load is out of bounds. Native gfx1036 wave32 and wave64 confirmed this with RGBA8_UINT and RGBA8_UNORM, two destination seeds, and both even-component loads as full-write controls. Full pairs are packed by `pack_f16_pair_int` and an odd final buffer component is narrowed with `f16_bits` for float/normalized formats. These memory conversions do not use `f16_pack2`: they come from the texture and buffer units, not the VALU whose rounding `MODE.FP_ROUND` sets (#753). For typed buffer loads the rounding is measured (BUILD-161, `tools/d16_format_probe.py`). On an RX 6700 (gfx1031, AMD Windows driver 32.0.21045.29003), every UNORM8, SNORM8, UNORM10, UNORM16 and SNORM16 value was loaded through `buffer_load_format_d16_x` and `tbuffer_load_format_d16_x`, in wave32 and wave64. The hardware rounds the exact quotient once, straight to f16, to nearest even, with f16 denormals kept (65,536 of 65,536 UNORM16 and SNORM16 values). It does not round to f32 first: that double rounding is 1 ulp high on exactly four values (UNORM16 0xffaf and 0xffef, SNORM16 0x7ff7 and 0x8009). Over every width from 1 to 16 bits, only two f32 quotients land on an f16 halfway point: 0x3f7ff000 (16379/16383, 32759/32767, 65519/65535) and 0x3f7fb000 (65455/65535). `Gen.d16_norm_f16` takes the f16 below for those two, for normalized formats only; a 32_FLOAT 0x3f7ff000 is a real tie and still rounds to even. `buffer_load_format_x` without d16 returned the correctly rounded f32 quotient for all of them, the decode `norm_bits` builds. A 16_FLOAT d16 load returned its own bits for all 65,536 encodings. MUBUF and MTBUF agreed everywhere. For d16 image results, round to nearest even is still inferred, as in #489, not measured. #489's own narrower, `f32_to_f16_int`, was folded into `f16_bits` on 2026-11-22: the two gave the same bits on 30,648 inputs (every f32 exponent, ties, the subnormal and overflow edges, NaN), and `f16_bits` lost its one GLSL.std.450 instruction (`UMin`) so the packer stays free of them. Checked by `tests/test_translate.py` (`test_depth_compare_sample_result_width`, `test_buffer_format_f16_narrowing_avoids_packhalf2x16`), `tests/test_d16_pack.py` and `tests/semantic/test_buffer_load_format.py` (`D16NormalizedRounding`). | | Float-to-int saturation | `v_cvt_u32_f32` and `v_cvt_i32_f32` truncate toward zero, saturate out-of-range values (including infinities) to the destination bounds, and return zero for NaN. The conversion operand is kept in range before emitting SPIR-V `OpConvertFToU`/`OpConvertFToS`. Source: AMD [RDNA 2 ISA reference](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf), §12.8, VOP1 opcodes 7 and 8. The synthetic `cs_cvt_f32_sat.asm` fixture is checked bit-for-bit by `tests/semantic/test_float_to_int.py`. | | `v_cvt_f16_u16`, `v_cvt_f16_i16`, `v_cvt_u16_f16`, `v_cvt_i16_f16` | Conversions of the low 16-bit half (`op_sel:[src,dst]` picks the high half of the source / of the destination in the VOP3 form where supported; GFX10 does not accept `op_sel` on these opcodes); the other half of the destination is kept, like the other 16-bit-result ops (see *16-bit results*). `v_cvt_f16_u16` / `v_cvt_f16_i16` convert the unsigned / sign-extended half and narrow with the usual f16 rounding (65520 and above give +infinity for the unsigned form). `v_cvt_u16_f16` / `v_cvt_i16_f16` truncate toward zero, saturate to [0, 65535] / [-32768, 32767] (an f16 infinity too) and give 0 for NaN, as the 32-bit conversions do (*Float-to-int saturation*). `clamp` and the output multipliers are rejected as `Unsupported` rather than guessed. Source: the AMD [RDNA 2 ISA reference](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf) pseudocode. Checked on the CPU by `tests/semantic/test_alu_cvt_16.py`; **hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137): all four `_e64` forms keep the high half of the destination, `v_cvt_u16/i16_f16` give 0 for ±qNaN and saturate ±inf, and `v_cvt_f16_u16(65520)` gives +inf (`0x7c00`). Not run on the shader corpus. | | `v_frexp_mant_f32`, `v_frexp_exp_i32_f32`, `v_ldexp_f32` | Computed on the binary32 word, with no float arithmetic. A normal input has a biased exponent of 1..254. `v_frexp_mant_f32` returns the input with its exponent set to 126 (a mantissa in [0.5, 1), sign kept); `v_frexp_exp_i32_f32` returns the biased exponent minus 126, so mantissa × 2^exponent is the input. Zero and denormals (read as zero) give a signed zero and exponent 0; infinities and NaNs give the input unchanged and exponent 0. `v_ldexp_f32` is S0 × 2^S1 with S1 a signed integer: S1 is clamped to [-512, 512] and added to the exponent field; a new field above 254 gives ±infinity, one of 0 or below gives ±0 (no denormal results), and zero, infinities and NaNs ignore S1. Neg/abs, `clamp` and the output multipliers apply as for other float ops (not to the integer exponent result). Source: the AMD [RDNA 2 ISA reference](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf) pseudocode for these three opcodes. **Not measured on hardware**: the denormal input and result handling (the f32 denormal mode is not modelled) and the NaN payload are the translator's choice. Checked on the CPU by `tests/semantic/test_alu_frexp_ldexp.py`; not run on the shader corpus. | | `v_mad_u16`, `v_mad_i16` | `D = S0 * S1 + S2` on the low 16-bit halves (VOP3 only). The product and sum are formed in 32 bits, so nothing overflows, and the low 16 bits are the result. `op_sel` bits 0..2 read the high half of a source and bit 3 writes the high half of the destination; like the other opsel-capable 16-bit VOP3 ops the other half of the destination is kept (see *16-bit results*). `clamp` saturates the full-width result to [0, 65535] (`v_mad_u16`) or [-32768, 32767] (`v_mad_i16`). Source: the AMD [RDNA 2 ISA reference](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf) pseudocode and Mesa ACO's `can_use_opsel`. Checked on the CPU by `tests/semantic/test_alu_mad_u16_i16.py`; **hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137): full-width `clamp`, `op_sel` and the untouched destination half match bit-for-bit. Not run on the shader corpus. | | `v_frexp_mant_f16`, `v_frexp_exp_i16_f16`, `v_ldexp_f16` | The binary16 versions of `v_frexp_mant_f32`, `v_frexp_exp_i32_f32` and `v_ldexp_f32`, computed on the f16 word of the low half with no float arithmetic (`op_sel` picks the high half of a source; the last `op_sel` bit sends the result to the high half of the destination; the other half of the destination is kept). A normal input has a biased exponent of 1..30. `v_frexp_mant_f16` returns the input with its exponent set to 14 (a mantissa in [0.5, 1), sign kept); `v_frexp_exp_i16_f16` returns the biased exponent minus 14 as a 16-bit integer, so mantissa × 2^exponent is the input. Zero and denormals (read as zero) give a signed zero and exponent 0; infinities and NaNs give the input unchanged and exponent 0. `v_ldexp_f16` is S0 × 2^S1 with S1 the low 16 bits of the source read as a signed integer: S1 is clamped to [-64, 64] and added to the exponent field; a new field above 30 gives ±infinity, one of 0 or below gives ±0 (no denormal results), and zero, infinities and NaNs ignore S1. Source neg/abs apply to the float operand. `clamp` and the output multipliers are rejected as unsupported rather than guessed. Source: the AMD [RDNA 2 ISA reference](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf) pseudocode for these three opcodes. **Not measured on hardware**: the denormal input and result handling, the NaN payload, and whether `v_frexp_exp_i16_f16` keeps the high half of its destination (it is modelled like the other 16-bit ops here, which keep it) are the translator's choice. Checked on the CPU by `tests/semantic/test_alu_frexp_ldexp_f16.py`; not run on the shader corpus. | | `v_min3_f16`, `v_max3_f16`, `v_min3_i16`, `v_min3_u16`, `v_max3_i16`, `v_max3_u16`, `v_med3_i16`, `v_med3_u16` | Three-operand 16-bit min/max/median (VOP3 only). `op_sel` bits 0..2 read the high half of S0..S2, bit 3 writes the high half of D, and the unwritten half of D is kept (see *16-bit results*). `v_min3_f16` and `v_max3_f16` read each selected f16 half through `Gen.f16_in` (`neg`/`abs` apply to the selected half), fold with `NMin`/`NMax` (so a NaN operand yields the other operand and −0 orders below +0, matching `v_min3_f32`/`v_max3_f32` and `v_med3_f16`), then apply VOP3 `omod`/`clamp` and `Gen.f16_out`. The 16-bit integer ops zero-extend (`u16`) or sign-extend (`i16`) the selected 16-bit halves, evaluate `UMin`/`UMax`/`UClamp` or `SMin`/`SMax`/`SClamp`, and write the low 16 bits into the selected half of D; `clamp` and non-VGPR `op_sel` destinations raise `Unsupported`. Until 2026-11-22 all eight raised `Unsupported`. Source: AMD [RDNA 2 ISA reference](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf) VOP3 opcodes `0x351`–`0x356`, `0x359`–`0x35A`, and Mesa ACO's `can_use_opsel`. **Not GPU-verified.** CPU-checked by `tests/semantic/test_alu_min3_max3_med3_16.py`, `tests/test_f16_op_sel.py`, and `tests/test_f16_op_sel_values.py`. | -| `v_cvt_flr_i32_f32`, `v_cvt_rpi_i32_f32` | RDNA ISA pseudocode: `f32_to_i32(floor(S0))` and `f32_to_i32(floor(S0 + 0.5))`, the `+ 0.5` rounded in binary32 like any f32 add (so 0.49999997 gives 1, where an exact round-half-up would give 0). `f32_to_i32` saturates as in the row above: INT_MAX / INT_MIN at or past ±2³¹ and for ±inf, 0 for NaN. Source neg/abs apply first. Checked on the CPU by `tests/semantic/test_alu_cvt_flr_rpi.py`, **not yet GPU-verified**. | +| `v_cvt_flr_i32_f32`, `v_cvt_rpi_i32_f32` | `sat_i32(floor(S0))` and exact `sat_i32(floor(S0 + 0.5))` (computed via `f = Floor(x); (x - f >= 0.5) ? f + 1 : f`, with no binary32 rounding of `S0 + 0.5`: `0x3effffff` → `0`, `0x4b000001` → `0x00800001`, `0x4b7fffff` → `0x00ffffff`). Out-of-range values (±2³¹ and beyond, ±inf) and NaNs all saturate by the sign bit of the operand (`+NaN` → `0x7FFFFFFF`, `-NaN` → `0x80000000`, unlike `v_cvt_i32_f32` which returns `0` for NaN); the sign is read from `x` before `Floor` so driver NaN canonicalization cannot flip it. Source neg/abs apply first. **Until 2026-11-22 the translator rounded `S0 + 0.5` in binary32 and returned `0` for NaN.** Hardware-verified natively on RDNA2 (AMD Radeon 680M `gfx1035`: 82/82 wave32 and 82/82 wave64 via `tools/hw_oracle`, plus `gfx1036` confirmation in #1746) and CPU-checked by `tests/semantic/test_alu_cvt_flr_rpi.py`. | | `v_cvt_pknorm_i16_f32`, `v_cvt_pknorm_u16_f32` | D[15:0] from S0 and D[31:16] from S1: the f32 is clamped to [-1, 1] (i16) or [0, 1] (u16), multiplied by 32767 or 65535 and rounded to nearest even. Mesa ACO emits these opcodes for NIR `pack_snorm_2x16`/`pack_unorm_2x16`, which `nir_opcodes.py` defines as `fround_even(fclamp(x) * 32767.0 / 65535.0)`. Emitted as `FClamp`, `OpFMul`, `RoundEven` and a convert, not `PackSnorm2x16`, whose rounding GLSL leaves to the driver. NaN gives 0, as `v_cvt_i32_f32` does; that is **not measured on hardware**. Source modifiers apply. `clamp` raises `Unsupported`. Until 2026-11-22 both ops were rejected. CPU-checked by `tests/semantic/test_alu_cvt_pknorm_f32.py` (ties at the scale steps, ±inf, ±NaN, subnormals, out-of-range values, 40 seeded pairs, abs/neg). **Not GPU-verified.** | | f16 rounding (SHADER-55, SHADER-56) | **Narrowing to f16 uses integer ops, not `PackHalf2x16`.** Every f16 ALU result (`v_*_f16` VOP1/VOP2/VOP3, `v_pk_*_f16`, `v_cvt_f16_f32`, `v_interp_p2_f16`, `v_fma_mix*`) and `v_cvt_pkrtz_f16_f32` go through `Gen.f16_bits` (round to nearest even, or round toward zero for pkrtz; f16 denormals kept, f32 denormal inputs give ±0, NaN stays a quiet NaN). After a MODE.FP_ROUND toward-zero write the ALU results take the toward-zero form instead (`Gen.f16_res`; see Known approximations). GLSL.std.450 leaves `PackHalf2x16`'s rounding to the implementation, and drivers fold a `PackHalf2x16` → `UnpackHalf2x16` round trip to a no-op, so the next f16 op saw the unrounded f32: #513 (RTX 6000 Ada, `--wave64-emulate`, `v_pk_add_f16` → `v_pk_mul_f16` 1 ulp off), and pkrtz giving round-to-nearest on llvmpipe. **f16 FMAs round once** (`v_fma_f16`, `v_fmac_f16`, `v_pk_fma_f16`): x·y is exact in f32, TwoSum gives the exact error of the f32 sum, and round-to-odd at f32 then rounds correctly to f16. An RX 6700 matched a correctly rounded f16 FMA in 12,612 of 12,612 cases (#374); `Fma` then narrowing double-rounded. Checked by `tests/semantic/test_f16_int_convert.py` (edges + seeded sweep against Python's binary16), `tests/semantic/test_f16_fma_rounding.py` (exact rational reference; built near-tie cases fail on the old translation) and `tools/valu_fuzz.py --family f16` on an RTX 6000 Ada. Image/buffer d16 packing (#489) and the 16-bit interpolant quantize (#512) are separate. `v_fma_mix*` with f32 sources uses `Fma` then narrows (two roundings) in nearest-even mode, while the hardware rounds once: 7 of 7 tie inputs of `tools/fma_mix_probe.py --oracle hw` on gfx1036 (SHADER-135; not fixed yet); toward zero it rounds once (see Known approximations). | -| `v_cvt_flr_i32_f32`, `v_cvt_rpi_i32_f32` | Currently translated as `f32_to_i32(floor(S0))` and `f32_to_i32(floor(S0 + 0.5))` with the `+ 0.5` rounded in binary32, saturating at ±2³¹ and ±inf and returning 0 for NaN (source neg/abs apply first); checked on the CPU by `tests/semantic/test_alu_cvt_flr_rpi.py`. **Measured on RDNA2 (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137) — two open divergences from the current translation:** (1) `v_cvt_rpi_i32_f32` computes exact `floor(S0 + 0.5)` with no f32 rounding of the add (`0x3effffff` → `0`, `0x4b000001` → `0x00800001`, `0x4b7fffff` → `0x00ffffff`, whereas the translator gives `1`, `0x00800002`, `0x01000000`); (2) both `v_cvt_flr_i32_f32` and `v_cvt_rpi_i32_f32` saturate NaN by its sign bit (`0x7fc00000` → `0x7fffffff`, `0xffc00000` → `0x80000000`), whereas `v_cvt_i32_f32` in the same probe returns `0` for every NaN. | | `v_cvt_pknorm_i16_f32`, `v_cvt_pknorm_u16_f32` | D[15:0] from S0 and D[31:16] from S1: the f32 is clamped to [-1, 1] (i16) or [0, 1] (u16), multiplied by 32767 or 65535 and rounded to nearest even. Mesa ACO emits these opcodes for NIR `pack_snorm_2x16`/`pack_unorm_2x16`, which `nir_opcodes.py` defines as `fround_even(fclamp(x) * 32767.0 / 65535.0)`. Emitted as `FClamp`, `OpFMul`, `RoundEven` and a convert, not `PackSnorm2x16`, whose rounding GLSL leaves to the driver. NaN gives 0, as `v_cvt_i32_f32` does. Source modifiers apply. `clamp` raises `Unsupported`. Until 2026-11-22 both ops were rejected. CPU-checked by `tests/semantic/test_alu_cvt_pknorm_f32.py` (ties at the scale steps, ±inf, ±NaN, subnormals, out-of-range values, 40 seeded pairs, abs/neg). **Hardware-verified on RDNA2** (`gfx1035`, wave32 and wave64 via `tools/int_hw_probe.py --oracle both`, SHADER-137): ±qNaN → 0, ±inf saturation, and round-to-nearest-even ties at ±0.5 match bit-for-bit. | | f16 rounding (SHADER-55, SHADER-56) | **Narrowing to f16 uses integer ops, not `PackHalf2x16`.** Every f16 ALU result (`v_*_f16` VOP1/VOP2/VOP3, `v_pk_*_f16`, `v_cvt_f16_f32`, `v_interp_p2_f16`, `v_fma_mix*`) and `v_cvt_pkrtz_f16_f32` go through `Gen.f16_bits` (round to nearest even, or round toward zero for pkrtz; f16 denormals kept, f32 denormal inputs give ±0, NaN stays a quiet NaN). After a MODE.FP_ROUND toward-zero write the ALU results take the toward-zero form instead (`Gen.f16_res`; see Known approximations). GLSL.std.450 leaves `PackHalf2x16`'s rounding to the implementation, and drivers fold a `PackHalf2x16` → `UnpackHalf2x16` round trip to a no-op, so the next f16 op saw the unrounded f32: #513 (RTX 6000 Ada, `--wave64-emulate`, `v_pk_add_f16` → `v_pk_mul_f16` 1 ulp off), and pkrtz giving round-to-nearest on llvmpipe. **f16 FMAs round once** (`v_fma_f16`, `v_fmac_f16`, `v_pk_fma_f16`): x·y is exact in f32, TwoSum gives the exact error of the f32 sum, and round-to-odd at f32 then rounds correctly to f16. An RX 6700 matched a correctly rounded f16 FMA in 12,612 of 12,612 cases (#374); `Fma` then narrowing double-rounded. Checked by `tests/semantic/test_f16_int_convert.py` (edges + seeded sweep against Python's binary16), `tests/semantic/test_f16_fma_rounding.py` (exact rational reference; built near-tie cases fail on the old translation) and `tools/valu_fuzz.py --family f16` on an RTX 6000 Ada. Image/buffer d16 packing (#489) and the 16-bit interpolant quantize (#512) are separate. `v_fma_mix*` with f32 sources uses `Fma` then narrows (two roundings, unmeasured) in nearest-even mode; toward zero it rounds once (see Known approximations). | | f16 rounding (SHADER-55, SHADER-56) | **Narrowing to f16 uses integer ops, not `PackHalf2x16`.** Every f16 ALU result (`v_*_f16` VOP1/VOP2/VOP3, `v_pk_*_f16`, `v_cvt_f16_f32`, `v_interp_p2_f16`, `v_fma_mix*`) and `v_cvt_pkrtz_f16_f32` go through `Gen.f16_bits` (round to nearest even, or round toward zero for pkrtz; f16 denormals kept, f32 denormal inputs give ±0, NaN stays a quiet NaN). After a MODE.FP_ROUND toward-zero write the ALU results take the toward-zero form instead (`Gen.f16_res`; see Known approximations). GLSL.std.450 leaves `PackHalf2x16`'s rounding to the implementation, and drivers fold a `PackHalf2x16` → `UnpackHalf2x16` round trip to a no-op, so the next f16 op saw the unrounded f32: #513 (RTX 6000 Ada, `--wave64-emulate`, `v_pk_add_f16` → `v_pk_mul_f16` 1 ulp off), and pkrtz giving round-to-nearest on llvmpipe. **f16 FMAs round once** (`v_fma_f16`, `v_fmac_f16`, `v_pk_fma_f16`): x·y is exact in f32, TwoSum gives the exact error of the f32 sum, and round-to-odd at f32 then rounds correctly to f16. An RX 6700 matched a correctly rounded f16 FMA in 12,612 of 12,612 cases (#374); `Fma` then narrowing double-rounded. Checked by `tests/semantic/test_f16_int_convert.py` (edges + seeded sweep against Python's binary16), `tests/semantic/test_f16_fma_rounding.py` (exact rational reference; built near-tie cases fail on the old translation) and `tools/valu_fuzz.py --family f16` on an RTX 6000 Ada. Image/buffer d16 packing (#489) and the 16-bit interpolant quantize (#512) are separate. `v_fma_mix*` rounds once straight to f16 via round-to-odd in both nearest and toward-zero modes (see Known approximations). | @@ -382,18 +370,17 @@ How the generated SPIR-V expects the runtime to work: | `v_fmac_f16`, `v_interp_p2/mov_f32` output modifiers | VOP3 `mul:2`/`mul:4`/`div:2` (applied first) and `clamp` to [0, 1] apply to `v_fmac_f16_e64` (before narrowing to f16, matching `v_fma_f16`, high half preserved) and to `v_interp_p2_f32_e64` / `v_interp_mov_f32_e64` (no-op when no modifier is present). Until 2026-11-22 all three dropped output modifiers. Source: LLVM `llvm/test/MC/AMDGPU/gfx10_asm_vop2.s` (`v_fmac_f16_e64`) and `gfx10_asm_vop3.s` (`v_interp_p2_f32_e64`, `v_interp_mov_f32_e64`). Checked on the CPU by `tests/semantic/test_f16_fma_rounding.py` (`test_fmac_output_modifiers`) and `tests/semantic/test_interp_f32_mods.py`, and on a GPU by `ps_fmac_f16_mods.asm`, `ps_interp_f32_mods.asm` and `ps_interp_mov_mods.asm` (the last two drawn with `vs_interp_consts.asm`, whose params are constant over the triangle; each modifier and the omod-before-clamp order change a word; Tesla V100 (NVIDIA 580.95.05, Linux)). | | 16-bit vector compare `op_sel` (`v_cmp(x)_*_{f16,u16,i16}`) | VOP3 `op_sel:[s0,s1]` selects bit `[15:0]` (`0`) or `[31:16]` (`1`) of each source before f16 input modifiers (`neg`/`abs`, via `Gen.f16_in`) or `u16`/`i16` zero-/sign-extension (`OpBitFieldUExtract`/`OpBitFieldSExtract` at bit offset 16 when set, 0 otherwise); VOPC writes a scalar lane mask (VCC/SGPR or EXEC for `v_cmpx`), so there is no destination `op_sel` bit. Until 2026-11-22 `Gen.compare` hardcoded the low half and ignored `mods`. Source: AMD RDNA2 ISA VOP3 `op_sel` and Mesa ACO `can_use_opsel`. Checked on the CPU by `tests/semantic/test_vcmp16_opsel.py` (all four `op_sel` combinations across `f16` relations/ordered/unordered/NaN/`neg`/`abs`, `u16`, signed `i16`, and `v_cmpx` wave32/wave64 EXEC updates via `spirv_mini_interp` and `spirv_wave_interp`); **not GPU-verified**. | | Known approximations | `v_cvt_pkrtz_f16_f32` is now **exact round-toward-zero** (finite overflow gives ±65504, not inf). The GPU smoke test caught the old round-to-nearest version producing inf in `PS_ImposterShadow`. The other f16 packs (`v_cvt_f16_f32`, d16 results, mix ops) round to nearest, which matches the default mode; the ALU ones follow a MODE toward-zero write (below; ALU sites: see the f16 rounding row). MODE: `s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2)` (f16/f64 rounding) is tracked in a per-invocation variable, the only MODE field the corpus writes (9,417 writes in 6,333 shaders: 6,694 toward zero, 2,723 back to nearest even). While it is toward zero, every VALU f16 result except the transcendentals listed below (`v_cvt_f16_f32`, f16 arithmetic, `v_pk_*_f16`, `v_fma_mix{lo,hi}_f16`, `v_interp_p2_f16`) rounds toward zero exactly, with the integer conversion `v_cvt_pkrtz_f16_f32` uses (`f16_bits(rtz=True)`, see the f16 rounding row), and `v_add_f64` steps back one ulp when the TwoSum error shows it rounded away from zero; finite overflow gives the largest finite value. The `v_add_f64` output modifiers apply after that step and round to nearest, so an omod that overflows or lands on a subnormal is not toward zero. **omod versus denormal mode is unmodelled:** the translator applies `mul:2`/`mul:4`/`div:2` regardless of the MODE denormal fields (as before this change), whereas hardware ignores omod when denormals are kept (denorm fields = 3) and applies it when they are flushed (both measured on an RX 6800: `v_add_f64 (1 - 2^-60) mul:2` with denormals kept gave 3ff00000:00000000 nearest and 3fefffff:ffffffff toward zero, unscaled; mul:2 was applied with denormals flushed); the tests therefore claim no omod order. CPU-checked by `tests/test_mode_round.py` (the RX 6800 words for f16 add/sub, `v_fma_mix`, the transcendentals, f64 overflow). f16 add and sub (f16 operands) and `v_pk_add_f16` take the exact TwoSum error of the f32 result into account, so they are exact toward zero too (f32 then f16 rounding alone would be wrong: 2 - 2^-24 is an f32 tie that rounds up to 2.0); f16 FMAs need nothing extra, since their round-to-odd f32 value (SHADER-55) narrows exactly in either mode. `v_fma_mix{lo,hi}_f16` rounds the exact fma once, straight to f16, in both nearest-even and toward-zero modes (measured on AMD RDNA2 gfx1036 and verified by `tools/fma_mix_probe.py`; finding 7079901079): `Gen.fma_mix_odd` corrects the f32 `Fma` to round-to-odd by the sign of its exact residual (product error by `Fma(x, y, -x*y)`, TwoSum of the sum), which narrows exactly in either direction. `fma_mix_odd` also handles a tiny product (|x*y| < 2^-64: its error underflows or is flushed, so the residual sign is sign(x) xor sign(y), independent of the driver's denormal mode) and an f32 overflow with finite operands (toward zero gives ±FLT_MAX, so f16 ±65504). `v_rcp_f16`, `v_rsq_f16`, `v_sqrt_f16` and `v_sin_f16` ignore the rounding mode on hardware (RX 6800: the same words in every mode), so they always narrow to nearest even; `v_cos_f16`, `v_exp_f16` and `v_log_f16` are unmeasured, assumed like those four and treated the same. The "every VALU f16 result rounds toward zero" sentence above therefore excludes these seven; the f16 results of `v_floor/ceil/trunc/rndne/fract_f16` are exact and need no rounding. The `v_add_f64` step needs f64 denormals preserved (not flushed) by the driver for subnormal sums. Shaders that never write MODE emit the same code as without this. Writes to other MODE bits (f32 rounding, denormals), directed rounding (+inf/-inf) and register-valued writes are refused, so nothing changes silently; none occur in the corpus. Denormal behaviour is still Vulkan's default. Format conversions in memory and texture units don't follow MODE. `v_mul_legacy_f32` now keeps the `0 × anything = 0` rule like `v_mad_legacy_f32` (GPU-checked with `runtime/test/shaders/ps_legacy_mul.asm` on AMD Radeon RX 9070 XT). | +| Known approximations | `v_cvt_pkrtz_f16_f32` is now **exact round-toward-zero** (finite overflow gives ±65504, not inf). The GPU smoke test caught the old round-to-nearest version producing inf in `PS_ImposterShadow`. The other f16 packs (`v_cvt_f16_f32`, d16 results) round to nearest, which matches the default mode. `v_fma_mixlo/mixhi_f16` round the exact `x*y+z` once in every mode (measured on an RDNA2 iGPU, gfx1036, 7 of 7 discriminating tie inputs, SHADER-135); toward zero the translator does that already, while in nearest-even mode it still narrows an f32 `Fma`, which is 1 f16 ulp off on ties until #1774 (SHADER-296) lands; the ALU ones follow a MODE toward-zero write (below; ALU sites: see the f16 rounding row). MODE: `s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2)` (f16/f64 rounding) is tracked in a per-invocation variable, the only MODE field the corpus writes (9,417 writes in 6,333 shaders: 6,694 toward zero, 2,723 back to nearest even). While it is toward zero, every VALU f16 result except the transcendentals listed below (`v_cvt_f16_f32`, f16 arithmetic, `v_pk_*_f16`, `v_fma_mix{lo,hi}_f16`, `v_interp_p2_f16`) rounds toward zero exactly, with the integer conversion `v_cvt_pkrtz_f16_f32` uses (`f16_bits(rtz=True)`, see the f16 rounding row), and `v_add_f64` steps back one ulp when the TwoSum error shows it rounded away from zero; finite overflow gives the largest finite value. The `v_add_f64` output modifiers apply after that step and round to nearest, so an omod that overflows or lands on a subnormal is not toward zero. **omod versus denormal mode is unmodelled:** the translator applies `mul:2`/`mul:4`/`div:2` regardless of the MODE denormal fields (as before this change), whereas hardware ignores omod when denormals are kept (denorm fields = 3) and applies it when they are flushed (both measured on an RX 6800: `v_add_f64 (1 - 2^-60) mul:2` with denormals kept gave 3ff00000:00000000 nearest and 3fefffff:ffffffff toward zero, unscaled; mul:2 was applied with denormals flushed); the tests therefore claim no omod order. CPU-checked by `tests/test_mode_round.py` (the RX 6800 words for f16 add/sub, `v_fma_mix`, the transcendentals, f64 overflow). f16 add and sub (f16 operands) and `v_pk_add_f16` take the exact TwoSum error of the f32 result into account, so they are exact toward zero too (f32 then f16 rounding alone would be wrong: 2 - 2^-24 is an f32 tie that rounds up to 2.0); f16 FMAs need nothing extra, since their round-to-odd f32 value (SHADER-55) narrows exactly in either mode. `v_fma_mix{lo,hi}_f16` rounds the exact fma once, straight to f16, toward zero (an RX 6800 gave 0x3fff for 1 * 2 - 2^-30, where rounding to f32 first and then narrowing gives 0x4000): `Gen.fma_mix_odd` corrects the f32 `Fma` to round-to-odd by the sign of its exact residual (product error by `Fma(x, y, -x*y)`, TwoSum of the sum), which narrows exactly in either direction; the nearest-even path is unchanged (f32 `Fma`, then narrow). `fma_mix_odd` also handles a tiny product (|x*y| < 2^-64: its error underflows or is flushed, so the residual sign is sign(x) xor sign(y), independent of the driver's denormal mode) and an f32 overflow with finite operands (toward zero gives ±FLT_MAX, so f16 ±65504). `v_rcp_f16`, `v_rsq_f16`, `v_sqrt_f16` and `v_sin_f16` ignore the rounding mode on hardware (RX 6800: the same words in every mode), so they always narrow to nearest even; `v_cos_f16`, `v_exp_f16` and `v_log_f16` are unmeasured, assumed like those four and treated the same. The "every VALU f16 result rounds toward zero" sentence above therefore excludes these seven; the f16 results of `v_floor/ceil/trunc/rndne/fract_f16` are exact and need no rounding. Nearest-mode `v_fma_mix*` still rounds twice (f32 `Fma`, then narrow): main's behaviour, unmeasured. `tools/fma_mix_probe.py --oracle hw` measures it on an AMD GPU, with seven inputs where the two rules differ by one f16 ulp (docs/shader_validation.md). The `v_add_f64` step needs f64 denormals preserved (not flushed) by the driver for subnormal sums. Shaders that never write MODE emit the same code as without this. Writes to other MODE bits (f32 rounding, denormals), directed rounding (+inf/-inf) and register-valued writes are refused, so nothing changes silently; none occur in the corpus. Denormal behaviour is still Vulkan's default. Format conversions in memory and texture units don't follow MODE. `v_mul_legacy_f32` now keeps the `0 × anything = 0` rule like `v_mad_legacy_f32` (GPU-checked with `runtime/test/shaders/ps_legacy_mul.asm` on AMD Radeon RX 9070 XT). | +| Known approximations | `v_cvt_pkrtz_f16_f32` is now **exact round-toward-zero** (finite overflow gives ±65504, not inf). The GPU smoke test caught the old round-to-nearest version producing inf in `PS_ImposterShadow`. The other f16 packs (`v_cvt_f16_f32`, d16 results, mix ops) round to nearest, which matches the default mode; the ALU ones follow a MODE toward-zero write (below; ALU sites: see the f16 rounding row). MODE: `s_setreg_imm32_b32 hwreg(HW_REG_MODE, 2, 2)` (f16/f64 rounding) is tracked in a per-invocation variable, the only MODE field the corpus writes (9,417 writes in 6,333 shaders: 6,694 toward zero, 2,723 back to nearest even). While it is toward zero, every VALU f16 result except the transcendentals listed below (`v_cvt_f16_f32`, f16 arithmetic, `v_pk_*_f16`, `v_fma_mix{lo,hi}_f16`, `v_interp_p2_f16`) rounds toward zero exactly, with the integer conversion `v_cvt_pkrtz_f16_f32` uses (`f16_bits(rtz=True)`, see the f16 rounding row), and `v_add_f64` steps back one ulp when the TwoSum error shows it rounded away from zero; finite overflow gives the largest finite value. The `v_add_f64` output modifiers apply after that step and round to nearest, so an omod that overflows or lands on a subnormal is not toward zero. **omod versus denormal mode is unmodelled:** the translator applies `mul:2`/`mul:4`/`div:2` regardless of the MODE denormal fields (as before this change), whereas hardware ignores omod when denormals are kept (denorm fields = 3) and applies it when they are flushed (both measured on an RX 6800: `v_add_f64 (1 - 2^-60) mul:2` with denormals kept gave 3ff00000:00000000 nearest and 3fefffff:ffffffff toward zero, unscaled; mul:2 was applied with denormals flushed); the tests therefore claim no omod order. CPU-checked by `tests/test_mode_round.py` (the RX 6800 words for f16 add/sub, `v_fma_mix`, the transcendentals, f64 overflow). f16 add and sub (f16 operands) and `v_pk_add_f16` take the exact TwoSum error of the f32 result into account, so they are exact toward zero too (f32 then f16 rounding alone would be wrong: 2 - 2^-24 is an f32 tie that rounds up to 2.0); f16 FMAs need nothing extra, since their round-to-odd f32 value (SHADER-55) narrows exactly in either mode. `v_fma_mix{lo,hi}_f16` rounds the exact fma once, straight to f16, toward zero (an RX 6800 gave 0x3fff for 1 * 2 - 2^-30, where rounding to f32 first and then narrowing gives 0x4000): `Gen.fma_mix_odd` corrects the f32 `Fma` to round-to-odd by the sign of its exact residual (product error by `Fma(x, y, -x*y)`, TwoSum of the sum), which narrows exactly in either direction; the nearest-even path is unchanged (f32 `Fma`, then narrow). `fma_mix_odd` also handles a tiny product (|x*y| < 2^-64: its error underflows or is flushed, so the residual sign is sign(x) xor sign(y), independent of the driver's denormal mode) and an f32 overflow with finite operands (toward zero gives ±FLT_MAX, so f16 ±65504). `v_rcp_f16`, `v_rsq_f16`, `v_sqrt_f16` and `v_sin_f16` ignore the rounding mode on hardware (RX 6800: the same words in every mode), so they always narrow to nearest even; `v_cos_f16`, `v_exp_f16` and `v_log_f16` are unmeasured, assumed like those four and treated the same. The "every VALU f16 result rounds toward zero" sentence above therefore excludes these seven; the f16 results of `v_floor/ceil/trunc/rndne/fract_f16` are exact and need no rounding. In nearest mode the translator still rounds `v_fma_mix{lo,hi}_f16` twice (f32 `Fma`, then narrow), but the hardware rounds once there as well: `tools/fma_mix_probe.py --oracle hw` on an RDNA2 iGPU (gfx1036, SHADER-135) gave the single-rounded word for all seven inputs where the two rules differ by one f16 ulp, so the translator is one f16 ulp off on exactly those ties (docs/shader_validation.md, "`v_fma_mix*` f16 rounding in nearest mode"; the fix is `Gen.fma_mix_odd` in nearest mode too, SHADER-296). The `v_add_f64` step needs f64 denormals preserved (not flushed) by the driver for subnormal sums. Shaders that never write MODE emit the same code as without this. Writes to other MODE bits (f32 rounding, denormals), directed rounding (+inf/-inf) and register-valued writes are refused, so nothing changes silently; none occur in the corpus. Denormal behaviour is still Vulkan's default. Format conversions in memory and texture units don't follow MODE. `v_mul_legacy_f32` now keeps the `0 × anything = 0` rule like `v_mad_legacy_f32` (GPU-checked with `runtime/test/shaders/ps_legacy_mul.asm` on AMD Radeon RX 9070 XT). | | Denormal flush in `v_mad_f32`, `v_mac_f32`, `v_mad_legacy_f32` (SHADER-118) | The three have no f32 denormal support: a subnormal operand, the rounded product or the result reads as signed zero, whatever the MODE register says. `Gen.flush_f32` emits `|x| < FLT_MIN → copysign(0, x)` on the three operands, after the product rounding and after `omod`/`clamp`; inf and NaN compare false and pass through, and 0 keeps its sign. Source: LLVM AMDGPU `SIISelLowering.cpp`, `SITargetLowering::isFMADLegal` (llvm-project `1922c0c`), which forms `v_mad_f32`/`v_mac_f32` only when f32 denormals are flushed. Corpus count with `tools/shader_profile.py` over the 26,503 gfx1013 shaders: `v_mad_f32` in 7,298 shaders (139,287 occurrences), `v_mac_f32` in 5,889 (276,806: 265,901 `_e32`, 10,811 `_e64`, 94 `_dpp`), `v_mad_legacy_f32` in 6,059 (24,765); 9,297 shaders (35.1%) use at least one, 440,858 occurrences (0.99% of the corpus's 44,406,870 instructions). Checked on the CPU by `tests/semantic/test_valu_f32_min3_max3_mad.py` (`DenormalFlushTests`: the flush column, NaN/inf/zero pass-through, and a sabotaged pass-through that fails); **not GPU-verified** — a native measurement still needs an RDNA1/RDNA2 part that has these opcodes. The `omod` order is an assumption: the flush runs after `div:2`/`mul:2`/`mul:4`, so `FLT_MIN div:2` is flushed, as pinned by that test. | | `v_mac_legacy_f32` | The GFX10.1 VOP2 form of `v_mad_legacy_f32` with D as the addend: D = legacy(S0 * S1) + D, where 0 times anything (inf and NaN included) is +0, with the same denormal flush and VOP3 modifiers. D is read before it is written, as for `v_mac_f32` (LLVM `VOP2Instructions.td`: `V_MAC_LEGACY_F32` has `$src2` tied to `$vdst`). Until 2026-11-22 it raised `Unsupported`. CPU-checked by `MacLegacyF32Tests` in `tests/semantic/test_valu_f32_min3_max3_mad.py` (a 15x8x6 grid against the `v_mad_legacy_f32` reference, the zero rule, clamp/neg, D aliased as a source). **Not GPU-verified**: like the other mad opcodes it exists on gfx1010-1013 only, so no RDNA2 desktop part runs it. | | Whole-quad mode (`s_wqm_b64` / `s_wqm_b32`) | A lane mask register holds only this lane's bit, so WQM on one (EXEC, VCC, an SGPR the mask analysis found) ORs the bit of the lane's quad, lanes 4n..4n+3 of the wave: two `OpGroupNonUniformQuadSwap` (horizontal, then vertical; capability `GroupNonUniformQuad`) in the default mode in fragment and compute shaders (quad operations are only guaranteed there; vertex, geometry and mesh shaders shuffle from the quad's four lanes), or the four lanes' values read through `%x_buf` under `--wave64-emulate` (no subgroup operation there). A quad never crosses lane 31/32, so the mask bits are exact per half on a 32-wide subgroup; SCC is a wave vote, so on wave64 it needs a 64-wide subgroup or `--wave64-emulate` (as every wave-wide mask op). The result goes to EXEC, VCC or an SGPR pair as a mask, SCC = the wave-wide any of it (same vote as the other mask ops). A 32-bit form in wave64 (`exec_lo`/`exec_hi`, `vcc_lo`/`vcc_hi`, a half-mask SGPR) writes only its own half (`exec_half_write`) and votes SCC over that half only (`cs_wqm_w64_half`). A source that is not a lane mask (a value loaded from memory, a literal) is data: `((x | x>>1 | x>>2 | x>>3) & 0x11111111) * 15` per 32-bit word and SCC = result != 0, no subgroup operation. Assumptions: in compute and mesh shaders the subgroup lane is `LocalInvocationIndex` mod the subgroup size (as for every cross-lane op); a hardware quad is four consecutive lanes of a wave, and in a pixel shader Vulkan's quad (the 2x2 pixels, helper invocations included) is the same four lanes; GPU-checked on both AMD and NVIDIA with `ps_wqm.asm` (every 2x2 block of a 64x64 target, fully covered). Not covered: helper-invocation behaviour at triangle edges is untested, and in native mode an absent invocation in a partial quad (a compute group whose size is not a multiple of 4) gives an undefined value (emulated, the missing lanes of a partial wave read as 0). Before this the instruction was the identity, so helper lanes stayed off (#156 SHADER-34: `s_wqm_b64` appears in 4,285 pixel shaders). GPU-checked with `runtime/test/shaders/cs_wqm_w64.asm`, `cs_wqm_w64_half.asm`, `cs_wqm_w32.asm` and `ps_wqm.asm` on AMD Radeon 880M (subgroup 64) and NVIDIA GeForce RTX 5070 Laptop (subgroup 32; `cs_wqm_w64` there needs `LEONIDA_W64_EMULATE=1`), with and without `--wave64-emulate`. | -| Buffer bounds checking | MUBUF `buffer_load*`, `buffer_store*`, and `buffer_atomic*` enforce `num_records` (V# word 2). Out-of-bounds stores/atomics skip memory access completely and out-of-bounds loads return 0 without a load. **The RX 6800 measurement behind RAW loads** (`buffer_load_dword`/`x2`/`x3`/`x4`, stride 0, no `idxen`, OOB_SELECT 3; the per-mode rule below covers every mode, stride and `idxen`): the byte offset O = inst_offset + soffset + (offen ? vaddr : 0) is exact (nothing truncated, and the address keeps base & 3), and dword i is data when O + 4·i + 4 ≤ num_records, else 0, measured on AMD Radeon RX 6800 (gfx1030, Windows driver 32.0.21045.29003) by running the instructions as a raw compute kernel, wave32 and wave64 (155 runs, every result either 0 or the stored data, wave32 = wave64 in every dword), for x1/x2/x4 with V# word3 0x31016fac (OOB_SELECT 3) at offsets 0..63 per lane, NUM_RECORDS 17..23 and 0x1000, base & 3 = 0 and 3: a dword at 0xf with NUM_RECORDS 18 is 0 (a start-only check reads it); x4 at 3 with 18 gives three data dwords and 0 for the fourth, which starts at 15 < 18 (so neither a whole-load nor a per-dword start check), and the zero is a whole 0, not partial bytes; x4 at offset:13 with 20 gives data, 0, 0, 0; inst_offset, soffset and offen are summed before the check; base & 3 = 3 flips at the same offsets. `x3` gets the rule without a measurement. **Per-mode check (V# OOB_SELECT, word3 bits [29:28])**, for every MUBUF/MTBUF access, as measured natively on RDNA2 (gfx1036, 732 cases, `docs/buffer_bounds.md`; Mesa's GFX11 column, not its GFX10 one). `idx` = `vindex` (0 without `idxen`), `off` = inst_offset + vaddr offset (offen), `offs` = `off` + soffset. A dword at byte 4·k of the access is out of range when: **0 STRUCTURED_WITH_OFFSET** `idx >= num_records` or `off + 4k + 4 > stride`; **1 STRUCTURED** `idx >= num_records` (no `idxen`: idx 0, so only `num_records == 0`); **2 DISABLED** `num_records == 0`; **3 RAW** `offs + 4k + 4 > num_records` (`idx * stride` is in the address, not in the check). A literal word3 (`s_mov_b32` earlier in the block) folds the mode, a run-time one selects with `OpSelect`. Multi-dword accesses, measured on the Radeon 880M (gfx1150, a valid proxy: gfx1036 follows the same column and gfx1150 matched it bit-exactly): in modes 0 and 3 **`buffer_load_dwordx2..x4` and `buffer_store_dwordx2..x4` are per dword**, for loads and stores alike (x4 at off 20 of 32 in RAW loads/stores 3 dwords, at 28 one, at 32 none; mode 0 likewise at the stride); modes 1 and 2 check once and always take the whole access. **A typed element (`buffer_load_format_*`, `buffer_store_format_*`) is all or nothing and ends at its format's size** (32_32_32_32 at off 20 of 32 reads or writes nothing), and an atomic checks its dword's end like a dword access. The translator does the same: per-dword guarded loads and stores for modes 0 and 3 (a store that straddled the edge used to write past it), the element size from the instruction's format, a literal word3 or the V#. The same oracle confirmed the terms (504 `buffer_load_dword` probes, idxen/offen/inst_offset/soffset at the stride and record edges, 0 disagreements): mode 0's `off` has `inst_offset` and no soffset, mode 1 reads nothing but the index, mode 3 adds inst_offset and soffset. `s_buffer_load` (SMEM) is separate: it keeps the `num_records` bound of the Scalar/buffer row and ignores OOB_SELECT (the same pattern for 0 to 3). **Swizzle**: SWIZZLE_ENABLE (V# word1 bit 31, Mesa `gfx10-rsrc.json` line 326; word1 [31:30] on GFX11, `gfx11-rsrc.json` line 259) and ADD_TID_ENABLE (word3 bit 23, line 337) change the address and the bounds in every mode and are not modelled: a literal V# with either set is `Unsupported`, a run-time V# with them is translated unswizzled, which is silently wrong (known gap). Until 2026-11-22 the translator ignored OOB_SELECT and checked by stride alone (`offset < num_records`, `index < num_records`, or `offset < num_records * stride`): a V# with word3 = 0 (mode 0, stride 0) was fully readable and is now always out of range, as on hardware, so the test harnesses' output V# is `0x31016fac` now (`vk_compute_test`, the interpreter tests, `cs_bounds.asm`, `cs_fmt_1010102.asm`, `cs_store.asm`). **How confirmed**: the native RDNA2 measurement (gfx1036) and the gfx1150 oracle (RDNA3.5, same column); GPU test `cs_oob_select.asm` (every mode, literal and run-time V#, words derived from the rules) on an NVIDIA RTX 5070 and an AMD Radeon 880M, which checks the translation, not RDNA2; `tests/semantic/test_buffer_oob_select.py` (a hand-written table of 33 cases over the four modes, loads and stores, both V# forms, plus the multi-dword stores and typed elements); `cs_oob_tail.asm` pins the end-based edge, per-dword x4 loads and stores and the all-or-nothing element, where Mesa's GFX10 column gives other words. **Unmeasured**: gfx1013/GFX10.1 itself (see `docs/buffer_bounds.md`), swizzle, unaligned addresses, and the mode 1/2 boundary of `buffer_load_dwordx2..x4` on RDNA2 hardware proper (the gfx1150 proxy shows all dwords in). Checked by `tests/semantic/test_value_semantics.py` (`RawBufferTailBounds`: the RX 6800 rows, values and the addresses loaded) and the GPU tests `runtime/test/shaders/cs_bounds.asm` (AMD Radeon RX 9070 XT, RX 6800), `cs_buf_tail.asm` (RX 6800, Vulkan, driver 26.11.2; aligned offsets only, since the translator's `Aligned 4` loads at byte-exact addresses were not checked on a Vulkan driver) `cs_oob_select.asm` and `cs_oob_tail.asm`. `cs_fmt_xy_xyz.asm` shows the whole element deciding for `_xy` and `_xyz` too, measured natively on a Radeon 680M (gfx1035, RDNA2): components that end inside num_records, in an element that doesn't, read 0 and store nothing. | | `buffer_atomic_{and,or,xor,swap}_x2` | `M = op(M, DATA)` on the 64-bit element at the MUBUF address (two dwords, low first); with `glc` the old 64 bits are returned in `vdata[0:1]`. A bitwise op or an exchange leaves the same memory done one dword at a time, so each dword is its own 32-bit `OpAtomic*` and no Int64 atomics are needed. **Approximation:** the returned pair comes from two reads, so another lane's 64-bit op on the same element between them can show up half done. **Bounds:** the check covers the whole 8-byte element, all or nothing, as for a typed 32_32 element (`buffer_address(elem="fmt")`). An out-of-range or inactive lane leaves memory alone and returns 0, as `buffer_atomic` does. How hardware treats a 64-bit atomic that is only partly in range is **not measured**. Still `Unsupported`: `add/sub/min/max_x2` and `cmpswap_x2`. Until 2026-11-22 every `_x2` buffer atomic was rejected. CPU-checked by `tests/semantic/test_buffer_atomics_x2.py` (the four ops with and without `glc`, an element ending exactly at `num_records`, half and fully out of range, seeded values, rejected forms). **Not GPU-verified.** | -| Wave64 graphics: partition invariance (SHADER-10) | A wave64 VS/PS/GS on a 32-wide subgroup is exact **iff its observable results do not change when the wave is cut into two 32-lane halves** (the host forms the subgroups of graphics stages, so there is no partner half to exchange with). `tools/wave64_halves.py` decides it from the code (forward taint dataflow over the basic blocks, plus control dependence on wave-wide votes) and the translator records it in `index.json` as `wave64_graphics` (`A`/`B`/`C`), `wave64_graphics_reasons` (tier C) and `wave64_graphics_idioms` (tier B). **A**: only per-lane arithmetic, votes that skip lane-masked work (`s_cbranch_execz/execnz`; `vccz/vccnz` whose run side starts by narrowing EXEC to that VCC and whose other side is the join, with no code of its own: a half that votes no runs that side, the wave does not; the same holds for `s_cbranch_execz/execnz`: the side that runs when EXEC is zero is taken by a half with no active lane, so it must be the join (or only jumps to it) or the exit of a loop the vote closes, else tier C `unsafe-execz-branch`; `s_cbranch_scc*` after a vote is the same kind of skip, any other reader of that SCC, `s_cselect`/`s_cmov`/`s_addc`, is tier C), whole-quad masks, `ds_bpermute`/`v_permlane16` (they stay inside a half, not GPU-tested here: no fixture; `ds_swizzle` and `v_permlanex16` likewise), loops closed by `execnz` with no scalar state carried. **B**: also a waterfall loop (`v_readfirstlane` of a varying value, `v_cmp_eq` against the same VGPR, `saveexec`, body, `s_xor exec`, `execnz`; the scalar only used inside the body), a wave-aggregated atomic (`s_bcnt1` of EXEC, `v_mbcnt` rank of that same EXEC, one `buffer_atomic_add` of that count (the count of the mask the rank ranks) by the rank-0 lane only, `v_readfirstlane` of the result with EXEC restored, base + rank as a store address, the rank counting the very mask the atomic's count was taken of (a rank of the entry EXEC or of a saved copy next to a base of the narrowed one is tier C `lane-rank`); the rank alone or the base alone is not a slot: exact as a set of slots, **the order of the slots within a wave is not preserved**, a 64-lane wave takes one run of slots, two halves take two), `v_readfirstlane` / `v_readlane` of a VGPR written from scalars and constants while EXEC was the launch mask (the same in every lane), a `v_writelane` / `v_readlane` spill pair on one constant lane below 32. **C**: anything else that reaches an export, a store's data, a branch or EXEC: lane count / rank / first-lane index / raw lane id (`v_mbcnt` of -1), `v_readlane` of a varying value at any lane (on a wave64 every lane gets hardware lane N, in halves each half gets its own lane N, so lane 7 is as wrong as lane 40; the research note's row 9 is too generous here); an analysis failure is tier C with reason `analysis-error` (the translation does not fail), `v_writelane` to a non-constant or >= 32 lane, a 32-bit access to half of a lane mask (`exec_hi`, `vcc_hi`, a mask pair's odd register), a mask read as data (including a mask combined by `s_and/or/andn2_b64` with a register that is not one: a user value, a loaded mask), a scalar defined behind a wave-wide vote and read where it may not have run (`s_add s5, s5, 1` after `s_cbranch_vccz`; a trip count in an SGPR of a divergent loop: the halves vote differently), a branch on a count, an elected-lane side effect that is not a count, `ds_append`/`ds_consume`. The check is conservative: unknown means C. `--wave64-graphics=warn` (default) marks tier C and counts it in the summary line, `error` refuses it (`Unsupported`), `off` skips the analysis; `python tools/wave64_halves.py --census /index.json` prints tier, reason and idiom counts (no names); it complements `tools/wave64_graphics_scan.py` (#1132), which counts candidate cross-half opcodes in the disassembly before translation and decides nothing. **Corpus coverage is not measured here**: it needs a run over the game's shaders by someone who has them. **Rewrite (the only one the emission needs)**: `v_readlane_b32` of a proven-uniform VGPR reads the lane's own copy instead of shuffling from lane N, because a subgroup shuffle from lane >= 32 of a 32-wide subgroup is undefined (143 of 144 test shaders translate byte-identically to origin/main, only `ps_w64_b_readlane_uniform` changed). Everything else tier B needs is what the translator already emits per subgroup: the ballot/count/rank/first-lane words of `wave_mask` are the subgroup's own (the high word is 0), `v_readfirstlane` is the subgroup's first active lane, a waterfall runs once per distinct value of the subgroup. GPU-checked on AMD Radeon 880M (driver 26.11.2; `requiredSubgroupSizeStages` has FRAGMENT, size 32..64) with `runtime/test/shaders/w64_graphics.py`: each `ps_w64_*` fixture drawn with the fragment subgroup size required to 64 (one hardware wave) and to 32 (two halves). `ps_w64_a_skip`, `_b_waterfall`, `_b_readfirstlane`, `_b_readlane_uniform` and `_b_ballot_atomic` (counter 1024 and the 1024 slot words as a set; slot order differs) match each other and the words their headers derive; `_c_bcnt_export`, `_c_lane_id`, `_c_readlane`, `_c_vote_stale`, `_c_vote_else`, `_c_scc_vote`, `_c_execz_sgpr` (an SGPR written on the exec-zero side and exported) and `_c_waterfall_count` differ between 64 and 32 (the detector is right). `ps_w64_a_one_lane` is the case where only one pixel votes yes (so one half votes and the other does not, in the wave and in the halves): its skip regions (`execz`, `vccz`, `vccnz` with a jump-only fall-through) give equal images at 64 and 32; `_c_vote_else` (code on the vote's no side) and `_c_scc_vote` (SCC of a vote as data) differ. NVIDIA GeForce RTX 5070 Laptop (32 only, driver 617.42): tier A/B fixtures equal the derived words and the 880M@64 images (`W64G_SAVE_REF` / `W64G_REF`), tier C fixtures differ from the 880M@64 images. Vertex shaders: the VS stage cannot be forced on the 880M (no VERTEX in `requiredSubgroupSizeStages`), so VS is covered by the strict wave interpreter (`tests/semantic/test_wave64_halves.py`: 64 lanes against two waves of 32; tier A/B equal, tier C differs); geometry shaders are not tested (the corpus ones are wave32; no fixture). Not checked: helper lanes of partial quads; `VK_KHR_shader_maximal_reconvergence` is assumed for waterfall and election loops. | +| Wave64 graphics: partition invariance (SHADER-10) | A wave64 VS/PS/GS on a 32-wide subgroup is exact **iff its observable results do not change when the wave is cut into two 32-lane halves** (the host forms the subgroups of graphics stages, so there is no partner half to exchange with). `tools/wave64_halves.py` decides it from the code (forward taint dataflow over the basic blocks, plus control dependence on wave-wide votes) and the translator records it in `index.json` as `wave64_graphics` (`A`/`B`/`C`), `wave64_graphics_reasons` (tier C) and `wave64_graphics_idioms` (tier B). **A**: only per-lane arithmetic, votes that skip lane-masked work (`s_cbranch_execz/execnz`; `vccz/vccnz` whose run side starts by narrowing EXEC to that VCC and whose other side is the join, with no code of its own: a half that votes no runs that side, the wave does not; the same holds for `s_cbranch_execz/execnz`: the side that runs when EXEC is zero is taken by a half with no active lane, so it must be the join (or only jumps to it) or the exit of a loop the vote closes, else tier C `unsafe-execz-branch`; `s_cbranch_scc*` after a vote is the same kind of skip, any other reader of that SCC, `s_cselect`/`s_cmov`/`s_addc`, is tier C), whole-quad masks, `ds_bpermute`/`v_permlane16` (they stay inside a half, not GPU-tested here: no fixture; `ds_swizzle` and `v_permlanex16` likewise), loops closed by `execnz` with no scalar state carried. **B**: also a waterfall loop (`v_readfirstlane` of a varying value, `v_cmp_eq` against the same VGPR, `saveexec`, body, `s_xor exec`, `execnz`; the scalar only used inside the body), a wave-aggregated atomic (`s_bcnt1` of EXEC, `v_mbcnt` rank of that same EXEC, one `buffer_atomic_add` of that count (the count of the mask the rank ranks) by the rank-0 lane only, `v_readfirstlane` of the result with EXEC restored, base + rank as a store address, the rank counting the very mask the atomic's count was taken of (a rank of the entry EXEC or of a saved copy next to a base of the narrowed one is tier C `lane-rank`); the rank alone or the base alone is not a slot: exact as a set of slots, **the order of the slots within a wave is not preserved**, a 64-lane wave takes one run of slots, two halves take two), `v_readfirstlane` / `v_readlane` of a VGPR written from scalars and constants while EXEC was the launch mask (the same in every lane), a `v_writelane` / `v_readlane` spill pair on one constant lane below 32. **C**: anything else that reaches an export, a store's data, a branch or EXEC: lane count / rank / first-lane index / raw lane id (`v_mbcnt` of -1), `v_readlane` of a varying value at any lane (on a wave64 every lane gets hardware lane N, in halves each half gets its own lane N, so lane 7 is as wrong as lane 40; the research note's row 9 is too generous here); an analysis failure is tier C with reason `analysis-error` (the translation does not fail), `v_writelane` to a non-constant or >= 32 lane, a 32-bit access to half of a lane mask (`exec_hi`, `vcc_hi`, a mask pair's odd register), a mask read as data (including a mask combined by `s_and/or/andn2_b64` with a register that is not one: a user value, a loaded mask), a scalar defined behind a wave-wide vote and read where it may not have run (`s_add s5, s5, 1` after `s_cbranch_vccz`; a trip count in an SGPR of a divergent loop: the halves vote differently), a branch on a count, an elected-lane side effect that is not a count, `ds_append`/`ds_consume`. The check is conservative: unknown means C. `--wave64-graphics=warn` (default) marks tier C and counts it in the summary line, `error` refuses it (`Unsupported`), `off` skips the analysis; `python tools/wave64_halves.py --census /index.json` prints tier, reason and idiom counts (no names); it complements `tools/wave64_graphics_scan.py` (#1132), which counts candidate cross-half opcodes in the disassembly before translation and decides nothing. **Corpus coverage is not measured here**: it needs a run over the game's shaders by someone who has them. **Rewrite (the only one the emission needs)**: `v_readlane_b32` of a proven-uniform VGPR reads the lane's own copy instead of shuffling from lane N, because a subgroup shuffle from lane >= 32 of a 32-wide subgroup is undefined (143 of 144 test shaders translate byte-identically to origin/main, only `ps_w64_b_readlane_uniform` changed). Everything else tier B needs is what the translator already emits per subgroup: the ballot/count/rank/first-lane words of `wave_mask` are the subgroup's own (the high word is 0), `v_readfirstlane` is the subgroup's first active lane, a waterfall runs once per distinct value of the subgroup. GPU-checked on AMD Radeon 880M (driver 26.11.2; `requiredSubgroupSizeStages` has FRAGMENT, size 32..64) with `runtime/test/shaders/w64_graphics.py`: each `ps_w64_*` fixture drawn with the fragment subgroup size required to 64 (one hardware wave) and to 32 (two halves). `ps_w64_a_skip`, `_b_waterfall`, `_b_readfirstlane`, `_b_readlane_uniform` and `_b_ballot_atomic` (counter 1024 and the 1024 slot words as a set; slot order differs) match each other and the words their headers derive; `_c_bcnt_export`, `_c_lane_id`, `_c_readlane`, `_c_vote_stale`, `_c_vote_else`, `_c_scc_vote`, `_c_execz_sgpr` (an SGPR written on the exec-zero side and exported) and `_c_waterfall_count` differ between 64 and 32 (the detector is right). `ps_w64_a_one_lane` is the case where only one pixel votes yes (so one half votes and the other does not, in the wave and in the halves): its skip regions (`execz`, `vccz`, `vccnz` with a jump-only fall-through) give equal images at 64 and 32; `_c_vote_else` (code on the vote's no side) and `_c_scc_vote` (SCC of a vote as data) differ. NVIDIA GeForce RTX 5070 Laptop (32 only, driver 617.42): tier A/B fixtures equal the derived words and the 880M@64 images (`W64G_SAVE_REF` / `W64G_REF`), tier C fixtures differ from the 880M@64 images. Vertex shaders: the VS stage cannot be forced on the 880M (no VERTEX in `requiredSubgroupSizeStages`), so VS is covered by the strict wave interpreter (`tests/semantic/test_wave64_halves.py`: 64 lanes against two waves of 32; tier A/B equal, tier C differs), and on RADV also on the GPU (TEST-251): RADV runs the VS stage (NGG) as wave64 by default and as wave32 with `RADV_PERFTEST=gewave32` (GFX10+, seen in the `RADV_DEBUG=shaders` dump: 64-bit EXEC operations against `exec_lo`), so `w64_graphics.py` draws each `vs_w64_*` fixture both ways, 960 zero-area vertices (`VKH_VERTICES`) that store four words each to the heap, with `vs_w64_c_lane_id` as the probe that the wave size changed (largest lane id 63, then 31). RADV packs 62 or 64 vertices into a wave64 and 30 or 32 into a wave32, so the 32-lane run repacks the vertices rather than halving the waves; tier A/B words are keyed on the vertex index, which makes this the stricter test. `vs_w64_a_skip`, `_b_waterfall`, `_b_readlane_uniform` (readfirstlane and readlane 40/63 of uniform VGPRs) and `_b_ballot_atomic` (240 slots as a set) give the derived words at both sizes; `_c_bcnt_export`, `_c_readlane` and `_c_lane_id` differ (the detector is right), on an RX 9070 XT (GFX1201) and a Ryzen 9800X3D iGPU (GFX1036, RDNA2), RADV Mesa 26.3.1; geometry shaders are not tested (the corpus ones are wave32; no fixture). Not checked: helper lanes of partial quads; `VK_KHR_shader_maximal_reconvergence` is assumed for waterfall and election loops. | | Buffer bounds checking | MUBUF `buffer_load*`, `buffer_store*`, and `buffer_atomic*` enforce `num_records` (V# word 2). Out-of-bounds stores/atomics skip memory access completely and out-of-bounds loads return 0 without a load. **The RX 6800 measurement behind RAW loads** (`buffer_load_dword`/`x2`/`x3`/`x4`, stride 0, no `idxen`, OOB_SELECT 3; the per-mode rule below covers every mode, stride and `idxen`): the byte offset O = inst_offset + soffset + (offen ? vaddr : 0) is exact (nothing truncated, and the address keeps base & 3), and dword i is data when O + 4·i + 4 ≤ num_records, else 0, measured on AMD Radeon RX 6800 (gfx1030, Windows driver 32.0.21045.29003) by running the instructions as a raw compute kernel, wave32 and wave64 (155 runs, every result either 0 or the stored data, wave32 = wave64 in every dword), for x1/x2/x4 with V# word3 0x31016fac (OOB_SELECT 3) at offsets 0..63 per lane, NUM_RECORDS 17..23 and 0x1000, base & 3 = 0 and 3: a dword at 0xf with NUM_RECORDS 18 is 0 (a start-only check reads it); x4 at 3 with 18 gives three data dwords and 0 for the fourth, which starts at 15 < 18 (so neither a whole-load nor a per-dword start check), and the zero is a whole 0, not partial bytes; x4 at offset:13 with 20 gives data, 0, 0, 0; inst_offset, soffset and offen are summed before the check; base & 3 = 3 flips at the same offsets. `x3` gets the rule without a measurement. **Per-mode check (V# OOB_SELECT, word3 bits [29:28])**, for every MUBUF/MTBUF access, as measured natively on RDNA2 (gfx1036, 732 cases, `docs/buffer_bounds.md`; Mesa's GFX11 column, not its GFX10 one). `idx` = `vindex` (0 without `idxen`), `off` = inst_offset + vaddr offset (offen), `offs` = `off` + soffset. A dword at byte 4·k of the access is out of range when: **0 STRUCTURED_WITH_OFFSET** `idx >= num_records` or `off + 4k + 4 > stride`; **1 STRUCTURED** `idx >= num_records` (no `idxen`: idx 0, so only `num_records == 0`); **2 DISABLED** `num_records == 0`; **3 RAW** `offs + 4k + 4 > num_records` (`idx * stride` is in the address, not in the check). A literal word3 (`s_mov_b32` earlier in the block) folds the mode, a run-time one selects with `OpSelect`. Multi-dword accesses, measured on the Radeon 880M (gfx1150, a valid proxy: gfx1036 follows the same column and gfx1150 matched it bit-exactly): in modes 0 and 3 **`buffer_load_dwordx2..x4` and `buffer_store_dwordx2..x4` are per dword**, for loads and stores alike (x4 at off 20 of 32 in RAW loads/stores 3 dwords, at 28 one, at 32 none; mode 0 likewise at the stride); modes 1 and 2 check once and always take the whole access. **A typed element (`buffer_load_format_*`, `buffer_store_format_*`) is all or nothing and ends at its format's size** (32_32_32_32 at off 20 of 32 reads or writes nothing), and an atomic checks its dword's end like a dword access. The translator does the same: per-dword guarded loads and stores for modes 0 and 3 (a store that straddled the edge used to write past it), the element size from the instruction's format, a literal word3 or the V#. The same oracle confirmed the terms (504 `buffer_load_dword` probes, idxen/offen/inst_offset/soffset at the stride and record edges, 0 disagreements): mode 0's `off` has `inst_offset` and no soffset, mode 1 reads nothing but the index, mode 3 adds inst_offset and soffset. `s_buffer_load` (SMEM) is separate: it keeps the `num_records` bound of the Scalar/buffer row and ignores OOB_SELECT (the same pattern for 0 to 3). **Swizzle**: SWIZZLE_ENABLE and ADD_TID_ENABLE are modelled; see the Swizzled buffer addressing row. Until 2026-11-22 the translator ignored OOB_SELECT and checked by stride alone (`offset < num_records`, `index < num_records`, or `offset < num_records * stride`): a V# with word3 = 0 (mode 0, stride 0) was fully readable and is now always out of range, as on hardware, so the test harnesses' output V# is `0x31016fac` now (`vk_compute_test`, the interpreter tests, `cs_bounds.asm`, `cs_fmt_1010102.asm`, `cs_store.asm`). **How confirmed**: the native RDNA2 measurement (gfx1036) and the gfx1150 oracle (RDNA3.5, same column); GPU test `cs_oob_select.asm` (every mode, literal and run-time V#, words derived from the rules) on an NVIDIA RTX 5070 and an AMD Radeon 880M, which checks the translation, not RDNA2; `tests/semantic/test_buffer_oob_select.py` (a hand-written table of 33 cases over the four modes, loads and stores, both V# forms, plus the multi-dword stores and typed elements); `cs_oob_tail.asm` pins the end-based edge, per-dword x4 loads and stores and the all-or-nothing element, where Mesa's GFX10 column gives other words. **Unmeasured**: gfx1013/GFX10.1 itself (see `docs/buffer_bounds.md`), unaligned addresses, and the mode 1/2 boundary of `buffer_load_dwordx2..x4` on RDNA2 hardware proper (the gfx1150 proxy shows all dwords in). Checked by `tests/semantic/test_value_semantics.py` (`RawBufferTailBounds`: the RX 6800 rows, values and the addresses loaded) and the GPU tests `runtime/test/shaders/cs_bounds.asm` (AMD Radeon RX 9070 XT, RX 6800), `cs_buf_tail.asm` (RX 6800, Vulkan, driver 26.11.2; aligned offsets only, since the translator's `Aligned 4` loads at byte-exact addresses were not checked on a Vulkan driver) `cs_oob_select.asm` and `cs_oob_tail.asm`. `cs_fmt_xy_xyz.asm` shows the whole element deciding for `_xy` and `_xyz` too, measured natively on a Radeon 680M (gfx1035, RDNA2): components that end inside num_records, in an element that doesn't, read 0 and store nothing. | | Swizzled buffer addressing (V# SWIZZLE_ENABLE, ADD_TID_ENABLE) | MUBUF/MTBUF `buffer_load*`, `buffer_store*`, `buffer_atomic*`, `buffer_load_format_*`/`buffer_store_format_*` and `tbuffer_load_format_*` follow the RDNA2 ISA ("RDNA 2" Instruction Set Architecture, 8.1.5 Buffer Addressing, "Swizzled Buffer Addressing" and tables 33, 35 and 37). Fields, Mesa 24.0.6 `src/amd/registers/gfx10-rsrc.json` (`SQ_BUF_RSRC_WORD1`, `SQ_BUF_RSRC_WORD3` and its `_gfx103` twin, the same bits): SWIZZLE_ENABLE word1 bit 31, STRIDE word1 [29:16], INDEX_STRIDE word3 [22:21] (IS = 8, 16, 32 or 64 indices), ADD_TID_ENABLE word3 bit 23; there is no ELEMENT_SIZE field, the element is fixed at 4 bytes (ISA 8.1.5; LLVM `SIInstrInfo::getScratchRsrcWords23` sets it only up to GFX8). `index` = (idxen ? vindex : 0) + (ADD_TID_ENABLE ? lane : 0), where the lane is thread_id[5:0] within the wave (`Gen.wave_lane`), swizzled or not: table 33 adds the thread id with no swizzle condition and table 36's ring column is linear with add_tid. `offset` = (offen ? vaddr : 0) + inst_offset, without soffset. Swizzled: buffer_offset = (index / IS · stride + offset / 4 · 4) · IS + index % IS · 4 + offset % 4, address = base + soffset + buffer_offset, so dword k of a multi-dword access (and of a typed element over 4 bytes) is 4 · IS bytes after dword k − 1, not 4. Bounds as in Buffer bounds checking, with `idx` = `index` (the lane included), except that OOB_SELECT 3 with SWIZZLE_ENABLE and stride ≠ 0 checks `index >= num_records` or `off + 4k + 4 > stride` (table 35), like mode 0; stride 0 keeps the raw check. A literal word1 / word3 (`s_mov_b32` earlier in the block) folds each bit. A run-time word1 makes IS = 2^(SWIZZLE_ENABLE · (3 + INDEX_STRIDE)): IS = 1 is the linear address, so one formula serves both and nothing is selected but the mode 3 check; a run-time word3 multiplies the lane by ADD_TID_ENABLE. Cost, measured on the 116 shaders of `runtime/test/shaders` that both versions translate (all `spirv-val` clean before and after): the 56 with a MUBUF access through a run-time V# grow by 15.1 % in SPIR-V lines (+10.4 % over all 116), 30 to 45 instructions per access (address, lane, 4 per extra dword, a select per dword of the bounds check); a literal linear V# gives the same SPIR-V as before. Outside compute and mesh shaders the lane is `SubgroupLocalInvocationId`, so a VS, PS or GS with a run-time V# now declares `GroupNonUniform`. The offset arithmetic is 32-bit, like the linear address. Until 2026-11-22 a literal V# with either bit was `Unsupported` and a run-time one was translated unswizzled. **How confirmed**: Mesa/LLVM and AMD's ISA reference (fields and formula), not measured on hardware; `tests/semantic/test_buffer_swizzle.py` (hand-worked addresses for IS 8/16/64, index msb/lsb, soffset after the swizzle, the mode 3 rule with and without a stride, per-dword x2/x3/x4 loads and stores, a 16-byte typed element, ADD_TID on lane 5 linear and swizzled, each with a literal and a run-time V#); GPU test `runtime/test/shaders/cs_buf_swizzle.asm` (check.py, `scripts/run_gpu_tests.py`), which checks the translation, not RDNA2. **Unmeasured**: the swizzled layout on RDNA2 hardware, offsets that are not dword aligned (the ISA requires alignment for swizzled accesses; the translation adds offset % 4), wrap of the 32-bit offset, and GFX11's two-bit SWIZZLE_ENABLE (word1 [31:30]). In the corpus `SCRATCH_EN` is 0 in every CS, so a swizzled V# can only come from a descriptor the game writes itself. | | Wave64 mask ballot | `tools/lane_masks.py` tracks per-lane masks (including 32-bit `MASK_LO`/`MASK_HI` halves, `vcc_lo`/`vcc_hi`, and `s_bfm_b64` bitfields). `s_bcnt1_i32_b64`/`b32`, `s_bcnt0_i32_b64`/`b32`, `s_ff1_i32_b64`/`b32`, `s_ff0_i32_b64`/`b32`, and `s_bitcmp0/1_b32/b64` reconstruct the 64-bit wave mask via `OpGroupNonUniformBitwiseOr` (`GroupNonUniformArithmetic`), restricting 32-bit half ops and `s_cmp_eq/lg_u32` (`wave_equal`) to the known 32-bit half in wave64. Opposite-half `s_cmp_*_u32/i32` comparisons (lo vs hi), ordering comparisons on mask halves, and `s_cmp_*_u32/i32/u64` comparing a lane mask against an arbitrary scalar or immediate reconstruct the exact 32/64-bit mask words via `wave_mask`. A compare with 0 keeps the vote, but a compare with -1 (all ones) does not: lanes that were never launched (a group smaller than the wave) don't vote, while their bits are 0 in the real mask, so until 2026-11-22 `s_cmp_eq_u32 vcc_hi, -1` read 1 in a 40-thread wave64 for `vcc_hi` = 0xff. GPU-checked with `cs_w64x_partial_scmp.asm` (40-thread wave64, native and `--wave64-emulate`) and `cs_w32_partial_scmp.asm` (20-thread wave32) on an AMD Radeon RX 7800 XT (RADV, Mesa 26.2.6): all 8 words as the headers derive, and 4 of 8 wrong in each with the old translator. GPU-checked with `runtime/test/shaders/cs_wave64_ballot.asm` and `cs_wm_*.asm` on AMD Radeon RX 9070 XT (64-wide subgroup); semantic test coverage in `tests/semantic/test_scalar_bitcmp.py` and `tests/semantic/test_scalar_alu_shifts.py`. | -| Wave64 mask ballot | `tools/lane_masks.py` tracks per-lane masks (including 32-bit `MASK_LO`/`MASK_HI` halves, `vcc_lo`/`vcc_hi`, and `s_bfm_b64` bitfields). `s_bcnt1_i32_b64`/`b32`, `s_bcnt0_i32_b64`/`b32`, `s_ff1_i32_b64`/`b32`, `s_ff0_i32_b64`/`b32`, and `s_bitcmp0/1_b32/b64` reconstruct the 64-bit wave mask via `OpGroupNonUniformBitwiseOr` (`GroupNonUniformArithmetic`), restricting 32-bit half ops and `s_cmp_eq/lg_u32` (`wave_equal`) to the known 32-bit half in wave64. Opposite-half `s_cmp_*_u32/i32` comparisons (lo vs hi), ordering comparisons on mask halves, and `s_cmp_*_u32/i32/u64` comparing a lane mask against an arbitrary scalar or immediate reconstruct the exact 32/64-bit mask words via `wave_mask`. GPU-checked with `runtime/test/shaders/cs_wave64_ballot.asm` and `cs_wm_*.asm` on AMD Radeon RX 9070 XT (64-wide subgroup); semantic test coverage in `tests/semantic/test_scalar_bitcmp.py` and `tests/semantic/test_scalar_alu_shifts.py`. | | VOP3 FP modifiers on constants | `tools/shader_ir.py` keeps VOP3 FP source modifiers (`neg(...)`, `|...|`, `-|...|`, `abs(...)`, and nested combinations) as `abs`/`neg` flags on `imm` and `fimm` operands so `abs` clears the sign bit first and `neg` flips it second (matching LLVM `AMDGPUInstPrinter.cpp::printOperandAndFPInputMods` and `llvm/test/MC/AMDGPU/vop3-modifiers.s`). Plain signed literals (`-1`, `-1.0`) are unchanged. Until 2026-11-22, `-|1.0|` folded `-` into the float before `FAbs` (yielding `+1.0`), `neg(0x3f800000)` / `neg(1)` applied two's-complement integer negation (`-4.0f` / `0xffffffff` NaN instead of `-1.0f` / `0x80000001`), and `|0x...|` / `-|0x...|` dropped `abs`. `tools/shader_meta.py` applies the same bit operations in `_imm_u32`. Checked on the CPU by `tests/test_shader_ir.py`, `tests/test_shader_meta.py` and `tests/semantic/test_vop3_const_mods.py` (f32, f16, `v_fma_mix_f32`, `v_cmp_class_f32`, f64 SPIR-V structure); GPU-checked for `-\|-2.0\|`, `neg(0x3f800000)`, `\|0xbf800000\|` and f16 `-\|0x3c00\|` by `ps_vop3_const_mods.asm` (Tesla V100 (NVIDIA 580.95.05, Linux)). | -| VOP3 FP modifiers on constants | `tools/shader_ir.py` keeps VOP3 FP source modifiers (`neg(...)`, `|...|`, `-|...|`, `abs(...)`, and nested combinations) as `abs`/`neg` flags on `imm` and `fimm` operands so `abs` clears the sign bit first and `neg` flips it second (matching LLVM `AMDGPUInstPrinter.cpp::printOperandAndFPInputMods` and `llvm/test/MC/AMDGPU/vop3-modifiers.s`). Plain signed literals (`-1`, `-1.0`) are unchanged. Until 2026-11-22, `-|1.0|` folded `-` into the float before `FAbs` (yielding `+1.0`), `neg(0x3f800000)` / `neg(1)` applied two's-complement integer negation (`-4.0f` / `0xffffffff` NaN instead of `-1.0f` / `0x80000001`), and `|0x...|` / `-|0x...|` dropped `abs`. `tools/shader_meta.py` applies the same bit operations in `_imm_u32`. Checked on the CPU by `tests/test_shader_ir.py`, `tests/test_shader_meta.py` and `tests/semantic/test_vop3_const_mods.py` (f32, f16, `v_fma_mix_f32`, `v_cmp_class_f32`, f64 SPIR-V structure); **not GPU-verified**. | | Mesh/compute input registers (historical measurement) | An early read-before-write analysis over all compute and mesh shaders found **compute** v0 (880), v0–v1 (614), v0–v2 (50), consistent with AMD's local thread ID x/y/z in v0/v1/v2, and scalar inputs centred on a pointer at s[4:5] and s6/s7. **Mesh:** every one of 2,969 reads exactly **v5**, plus s3 (always arithmetic), s[16:17] and s19–s23. The early pass also read FSSM 0x13C as the group width and compared the first SGPR multiply against it (82 match, 151 don't, 1,447 no simple multiply) and wrongly concluded that 0x13C was not the group width; the matching register varied by shader (s6/s10/s7/s9…). PSV0 gave the real thread-group sizes (32×1×1 for 1,253, 8×8×1 for 416, …). **Superseded:** 0x13C/0x140/0x144 are the thread-group size, `COMPUTE_PGM_RSRC2` at 0x138 gives the per-shader user-SGPR count and enabled workgroup IDs, and mesh takes NumThreads, limits and topology from PSV0 with `v5 = linearGroupIndex * NumThreads + LocalInvocationIndex`. All 2,689 CS and 9,282 mesh shaders translate now (see the Compute shaders and Mesh shaders rows). | | Formerly untranslated | Mesh (9,282), geometry (195) and compute (2,689) now translate; `s_swappc_b64` is replaced by Vulkan vertex inputs (see *Vertex fetch*) and the `tbuffer_load_format_*` forms use the instruction's format. Packed `tbuffer_load_format_d16_{x,xy,xyz,xyzw}` load two 16-bit components per VGPR, with the same final partial write as MUBUF. Native gfx1036 wave32/64 confirmed all four widths for RGBA8_UINT and RGBA8_UNORM with a conflicting 32_UINT V# format. Both packed and ordinary MTBUF loads ignore the V# channel selectors and use identity for the instruction format, zero-filling missing channels. Native gfx1036 measurements compared multiple V# permutations with MUBUF as a control. An INVALID V# format (0) suppresses the MTBUF fetch even at a valid address inside its bounds. Native gfx1036 wave32/64 returned zero components at all four widths and preserved the untouched half of an odd D16 destination, as specified for unbound resources in the [RDNA2 ISA, §8.1.4](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf). A translated vertex fetch on RTX 5080 and Radeon Graphics also followed a change to the instruction format between two draws with identical vertex records and V#. Fixed UNORM and SNORM loads share the exact integer quotient for each magnitude width across instructions and channels (checked against rationally rounded binary32 values on RTX 5080 and Radeon Graphics). The gfx1013 disassembler omits `format:` for the [GFX10 MTBUF default](https://llvm.org/docs/AMDGPUModifierSyntax.html#ufmt), `BUF_FMT_8_UNORM` (code 1). A few rare ops are still reported by name rather than guessed. | diff --git a/docs/embedded_shaders.md b/docs/embedded_shaders.md new file mode 100644 index 0000000000..cfd316094a --- /dev/null +++ b/docs/embedded_shaders.md @@ -0,0 +1,124 @@ +# Shader containers embedded in the package's DLLs + +**Status: measured** on the 1.0.2.1 package. This note covers the shader programs that ship outside +`shaders.rpf`: the DXBC containers inside the package's DLLs, what each one carries, and what the measurement +changes for the ray-tracing and upscaling paths. No container, shader or payload is reproduced here; the tables +hold counts, offsets, chunk names and module identifiers. + +## 1. Why they matter + +`make_game.py`'s `shaders` stage carves `shaders.rpf` only (`make_game.py`:655). Two DLLs in the same package +carry compute programs of their own: + +* `XboxBvhBuilder.dll`, Microsoft's XDXR acceleration-structure builder. Its constructor creates compute PSOs + through device slot 62, and the builder is on the critical path for ray tracing. +* `amd_fidelityfx_upscaler_xbox.dll`, the FidelityFX 4.1.1 upscaler. Its programs are the `ACCC`/`FSPX` format + covered in [fspx.md](fspx.md); this note only counts them. + +`tools/pe_shader_containers.py` scans a binary for DXBC containers, validates the chunk table, reads the `ILDN` +module name and reports what each container carries. `--extract` writes the containers and an `index.json` the +translator reads; extracted shaders are game data and must stay in the user's work folder. + +```sh +python -I tools/pe_shader_containers.py --json /containers.json --extract /embedded/dxbc +``` + +## 2. Inventory + +The 16 DLLs and the package's root files were scanned. All the containers are in two DLLs: + +| image | containers | bytes | min / median / max | chunks | +|---|---:|---:|---:|---| +| `XboxBvhBuilder.dll` | 52 | 674,404 | 4,072 / 7,454 / 74,508 | `SFI0 ISG1 OSG1 PSV0 RTS0 STAT ILDN HASH DXIL` | +| `amd_fidelityfx_upscaler_xbox.dll` | 29 | 289,656 | 1,764 / 5,176 / 42,616 | `SFI0 ISG1 OSG1 PSV0 RTS0 HASH ACCC` | +| other 14 DLLs | 0 | 0 | — | — | + +The 29 `ACCC` containers hold `FSPX` payloads ([fspx.md](fspx.md)); the 52 `DXIL` containers are the subject of +this note. The FSR DLL has one rejected `DXBC` hit: the bytes are an immediate in its own magic check, and the +validator rejects it (the scan reports both counts). + +**Every one of the 52 containers carries two representations of its program:** + +* an LLVM bitcode blob in the `DXIL` chunk (`BC C0 DE`, 1,820 to 70,276 bytes), and +* an `XDAT` directory with tag `0x0d` whose payload starts with `XBCH`: the console program. The same chunk also + holds tag `0x07` (a second `DXIL` program header) and tag `0x12` (a 16-byte hash). The `STAT` chunk holds a + second, different bitcode blob, not the same one. + +The bitcode is what a PC D3D12 compiler consumes; the runtime path is the `XBCH` record. The constructor passes +the **whole container** to the compute-PSO call: at `0x180021330` it loads `DAT_180025700` with size `0x1134` +(4,404 bytes, the size of container 0, `CopyAndCompactBVH`) and calls `FUN_18000c470`, whose vtable call at +`+0x1f0` (slot 62) receives that pointer, its size and two zero words. `FUN_18001d400` adds two more PSOs, +`XDXR PostBuildInfoQuery` (0x14a4 bytes) and `XDXR GetBVHCompactedSize`. `bvh_builder_test` measures **53** PSO +creations during construction over the **52** containers ([d3d12_vulkan.md](d3d12_vulkan.md) A.2), so one +container is created twice; which one is **Open**. + +## 3. The 52 modules + +The `ILDN` PDB path gives one module per container, all under +`X:\americas\src\dev\rage\3rdparty\Microsoft\XboxBvhBuilder\Build\Release\Output\XboxBvhBuilder\` (Microsoft's +component integrated into RAGE, not Rockstar shader code). Grouped by phase: + +| phase | modules | +|---|---| +| sort (11) | `BitonicPreSortCS`, `BitonicPreSort64CS`, `BitonicInnerSortCS`, `BitonicInnerSort64CS`, `BitonicOuterSortCS`, `BitonicOuterSort64CS`, `RadixCount`, `RadixAlloc`, `RadixReset`, `CalculateMortonCodes`, `CalculateMortonCodes64` | +| prefix (7) | `PrefixSum64`, `PrefixSum128`, `PrefixSum256`, `PrefixSum512`, `PrefixSum1024`, `PrefixSum2048`, `PrefixSum4096` | +| kdop (3) | `BuildKDOP`, `ResetKDOP`, `BuildApexPointMap` | +| build (7) | `ConstructBVH4`, `BuildBVHSplits`, `BuildBVHSplits64`, `SplitInstances`, `FindTreelets`, `RearrangeBVHs`, `RearrangeTriangles` | +| refit (2) | `RefitBVH4`, `CopyForBVHUpdate` | +| load (6) | `LoadTriangles`, `ReloadTriangles`, `LoadInstances`, `LoadProceduralGeometry`, `ReloadProcedurals`, `ResetToIndexBuffer` | +| path tracing (6) | `PT_ConstructBVH4`, `PT_BeginPass`, `PT_LoadInstances`, `PT_WriteInstances`, `PT_WritePartitions`, `PT_WriteOfflinePartition` | +| rehydration (3) | `Box16Rehydration`, `Box32Rehydration`, `LeafRehydration` | +| headers/util (7) | `DecompressHeader`, `InitHeaders`, `InitPartitionedHeaders`, `GetBVHCompactedSize`, `CopyCounters`, `ResetCounterValues`, `CopyAndCompactBVH` | + +## 4. They are console FSSM, and the existing translator already takes them + +The `XBCH` record has the same shape as the game's own shaders: `XBCH` + stored/unpacked sizes + a zlib stream +that expands to `FSSM` ([fssm_crosscheck.md](fssm_crosscheck.md)). On all 52 containers: + +| step | result | +|---|---| +| `tools/fssm_unpack.py` | **52/52** decompress to a valid `FSSM` blob (716 B to 101,320 B, median 2,200 B) | +| `tools/shader_disasm.py --mcpu gfx1013` | **52/52** disassemble; 42 with no invalid word, 10 with invalid words in the code | +| `tools/rdna2spirv.py` | **42** translate and pass `spirv-val` | + +The 10 untranslated programs stop at four rules: + +| module(s) | blocker | +|---|---| +| `BuildKDOP`, `LoadInstances`, `ReloadProcedurals`, `LoadProceduralGeometry`, `LoadTriangles` | `global_atomic_fmax` | +| `PT_LoadInstances` | `global_atomic_fmin` | +| `Box16Rehydration`, `Box32Rehydration`, `ReloadTriangles` | `buffer_load_ushort` | +| `LeafRehydration` | `tbuffer_load_format_x GFX10_FORMAT_8_UINT` | + +Reproduction, after `--extract` above: + +```sh +python -I tools/fssm_unpack.py /embedded/dxbc +python -I tools/shader_disasm.py /embedded/dxbc/fssm --out /embedded/dxbc/disasm --mcpu gfx1013 +python -I tools/rdna2spirv.py /embedded/dxbc/disasm --out /embedded/spirv +``` + +## 5. What this changes + +* **The RT builder does not need a DXIL path for the console code.** Its programs are RDNA2 `FSSM`, and 41 of + 52 already pass `spirv-val` with the translator the project uses for the game's 26,503 shaders. The bitcode in + the same container is a second representation (the one the PC-compiler experiment measured); it is not what + the console runtime executes. +* **The four missing rules are small and have real fixtures.** `global_atomic_fmax`/`fmin` cover 6 programs, + `buffer_load_ushort` 3 and `tbuffer_load_format_x` with format 8 one. They are ordinary translator rules, not + a new compiler backend. +* **The rehydration programs are the ones closest to the shipped data.** `Box16Rehydration`, + `Box32Rehydration` and `LeafRehydration` are exactly the programs that would turn the dehydrated BVH packs + into runtime trees ([bvh.md](bvh.md) §3.1). Two of the four rules stand between them and translation. +* **What is still open.** None of the 52 has been executed on a GPU; translation and `spirv-val` do not prove the + output. Which of them the game actually creates is a call-site question (RT-5). The module-to-pipeline order + above comes from `ILDN`, not from a runtime trace. The `STAT` bitcode and the `0x07 NOBC` record are not + explained. + +## 6. Tool and tests + +`tools/pe_shader_containers.py` is standard library only and reads the file, never runs it. It accepts a +container only when the chunk table is sorted, 4-byte aligned, entirely inside the declared total and its last +chunk ends exactly at that total; that is what rejects the FSR DLL's `DXBC` immediate. The synthetic tests in +`tests/test_pe_shader_containers.py` build containers by hand (no game data) and cover the accepted layout, a +bare magic, a truncated chunk, an `ACCC`/`FSPX` container, the `ILDN` name and the extraction index. diff --git a/docs/i18n/README.md b/docs/i18n/README.md index 78e8562c15..83138e71aa 100644 --- a/docs/i18n/README.md +++ b/docs/i18n/README.md @@ -13,7 +13,9 @@ A language is added when a contributor volunteers to maintain it and keeps the s | Language | File | Synced commit | Maintainer | |---|---|---|---| | Français (`fr`) | [`fr/quickstart.md`](fr/quickstart.md) | `e7584c52` | `@Urban225` | -| Português (Brasil) (`pt-BR`) | [`pt-BR/quickstart.md`](pt-BR/quickstart.md) | `d3841c0c` | `@Andretuta` | -| 简体中文 (`zh-CN`) | [`zh-CN/quickstart.md`](zh-CN/quickstart.md) | `e7584c5` | `@liang-kai-shui` | +| Português (Brasil) (`pt-BR`) | [`pt-BR/quickstart.md`](pt-BR/quickstart.md) | `003e7812` | `@Andretuta` | +| 简体中文 (`zh-CN`) | [`zh-CN/quickstart.md`](zh-CN/quickstart.md) | `003e7812` | `@liang-kai-shui` | | Polski (Polish) (`pl-PL`) | [`pl-PL/quickstart.md`](pl-PL/quickstart.md) | `c0ac5fd6` | `@Dom-in` | | Türkçe (`tr`) | [`tr/quickstart.md`](tr/quickstart.md) | `f85582e` | `@emirhan-karaca` | +| Русский (`ru`) | [`ru/quickstart.md`](ru/quickstart.md) | `a0acd33` | `@DmitryBykov-ISPO` | +| 日本語 (`ja`) | [`ja/quickstart.md`](ja/quickstart.md) | `003e781` | `@bingll123` | diff --git a/docs/i18n/ja/quickstart.md b/docs/i18n/ja/quickstart.md new file mode 100644 index 0000000000..0dfae78313 --- /dev/null +++ b/docs/i18n/ja/quickstart.md @@ -0,0 +1,138 @@ +# Leonida クイックスタート(`ja`) + +> [!NOTE] +> 英語のドキュメント([`README.md`](../../../README.md)、[`CONTRIBUTING.md`](../../../CONTRIBUTING.md)、 +> [`docs/README.md`](../../README.md))が**正式版**です。このページは安定したセットアップとビルド手順のみを +> まとめたもので、commit `003e781` に同期しています。日々の進捗は [`README.md`](../../../README.md) +> を参照してください。 + +## Leonida とは + +Leonida は、Xbox Series 版 Grand Theft Auto VI を Windows 上でネイティブに動かすための**静的リコンパイル** +プロジェクトです。Xbox Series の CPU は PC と同じ x86-64 なので、ゲームのコードはそのまま読み込まれて +ネイティブに実行され、本体側のシステムソフトウェアは shim として再実装されます。本体用にコンパイル済みの +RDNA2 GPU プログラムは Vulkan 向けの SPIR-V に翻訳され、モデル・テクスチャ・音声はあなたのパッケージから +直接読み込まれます。これらはすべて**あなたの PC 上で、あなた自身のゲームのコピーから**行われます。 + +> [!IMPORTANT] +> このリポジトリにはゲーム、キー、実行ファイルは**含まれません**。入手方法も説明しません。自分用のコピーが +> 必要で、そのファイルはあらかじめディスク上で読める状態になっている必要があります。ここには復号や保護の +> 回避を行うものは何もありません。ビルドが生成するもの(翻訳されたシェーダー、抽出されたアセット、 +> runtime フォルダー、セーブデータ)はすべてあなたのゲームに由来し、あなたの PC に残ります。これらの +> ファイルを共有しないでください([`CONTRIBUTING.md`](../../../CONTRIBUTING.md))。 + +プロジェクトはまだ初期段階で、**ゲームはまだ起動しません**。 + +## 前提条件 + +- **自分用の Xbox Series パッケージ**(バージョン `1.0.2.1`)。`MicrosoftGame.Config` と `.rpf` アーカイブが + プレーンなファイルとして置かれているフォルダーが、ゲームフォルダーです。 +- **Windows 10/11 x64** と、作業ファイル用に約 **350 GB** の空き容量(`--work` で別ドライブに置けます)。 +- [Python 3.12+](https://www.python.org/downloads/)(インストール時に "Add python.exe to PATH" を有効に)。 +- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)。 +- [Vulkan SDK](https://vulkan.lunarg.com/)(`spirv-as` / `spirv-val` 用)。 +- **AMDGPU target** を含む [LLVM 21+](https://github.com/llvm/llvm-project/releases)(`llvm-mc` 用)。 + - Windows 版の公式 LLVM には AMDGPU target が**含まれていません**。 + - Windows では、リポジトリのルートで次のコマンドを実行すると、AMDGPU target 付きのネイティブ `llvm-mc.exe` を + ビルドし(WSL 不要。`git` と下記の Visual Studio の C++ ツールが必要)、`LLVM_MC` を設定します: + + ```powershell + powershell -ExecutionPolicy Bypass -File scripts\build_llvm_mc.ps1 + ``` + - または WSL に `llvm-21` を入れて、`LLVM_MC` にコマンド全体を設定します: + `LLVM_MC="wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc"` + ([docs/design.md](../../design.md#disassembling-shaders))。 + - Linux では `PATH` に `llvm-mc` があれば十分です。 +- **Visual Studio 2022**(**C++ によるデスクトップ開発**)と **Windows SDK 10.0.26100 以降**。 + `runtime` ステージで必要です(バージョン 1.2 の root signature を使い、古い SDK には宣言がないためです)。 +- [ffmpeg](https://ffmpeg.org/download.html) を `PATH` に(任意: XMA2 ストリームのデコード。`--wav` では必須)。 + +## ビルド方法 + +ポートはビルド済みで配布されているものではありません。**あなたの PC 上で、あなた自身のコピーから**ビルドします。 + +### 簡単な方法(Windows) + +1. 上記の前提条件をインストールします。 +2. サブモジュール込みでリポジトリを取得します。 + + ```powershell + git clone --recursive https://github.com/ItsNotRexed/Leonida + ``` + + GitHub の "Download ZIP" では `third_party/rpf9-explorer` が含まれません。`git` があればビルドが自動で + 取得し、なければ必要な操作を表示します。 +3. **`Build.bat`** をダブルクリックします。 + +すると、ゲームのコピーが自動で見つかります。ダウンロード、デスクトップ、ドキュメント(OneDrive など +Windows が保存する場所を含む)、Games、ホームフォルダー、各ドライブの先頭から 2 階層までを探し、いくつかの +ファイルサイズからバージョンを判定します(大きなファイルは読みません)。複数ある場合はどれを使うか確認し、 +見つからない場合はフォルダーの貼り付けを求めます。開始前に上記の前提条件と空き容量を確認し、足りないものを +まとめて表示します。出力先は `Documents\Leonida` です。中断したビルドは続きから再開します。 + +### コマンドライン(`make_game.py`) + +```powershell +python -I make_game.py --find # この PC で見つかったコピーを一覧 +python -I make_game.py --pick # フォルダーダイアログでゲームフォルダーを選ぶ +python -I make_game.py --check # コピーを確認するだけでビルドしない +python -I make_game.py --check --full-check # すべてのファイルの SHA-256 も比較(低速) +python -I make_game.py --game "D:\path\to\your\package" --out "D:\Games\Leonida" --work "E:\leonida-work" +python -I make_game.py --stages shaders,assets # 一部のステージだけ +python -I make_game.py --game "D:\path\to\your\package" --wav # Opus を PCM WAV にもデコード(大容量) +python -I make_game.py --wave64-emulate off # auto(既定)、on、off のいずれか +``` + +ステージは `check` → `shaders` → `assets` → `runtime` → `pipelines` の順に実行されます。`pipelines` は +翻訳済みの各シェーダーをあなたの GPU ドライバー上で生成してパイプラインキャッシュを保存するので、初回起動時の +コンパイルが不要になります。最も時間がかかるのはシェーダーの翻訳で、`--jobs` 個のプロセスで実行されます +(既定では CPU スレッド数の半分)。 + +- **`--wave64-emulate`**: wave64 の compute / mesh シェーダーを、どのサブグループサイズでも正確になるように + 翻訳するかどうかを決めます。NVIDIA と Intel の GPU は 32 レーンのサブグループなので必要です。既定の `auto` は + `vulkaninfo`(Vulkan SDK に含まれる)に問い合わせ、すべての GPU が 64 レーンのサブグループを報告しない場合、 + または判定できない場合に有効にします。ただし runtime が使う GPU が、AMD の Windows ドライバーで wave64 を + ネイティブに実行できる RDNA2 のカードや iGPU の場合は、そのドライバーのシェーダーコンパイラーが + エミュレーションされた LDS コードでクラッシュするため(#857)、オフのままにします。設定は翻訳済みシェーダーの + 隣に保存され、変更すると翻訳し直しになります。 +- **`--work`**: 中間ファイル用のフォルダーです。最低でも 350 GB 空いているドライブを指定してください。 +- **`--wav`**: 既定では無効です。16-bit PCM WAV は Ogg Opus より数倍大きいためです。 +- **Linux と Wine/Proton**: `make_game.py` は Linux でも動作します。ローダーは Windows プログラムなので + Wine または Proton で動きます。`runtime` ステージは Linux 上で clang-cl と lld-link(LLVM 19 以降)を使い、 + [xwin](https://github.com/Jake-Shadle/xwin) が `XWIN_DIR` または `~/.local/share/xwin-sdk` に用意した + MSVC CRT と Windows SDK に対して `runtime/build/windows` へクロスビルドします + ([docs/testing.md](../../testing.md#the-windows-runtime-on-linux-under-wine-or-proton) に一度だけ実行する + `xwin` コマンドがあります)。これらがない場合、このステージは既定のステージから外れ、明示的に指定すると + 何が足りないかを作業開始前に表示します。別の場所で作った Windows 版も使えます: + + ```sh + python3 -I make_game.py --runtime-build ~/Downloads/runtime-windows + ``` + + どちらの場合も `gta6rt.exe` と `gta6rt_tls_host.dll` を `--out` にコピーし、隣に `gta6rt.sh` を書き出します。 + これは `gta6rt.exe` を `wine`、または `WINE` で指定した Wine(Proton なら `files/bin/wine`)で起動します。 + Windows で同じオプションを指定すると、ビルドは省略されます。 + +## よくある問題 + +- **GitHub の "Download ZIP" を使った**: ZIP には `third_party/rpf9-explorer` サブモジュールが含まれません。 + `git clone --recursive` を使うか、リポジトリのフォルダーで `git submodule update --init --recursive` を + 実行してください。 +- **`llvm-mc` が `gfx1013` や AMDGPU を拒否する**: Windows 版の公式 LLVM を使っている可能性が高いです。 + リポジトリのルートで `powershell -ExecutionPolicy Bypass -File scripts\build_llvm_mc.ps1` を実行するか、 + `LLVM_MC` を WSL の `llvm-mc`(`llvm-21`)に向けてください。 +- **CMake が "needs the Windows SDK 10.0.26100 or newer" で止まる**、または MSVC が `Desc_1_2` は + `D3D12_VERSIONED_ROOT_SIGNATURE_DESC` のメンバーではないと報告する: Windows SDK を `10.0.26100` 以降に + 更新し(Visual Studio Installer、または `winget install Microsoft.WindowsSDK.10.0.26100`)、 + `runtime/build` を削除してから構成し直してください。 +- **`C:` ドライブの空きが足りない**: `--work "D:\leonida-work"` を指定して中間ファイルを別のドライブに置きます。 +- **Windows がビルド直後のテストプログラムの実行を拒否する**("An Application Control policy has blocked this + file"): Windows 11 のスマート アプリ コントロールです。 + [docs/testing.md](../../testing.md#known-problems) を参照してください。 + +## コントリビュートと GPU テスト + +- GPU テストの手順(ゲームファイル不要): [docs/testing.md](../../testing.md)。結果は + [#166](https://github.com/ItsNotRexed/Leonida/issues/166) に、GPU とドライバーごとに 1 コメントで投稿します。 +- コントリビュートのルール、ゲームデータを持ち込まない方針、作業の調整: + [`CONTRIBUTING.md`](../../../CONTRIBUTING.md)。 diff --git a/docs/i18n/pt-BR/quickstart.md b/docs/i18n/pt-BR/quickstart.md index 0d54af7b48..6964b8aee1 100644 --- a/docs/i18n/pt-BR/quickstart.md +++ b/docs/i18n/pt-BR/quickstart.md @@ -3,7 +3,7 @@ > [!NOTE] > A documentação em inglês ([`README.md`](../../../README.md), [`CONTRIBUTING.md`](../../../CONTRIBUTING.md) e > [`docs/README.md`](../../README.md)) é a **referência oficial**. Este guia reúne apenas instruções estáveis de -> configuração e compilação (sincronizado com o commit `d3841c0c`). Para o status diário do projeto, consulte o +> configuração e compilação (sincronizado com o commit `003e7812`). Para o status diário do projeto, consulte o > [`README.md`](../../../README.md). ## O que é o Leonida @@ -30,9 +30,14 @@ O projeto está em fase inicial: **o jogo ainda não dá boot**. - [Vulkan SDK](https://vulkan.lunarg.com/) (`spirv-as`, `spirv-val` e `vulkaninfo`). - [LLVM 21+](https://github.com/llvm/llvm-project/releases) com o **target AMDGPU** (`llvm-mc`): - O binário oficial do LLVM para Windows **não** inclui o target AMDGPU. - - Para compilar um `llvm-mc.exe` nativo com AMDGPU, execute `.\scripts\build_llvm_mc.ps1` no PowerShell - a partir da raiz do repositório. O script requer `git` e as ferramentas C++ do Visual Studio, configura - `LLVM_MC` para o seu usuário e pede que você abra um novo terminal para carregar a variável. + - Para compilar um `llvm-mc.exe` nativo com AMDGPU, rode este comando a partir da raiz do repositório. + + ```powershell + powershell -ExecutionPolicy Bypass -File scripts\build_llvm_mc.ps1 + ``` + + O script requer `git` e as ferramentas C++ do Visual Studio, configura `LLVM_MC` para o seu usuário + e pede que você abra um novo terminal para carregar a variável. - Se usar o WSL, instale `llvm-21` no Ubuntu e defina a variável na mesma sessão do PowerShell em que vai executar `make_game.py`. @@ -80,7 +85,7 @@ Os estágios executam nesta ordem: `check` → `shaders` → `assets` → `runti ## Problemas comuns - **Baixou pelo botão "Download ZIP" do GitHub**: o ZIP não inclui o submódulo `third_party/rpf9-explorer`. Use `git clone --recursive` ou execute `git submodule update --init --recursive` dentro da pasta do repositório. -- **`llvm-mc` recusa `gfx1013` / AMDGPU**: você provavelmente está com o instalador oficial do LLVM para Windows. Use `scripts\build_llvm_mc.ps1` ou aponte `LLVM_MC` para o `llvm-mc` do WSL (`llvm-21`). +- **`llvm-mc` recusa `gfx1013` / AMDGPU**: você provavelmente está com o instalador oficial do LLVM para Windows. Siga um dos passos de configuração do LLVM acima. - **Erro de `D3D12_ROOT_SIGNATURE_DESC2` ao compilar o runtime**: atualize o Windows SDK para `10.0.26100` ou mais recente pelo Visual Studio Installer ou `winget install Microsoft.WindowsSDK.10.0.26100`, apague a pasta de build e reconfigure. - **Falha por falta de espaço no drive `C:`**: passe `--work "D:\leonida-work"` para mover os arquivos temporários para outra partição. @@ -91,7 +96,8 @@ Os estágios executam nesta ordem: `check` → `shaders` → `assets` → `runti 2. Rode os testes relevantes com entradas sintéticas. Por exemplo, para testar o verificador de manifestos, execute `python -I tests/test_manifest_verifier.py` na raiz do repositório. 3. No PR, inclua o ID da tarefa, descreva o que testou e informe a GPU e o driver se rodou testes de GPU. - Indique se usou assistência de IA. Confira as regras em [`CONTRIBUTING.md`](../../../CONTRIBUTING.md). + Confira as regras em [`CONTRIBUTING.md`](../../../CONTRIBUTING.md). Se usou assistência de IA, indique + isso no PR, conforme [`AGENTS.md`](../../../AGENTS.md). O [guia de testes em GPU](../../testing.md) mostra como executar os testes sem arquivos do jogo. Publique os resultados de GPU na [issue #166](https://github.com/ItsNotRexed/Leonida/issues/166). diff --git a/docs/i18n/ru/quickstart.md b/docs/i18n/ru/quickstart.md new file mode 100644 index 0000000000..c22c09e799 --- /dev/null +++ b/docs/i18n/ru/quickstart.md @@ -0,0 +1,157 @@ +# Быстрый старт Leonida (`ru`) + +> [!NOTE] +> Главный источник: английская документация ([`README.md`](../../../README.md), [`CONTRIBUTING.md`](../../../CONTRIBUTING.md) +> и [`docs/README.md`](../../README.md)). Этот гайд покрывает только стабильные шаги установки и сборки +> (сверен с коммитом `a0acd33`). Текущее состояние проекта меняется каждый день, его смотрите в +> [`README.md`](../../../README.md). + +## Что такое Leonida + +Leonida это проект статической рекомпиляции Grand Theft Auto VI (Xbox Series): игра запускается нативно на +Windows. Процессор консоли x86-64, как у ПК, поэтому код игры загружается и работает напрямую, а системное ПО +консоли реализовано заново. Готовые GPU-программы RDNA2 переводятся в SPIR-V для Vulkan. Модели, текстуры и звук +читаются из вашего пакета. Всё это происходит **на вашем ПК, из вашей копии игры**. + +> [!IMPORTANT] +> В репозитории **нет ни игры, ни ключей, ни исполняемого файла**, и он не объясняет, где их взять. Нужна своя +> копия, файлы которой уже читаются с диска. Ничто в проекте не расшифровывает данные и не обходит защиты. Всё, +> что создаёт сборка (переведённые шейдеры, извлечённые ресурсы, рабочая папка и ваши сохранения), берётся из +> вашей игры и **остаётся на вашем ПК**. Не выкладывайте эти файлы (см. [`CONTRIBUTING.md`](../../../CONTRIBUTING.md)). + +Проект на раннем этапе: **игра пока не запускается**. + +## Что нужно + +- **Своя копия** пакета Xbox Series версии `1.0.2.1`: папка, где `MicrosoftGame.Config` и архивы `.rpf` лежат + обычными файлами. +- **Windows 10/11 x64** и примерно **350 ГБ** свободного места под рабочие файлы. Их можно перенести на другой + диск через `--work`. +- [Python 3.12+](https://www.python.org/downloads/) (при установке отметьте *«Add python.exe to PATH»*). +- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0). +- [Vulkan SDK](https://vulkan.lunarg.com/) для `spirv-as` и `spirv-val`. +- [LLVM 21+](https://github.com/llvm/llvm-project/releases) с **целью AMDGPU** для `llvm-mc`: + - в официальной сборке LLVM для Windows цели AMDGPU нет; + - на Windows `scripts\build_llvm_mc.ps1` собирает свой `llvm-mc.exe` с этой целью (без WSL, нужны `git` и + инструменты C++ из Visual Studio ниже) и прописывает `LLVM_MC`; после этого откройте новый терминал, чтобы + переменная подхватилась; + - если ставите `llvm-21` в WSL, передайте `LLVM_MC` целой командой в той же сессии PowerShell, откуда + запускаете `make_game.py`: + + ```powershell + $env:LLVM_MC = 'wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc' + ``` + + Подробности в [`docs/design.md`](../../design.md#disassembling-shaders); + - на Linux достаточно `llvm-mc` в `PATH`. +- **Visual Studio 2022** с рабочей нагрузкой *«Разработка классических приложений на C++»* и **Windows SDK + `10.0.26100` или новее**: они нужны этапу `runtime`, который использует root signatures версии 1.2, а в старых + SDK их нет. +- [ffmpeg](https://ffmpeg.org/download.html) в `PATH` *(по желанию: декодирует потоки XMA2, обязателен для `--wav`)*. + +## Как собрать + +### Простой способ (Windows) + +1. Установите всё из списка выше. +2. Склонируйте проект **вместе с подмодулем**: + ```powershell + git clone --recursive https://github.com/ItsNotRexed/Leonida + ``` + Кнопка «Download ZIP» на GitHub оставляет за бортом `third_party/rpf9-explorer`. Сборка подтянет его сама, + если установлен `git`, иначе скажет, что сделать. +3. Запустите **`Build.bat`** двойным щелчком. + +Скрипт сам находит копию игры: смотрит папки «Загрузки», рабочий стол, «Документы» (в том числе когда их хранит +OneDrive), `Games`, домашнюю папку и корень каждого диска, на два уровня вглубь. Версию он определяет по +размерам нескольких файлов, не читая больших данных. Если копий несколько, спросит, какую брать; +если ни одной, попросит вставить путь к папке. Перед стартом он проверит, что всё из списка установлено и места +хватает, и покажет все недостающие пункты разом. Результат пишется в `Documents\Leonida`. Прерванная +сборка продолжается с того места, где встала. + +### Из терминала (`make_game.py`) + +```powershell +python -I make_game.py --find # какие копии нашлись на этом ПК +python -I make_game.py --pick # выбрать папку игры в диалоге +python -I make_game.py --check # проверить копию, ничего не собирать +python -I make_game.py --check --full-check # ещё и сравнить SHA-256 каждого файла (долго) +python -I make_game.py --game "D:\путь\к\пакету" --out "D:\Games\Leonida" --work "E:\leonida-work" +python -I make_game.py --stages shaders,assets # только часть этапов +python -I make_game.py --game "D:\путь\к\пакету" --wav # ещё и Opus в PCM WAV (много места) +python -I make_game.py --wave64-emulate off # auto (по умолчанию), on или off +``` + +Этапы идут в таком порядке: `check`, `shaders`, `assets`, `runtime`, `pipelines`. Последний создаёт все +переведённые шейдеры на драйвере вашей видеокарты и сохраняет кеш конвейеров, чтобы при первой загрузке их не +пришлось компилировать. Перевод шейдеров самый долгий: он выполняется в `--jobs` процессов (по умолчанию +половина потоков процессора). + +- **`--wave64-emulate`**: переводить ли compute- и mesh-шейдеры wave64 так, чтобы они работали точно при любом + размере подгруппы (раздел «Wave64 emulation» в [`docs/design.md`](../../design.md)). У NVIDIA и Intel подгруппы + шириной 32, им это нужно. Режим `auto` спрашивает `vulkaninfo` из Vulkan SDK и включает эмуляцию в трёх + случаях: не все видеокарты сообщают подгруппы шириной 64, ответ получить не удалось, или карта для runtime не + умеет выполнять compute- и mesh-шейдеры на 64. Режим сохраняется рядом с переведёнными шейдерами, и его смена + запускает перевод заново. При `auto` рабочая папка, где эмуляция уже использовалась, держит её и дальше, даже + если текущая карта умеет wave64 нативно. +- **`--work`**: выберите диск, где свободно хотя бы 350 ГБ. +- **`--wav`**: по умолчанию выключен, потому что 16-битный PCM WAV в несколько раз больше Ogg Opus. Флаг + декодирует перепакованные потоки Ogg Opus в `work\assets\audio\wav` после этапа аудио; готовые WAV при + продолжении сборки пропускаются. + +Четыре запасных флага передаются переводчику так же, сохраняются рядом с шейдерами и запускают перевод заново +при изменении: `--no-float-controls` (убрать `SignedZeroInfNanPreserve` для устройств, чья проверка конвейеров +пропускает шейдер без `shaderSignedZeroInfNanPreserveFloat32`), `--bary-fallback` (читать сырые барицентрики из +интерполированного входа, для устройств без `VK_KHR_fragment_shader_barycentric`), `--texel-offset-fallback` +(вносить смещения `image_sample*_o` в координату, для устройств без `VK_KHR_maintenance8`) и `--mesh-compute` +(mesh-шейдеры как compute, для устройств без `VK_EXT_mesh_shader`). Каждый описан в +[`docs/design.md`](../../design.md). + +### Linux и Wine/Proton + +`make_game.py` работает и на Linux. Загрузчик (`gta6rt.exe`) это программа для Windows, поэтому на Linux она +идёт под Wine или Proton. Этап `runtime` на Linux кросс-собирается в `runtime/build/windows` через `clang-cl` и +`lld-link` +(LLVM 19+, но не 22.1.7 и не 22.1.8, см. [`docs/testing.md`](../../testing.md#known-problems)) против CRT от MSVC и +Windows SDK, которые раскладывает [xwin](https://github.com/Jake-Shadle/xwin) в `XWIN_DIR` или +`~/.local/share/xwin-sdk`. Разовый вызов `xwin` есть в +[`docs/testing.md`](../../testing.md#the-windows-runtime-on-linux-under-wine-or-proton). Если этих инструментов нет, +этап выпадает из списка по умолчанию, а при явном запросе скрипт сразу перечислит, чего не хватает. Готовая +сборка для Windows тоже подойдёт, например артефакт `runtime-windows` из CI: + +```sh +python3 -I make_game.py --runtime-build ~/Downloads/runtime-windows +``` + +В обоих случаях `gta6rt.exe` и `gta6rt_tls_host.dll` копируются в `--out`, а рядом пишется `gta6rt.sh`, который +запускает `gta6rt.exe` через `wine` или через Wine из переменной `WINE` (для Proton это его `files/bin/wine`). На +Windows этот же флаг пропускает сборку. + +## Частые проблемы + +- **Скачали ZIP с GitHub**: в архиве нет подмодуля `third_party/rpf9-explorer`. Используйте + `git clone --recursive` или выполните `git submodule update --init --recursive` в папке репозитория. +- **`llvm-mc` не знает `gfx1013` или цель AMDGPU**: скорее всего установлен официальный LLVM для Windows. + Соберите свой через `scripts\build_llvm_mc.ps1` или укажите в `LLVM_MC` путь к `llvm-mc` из WSL (`llvm-21`). +- **CMake пишет «needs the Windows SDK 10.0.26100 or newer»** или MSVC не находит `Desc_1_2` в + `D3D12_VERSIONED_ROOT_SIGNATURE_DESC`: поставьте Windows SDK `10.0.26100` или новее через Visual Studio + Installer либо `winget install Microsoft.WindowsSDK.10.0.26100`, удалите `runtime/build` и настройте заново. +- **Кончилось место на `C:`**: передайте `--work "D:\leonida-work"`, чтобы рабочие файлы легли на другой диск. +- **Windows не даёт запустить только что собранные тестовые программы** («An Application Control policy has + blocked this file»): так работает Smart App Control в Windows 11, подробности в + [`docs/testing.md`](../../testing.md#known-problems). + +## Как помочь и прогнать тесты на видеокарте + +1. Посмотрите открытые pull request и [issue координации][coord], чтобы не делать ту же работу дважды. Заявите + задачу строкой `claiming: ` или одним предложением описания, если ID ещё нет. +2. Прогоните нужные тесты на синтетических входных данных. Например, проверку манифеста: + `python -I tests/test_manifest_verifier.py` из корня репозитория. +3. В pull request укажите ID задачи и то, что вы проверили, а если запускали тесты на видеокарте, ещё её модель и + версию драйвера. Отметьте, помогал ли вам ИИ. Все правила в [`CONTRIBUTING.md`](../../../CONTRIBUTING.md). + +[Руководство по тестам на видеокарте](../../testing.md) объясняет, как обойтись без файлов игры. Результаты +складывают в [issue #166](https://github.com/ItsNotRexed/Leonida/issues/166), по одному комментарию на карту и +драйвер. + +[coord]: https://github.com/ItsNotRexed/Leonida/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22 diff --git a/docs/i18n/zh-CN/quickstart.md b/docs/i18n/zh-CN/quickstart.md index c316e65da8..3cf73de36f 100644 --- a/docs/i18n/zh-CN/quickstart.md +++ b/docs/i18n/zh-CN/quickstart.md @@ -2,7 +2,7 @@ > [!NOTE] > 英文文档([`README.md`](../../../README.md)、[`CONTRIBUTING.md`](../../../CONTRIBUTING.md) 和 -> [`docs/README.md`](../../README.md))是**权威版本**。本文只汇总稳定的安装与构建说明(与 commit `e7584c5` 同步)。 +> [`docs/README.md`](../../README.md))是**权威版本**。本文只汇总稳定的安装与构建说明(与 commit `003e7812` 同步)。 > 项目每日进展请查看 [`README.md`](../../../README.md)。 ## Leonida 是什么 @@ -48,14 +48,16 @@ Leonida 是一个把 Xbox Series 版 Grand Theft Auto VI **静态重编译**到 3. 双击 **`Build.bat`**。 -脚本会自动查找你的拷贝(Downloads、Desktop、Documents、Games、用户目录以及每个盘的根目录往下两层), -检查前置条件和可用空间,结果写到 `Documents\Leonida`。构建中断后重新运行即可从断点继续。 +脚本会自动查找你的拷贝(Downloads、Desktop、Documents(也包括 OneDrive 等 Windows 实际存放它的位置)、Games、 +用户目录以及每个盘的根目录往下两层),检查前置条件和可用空间,结果写到 `Documents\Leonida`。构建中断后重新运行即可从断点继续。 ### 命令行(`make_game.py`) ```powershell python -I make_game.py --find # 列出本机找到的拷贝 +python -I make_game.py --pick # 在文件夹对话框里选择游戏目录 python -I make_game.py --check # 校验游戏文件,不构建 +python -I make_game.py --check --full-check # 另外比对每个文件的 SHA-256(较慢) python -I make_game.py --game "D:\path\to\package" --out "D:\Games\Leonida" --work "E:\leonida-work" python -I make_game.py --stages shaders,assets # 只跑指定阶段 python -I make_game.py --game "D:\path\to\package" --wav # 额外把 Ogg Opus 解码为 PCM WAV(很大) @@ -64,11 +66,26 @@ python -I make_game.py --wave64-emulate auto # auto(默认)、o 阶段顺序:`check` → `shaders` → `assets` → `runtime` → `pipelines`。 -- **`--wave64-emulate`**:在 32 lane 子组的 GPU(NVIDIA、Intel)上模拟 compute/mesh 的 wave64。 - 默认 `auto` 会询问 `vulkaninfo`,需要时自动启用。 +- **`--wave64-emulate`**:决定是否把 wave64 compute/mesh 着色器翻译成在任意子组宽度下都精确的版本 + (见 [`docs/design.md`](../../design.md) 中 Wave64 emulation 一行)。NVIDIA 和 Intel GPU 是 32 lane 子组, + 需要它。默认 `auto` 会询问 `vulkaninfo`(属于 Vulkan SDK),除非所有 GPU 都报告 64 宽子组、或无法判断, + 都会启用;运行时实际使用的 GPU 无法以 64 宽运行 compute/mesh 时也会启用。有一个例外会让它保持关闭:当运行时的 + GPU 是 RDNA2 独显或核显(RX 6000、Ryzen 6000/7000/9000 的核显)、使用 AMD Windows 驱动并原生运行 wave64 时 + ——该驱动的着色器编译器在模拟 LDS 代码上会崩溃(#857);否则 Intel 核显搭配 RX 6000 卡时也会被启用。 + 该模式会保存在翻译后的着色器旁边,切换它会重新翻译。使用 `auto` 时,之前用过模拟的工作目录在后续翻译和重试中 + 会继续使用模拟,即使当前 GPU 支持原生 wave64;要用原生方式翻译,使用 `--wave64-emulate off`。 +- **四个 fallback 标志**:它们同样转发给翻译器、保存在翻译后的着色器旁边,切换会重新翻译: + `--no-float-controls`(去掉 `SignedZeroInfNanPreserve`,用于设备在缺少 + `shaderSignedZeroInfNanPreserveFloat32` 时会跳过着色器;需要 PR #664 的翻译器标志)、 + `--bary-fallback`(从插值输入读取原始重心坐标,用于没有 `VK_KHR_fragment_shader_barycentric` 的设备)、 + `--texel-offset-fallback`(把 `image_sample*_o` 的偏移折叠进坐标,用于没有 `VK_KHR_maintenance8` 的设备)和 + `--mesh-compute`(把 mesh 着色器当作 compute,用于没有 `VK_EXT_mesh_shader` 的设备)。每个标志的说明见 + [`docs/design.md`](../../design.md)。 - **`--work`**:建议指向至少有 350 GB 空闲的磁盘;`shaders` 阶段最慢,默认使用一半 CPU 线程(`--jobs` 可调)。 - **Linux 与 Wine/Proton**:`make_game.py` 也能在 Linux 上运行。`runtime` 阶段会在 Linux 上用 clang-cl 和 - lld-link(LLVM 19+)把 loader 交叉编译到 `runtime/build/windows`,依赖 `XWIN_DIR` 或 + lld-link(LLVM 19+,但 22.1.7 和 22.1.8 有已知问题,见 [docs/testing.md](../../testing.md#known-problems); + 命令名用不带版本后缀的,或五个 LLVM 工具都用同一版本后缀,例如 `clang-cl-21`)把 loader 交叉编译到 + `runtime/build/windows`,依赖 `XWIN_DIR` 或 `~/.local/share/xwin-sdk` 里的 MSVC CRT 和 Windows SDK ([docs/testing.md](../../testing.md#the-windows-runtime-on-linux-under-wine-or-proton) 有一次性 `xwin` 命令); 缺少这些时该阶段不参与默认 stages,显式请求会先列出缺什么。 diff --git a/docs/mission_logic.md b/docs/mission_logic.md index 8f754556e0..af6ac4a10b 100644 --- a/docs/mission_logic.md +++ b/docs/mission_logic.md @@ -103,7 +103,56 @@ are no opcodes here, and no jump table. Two consequences for a runtime: ## Mission identity -The package's own text metadata carries a 145-entry mission table. Only **one** of those ids is provably -bound to one of these tables, so most outlines are unattributed. Joining ids to tables is an open problem; -a plain joaat of the ids does not appear in the program data (0 of 290 variants in 170.9 MB), so the join -is not by name hash. +The package's own text metadata carries a 145-entry mission table. Two of those ids now have a +reproducible binding to one of these tables, so most outlines are still unattributed. Joining ids to +tables is an open problem; a plain joaat of the ids does not appear in the program data (0 of 290 +variants in 170.9 MB), so the join is not by name hash. + +## Binding a mission id to its tables + +This binding does not join on the id. It uses a **character** as the bridge: the mission's own text names +a person, a name dictionary turns that name into a 32-bit hash, and the same hash appears as the +`linkHash` of pool elements in a state table. + +1. **Start from a name the mission text uses.** `COM_KBOS_NEIGHB` is the replay-table id for the mission + publicly catalogued as **Pipework** (Mandy's rent). The text table at `data.rpf` stream + `0x19957A0` contains the line "You brought the cops to Mandy's house" and the line "Bert died". + The stream carries no mission id; the id-to-text step rests on the public name and the cast, not an + archive key. +2. **Resolve the character and its schedule.** `common.rpf` stream `0x4C270` lists + `KeyLento/Perschars/Peds/Unique/Mandy` and `.../Bert` under the pack `PSP_KeyLento_perschars_peds`. + SixNG's name dictionary, which is lower-case joaat, resolves the pack to `0x865F0DA9`, Mandy to + `0x03A885E6` and Bert to `0xE34ACBC8`. +3. **Scan the PSINs for the link hash.** In the 64-byte element above, `linkHash` is the dword at byte + `+0x34`, not the archetype dword. Inflating the five `story000_script.rpf` streams at `0x3FE4000`, + `0x3FE8000`, `0x3FEB000`, `0x3FEE000` and `0x3FF0000` and searching for those two hashes finds 28 + elements: 15 Mandy and 13 Bert. A scan of all 2,309 PSIN streams finds those 28 hits in exactly these + five files. +4. **Read the element.** Its start is `linkHash - 52`. The first dword is the archetype/state hash + described above. It does not resolve in the name dictionary, and the same character takes three + values, so it is an archetype/state hash rather than a character model name. + +| stream | Mandy elements | Mandy archetype | Bert elements | Bert archetype | +|---|---:|---|---:|---| +| `0x3FE4000` | 5 | `0x18BB2550` | 5 | `0xA5A1E67D` | +| `0x3FE8000` | 3 | `0x73E83886` | 3 | `0x780A05A5` | +| `0x3FEB000` | 3 | `0x73E83886` | 4 | `0x780A05A5` | +| `0x3FEE000` | 3 | `0x73E83886` | 0 | - | +| `0x3FF0000` | 1 | `0x57DDFFC2` | 1 | `0xCBA48304` | + +Mandy has three distinct archetype values in this set and Bert three; none resolves in the name +dictionary. + +The five tables are bound to `COM_KBOS_NEIGHB` through two people the mission's own text names, both +present as link hashes in the same five streams. It is a binding by cast, not by id: the public +`Pipework` name is the outside link between the id and the text, and a mission whose cast is not in the +dictionary still has no bridge. + +It does **not** turn `0x18BB2550`, `0x73E83886`, `0x57DDFFC2`, `0xA5A1E67D`, `0x780A05A5` or +`0xCBA48304` into model names. None resolves in the same dictionary, and the first dword changes per +state; it is an archetype/state hash, not a Mandy or Bert drawable. The table that would name those +archetypes is not in the readable archives. + +This is **one more binding, not a general solution**. The other 143 ids in the mission table remain +unattributed unless a character, schedule or other stable name gives them a bridge; joining ids to +tables is still an open problem. diff --git a/docs/models.md b/docs/models.md index 61b0e9f2b8..90d31c1a8e 100644 --- a/docs/models.md +++ b/docs/models.md @@ -2,12 +2,8 @@ Measured state of `tools/rpf9dump models` on the Xbox Series 1.0.2.1 package, and the upstream `rpf9-explorer` fixes that close it. The fixes are merged upstream and the submodule is -pinned at `e293917`, where a full ten-archive re-count recovers **382,781 models** (**2.64 billion -triangles**, **0 decode failures**), up from 350,248 at `917e9b9` and 190,792 at `c3708fb`. -upstream `rpf9-explorer` fix that closes it. The fix is merged upstream and the submodule is -pinned at `e293917` (the 350,251-model counts below were measured at `917e9b9`, before -upstream `v1.2` PRs #8-#12 landed; the non-`levels.rpf` archives were then re-counted at -`e293917`). +pinned at `e293917`, where a full ten-archive re-count recovers **382,781 models** (**0 decode +failures**), up from 350,251 at `917e9b9` and 190,792 at `c3708fb`. Before the fix, the exporter did not reject any vertex or index layout in the tested archives. It dropped valid models in three validation paths, all in `third_party/rpf9-explorer` at commit @@ -23,13 +19,11 @@ per entry), the TTPF compact/array/cubemap/volume layouts, and the external draw reader. Commits `917e9b9..e293917` add upstream `v1.2` model-discovery changes (PRs #8–#12: optional fragment pointers, skipping texture dictionaries in drawable-dictionary scans, 16-bit bone-palette indices, probe-count parity, and zero-radius drawables) plus BCPack BC1/BC3/BC4/BC5 -decoding (PR #7). A full ten-archive re-count at `e293917` recovers **382,781 models** (**+32,533** -over `917e9b9`'s 350,248) and **2,636,248,990 triangles** with **0 decode failures**; the earlier +decoding (PR #7). A full ten-archive re-count at `e293917` recovers **382,781 models** (**+32,530** +over `917e9b9`'s 350,251) with **0 decode failures**; the `levels.rpf` fragment, bone-binding and +triangle cells are not independently reproduced (see the table note), and the earlier `917e9b9`, `c3708fb`, and `48557ea` measurements are kept below as controls. This page records the measured state; it is not a competing patch. -decoding (PR #7). The 350,251-model counts below were measured at `917e9b9` and are kept as the -control; the `e293917` re-count for the non-`levels.rpf` archives is in the table below. This page -records both, and is not a competing patch. PR #1 reports 190,792 of 190,792 recognized candidates across the ten archives configured in Leonida, including 169 previously rejected candidates (also verified after archive readback). A @@ -63,18 +57,25 @@ effect of upstream `v1.2` PRs #8–#12: | `data.rpf` | 2,921 | **3,175** | 268 | 2,907 | 1,758 | 2,891 | 3,387,016 | 0 | +594 | | `pack/shared_minigame000/...` | 1,058 | **1,294** | 317 | 977 | 10 | 18 | 16,843,903 | 0 | +6 | | `pack/core_restofworld/...` | 924 | **936** | 808 | 128 | 53 | 849 | 1,239,596 | 0 | +51 | -| `pack/story000_restofworld/...` | 1 | **3** | 3 | 0 | 0 | 0 | 2,620 | 0 | +3 | +| `pack/story000_restofworld/...` | 1 | **3** | 3 | 0 | 0 | 0 | 2,620 | 0 | 0 | | `pack/story000/story000.rpf` | 4,195 | **7,461** | 4,156 | 3,305 | 0 | 0 | 39,861,747 | 0 | +1 | | `packs.rpf` | 26,389 | **26,585** | 23,720 | 2,865 | 2,865 | 26,585 | 64,966,572 | 0 | +2,551 | -| `levels.rpf` | 235,330 | **343,327** | 130,239 | 213,088 | 50,731 | 59,544 | 2,509,947,536 | 71 | +29,327 | +| `levels.rpf` | 235,330 | **343,327** | 130,239 | 213,088 | † | † | † | 71 | +29,327 | | `textures.rpf` | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | | `common.rpf`, `core_restofworld001` | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | -| **Total** | **270,819** | **382,781** | **159,511** | **223,270** | **55,417** | **89,887** | **2,636,248,990** | **72** | **+32,533** | +| **Total** | **270,819** | **382,781** | **159,511** | **223,270** | **†** | **†** | **†** | **72** | **+32,530** | + +† `levels.rpf` was counted with `count.exe recover --verify`, which reports candidates, models, +dictionary children, standalone models, rejects and decode failures only: no `levels.rpf` manifest +exists and the harness emits no fragment, bone-binding or triangle field. Those three `levels.rpf` +cells, and the totals that would include them, are therefore **not independently reproduced**. The +other archives measure 4,686 fragments, 30,343 bone-bound and 126,301,454 triangles. Every recovered entry was read back from its archive segments and decoded through -`RageModelDecoder.Decode`: **382,781 / 382,781 decoded, 0 decode failures**, **4,090,898 meshes**, -**2,468,402,149 vertices**, **2,636,248,990 triangles (2.64 billion)**, and **1,805 embedded -textures**. +`RageModelDecoder.Decode`: **382,781 / 382,781 decoded, 0 decode failures**. The other archives +measure **236,311 meshes**, **104,183,438 vertices**, **126,301,454 triangles** and **512 embedded +textures**; the `levels.rpf` mesh/vertex/triangle/embedded cells are not independently reproduced +(see the table note). What moved between `917e9b9` and `e293917`: @@ -89,13 +90,13 @@ What moved between `917e9b9` and `e293917`: `data.rpf` (75 → 0), `core_restofworld` (140 → 0), and `shared_minigame000` (18 → 0). Only one texture-dictionary candidate remains across all ten archives (in `textures.rpf`; rejected cleanly, and recovered by `Rpf9TextureRecovery`). -- **Probe caps and zero-radius drawables (+28 dictionary children plus capped standalones).** +- **Probe caps and zero-radius drawables (+25 dictionary children plus capped standalones).** Upstream [rpf9-explorer#11](https://github.com/breadbbbb/rpf9-explorer/pull/11) recovers the 29 previously capped candidates (+1 in `story000.rpf`, and +14 dictionary children plus capped standalones in `levels.rpf`). Upstream [rpf9-explorer#12](https://github.com/breadbbbb/rpf9-explorer/pull/12) recovers all 11 zero-radius - dictionary children in `core_restofworld` (797 → 808) and 1 drawable dictionary (3 models) in - `story000_restofworld.rpf`, which previously recovered 0 models. + dictionary children in `core_restofworld` (797 → 808); `story000_restofworld.rpf` already + recovered its 3 models at `917e9b9`, so its delta is 0. - **Remaining 72 rejects (down from 1,282 at `917e9b9`).** Aside from the single texture-dictionary candidate in `textures.rpf`, all 71 remaining rejects are in `levels.rpf` (0 texture dictionaries, 0 zlib checksum errors). Sampled headers are fragment candidates (`LooksLikeFragment == true`) @@ -165,7 +166,7 @@ pages. `core_restofworld` recovers 873 of its 1,024 candidates (885 models); the models**, 130,225 dictionary children, 183,775 standalone. 1,037 candidates are rejected: the 1,009 in the last shard are texture dictionaries, not models, and 28 more in shards 1 to 7 are models the probe caps reject (see [rejected candidates](#rejected-candidates-at-917e9b9)). The -`levels.rpf` full export was not re-run, so its triangle total is still the old measurement. +`levels.rpf` full export was not re-run, so its triangle total is not re-run here. ### Rejected candidates at `917e9b9` @@ -248,11 +249,8 @@ The `packs.rpf` row is the pre-dictionary-root control: at `917e9b9` that archiv 24,034 models (26,585 at `e293917`), and the other archives' new-pin counts are in the table above. The rows here are the `c3708fb` measurements (190,792 models); the `917e9b9` re-count is 350,251, and the `e293917` re-count outside `levels.rpf` is 39,454. Triangle totals have not been re-run at -either new pin. -24,034 models (26,585 at `e293917`), and the other archives' counts are in the tables above. The -rows here are the `c3708fb` measurements (190,792 models); the `917e9b9` re-count is 350,248. -Triangle totals for that pin have not been re-run; the current `e293917` totals are in the -full-archive table above. +either new pin; the `e293917` `levels.rpf` geometry cells are not independently reproduced (see +the table note above). At `c3708fb`, every candidate is recovered, read back and decoded: 0 decode failures, 0 readback failures, no duplicate model names, and 2.22 billion triangles (1.95 billion before). The @@ -505,7 +503,8 @@ own light bones). 1. **Done:** [rpf9-explorer PR #1](https://github.com/breadbbbb/rpf9-explorer/pull/1) is merged upstream. 2. **Done:** the pin is `e293917` (was `917e9b9`, originally `48557ea`). 3. **Done:** all ten `MODEL_ARCHIVES` were re-counted and read-back decoded at `e293917` (**382,781 - models**, **2,636,248,990 triangles**, **0 decode failures**; table above). + models**, **0 decode failures**; table above; the `levels.rpf` geometry cells are not + independently reproduced). 4. Investigate the 71 remaining unrecovered fragment candidates in `levels.rpf` (and the 1 texture-dictionary candidate in `textures.rpf`) if further upstream recovery is wanted. 5. Keep issue #29 in sync with the `e293917` counts. diff --git a/docs/pipeline_check.md b/docs/pipeline_check.md index 17ab615a93..1f3e2ee465 100644 --- a/docs/pipeline_check.md +++ b/docs/pipeline_check.md @@ -9,6 +9,8 @@ the Vulkan implementation, not that the shader results are correct. Value-level The checker exits nonzero if a module fails to load, a pipeline fails to compile, or the requested final cache save fails. It still finishes checking the other entries and attempts the final save so the next run can reuse successful pipelines. Entries reported as skipped do not count as failures. +It also exits 2, before loading Vulkan, if `index.json` is missing, unreadable, empty or malformed, so a wrong +directory can't pass as an empty corpus. A valid `{}` is an intentionally empty index. For a compute entry with `lds_bytes` in the index, the checker compares the reported workgroup memory with the selected GPU's `maxComputeSharedMemorySize`. An entry above the limit counts as a module @@ -143,6 +145,42 @@ The report above therefore states the limit and the skip count; a later run on a completed the full 26,503-entry set without them (`docs/design.md`). `--max-bytes` remains a visibility tool, not a pass: a skipped module has not been validated. +## Crash isolation (`--isolate`) + +A driver that dies while compiling one module (for example the RADV `SIGFPE` in +[#1721](https://github.com/ItsNotRexed/Leonida/issues/1721)) ends the whole process, so the rest of the corpus +used to need that module excluded by hand with `--start/--count`. With `--isolate` (POSIX only; on Windows it +prints an error and exits with 2) the tool runs the check in child processes instead: + +```sh +vk_pipeline_check cache.bin --isolate [--isolate-batch 256] [--jobs N ...] +``` + +- The parent opens no Vulkan device. It runs this executable, one child at a time, over `--isolate-batch` + modules (default 256) of the same sorted, stage-filtered list, with the other options passed on (`--jobs` is + the thread count inside each child). `--stats` is refused: children would overwrite one file. +- A child that is killed by a signal, or exits without finishing the pass after it started work, has its output + discarded and its batch is bisected (re-run in halves) down to the module that kills it. That module is printed as + `MODULE CRASH (, driver crashed: SIGFPE)`, counted as a failed pipeline and listed at the end; + the other modules are checked as usual and counted once. If both halves of a crashed batch run clean (a crash + that needs several threads at once), the batch is reported as `MODULE CRASH [a, b) not reproduced ...` and + counts as a failure. A child that fails before it starts work (no device, bad arguments) stops the run + with exit status 1. +- The pipeline cache: children run one after another and each seeds from and saves to the same `cache.bin`, + like the chunked runs above; the save is atomic, a crashed child saves nothing, so the file stays valid and + holds everything the finished children compiled. The parent prints its size at the end. +- Exit status: 0 only if no module failed or crashed and the cache saved; 1 otherwise. The summary is + aggregated by the parent (modules, pipelines, skips, `--cache-feedback`); the per-stage wave and compile-time lines + of a normal run are not repeated. Output of a batch appears when its child finishes. +- Each child loads the cache again, so a very large cache makes small batches slow; raise `--isolate-batch`. + There is no timeout: a hung compile still hangs. + +Test hook, not for normal use: `VK_PIPELINE_CHECK_SIMULATE_CRASH=[:SIGNAL]` makes the +process raise `SIGNAL` (default `SIGFPE`; `SEGV`, `ABRT`, `KILL`, ... also accepted) just before the pipeline of a +matching module is created. `tests/test_vk_pipeline_check_isolate.py` uses it with five hand-assembled compute +shaders to check `--isolate` without a crashing driver; it skips when the tool isn't built or there is no +Vulkan device. + ## Application pipeline-cache feedback With `--cache-feedback`, the checker groups successful pipeline creations by translated shader stage diff --git a/docs/psin.md b/docs/psin.md index 22ac8ab151..9999e89a97 100644 --- a/docs/psin.md +++ b/docs/psin.md @@ -467,6 +467,21 @@ section, truncated data, trailing bytes and the JSON CLI, and the `LSCH`/`LENM` a count that fits nothing and both schema checks. It uses synthetic headers and joaat hashes of invented names only. +### Viewing a container in ImHex + +[tools/imhex/psin.hexpat](../tools/imhex/psin.hexpat) is a pattern for the [ImHex](https://imhex.werwolv.net/) hex +editor that lays out one container as this page describes it: +- the header, the instance-data block table with its `pppppppp` end, and the blocks, as raw bytes; +- the section chain; +- the `LSCH` struct headers and members, and the `LENM` enums and values, with the header count found by the same + fill-exact rule as `psin_index.py`; +- the `LSNS` block table and its opaque 16-byte records; +- the `LRSC` `0DRP` version and root block, and the `CHKS` file size. + +A section that runs past the end of a truncated stream is shown as raw bytes. `tests/test_imhex_patterns.py` builds a +synthetic container, checks it with `psin_index.py` and `psin_data.block_table`, and when ImHex is installed compares +the pattern's output with both. + ## Limits - The 64 KiB split is not joined automatically. A caller that has the archive order can join adjacent diff --git a/docs/runtime_imports.md b/docs/runtime_imports.md index c3860caf10..b5d099062c 100644 --- a/docs/runtime_imports.md +++ b/docs/runtime_imports.md @@ -141,10 +141,32 @@ pseudo-handle, and `GetProcAddress` on it resolves through the registry. A name with `ERROR_PROC_NOT_FOUND` and is logged once. Every other module goes to the host unchanged. `runtime/shims/xgameruntime.cpp` serves the five entry points. The initializers succeed offline and log the GDK -version and mode once. `QueryApiImpl` logs each class and interface id it is asked for and returns `0x80070032`, the -documented error for a class the runtime doesn't provide. The class method layouts are not known yet, so the first -boot with the executable lists the interfaces to implement next. `xgameruntime_test` drives this path through the -api-set binding `XCurl.dll` uses. +version and mode once. `QueryApiImpl` serves `XThreadingImpl` and `XErrorImpl` (below); for any other class it logs +the class and interface id and returns `0x80070032`, the documented error for a class the runtime doesn't provide, so +the first boot with the executable lists the classes to implement next. `xgameruntime_test` drives this path through +the api-set binding `XCurl.dll` uses, and calls the two classes slot by slot. + +### Class layouts, measured + +Each `xgameruntime.lib` function the package's DLLs link is a thunk of the same shape: it calls a helper with the +class id (passed as both the class and the interface id), which initializes the runtime once and calls +`QueryApiImpl`; then it calls one vtable slot with `this` followed by the function's own arguments, and calls +`Release` (slot 2). The helper treats `0x80040154` (class not registered) from `QueryApiImpl` specially: it turns it +into `0x89240107` and calls an error hook; any other failure is returned as is. + +The slots below were read from the thunks statically linked into `libHttpClient.GDK.dll` and `XCurl.dll` +(disassembled with `llvm-objdump`; no code was run, nothing else read). Every slot called matches, in argument +count and width, the function at that position of xgameruntime-docs' "Layout" list after IUnknown's three slots: + +| Class | Slots called | Checked against the documented order | +|---|---|---| +| `XThreadingImpl` (`IXThreadingImpl`, 28 methods, slots 3-30) | 3-7 and 9-30 (`libHttpClient.GDK.dll`), 3, 5, 12, 16-18, 22, 29 (`XCurl.dll`) | e.g. 7 `XAsyncBegin` (5 args), 9 `XAsyncSchedule` (pointer, 32-bit), 10 `XAsyncComplete` (pointer, HRESULT, size), 12 `XTaskQueueCreate` (two 32-bit modes, pointer), 16 `XTaskQueueDispatch` (returns a byte), 19 `XTaskQueueSubmitDelayedCallback` (5 args), 22 `XTaskQueueTerminate` (pointer, bool, two pointers), 27 `XThreadSetTimeSensitive` (bool), 30 `XThreadIsTimeSensitive` (returns a byte). Slot 8 (`XAsyncBeginAlloc`, private) is never called; slot 28 (`XTaskQueueIsEmpty`, private) takes no arguments | +| `XErrorImpl` (`IXErrorImpl`, slots 3-5) | 3 (`XCurl.dll`) | slot 3, the docs' `_unknown_`, takes an HRESULT and a pointer: `XErrorReport(HRESULT, const char*)` | +| `XNetworkingImpl` (`IXNetworkingImpl2`, slots 3-20) | 11-17 (`XCurl.dll`) | the Utf16 `XNetworkingQuerySecurityInformationForUrl*` trio, `XNetworkingVerifyServerCertificate`, `XNetworkingGetConnectivityHint`, `XNetworkingRegister/UnregisterConnectivityHintChanged` (pointer, bool). Not served yet | + +`XThreadingImpl` forwards each slot to `third_party/xtaskqueue`, the same implementation the named exports use; +`XThreadSetTimeSensitive`/`XThreadIsTimeSensitive` keep a per-thread flag and the two private slots log once and +answer 0. `XErrorImpl` logs each report and hands it to the callback `XErrorSetCallback` set. Which classes the package's GDK modules reference, from a byte search for the class and interface GUIDs that xgameruntime-docs lists (16-byte in-memory form, every `.dll` of the package; counts only, nothing else read): diff --git a/docs/saves.md b/docs/saves.md index 48136dc7f1..4f8fcaeef7 100644 --- a/docs/saves.md +++ b/docs/saves.md @@ -101,12 +101,15 @@ to it holds the same save. The wrapper's header is the only place the autosave's ## Importing into the runtime -`runtime/shims/xgameruntime_services.cpp` (#279) keeps `XGameSave` data in +The offline XGameSave shim of the open #279 (`xgameruntime_services.cpp` there; **not on `main` yet**, where the +`XGameSave*` imports have no implementation and get the loader's default answers, classified in +`runtime/shims/registry.cpp`) keeps `XGameSave` data in `LEONIDA_SAVE_DIR\local-user\\`, defaulting to `%LOCALAPPDATA%\Leonida\saves`, with names %-encoded. `python -I tools/saves.py import ... [--out DIR] [--map OLD=CONTAINER/BLOB]` writes payloads in that layout with the same encoding, plus `import-manifest.json` (source, size, SHA-256). -Checked: four imported blobs (2 KB to 1.2 MB) read back byte-identical through the shim's `XGameSaveReadBlobData`. +Checked with #279's shim: four imported blobs (2 KB to 1.2 MB) read back byte-identical through its +`XGameSaveReadBlobData`. **VERIFY:** the title's real container and blob names. The default is container = slot name and blob = payload file name, and `--map` overrides it. Confirm or fix them from the executable's `XGameSaveCreateContainer` and diff --git a/docs/shader_validation.md b/docs/shader_validation.md index ddaafe7382..97cf8309a2 100644 --- a/docs/shader_validation.md +++ b/docs/shader_validation.md @@ -280,16 +280,10 @@ differences** (plus `tools/salu_diff.py --oracle hw,translator --bfe-any --progr kept), `v_cvt_f16_u16/i16` and `v_cvt_u16/i16_f16` (`_e64` keeps high half; NaN → 0, ±inf saturates; note GFX10 does not accept `op_sel` on these opcodes), `v_cvt_i32_f32` (control: all ±qNaN/±sNaN → 0), and `v_cvt_pknorm_i16/u16_f32` (±qNaN → 0, ±inf saturation, RNE ties at ±0.5). -- **Live translator divergences confirmed on gfx1035 (5/87, pinned in `KNOWN_DIVERGENCES`):** - 1. **`v_add_co_u32`, `v_sub_co_u32`, `v_subrev_co_u32`, `v_add_co_ci_u32`, `v_sub_co_ci_u32`, `v_subrev_co_ci_u32` - with `clamp`:** hardware saturates `D` (`0xffffffff` on carry, `0x00000000` on borrow) while still reporting the - real carry/borrow (`1`) in `sdst`; the translator currently ignores `clamp` on these ops. - 2. **`v_cvt_rpi_i32_f32` precision:** hardware computes exact `floor(x + 0.5)` without binary32 rounding of `x + 0.5` - (`0x3effffff` → `0`, `0x4b000001` → `0x00800001`, `0x4b7fffff` → `0x00ffffff`), whereas the translator rounds - `x + 0.5` in f32 first (`1`, `0x00800002`, `0x01000000`). - 3. **`v_cvt_flr_i32_f32` / `v_cvt_rpi_i32_f32` on NaN:** hardware saturates by the NaN's sign bit (`0x7fc00000` → - `0x7fffffff`, `0xffc00000` → `0x80000000`), whereas `v_cvt_i32_f32` gives `0` for every NaN; the translator gives - `0` for both `flr` and `rpi`. +- **Translator divergences found on gfx1035:** five (VOP3 `clamp` on the six carry-out add/sub ops ignored; + `v_cvt_rpi_i32_f32` rounding `x + 0.5` in binary32; `v_cvt_flr/rpi_i32_f32` returning `0` for NaN instead of + saturating by its sign). All are fixed (#1831, #1856), so `KNOWN_DIVERGENCES` is empty and all 87 cases + match. Two assembler facts matter when writing edge cases: @@ -426,11 +420,20 @@ python -I tools/lds_fuzz.py --oracle hw --programs 50 --seed 1 --wave 32 --only that lane is on"): gfx1150 returns 0 when the source lane is off in EXEC, as `ds_bpermute` does. The model now says that. - **Negative controls.** `--perturb NAME` judges the hardware against a deliberately wrong model (mismatches must - appear); `--negative-control` re-judges the words of the run with all 15 (`max_i32` unsigned, `min_u32` signed, + appear); `--negative-control` re-judges the words of the run with all 16 (`max_i32` unsigned, `min_u32` signed, swapped `cmpst`, zero-extended `i8`/`i16`, d16 reads clearing the other half, `b16_d16_hi` shift, swapped `write2`, `st64` unit, bpermute reading off lanes or crossing the wave64 halves, reversed quad permute, swapped - swizzle or/xor, permute writing no zero) and exits 1 if one goes unnoticed. `--minimize` drops ops while a - program still differs, `--keep DIR` writes the native kernel of each mismatch, `--only I,J` runs chosen indices. + swizzle or/xor, permute writing no zero, permute lowest source winning a collision) and exits 1 if one goes + unnoticed. `--minimize` drops ops while a program still differs, `--keep DIR` writes the native kernel of each + mismatch, `--only I,J` runs chosen indices. + +RDNA2 `ds_permute_b32` verification (`FUZZ-10`, `SHADER-133`): raw kernels on an AMD Radeon RX 6800 (`gfx1030`, wave32 +and wave64) confirm that only active lanes send, the highest active source lane wins a collision, active destination +lanes nobody targets read `0`, inactive destinations keep their old values, and the two 32-lane halves stay separate +in wave64. On an AMD Radeon RX 6700 XT (`gfx1031`, RADV Mesa 26.3.1), 3,600 translator runs with colliding +`ds_permute_b32` multipliers (`mul` in `0..63`, seeds 1–3, 300 programs × wave32/wave64 native and `--emulate`) +matched the model bit for bit (`0` mismatches), and inverting the collision winner or zero-fill rules produced +mismatches in `39` and `56` of `200` seed-1 programs. Results on a Radeon 880M (gfx1150, RDNA3.5, driver 26.11.2, AMD clang 23.0.0git), `--oracle hw`: @@ -683,7 +686,7 @@ vscnt wait plus `s_dcache_inv`; vector accesses only need `s_waitcnt vmcnt(0)`. *Results on RDNA2 (gfx1036 integrated GPU, AMD Windows driver 32.0.21044.64, HIP backend, AMD clang 23.0.0git, `main` bb2e1842).* - **Hardware, same protocol** (seeds 101 to 105 x 2,000 programs x wave32 and native wave64 per family): **`f16` 20,000 of 20,000 and `mem` 20,000 of 20,000 match, 0 mismatches, 0 assembler rejections.** On a gfx1030, ROCm 6.2's clang 19 rejected 3,768 of 4,000 `f16` programs (#1365); clang 23 rejects none. - **Negative controls**, in the order above: `f16` 992, 865, 826, 430, 280 and 879 caught; `mem` 514, 57, 354, 60, 37, 580, 214 and 89 caught. The unperturbed model gives 0 mismatches. -- **`translator,hw` at seed 3** (100 programs, the same GPU through the AMD Vulkan driver): `mem` 200 of 200 match, `f16` 199 of 200. The one difference, `s3_22_w64`, is a driver mismatch of the #1506 kind. The hardware and `tests/semantic/spirv_mini_interp` both give the model's value for it, and the same emulated SPIR-V matches on NVIDIA. +- **`translator,hw` at seed 3** (100 programs, the same GPU through the AMD Vulkan driver): `mem` 200 of 200 match, `f16` 199 of 200. The one difference, `s3_22_w64`, is a driver mismatch of the #1506 kind. The hardware and `tests/semantic/spirv_mini_interp.py` both give the model's value for it, and the same emulated SPIR-V matches on NVIDIA. - **`v_pack_b32_f16` with signaling NaNs**, measured with hand-written raw kernels in both wave sizes and both IEEE modes. The inputs were five signaling-NaN halves, quiet NaNs, ±0, +inf and a denormal, in either half, with `op_sel` and with `neg`. - IEEE mode 1, the assembler's default: a signaling-NaN half is quieted. Bit 9 is set and the sign and payload are kept, as on gfx1150. - IEEE mode 0: the half is moved unchanged. @@ -984,6 +987,65 @@ reset in the kernel log. inputs is computed once and stored in its own half (`tests/test_f16_trans_sweep.py`). On a GPU the test checks exp2 of integers and wave32 = wave64. +### d16 rounding of UNORM/SNORM buffer loads (`tools/d16_format_probe.py`, BUILD-161) + +`docs/design.md` ("d16 and f16 format narrowing") narrows the f16 of a typed d16 buffer load the way it narrows an +image result: the exact binary32 decode, then integer round to nearest even (`Gen.f16_bits`). For buffer loads that +rounding was inferred, not measured. The probe measures it on a GFX10 GPU (RDNA1/RDNA2) through the hardware +oracle. Every value of UNORM8, SNORM8, UNORM10 (the x channel of format 50), UNORM16 and SNORM16 is loaded with +`buffer_load_format_d16_x`, `tbuffer_load_format_d16_x` and, for the f32 stage alone, `buffer_load_format_x`. Each +runs in wave32 and wave64. + +``` +python -I tools/d16_format_probe.py --json d16.json # about 1,040 kernels of 1,024 threads; exit 77 without the oracle +python -I tools/d16_format_probe.py --self-test # the rules against docs/design.md's #489 counts, no GPU +``` + +- **The kernels stage their own inputs.** Thread t stores the format bits of one value at dword t of the output + buffer and waits for the store (`s_waitcnt_vscnt`). It then builds a GFX10 V# over the buffer: DST_SEL XYZW, the + format, RESOURCE_LEVEL 1, OOB_SELECT 3, NUM_RECORDS the 4 KiB staged. It loads its element with `glc dlc` (past + L0 and GL1) and stores the VGPR at dword 1024 + t. The host checks that every staged word reads back as written. +- **Rules compared**, each also with f16 denormal results flushed: + - `f32_rte`, the translator's rule; + - `f32_rtz`, which is `v_cvt_pkrtz_f16_f32` of the f32 decode, the #489 bug; + - `rte` and `rtz`, which round the exact quotient once; + - `mul_rte`, the f32 product v · f32(1/(2^n − 1)) rounded to nearest even. +- **What the formats can separate.** The 8- and 10-bit formats only separate nearest from toward zero: every other rule + gives the same bits there. That covers 123 of the 256 UNORM8 values and 110 of the 256 SNORM8 values, the #489 + counts. Only four 16-bit values separate one rounding from two (`f32_rte` against `rte`): UNORM16 0xffaf and + 0xffef, SNORM16 0x7ff7 and 0x8009. The smallest UNORM16/SNORM16 values have quotients under 2^-14, so they show + a flush of f16 denormals. +- **Controls:** + - a 16_FLOAT d16 load must return its own bits (NaNs may be quieted); + - `d16_x` must leave the high half of its VGPR as it was (`docs/design.md` measured this on gfx1036); + - wave32 must equal wave64, and MUBUF must equal MTBUF. + + A failed control is exit 2; a wave or MUBUF/MTBUF difference is exit 1. Which rule the hardware follows is + reported, not judged. + +Measured on an RX 6700 (gfx1031, AMD Windows driver 32.0.21045.29003, ROCm wheel clang), the whole sweep in 36 s: + +| Format | Values | d16 `rte` | d16 `f32_rte` | d16 `f32_rtz` | f32 `f32_rte` | +| --- | --- | --- | --- | --- | --- | +| UNORM8 | 256 | 256 | 256 | 133 | 256 | +| SNORM8 | 256 | 256 | 256 | 146 | 256 | +| UNORM10 | 1,024 | 1,024 | 1,024 | 514 | 1,024 | +| UNORM16 | 65,536 | 65,536 | 65,534 | 33,796 | 65,536 | +| SNORM16 | 65,536 | 65,536 | 65,534 | 34,820 | 65,536 | + +- The d16 result is the exact quotient rounded once to f16, to nearest even, with f16 denormals kept. The two + UNORM16 and two SNORM16 values that separate one rounding from two all came out 1 ulp below the f32-first result: + 0xffaf gave 0x3bfd (not 0x3bfe), 0xffef gave 0x3bff (not 0x3c00), 0x7ff7 gave 0x3bff, and 0x8009 gave 0xbbff. + The translator now follows this (`Gen.d16_norm_f16`, `docs/design.md` "d16 and f16 format narrowing"). +- The f32 result (`buffer_load_format_x`) is the correctly rounded quotient for every value. The reciprocal multiply + matched only 130 of 256 UNORM8 values and 65,024 of 65,536 UNORM16 values. +- 16_FLOAT came back with its own bits for all 65,536 encodings, NaNs included. The high half of the d16_x VGPR was + kept. MUBUF matched MTBUF, and wave32 matched wave64, for every value. + +`tests/test_d16_format_probe.py` checks the rules against the #489 counts and the descriptor bits. It checks that +each value is staged once, and that the kernels assemble for gfx1031. A fake oracle plays the GPU to check the exit +codes. On a GFX10 GPU the test runs UNORM8 and checks the controls. + ### `v_fma_mix*` f16 rounding in nearest mode (`tools/fma_mix_probe.py`) `docs/design.md` leaves one f16 question open. In round-to-nearest mode, does `v_fma_mixlo_f16` / `v_fma_mixhi_f16` @@ -1023,8 +1085,8 @@ Results: | GPU | Driver | `translator` | `vulkan` | `hw` | |---|---|---|---|---| -| NVIDIA GeForce RTX 5060 (Blackwell), Windows 11 | 621.24 | double | double, 8 of 8 words | not AMD | -| AMD Radeon iGPU (RDNA2, gfx1036), Windows 11, HIP backend | 32.0.21044.64 | double | not run | **single**, 7 of 7 ties; control `0x4100` | +| NVIDIA GeForce RTX 5060 (Blackwell), Windows 11 | 621.24 | single | single, 8 of 8 words | not AMD | +| AMD Radeon iGPU (RDNA2, gfx1036), Windows 11, HIP backend | 32.0.21044.64 | single | single, 8 of 8 words | **single**, 7 of 7 ties; control `0x4100` | RDNA2 rounds once. Every tie input gives the single-rounded word (A `0x3c01`, B `0x3c01`, C `0xbc01`, D `0x0001`, E `0x7bff`, F `0x3c01`, G `0x3c01`), so the translator is one f16 ulp off on exactly these inputs (SHADER-135; the @@ -1035,6 +1097,9 @@ translator is not changed here). On the RTX 5060, a translator copy changed to u Measurement on AMD RDNA2 (gfx1036) confirmed single rounding across all 7 discriminating cases (finding 7079901079). Using `fma_mix_odd` produces the exact hardware single-rounded words in both nearest-even and toward-zero modes. +E `0x7bff`, F `0x3c01`, G `0x3c01`), which the translator produces across all 7 discriminating cases via +`fma_mix_odd` in both nearest-even and toward-zero modes (SHADER-297). On Vulkan, using `fma_mix_odd` matches the +exact single-rounded hardware words for all inputs. ### f16 output modifiers, clamp and `v_fma_mix*` operands on RDNA2 (SHADER-135) diff --git a/docs/testing.md b/docs/testing.md index ddf6b642c1..0c187fdef9 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -258,10 +258,9 @@ The GPU tools of `runtime/test/shaders` (`vk_compute_test`, `vk_harness`, ...) r |---|---|---| | Windows refuses to start freshly built test programs ("An Application Control policy has blocked this file"), and the runner stops with a traceback | Smart App Control on Windows 11 | Turn Smart App Control off for the run | | Validation errors without a VUID, or messages from a layer you didn't ask for | An implicit Vulkan layer from other software (Rockstar Social Club, ReShade, MangoHud, an overlay) | Set `VK_LOADER_LAYERS_DISABLE=~implicit~` | -| Validation errors that only your machine shows (e.g. `xbox_present`'s sRGB swapchain `STORAGE` message), with MSI Afterburner/RivaTuner or OBS installed | An overlay layer that hooks the swapchain: RivaTuner's `VK_LAYER_RTSS` adds `STORAGE` usage to it. On some setups it stays loaded even with `VK_LOADER_LAYERS_DISABLE=~implicit~` | Also set the layer's own switch: `DISABLE_RTSS_LAYER=1`, `DISABLE_VULKAN_OBS_CAPTURE=1` (OBS). Any other layer's switch is the `disable_environment` entry in its manifest (the JSON listed under `HKLM\SOFTWARE\Khronos\Vulkan\ImplicitLayers` or `HKCU\...`). `VK_LOADER_DEBUG=layer` prints the layers that were actually inserted | -| Validation errors without a VUID, or messages from a layer you didn't ask for | An implicit Vulkan layer from other software (Rockstar Social Club, ReShade, MangoHud, an overlay) | Set `VK_LOADER_LAYERS_DISABLE=~implicit~`. Note that third-party overlays (RivaTuner `VK_LAYER_RTSS` from MSI Afterburner, OBS `VK_LAYER_OBS_HOOK`) stay loaded under `~implicit~` and can add `VK_IMAGE_USAGE_STORAGE_BIT` to swapchains; set `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` to disable them | -| False validation failures in `xbox_present` or present tests (e.g. sRGB swapchain `STORAGE` messages) with MSI Afterburner or OBS running | Overlay Vulkan layers (RivaTuner `VK_LAYER_RTSS`, OBS `VK_LAYER_OBS_HOOK`) remain active under `VK_LOADER_LAYERS_DISABLE=~implicit~` and inject `VK_IMAGE_USAGE_STORAGE_BIT` into swapchains | Set `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` for validation runs | | Validation errors that only your machine shows (e.g. `xbox_present`'s sRGB swapchain `STORAGE` message), with MSI Afterburner/RivaTuner or OBS installed | An overlay layer that hooks the swapchain: while RivaTuner Statistics Server is running, its `VK_LAYER_RTSS` adds `STORAGE` usage to it. In an elevated (administrator) terminal the loader ignores `VK_LOADER_LAYERS_DISABLE` (`VK_LOADER_DEBUG=all` says so), so `~implicit~` leaves the layer in | Run the tests from a normal terminal, close the overlay application, or set the layer's own switch, which works elevated too: `DISABLE_RTSS_LAYER=1`, `DISABLE_VULKAN_OBS_CAPTURE=1` (OBS). Any other layer's switch is the `disable_environment` entry in its manifest (the JSON listed under `HKLM\SOFTWARE\Khronos\Vulkan\ImplicitLayers` or `HKCU\...`). `VK_LOADER_DEBUG=layer` prints the layers that were actually inserted | +| Validation errors without a VUID, or messages from a layer you didn't ask for | An implicit Vulkan layer from other software (Rockstar Social Club, ReShade, MangoHud, an overlay) | Set `VK_LOADER_LAYERS_DISABLE=~implicit~`. Overlays that hook the swapchain (RivaTuner `VK_LAYER_RTSS`, OBS `VK_LAYER_OBS_HOOK`) can stay loaded: see the next row | +| Validation errors that only your machine shows (e.g. `xbox_present`'s sRGB swapchain `STORAGE` message), with MSI Afterburner/RivaTuner or OBS installed | An overlay layer that hooks the swapchain: while RivaTuner Statistics Server is running, its `VK_LAYER_RTSS` adds `STORAGE` usage to it (OBS's `VK_LAYER_OBS_HOOK` injects `VK_IMAGE_USAGE_STORAGE_BIT` too). In an elevated (administrator) terminal the loader ignores `VK_LOADER_LAYERS_DISABLE` (`VK_LOADER_DEBUG=all` says so), so `~implicit~` leaves the layer in | Run the tests from a normal terminal, close the overlay application, or set the layer's own switch, which works elevated too: `DISABLE_RTSS_LAYER=1`, `DISABLE_VULKAN_OBS_CAPTURE=1` (OBS). Any other layer's switch is the `disable_environment` entry in its manifest (the JSON listed under `HKLM\SOFTWARE\Khronos\Vulkan\ImplicitLayers` or `HKCU\...`). `VK_LOADER_DEBUG=layer` prints the layers that were actually inserted | | `vk_sync_validation` fails with `LEONIDA_VK_VALIDATION=1` ("the write-after-write hazard was not reported") | Synchronization validation is off although the tests ask for it: an older layer, or a layer setting such as `VK_KHRONOS_VALIDATION_VALIDATE_SYNC=false` or a `vk_layer_settings.txt` that overrides it. Every other GPU test then reports "0 validation errors" without having been checked | Remove the override or update the Vulkan SDK, then rerun `ctest -R vk_sync_validation` until it passes | | Validation errors that only your machine shows (e.g. `xbox_present`'s sRGB swapchain `STORAGE` message), with MSI Afterburner/RivaTuner or OBS installed | An overlay layer that hooks the swapchain: while RivaTuner Statistics Server is running, its `VK_LAYER_RTSS` adds `STORAGE` usage to it. In an elevated (administrator) terminal the loader ignores `VK_LOADER_LAYERS_DISABLE` (`VK_LOADER_DEBUG=all` says so), so `~implicit~` leaves the layer in | Run the tests from a normal terminal, close the overlay application, or set the layer's own switch, which works elevated too: `DISABLE_RTSS_LAYER=1`, `DISABLE_VULKAN_OBS_CAPTURE=1` (OBS). Any other layer's switch is the `disable_environment` entry in its manifest (the JSON listed under `HKLM\SOFTWARE\Khronos\Vulkan\ImplicitLayers` or `HKCU\...`). `VK_LOADER_DEBUG=layer` prints the layers that were actually inserted | | Every test crashes inside `libnvidia-eglcore.so` | NVIDIA's 535 server driver (Ubuntu 24.04's default) | Use driver 615 or newer | diff --git a/docs/world_names.md b/docs/world_names.md index 80f5725833..bd0a83b0d7 100644 --- a/docs/world_names.md +++ b/docs/world_names.md @@ -67,7 +67,9 @@ formula is proven by every resolved entry. The windows above use only names that were already exported locally. The names of almost all the other archetypes are in `levels.rpf` itself: `tools/rpf9_names.py` lists the `name.#dr` and `name.#ft` strings of every -stream, and with that list as the dictionary nearly every placement resolves. Whole `levels.rpf`, one +stream. A full pass over the data area (76.15 GB, 5,255 s) inflates 1,116,073 zlib streams (98.32% of +compressed bytes) and finds 235,814 named streams / 318,266 unique names (267,463 `.#dr`, 50,803 `.#ft`); +with that list as the dictionary nearly every placement resolves. Whole `levels.rpf`, one `world_index.py --archetypes-out` run (23,532 placement maps and 1,670,435 entities: 3 maps and 7 entities fewer than the census in [world.md](world.md#how-many-are-there), which also joins the raw continuation page that 3 placement maps use and `world_index.py` does not; 228,681 distinct `archetypeName` hashes, one 64-bit key per hash, no conflicting keys, diff --git a/make_game.py b/make_game.py index cff1068e1c..b7fc47c08a 100644 --- a/make_game.py +++ b/make_game.py @@ -350,6 +350,17 @@ def default_out() -> str: return os.path.join(os.path.expanduser("~"), "Documents", "Leonida") +def icloud_default_notes() -> list: + """The log lines when default_out() left iCloud-synced Documents: why, and where a build made before this change + is, so its resumable work folder isn't silently left behind.""" + notes = ["iCloud syncs Documents on this Mac: building into ~/Leonida instead, so the game's files stay off iCloud"] + earlier = os.path.join(os.path.expanduser("~"), "Documents", "Leonida") + if os.path.isdir(earlier): + notes.append(f"an earlier build is in {earlier}: move it to {default_out()} to resume it there, " + f'or pass --out "{earlier}" to keep using it') + return notes + + # ---------------------------------------------------------------- preflight MIN_FREE_GB = {"shaders": 30, "assets": 300} @@ -694,7 +705,7 @@ def shaders(game: str, work: str, jobs: int, emulate: bool = False, keep_emulate drop(translated, shard_plan, disassembled) clear_shader_disassembly(work, disasm) py("shader_disasm.py", os.path.join(dxbc, "fssm"), "--out", disasm, "--mcpu", "gfx1013", "--jobs", jobs) - with open(disassembled, "w", encoding="utf-8") as f: + with open(disassembled, "w", encoding="utf-8", newline="\n") as f: f.write(signature + "\n") # The translation also depends on the translator's own files, so their digest is kept beside it. A folder without # it (from before the file existed), with an unreadable one or with another one is translated again; carving, unpacking and @@ -738,11 +749,11 @@ def shaders(game: str, work: str, jobs: int, emulate: bool = False, keep_emulate # a stop at any point then leaves either no index (translated again) or an index with the right mode and # digest, never a guessed one. rdna2spirv.py --merge writes index.json last, after the stubs. os.makedirs(spirv, exist_ok=True) - with open(mode_file, "w", encoding="utf-8") as f: + with open(mode_file, "w", encoding="utf-8", newline="\n") as f: f.write(want + "\n") - with open(flags_file, "w", encoding="utf-8") as f: + with open(flags_file, "w", encoding="utf-8", newline="\n") as f: f.write(want_flags + "\n") - with open(sources_file, "w", encoding="utf-8") as f: + with open(sources_file, "w", encoding="utf-8", newline="\n") as f: f.write(sources + "\n") translate(disasm, spirv, jobs, emulate=emulate, fallbacks=fallbacks) log("shaders: done") @@ -919,9 +930,9 @@ def translate(disasm: str, spirv: str, jobs: int, emulate: bool = False, # Parts from another --jobs would be merged in too, and parts from another mode, flags or translator are # wrong. They go before the new plan is written: a stop in between must not leave old parts under a new plan. for f in os.listdir(spirv): - if f.startswith("index.part") and f.endswith(".json"): + if (f.startswith("index.part") and f.endswith(".json")) or re.fullmatch(r"shard\d+\.json", f): os.remove(os.path.join(spirv, f)) - with open(plan_path, "w", encoding="utf-8") as f: + with open(plan_path, "w", encoding="utf-8", newline="\n") as f: json.dump(plan, f) todo = [i for i in range(jobs) if not os.path.isfile(os.path.join(spirv, f"index.part{i}.json"))] if len(todo) < jobs: @@ -1070,7 +1081,7 @@ def assets(game: str, work: str, wav: bool, jobs: int) -> None: def mark(path: str, what: str) -> None: """Write a step's completion marker; call it only after the step succeeded.""" - with open(path, "w", encoding="utf-8") as f: + with open(path, "w", encoding="utf-8", newline="\n") as f: f.write(f"{what} finished\n") @@ -1189,7 +1200,7 @@ def runtime(game: str, out: str, v: dict, runtime_build: str | None = None, jobs if not os.path.exists(os.path.join(out, os.path.basename(built))) or \ not os.path.samefile(built, os.path.join(out, os.path.basename(built))): shutil.copy2(built, out) - with open(os.path.join(out, "game_path.txt"), "w", encoding="utf-8") as f: + with open(os.path.join(out, "game_path.txt"), "w", encoding="utf-8", newline="\n") as f: f.write(os.path.abspath(game)) start = os.path.join(out, "gta6rt.exe") if os.name != "nt": @@ -1350,7 +1361,8 @@ def main() -> int: preflight(stages, work, a.wav, runtime_build, emulate=emulate, keep_emulated=keep_emulated, fallbacks=fallbacks, jobs=a.jobs) if not a.out and icloud_documents(): - log("iCloud syncs Documents on this Mac: building into ~/Leonida instead, so the game's files stay off iCloud") + for note in icloud_default_notes(): + log(note) log(f"building into {out} (work files in {work})") t0 = time.time() if "shaders" in stages: diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 2fb2c2fd4a..01e188e47e 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -857,7 +857,7 @@ if(TARGET Vulkan::Headers) ${_stubs_header} ID3D12GraphicsCommandList8 ID3D12CommandQueue ID3D12CommandAllocator ID3D12Fence1 ID3D12Device11 ID3D12DescriptorHeap ID3D12Heap ID3D12Resource ID3D12QueryHeap ID3D12RootSignature - ID3D12PipelineState ID3D12CommandSignature + ID3D12PipelineState ID3D12CommandSignature ID3D12PipelineLibrary1 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../tools/gen_d3d12_stubs.py ${LEONIDA_D3D12_HEADER} COMMENT "Generating D3D12 COM stubs" VERBATIM) @@ -1222,8 +1222,65 @@ if(TARGET Vulkan::Headers) target_compile_options(d3d12_m3_frame_test PRIVATE /W4 /permissive- /utf-8) add_test(NAME d3d12_m3_frame COMMAND d3d12_m3_frame_test) set_tests_properties(d3d12_m3_frame PROPERTIES SKIP_RETURN_CODE 77) + + # M4 (synthetic part): compute PSOs, a UAV table (structured and raw buffers, an R32_UINT storage image), an indirect + # dispatch from arguments a first dispatch wrote, and a copy queue that streams the input in and reads the results + # back across queue fences. cs_m4_fill.asm and cs_m4_indirect.asm go through the same build; build.py publishes + # their synthetic FSSM programs (the compute header and the words their "fssm-data" comments give), which the + # test wraps in shader containers. + set(LEONIDA_M4_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/m4_shaders) + set(LEONIDA_M4_FILES ${LEONIDA_M4_DIR}/spirv/index.json ${LEONIDA_M4_DIR}/fssm/cs_m4_fill.fssm + ${LEONIDA_M4_DIR}/fssm/cs_m4_indirect.fssm) + add_custom_command( + OUTPUT ${LEONIDA_M4_FILES} + COMMAND ${CMAKE_COMMAND} -E remove_directory ${LEONIDA_M4_DIR} + COMMAND ${CMAKE_COMMAND} -E env "LLVM_MC=${LEONIDA_LLVM_MC}" "LEONIDA_SPIRV_TOOLS=${LEONIDA_SPIRV_TOOLS_NATIVE}" + $ -I ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py + ${LEONIDA_M4_DIR} cs_m4_fill cs_m4_indirect + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py + ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/compute_fixture.py + ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/cs_m4_fill.asm + ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/cs_m4_indirect.asm + ${CMAKE_CURRENT_SOURCE_DIR}/../tools/rdna2spirv.py + COMMENT "Translating cs_m4_fill and cs_m4_indirect for the compute test" + VERBATIM) + add_executable(d3d12_m4_compute_test test/d3d12_m4_compute_test.cpp shims/d3d12_xs_device.cpp ${LEONIDA_M4_FILES}) + target_link_libraries(d3d12_m4_compute_test PRIVATE gta6rt_d3d12_com) + target_compile_definitions(d3d12_m4_compute_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX + LEONIDA_TEST_M4_DIR="${LEONIDA_M4_DIR}") + target_compile_options(d3d12_m4_compute_test PRIVATE /W4 /permissive- /utf-8) + add_test(NAME d3d12_m4_compute COMMAND d3d12_m4_compute_test) + set_tests_properties(d3d12_m4_compute PROPERTIES SKIP_RETURN_CODE 77) + + # Typed buffer UAVs and UAV counters: cs_buf_typed.asm writes typed views through V#s with a FORMAT, and + # cs_buf_counter.asm appends to and consumes from a structured view whose counter is the second V# of its slot; + # the test also compares typed-buffer and counter clears with the host runtime on the layer's adapter. + set(LEONIDA_BUFFER_UAV_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated/buffer_uav_shaders) + set(LEONIDA_BUFFER_UAV_FILES ${LEONIDA_BUFFER_UAV_DIR}/spirv/index.json + ${LEONIDA_BUFFER_UAV_DIR}/fssm/cs_buf_typed.fssm + ${LEONIDA_BUFFER_UAV_DIR}/fssm/cs_buf_counter.fssm) + add_custom_command( + OUTPUT ${LEONIDA_BUFFER_UAV_FILES} + COMMAND ${CMAKE_COMMAND} -E remove_directory ${LEONIDA_BUFFER_UAV_DIR} + COMMAND ${CMAKE_COMMAND} -E env "LLVM_MC=${LEONIDA_LLVM_MC}" "LEONIDA_SPIRV_TOOLS=${LEONIDA_SPIRV_TOOLS_NATIVE}" + $ -I ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py + ${LEONIDA_BUFFER_UAV_DIR} cs_buf_typed cs_buf_counter + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/build.py + ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/compute_fixture.py + ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/cs_buf_typed.asm + ${CMAKE_CURRENT_SOURCE_DIR}/test/shaders/cs_buf_counter.asm + ${CMAKE_CURRENT_SOURCE_DIR}/../tools/rdna2spirv.py + COMMENT "Translating cs_buf_typed and cs_buf_counter for the buffer UAV test" + VERBATIM) + add_executable(d3d12_buffer_uav_test test/d3d12_buffer_uav_test.cpp shims/d3d12_xs_device.cpp ${LEONIDA_BUFFER_UAV_FILES}) + target_link_libraries(d3d12_buffer_uav_test PRIVATE gta6rt_d3d12_com) + target_compile_definitions(d3d12_buffer_uav_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX + LEONIDA_TEST_BUFFER_UAV_DIR="${LEONIDA_BUFFER_UAV_DIR}") + target_compile_options(d3d12_buffer_uav_test PRIVATE /W4 /permissive- /utf-8) + add_test(NAME d3d12_buffer_uav COMMAND d3d12_buffer_uav_test) + set_tests_properties(d3d12_buffer_uav PROPERTIES SKIP_RETURN_CODE 77) else() - message(STATUS "llvm-mc (set LLVM_MC) or the SDK's spirv-as/spirv-val not found: d3d12_translated_draw_test, d3d12_m2_textured_test and d3d12_m3_frame_test are not built") + message(STATUS "llvm-mc (set LLVM_MC) or the SDK's spirv-as/spirv-val not found: d3d12_translated_draw_test, d3d12_m2_textured_test, d3d12_m3_frame_test, d3d12_m4_compute_test and d3d12_buffer_uav_test are not built") endif() # ID3D12Resource::GetHeapProperties and ID3D12DescriptorHeap::GetDesc (node masks, resolved heap flags) against the # host runtime and WARP; run explicitly on a Vulkan GPU. @@ -1379,6 +1436,16 @@ if(TARGET Vulkan::Headers) target_compile_options(d3d12_set0_compute_test PRIVATE /W4 /permissive- /utf-8) add_test(NAME d3d12_set0_compute COMMAND d3d12_set0_compute_test) set_tests_properties(d3d12_set0_compute PROPERTIES SKIP_RETURN_CODE 77) + add_executable(d3d12_pipeline_library_test test/d3d12_pipeline_library_test.cpp + ${LEONIDA_TEST_CS} ${LEONIDA_TEST_VS} ${LEONIDA_TEST_PS}) + target_link_libraries(d3d12_pipeline_library_test PRIVATE gta6rt_d3d12_com) + target_compile_definitions(d3d12_pipeline_library_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX + LEONIDA_TEST_CS_SPV="${LEONIDA_TEST_CS}" + LEONIDA_TEST_VS_SPV="${LEONIDA_TEST_VS}" + LEONIDA_TEST_PS_SPV="${LEONIDA_TEST_PS}") + target_compile_options(d3d12_pipeline_library_test PRIVATE /W4 /permissive- /utf-8) + add_test(NAME d3d12_pipeline_library COMMAND d3d12_pipeline_library_test) + set_tests_properties(d3d12_pipeline_library PROPERTIES SKIP_RETURN_CODE 77) else() message(STATUS "glslangValidator not found: d3d12_compute_test, d3d12_draw_test and d3d12_set0_compute_test are not built") endif() diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index 581bc0fa95..55c6f86a81 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp @@ -601,12 +601,17 @@ class GraphicsCommandList final cmd.argument_offset = argument_buffer_offset; cmd.count_buffer = count_buffer ? resource_id(count_buffer) : 0; cmd.count_offset = count_buffer ? count_buffer_offset : 0; + if (kind == leonida::IndirectKind::dispatch && max_command_count) { // the pipeline and root arguments a Dispatch would record + if (!compute_pipeline_ || !compute_.layout) return check(false); + cmd.pipeline = compute_pipeline_; + cmd.user_data = compute_.data; + } check(list_.execute_indirect(cmd)); } void STDMETHODCALLTYPE BuildRaytracingAccelerationStructure( - const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC* desc, UINT, - const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC*) override { + const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC* desc, UINT postbuild_count, + const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC* postbuild) override { if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE || !desc) return check(false); const auto& in = desc->Inputs; leonida::BuildAccelerationStructure cmd{}; @@ -660,7 +665,38 @@ class GraphicsCommandList final cmd.triangles.push_back(t); } } - check(list_.build_acceleration_structure(cmd)); + const std::uint64_t built = cmd.dst_va; + const bool recorded = list_.build_acceleration_structure(std::move(cmd)); + check(recorded); + if (!recorded) return; + // The postbuild values of the structure just built, after it (D3D12 orders them after the build). + for (UINT i = 0; postbuild && i < postbuild_count; ++i) { + leonida::AccelerationStructurePostbuild info{}; + info.dest_va = postbuild[i].DestBuffer; + info.type = static_cast(postbuild[i].InfoType); + info.sources = {built}; + const bool ok = list_.acceleration_structure_postbuild(std::move(info)); + check(ok); + if (!ok) return; + } + } + + void STDMETHODCALLTYPE EmitRaytracingAccelerationStructurePostbuildInfo( + const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC* desc, UINT count, + const D3D12_GPU_VIRTUAL_ADDRESS* sources) override { + if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE || !desc || !count || !sources) return check(false); + leonida::AccelerationStructurePostbuild info{}; + info.dest_va = desc->DestBuffer; + info.type = static_cast(desc->InfoType); + info.sources.assign(sources, sources + count); + check(list_.acceleration_structure_postbuild(std::move(info))); + } + + void STDMETHODCALLTYPE CopyRaytracingAccelerationStructure(D3D12_GPU_VIRTUAL_ADDRESS dest, + D3D12_GPU_VIRTUAL_ADDRESS source, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE mode) override { + if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE) return check(false); + check(list_.copy_acceleration_structure({dest, source, static_cast(mode)})); } static GraphicsCommandList* from(IUnknown* object) { return Child::from(object); } @@ -1261,7 +1297,8 @@ HRESULT create_command_list(D3D12_COMMAND_LIST_TYPE type, ID3D12CommandAllocator if (!command_allocator || command_allocator->type() != type) return E_INVALIDARG; // A list is created open, so the allocator must be free: E_INVALIDARG as on the PC runtime (D3D-51). if (command_allocator->recording()) return E_INVALIDARG; - if (type != D3D12_COMMAND_LIST_TYPE_DIRECT && type != D3D12_COMMAND_LIST_TYPE_BUNDLE) + if (type != D3D12_COMMAND_LIST_TYPE_DIRECT && type != D3D12_COMMAND_LIST_TYPE_BUNDLE && + type != D3D12_COMMAND_LIST_TYPE_COMPUTE && type != D3D12_COMMAND_LIST_TYPE_COPY) stub("create_command_list(non-direct type)"); auto* object = new GraphicsCommandList(type); // created open, as D3D12 does object->record_into(command_allocator); diff --git a/runtime/shims/d3d12_com.h b/runtime/shims/d3d12_com.h index 2e1f2d3c54..b3b397be08 100644 --- a/runtime/shims/d3d12_com.h +++ b/runtime/shims/d3d12_com.h @@ -273,6 +273,12 @@ inline constexpr UINT descriptor_size = 32; // ExecuteCommandLists returns void; this is what the last call on the queue did. leonida::ReplayResult last_execute_result(ID3D12CommandQueue* queue); +// True when the current thread or process token has SeIncreaseBasePriorityPrivilege enabled (or the test override +// forces it), which D3D12 requires for D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME. +bool has_global_realtime_privilege(); +// Test override for has_global_realtime_privilege(): -1 queries the token (default), 0 forces denied, 1 forces granted. +void set_global_realtime_privilege_override_for_test(int state); + // The front/back stencil references last recorded by ID3D12GraphicsCommandList8::OMSetFrontAndBackStencilRef on // `list`. The values are kept for the future pipeline path, which is what would apply them. False when `list` is // not one of this module's command lists. diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp index a8a14a316e..8f126de17e 100644 --- a/runtime/shims/d3d12_vulkan_device.cpp +++ b/runtime/shims/d3d12_vulkan_device.cpp @@ -15,15 +15,19 @@ #include "d3d12_xs_device.h" #include "dxgi_com.h" #include "../src/gfx10_descriptors.h" +#include "../src/uav_clear.h" #include "../src/vulkan_bindless.h" #include "../src/vulkan_memory.h" #include "../src/resource_tiling.h" #include "../src/shader_library.h" #include "../src/vulkan_present.h" #include "../src/vulkan_device_filter.h" +#include "../src/vulkan13_features.h" #include - +#ifdef _MSC_VER +#pragma comment(lib, "advapi32.lib") +#endif #include #include @@ -59,6 +63,8 @@ static_assert(sizeof(leonida::TargetView) <= kDescriptorSize); constexpr D3D_SHADER_MODEL kHighestShaderModel = D3D_SHADER_MODEL_6_0; constexpr D3D_ROOT_SIGNATURE_VERSION kHighestRootSignatureVersion = D3D_ROOT_SIGNATURE_VERSION_1_1; +std::atomic g_global_realtime_privilege_override{-1}; + void log_once(const char* what, int value) { static std::mutex mutex; static std::set> seen; @@ -381,12 +387,6 @@ struct DeviceState { // True when VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 lacks native STORAGE_IMAGE but mutable R32_UINT+{R32_UINT,E5B9G9R9} // is supported, so R9G9B9E5_SHAREDEXP UAV textures are backed by R32_UINT with separate storage/sampled views. bool r9g9b9e5_uav_emulated = false; - // D3D-219: VK_EXT_image_view_min_lod may select levels with minLodInteger = floor(minLod), the spec's - // "alternative", while D3D12's ResourceMinLODClamp is fractional. Intel's integrated GPUs on Windows do: a 0.75 - // clamp sampled at LOD 0 with point mip filtering reads mip 0 (UHD 770 101.7092, Arrow Lake Xe-LPG; #1015). - // bind_image gives such a driver the clamp rounded to the nearest level, which point mip filtering selects - // exactly. LEONIDA_MIN_LOD_INTEGER=1 or 0 forces it either way. - bool min_lod_integer = false; // Cached physical-device no-attachment sample counts for D3D12_OPTIONS19. UINT no_output_sample_counts = 0; @@ -796,9 +796,6 @@ struct DeviceState { log_once("SRV requires VK_EXT_image_view_min_lod; first mip", int(image.first_mip)); return false; } - // A driver that floors the clamp (min_lod_integer) gets the level point mip filtering picks: - // nearest(d') = ceil(d' + 0.5) - 1, the spec's preferred rounding. It stays within the mip range. - if (min_lod_integer) clamp.minLod = std::ceil(clamp.minLod + 0.5f) - 1.0f; clamp.pNext = view_info.pNext; view_info.pNext = &clamp; } @@ -1069,6 +1066,21 @@ const char* heap_properties_refusal(const D3D12_HEAP_PROPERTIES& heap) { return nullptr; } +// Why the host would refuse this CreateHeap/CreateHeap1 description, or null if these checks pass (D3D-238). A probe +// on an RX 5700 and WARP refuses an alignment other than 0, 64 KiB and 4 MiB, the heap properties above (a type of 0, +// a custom heap without a CPU page property), and a heap that denies buffers and both kinds of texture. +const char* heap_desc_refusal(const D3D12_HEAP_DESC& desc) { + if (!desc.SizeInBytes) return "zero size"; + if (desc.Alignment && desc.Alignment != D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT && + desc.Alignment != D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT) + return "alignment (0, 64 KiB or 4 MiB)"; + if (const char* why = heap_properties_refusal(desc.Properties)) return why; + constexpr UINT deny_all = D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | + D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES; + if ((UINT(desc.Flags) & deny_all) == deny_all) return "heap flags denying every resource kind"; + return nullptr; +} + // Why the host would refuse this committed resource, or null if these checks pass. The flag and format tables were // measured on an RX 9070 XT, an integrated Radeon and WARP, which agree on all of them. Cross-adapter resources // (valid there only as a row-major texture on a SHARED | SHARED_CROSS_ADAPTER heap) are refused: this layer has no @@ -2612,6 +2624,99 @@ struct TextureView { float min_lod = 0.0f; }; +// In-memory pipeline library (docs/d3d12_vulkan.md sections 3.6 and 4). D3D12 cached blobs are driver-specific +// and ignored across runs; Serialize writes a versioned header so CreatePipelineLibrary recognizes our own blobs +// and returns D3D12_ERROR_DRIVER_VERSION_MISMATCH for foreign or corrupt ones. +class PipelineLibrary final + : public Child { +public: + // {6e2a9d41-7b5f-4c83-8e14-2a9d6f3c5b10} + static constexpr GUID kTag{0x6e2a9d41, 0x7b5f, 0x4c83, {0x8e, 0x14, 0x2a, 0x9d, 0x6f, 0x3c, 0x5b, 0x10}}; + + struct Header { + std::uint32_t magic; + std::uint32_t version; + std::uint32_t count; + std::uint32_t reserved; + }; + static constexpr std::uint32_t kMagic = 0x314C504Cu; // "LPL1" + static constexpr std::uint32_t kVersion = 1; + + ~PipelineLibrary() override { + std::lock_guard lock(mutex_); + for (auto& [name, pso] : entries_) + if (pso) pso->Release(); + entries_.clear(); + } + + static bool valid_blob(const void* data, SIZE_T size) { + if (!data || size < sizeof(Header)) return false; + Header h{}; + std::memcpy(&h, data, sizeof(h)); + return h.magic == kMagic && h.version == kVersion && h.reserved == 0; + } + + HRESULT STDMETHODCALLTYPE StorePipeline(LPCWSTR name, ID3D12PipelineState* pipeline) override { + if (!name || !*name || !pipeline) return E_INVALIDARG; + if (!PipelineState::from(pipeline)) return E_INVALIDARG; + std::lock_guard lock(mutex_); + auto [it, inserted] = entries_.emplace(name, pipeline); + if (!inserted) return E_INVALIDARG; + pipeline->AddRef(); + return S_OK; + } + + HRESULT STDMETHODCALLTYPE LoadGraphicsPipeline(LPCWSTR name, const D3D12_GRAPHICS_PIPELINE_STATE_DESC* desc, + REFIID riid, void** out) override { + if (!out) return E_POINTER; + *out = nullptr; + if (!name || !*name || !desc) return E_INVALIDARG; + return load_entry(name, false, true, riid, out); + } + + HRESULT STDMETHODCALLTYPE LoadComputePipeline(LPCWSTR name, const D3D12_COMPUTE_PIPELINE_STATE_DESC* desc, + REFIID riid, void** out) override { + if (!out) return E_POINTER; + *out = nullptr; + if (!name || !*name || !desc) return E_INVALIDARG; + return load_entry(name, true, false, riid, out); + } + + HRESULT STDMETHODCALLTYPE LoadPipeline(LPCWSTR name, const D3D12_PIPELINE_STATE_STREAM_DESC* desc, + REFIID riid, void** out) override { + if (!out) return E_POINTER; + *out = nullptr; + if (!name || !*name || !desc || !desc->SizeInBytes || !desc->pPipelineStateSubobjectStream) return E_INVALIDARG; + return load_entry(name, false, false, riid, out); + } + + SIZE_T STDMETHODCALLTYPE GetSerializedSize() override { return sizeof(Header); } + + HRESULT STDMETHODCALLTYPE Serialize(void* data, SIZE_T size) override { + if (!data || size < sizeof(Header)) return E_INVALIDARG; + std::lock_guard lock(mutex_); + const Header h{kMagic, kVersion, static_cast(entries_.size()), 0}; + std::memcpy(data, &h, sizeof(h)); + return S_OK; + } + +private: + HRESULT load_entry(LPCWSTR name, bool require_compute, bool require_graphics, REFIID riid, void** out) { + std::lock_guard lock(mutex_); + const auto it = entries_.find(name); + if (it == entries_.end()) return E_INVALIDARG; + PipelineState* ps = PipelineState::from(it->second); + if (!ps) return E_INVALIDARG; + if (require_compute && !ps->compute()) return E_INVALIDARG; + if (require_graphics && !ps->graphics()) return E_INVALIDARG; + return it->second->QueryInterface(riid, out); + } + + std::mutex mutex_; + std::unordered_map entries_; +}; + // The T# of a view: what the shader gets to know about it, in the structure the console's shaders read. // False (with a log) for a view set 0 cannot show yet. bool image_descriptor(const Resource& resource, const TextureView& view, leonida::gfx10::Image& out) { @@ -2642,7 +2747,7 @@ bool image_descriptor(const Resource& resource, const TextureView& view, leonida const auto dimension = line ? D3D12_RESOURCE_DIMENSION_TEXTURE1D : view.type == g::ImageType::image_3d ? D3D12_RESOURCE_DIMENSION_TEXTURE3D : D3D12_RESOURCE_DIMENSION_TEXTURE2D; - if (desc.Dimension != dimension || (line && desc.DepthOrArraySize != 1) || msaa != (desc.SampleDesc.Count > 1)) { + if (desc.Dimension != dimension || (line && view.layer_count != 1) || msaa != (desc.SampleDesc.Count > 1)) { log_once("view type incompatible with texture dimension or sample count; view type", int(view.type)); return false; } @@ -3046,15 +3151,6 @@ class Device final VkPhysicalDeviceProperties properties{}; device_properties(info.physical, &properties); state_.max_sampler_lod_bias = properties.limits.maxSamplerLodBias; - { - constexpr std::uint32_t kIntelVendorId = 0x8086; - state_.min_lod_integer = properties.vendorID == kIntelVendorId && - properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU; - char text[4] = {}; - size_t length = 0; - if (getenv_s(&length, text, "LEONIDA_MIN_LOD_INTEGER") == 0 && length > 1) - state_.min_lod_integer = text[0] != '0'; - } std::uint32_t family_count = 0; queue_families(info.physical, &family_count, nullptr); std::vector families(family_count); @@ -3396,8 +3492,8 @@ class Device final log_once("CreateCommandQueue refused (type, priority, flags or node mask), type", desc->Type); return d3d12_trace::result(method, E_INVALIDARG); } - // Global realtime priority needs a privilege the host grants only on request; without it, this answer. - if (desc->Priority == D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME) { + // Global realtime priority needs SeIncreaseBasePriorityPrivilege enabled in the token; without it, this answer. + if (desc->Priority == D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME && !has_global_realtime_privilege()) { log_once("CreateCommandQueue refused (global realtime priority), type", desc->Type); return d3d12_trace::result(method, DXGI_ERROR_ACCESS_DENIED); } @@ -3722,6 +3818,19 @@ class Device final return hand_out(pipeline, riid, out); } + // Device1: in-memory pipeline library (docs/d3d12_vulkan.md sections 3.6 and 4). + HRESULT STDMETHODCALLTYPE CreatePipelineLibrary(const void* blob, SIZE_T size, REFIID riid, void** out) override { + constexpr auto method = "ID3D12Device1::CreatePipelineLibrary"; + if (out) *out = nullptr; + if (size > 0 && !blob) return d3d12_trace::result(method, E_INVALIDARG); + if (size > 0 && !PipelineLibrary::valid_blob(blob, size)) + return d3d12_trace::result(method, D3D12_ERROR_DRIVER_VERSION_MISMATCH); + if (!out) return d3d12_trace::result(method, S_FALSE); + auto* lib = new PipelineLibrary(); + lib->attach_device(identity()); + return d3d12_trace::result(method, hand_out(lib, riid, out)); + } + UINT STDMETHODCALLTYPE GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE) override { return kDescriptorSize; } @@ -3780,13 +3889,16 @@ class Device final r->allows_view_format(vulkan_format(requested, false).format)); if (typeless_rgba8 || (requested != rd.Format && listed && rd.Format == DXGI_FORMAT_R8G8B8A8_UNORM)) { - const bool plain = desc && desc->ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2D; - const bool array = desc && desc->ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DARRAY; + const bool msaa = rd.SampleDesc.Count > 1; + const bool plain = !msaa && desc && desc->ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2D; + const bool array = !msaa && desc && desc->ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DARRAY; + const bool ms = msaa && desc && desc->ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DMS; + const bool ms_array = msaa && desc && desc->ViewDimension == D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY; const UINT plane = plain ? desc->Texture2D.PlaneSlice : array ? desc->Texture2DArray.PlaneSlice : 0; // Subtraction keeps malformed layer ranges from overflowing during validation. - if ((!plain && !array) || rd.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D || - rd.SampleDesc.Count != 1 || plane || !view.resource || view.mip >= rd.MipLevels || + if ((!plain && !array && !ms && !ms_array) || rd.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D || + plane || !view.resource || view.mip >= rd.MipLevels || !view.layer_count || view.first_layer >= rd.DepthOrArraySize || view.layer_count > rd.DepthOrArraySize - view.first_layer || !(rd.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET)) { @@ -3920,9 +4032,10 @@ class Device final TextureView view{}; if (!desc) { const bool array = r->desc().DepthOrArraySize > 1; - if (r->desc().Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE1D && !array) + if (r->desc().Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE1D && !array) { view.type = ImageType::image_1d; - else if (r->desc().Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D) + view.layer_count = 1; + } else if (r->desc().Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D) view.type = ImageType::image_3d; else if (r->desc().SampleDesc.Count > 1) view.type = array ? ImageType::image_2d_msaa_array : ImageType::image_2d_msaa; @@ -3936,6 +4049,7 @@ class Device final view.type = ImageType::image_1d; view.first_mip = desc->Texture1D.MostDetailedMip; view.mip_count = desc->Texture1D.MipLevels; + view.layer_count = 1; view.min_lod = desc->Texture1D.ResourceMinLODClamp; break; case D3D12_SRV_DIMENSION_TEXTURE3D: @@ -3992,6 +4106,95 @@ class Device final write_image_descriptor(*r, view, destination, false); } + // An unordered-access view of a buffer is a V# in the slot (docs section 3.4): the shader loads those four dwords + // through its descriptor table and reaches the bytes by the console VA in them. A structured view (format + // UNKNOWN and a stride) is `stride` and a record count, a raw one (R32_TYPELESS with the RAW flag) is a byte count, + // a typed one (any other format) is the format's GFX10_FORMAT code with the element size as the stride and an + // element count: the V# a buffer_load_format / buffer_store_format / buffer_atomic reads (OOB_SELECT 1, so the + // index is checked against NUM_RECORDS, docs/buffer_bounds.md). A slot left as zeros is a null descriptor. + // A UAV counter (docs section 3.4, "UAV counters") is a second, raw V# of 4 bytes in the slot's upper 16 bytes: the + // counter resource's address plus CounterOffsetInBytes. Append and consume are atomics a shader does on it. + void write_buffer_uav(ID3D12Resource* resource, ID3D12Resource* counter, const D3D12_UNORDERED_ACCESS_VIEW_DESC* desc, + D3D12_CPU_DESCRIPTOR_HANDLE destination) { + namespace g = leonida::gfx10; + const D3D12_RESOURCE_DESC& rd = Resource::from(resource)->desc(); + if (!(rd.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) { + log_once("unordered-access view of a buffer created without ALLOW_UNORDERED_ACCESS; flags", int(rd.Flags)); + return; + } + if (!desc || desc->ViewDimension != D3D12_UAV_DIMENSION_BUFFER) { + log_once("unordered-access view of a buffer needs a buffer view description; dimension", + desc ? int(desc->ViewDimension) : -1); + return; + } + const D3D12_BUFFER_UAV& view = desc->Buffer; + const bool structured = desc->Format == DXGI_FORMAT_UNKNOWN; + const bool raw = desc->Format == DXGI_FORMAT_R32_TYPELESS && (view.Flags & D3D12_BUFFER_UAV_FLAG_RAW); + const bool typed = !structured && !raw; + std::uint32_t format_code = 0, element_bytes = 0; + g::Swizzle channels = g::identity_swizzle; + if (typed) { + // D3D12: a typed view has no RAW flag; its format is one of the typed-UAV formats the layer can name. + const Format mapped = vulkan_format(desc->Format, false); + const auto* layout = mapped.format != VK_FORMAT_UNDEFINED && !mapped.typeless && !mapped.rgb96 && + !(view.Flags & D3D12_BUFFER_UAV_FLAG_RAW) + ? leonida::uav_clear::layout(mapped.format) + : nullptr; + format_code = layout ? g::format_from_vulkan(mapped.format) : 0; + if (!format_code || format_code >= 128) { // the V#'s FORMAT is 7 bits + log_once("typed buffer unordered-access view format not supported; format", int(desc->Format)); + return; + } + element_bytes = layout->bytes; + channels = g::format_swizzle(mapped.format); + } + const UINT64 unit = structured ? view.StructureByteStride : typed ? element_bytes : 4; + if (!unit || unit > 0x3fff || view.FirstElement > rd.Width / unit || + (UINT64(view.FirstElement) + view.NumElements) > rd.Width / unit || + UINT64(view.NumElements) * (structured || typed ? 1 : 4) > ~0u) { + log_once("unordered-access view of a buffer outside the resource or with a bad stride; elements", + int(view.NumElements)); + return; + } + // D3D12: a counter belongs to a structured view and sits in a buffer that allows unordered access, 4096-byte + // aligned with room for its 4 bytes; with no counter resource the offset is 0. + if (counter || view.CounterOffsetInBytes) { + const Resource* c = counter ? Resource::from(counter) : nullptr; + const bool valid = c && !c->image() && structured && + (c->desc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) && + !(view.CounterOffsetInBytes % D3D12_UAV_COUNTER_PLACEMENT_ALIGNMENT) && + UINT64(view.CounterOffsetInBytes) + 4 <= c->desc().Width; + if (!valid) { + log_once("unordered-access view counter refused (a structured view, a buffer that allows unordered " + "access, a 4096-aligned offset inside it); offset", + int(view.CounterOffsetInBytes)); + return; + } + } + const UINT64 va = resource->GetGPUVirtualAddress(); + const UINT64 counter_va = counter ? counter->GetGPUVirtualAddress() : 0; + if (!va || (counter && !counter_va)) return; + g::Buffer buffer{}; + buffer.address = va + view.FirstElement * unit; + buffer.stride = structured || typed ? std::uint32_t(unit) : 0; + buffer.num_records = std::uint32_t(structured || typed ? view.NumElements : UINT64(view.NumElements) * 4); + buffer.format = format_code; + buffer.swizzle = channels; + buffer.oob_select = typed ? g::OobSelect::structured + : structured ? g::OobSelect::structured_with_offset : g::OobSelect::raw; + const g::BufferWords words = g::encode(buffer); + std::memcpy(reinterpret_cast(destination.ptr), words.data(), sizeof(words)); + if (counter) { + g::Buffer counter_buffer{}; + counter_buffer.address = counter_va + view.CounterOffsetInBytes; + counter_buffer.num_records = 4; + counter_buffer.oob_select = g::OobSelect::raw; + const g::BufferWords counter_words = g::encode(counter_buffer); + std::memcpy(reinterpret_cast(destination.ptr) + sizeof(words), counter_words.data(), + sizeof(counter_words)); + } + } + // An unordered-access view of a texture is a T# too, of one mip; set 0 also holds it as a storage image. void STDMETHODCALLTYPE CreateUnorderedAccessView(ID3D12Resource* resource, ID3D12Resource* counter, const D3D12_UNORDERED_ACCESS_VIEW_DESC* desc, @@ -4004,7 +4207,11 @@ class Device final if (resource) stub("ID3D12Device::CreateUnorderedAccessView(resource from another device)"); return; } - if (!r->image() || counter) return stub("ID3D12Device::CreateUnorderedAccessView(buffer)"); + if (!r->image()) return write_buffer_uav(resource, counter, desc, destination); + if (counter) { + log_once("unordered-access view of a texture with a counter resource; dimension", int(r->desc().Dimension)); + return; + } if (!(r->desc().Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)) { log_once("unordered-access view of a texture created without ALLOW_UNORDERED_ACCESS; flags", int(r->desc().Flags)); @@ -4040,6 +4247,7 @@ class Device final return; } write_image_descriptor(*r, view, destination, true); + state_.context->note_storage_image(r->id()); } // A sampler is an S# in the first 16 bytes of the slot; the shader finds the sampler by those four dwords. @@ -4273,7 +4481,11 @@ class Device final // 64 KiB-aligned offset is simply that offset into the arena, and its console VA is the heap's place plus it. HRESULT STDMETHODCALLTYPE CreateHeap(const D3D12_HEAP_DESC* desc, REFIID riid, void** out) override { if (out) *out = nullptr; - if (!desc || !desc->SizeInBytes) return E_INVALIDARG; + if (!desc) return E_INVALIDARG; + if (const char* why = heap_desc_refusal(*desc)) { + log_once((std::string("CreateHeap refused (") + why + "), heap type").c_str(), int(desc->Properties.Type)); + return E_INVALIDARG; + } if (!state_.arena.mapped) { log_once("heaps need the GPU address arena (bufferDeviceAddress); heap size in KiB:", int(desc->SizeInBytes / 1024)); @@ -4293,6 +4505,18 @@ class Device final return hand_out(heap, riid, out); } + // Device4: CreateHeap with a protected session, which is refused as CreateCommittedResource1 refuses one. The host + // gives the same answers as CreateHeap for the D3D-238 descriptions. + HRESULT STDMETHODCALLTYPE CreateHeap1(const D3D12_HEAP_DESC* desc, ID3D12ProtectedResourceSession* session, + REFIID riid, void** out) override { + if (out) *out = nullptr; + if (session) { + log_once("protected resource session refused (not supported) by CreateHeap1", 1); + return E_INVALIDARG; + } + return CreateHeap(desc, riid, out); + } + HRESULT STDMETHODCALLTYPE CreatePlacedResource(ID3D12Heap* heap_interface, UINT64 heap_offset, const D3D12_RESOURCE_DESC* desc, D3D12_RESOURCE_STATES, const D3D12_CLEAR_VALUE*, REFIID riid, void** out) override { @@ -4347,18 +4571,22 @@ class Device final const bool tiled = is_tiled_layout(desc->Layout); const bool msaa = desc->SampleDesc.Count > 1; if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) { + if (heap->flags() & D3D12_HEAP_FLAG_DENY_BUFFERS) return E_INVALIDARG; if (desc->Layout != D3D12_TEXTURE_LAYOUT_ROW_MAJOR) return E_INVALIDARG; if (desc->Width > heap->bytes() || heap_offset > heap->bytes() - desc->Width) return E_INVALIDARG; } else { if (heap->properties().Type == D3D12_HEAP_TYPE_UPLOAD || heap->properties().Type == D3D12_HEAP_TYPE_READBACK) return E_INVALIDARG; + const bool rt_ds = (desc->Flags & (D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET | + D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL)) != 0; + if (rt_ds && (heap->flags() & D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES)) return E_INVALIDARG; + if (!rt_ds && (heap->flags() & D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES)) return E_INVALIDARG; if (tiled || msaa) { if (tiled && desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D && desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D) return E_INVALIDARG; if (msaa && desc->Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D) return E_INVALIDARG; - if (msaa && (heap->flags() & D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES)) return E_INVALIDARG; const D3D12_RESOURCE_ALLOCATION_INFO alloc = allocation(*desc); if (alloc.SizeInBytes == UINT64_MAX || heap->alignment() < alloc.Alignment || heap_offset % alloc.Alignment || alloc.SizeInBytes > heap->bytes() || @@ -5775,7 +6003,8 @@ HRESULT create_dxgi_factory(ID3D12Device* device, REFIID riid, void** out) { i.queue_family, riid, out); } -// Creates its own Vulkan 1.3 instance and device. LEONIDA_VK_VALIDATION=1 adds VK_LAYER_KHRONOS_validation. +// Creates its own Vulkan instance and a Vulkan 1.3 device, or a 1.2 device with VK_KHR_dynamic_rendering and +// VK_KHR_synchronization2 (vulkan13_features.h). LEONIDA_VK_VALIDATION=1 adds VK_LAYER_KHRONOS_validation. HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { if (!out) return E_POINTER; *out = nullptr; @@ -5888,22 +6117,21 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { bool chosen_bc = false; VkPhysicalDeviceFeatures chosen_features{}; VkPhysicalDeviceVulkan12Features chosen12{}; - VkPhysicalDeviceVulkan13Features chosen13{}; bool chosen_draw_params = false; + leonida::Vulkan13Features v13, candidate13; for (VkPhysicalDevice candidate : physicals) { VkPhysicalDeviceProperties props{}; vkGetPhysicalDeviceProperties(candidate, &props); - if (props.apiVersion < VK_API_VERSION_1_3 || !leonida::vulkan_device_wanted(props.deviceName)) continue; - VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; - VkPhysicalDeviceVulkan11Features f11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &f13}; + if (!leonida::vulkan_device_wanted(props.deviceName)) continue; + candidate13.query(candidate, props.apiVersion, vkGetPhysicalDeviceFeatures2, vkEnumerateDeviceExtensionProperties); + if (!candidate13.usable()) continue; + VkPhysicalDeviceVulkan11Features f11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES}; VkPhysicalDeviceVulkan12Features f12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &f11}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &f12}; vkGetPhysicalDeviceFeatures2(candidate, &features); const bool bc = features.features.textureCompressionBC; const bool draw_params = f11.shaderDrawParameters; - if (!f13.dynamicRendering || !f13.synchronization2 || !f12.timelineSemaphore || - !f12.separateDepthStencilLayouts || !f12.bufferDeviceAddress) - continue; + if (!f12.timelineSemaphore || !f12.separateDepthStencilLayouts || !f12.bufferDeviceAddress) continue; std::uint32_t family_count = 0; vkGetPhysicalDeviceQueueFamilyProperties(candidate, &family_count, nullptr); std::vector families(family_count); @@ -5917,18 +6145,22 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { chosen_bc = bc; chosen_features = features.features; chosen12 = f12; - chosen13 = f13; chosen_draw_params = draw_params; + v13.choose(candidate13); } break; } } if (!info.physical) return fail(leonida::vulkan_device_filter().empty() - ? "no Vulkan 1.3 GPU with dynamicRendering, synchronization2, timelineSemaphore and " - "separateDepthStencilLayouts" - : "no GPU named by LEONIDA_VK_DEVICE has Vulkan 1.3 with dynamicRendering, synchronization2, " - "timelineSemaphore and separateDepthStencilLayouts"); + ? "no Vulkan 1.3 GPU (or 1.2 with VK_KHR_dynamic_rendering and VK_KHR_synchronization2) with " + "dynamicRendering, synchronization2, timelineSemaphore and separateDepthStencilLayouts" + : "no GPU named by LEONIDA_VK_DEVICE has Vulkan 1.3 (or 1.2 with VK_KHR_dynamic_rendering and " + "VK_KHR_synchronization2) with dynamicRendering, synchronization2, timelineSemaphore and " + "separateDepthStencilLayouts"); + if (!v13.core) + std::fprintf(stderr, "[rt] d3d12: Vulkan 1.2 device: dynamicRendering and synchronization2 through their KHR " + "extensions\n"); // VK_EXT_conditional_rendering for SetPredication, VK_KHR_swapchain for DXGI presentation, and optional // VK_KHR_acceleration_structure + VK_KHR_ray_query for hardware BVH builds (BLAS + TLAS). @@ -5998,17 +6230,13 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { ext_chain = &enable_conditional; } - VkPhysicalDeviceVulkan13Features enable13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES, ext_chain}; - enable13.dynamicRendering = VK_TRUE; - enable13.synchronization2 = VK_TRUE; // Subgroup size control: a pipeline stage asks for the size its shader was translated for (src/subgroup_size.h). - enable13.subgroupSizeControl = chosen13.subgroupSizeControl; - enable13.computeFullSubgroups = chosen13.computeFullSubgroups; - leonida::query_subgroup_size_caps(vkGetPhysicalDeviceProperties2, info.physical, chosen13.subgroupSizeControl, - chosen13.computeFullSubgroups, info.subgroup); + leonida::query_subgroup_size_caps(vkGetPhysicalDeviceProperties2, info.physical, v13.subgroup_size_control, + v13.compute_full_subgroups, info.subgroup); // Translated vertex shaders read BaseVertex / BaseInstance (SPIR-V DrawParameters) to give v0 / v3 the // hardware's zero-based vertex and instance ids (docs/design.md, Inputs and outputs). - VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &enable13}; + VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, + v13.enable(ext_chain)}; enable11.shaderDrawParameters = chosen_draw_params ? VK_TRUE : VK_FALSE; if (!chosen_draw_params) std::fprintf(stderr, "[rt] d3d12: the GPU has no shaderDrawParameters\n"); VkPhysicalDeviceVulkan12Features enable12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &enable11}; @@ -6081,8 +6309,8 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { vkGetPhysicalDeviceFeatures2(info.physical, &query); info.image_view_min_lod = min_lod.minLod == VK_TRUE; if (info.image_view_min_lod) { - min_lod.pNext = enable13.pNext; - enable13.pNext = &min_lod; + min_lod.pNext = *v13.next(); + *v13.next() = &min_lod; } } VkPhysicalDeviceHostImageCopyFeaturesEXT host_copy{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT}; @@ -6093,8 +6321,8 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { const char* host_image_copy_name = VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME; info.host_image_copy = has_host_image_copy && host_copy.hostImageCopy; if (info.host_image_copy) { - host_copy.pNext = enable13.pNext; // after the conditional rendering features, if any - enable13.pNext = &host_copy; + host_copy.pNext = *v13.next(); // after the conditional rendering features, if any + *v13.next() = &host_copy; } else { std::fprintf(stderr, "[rt] d3d12: no VK_EXT_host_image_copy; CPU texture copies use a staging submit\n"); } @@ -6111,8 +6339,8 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { vkGetPhysicalDeviceFeatures2(info.physical, &query); info.shader_fma = shader_fma.shaderFmaFloat32 == VK_TRUE; if (info.shader_fma) { - shader_fma.pNext = enable13.pNext; - enable13.pNext = &shader_fma; + shader_fma.pNext = *v13.next(); + *v13.next() = &shader_fma; } } #endif @@ -6164,8 +6392,8 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { VkPhysicalDeviceFeatures2 query{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &swapchain_m1}; vkGetPhysicalDeviceFeatures2(info.physical, &query); if (swapchain_m1.swapchainMaintenance1 == VK_TRUE) { - swapchain_m1.pNext = enable13.pNext; - enable13.pNext = &swapchain_m1; + swapchain_m1.pNext = *v13.next(); + *v13.next() = &swapchain_m1; } else { swapchain_m1_name = nullptr; } @@ -6179,6 +6407,7 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { device_info.pQueueCreateInfos = &queue_info; device_info.pEnabledFeatures = &enable; std::vector device_extensions; + v13.add_extensions(device_extensions); if (info.image_view_min_lod) device_extensions.push_back(VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME); if (info.conditional_rendering) device_extensions.push_back(conditional_extension); if (info.host_image_copy) device_extensions.push_back(host_image_copy_name); @@ -6232,4 +6461,29 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { return hand_out(device, riid, out); } +bool has_global_realtime_privilege() { + const int override_state = g_global_realtime_privilege_override.load(std::memory_order_relaxed); + if (override_state >= 0) return override_state != 0; + HANDLE token = nullptr; + if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE, &token) && + !OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) + return false; + LUID luid{}; + BOOL enabled = FALSE; + if (LookupPrivilegeValueW(nullptr, L"SeIncreaseBasePriorityPrivilege", &luid)) { + PRIVILEGE_SET set{}; + set.PrivilegeCount = 1; + set.Control = PRIVILEGE_SET_ALL_NECESSARY; + set.Privilege[0].Luid = luid; + set.Privilege[0].Attributes = SE_PRIVILEGE_ENABLED; + if (!PrivilegeCheck(token, &set, &enabled)) enabled = FALSE; + } + CloseHandle(token); + return enabled != FALSE; +} + +void set_global_realtime_privilege_override_for_test(int state) { + g_global_realtime_privilege_override.store(state, std::memory_order_relaxed); +} + } // namespace rt::d3d12 diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp index c4a7530c4c..caf09cee71 100644 --- a/runtime/shims/dxgi_com.cpp +++ b/runtime/shims/dxgi_com.cpp @@ -29,9 +29,7 @@ bool valid_flip_buffer_count(UINT count) { VkFormat dxgi_to_vk_format(DXGI_FORMAT fmt) { switch (fmt) { case DXGI_FORMAT_B8G8R8A8_UNORM: return VK_FORMAT_B8G8R8A8_UNORM; - case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: return VK_FORMAT_B8G8R8A8_SRGB; case DXGI_FORMAT_R8G8B8A8_UNORM: return VK_FORMAT_R8G8B8A8_UNORM; - case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: return VK_FORMAT_R8G8B8A8_SRGB; case DXGI_FORMAT_R10G10B10A2_UNORM: return VK_FORMAT_A2B10G10R10_UNORM_PACK32; case DXGI_FORMAT_R16G16B16A16_FLOAT: return VK_FORMAT_R16G16B16A16_SFLOAT; default: return VK_FORMAT_UNDEFINED; @@ -126,17 +124,12 @@ class SwapChain final : public IDXGISwapChain3 { if (parent_) parent_->Release(); } - bool init(HWND hwnd, const DXGI_SWAP_CHAIN_DESC1& desc) { + bool init(HWND hwnd, const DXGI_SWAP_CHAIN_DESC1& desc, VkFormat vk_fmt) { hwnd_ = hwnd; flags_ = desc.Flags; const VkExtent2D size = size_or_client(desc.Width, desc.Height, {256u, 256u}); const std::uint32_t w = size.width; const std::uint32_t h = size.height; - VkFormat vk_fmt = VK_FORMAT_UNDEFINED; - if (desc.Format != DXGI_FORMAT_UNKNOWN) { - vk_fmt = dxgi_to_vk_format(desc.Format); - if (vk_fmt == VK_FORMAT_UNDEFINED) return false; - } const bool allow_tearing = (flags_ & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) != 0; if (!swapchain_.create(hwnd, w, h, vk_fmt, desc.BufferCount, allow_tearing)) return false; if (flags_ & DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT) { @@ -241,7 +234,7 @@ class SwapChain final : public IDXGISwapChain3 { VkFormat vk_fmt = VK_FORMAT_UNDEFINED; if (fmt != DXGI_FORMAT_UNKNOWN) { vk_fmt = dxgi_to_vk_format(fmt); - if (vk_fmt == VK_FORMAT_UNDEFINED) return DXGI_ERROR_UNSUPPORTED; + if (vk_fmt == VK_FORMAT_UNDEFINED) return E_INVALIDARG; } constexpr UINT creation_only_flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT | DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; @@ -789,8 +782,10 @@ class Factory final : public IDXGIFactory5 { *out = nullptr; if (!hwnd || !desc) return E_INVALIDARG; if (!valid_flip_buffer_count(desc->BufferCount)) return DXGI_ERROR_INVALID_CALL; + const VkFormat vk_fmt = dxgi_to_vk_format(desc->Format); + if (vk_fmt == VK_FORMAT_UNDEFINED) return DXGI_ERROR_INVALID_CALL; auto* sc = new SwapChain(this, device, context_, gipa_, instance_, physical_, gdpa_, queue_, queue_family_); - if (!sc->init(hwnd, *desc)) { + if (!sc->init(hwnd, *desc, vk_fmt)) { sc->Release(); return E_FAIL; } diff --git a/runtime/shims/xgameruntime.cpp b/runtime/shims/xgameruntime.cpp index 8135589b92..46aec5af71 100644 --- a/runtime/shims/xgameruntime.cpp +++ b/runtime/shims/xgameruntime.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -35,9 +36,9 @@ std::atomic g_runtime_refs{0}; // "xgameruntime.dll" and GetProcAddress these five names (measured in the package's libHttpClient.GDK.dll and // XCurl.dll, docs/runtime_imports.md). Signatures, the options struct and the error for an unknown class follow // xodus-gaming/xgameruntime-docs (GPL-3.0; facts only, nothing copied): InitializeApiImplEx2 is the one -// XGameRuntimeInitialize[WithOptions] calls, and QueryApiImpl hands out the runtime's COM classes. The classes' -// method layouts are not known yet, so QueryApiImpl logs each class and interface id it is asked for and refuses -// them; the first boot with the executable then lists the interfaces to implement. +// XGameRuntimeInitialize[WithOptions] calls, and QueryApiImpl hands out the runtime's COM classes. XThreadingImpl and +// XErrorImpl are served (their layouts are measured, below); for any other class QueryApiImpl logs the class and +// interface id and refuses it, so the first boot with the executable lists the interfaces to implement next. struct ApiImplOptions { // InitializeApiImplEx2's fourth argument uint32_t unknown; // documented as always 1 @@ -85,8 +86,149 @@ void print_guid(char (&out)[40], const GUID* g) { g->Data4[6], g->Data4[7]); } +// ---- The runtime classes QueryApiImpl hands out ---- +// +// xgameruntime.lib's thunk for each function asks QueryApiImpl for the class (passing the class id as the interface +// id too), calls one slot of the object's vtable with the function's own arguments after `this`, and Releases it. +// The slot order is xgameruntime-docs' "Layout" list after IUnknown's three slots, and it is measured: the thunks +// statically linked into the package's libHttpClient.GDK.dll and XCurl.dll (disassembled, their code not run) +// call IXThreadingImpl slots 3-7 and 9-30, each with the argument shape of the documented function in that +// position (XAsyncBegin's five arguments at slot 7, XTaskQueueCreate's two modes and a handle pointer at 12, +// XTaskQueueTerminate's bool at 22, XThreadSetTimeSensitive's bool at 27, ...), and IXErrorImpl slot 3 with an +// HRESULT and a pointer. docs/runtime_imports.md has the table. Each function is served by the implementation the +// named export already uses (third_party/xtaskqueue), so the two ways in behave the same. + +constexpr GUID kThreadingClass = {0x073b7dcb, 0x1fcf, 0x4030, {0x94, 0xbe, 0xe3, 0xc9, 0xeb, 0x62, 0x34, 0x28}}; +constexpr GUID kErrorClass = {0x8ca467f7, 0x22e8, 0x4096, {0x84, 0x56, 0xbb, 0x8a, 0xa1, 0x3f, 0x79, 0xd8}}; + +// A function's arguments after `this`, forwarded unchanged (x64 has one calling convention). +// Specialised on the function's exact type, so a noexcept function matches only one form. +template struct Method; +template struct Method { + static R STDMETHODCALLTYPE call(void*, A... a) { return F(a...); } +}; +template struct Method { + static R STDMETHODCALLTYPE call(void*, A... a) noexcept { return F(a...); } +}; + +constexpr GUID kIUnknown = {0x00000000, 0x0000, 0x0000, {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}}; + +// The runtime's objects are process-wide singletons: AddRef/Release count but never free. +struct RuntimeObject { + const void* const* vtable; + const GUID* class_id; + std::atomic refs{1}; +}; + +HRESULT STDMETHODCALLTYPE object_query_interface(void* self, REFIID iid, void** out) { + if (!out) return E_POINTER; + auto* o = static_cast(self); + if (iid == kIUnknown || iid == *o->class_id) { + o->refs.fetch_add(1); + *out = self; + return S_OK; + } + *out = nullptr; + return E_NOINTERFACE; +} +ULONG STDMETHODCALLTYPE object_add_ref(void* self) { return static_cast(static_cast(self)->refs.fetch_add(1) + 1); } +ULONG STDMETHODCALLTYPE object_release(void* self) { + long prev = static_cast(self)->refs.load(); + while (prev > 1 && !static_cast(self)->refs.compare_exchange_weak(prev, prev - 1)) {} + return static_cast(prev > 1 ? prev - 1 : 1); // the singleton's own reference stays +} + +// A private slot whose signature isn't public: logged once, answers 0 (S_OK / false / nothing to do). +template uint64_t STDMETHODCALLTYPE private_slot(void*) { + static std::atomic s_logged{false}; + if (!s_logged.exchange(true)) + std::fprintf(stderr, "[rt] xgameruntime: XThreadingImpl private slot %d called; answering 0\n", Slot); + return 0; +} + +// XThreadSetTimeSensitive / XThreadIsTimeSensitive / XThreadAssertNotTimeSensitive. The flag is per thread, as in +// the GDK; nothing is enforced offline (a time-sensitive thread may still block). +thread_local bool t_time_sensitive = false; +HRESULT STDMETHODCALLTYPE thread_set_time_sensitive(void*, bool value) { + t_time_sensitive = value; + return S_OK; +} +void STDMETHODCALLTYPE thread_assert_not_time_sensitive(void*) {} +bool STDMETHODCALLTYPE thread_is_time_sensitive(void*) { return t_time_sensitive; } + +#define XM(fn) reinterpret_cast(&Method<&fn>::call) +const void* const kThreadingVtable[] = { + reinterpret_cast(&object_query_interface), reinterpret_cast(&object_add_ref), + reinterpret_cast(&object_release), + XM(XAsyncGetStatus), // 3 + XM(XAsyncGetResultSize), // 4 + XM(XAsyncCancel), // 5 + XM(XAsyncRun), // 6 + XM(XAsyncBegin), // 7 + reinterpret_cast(&private_slot<8>), // 8 XAsyncBeginAlloc (private, not called by the package) + XM(XAsyncSchedule), // 9 + XM(XAsyncComplete), // 10 + XM(XAsyncGetResult), // 11 + XM(XTaskQueueCreate), // 12 + XM(XTaskQueueCreateComposite), // 13 + XM(XTaskQueueGetPort), // 14 + XM(XTaskQueueDuplicateHandle), // 15 + XM(XTaskQueueDispatch), // 16 + XM(XTaskQueueCloseHandle), // 17 + XM(XTaskQueueSubmitCallback), // 18 + XM(XTaskQueueSubmitDelayedCallback), // 19 + XM(XTaskQueueRegisterWaiter), // 20 + XM(XTaskQueueUnregisterWaiter), // 21 + XM(XTaskQueueTerminate), // 22 + XM(XTaskQueueRegisterMonitor), // 23 + XM(XTaskQueueUnregisterMonitor), // 24 + XM(XTaskQueueGetCurrentProcessTaskQueue), // 25 + XM(XTaskQueueSetCurrentProcessTaskQueue), // 26 + reinterpret_cast(&thread_set_time_sensitive), // 27 + reinterpret_cast(&private_slot<28>), // 28 XTaskQueueIsEmpty (private; no arguments) + reinterpret_cast(&thread_assert_not_time_sensitive), // 29 + reinterpret_cast(&thread_is_time_sensitive), // 30 +}; +#undef XM +static_assert(std::size(kThreadingVtable) == 31, "IUnknown + IXThreadingImpl's 28 methods"); + +// IXErrorImpl: XErrorReport(HRESULT, const char*) at slot 3 (the docs' "_unknown_"; XCurl calls it with an HRESULT +// and a string), XErrorSetCallback(XErrorCallback*, void*) and XErrorSetOptions(options, options). Offline, a report +// is logged and handed to the callback the title set, if any. +using XErrorCallback = bool(CALLBACK*)(HRESULT hr, const char* message, void* context); +std::atomic g_error_callback{nullptr}; +std::atomic g_error_context{nullptr}; + +void STDMETHODCALLTYPE error_report(void*, HRESULT hr, const char* message) { + static std::atomic s_logged{0}; + if (s_logged.fetch_add(1) < 64) + std::fprintf(stderr, "[rt] xgameruntime: XErrorReport(0x%08lx, %s)\n", static_cast(hr), + message ? message : "(null)"); + if (XErrorCallback cb = g_error_callback.load()) cb(hr, message, g_error_context.load()); +} +void STDMETHODCALLTYPE error_set_callback(void*, XErrorCallback callback, void* context) { + g_error_context = context; + g_error_callback = callback; +} +HRESULT STDMETHODCALLTYPE error_set_options(void*, uint32_t, uint32_t) { return S_OK; } + +const void* const kErrorVtable[] = { + reinterpret_cast(&object_query_interface), reinterpret_cast(&object_add_ref), + reinterpret_cast(&object_release), + reinterpret_cast(&error_report), // 3 + reinterpret_cast(&error_set_callback), // 4 + reinterpret_cast(&error_set_options), // 5 +}; + +RuntimeObject g_threading{kThreadingVtable, &kThreadingClass}; +RuntimeObject g_error{kErrorVtable, &kErrorClass}; + HRESULT WINAPI QueryApiImpl(const GUID* class_id, REFIID interface_id, void** out) { if (out) *out = nullptr; + if (class_id && out) { + for (RuntimeObject* o : {&g_threading, &g_error}) + if (*class_id == *o->class_id) return object_query_interface(o, interface_id, out); + } char cls[40], iid[40]; print_guid(cls, class_id); print_guid(iid, &interface_id); @@ -156,6 +298,115 @@ uint64_t __stdcall XSystemGetAppMemoryUsage() { return 0; } +// XVersion: 4-part version structure from GDK XGameRuntimeTypes.h (8 bytes) +struct XVersion { + union { + struct { + uint16_t major; + uint16_t minor; + uint16_t build; + uint16_t revision; + }; + uint64_t Value; + }; +}; +static_assert(sizeof(XVersion) == 8, "XVersion must be 8 bytes"); + +// XSystemAnalyticsInfo: hardware and OS version telemetry (144 bytes) +struct XSystemAnalyticsInfo { + XVersion osVersion; + XVersion hostingOsVersion; + char family[64]; + char form[64]; +}; +static_assert(sizeof(XSystemAnalyticsInfo) == 144, "XSystemAnalyticsInfo must be 144 bytes"); + +// XSystemAnalyticsInfo XSystemGetAnalyticsInfo() +// Returned by value per Microsoft GDK specification. +XSystemAnalyticsInfo __stdcall XSystemGetAnalyticsInfo() { + XSystemAnalyticsInfo info{}; + info.osVersion = {10, 0, 22000, 0}; + info.hostingOsVersion = {10, 0, 22000, 0}; + std::strncpy(info.family, "Xbox", sizeof(info.family) - 1); + + const uint32_t dt = XSystemGetDeviceType(); + if (dt == static_cast(XSystemDeviceType::XboxScarlettLockhart)) { + std::strncpy(info.form, "Xbox Series S", sizeof(info.form) - 1); + } else { + std::strncpy(info.form, "Xbox Series X", sizeof(info.form) - 1); + } + + char form_override[64]; + const DWORD n = GetEnvironmentVariableA("LEONIDA_ANALYTICS_FORM", form_override, sizeof(form_override)); + if (n > 0 && n < sizeof(form_override)) { + std::strncpy(info.form, form_override, sizeof(info.form) - 1); + } + return info; +} + +// ---- XPackage ---- + +constexpr size_t XPACKAGE_IDENTIFIER_MAX_LENGTH = 33; +constexpr char kDefaultPackageIdentifier[XPACKAGE_IDENTIFIER_MAX_LENGTH] = "LeonidaPackageIdentifier00000000"; +static_assert(sizeof(kDefaultPackageIdentifier) == XPACKAGE_IDENTIFIER_MAX_LENGTH, + "default package identifier must match XPACKAGE_IDENTIFIER_MAX_LENGTH"); + +// HRESULT XPackageGetCurrentProcessPackageIdentifier(size_t bufferSize, char* buffer). +// Retrieves the package identifier string for the current process. +HRESULT __stdcall XPackageGetCurrentProcessPackageIdentifier(size_t bufferSize, char* buffer) { + if (!buffer || bufferSize == 0) return E_INVALIDARG; + + char id[XPACKAGE_IDENTIFIER_MAX_LENGTH] = {}; + const DWORD n = GetEnvironmentVariableA("LEONIDA_PACKAGE_ID", id, sizeof(id)); + const char* selected = (n > 0 && n < sizeof(id)) ? id : kDefaultPackageIdentifier; + const size_t len = std::strlen(selected); + + if (bufferSize < len + 1) return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + std::memcpy(buffer, selected, len + 1); + return S_OK; +} + +// HRESULT XPackageGetMountPath(XPackageMountHandle mount, size_t pathSize, char* path). +// Retrieves the installed filesystem path for the mounted package. +// Reads LEONIDA_GAME_DIR when set, otherwise falls back to the current module's directory. +HRESULT __stdcall XPackageGetMountPath(void* /*mount*/, size_t pathSize, char* path) { + if (!path || pathSize == 0) return E_INVALIDARG; + + char buf[MAX_PATH] = {}; + const DWORD n = GetEnvironmentVariableA("LEONIDA_GAME_DIR", buf, sizeof(buf)); + if (n == 0 || n >= sizeof(buf)) { + const DWORD mod_len = GetModuleFileNameA(nullptr, buf, sizeof(buf)); + if (mod_len > 0 && mod_len < sizeof(buf)) { + char* slash = std::strrchr(buf, '\\'); + char* fslash = std::strrchr(buf, '/'); + char* last = slash > fslash ? slash : fslash; + if (last) { + *last = '\0'; + } else { + return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); + } + } else { + return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); + } + } + + const size_t len = std::strlen(buf); + if (pathSize < len + 1) return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + std::memcpy(path, buf, len + 1); + return S_OK; +} + +// bool XPackageIsPackagedProcess(). +// Returns true on Xbox Series console. LEONIDA_PACKAGED=0 overrides it. +bool __stdcall XPackageIsPackagedProcess() { + char s[16]; + const DWORD n = GetEnvironmentVariableA("LEONIDA_PACKAGED", s, sizeof(s)); + if (n > 0 && n < sizeof(s)) { + if (std::atoi(s) == 0) return false; + } + return true; +} + #define XGR(name) {"xgameruntime.dll", #name, reinterpret_cast(&name)} } // namespace @@ -173,6 +424,10 @@ SHIM_TABLE(xgameruntime, XGR(XSystemGetConsoleId), XGR(XSystemGetAppMemoryUsageLimit), XGR(XSystemGetAppMemoryUsage), + XGR(XSystemGetAnalyticsInfo), + XGR(XPackageGetCurrentProcessPackageIdentifier), + XGR(XPackageGetMountPath), + XGR(XPackageIsPackagedProcess), // XTaskQueue (third_party/xtaskqueue) XGR(XTaskQueueCreate), XGR(XTaskQueueCreateComposite), diff --git a/runtime/src/base_reservation.h b/runtime/src/base_reservation.h index 76fb530ce8..bf49468954 100644 --- a/runtime/src/base_reservation.h +++ b/runtime/src/base_reservation.h @@ -98,7 +98,11 @@ inline int relaunch(const Range& r) { wchar_t marker[64]; std::swprintf(marker, 64, L"%llx:%llx", static_cast(r.base), static_cast(r.size)); - SetEnvironmentVariableW(kVariable, marker); // inherited by the child; this process only waits from here on + // Inherited by the child: it tells it to commit inside the reservation and not to relaunch again. + if (!SetEnvironmentVariableW(kVariable, marker)) { + std::fprintf(stderr, "error: setting %ls failed (%lu)\n", kVariable, GetLastError()); + return 1; + } std::wstring command_line = GetCommandLineW(); STARTUPINFOW startup{sizeof startup}; startup.dwFlags = STARTF_USESTDHANDLES; @@ -115,19 +119,27 @@ inline int relaunch(const Range& r) { std::fprintf(stderr, "error: starting gta6rt again to reserve the image range failed (%lu)\n", GetLastError()); return 1; } - if (!VirtualAllocEx(process.hProcess, reinterpret_cast(r.base), static_cast(r.size), MEM_RESERVE, - PAGE_NOACCESS)) { - const DWORD error = GetLastError(); + const auto abandon = [&process] { // the child never ran: end it and release its handles TerminateProcess(process.hProcess, 1); CloseHandle(process.hThread); CloseHandle(process.hProcess); + }; + if (!VirtualAllocEx(process.hProcess, reinterpret_cast(r.base), static_cast(r.size), MEM_RESERVE, + PAGE_NOACCESS)) { + const DWORD error = GetLastError(); + abandon(); std::fprintf(stderr, "error: the image has no relocations and its range %#llx-%#llx is taken, also in a new " "process (VirtualAllocEx %lu)\n", static_cast(r.base), static_cast(r.base + r.size), error); return 1; } - ResumeThread(process.hThread); + if (ResumeThread(process.hThread) == static_cast(-1)) { // still suspended: the wait would never end + const DWORD error = GetLastError(); + abandon(); + std::fprintf(stderr, "error: resuming the relaunched gta6rt failed (%lu)\n", error); + return 1; + } WaitForSingleObject(process.hProcess, INFINITE); DWORD code = 1; GetExitCodeProcess(process.hProcess, &code); diff --git a/runtime/src/command_list.h b/runtime/src/command_list.h index 9c74994e18..07520c2e3f 100644 --- a/runtime/src/command_list.h +++ b/runtime/src/command_list.h @@ -565,6 +565,11 @@ struct ExecuteIndirect { std::uint64_t argument_offset = 0; ResourceId count_buffer = 0; // 0: fixed max_count; non-zero: vkCmdDraw*IndirectCount std::uint64_t count_offset = 0; + // kind == dispatch: the compute pipeline and root arguments in effect, as Dispatch records them, so the dispatches + // run that pipeline with those arguments whatever the command buffer had bound. A pipeline of 0 leaves the binding + // as it is. + std::uintptr_t pipeline = 0; + std::array user_data{}; }; // Triangle geometry descriptor for a BLAS build (ID3D12GraphicsCommandList4::BuildRaytracingAccelerationStructure). @@ -594,11 +599,29 @@ struct BuildAccelerationStructure { std::vector triangles; }; +// CopyRaytracingAccelerationStructure. `mode` is D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE; replay supports +// CLONE (0) and COMPACT (1) for XDXR structures. +struct CopyAccelerationStructure { + std::uint64_t dst_va = 0; + std::uint64_t src_va = 0; + std::uint32_t mode = 0; +}; + +// EmitRaytracingAccelerationStructurePostbuildInfo, and each postbuild desc of BuildRaytracingAccelerationStructure: +// one value per source, consecutively from `dest_va`. `type` is D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE; +// replay supports COMPACTED_SIZE (0) and CURRENT_SIZE (3), 8 bytes each. +struct AccelerationStructurePostbuild { + std::uint64_t dest_va = 0; + std::uint32_t type = 0; + std::vector sources; +}; + using Command = std::variant; + ExecuteIndirect, BuildAccelerationStructure, Dispatch, Draw, CopyAccelerationStructure, + AccelerationStructurePostbuild>; class CommandList { public: @@ -809,6 +832,17 @@ class CommandList { if (!build.dst_va || !build.scratch_va) return false; return append(std::move(build)); } + // D3D12: acceleration structures are 256-byte aligned, postbuild destinations 8-byte aligned. + bool copy_acceleration_structure(CopyAccelerationStructure copy) { + if (!copy.dst_va || !copy.src_va || copy.dst_va % 256 || copy.src_va % 256) return false; + return append(copy); + } + bool acceleration_structure_postbuild(AccelerationStructurePostbuild info) { + if (!info.dest_va || info.dest_va % 8 || info.sources.empty()) return false; + for (const auto va : info.sources) + if (!va || va % 256) return false; + return append(std::move(info)); + } bool close() { if (closed_) return false; closed_ = true; diff --git a/runtime/src/descriptor_table.h b/runtime/src/descriptor_table.h index 59f96fd4f4..2b5b111f7a 100644 --- a/runtime/src/descriptor_table.h +++ b/runtime/src/descriptor_table.h @@ -129,7 +129,10 @@ class DescriptorTable { } // Erases a key from the table. Returns true if the key was found and erased, false otherwise. - // Backward-shifts downstream entries in the probe cluster so probe chains remain intact and compact. + // Only the key's own slot changes (it becomes empty): no other entry moves. Every lookup, here and in the + // shaders (rdna2spirv.py desc_probe), compares all kDescriptorProbes slots and never stops at an empty one, so + // a hole breaks no probe chain and inserts reuse it. Keeping the other entries in place is what lets the GPU + // copy of the table take an erase while shaders still probe it (BindlessSet::flush_needs_idle). bool erase(const std::uint32_t key[8]) { std::lock_guard lock(mutex_); return erase_locked(key); @@ -321,24 +324,9 @@ class DescriptorTable { } if (!found) return false; - // Backward-shift entries in the probe cluster to maintain probe chains - std::uint32_t i = found_slot; - std::uint32_t j = i; + // No backward shift: see erase(). + entries_[found_slot] = DescriptorEntry{}; mark(found_slot); - while (true) { - j = (j + 1) & mask_; - if (entries_[j].pad != kSlotOccupiedMarker) break; - const std::uint32_t r = hash_descriptor_key(entries_[j].key); - const std::uint32_t dist_r_to_i = (i - r) & mask_; - const std::uint32_t dist_r_to_j = (j - r) & mask_; - if (dist_r_to_i < dist_r_to_j && dist_r_to_i < kDescriptorProbes) { - entries_[i] = entries_[j]; - mark(i); - i = j; - } - } - entries_[i] = DescriptorEntry{}; - mark(i); --occupied_count_; return true; } diff --git a/runtime/src/vulkan13_features.h b/runtime/src/vulkan13_features.h new file mode 100644 index 0000000000..2057d953b8 --- /dev/null +++ b/runtime/src/vulkan13_features.h @@ -0,0 +1,127 @@ +#pragma once + +// dynamicRendering and synchronization2, the two Vulkan 1.3 features the D3D12 layer needs, on a Vulkan 1.3 device +// or on a Vulkan 1.2 device through VK_KHR_dynamic_rendering and VK_KHR_synchronization2. CrossOver's MoltenVK on +// macOS is such a 1.2 device (1.2.10: Vulkan 1.2 with both extensions); the extension structs, functions and +// behaviour are the core ones under another name, so the rest of the layer does not see the difference. +// +// leonida::Vulkan13Features v13; +// v13.query(physical, props.apiVersion, get_features2, enumerate_extensions); // per candidate +// if (!v13.usable()) continue; +// enable12.pNext = v13.enable(chain); // chain: what came after VkPhysicalDeviceVulkan13Features +// ... v13.next() is where later feature structs go (it used to be enable13.pNext) +// v13.add_extensions(device_extensions); +// fn = leonida::device_proc_or_khr(get_device_proc, device, "vkCmdPipelineBarrier2"); + +#include + +#include +#include +#include +#include + +namespace leonida { + +class Vulkan13Features { +public: + Vulkan13Features() = default; + Vulkan13Features(const Vulkan13Features&) = delete; // enable() links pointers into this object + Vulkan13Features& operator=(const Vulkan13Features&) = delete; + + bool core = false; // a Vulkan 1.3 device: the features are core + bool dynamic_rendering = false; // supported, as a core feature or through VK_KHR_dynamic_rendering + bool synchronization2 = false; // supported, as a core feature or through VK_KHR_synchronization2 + // Optional 1.3 core features, enabled where supported; on a 1.2 device they stay off (no required subgroup size). + bool subgroup_size_control = false; + bool compute_full_subgroups = false; + + bool usable() const { return dynamic_rendering && synchronization2; } + + // Fills the flags above for one physical device. A device older than 1.2 never qualifies. + void query(VkPhysicalDevice physical, std::uint32_t api_version, PFN_vkGetPhysicalDeviceFeatures2 features2, + PFN_vkEnumerateDeviceExtensionProperties enumerate_extensions) { + core = api_version >= VK_API_VERSION_1_3; + dynamic_rendering = synchronization2 = subgroup_size_control = compute_full_subgroups = false; + if (!features2) return; + if (core) { + VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; + VkPhysicalDeviceFeatures2 query{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &f13}; + features2(physical, &query); + dynamic_rendering = f13.dynamicRendering == VK_TRUE; + synchronization2 = f13.synchronization2 == VK_TRUE; + subgroup_size_control = f13.subgroupSizeControl == VK_TRUE; + compute_full_subgroups = f13.computeFullSubgroups == VK_TRUE; + return; + } + if (api_version < VK_API_VERSION_1_2 || !enumerate_extensions) return; + std::uint32_t count = 0; + enumerate_extensions(physical, nullptr, &count, nullptr); + std::vector extensions(count); + enumerate_extensions(physical, nullptr, &count, extensions.data()); + bool has_dynamic_rendering = false, has_synchronization2 = false; + for (const auto& e : extensions) { + has_dynamic_rendering |= std::strcmp(e.extensionName, VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME) == 0; + has_synchronization2 |= std::strcmp(e.extensionName, VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME) == 0; + } + if (!has_dynamic_rendering || !has_synchronization2) return; + VkPhysicalDeviceSynchronization2FeaturesKHR sync2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR}; + VkPhysicalDeviceDynamicRenderingFeaturesKHR rendering{ + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR, &sync2}; + VkPhysicalDeviceFeatures2 query{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &rendering}; + features2(physical, &query); + dynamic_rendering = rendering.dynamicRendering == VK_TRUE; + synchronization2 = sync2.synchronization2 == VK_TRUE; + } + + // Copies the flags of the device query() chose (a later query() for another candidate overwrites them). + void choose(const Vulkan13Features& from) { + core = from.core; + dynamic_rendering = from.dynamic_rendering; + synchronization2 = from.synchronization2; + subgroup_size_control = from.subgroup_size_control; + compute_full_subgroups = from.compute_full_subgroups; + } + + // The structs that enable both features, ahead of `chain`; returns their head for VkPhysicalDeviceVulkan12Features' + // pNext. Call once, after query() or choose(). + void* enable(void* chain) { + if (core) { + enable13_.pNext = chain; + enable13_.dynamicRendering = VK_TRUE; + enable13_.synchronization2 = VK_TRUE; + enable13_.subgroupSizeControl = subgroup_size_control ? VK_TRUE : VK_FALSE; + enable13_.computeFullSubgroups = compute_full_subgroups ? VK_TRUE : VK_FALSE; + return &enable13_; + } + sync2_.pNext = chain; + sync2_.synchronization2 = VK_TRUE; + rendering_.pNext = &sync2_; + rendering_.dynamicRendering = VK_TRUE; + return &rendering_; + } + + // Where a feature struct goes to follow these: insert with `s.pNext = *next(); *next() = &s;`. + void** next() { return core ? &enable13_.pNext : &sync2_.pNext; } + + // The device extensions a 1.2 device needs for both features; none on 1.3. + void add_extensions(std::vector& extensions) const { + if (core) return; + extensions.push_back(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME); + extensions.push_back(VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME); + } + +private: + VkPhysicalDeviceVulkan13Features enable13_{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; + VkPhysicalDeviceDynamicRenderingFeaturesKHR rendering_{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR}; + VkPhysicalDeviceSynchronization2FeaturesKHR sync2_{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR}; +}; + +// A device function by its core name, or by its KHR name where the core one is null: a Vulkan 1.2 device returns +// null for Vulkan 1.3 core names (vkCmdPipelineBarrier2, vkCmdBeginRendering, ...) and serves the enabled +// extension's vkCmdPipelineBarrier2KHR and the like, which have the same signatures. +inline PFN_vkVoidFunction device_proc_or_khr(PFN_vkGetDeviceProcAddr get, VkDevice device, const char* name) { + if (const PFN_vkVoidFunction function = get(device, name)) return function; + return get(device, (std::string(name) + "KHR").c_str()); +} + +} // namespace leonida diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h index e577e6af02..8683ae2ded 100644 --- a/runtime/src/vulkan_backend.h +++ b/runtime/src/vulkan_backend.h @@ -3,7 +3,8 @@ // The execution side of the D3D12 layer, without COM: the per-device Vulkan context (resources, layout tracker, // image views), queues that execute command lists, and timeline-semaphore fences. The COM objects in // shims/d3d12_com.cpp are thin wrappers over these. Needs Vulkan 1.2 timeline semaphores; rectangle clears and -// enhanced barriers need the Vulkan 1.3 functions (dynamicRendering, synchronization2) to be enabled. +// enhanced barriers need the Vulkan 1.3 functions (dynamicRendering, synchronization2) to be enabled, as core +// features or through their KHR extensions on a 1.2 device (vulkan13_features.h). #ifndef VK_NO_PROTOTYPES #define VK_NO_PROTOTYPES @@ -12,6 +13,7 @@ #include "occlusion_sum_spirv.h" #include "retire_tickets.h" #include "statistics_sum_spirv.h" +#include "vulkan13_features.h" #include "vulkan_depth24.h" #include "vulkan_scratch.h" #include "vulkan_replay.h" @@ -27,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -84,7 +87,7 @@ struct VulkanDeviceFunctions { // extension is not enabled, and the query functions are optional (a list that uses queries without them is // unsupported). The compute and descriptor functions are needed for normalized or summed occlusion results. bool load(PFN_vkGetDeviceProcAddr get, VkDevice device) { -#define LEONIDA_VK_LOAD(name) name = reinterpret_cast(get(device, #name)); +#define LEONIDA_VK_LOAD(name) name = reinterpret_cast(leonida::device_proc_or_khr(get, device, #name)); LEONIDA_VK_DEVICE_FUNCTIONS(LEONIDA_VK_LOAD) #undef LEONIDA_VK_LOAD return vkCreateCommandPool && vkDestroyCommandPool && vkAllocateCommandBuffers && vkResetCommandBuffer && @@ -744,6 +747,14 @@ class VulkanContext { xdxr_->record_blas(cb, layout, geometries, base + b.dst_va, base + b.scratch_va, from); } }; + replay_.xdxr_copy = [this](VkCommandBuffer cb, std::uint64_t src, std::uint64_t dst, std::uint64_t bytes) { + const std::uint64_t base = replay_.heap_base; + xdxr_->record_copy(cb, base + src, base + dst, bytes); + }; + replay_.xdxr_postbuild = [this](VkCommandBuffer cb, std::uint64_t src, std::uint64_t dest) { + const std::uint64_t base = replay_.heap_base; + xdxr_->record_postbuild(cb, base + src, base + dest); + }; } else { xdxr_.reset(); } @@ -817,6 +828,15 @@ class VulkanContext { } } + // An image that got a storage (unordered-access) view. A shader can write it before any command names it, so the + // layer would not know it was used and the first barrier or copy that does would zero-fill it (vulkan_replay.h, + // initialize). The next submission therefore moves each such image to GENERAL, the layout its descriptor names, + // zero-filled, ahead of its lists. An image already tracked beyond UNDEFINED is left as it is. + void note_storage_image(ResourceId id) { + std::lock_guard lock(storage_mutex_); + storage_pending_.insert(id); + } + void remove_resource(ResourceId id) { VkImage img = VK_NULL_HANDLE; { @@ -1122,6 +1142,14 @@ class VulkanContext { std::unordered_map graphics_pipelines_; std::unordered_map acceleration_structures_; LayoutTracker tracker_; + std::mutex storage_mutex_; // a leaf lock: guards storage_pending_ only + std::unordered_set storage_pending_; + // The last submission that initialized storage images (its queue's progress semaphore and ticket) and a counter + // that says which one: every other queue's next submission waits for it, so no queue uses such an image before + // the zero-fill that put it in GENERAL has run. + VkSemaphore storage_init_semaphore_ = VK_NULL_HANDLE; + std::uint64_t storage_init_value_ = 0; + std::uint64_t storage_init_version_ = 0; std::map, VkImageView> views_; std::function bindless_prepare_; std::unique_ptr depth24_; @@ -1437,6 +1465,33 @@ class VulkanQueue { return ReplayResult::unsupported; } auto next_tracker = context_.tracker_; + // Images with a UAV view are moved to GENERAL (zeroed) by the first submission that can use a shader on them: + // not a copy queue (its family may not clear images), and one whose lists dispatch or draw. + bool runs_shaders = false; + for (const CommandList* list : lists) + for (const auto& command : list->commands()) + runs_shaders |= std::holds_alternative(command) || std::holds_alternative(command) || + std::holds_alternative(command); + std::vector storage_images; + { + std::lock_guard lock(context_.storage_mutex_); + if (context_.storage_init_semaphore_ && context_.storage_init_semaphore_ != progress_ && + context_.storage_init_version_ != storage_init_seen_) { + waits_.push_back(context_.storage_init_semaphore_); + wait_values_.push_back(context_.storage_init_value_); + storage_init_seen_ = context_.storage_init_version_; + } + if (kind_ != QueueKind::copy && runs_shaders) + storage_images.assign(context_.storage_pending_.begin(), context_.storage_pending_.end()); + if (!storage_images.empty()) context_.storage_pending_.clear(); + } + for (const ResourceId id : storage_images) { + const ResourceBinding* image = context_.resolve(id); + if (!image || !image->image) continue; + const VkImageSubresourceRange range{image->aspects, 0, image->mip_levels, 0, image->array_layers}; + auto pieces = detail::current(&next_tracker, id, range, VK_IMAGE_LAYOUT_UNDEFINED); + detail::initialize(replay, command_buffer, *image, id, pieces, VK_IMAGE_LAYOUT_GENERAL, &next_tracker); + } bool wrote_readback = false; VkPipelineStageFlags2 readback_stages = 0; std::uint32_t open_labels = 0; // events may span the lists of one ExecuteCommandLists @@ -1479,6 +1534,17 @@ class VulkanQueue { const bool ended = context_.vk.vkEndCommandBuffer(command_buffer) == VK_SUCCESS; resource_lock.unlock(); // release resource_mutex_ before vkQueueSubmit while keeping tracker_lock held const bool submitted = ended && submit(command_buffer, VK_NULL_HANDLE, 0); + if (!submitted && !storage_images.empty()) { // not initialized after all: try again with the next submission + std::lock_guard lock(context_.storage_mutex_); + context_.storage_pending_.insert(storage_images.begin(), storage_images.end()); + } + if (submitted && !storage_images.empty()) { + std::lock_guard lock(context_.storage_mutex_); + context_.storage_init_semaphore_ = progress_; + context_.storage_init_value_ = submitted_; + ++context_.storage_init_version_; + storage_init_seen_ = context_.storage_init_version_; + } if (submitted) { context_.tracker_ = std::move(next_tracker); slot->predicate = std::move(batch); @@ -1630,6 +1696,7 @@ class VulkanQueue { std::uint64_t submitted_ = 0; std::vector buffers_; std::unique_ptr occlusion_resolve_; + std::uint64_t storage_init_seen_ = 0; // the storage_init_version_ this queue has waited for std::vector waits_; std::vector wait_values_; std::uint32_t open_labels_ = 0; // queue labels begun and not ended diff --git a/runtime/src/vulkan_bindless.h b/runtime/src/vulkan_bindless.h index 9111f764cf..5f484bf162 100644 --- a/runtime/src/vulkan_bindless.h +++ b/runtime/src/vulkan_bindless.h @@ -435,19 +435,21 @@ class BindlessSet { result == DescriptorTable::InsertResult::added_with_relocation; return true; } - // Erasing compacts the key's probe cluster, so other keys' entries may change slots. + // Erasing empties only the key's own slot; no other entry moves (DescriptorTable::erase), so it needs no idle. + // The caller erases a key once no submitted work uses it (its texture is gone), like D3D12 requires. bool erase_key(const DescriptorKey& key) { if (!table_.erase(key)) return false; - table_dirty_ = existing_entries_changed_ = true; + table_dirty_ = true; return true; } const DescriptorTable& table() const { return table_; } - // True when the next flush() will change entries a running shader may be probing, or replace the table's - // buffer: the caller then flushes only once no command buffer that uses the set is still executing. Without - // it the flush only adds entries, and the copy of an entry is not atomic: a shader probing a different key - // could in principle see a torn entry that matches it, which is accepted as vanishingly unlikely because the - // added key is new (there is no live key equal to it). + // True when the next flush() will change entries a running shader may be probing (a live key's index replaced + // or a live key moved by a relocating insert), or replace the table's buffer: the caller then flushes only once + // no command buffer that uses the set is still executing. Without it the flush only adds entries or empties the + // slots of erased keys, and the copy of an entry is not atomic: a shader probing a different key could in + // principle see a torn entry that matches it, which is accepted as vanishingly unlikely because the added or + // erased key is not live (no running work uses it). bool flush_needs_idle() const { return table_dirty_ && (existing_entries_changed_ || force_full_upload_ || table_.size_bytes() > table_buffers_.table.size); diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h index 0b46198a99..2a37f58f51 100644 --- a/runtime/src/vulkan_replay.h +++ b/runtime/src/vulkan_replay.h @@ -788,6 +788,10 @@ struct ReplayFunctions { // cannot read while the list is prepared, `xdxr_record` records the build. std::function xdxr_check; std::function xdxr_record; + // CopyRaytracingAccelerationStructure (CLONE, COMPACT) of XDXR structures: `bytes` is the room the destination + // resource has; and one postbuild value (COMPACTED_SIZE, CURRENT_SIZE) of the structure at `src` to `dest`. + std::function xdxr_copy; + std::function xdxr_postbuild; std::function resolve_acceleration_structure; // Preparation only allocates a slot; capture records the GPU snapshot at the SetPredication command. std::function prepare_predicate; @@ -903,6 +907,7 @@ struct Prepared { VkExtent2D area{}; std::uint32_t layers = 1; // the fewest layers any bound attachment view has VkAccelerationStructureKHR accel_dst = VK_NULL_HANDLE; + std::uint64_t xdxr_bytes = 0; // CopyAccelerationStructure: the most bytes the copy may write VkAccelerationStructureKHR accel_src = VK_NULL_HANDLE; }; @@ -972,7 +977,7 @@ inline VkFormat color_view_format(const ResourceBinding& resource, const TargetV } if (!resource.rgba8_typeless && !resource.castable_view_formats) return format == resource.format ? format : VK_FORMAT_UNDEFINED; - if (resource.format != VK_FORMAT_R8G8B8A8_UNORM || resource.volume || resource.depth != 1 || resource.samples != 1) + if (resource.format != VK_FORMAT_R8G8B8A8_UNORM || resource.volume || resource.depth != 1) return VK_FORMAT_UNDEFINED; return format; } @@ -2392,6 +2397,13 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun (ind->kind == IndirectKind::dispatch && !vk.dispatch_indirect)) return ReplayResult::unsupported; } + if (ind->kind == IndirectKind::dispatch && ind->pipeline) { // the pipeline and root arguments it was recorded + if (!vk.bind_pipeline || !vk.push_constants || !vk.compute_pipeline) return ReplayResult::unsupported; + const ComputePipeline* pipeline = vk.compute_pipeline(ind->pipeline); + if (!pipeline || !pipeline->pipeline) return ReplayResult::unresolved_resource; + if (pipeline->bindless_set && !vk.bind_descriptor_sets) return ReplayResult::unsupported; + p.pipeline = *pipeline; + } } else if (const auto* build = std::get_if(&command)) { if (vk.xdxr_check) { if (!vk.xdxr_check(*build)) return ReplayResult::unsupported; @@ -2405,6 +2417,29 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun if (!p.accel_src) return ReplayResult::unresolved_resource; } } + } else if (const auto* copy = std::get_if(&command)) { + // XDXR only (a KHR copy needs VkAccelerationStructureKHR handles and vkCmdCopyAccelerationStructureKHR); + // the destination's room bounds the copy, as the size is only known to the GPU. + if (!vk.xdxr_copy || !vk.buffer_at || copy->mode > 1) return ReplayResult::unsupported; + std::uint64_t room = ~std::uint64_t(0); + VkBuffer buffer = VK_NULL_HANDLE; + VkDeviceSize offset = 0; + if (!vk.buffer_at(copy->dst_va, room, buffer, offset)) return ReplayResult::unresolved_resource; + std::uint64_t source = ~std::uint64_t(0); + if (!vk.buffer_at(copy->src_va, source, buffer, offset)) return ReplayResult::unresolved_resource; + p.xdxr_bytes = std::min(room, source); + } else if (const auto* info = std::get_if(&command)) { + // The KHR path never wrote postbuild values; it keeps skipping them rather than failing the list. + if (!vk.xdxr_postbuild) { + p.skip = true; + } else { + if (!vk.buffer_at || (info->type != 0 && info->type != 3)) return ReplayResult::unsupported; + std::uint64_t room = 8 * info->sources.size(); + VkBuffer buffer = VK_NULL_HANDLE; + VkDeviceSize offset = 0; + if (!vk.buffer_at(info->dest_va, room, buffer, offset)) return ReplayResult::unresolved_resource; + if (room < 8 * info->sources.size()) return ReplayResult::invalid_copy; + } } else if (const auto* dispatch = std::get_if(&command)) { if (!vk.bind_pipeline || !vk.push_constants || !vk.dispatch || !vk.compute_pipeline) return ReplayResult::unsupported; @@ -3113,6 +3148,18 @@ inline void emit(const PreparedList& prepared, VkCommandBuffer command_buffer, c } else if (ind->kind == IndirectKind::draw_indexed) { vk.draw_indexed_indirect(command_buffer, p.binding.buffer, arguments, ind->max_count, ind->stride); } else if (ind->kind == IndirectKind::dispatch) { + if (ind->pipeline) { + ShaderUserData data{}; + std::copy(ind->user_data.begin(), ind->user_data.end(), data.s); + data.heap_base = vk.heap_base; + data.code_base = p.pipeline.code_base; + vk.bind_pipeline(command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, p.pipeline.pipeline); + if (p.pipeline.bindless_set) + vk.bind_descriptor_sets(command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, p.pipeline.layout, 0, + 1, &p.pipeline.bindless_set, 0, nullptr); + vk.push_constants(command_buffer, p.pipeline.layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(data), + &data); + } for (std::uint32_t k = 0; k < ind->max_count; ++k) { vk.dispatch_indirect(command_buffer, p.binding.buffer, arguments + VkDeviceSize(k) * ind->stride); @@ -3122,6 +3169,11 @@ inline void emit(const PreparedList& prepared, VkCommandBuffer command_buffer, c } else if (const auto* xdxr_build = std::get_if(&command); xdxr_build && vk.xdxr_record) { vk.xdxr_record(command_buffer, *xdxr_build); + } else if (const auto* copy = std::get_if(&command)) { + vk.xdxr_copy(command_buffer, copy->src_va, copy->dst_va, p.xdxr_bytes); + } else if (const auto* info = std::get_if(&command); info && !p.skip) { + for (std::size_t i = 0; i < info->sources.size(); ++i) + vk.xdxr_postbuild(command_buffer, info->sources[i], info->dest_va + 8 * i); } else if (const auto* build = std::get_if(&command)) { // The build's addresses are console VAs into the GPU address arena (heap_base is its device address). // A null VA (no index buffer, no transform) stays null: heap_base + 0 would name the arena's zero page. diff --git a/runtime/src/xdxr_build.comp b/runtime/src/xdxr_build.comp index d5bbe82533..9080068978 100644 --- a/runtime/src/xdxr_build.comp +++ b/runtime/src/xdxr_build.comp @@ -23,6 +23,12 @@ // slots, MODE_LEVEL with arg2 = 1 recomputes each node's boxes from the children it already points to (the tree's // grouping is kept, so there is no Morton pass and no sort), and MODE_HEADER rewrites the bounds. // MODE_COPY one thread per word: count words from src0 to dst +// MODE_COPY_AS CopyRaytracingAccelerationStructure CLONE / COMPACT: the source structure's size comes from its +// header (totalSizeIn64BNodes), so the copy can follow a build in the same list; at most count +// words. The records are position-independent (node pointers count from the structure's start, and +// a TLAS names its BLASes by address), so the bytes are the copy. +// MODE_POSTBUILD one thread: the 8-byte COMPACTED_SIZE or CURRENT_SIZE of the structure at src0, at dst. A build +// is already exactly its layout's size, so both are totalSizeIn64BNodes * 64. // The tree groups four consecutive children per node in Morton order, level by level, so its shape depends only on // the element count and the layout (xdxr_build.h XdxrLayout) is known when the command is recorded. // @@ -40,7 +46,7 @@ layout(buffer_reference, std430, buffer_reference_align = 4) buffer Words { uint const uint MODE_INIT = 0u, MODE_TRIANGLES = 1u, MODE_INSTANCES = 2u, MODE_MORTON = 3u, MODE_LEVEL = 5u, MODE_HEADER = 6u, MODE_RADIX_COUNT = 7u, MODE_RADIX_SCAN = 8u, MODE_RADIX_SCATTER = 9u, - MODE_SMALL_SORT = 10u, MODE_COPY = 11u; + MODE_SMALL_SORT = 10u, MODE_COPY = 11u, MODE_COPY_AS = 12u, MODE_POSTBUILD = 13u; const uint SMALL_SORT_MAX = 1024u; // xdxr_build.h XdxrLayout::small_sort_max const uint RADIX_BITS = 4u, RADIX_BINS = 16u, RADIX_PASSES = 8u; const uint RADIX_TILE = 256u; // elements per workgroup in count and scatter: 4 chunks of 64 @@ -455,6 +461,14 @@ void main() { return; } if (i >= pc.count) return; + if (pc.mode == MODE_POSTBUILD) { + if (i == 0u) { store(pc.dst, 0u, load(pc.src0, 4u) * 64u); store(pc.dst, 4u, 0u); } + return; + } + if (pc.mode == MODE_COPY_AS) { + if (4u * i < load(pc.src0, 4u) * 64u) store(pc.dst, 4u * i, load(pc.src0, 4u * i)); + return; + } if (pc.mode == MODE_COPY) { store(pc.dst, 4u * i, load(pc.src0, 4u * i)); } else if (pc.mode == MODE_INIT) { diff --git a/runtime/src/xdxr_build.h b/runtime/src/xdxr_build.h index 64fe97a83a..6930078a48 100644 --- a/runtime/src/xdxr_build.h +++ b/runtime/src/xdxr_build.h @@ -15,6 +15,7 @@ // device addresses are wider (llvmpipe's are host pointers), the layer must present a narrower window and a bias. #pragma once +#include #include #include #include @@ -161,10 +162,44 @@ class XdxrBuilder { return true; } + // CopyRaytracingAccelerationStructure CLONE or COMPACT: the structure at `src` to `dst`, as many bytes as its + // header says, at most `max_bytes` (the room the destination has). The structures are position-independent. + bool record_copy(VkCommandBuffer cb, std::uint64_t src, std::uint64_t dst, std::uint64_t max_bytes) { + if (!loaded_ || !src || !dst || max_bytes < XdxrLayout::header_size) return false; + if (src == dst) return true; + vk_.vkCmdBindPipeline(cb, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_); + Push p{}; + p.mode = mode_copy_as; + p.src0 = split(src); + p.dst = split(dst); + p.count = std::uint32_t(std::min(max_bytes, 0xffffffffull) / 4); + dispatch(cb, p, p.count, false); + return true; + } + + // One postbuild value (COMPACTED_SIZE or CURRENT_SIZE, the same for these builds): 8 bytes at `dst` for the + // structure at `src`. A barrier first: a build or copy recorded just before writes the header it reads. + bool record_postbuild(VkCommandBuffer cb, std::uint64_t src, std::uint64_t dst) { + if (!loaded_ || !src || !dst) return false; + VkMemoryBarrier b{VK_STRUCTURE_TYPE_MEMORY_BARRIER, nullptr, VK_ACCESS_SHADER_WRITE_BIT, + VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT}; + vk_.vkCmdPipelineBarrier(cb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 1, + &b, 0, nullptr, 0, nullptr); + vk_.vkCmdBindPipeline(cb, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_); + Push p{}; + p.mode = mode_postbuild; + p.src0 = split(src); + p.dst = split(dst); + p.count = 1; + dispatch(cb, p, 1, false); + return true; + } + private: enum : std::uint32_t { mode_init = 0, mode_triangles = 1, mode_instances = 2, mode_morton = 3, mode_level = 5, mode_header = 6, - mode_radix_count = 7, mode_radix_scan = 8, mode_radix_scatter = 9, mode_small_sort = 10, mode_copy = 11 + mode_radix_count = 7, mode_radix_scan = 8, mode_radix_scatter = 9, mode_small_sort = 10, mode_copy = 11, + mode_copy_as = 12, mode_postbuild = 13 }; struct Addr { std::uint32_t lo = 0, hi = 0; }; struct Push { // xdxr_build.comp `Push`, std430 push-constant layout diff --git a/runtime/src/xdxr_build.inc b/runtime/src/xdxr_build.inc index 71ce37fbbf..bbc1bb8883 100644 --- a/runtime/src/xdxr_build.inc +++ b/runtime/src/xdxr_build.inc @@ -1,4 +1,4 @@ -{0x07230203,0x00010500,0x000d000b,0x000031a8, +{0x07230203,0x00010500,0x000d000b,0x000032b4, 0x00000000,0x00020011,0x00000001,0x00020011, 0x000014e3,0x0006000b,0x00000001,0x4c534c47, 0x6474732e,0x3035342e,0x00000000,0x0003000e, @@ -39,7 +39,7 @@ 0x00000023,0x00000064,0x00040047,0x00000b0e, 0x0000000b,0x0000001c,0x00040047,0x00000b17, 0x0000000b,0x0000001a,0x00040047,0x00000b18, -0x0000000b,0x0000001b,0x00040047,0x00000bb4, +0x0000000b,0x0000001b,0x00040047,0x00000bf1, 0x0000000b,0x00000019,0x00020013,0x00000002, 0x00030021,0x00000003,0x00000002,0x00040015, 0x00000006,0x00000020,0x00000000,0x00040017, @@ -175,25 +175,26 @@ 0x00000001,0x0004003b,0x00000b0d,0x00000b18, 0x00000001,0x0004002b,0x00000006,0x00000b3a, 0x0000000a,0x0004002b,0x00000006,0x00000b57, -0x0000000b,0x0006002c,0x0000065d,0x00000bb4, +0x0000000d,0x0004002b,0x00000006,0x00000b94, +0x0000000b,0x0006002c,0x0000065d,0x00000bf1, 0x00000107,0x000000b0,0x000000b0,0x0006002c, -0x0000004b,0x00003196,0x000004fc,0x000004fc, -0x000004fc,0x0004002b,0x00000027,0x00003198, -0x7f800000,0x0006002c,0x0000004b,0x00003199, -0x00003198,0x00003198,0x00003198,0x0004002b, -0x00000027,0x0000319a,0xff800000,0x0006002c, -0x0000004b,0x0000319b,0x0000319a,0x0000319a, -0x0000319a,0x0004002b,0x00000006,0x0000319c, +0x0000004b,0x000032a2,0x000004fc,0x000004fc, +0x000004fc,0x0004002b,0x00000027,0x000032a4, +0x7f800000,0x0006002c,0x0000004b,0x000032a5, +0x000032a4,0x000032a4,0x000032a4,0x0004002b, +0x00000027,0x000032a6,0xff800000,0x0006002c, +0x0000004b,0x000032a7,0x000032a6,0x000032a6, +0x000032a6,0x0004002b,0x00000006,0x000032a8, 0x000000ff,0x00050036,0x00000002,0x00000004, 0x00000000,0x00000003,0x000200f8,0x00000005, -0x0004003b,0x000003da,0x00001b65,0x00000007, -0x0004003b,0x0000054c,0x00001ba6,0x00000007, -0x0004003b,0x0000004c,0x00001ba9,0x00000007, -0x0004003b,0x0000004c,0x00001705,0x00000007, -0x0004003b,0x000002f7,0x0000151a,0x00000007, -0x0004003b,0x000008cb,0x00000d72,0x00000007, -0x000300f7,0x00000bb6,0x00000000,0x000300fb, -0x000000a6,0x00000bb7,0x000200f8,0x00000bb7, +0x0004003b,0x000003da,0x00001c65,0x00000007, +0x0004003b,0x0000054c,0x00001ca6,0x00000007, +0x0004003b,0x0000004c,0x00001ca9,0x00000007, +0x0004003b,0x0000004c,0x00001805,0x00000007, +0x0004003b,0x000002f7,0x0000161a,0x00000007, +0x0004003b,0x000008cb,0x00000daf,0x00000007, +0x000300f7,0x00000bf3,0x00000000,0x000300fb, +0x000000a6,0x00000bf4,0x000200f8,0x00000bf4, 0x00050041,0x00000b0f,0x00000b10,0x00000b0e, 0x000000a6,0x0004003d,0x00000006,0x00000b11, 0x00000b10,0x00050041,0x000000fe,0x00000b12, @@ -207,210 +208,210 @@ 0x00000b1a,0x00050041,0x00000b0f,0x00000b1d, 0x00000b18,0x000000a6,0x0004003d,0x00000006, 0x00000b1e,0x00000b1d,0x000500b0,0x0000002f, -0x00000bd3,0x00000b1e,0x0000011f,0x000300f7, -0x00000bd7,0x00000000,0x000400fa,0x00000bd3, -0x00000bd4,0x00000bd7,0x000200f8,0x00000bd4, -0x00050041,0x000006c2,0x00000bd6,0x000007a3, -0x00000b1e,0x0003003e,0x00000bd6,0x000000a6, -0x000200f9,0x00000bd7,0x000200f8,0x00000bd7, +0x00000c10,0x00000b1e,0x0000011f,0x000300f7, +0x00000c14,0x00000000,0x000400fa,0x00000c10, +0x00000c11,0x00000c14,0x000200f8,0x00000c11, +0x00050041,0x000006c2,0x00000c13,0x000007a3, +0x00000b1e,0x0003003e,0x00000c13,0x000000a6, +0x000200f9,0x00000c14,0x000200f8,0x00000c14, 0x000400e0,0x00000170,0x00000170,0x000006da, -0x00050084,0x00000006,0x00000bd9,0x00000b1b, -0x00000101,0x00050080,0x00000006,0x00000bdb, -0x00000bd9,0x00000101,0x00050041,0x000000fe, -0x00000bdc,0x000000fc,0x000000fd,0x0004003d, -0x00000006,0x00000bdd,0x00000bdc,0x0007000c, -0x00000006,0x00000bde,0x00000001,0x00000026, -0x00000bdb,0x00000bdd,0x00050080,0x00000006, -0x00000be1,0x00000bd9,0x00000b1e,0x000200f9, -0x00000be2,0x000200f8,0x00000be2,0x000700f5, -0x00000006,0x00003177,0x00000be1,0x00000bd7, -0x00000bf4,0x00000bf2,0x000500b0,0x0000002f, -0x00000be6,0x00003177,0x00000bde,0x000400f6, -0x00000bf5,0x00000bf2,0x00000000,0x000400fa, -0x00000be6,0x00000be7,0x00000bf5,0x000200f8, -0x00000be7,0x00050041,0x000000fe,0x00000c0b, +0x00050084,0x00000006,0x00000c16,0x00000b1b, +0x00000101,0x00050080,0x00000006,0x00000c18, +0x00000c16,0x00000101,0x00050041,0x000000fe, +0x00000c19,0x000000fc,0x000000fd,0x0004003d, +0x00000006,0x00000c1a,0x00000c19,0x0007000c, +0x00000006,0x00000c1b,0x00000001,0x00000026, +0x00000c18,0x00000c1a,0x00050080,0x00000006, +0x00000c1e,0x00000c16,0x00000b1e,0x000200f9, +0x00000c1f,0x000200f8,0x00000c1f,0x000700f5, +0x00000006,0x00003283,0x00000c1e,0x00000c14, +0x00000c31,0x00000c2f,0x000500b0,0x0000002f, +0x00000c23,0x00003283,0x00000c1b,0x000400f6, +0x00000c32,0x00000c2f,0x00000000,0x000400fa, +0x00000c23,0x00000c24,0x00000c32,0x000200f8, +0x00000c24,0x00050041,0x000000fe,0x00000c48, 0x000000fc,0x00000308,0x0004003d,0x00000006, -0x00000c0c,0x00000c0b,0x000500c7,0x00000006, -0x00000c0d,0x00000c0c,0x000000b0,0x000500aa, -0x0000002f,0x00000c0e,0x00000c0d,0x000000a6, -0x000300f7,0x00000c13,0x00000000,0x000400fa, -0x00000c0e,0x00000c0f,0x00000c11,0x000200f8, -0x00000c0f,0x000200f9,0x00000c13,0x000200f8, -0x00000c11,0x00050084,0x00000006,0x00000c1b, -0x00000111,0x00000bdd,0x00050080,0x00000006, -0x00000c1c,0x00000107,0x00000c1b,0x000200f9, -0x00000c13,0x000200f8,0x00000c13,0x000700f5, -0x00000006,0x00003178,0x00000107,0x00000c0f, -0x00000c1c,0x00000c11,0x00050084,0x00000006, -0x00000bea,0x0000010a,0x00003177,0x00050080, -0x00000006,0x00000beb,0x00003178,0x00000bea, -0x00050041,0x00000156,0x00000bec,0x000000fc, -0x00000154,0x0004003d,0x00000007,0x00000bed, -0x00000bec,0x00050051,0x00000006,0x00000c33, -0x00000bed,0x00000000,0x00050095,0x000000ab, -0x00000c35,0x00000c33,0x00000beb,0x00050051, -0x00000006,0x00000c36,0x00000c35,0x00000001, -0x00050051,0x00000006,0x00000c37,0x00000c35, -0x00000000,0x00050051,0x00000006,0x00000c3a, -0x00000bed,0x00000001,0x00050080,0x00000006, -0x00000c3c,0x00000c3a,0x00000c36,0x00050050, -0x00000007,0x00000c3d,0x00000c37,0x00000c3c, -0x0004007c,0x00000014,0x00000c2d,0x00000c3d, -0x00060041,0x000000db,0x00000c24,0x00000c2d, +0x00000c49,0x00000c48,0x000500c7,0x00000006, +0x00000c4a,0x00000c49,0x000000b0,0x000500aa, +0x0000002f,0x00000c4b,0x00000c4a,0x000000a6, +0x000300f7,0x00000c50,0x00000000,0x000400fa, +0x00000c4b,0x00000c4c,0x00000c4e,0x000200f8, +0x00000c4c,0x000200f9,0x00000c50,0x000200f8, +0x00000c4e,0x00050084,0x00000006,0x00000c58, +0x00000111,0x00000c1a,0x00050080,0x00000006, +0x00000c59,0x00000107,0x00000c58,0x000200f9, +0x00000c50,0x000200f8,0x00000c50,0x000700f5, +0x00000006,0x00003284,0x00000107,0x00000c4c, +0x00000c59,0x00000c4e,0x00050084,0x00000006, +0x00000c27,0x0000010a,0x00003283,0x00050080, +0x00000006,0x00000c28,0x00003284,0x00000c27, +0x00050041,0x00000156,0x00000c29,0x000000fc, +0x00000154,0x0004003d,0x00000007,0x00000c2a, +0x00000c29,0x00050051,0x00000006,0x00000c70, +0x00000c2a,0x00000000,0x00050095,0x000000ab, +0x00000c72,0x00000c70,0x00000c28,0x00050051, +0x00000006,0x00000c73,0x00000c72,0x00000001, +0x00050051,0x00000006,0x00000c74,0x00000c72, +0x00000000,0x00050051,0x00000006,0x00000c77, +0x00000c2a,0x00000001,0x00050080,0x00000006, +0x00000c79,0x00000c77,0x00000c73,0x00050050, +0x00000007,0x00000c7a,0x00000c74,0x00000c79, +0x0004007c,0x00000014,0x00000c6a,0x00000c7a, +0x00060041,0x000000db,0x00000c61,0x00000c6a, 0x000000da,0x000000da,0x0006003d,0x00000006, -0x00000c25,0x00000c24,0x00000002,0x00000004, -0x00050084,0x00000006,0x00000c43,0x0000010a, -0x00000c0c,0x000500c2,0x00000006,0x00000c44, -0x00000c25,0x00000c43,0x000500c7,0x00000006, -0x00000c45,0x00000c44,0x00000799,0x00050041, -0x000006c2,0x00000bf0,0x000007a3,0x00000c45, -0x000700ea,0x00000006,0x00000bf1,0x00000bf0, +0x00000c62,0x00000c61,0x00000002,0x00000004, +0x00050084,0x00000006,0x00000c80,0x0000010a, +0x00000c49,0x000500c2,0x00000006,0x00000c81, +0x00000c62,0x00000c80,0x000500c7,0x00000006, +0x00000c82,0x00000c81,0x00000799,0x00050041, +0x000006c2,0x00000c2d,0x000007a3,0x00000c82, +0x000700ea,0x00000006,0x00000c2e,0x00000c2d, 0x000000b0,0x000000a6,0x000000b0,0x000200f9, -0x00000bf2,0x000200f8,0x00000bf2,0x00050080, -0x00000006,0x00000bf4,0x00003177,0x00000107, -0x000200f9,0x00000be2,0x000200f8,0x00000bf5, +0x00000c2f,0x000200f8,0x00000c2f,0x00050080, +0x00000006,0x00000c31,0x00003283,0x00000107, +0x000200f9,0x00000c1f,0x000200f8,0x00000c32, 0x000400e0,0x00000170,0x00000170,0x000006da, -0x000300f7,0x00000c07,0x00000000,0x000400fa, -0x00000bd3,0x00000bf8,0x00000c07,0x000200f8, -0x00000bf8,0x00050084,0x00000006,0x00000c4a, -0x0000011f,0x00000bdd,0x00050080,0x00000006, -0x00000c4b,0x00000107,0x00000c4a,0x00050080, -0x00000006,0x00000c51,0x00000bdd,0x0000319c, -0x00050086,0x00000006,0x00000c52,0x00000c51, -0x00000101,0x00050084,0x00000006,0x00000bfc, -0x00000b1e,0x00000c52,0x00050080,0x00000006, -0x00000bfe,0x00000bfc,0x00000b1b,0x00050084, -0x00000006,0x00000bff,0x0000010a,0x00000bfe, -0x00050080,0x00000006,0x00000c00,0x00000c4b, -0x00000bff,0x00050041,0x00000156,0x00000c02, +0x000300f7,0x00000c44,0x00000000,0x000400fa, +0x00000c10,0x00000c35,0x00000c44,0x000200f8, +0x00000c35,0x00050084,0x00000006,0x00000c87, +0x0000011f,0x00000c1a,0x00050080,0x00000006, +0x00000c88,0x00000107,0x00000c87,0x00050080, +0x00000006,0x00000c8e,0x00000c1a,0x000032a8, +0x00050086,0x00000006,0x00000c8f,0x00000c8e, +0x00000101,0x00050084,0x00000006,0x00000c39, +0x00000b1e,0x00000c8f,0x00050080,0x00000006, +0x00000c3b,0x00000c39,0x00000b1b,0x00050084, +0x00000006,0x00000c3c,0x0000010a,0x00000c3b, +0x00050080,0x00000006,0x00000c3d,0x00000c88, +0x00000c3c,0x00050041,0x00000156,0x00000c3f, 0x000000fc,0x00000154,0x0004003d,0x00000007, -0x00000c03,0x00000c02,0x00050041,0x000006c2, -0x00000c04,0x000007a3,0x00000b1e,0x0004003d, -0x00000006,0x00000c05,0x00000c04,0x00050051, -0x00000006,0x00000c68,0x00000c03,0x00000000, -0x00050095,0x000000ab,0x00000c6a,0x00000c68, -0x00000c00,0x00050051,0x00000006,0x00000c6b, -0x00000c6a,0x00000001,0x00050051,0x00000006, -0x00000c6c,0x00000c6a,0x00000000,0x00050051, -0x00000006,0x00000c6f,0x00000c03,0x00000001, -0x00050080,0x00000006,0x00000c71,0x00000c6f, -0x00000c6b,0x00050050,0x00000007,0x00000c72, -0x00000c6c,0x00000c71,0x0004007c,0x00000014, -0x00000c62,0x00000c72,0x00060041,0x000000db, -0x00000c5a,0x00000c62,0x000000da,0x000000da, -0x0005003e,0x00000c5a,0x00000c05,0x00000002, -0x00000004,0x000200f9,0x00000c07,0x000200f8, -0x00000c07,0x000200f9,0x00000bb6,0x000200f8, +0x00000c40,0x00000c3f,0x00050041,0x000006c2, +0x00000c41,0x000007a3,0x00000b1e,0x0004003d, +0x00000006,0x00000c42,0x00000c41,0x00050051, +0x00000006,0x00000ca5,0x00000c40,0x00000000, +0x00050095,0x000000ab,0x00000ca7,0x00000ca5, +0x00000c3d,0x00050051,0x00000006,0x00000ca8, +0x00000ca7,0x00000001,0x00050051,0x00000006, +0x00000ca9,0x00000ca7,0x00000000,0x00050051, +0x00000006,0x00000cac,0x00000c40,0x00000001, +0x00050080,0x00000006,0x00000cae,0x00000cac, +0x00000ca8,0x00050050,0x00000007,0x00000caf, +0x00000ca9,0x00000cae,0x0004007c,0x00000014, +0x00000c9f,0x00000caf,0x00060041,0x000000db, +0x00000c97,0x00000c9f,0x000000da,0x000000da, +0x0005003e,0x00000c97,0x00000c42,0x00000002, +0x00000004,0x000200f9,0x00000c44,0x000200f8, +0x00000c44,0x000200f9,0x00000bf3,0x000200f8, 0x00000b16,0x000500aa,0x0000002f,0x00000b23, 0x00000b13,0x00000111,0x000300f7,0x00000b25, 0x00000000,0x000400fa,0x00000b23,0x00000b24, 0x00000b25,0x000200f8,0x00000b24,0x00050041, 0x00000b0f,0x00000b27,0x00000b18,0x000000a6, 0x0004003d,0x00000006,0x00000b28,0x00000b27, -0x00050041,0x000000fe,0x00000ce5,0x000000fc, -0x000000fd,0x0004003d,0x00000006,0x00000ce6, -0x00000ce5,0x00050080,0x00000006,0x00000ce8, -0x00000ce6,0x0000319c,0x00050086,0x00000006, -0x00000ce9,0x00000ce8,0x00000101,0x00050084, -0x00000006,0x00000c88,0x0000011f,0x00000ce9, -0x00050080,0x00000006,0x00000c8a,0x00000c88, -0x000007e4,0x00050086,0x00000006,0x00000c8b, -0x00000c8a,0x00000107,0x00050084,0x00000006, -0x00000c8e,0x00000b28,0x00000c8b,0x0007000c, -0x00000006,0x00000c90,0x00000001,0x00000026, -0x00000c8e,0x00000c88,0x00050080,0x00000006, -0x00000c93,0x00000c90,0x00000c8b,0x0007000c, -0x00000006,0x00000c95,0x00000001,0x00000026, -0x00000c93,0x00000c88,0x000200f9,0x00000c97, -0x000200f8,0x00000c97,0x000700f5,0x00000006, -0x00003172,0x000000a6,0x00000b24,0x00000ca5, -0x00000c9c,0x000700f5,0x00000006,0x00003171, -0x00000c90,0x00000b24,0x00000ca8,0x00000c9c, -0x000500b0,0x0000002f,0x00000c9b,0x00003171, -0x00000c95,0x000400f6,0x00000ca9,0x00000c9c, -0x00000000,0x000400fa,0x00000c9b,0x00000c9c, -0x00000ca9,0x000200f8,0x00000c9c,0x00050084, -0x00000006,0x00000cee,0x0000011f,0x00000ce6, -0x00050080,0x00000006,0x00000cef,0x00000107, -0x00000cee,0x00050084,0x00000006,0x00000c9f, -0x0000010a,0x00003171,0x00050080,0x00000006, -0x00000ca0,0x00000cef,0x00000c9f,0x00050041, -0x00000156,0x00000ca1,0x000000fc,0x00000154, -0x0004003d,0x00000007,0x00000ca2,0x00000ca1, -0x00050051,0x00000006,0x00000d06,0x00000ca2, -0x00000000,0x00050095,0x000000ab,0x00000d08, -0x00000d06,0x00000ca0,0x00050051,0x00000006, -0x00000d09,0x00000d08,0x00000001,0x00050051, -0x00000006,0x00000d0a,0x00000d08,0x00000000, -0x00050051,0x00000006,0x00000d0d,0x00000ca2, -0x00000001,0x00050080,0x00000006,0x00000d0f, -0x00000d0d,0x00000d09,0x00050050,0x00000007, -0x00000d10,0x00000d0a,0x00000d0f,0x0004007c, -0x00000014,0x00000d00,0x00000d10,0x00060041, -0x000000db,0x00000cf7,0x00000d00,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00000cf8, -0x00000cf7,0x00000002,0x00000004,0x00050080, -0x00000006,0x00000ca5,0x00003172,0x00000cf8, -0x00050080,0x00000006,0x00000ca8,0x00003171, -0x00000154,0x000200f9,0x00000c97,0x000200f8, -0x00000ca9,0x00050041,0x000006c2,0x00000cac, -0x0000080d,0x00000b28,0x0003003e,0x00000cac, -0x00003172,0x000400e0,0x00000170,0x00000170, -0x000006da,0x000500aa,0x0000002f,0x00000cae, -0x00000b28,0x000000a6,0x000300f7,0x00000cc2, -0x00000000,0x000400fa,0x00000cae,0x00000caf, -0x00000cc2,0x000200f8,0x00000caf,0x000200f9, -0x00000cb0,0x000200f8,0x00000cb0,0x000700f5, -0x00000006,0x00003176,0x000000a6,0x00000caf, -0x00000cbd,0x00000cb4,0x000700f5,0x00000006, -0x00003173,0x000000a6,0x00000caf,0x00000cc0, -0x00000cb4,0x000500b0,0x0000002f,0x00000cb3, -0x00003173,0x00000107,0x000400f6,0x00000cc1, -0x00000cb4,0x00000000,0x000400fa,0x00000cb3, -0x00000cb4,0x00000cc1,0x000200f8,0x00000cb4, -0x00050041,0x000006c2,0x00000cb6,0x0000080d, -0x00003173,0x0004003d,0x00000006,0x00000cb7, -0x00000cb6,0x0003003e,0x00000cb6,0x00003176, -0x00050080,0x00000006,0x00000cbd,0x00003176, -0x00000cb7,0x00050080,0x00000006,0x00000cc0, -0x00003173,0x00000154,0x000200f9,0x00000cb0, -0x000200f8,0x00000cc1,0x000200f9,0x00000cc2, -0x000200f8,0x00000cc2,0x000400e0,0x00000170, +0x00050041,0x000000fe,0x00000d22,0x000000fc, +0x000000fd,0x0004003d,0x00000006,0x00000d23, +0x00000d22,0x00050080,0x00000006,0x00000d25, +0x00000d23,0x000032a8,0x00050086,0x00000006, +0x00000d26,0x00000d25,0x00000101,0x00050084, +0x00000006,0x00000cc5,0x0000011f,0x00000d26, +0x00050080,0x00000006,0x00000cc7,0x00000cc5, +0x000007e4,0x00050086,0x00000006,0x00000cc8, +0x00000cc7,0x00000107,0x00050084,0x00000006, +0x00000ccb,0x00000b28,0x00000cc8,0x0007000c, +0x00000006,0x00000ccd,0x00000001,0x00000026, +0x00000ccb,0x00000cc5,0x00050080,0x00000006, +0x00000cd0,0x00000ccd,0x00000cc8,0x0007000c, +0x00000006,0x00000cd2,0x00000001,0x00000026, +0x00000cd0,0x00000cc5,0x000200f9,0x00000cd4, +0x000200f8,0x00000cd4,0x000700f5,0x00000006, +0x0000327e,0x000000a6,0x00000b24,0x00000ce2, +0x00000cd9,0x000700f5,0x00000006,0x0000327d, +0x00000ccd,0x00000b24,0x00000ce5,0x00000cd9, +0x000500b0,0x0000002f,0x00000cd8,0x0000327d, +0x00000cd2,0x000400f6,0x00000ce6,0x00000cd9, +0x00000000,0x000400fa,0x00000cd8,0x00000cd9, +0x00000ce6,0x000200f8,0x00000cd9,0x00050084, +0x00000006,0x00000d2b,0x0000011f,0x00000d23, +0x00050080,0x00000006,0x00000d2c,0x00000107, +0x00000d2b,0x00050084,0x00000006,0x00000cdc, +0x0000010a,0x0000327d,0x00050080,0x00000006, +0x00000cdd,0x00000d2c,0x00000cdc,0x00050041, +0x00000156,0x00000cde,0x000000fc,0x00000154, +0x0004003d,0x00000007,0x00000cdf,0x00000cde, +0x00050051,0x00000006,0x00000d43,0x00000cdf, +0x00000000,0x00050095,0x000000ab,0x00000d45, +0x00000d43,0x00000cdd,0x00050051,0x00000006, +0x00000d46,0x00000d45,0x00000001,0x00050051, +0x00000006,0x00000d47,0x00000d45,0x00000000, +0x00050051,0x00000006,0x00000d4a,0x00000cdf, +0x00000001,0x00050080,0x00000006,0x00000d4c, +0x00000d4a,0x00000d46,0x00050050,0x00000007, +0x00000d4d,0x00000d47,0x00000d4c,0x0004007c, +0x00000014,0x00000d3d,0x00000d4d,0x00060041, +0x000000db,0x00000d34,0x00000d3d,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00000d35, +0x00000d34,0x00000002,0x00000004,0x00050080, +0x00000006,0x00000ce2,0x0000327e,0x00000d35, +0x00050080,0x00000006,0x00000ce5,0x0000327d, +0x00000154,0x000200f9,0x00000cd4,0x000200f8, +0x00000ce6,0x00050041,0x000006c2,0x00000ce9, +0x0000080d,0x00000b28,0x0003003e,0x00000ce9, +0x0000327e,0x000400e0,0x00000170,0x00000170, +0x000006da,0x000500aa,0x0000002f,0x00000ceb, +0x00000b28,0x000000a6,0x000300f7,0x00000cff, +0x00000000,0x000400fa,0x00000ceb,0x00000cec, +0x00000cff,0x000200f8,0x00000cec,0x000200f9, +0x00000ced,0x000200f8,0x00000ced,0x000700f5, +0x00000006,0x00003282,0x000000a6,0x00000cec, +0x00000cfa,0x00000cf1,0x000700f5,0x00000006, +0x0000327f,0x000000a6,0x00000cec,0x00000cfd, +0x00000cf1,0x000500b0,0x0000002f,0x00000cf0, +0x0000327f,0x00000107,0x000400f6,0x00000cfe, +0x00000cf1,0x00000000,0x000400fa,0x00000cf0, +0x00000cf1,0x00000cfe,0x000200f8,0x00000cf1, +0x00050041,0x000006c2,0x00000cf3,0x0000080d, +0x0000327f,0x0004003d,0x00000006,0x00000cf4, +0x00000cf3,0x0003003e,0x00000cf3,0x00003282, +0x00050080,0x00000006,0x00000cfa,0x00003282, +0x00000cf4,0x00050080,0x00000006,0x00000cfd, +0x0000327f,0x00000154,0x000200f9,0x00000ced, +0x000200f8,0x00000cfe,0x000200f9,0x00000cff, +0x000200f8,0x00000cff,0x000400e0,0x00000170, 0x00000170,0x000006da,0x0004003d,0x00000006, -0x00000cc5,0x00000cac,0x000200f9,0x00000cc7, -0x000200f8,0x00000cc7,0x000700f5,0x00000006, -0x00003175,0x00000cc5,0x00000cc2,0x00000cde, -0x00000ccc,0x000700f5,0x00000006,0x00003174, -0x00000c90,0x00000cc2,0x00000ce1,0x00000ccc, -0x000500b0,0x0000002f,0x00000ccb,0x00003174, -0x00000c95,0x000400f6,0x00000ce2,0x00000ccc, -0x00000000,0x000400fa,0x00000ccb,0x00000ccc, -0x00000ce2,0x000200f8,0x00000ccc,0x00050084, -0x00000006,0x00000d15,0x0000011f,0x00000ce6, -0x00050080,0x00000006,0x00000d16,0x00000107, -0x00000d15,0x00050084,0x00000006,0x00000ccf, -0x0000010a,0x00003174,0x00050080,0x00000006, -0x00000cd0,0x00000d16,0x00000ccf,0x00050041, -0x00000156,0x00000cd1,0x000000fc,0x00000154, -0x0004003d,0x00000007,0x00000cd2,0x00000cd1, -0x00050051,0x00000006,0x00000d2d,0x00000cd2, -0x00000000,0x00050095,0x000000ab,0x00000d2f, -0x00000d2d,0x00000cd0,0x00050051,0x00000006, -0x00000d30,0x00000d2f,0x00000001,0x00050051, -0x00000006,0x00000d31,0x00000d2f,0x00000000, -0x00050051,0x00000006,0x00000d34,0x00000cd2, -0x00000001,0x00050080,0x00000006,0x00000d36, -0x00000d34,0x00000d30,0x00050050,0x00000007, -0x00000d37,0x00000d31,0x00000d36,0x0004007c, -0x00000014,0x00000d27,0x00000d37,0x00060041, -0x000000db,0x00000d1e,0x00000d27,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00000d1f, -0x00000d1e,0x00000002,0x00000004,0x0005003e, -0x00000d1e,0x00003175,0x00000002,0x00000004, -0x00050080,0x00000006,0x00000cde,0x00003175, -0x00000d1f,0x00050080,0x00000006,0x00000ce1, -0x00003174,0x00000154,0x000200f9,0x00000cc7, -0x000200f8,0x00000ce2,0x000200f9,0x00000bb6, +0x00000d02,0x00000ce9,0x000200f9,0x00000d04, +0x000200f8,0x00000d04,0x000700f5,0x00000006, +0x00003281,0x00000d02,0x00000cff,0x00000d1b, +0x00000d09,0x000700f5,0x00000006,0x00003280, +0x00000ccd,0x00000cff,0x00000d1e,0x00000d09, +0x000500b0,0x0000002f,0x00000d08,0x00003280, +0x00000cd2,0x000400f6,0x00000d1f,0x00000d09, +0x00000000,0x000400fa,0x00000d08,0x00000d09, +0x00000d1f,0x000200f8,0x00000d09,0x00050084, +0x00000006,0x00000d52,0x0000011f,0x00000d23, +0x00050080,0x00000006,0x00000d53,0x00000107, +0x00000d52,0x00050084,0x00000006,0x00000d0c, +0x0000010a,0x00003280,0x00050080,0x00000006, +0x00000d0d,0x00000d53,0x00000d0c,0x00050041, +0x00000156,0x00000d0e,0x000000fc,0x00000154, +0x0004003d,0x00000007,0x00000d0f,0x00000d0e, +0x00050051,0x00000006,0x00000d6a,0x00000d0f, +0x00000000,0x00050095,0x000000ab,0x00000d6c, +0x00000d6a,0x00000d0d,0x00050051,0x00000006, +0x00000d6d,0x00000d6c,0x00000001,0x00050051, +0x00000006,0x00000d6e,0x00000d6c,0x00000000, +0x00050051,0x00000006,0x00000d71,0x00000d0f, +0x00000001,0x00050080,0x00000006,0x00000d73, +0x00000d71,0x00000d6d,0x00050050,0x00000007, +0x00000d74,0x00000d6e,0x00000d73,0x0004007c, +0x00000014,0x00000d64,0x00000d74,0x00060041, +0x000000db,0x00000d5b,0x00000d64,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00000d5c, +0x00000d5b,0x00000002,0x00000004,0x0005003e, +0x00000d5b,0x00003281,0x00000002,0x00000004, +0x00050080,0x00000006,0x00000d1b,0x00003281, +0x00000d5c,0x00050080,0x00000006,0x00000d1e, +0x00003280,0x00000154,0x000200f9,0x00000d04, +0x000200f8,0x00000d1f,0x000200f9,0x00000bf3, 0x000200f8,0x00000b25,0x000500aa,0x0000002f, 0x00000b2d,0x00000b13,0x0000038a,0x000300f7, 0x00000b2f,0x00000000,0x000400fa,0x00000b2d, @@ -420,475 +421,475 @@ 0x00000b31,0x00050041,0x00000b0f,0x00000b34, 0x00000b18,0x000000a6,0x0004003d,0x00000006, 0x00000b35,0x00000b34,0x000500b0,0x0000002f, -0x00000d7e,0x00000b35,0x0000011f,0x000300f7, -0x00000d8d,0x00000000,0x000400fa,0x00000d7e, -0x00000d7f,0x00000d8d,0x000200f8,0x00000d7f, -0x00050041,0x000000fe,0x00000e2f,0x000000fc, -0x000000fd,0x0004003d,0x00000006,0x00000e30, -0x00000e2f,0x00050084,0x00000006,0x00000e31, -0x0000011f,0x00000e30,0x00050080,0x00000006, -0x00000e32,0x00000107,0x00000e31,0x00050080, -0x00000006,0x00000e38,0x00000e30,0x0000319c, -0x00050086,0x00000006,0x00000e39,0x00000e38, -0x00000101,0x00050084,0x00000006,0x00000d84, -0x00000b35,0x00000e39,0x00050080,0x00000006, -0x00000d86,0x00000d84,0x00000b32,0x00050084, -0x00000006,0x00000d87,0x0000010a,0x00000d86, -0x00050080,0x00000006,0x00000d88,0x00000e32, -0x00000d87,0x00050041,0x00000156,0x00000d89, +0x00000dbb,0x00000b35,0x0000011f,0x000300f7, +0x00000dca,0x00000000,0x000400fa,0x00000dbb, +0x00000dbc,0x00000dca,0x000200f8,0x00000dbc, +0x00050041,0x000000fe,0x00000e6c,0x000000fc, +0x000000fd,0x0004003d,0x00000006,0x00000e6d, +0x00000e6c,0x00050084,0x00000006,0x00000e6e, +0x0000011f,0x00000e6d,0x00050080,0x00000006, +0x00000e6f,0x00000107,0x00000e6e,0x00050080, +0x00000006,0x00000e75,0x00000e6d,0x000032a8, +0x00050086,0x00000006,0x00000e76,0x00000e75, +0x00000101,0x00050084,0x00000006,0x00000dc1, +0x00000b35,0x00000e76,0x00050080,0x00000006, +0x00000dc3,0x00000dc1,0x00000b32,0x00050084, +0x00000006,0x00000dc4,0x0000010a,0x00000dc3, +0x00050080,0x00000006,0x00000dc5,0x00000e6f, +0x00000dc4,0x00050041,0x00000156,0x00000dc6, 0x000000fc,0x00000154,0x0004003d,0x00000007, -0x00000d8a,0x00000d89,0x00050051,0x00000006, -0x00000e50,0x00000d8a,0x00000000,0x00050095, -0x000000ab,0x00000e52,0x00000e50,0x00000d88, -0x00050051,0x00000006,0x00000e53,0x00000e52, -0x00000001,0x00050051,0x00000006,0x00000e54, -0x00000e52,0x00000000,0x00050051,0x00000006, -0x00000e57,0x00000d8a,0x00000001,0x00050080, -0x00000006,0x00000e59,0x00000e57,0x00000e53, -0x00050050,0x00000007,0x00000e5a,0x00000e54, -0x00000e59,0x0004007c,0x00000014,0x00000e4a, -0x00000e5a,0x00060041,0x000000db,0x00000e41, -0x00000e4a,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00000e42,0x00000e41,0x00000002, -0x00000004,0x00050041,0x000006c2,0x00000d8c, -0x00000856,0x00000b35,0x0003003e,0x00000d8c, -0x00000e42,0x000200f9,0x00000d8d,0x000200f8, -0x00000d8d,0x00050084,0x00000006,0x00000d8f, +0x00000dc7,0x00000dc6,0x00050051,0x00000006, +0x00000e8d,0x00000dc7,0x00000000,0x00050095, +0x000000ab,0x00000e8f,0x00000e8d,0x00000dc5, +0x00050051,0x00000006,0x00000e90,0x00000e8f, +0x00000001,0x00050051,0x00000006,0x00000e91, +0x00000e8f,0x00000000,0x00050051,0x00000006, +0x00000e94,0x00000dc7,0x00000001,0x00050080, +0x00000006,0x00000e96,0x00000e94,0x00000e90, +0x00050050,0x00000007,0x00000e97,0x00000e91, +0x00000e96,0x0004007c,0x00000014,0x00000e87, +0x00000e97,0x00060041,0x000000db,0x00000e7e, +0x00000e87,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00000e7f,0x00000e7e,0x00000002, +0x00000004,0x00050041,0x000006c2,0x00000dc9, +0x00000856,0x00000b35,0x0003003e,0x00000dc9, +0x00000e7f,0x000200f9,0x00000dca,0x000200f8, +0x00000dca,0x00050084,0x00000006,0x00000dcc, 0x00000b32,0x00000101,0x00050080,0x00000006, -0x00000d91,0x00000d8f,0x00000101,0x00050041, -0x000000fe,0x00000d92,0x000000fc,0x000000fd, -0x0004003d,0x00000006,0x00000d93,0x00000d92, -0x0007000c,0x00000006,0x00000d94,0x00000001, -0x00000026,0x00000d91,0x00000d93,0x000200f9, -0x00000d96,0x000200f8,0x00000d96,0x000700f5, -0x00000006,0x00003158,0x00000d8f,0x00000d8d, -0x00000e2b,0x00000e29,0x000500b0,0x0000002f, -0x00000d9a,0x00003158,0x00000d94,0x000400f6, -0x00000e2c,0x00000e29,0x00000000,0x000400fa, -0x00000d9a,0x00000d9b,0x00000e2c,0x000200f8, -0x00000d9b,0x00050080,0x00000006,0x00000d9e, -0x00003158,0x00000b35,0x000500b0,0x0000002f, -0x00000da1,0x00000d9e,0x00000d94,0x000300f7, -0x00000dac,0x00000000,0x000400fa,0x00000da1, -0x00000da3,0x00000dab,0x000200f8,0x00000da3, -0x00050041,0x000000fe,0x00000e5e,0x000000fc, -0x00000308,0x0004003d,0x00000006,0x00000e5f, -0x00000e5e,0x000500c7,0x00000006,0x00000e60, -0x00000e5f,0x000000b0,0x000500aa,0x0000002f, -0x00000e61,0x00000e60,0x000000a6,0x000300f7, -0x00000e66,0x00000000,0x000400fa,0x00000e61, -0x00000e62,0x00000e64,0x000200f8,0x00000e62, -0x000200f9,0x00000e66,0x000200f8,0x00000e64, -0x00050084,0x00000006,0x00000e6e,0x00000111, -0x00000d93,0x00050080,0x00000006,0x00000e6f, -0x00000107,0x00000e6e,0x000200f9,0x00000e66, -0x000200f8,0x00000e66,0x000700f5,0x00000006, -0x00003159,0x00000107,0x00000e62,0x00000e6f, -0x00000e64,0x00050084,0x00000006,0x00000da6, -0x0000010a,0x00000d9e,0x00050080,0x00000006, -0x00000da7,0x00003159,0x00000da6,0x00050041, -0x00000156,0x00000da8,0x000000fc,0x00000154, -0x0004003d,0x00000007,0x00000da9,0x00000da8, -0x00050051,0x00000006,0x00000e86,0x00000da9, -0x00000000,0x00050095,0x000000ab,0x00000e88, -0x00000e86,0x00000da7,0x00050051,0x00000006, -0x00000e89,0x00000e88,0x00000001,0x00050051, -0x00000006,0x00000e8a,0x00000e88,0x00000000, -0x00050051,0x00000006,0x00000e8d,0x00000da9, -0x00000001,0x00050080,0x00000006,0x00000e8f, -0x00000e8d,0x00000e89,0x00050050,0x00000007, -0x00000e90,0x00000e8a,0x00000e8f,0x0004007c, -0x00000014,0x00000e80,0x00000e90,0x00060041, -0x000000db,0x00000e77,0x00000e80,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00000e78, -0x00000e77,0x00000002,0x00000004,0x000200f9, -0x00000dac,0x000200f8,0x00000dab,0x000200f9, -0x00000dac,0x000200f8,0x00000dac,0x000700f5, -0x00000006,0x0000315a,0x00000e78,0x00000e66, -0x000000a6,0x00000dab,0x000300f7,0x00000db8, -0x00000000,0x000400fa,0x00000da1,0x00000daf, -0x00000db7,0x000200f8,0x00000daf,0x00050041, -0x000000fe,0x00000e94,0x000000fc,0x00000308, -0x0004003d,0x00000006,0x00000e95,0x00000e94, -0x000500c7,0x00000006,0x00000e96,0x00000e95, -0x000000b0,0x000500aa,0x0000002f,0x00000e97, -0x00000e96,0x000000a6,0x000300f7,0x00000e9c, -0x00000000,0x000400fa,0x00000e97,0x00000e98, -0x00000e9a,0x000200f8,0x00000e98,0x00050084, -0x00000006,0x00000ea2,0x0000010a,0x00000d93, -0x00050080,0x00000006,0x00000ea3,0x00000107, -0x00000ea2,0x000200f9,0x00000e9c,0x000200f8, -0x00000e9a,0x00050084,0x00000006,0x00000ea8, -0x00000118,0x00000d93,0x00050080,0x00000006, -0x00000ea9,0x00000107,0x00000ea8,0x000200f9, -0x00000e9c,0x000200f8,0x00000e9c,0x000700f5, -0x00000006,0x0000315b,0x00000ea3,0x00000e98, -0x00000ea9,0x00000e9a,0x00050084,0x00000006, -0x00000db2,0x0000010a,0x00000d9e,0x00050080, -0x00000006,0x00000db3,0x0000315b,0x00000db2, -0x00050041,0x00000156,0x00000db4,0x000000fc, -0x00000154,0x0004003d,0x00000007,0x00000db5, -0x00000db4,0x00050051,0x00000006,0x00000ec0, -0x00000db5,0x00000000,0x00050095,0x000000ab, -0x00000ec2,0x00000ec0,0x00000db3,0x00050051, -0x00000006,0x00000ec3,0x00000ec2,0x00000001, -0x00050051,0x00000006,0x00000ec4,0x00000ec2, -0x00000000,0x00050051,0x00000006,0x00000ec7, -0x00000db5,0x00000001,0x00050080,0x00000006, -0x00000ec9,0x00000ec7,0x00000ec3,0x00050050, -0x00000007,0x00000eca,0x00000ec4,0x00000ec9, -0x0004007c,0x00000014,0x00000eba,0x00000eca, -0x00060041,0x000000db,0x00000eb1,0x00000eba, +0x00000dce,0x00000dcc,0x00000101,0x00050041, +0x000000fe,0x00000dcf,0x000000fc,0x000000fd, +0x0004003d,0x00000006,0x00000dd0,0x00000dcf, +0x0007000c,0x00000006,0x00000dd1,0x00000001, +0x00000026,0x00000dce,0x00000dd0,0x000200f9, +0x00000dd3,0x000200f8,0x00000dd3,0x000700f5, +0x00000006,0x00003264,0x00000dcc,0x00000dca, +0x00000e68,0x00000e66,0x000500b0,0x0000002f, +0x00000dd7,0x00003264,0x00000dd1,0x000400f6, +0x00000e69,0x00000e66,0x00000000,0x000400fa, +0x00000dd7,0x00000dd8,0x00000e69,0x000200f8, +0x00000dd8,0x00050080,0x00000006,0x00000ddb, +0x00003264,0x00000b35,0x000500b0,0x0000002f, +0x00000dde,0x00000ddb,0x00000dd1,0x000300f7, +0x00000de9,0x00000000,0x000400fa,0x00000dde, +0x00000de0,0x00000de8,0x000200f8,0x00000de0, +0x00050041,0x000000fe,0x00000e9b,0x000000fc, +0x00000308,0x0004003d,0x00000006,0x00000e9c, +0x00000e9b,0x000500c7,0x00000006,0x00000e9d, +0x00000e9c,0x000000b0,0x000500aa,0x0000002f, +0x00000e9e,0x00000e9d,0x000000a6,0x000300f7, +0x00000ea3,0x00000000,0x000400fa,0x00000e9e, +0x00000e9f,0x00000ea1,0x000200f8,0x00000e9f, +0x000200f9,0x00000ea3,0x000200f8,0x00000ea1, +0x00050084,0x00000006,0x00000eab,0x00000111, +0x00000dd0,0x00050080,0x00000006,0x00000eac, +0x00000107,0x00000eab,0x000200f9,0x00000ea3, +0x000200f8,0x00000ea3,0x000700f5,0x00000006, +0x00003265,0x00000107,0x00000e9f,0x00000eac, +0x00000ea1,0x00050084,0x00000006,0x00000de3, +0x0000010a,0x00000ddb,0x00050080,0x00000006, +0x00000de4,0x00003265,0x00000de3,0x00050041, +0x00000156,0x00000de5,0x000000fc,0x00000154, +0x0004003d,0x00000007,0x00000de6,0x00000de5, +0x00050051,0x00000006,0x00000ec3,0x00000de6, +0x00000000,0x00050095,0x000000ab,0x00000ec5, +0x00000ec3,0x00000de4,0x00050051,0x00000006, +0x00000ec6,0x00000ec5,0x00000001,0x00050051, +0x00000006,0x00000ec7,0x00000ec5,0x00000000, +0x00050051,0x00000006,0x00000eca,0x00000de6, +0x00000001,0x00050080,0x00000006,0x00000ecc, +0x00000eca,0x00000ec6,0x00050050,0x00000007, +0x00000ecd,0x00000ec7,0x00000ecc,0x0004007c, +0x00000014,0x00000ebd,0x00000ecd,0x00060041, +0x000000db,0x00000eb4,0x00000ebd,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00000eb5, +0x00000eb4,0x00000002,0x00000004,0x000200f9, +0x00000de9,0x000200f8,0x00000de8,0x000200f9, +0x00000de9,0x000200f8,0x00000de9,0x000700f5, +0x00000006,0x00003266,0x00000eb5,0x00000ea3, +0x000000a6,0x00000de8,0x000300f7,0x00000df5, +0x00000000,0x000400fa,0x00000dde,0x00000dec, +0x00000df4,0x000200f8,0x00000dec,0x00050041, +0x000000fe,0x00000ed1,0x000000fc,0x00000308, +0x0004003d,0x00000006,0x00000ed2,0x00000ed1, +0x000500c7,0x00000006,0x00000ed3,0x00000ed2, +0x000000b0,0x000500aa,0x0000002f,0x00000ed4, +0x00000ed3,0x000000a6,0x000300f7,0x00000ed9, +0x00000000,0x000400fa,0x00000ed4,0x00000ed5, +0x00000ed7,0x000200f8,0x00000ed5,0x00050084, +0x00000006,0x00000edf,0x0000010a,0x00000dd0, +0x00050080,0x00000006,0x00000ee0,0x00000107, +0x00000edf,0x000200f9,0x00000ed9,0x000200f8, +0x00000ed7,0x00050084,0x00000006,0x00000ee5, +0x00000118,0x00000dd0,0x00050080,0x00000006, +0x00000ee6,0x00000107,0x00000ee5,0x000200f9, +0x00000ed9,0x000200f8,0x00000ed9,0x000700f5, +0x00000006,0x00003267,0x00000ee0,0x00000ed5, +0x00000ee6,0x00000ed7,0x00050084,0x00000006, +0x00000def,0x0000010a,0x00000ddb,0x00050080, +0x00000006,0x00000df0,0x00003267,0x00000def, +0x00050041,0x00000156,0x00000df1,0x000000fc, +0x00000154,0x0004003d,0x00000007,0x00000df2, +0x00000df1,0x00050051,0x00000006,0x00000efd, +0x00000df2,0x00000000,0x00050095,0x000000ab, +0x00000eff,0x00000efd,0x00000df0,0x00050051, +0x00000006,0x00000f00,0x00000eff,0x00000001, +0x00050051,0x00000006,0x00000f01,0x00000eff, +0x00000000,0x00050051,0x00000006,0x00000f04, +0x00000df2,0x00000001,0x00050080,0x00000006, +0x00000f06,0x00000f04,0x00000f00,0x00050050, +0x00000007,0x00000f07,0x00000f01,0x00000f06, +0x0004007c,0x00000014,0x00000ef7,0x00000f07, +0x00060041,0x000000db,0x00000eee,0x00000ef7, 0x000000da,0x000000da,0x0006003d,0x00000006, -0x00000eb2,0x00000eb1,0x00000002,0x00000004, -0x000200f9,0x00000db8,0x000200f8,0x00000db7, -0x000200f9,0x00000db8,0x000200f8,0x00000db8, -0x000700f5,0x00000006,0x0000315c,0x00000eb2, -0x00000e9c,0x000000a6,0x00000db7,0x00050041, -0x000000fe,0x00000ece,0x000000fc,0x00000308, -0x0004003d,0x00000006,0x00000ecf,0x00000ece, -0x00050084,0x00000006,0x00000ed0,0x0000010a, -0x00000ecf,0x000500c2,0x00000006,0x00000ed1, -0x0000315a,0x00000ed0,0x000500c7,0x00000006, -0x00000ed2,0x00000ed1,0x00000799,0x000200f9, -0x00000dbc,0x000200f8,0x00000dbc,0x000700f5, -0x00000006,0x0000315d,0x000000a6,0x00000db8, -0x00000dcc,0x00000dc0,0x000500b0,0x0000002f, -0x00000dbf,0x0000315d,0x0000011f,0x000400f6, -0x00000dcd,0x00000dc0,0x00000000,0x000400fa, -0x00000dbf,0x00000dc0,0x00000dcd,0x000200f8, -0x00000dc0,0x000500aa,0x0000002f,0x00000dc6, -0x0000315d,0x00000ed2,0x000500a7,0x0000002f, -0x00000dc7,0x00000da1,0x00000dc6,0x000600a9, -0x00000006,0x00000dc8,0x00000dc7,0x000000b0, -0x000000a6,0x00060041,0x000006c2,0x00000dc9, -0x000008af,0x0000315d,0x00000b35,0x0003003e, -0x00000dc9,0x00000dc8,0x00050080,0x00000006, -0x00000dcc,0x0000315d,0x00000154,0x000200f9, -0x00000dbc,0x000200f8,0x00000dcd,0x000400e0, +0x00000eef,0x00000eee,0x00000002,0x00000004, +0x000200f9,0x00000df5,0x000200f8,0x00000df4, +0x000200f9,0x00000df5,0x000200f8,0x00000df5, +0x000700f5,0x00000006,0x00003268,0x00000eef, +0x00000ed9,0x000000a6,0x00000df4,0x00050041, +0x000000fe,0x00000f0b,0x000000fc,0x00000308, +0x0004003d,0x00000006,0x00000f0c,0x00000f0b, +0x00050084,0x00000006,0x00000f0d,0x0000010a, +0x00000f0c,0x000500c2,0x00000006,0x00000f0e, +0x00003266,0x00000f0d,0x000500c7,0x00000006, +0x00000f0f,0x00000f0e,0x00000799,0x000200f9, +0x00000df9,0x000200f8,0x00000df9,0x000700f5, +0x00000006,0x00003269,0x000000a6,0x00000df5, +0x00000e09,0x00000dfd,0x000500b0,0x0000002f, +0x00000dfc,0x00003269,0x0000011f,0x000400f6, +0x00000e0a,0x00000dfd,0x00000000,0x000400fa, +0x00000dfc,0x00000dfd,0x00000e0a,0x000200f8, +0x00000dfd,0x000500aa,0x0000002f,0x00000e03, +0x00003269,0x00000f0f,0x000500a7,0x0000002f, +0x00000e04,0x00000dde,0x00000e03,0x000600a9, +0x00000006,0x00000e05,0x00000e04,0x000000b0, +0x000000a6,0x00060041,0x000006c2,0x00000e06, +0x000008af,0x00003269,0x00000b35,0x0003003e, +0x00000e06,0x00000e05,0x00050080,0x00000006, +0x00000e09,0x00003269,0x00000154,0x000200f9, +0x00000df9,0x000200f8,0x00000e0a,0x000400e0, 0x00000170,0x00000170,0x000006da,0x000200f9, -0x00000dce,0x000200f8,0x00000dce,0x000700f5, -0x00000006,0x0000315e,0x000000b0,0x00000dcd, -0x00000dff,0x00000dfd,0x000500b0,0x0000002f, -0x00000dd1,0x0000315e,0x00000107,0x000400f6, -0x00000e00,0x00000dfd,0x00000000,0x000400fa, -0x00000dd1,0x00000dd2,0x00000e00,0x000200f8, -0x00000dd2,0x000200f9,0x00000dd3,0x000200f8, -0x00000dd3,0x000700f5,0x00000006,0x0000316b, -0x000000a6,0x00000dd2,0x00000de9,0x00000de7, -0x000500b0,0x0000002f,0x00000dd6,0x0000316b, -0x0000011f,0x000400f6,0x00000dea,0x00000de7, -0x00000000,0x000400fa,0x00000dd6,0x00000dd7, -0x00000dea,0x000200f8,0x00000dd7,0x000500ae, -0x0000002f,0x00000ddb,0x00000b35,0x0000315e, -0x000300f7,0x00000de4,0x00000000,0x000400fa, -0x00000ddb,0x00000ddc,0x00000de3,0x000200f8, -0x00000ddc,0x00050082,0x00000006,0x00000de0, -0x00000b35,0x0000315e,0x00060041,0x000006c2, -0x00000de1,0x000008af,0x0000316b,0x00000de0, -0x0004003d,0x00000006,0x00000de2,0x00000de1, -0x000200f9,0x00000de4,0x000200f8,0x00000de3, -0x000200f9,0x00000de4,0x000200f8,0x00000de4, -0x000700f5,0x00000006,0x0000316f,0x00000de2, -0x00000ddc,0x000000a6,0x00000de3,0x00050041, -0x00000009,0x00000de6,0x00000d72,0x0000316b, -0x0003003e,0x00000de6,0x0000316f,0x000200f9, -0x00000de7,0x000200f8,0x00000de7,0x00050080, -0x00000006,0x00000de9,0x0000316b,0x00000154, -0x000200f9,0x00000dd3,0x000200f8,0x00000dea, +0x00000e0b,0x000200f8,0x00000e0b,0x000700f5, +0x00000006,0x0000326a,0x000000b0,0x00000e0a, +0x00000e3c,0x00000e3a,0x000500b0,0x0000002f, +0x00000e0e,0x0000326a,0x00000107,0x000400f6, +0x00000e3d,0x00000e3a,0x00000000,0x000400fa, +0x00000e0e,0x00000e0f,0x00000e3d,0x000200f8, +0x00000e0f,0x000200f9,0x00000e10,0x000200f8, +0x00000e10,0x000700f5,0x00000006,0x00003277, +0x000000a6,0x00000e0f,0x00000e26,0x00000e24, +0x000500b0,0x0000002f,0x00000e13,0x00003277, +0x0000011f,0x000400f6,0x00000e27,0x00000e24, +0x00000000,0x000400fa,0x00000e13,0x00000e14, +0x00000e27,0x000200f8,0x00000e14,0x000500ae, +0x0000002f,0x00000e18,0x00000b35,0x0000326a, +0x000300f7,0x00000e21,0x00000000,0x000400fa, +0x00000e18,0x00000e19,0x00000e20,0x000200f8, +0x00000e19,0x00050082,0x00000006,0x00000e1d, +0x00000b35,0x0000326a,0x00060041,0x000006c2, +0x00000e1e,0x000008af,0x00003277,0x00000e1d, +0x0004003d,0x00000006,0x00000e1f,0x00000e1e, +0x000200f9,0x00000e21,0x000200f8,0x00000e20, +0x000200f9,0x00000e21,0x000200f8,0x00000e21, +0x000700f5,0x00000006,0x0000327b,0x00000e1f, +0x00000e19,0x000000a6,0x00000e20,0x00050041, +0x00000009,0x00000e23,0x00000daf,0x00003277, +0x0003003e,0x00000e23,0x0000327b,0x000200f9, +0x00000e24,0x000200f8,0x00000e24,0x00050080, +0x00000006,0x00000e26,0x00003277,0x00000154, +0x000200f9,0x00000e10,0x000200f8,0x00000e27, 0x000400e0,0x00000170,0x00000170,0x000006da, -0x000200f9,0x00000deb,0x000200f8,0x00000deb, -0x000700f5,0x00000006,0x0000316c,0x000000a6, -0x00000dea,0x00000dfb,0x00000def,0x000500b0, -0x0000002f,0x00000dee,0x0000316c,0x0000011f, -0x000400f6,0x00000dfc,0x00000def,0x00000000, -0x000400fa,0x00000dee,0x00000def,0x00000dfc, -0x000200f8,0x00000def,0x00050041,0x00000009, -0x00000df3,0x00000d72,0x0000316c,0x0004003d, -0x00000006,0x00000df4,0x00000df3,0x00060041, -0x000006c2,0x00000df5,0x000008af,0x0000316c, -0x00000b35,0x0004003d,0x00000006,0x00000df6, -0x00000df5,0x00050080,0x00000006,0x00000df7, -0x00000df6,0x00000df4,0x0003003e,0x00000df5, -0x00000df7,0x00050080,0x00000006,0x00000dfb, -0x0000316c,0x00000154,0x000200f9,0x00000deb, -0x000200f8,0x00000dfc,0x000400e0,0x00000170, -0x00000170,0x000006da,0x000200f9,0x00000dfd, -0x000200f8,0x00000dfd,0x000500c4,0x00000006, -0x00000dff,0x0000315e,0x00000154,0x000200f9, -0x00000dce,0x000200f8,0x00000e00,0x000300f7, -0x00000e1c,0x00000000,0x000400fa,0x00000da1, -0x00000e02,0x00000e1c,0x000200f8,0x00000e02, -0x00050041,0x000006c2,0x00000e04,0x00000856, -0x00000ed2,0x0004003d,0x00000006,0x00000e05, -0x00000e04,0x00060041,0x000006c2,0x00000e08, -0x000008af,0x00000ed2,0x00000b35,0x0004003d, -0x00000006,0x00000e09,0x00000e08,0x00050080, -0x00000006,0x00000e0a,0x00000e05,0x00000e09, -0x00050082,0x00000006,0x00000e0b,0x00000e0a, -0x000000b0,0x000500c7,0x00000006,0x00000ed8, -0x00000ecf,0x000000b0,0x000500aa,0x0000002f, -0x00000ed9,0x00000ed8,0x000000a6,0x000300f7, -0x00000ede,0x00000000,0x000400fa,0x00000ed9, -0x00000eda,0x00000edc,0x000200f8,0x00000eda, -0x00050084,0x00000006,0x00000ee4,0x00000111, -0x00000d93,0x00050080,0x00000006,0x00000ee5, -0x00000107,0x00000ee4,0x000200f9,0x00000ede, -0x000200f8,0x00000edc,0x000200f9,0x00000ede, -0x000200f8,0x00000ede,0x000700f5,0x00000006, -0x0000315f,0x00000ee5,0x00000eda,0x00000107, -0x00000edc,0x00050084,0x00000006,0x00000e0e, -0x0000010a,0x00000e0b,0x00050080,0x00000006, -0x00000e0f,0x0000315f,0x00000e0e,0x00050041, -0x00000156,0x00000e10,0x000000fc,0x00000154, -0x0004003d,0x00000007,0x00000e11,0x00000e10, -0x00050051,0x00000006,0x00000efd,0x00000e11, -0x00000000,0x00050095,0x000000ab,0x00000eff, -0x00000efd,0x00000e0f,0x00050051,0x00000006, -0x00000f00,0x00000eff,0x00000001,0x00050051, -0x00000006,0x00000f01,0x00000eff,0x00000000, -0x00050051,0x00000006,0x00000f04,0x00000e11, -0x00000001,0x00050080,0x00000006,0x00000f06, -0x00000f04,0x00000f00,0x00050050,0x00000007, -0x00000f07,0x00000f01,0x00000f06,0x0004007c, -0x00000014,0x00000ef7,0x00000f07,0x00060041, -0x000000db,0x00000eef,0x00000ef7,0x000000da, -0x000000da,0x0005003e,0x00000eef,0x0000315a, -0x00000002,0x00000004,0x000300f7,0x00000f13, -0x00000000,0x000400fa,0x00000ed9,0x00000f0f, -0x00000f11,0x000200f8,0x00000f0f,0x00050084, -0x00000006,0x00000f19,0x00000118,0x00000d93, -0x00050080,0x00000006,0x00000f1a,0x00000107, -0x00000f19,0x000200f9,0x00000f13,0x000200f8, -0x00000f11,0x00050084,0x00000006,0x00000f1f, -0x0000010a,0x00000d93,0x00050080,0x00000006, -0x00000f20,0x00000107,0x00000f1f,0x000200f9, -0x00000f13,0x000200f8,0x00000f13,0x000700f5, -0x00000006,0x00003160,0x00000f1a,0x00000f0f, -0x00000f20,0x00000f11,0x00050080,0x00000006, -0x00000e17,0x00003160,0x00000e0e,0x00050095, -0x000000ab,0x00000f38,0x00000efd,0x00000e17, -0x00050051,0x00000006,0x00000f39,0x00000f38, -0x00000001,0x00050051,0x00000006,0x00000f3a, -0x00000f38,0x00000000,0x00050080,0x00000006, -0x00000f3f,0x00000f04,0x00000f39,0x00050050, -0x00000007,0x00000f40,0x00000f3a,0x00000f3f, -0x0004007c,0x00000014,0x00000f30,0x00000f40, -0x00060041,0x000000db,0x00000f28,0x00000f30, -0x000000da,0x000000da,0x0005003e,0x00000f28, -0x0000315c,0x00000002,0x00000004,0x000200f9, -0x00000e1c,0x000200f8,0x00000e1c,0x000400e0, +0x000200f9,0x00000e28,0x000200f8,0x00000e28, +0x000700f5,0x00000006,0x00003278,0x000000a6, +0x00000e27,0x00000e38,0x00000e2c,0x000500b0, +0x0000002f,0x00000e2b,0x00003278,0x0000011f, +0x000400f6,0x00000e39,0x00000e2c,0x00000000, +0x000400fa,0x00000e2b,0x00000e2c,0x00000e39, +0x000200f8,0x00000e2c,0x00050041,0x00000009, +0x00000e30,0x00000daf,0x00003278,0x0004003d, +0x00000006,0x00000e31,0x00000e30,0x00060041, +0x000006c2,0x00000e32,0x000008af,0x00003278, +0x00000b35,0x0004003d,0x00000006,0x00000e33, +0x00000e32,0x00050080,0x00000006,0x00000e34, +0x00000e33,0x00000e31,0x0003003e,0x00000e32, +0x00000e34,0x00050080,0x00000006,0x00000e38, +0x00003278,0x00000154,0x000200f9,0x00000e28, +0x000200f8,0x00000e39,0x000400e0,0x00000170, +0x00000170,0x000006da,0x000200f9,0x00000e3a, +0x000200f8,0x00000e3a,0x000500c4,0x00000006, +0x00000e3c,0x0000326a,0x00000154,0x000200f9, +0x00000e0b,0x000200f8,0x00000e3d,0x000300f7, +0x00000e59,0x00000000,0x000400fa,0x00000dde, +0x00000e3f,0x00000e59,0x000200f8,0x00000e3f, +0x00050041,0x000006c2,0x00000e41,0x00000856, +0x00000f0f,0x0004003d,0x00000006,0x00000e42, +0x00000e41,0x00060041,0x000006c2,0x00000e45, +0x000008af,0x00000f0f,0x00000b35,0x0004003d, +0x00000006,0x00000e46,0x00000e45,0x00050080, +0x00000006,0x00000e47,0x00000e42,0x00000e46, +0x00050082,0x00000006,0x00000e48,0x00000e47, +0x000000b0,0x000500c7,0x00000006,0x00000f15, +0x00000f0c,0x000000b0,0x000500aa,0x0000002f, +0x00000f16,0x00000f15,0x000000a6,0x000300f7, +0x00000f1b,0x00000000,0x000400fa,0x00000f16, +0x00000f17,0x00000f19,0x000200f8,0x00000f17, +0x00050084,0x00000006,0x00000f21,0x00000111, +0x00000dd0,0x00050080,0x00000006,0x00000f22, +0x00000107,0x00000f21,0x000200f9,0x00000f1b, +0x000200f8,0x00000f19,0x000200f9,0x00000f1b, +0x000200f8,0x00000f1b,0x000700f5,0x00000006, +0x0000326b,0x00000f22,0x00000f17,0x00000107, +0x00000f19,0x00050084,0x00000006,0x00000e4b, +0x0000010a,0x00000e48,0x00050080,0x00000006, +0x00000e4c,0x0000326b,0x00000e4b,0x00050041, +0x00000156,0x00000e4d,0x000000fc,0x00000154, +0x0004003d,0x00000007,0x00000e4e,0x00000e4d, +0x00050051,0x00000006,0x00000f3a,0x00000e4e, +0x00000000,0x00050095,0x000000ab,0x00000f3c, +0x00000f3a,0x00000e4c,0x00050051,0x00000006, +0x00000f3d,0x00000f3c,0x00000001,0x00050051, +0x00000006,0x00000f3e,0x00000f3c,0x00000000, +0x00050051,0x00000006,0x00000f41,0x00000e4e, +0x00000001,0x00050080,0x00000006,0x00000f43, +0x00000f41,0x00000f3d,0x00050050,0x00000007, +0x00000f44,0x00000f3e,0x00000f43,0x0004007c, +0x00000014,0x00000f34,0x00000f44,0x00060041, +0x000000db,0x00000f2c,0x00000f34,0x000000da, +0x000000da,0x0005003e,0x00000f2c,0x00003266, +0x00000002,0x00000004,0x000300f7,0x00000f50, +0x00000000,0x000400fa,0x00000f16,0x00000f4c, +0x00000f4e,0x000200f8,0x00000f4c,0x00050084, +0x00000006,0x00000f56,0x00000118,0x00000dd0, +0x00050080,0x00000006,0x00000f57,0x00000107, +0x00000f56,0x000200f9,0x00000f50,0x000200f8, +0x00000f4e,0x00050084,0x00000006,0x00000f5c, +0x0000010a,0x00000dd0,0x00050080,0x00000006, +0x00000f5d,0x00000107,0x00000f5c,0x000200f9, +0x00000f50,0x000200f8,0x00000f50,0x000700f5, +0x00000006,0x0000326c,0x00000f57,0x00000f4c, +0x00000f5d,0x00000f4e,0x00050080,0x00000006, +0x00000e54,0x0000326c,0x00000e4b,0x00050095, +0x000000ab,0x00000f75,0x00000f3a,0x00000e54, +0x00050051,0x00000006,0x00000f76,0x00000f75, +0x00000001,0x00050051,0x00000006,0x00000f77, +0x00000f75,0x00000000,0x00050080,0x00000006, +0x00000f7c,0x00000f41,0x00000f76,0x00050050, +0x00000007,0x00000f7d,0x00000f77,0x00000f7c, +0x0004007c,0x00000014,0x00000f6d,0x00000f7d, +0x00060041,0x000000db,0x00000f65,0x00000f6d, +0x000000da,0x000000da,0x0005003e,0x00000f65, +0x00003268,0x00000002,0x00000004,0x000200f9, +0x00000e59,0x000200f8,0x00000e59,0x000400e0, 0x00000170,0x00000170,0x000006da,0x000300f7, -0x00000e28,0x00000000,0x000400fa,0x00000d7e, -0x00000e1f,0x00000e28,0x000200f8,0x00000e1f, -0x00060041,0x000006c2,0x00000e22,0x000008af, +0x00000e65,0x00000000,0x000400fa,0x00000dbb, +0x00000e5c,0x00000e65,0x000200f8,0x00000e5c, +0x00060041,0x000006c2,0x00000e5f,0x000008af, 0x00000b35,0x0000091d,0x0004003d,0x00000006, -0x00000e23,0x00000e22,0x00050041,0x000006c2, -0x00000e24,0x00000856,0x00000b35,0x0004003d, -0x00000006,0x00000e25,0x00000e24,0x00050080, -0x00000006,0x00000e26,0x00000e25,0x00000e23, -0x0003003e,0x00000e24,0x00000e26,0x000200f9, -0x00000e28,0x000200f8,0x00000e28,0x000400e0, +0x00000e60,0x00000e5f,0x00050041,0x000006c2, +0x00000e61,0x00000856,0x00000b35,0x0004003d, +0x00000006,0x00000e62,0x00000e61,0x00050080, +0x00000006,0x00000e63,0x00000e62,0x00000e60, +0x0003003e,0x00000e61,0x00000e63,0x000200f9, +0x00000e65,0x000200f8,0x00000e65,0x000400e0, 0x00000170,0x00000170,0x000006da,0x000200f9, -0x00000e29,0x000200f8,0x00000e29,0x00050080, -0x00000006,0x00000e2b,0x00003158,0x00000107, -0x000200f9,0x00000d96,0x000200f8,0x00000e2c, -0x000200f9,0x00000bb6,0x000200f8,0x00000b2f, +0x00000e66,0x000200f8,0x00000e66,0x00050080, +0x00000006,0x00000e68,0x00003264,0x00000107, +0x000200f9,0x00000dd3,0x000200f8,0x00000e69, +0x000200f9,0x00000bf3,0x000200f8,0x00000b2f, 0x000500aa,0x0000002f,0x00000b3b,0x00000b13, 0x00000b3a,0x000300f7,0x00000b3d,0x00000000, 0x000400fa,0x00000b3b,0x00000b3c,0x00000b3d, 0x000200f8,0x00000b3c,0x00050041,0x00000b0f, 0x00000b3f,0x00000b18,0x000000a6,0x0004003d, 0x00000006,0x00000b40,0x00000b3f,0x00050041, -0x000000fe,0x00000f5b,0x000000fc,0x000000fd, -0x0004003d,0x00000006,0x00000f5c,0x00000f5b, -0x000200f9,0x00000f5d,0x000200f8,0x00000f5d, -0x000700f5,0x00000006,0x00003143,0x000000b0, -0x00000b3c,0x00000f64,0x00000f62,0x000500b0, -0x0000002f,0x00000f61,0x00003143,0x00000f5c, -0x000400f6,0x00000f66,0x00000f62,0x00000000, -0x000400fa,0x00000f61,0x00000f62,0x00000f66, -0x000200f8,0x00000f62,0x000500c4,0x00000006, -0x00000f64,0x00003143,0x00000154,0x000200f9, -0x00000f5d,0x000200f8,0x00000f66,0x000200f9, -0x00000f68,0x000200f8,0x00000f68,0x000700f5, -0x00000006,0x00003144,0x00000b40,0x00000f66, -0x00000f90,0x00000f8e,0x000500b0,0x0000002f, -0x00000f6c,0x00003144,0x00003143,0x000400f6, -0x00000f91,0x00000f8e,0x00000000,0x000400fa, -0x00000f6c,0x00000f6d,0x00000f91,0x000200f8, -0x00000f6d,0x000500b0,0x0000002f,0x00000f71, -0x00003144,0x00000f5c,0x000300f7,0x00000f7b, -0x00000000,0x000400fa,0x00000f71,0x00000f72, -0x00000f7a,0x000200f8,0x00000f72,0x00050084, -0x00000006,0x00000f75,0x0000010a,0x00003144, -0x00050080,0x00000006,0x00000f76,0x00000107, -0x00000f75,0x00050041,0x00000156,0x00000f77, +0x000000fe,0x00000f98,0x000000fc,0x000000fd, +0x0004003d,0x00000006,0x00000f99,0x00000f98, +0x000200f9,0x00000f9a,0x000200f8,0x00000f9a, +0x000700f5,0x00000006,0x0000324f,0x000000b0, +0x00000b3c,0x00000fa1,0x00000f9f,0x000500b0, +0x0000002f,0x00000f9e,0x0000324f,0x00000f99, +0x000400f6,0x00000fa3,0x00000f9f,0x00000000, +0x000400fa,0x00000f9e,0x00000f9f,0x00000fa3, +0x000200f8,0x00000f9f,0x000500c4,0x00000006, +0x00000fa1,0x0000324f,0x00000154,0x000200f9, +0x00000f9a,0x000200f8,0x00000fa3,0x000200f9, +0x00000fa5,0x000200f8,0x00000fa5,0x000700f5, +0x00000006,0x00003250,0x00000b40,0x00000fa3, +0x00000fcd,0x00000fcb,0x000500b0,0x0000002f, +0x00000fa9,0x00003250,0x0000324f,0x000400f6, +0x00000fce,0x00000fcb,0x00000000,0x000400fa, +0x00000fa9,0x00000faa,0x00000fce,0x000200f8, +0x00000faa,0x000500b0,0x0000002f,0x00000fae, +0x00003250,0x00000f99,0x000300f7,0x00000fb8, +0x00000000,0x000400fa,0x00000fae,0x00000faf, +0x00000fb7,0x000200f8,0x00000faf,0x00050084, +0x00000006,0x00000fb2,0x0000010a,0x00003250, +0x00050080,0x00000006,0x00000fb3,0x00000107, +0x00000fb2,0x00050041,0x00000156,0x00000fb4, 0x000000fc,0x00000154,0x0004003d,0x00000007, -0x00000f78,0x00000f77,0x00050051,0x00000006, -0x0000101f,0x00000f78,0x00000000,0x00050095, -0x000000ab,0x00001021,0x0000101f,0x00000f76, -0x00050051,0x00000006,0x00001022,0x00001021, -0x00000001,0x00050051,0x00000006,0x00001023, -0x00001021,0x00000000,0x00050051,0x00000006, -0x00001026,0x00000f78,0x00000001,0x00050080, -0x00000006,0x00001028,0x00001026,0x00001022, -0x00050050,0x00000007,0x00001029,0x00001023, -0x00001028,0x0004007c,0x00000014,0x00001019, -0x00001029,0x00060041,0x000000db,0x00001010, -0x00001019,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00001011,0x00001010,0x00000002, -0x00000004,0x000200f9,0x00000f7b,0x000200f8, -0x00000f7a,0x000200f9,0x00000f7b,0x000200f8, -0x00000f7b,0x000700f5,0x00000006,0x00003154, -0x00001011,0x00000f72,0x00000380,0x00000f7a, -0x00050041,0x000006c2,0x00000f7d,0x000006af, -0x00003144,0x0003003e,0x00000f7d,0x00003154, -0x000300f7,0x00000f8b,0x00000000,0x000400fa, -0x00000f71,0x00000f82,0x00000f8a,0x000200f8, -0x00000f82,0x00050084,0x00000006,0x0000102e, -0x0000010a,0x00000f5c,0x00050080,0x00000006, -0x0000102f,0x00000107,0x0000102e,0x00050084, -0x00000006,0x00000f85,0x0000010a,0x00003144, -0x00050080,0x00000006,0x00000f86,0x0000102f, -0x00000f85,0x00050041,0x00000156,0x00000f87, +0x00000fb5,0x00000fb4,0x00050051,0x00000006, +0x0000105c,0x00000fb5,0x00000000,0x00050095, +0x000000ab,0x0000105e,0x0000105c,0x00000fb3, +0x00050051,0x00000006,0x0000105f,0x0000105e, +0x00000001,0x00050051,0x00000006,0x00001060, +0x0000105e,0x00000000,0x00050051,0x00000006, +0x00001063,0x00000fb5,0x00000001,0x00050080, +0x00000006,0x00001065,0x00001063,0x0000105f, +0x00050050,0x00000007,0x00001066,0x00001060, +0x00001065,0x0004007c,0x00000014,0x00001056, +0x00001066,0x00060041,0x000000db,0x0000104d, +0x00001056,0x000000da,0x000000da,0x0006003d, +0x00000006,0x0000104e,0x0000104d,0x00000002, +0x00000004,0x000200f9,0x00000fb8,0x000200f8, +0x00000fb7,0x000200f9,0x00000fb8,0x000200f8, +0x00000fb8,0x000700f5,0x00000006,0x00003260, +0x0000104e,0x00000faf,0x00000380,0x00000fb7, +0x00050041,0x000006c2,0x00000fba,0x000006af, +0x00003250,0x0003003e,0x00000fba,0x00003260, +0x000300f7,0x00000fc8,0x00000000,0x000400fa, +0x00000fae,0x00000fbf,0x00000fc7,0x000200f8, +0x00000fbf,0x00050084,0x00000006,0x0000106b, +0x0000010a,0x00000f99,0x00050080,0x00000006, +0x0000106c,0x00000107,0x0000106b,0x00050084, +0x00000006,0x00000fc2,0x0000010a,0x00003250, +0x00050080,0x00000006,0x00000fc3,0x0000106c, +0x00000fc2,0x00050041,0x00000156,0x00000fc4, 0x000000fc,0x00000154,0x0004003d,0x00000007, -0x00000f88,0x00000f87,0x00050051,0x00000006, -0x00001046,0x00000f88,0x00000000,0x00050095, -0x000000ab,0x00001048,0x00001046,0x00000f86, -0x00050051,0x00000006,0x00001049,0x00001048, -0x00000001,0x00050051,0x00000006,0x0000104a, -0x00001048,0x00000000,0x00050051,0x00000006, -0x0000104d,0x00000f88,0x00000001,0x00050080, -0x00000006,0x0000104f,0x0000104d,0x00001049, -0x00050050,0x00000007,0x00001050,0x0000104a, -0x0000104f,0x0004007c,0x00000014,0x00001040, -0x00001050,0x00060041,0x000000db,0x00001037, -0x00001040,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00001038,0x00001037,0x00000002, -0x00000004,0x000200f9,0x00000f8b,0x000200f8, -0x00000f8a,0x000200f9,0x00000f8b,0x000200f8, -0x00000f8b,0x000700f5,0x00000006,0x00003156, -0x00001038,0x00000f82,0x00000380,0x00000f8a, -0x00050041,0x000006c2,0x00000f8d,0x000006c4, -0x00003144,0x0003003e,0x00000f8d,0x00003156, -0x000200f9,0x00000f8e,0x000200f8,0x00000f8e, -0x00050080,0x00000006,0x00000f90,0x00003144, -0x00000107,0x000200f9,0x00000f68,0x000200f8, -0x00000f91,0x000400e0,0x00000170,0x00000170, -0x000006da,0x000200f9,0x00000f92,0x000200f8, -0x00000f92,0x000700f5,0x00000006,0x00003146, -0x00000170,0x00000f91,0x00000fe6,0x00000fe4, -0x000500b2,0x0000002f,0x00000f96,0x00003146, -0x00003143,0x000400f6,0x00000fe7,0x00000fe4, -0x00000000,0x000400fa,0x00000f96,0x00000f97, -0x00000fe7,0x000200f8,0x00000f97,0x000500c2, -0x00000006,0x00000f99,0x00003146,0x00000154, -0x000200f9,0x00000f9a,0x000200f8,0x00000f9a, -0x000700f5,0x00000006,0x00003149,0x00000f99, -0x00000f97,0x00000fe2,0x00000fe0,0x000500ac, -0x0000002f,0x00000f9d,0x00003149,0x000000a6, -0x000400f6,0x00000fe3,0x00000fe0,0x00000000, -0x000400fa,0x00000f9d,0x00000f9e,0x00000fe3, -0x000200f8,0x00000f9e,0x000200f9,0x00000fa0, -0x000200f8,0x00000fa0,0x000700f5,0x00000006, -0x0000314b,0x00000b40,0x00000f9e,0x00000fde, -0x00000fdc,0x000500b0,0x0000002f,0x00000fa4, -0x0000314b,0x00003143,0x000400f6,0x00000fdf, -0x00000fdc,0x00000000,0x000400fa,0x00000fa4, -0x00000fa5,0x00000fdf,0x000200f8,0x00000fa5, -0x000500c6,0x00000006,0x00000fa8,0x0000314b, -0x00003149,0x000500ac,0x0000002f,0x00000fab, -0x00000fa8,0x0000314b,0x000300f7,0x00000fdb, -0x00000000,0x000400fa,0x00000fab,0x00000fac, -0x00000fdb,0x000200f8,0x00000fac,0x00050041, -0x000006c2,0x00000fae,0x000006af,0x0000314b, -0x0004003d,0x00000006,0x00000faf,0x00000fae, -0x00050041,0x000006c2,0x00000fb1,0x000006af, -0x00000fa8,0x0004003d,0x00000006,0x00000fb2, -0x00000fb1,0x00050041,0x000006c2,0x00000fb4, -0x000006c4,0x0000314b,0x0004003d,0x00000006, -0x00000fb5,0x00000fb4,0x00050041,0x000006c2, -0x00000fb7,0x000006c4,0x00000fa8,0x0004003d, -0x00000006,0x00000fb8,0x00000fb7,0x000500ac, -0x0000002f,0x00000fbb,0x00000faf,0x00000fb2, -0x000400a8,0x0000002f,0x00000fbc,0x00000fbb, -0x000300f7,0x00000fc5,0x00000000,0x000400fa, -0x00000fbc,0x00000fbd,0x00000fc5,0x000200f8, -0x00000fbd,0x000500aa,0x0000002f,0x00000fc0, -0x00000faf,0x00000fb2,0x000500ac,0x0000002f, -0x00000fc3,0x00000fb5,0x00000fb8,0x000500a7, -0x0000002f,0x00000fc4,0x00000fc0,0x00000fc3, -0x000200f9,0x00000fc5,0x000200f8,0x00000fc5, -0x000700f5,0x0000002f,0x00000fc6,0x00000fbb, -0x00000fac,0x00000fc4,0x00000fbd,0x000500c7, -0x00000006,0x00000fca,0x0000314b,0x00003146, -0x000500aa,0x0000002f,0x00000fcb,0x00000fca, -0x000000a6,0x000500a4,0x0000002f,0x00000fcc, -0x00000fc6,0x00000fcb,0x000300f7,0x00000fda, -0x00000000,0x000400fa,0x00000fcc,0x00000fcd, -0x00000fda,0x000200f8,0x00000fcd,0x0003003e, -0x00000fae,0x00000fb2,0x0003003e,0x00000fb1, -0x00000faf,0x0003003e,0x00000fb4,0x00000fb8, -0x0003003e,0x00000fb7,0x00000fb5,0x000200f9, -0x00000fda,0x000200f8,0x00000fda,0x000200f9, -0x00000fdb,0x000200f8,0x00000fdb,0x000200f9, -0x00000fdc,0x000200f8,0x00000fdc,0x00050080, -0x00000006,0x00000fde,0x0000314b,0x00000107, -0x000200f9,0x00000fa0,0x000200f8,0x00000fdf, +0x00000fc5,0x00000fc4,0x00050051,0x00000006, +0x00001083,0x00000fc5,0x00000000,0x00050095, +0x000000ab,0x00001085,0x00001083,0x00000fc3, +0x00050051,0x00000006,0x00001086,0x00001085, +0x00000001,0x00050051,0x00000006,0x00001087, +0x00001085,0x00000000,0x00050051,0x00000006, +0x0000108a,0x00000fc5,0x00000001,0x00050080, +0x00000006,0x0000108c,0x0000108a,0x00001086, +0x00050050,0x00000007,0x0000108d,0x00001087, +0x0000108c,0x0004007c,0x00000014,0x0000107d, +0x0000108d,0x00060041,0x000000db,0x00001074, +0x0000107d,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00001075,0x00001074,0x00000002, +0x00000004,0x000200f9,0x00000fc8,0x000200f8, +0x00000fc7,0x000200f9,0x00000fc8,0x000200f8, +0x00000fc8,0x000700f5,0x00000006,0x00003262, +0x00001075,0x00000fbf,0x00000380,0x00000fc7, +0x00050041,0x000006c2,0x00000fca,0x000006c4, +0x00003250,0x0003003e,0x00000fca,0x00003262, +0x000200f9,0x00000fcb,0x000200f8,0x00000fcb, +0x00050080,0x00000006,0x00000fcd,0x00003250, +0x00000107,0x000200f9,0x00000fa5,0x000200f8, +0x00000fce,0x000400e0,0x00000170,0x00000170, +0x000006da,0x000200f9,0x00000fcf,0x000200f8, +0x00000fcf,0x000700f5,0x00000006,0x00003252, +0x00000170,0x00000fce,0x00001023,0x00001021, +0x000500b2,0x0000002f,0x00000fd3,0x00003252, +0x0000324f,0x000400f6,0x00001024,0x00001021, +0x00000000,0x000400fa,0x00000fd3,0x00000fd4, +0x00001024,0x000200f8,0x00000fd4,0x000500c2, +0x00000006,0x00000fd6,0x00003252,0x00000154, +0x000200f9,0x00000fd7,0x000200f8,0x00000fd7, +0x000700f5,0x00000006,0x00003255,0x00000fd6, +0x00000fd4,0x0000101f,0x0000101d,0x000500ac, +0x0000002f,0x00000fda,0x00003255,0x000000a6, +0x000400f6,0x00001020,0x0000101d,0x00000000, +0x000400fa,0x00000fda,0x00000fdb,0x00001020, +0x000200f8,0x00000fdb,0x000200f9,0x00000fdd, +0x000200f8,0x00000fdd,0x000700f5,0x00000006, +0x00003257,0x00000b40,0x00000fdb,0x0000101b, +0x00001019,0x000500b0,0x0000002f,0x00000fe1, +0x00003257,0x0000324f,0x000400f6,0x0000101c, +0x00001019,0x00000000,0x000400fa,0x00000fe1, +0x00000fe2,0x0000101c,0x000200f8,0x00000fe2, +0x000500c6,0x00000006,0x00000fe5,0x00003257, +0x00003255,0x000500ac,0x0000002f,0x00000fe8, +0x00000fe5,0x00003257,0x000300f7,0x00001018, +0x00000000,0x000400fa,0x00000fe8,0x00000fe9, +0x00001018,0x000200f8,0x00000fe9,0x00050041, +0x000006c2,0x00000feb,0x000006af,0x00003257, +0x0004003d,0x00000006,0x00000fec,0x00000feb, +0x00050041,0x000006c2,0x00000fee,0x000006af, +0x00000fe5,0x0004003d,0x00000006,0x00000fef, +0x00000fee,0x00050041,0x000006c2,0x00000ff1, +0x000006c4,0x00003257,0x0004003d,0x00000006, +0x00000ff2,0x00000ff1,0x00050041,0x000006c2, +0x00000ff4,0x000006c4,0x00000fe5,0x0004003d, +0x00000006,0x00000ff5,0x00000ff4,0x000500ac, +0x0000002f,0x00000ff8,0x00000fec,0x00000fef, +0x000400a8,0x0000002f,0x00000ff9,0x00000ff8, +0x000300f7,0x00001002,0x00000000,0x000400fa, +0x00000ff9,0x00000ffa,0x00001002,0x000200f8, +0x00000ffa,0x000500aa,0x0000002f,0x00000ffd, +0x00000fec,0x00000fef,0x000500ac,0x0000002f, +0x00001000,0x00000ff2,0x00000ff5,0x000500a7, +0x0000002f,0x00001001,0x00000ffd,0x00001000, +0x000200f9,0x00001002,0x000200f8,0x00001002, +0x000700f5,0x0000002f,0x00001003,0x00000ff8, +0x00000fe9,0x00001001,0x00000ffa,0x000500c7, +0x00000006,0x00001007,0x00003257,0x00003252, +0x000500aa,0x0000002f,0x00001008,0x00001007, +0x000000a6,0x000500a4,0x0000002f,0x00001009, +0x00001003,0x00001008,0x000300f7,0x00001017, +0x00000000,0x000400fa,0x00001009,0x0000100a, +0x00001017,0x000200f8,0x0000100a,0x0003003e, +0x00000feb,0x00000fef,0x0003003e,0x00000fee, +0x00000fec,0x0003003e,0x00000ff1,0x00000ff5, +0x0003003e,0x00000ff4,0x00000ff2,0x000200f9, +0x00001017,0x000200f8,0x00001017,0x000200f9, +0x00001018,0x000200f8,0x00001018,0x000200f9, +0x00001019,0x000200f8,0x00001019,0x00050080, +0x00000006,0x0000101b,0x00003257,0x00000107, +0x000200f9,0x00000fdd,0x000200f8,0x0000101c, 0x000400e0,0x00000170,0x00000170,0x000006da, -0x000200f9,0x00000fe0,0x000200f8,0x00000fe0, -0x000500c2,0x00000006,0x00000fe2,0x00003149, -0x00000154,0x000200f9,0x00000f9a,0x000200f8, -0x00000fe3,0x000200f9,0x00000fe4,0x000200f8, -0x00000fe4,0x000500c4,0x00000006,0x00000fe6, -0x00003146,0x00000154,0x000200f9,0x00000f92, -0x000200f8,0x00000fe7,0x000200f9,0x00000fe9, -0x000200f8,0x00000fe9,0x000700f5,0x00000006, -0x00003148,0x00000b40,0x00000fe7,0x00001005, -0x00000fee,0x000500b0,0x0000002f,0x00000fed, -0x00003148,0x00000f5c,0x000400f6,0x00001006, -0x00000fee,0x00000000,0x000400fa,0x00000fed, -0x00000fee,0x00001006,0x000200f8,0x00000fee, -0x00050084,0x00000006,0x00000ff1,0x0000010a, -0x00003148,0x00050080,0x00000006,0x00000ff2, -0x00000107,0x00000ff1,0x00050041,0x00000156, -0x00000ff4,0x000000fc,0x00000154,0x0004003d, -0x00000007,0x00000ff5,0x00000ff4,0x00050041, -0x000006c2,0x00000ff6,0x000006af,0x00003148, -0x0004003d,0x00000006,0x00000ff7,0x00000ff6, -0x00050051,0x00000006,0x00001068,0x00000ff5, -0x00000000,0x00050095,0x000000ab,0x0000106a, -0x00001068,0x00000ff2,0x00050051,0x00000006, -0x0000106b,0x0000106a,0x00000001,0x00050051, -0x00000006,0x0000106c,0x0000106a,0x00000000, -0x00050051,0x00000006,0x0000106f,0x00000ff5, -0x00000001,0x00050080,0x00000006,0x00001071, -0x0000106f,0x0000106b,0x00050050,0x00000007, -0x00001072,0x0000106c,0x00001071,0x0004007c, -0x00000014,0x00001062,0x00001072,0x00060041, -0x000000db,0x0000105a,0x00001062,0x000000da, -0x000000da,0x0005003e,0x0000105a,0x00000ff7, +0x000200f9,0x0000101d,0x000200f8,0x0000101d, +0x000500c2,0x00000006,0x0000101f,0x00003255, +0x00000154,0x000200f9,0x00000fd7,0x000200f8, +0x00001020,0x000200f9,0x00001021,0x000200f8, +0x00001021,0x000500c4,0x00000006,0x00001023, +0x00003252,0x00000154,0x000200f9,0x00000fcf, +0x000200f8,0x00001024,0x000200f9,0x00001026, +0x000200f8,0x00001026,0x000700f5,0x00000006, +0x00003254,0x00000b40,0x00001024,0x00001042, +0x0000102b,0x000500b0,0x0000002f,0x0000102a, +0x00003254,0x00000f99,0x000400f6,0x00001043, +0x0000102b,0x00000000,0x000400fa,0x0000102a, +0x0000102b,0x00001043,0x000200f8,0x0000102b, +0x00050084,0x00000006,0x0000102e,0x0000010a, +0x00003254,0x00050080,0x00000006,0x0000102f, +0x00000107,0x0000102e,0x00050041,0x00000156, +0x00001031,0x000000fc,0x00000154,0x0004003d, +0x00000007,0x00001032,0x00001031,0x00050041, +0x000006c2,0x00001033,0x000006af,0x00003254, +0x0004003d,0x00000006,0x00001034,0x00001033, +0x00050051,0x00000006,0x000010a5,0x00001032, +0x00000000,0x00050095,0x000000ab,0x000010a7, +0x000010a5,0x0000102f,0x00050051,0x00000006, +0x000010a8,0x000010a7,0x00000001,0x00050051, +0x00000006,0x000010a9,0x000010a7,0x00000000, +0x00050051,0x00000006,0x000010ac,0x00001032, +0x00000001,0x00050080,0x00000006,0x000010ae, +0x000010ac,0x000010a8,0x00050050,0x00000007, +0x000010af,0x000010a9,0x000010ae,0x0004007c, +0x00000014,0x0000109f,0x000010af,0x00060041, +0x000000db,0x00001097,0x0000109f,0x000000da, +0x000000da,0x0005003e,0x00001097,0x00001034, 0x00000002,0x00000004,0x00050084,0x00000006, -0x00001077,0x0000010a,0x00000f5c,0x00050080, -0x00000006,0x00001078,0x00000107,0x00001077, -0x00050080,0x00000006,0x00000ffc,0x00001078, -0x00000ff1,0x00050041,0x000006c2,0x00001000, -0x000006c4,0x00003148,0x0004003d,0x00000006, -0x00001001,0x00001000,0x00050095,0x000000ab, -0x00001090,0x00001068,0x00000ffc,0x00050051, -0x00000006,0x00001091,0x00001090,0x00000001, -0x00050051,0x00000006,0x00001092,0x00001090, -0x00000000,0x00050080,0x00000006,0x00001097, -0x0000106f,0x00001091,0x00050050,0x00000007, -0x00001098,0x00001092,0x00001097,0x0004007c, -0x00000014,0x00001088,0x00001098,0x00060041, -0x000000db,0x00001080,0x00001088,0x000000da, -0x000000da,0x0005003e,0x00001080,0x00001001, +0x000010b4,0x0000010a,0x00000f99,0x00050080, +0x00000006,0x000010b5,0x00000107,0x000010b4, +0x00050080,0x00000006,0x00001039,0x000010b5, +0x0000102e,0x00050041,0x000006c2,0x0000103d, +0x000006c4,0x00003254,0x0004003d,0x00000006, +0x0000103e,0x0000103d,0x00050095,0x000000ab, +0x000010cd,0x000010a5,0x00001039,0x00050051, +0x00000006,0x000010ce,0x000010cd,0x00000001, +0x00050051,0x00000006,0x000010cf,0x000010cd, +0x00000000,0x00050080,0x00000006,0x000010d4, +0x000010ac,0x000010ce,0x00050050,0x00000007, +0x000010d5,0x000010cf,0x000010d4,0x0004007c, +0x00000014,0x000010c5,0x000010d5,0x00060041, +0x000000db,0x000010bd,0x000010c5,0x000000da, +0x000000da,0x0005003e,0x000010bd,0x0000103e, 0x00000002,0x00000004,0x00050080,0x00000006, -0x00001005,0x00003148,0x00000107,0x000200f9, -0x00000fe9,0x000200f8,0x00001006,0x000200f9, -0x00000bb6,0x000200f8,0x00000b3d,0x000500aa, +0x00001042,0x00003254,0x00000107,0x000200f9, +0x00001026,0x000200f8,0x00001043,0x000200f9, +0x00000bf3,0x000200f8,0x00000b3d,0x000500aa, 0x0000002f,0x00000b45,0x00000b13,0x00000239, 0x000300f7,0x00000b47,0x00000000,0x000400fa, 0x00000b45,0x00000b46,0x00000b47,0x000200f8, @@ -896,3095 +897,3196 @@ 0x00000b11,0x000000a6,0x000300f7,0x00000b4b, 0x00000000,0x000400fa,0x00000b49,0x00000b4a, 0x00000b4b,0x000200f8,0x00000b4a,0x00050041, -0x000000fe,0x000010d1,0x000000fc,0x00000308, -0x0004003d,0x00000006,0x000010d2,0x000010d1, -0x00050041,0x000000fe,0x000010d3,0x000000fc, -0x0000096c,0x0004003d,0x00000006,0x000010d4, -0x000010d3,0x00050080,0x00000006,0x000010d6, -0x000010d4,0x000010d2,0x00050041,0x000000fe, -0x00001167,0x000000fc,0x000000fd,0x0004003d, -0x00000006,0x00001168,0x00001167,0x00050084, -0x00000006,0x00001169,0x0000011f,0x00001168, -0x00050080,0x00000006,0x0000116a,0x00000107, -0x00001169,0x00050080,0x00000006,0x00001170, -0x00001168,0x0000319c,0x00050086,0x00000006, -0x00001171,0x00001170,0x00000101,0x00050084, -0x00000006,0x00001163,0x00000107,0x00001171, -0x00050080,0x00000006,0x00001164,0x0000116a, -0x00001163,0x00050084,0x00000006,0x00001138, -0x00000150,0x000010d6,0x00050080,0x00000006, -0x00001139,0x00001164,0x00001138,0x00050041, -0x00000156,0x0000113a,0x000000fc,0x00000154, -0x0004003d,0x00000007,0x0000113b,0x0000113a, -0x00050051,0x00000006,0x00001188,0x0000113b, -0x00000000,0x00050095,0x000000ab,0x0000118a, -0x00001188,0x00001139,0x00050051,0x00000006, -0x0000118b,0x0000118a,0x00000001,0x00050051, -0x00000006,0x0000118c,0x0000118a,0x00000000, -0x00050051,0x00000006,0x0000118f,0x0000113b, -0x00000001,0x00050080,0x00000006,0x00001191, -0x0000118f,0x0000118b,0x00050050,0x00000007, -0x00001192,0x0000118c,0x00001191,0x0004007c, -0x00000014,0x00001182,0x00001192,0x00060041, -0x000000db,0x00001179,0x00001182,0x000000da, -0x000000da,0x0006003d,0x00000006,0x0000117a, -0x00001179,0x00000002,0x00000004,0x00050080, -0x00000006,0x00001140,0x00001139,0x0000010a, -0x00050095,0x000000ab,0x000011ab,0x00001188, -0x00001140,0x00050051,0x00000006,0x000011ac, -0x000011ab,0x00000001,0x00050051,0x00000006, -0x000011ad,0x000011ab,0x00000000,0x00050080, -0x00000006,0x000011b2,0x0000118f,0x000011ac, -0x00050050,0x00000007,0x000011b3,0x000011ad, -0x000011b2,0x0004007c,0x00000014,0x000011a3, -0x000011b3,0x00060041,0x000000db,0x0000119a, -0x000011a3,0x000000da,0x000000da,0x0006003d, -0x00000006,0x0000119b,0x0000119a,0x00000002, -0x00000004,0x00050080,0x00000006,0x00001146, -0x00001139,0x00000111,0x00050095,0x000000ab, -0x000011cc,0x00001188,0x00001146,0x00050051, -0x00000006,0x000011cd,0x000011cc,0x00000001, -0x00050051,0x00000006,0x000011ce,0x000011cc, -0x00000000,0x00050080,0x00000006,0x000011d3, -0x0000118f,0x000011cd,0x00050050,0x00000007, -0x000011d4,0x000011ce,0x000011d3,0x0004007c, -0x00000014,0x000011c4,0x000011d4,0x00060041, -0x000000db,0x000011bb,0x000011c4,0x000000da, -0x000000da,0x0006003d,0x00000006,0x000011bc, -0x000011bb,0x00000002,0x00000004,0x00050080, -0x00000006,0x0000114d,0x00001139,0x00000118, -0x00050095,0x000000ab,0x000011ed,0x00001188, -0x0000114d,0x00050051,0x00000006,0x000011ee, -0x000011ed,0x00000001,0x00050051,0x00000006, -0x000011ef,0x000011ed,0x00000000,0x00050080, -0x00000006,0x000011f4,0x0000118f,0x000011ee, -0x00050050,0x00000007,0x000011f5,0x000011ef, -0x000011f4,0x0004007c,0x00000014,0x000011e5, -0x000011f5,0x00060041,0x000000db,0x000011dc, -0x000011e5,0x000000da,0x000000da,0x0006003d, -0x00000006,0x000011dd,0x000011dc,0x00000002, -0x00000004,0x00050080,0x00000006,0x00001153, -0x00001139,0x0000011f,0x00050095,0x000000ab, -0x0000120e,0x00001188,0x00001153,0x00050051, -0x00000006,0x0000120f,0x0000120e,0x00000001, -0x00050051,0x00000006,0x00001210,0x0000120e, -0x00000000,0x00050080,0x00000006,0x00001215, -0x0000118f,0x0000120f,0x00050050,0x00000007, -0x00001216,0x00001210,0x00001215,0x0004007c, -0x00000014,0x00001206,0x00001216,0x00060041, -0x000000db,0x000011fd,0x00001206,0x000000da, -0x000000da,0x0006003d,0x00000006,0x000011fe, -0x000011fd,0x00000002,0x00000004,0x00050080, -0x00000006,0x00001159,0x00001139,0x00000189, -0x00050095,0x000000ab,0x0000122f,0x00001188, -0x00001159,0x00050051,0x00000006,0x00001230, -0x0000122f,0x00000001,0x00050051,0x00000006, -0x00001231,0x0000122f,0x00000000,0x00050080, -0x00000006,0x00001236,0x0000118f,0x00001230, -0x00050050,0x00000007,0x00001237,0x00001231, -0x00001236,0x0004007c,0x00000014,0x00001227, -0x00001237,0x00060041,0x000000db,0x0000121e, -0x00001227,0x000000da,0x000000da,0x0006003d, -0x00000006,0x0000121f,0x0000121e,0x00000002, -0x00000004,0x00050041,0x000000fe,0x000010da, +0x000000fe,0x0000110e,0x000000fc,0x00000308, +0x0004003d,0x00000006,0x0000110f,0x0000110e, +0x00050041,0x000000fe,0x00001110,0x000000fc, +0x0000096c,0x0004003d,0x00000006,0x00001111, +0x00001110,0x00050080,0x00000006,0x00001113, +0x00001111,0x0000110f,0x00050041,0x000000fe, +0x000011a4,0x000000fc,0x000000fd,0x0004003d, +0x00000006,0x000011a5,0x000011a4,0x00050084, +0x00000006,0x000011a6,0x0000011f,0x000011a5, +0x00050080,0x00000006,0x000011a7,0x00000107, +0x000011a6,0x00050080,0x00000006,0x000011ad, +0x000011a5,0x000032a8,0x00050086,0x00000006, +0x000011ae,0x000011ad,0x00000101,0x00050084, +0x00000006,0x000011a0,0x00000107,0x000011ae, +0x00050080,0x00000006,0x000011a1,0x000011a7, +0x000011a0,0x00050084,0x00000006,0x00001175, +0x00000150,0x00001113,0x00050080,0x00000006, +0x00001176,0x000011a1,0x00001175,0x00050041, +0x00000156,0x00001177,0x000000fc,0x00000154, +0x0004003d,0x00000007,0x00001178,0x00001177, +0x00050051,0x00000006,0x000011c5,0x00001178, +0x00000000,0x00050095,0x000000ab,0x000011c7, +0x000011c5,0x00001176,0x00050051,0x00000006, +0x000011c8,0x000011c7,0x00000001,0x00050051, +0x00000006,0x000011c9,0x000011c7,0x00000000, +0x00050051,0x00000006,0x000011cc,0x00001178, +0x00000001,0x00050080,0x00000006,0x000011ce, +0x000011cc,0x000011c8,0x00050050,0x00000007, +0x000011cf,0x000011c9,0x000011ce,0x0004007c, +0x00000014,0x000011bf,0x000011cf,0x00060041, +0x000000db,0x000011b6,0x000011bf,0x000000da, +0x000000da,0x0006003d,0x00000006,0x000011b7, +0x000011b6,0x00000002,0x00000004,0x00050080, +0x00000006,0x0000117d,0x00001176,0x0000010a, +0x00050095,0x000000ab,0x000011e8,0x000011c5, +0x0000117d,0x00050051,0x00000006,0x000011e9, +0x000011e8,0x00000001,0x00050051,0x00000006, +0x000011ea,0x000011e8,0x00000000,0x00050080, +0x00000006,0x000011ef,0x000011cc,0x000011e9, +0x00050050,0x00000007,0x000011f0,0x000011ea, +0x000011ef,0x0004007c,0x00000014,0x000011e0, +0x000011f0,0x00060041,0x000000db,0x000011d7, +0x000011e0,0x000000da,0x000000da,0x0006003d, +0x00000006,0x000011d8,0x000011d7,0x00000002, +0x00000004,0x00050080,0x00000006,0x00001183, +0x00001176,0x00000111,0x00050095,0x000000ab, +0x00001209,0x000011c5,0x00001183,0x00050051, +0x00000006,0x0000120a,0x00001209,0x00000001, +0x00050051,0x00000006,0x0000120b,0x00001209, +0x00000000,0x00050080,0x00000006,0x00001210, +0x000011cc,0x0000120a,0x00050050,0x00000007, +0x00001211,0x0000120b,0x00001210,0x0004007c, +0x00000014,0x00001201,0x00001211,0x00060041, +0x000000db,0x000011f8,0x00001201,0x000000da, +0x000000da,0x0006003d,0x00000006,0x000011f9, +0x000011f8,0x00000002,0x00000004,0x00050080, +0x00000006,0x0000118a,0x00001176,0x00000118, +0x00050095,0x000000ab,0x0000122a,0x000011c5, +0x0000118a,0x00050051,0x00000006,0x0000122b, +0x0000122a,0x00000001,0x00050051,0x00000006, +0x0000122c,0x0000122a,0x00000000,0x00050080, +0x00000006,0x00001231,0x000011cc,0x0000122b, +0x00050050,0x00000007,0x00001232,0x0000122c, +0x00001231,0x0004007c,0x00000014,0x00001222, +0x00001232,0x00060041,0x000000db,0x00001219, +0x00001222,0x000000da,0x000000da,0x0006003d, +0x00000006,0x0000121a,0x00001219,0x00000002, +0x00000004,0x00050080,0x00000006,0x00001190, +0x00001176,0x0000011f,0x00050095,0x000000ab, +0x0000124b,0x000011c5,0x00001190,0x00050051, +0x00000006,0x0000124c,0x0000124b,0x00000001, +0x00050051,0x00000006,0x0000124d,0x0000124b, +0x00000000,0x00050080,0x00000006,0x00001252, +0x000011cc,0x0000124c,0x00050050,0x00000007, +0x00001253,0x0000124d,0x00001252,0x0004007c, +0x00000014,0x00001243,0x00001253,0x00060041, +0x000000db,0x0000123a,0x00001243,0x000000da, +0x000000da,0x0006003d,0x00000006,0x0000123b, +0x0000123a,0x00000002,0x00000004,0x00050080, +0x00000006,0x00001196,0x00001176,0x00000189, +0x00050095,0x000000ab,0x0000126c,0x000011c5, +0x00001196,0x00050051,0x00000006,0x0000126d, +0x0000126c,0x00000001,0x00050051,0x00000006, +0x0000126e,0x0000126c,0x00000000,0x00050080, +0x00000006,0x00001273,0x000011cc,0x0000126d, +0x00050050,0x00000007,0x00001274,0x0000126e, +0x00001273,0x0004007c,0x00000014,0x00001264, +0x00001274,0x00060041,0x000000db,0x0000125b, +0x00001264,0x000000da,0x000000da,0x0006003d, +0x00000006,0x0000125c,0x0000125b,0x00000002, +0x00000004,0x00050041,0x000000fe,0x00001117, 0x000000fc,0x00000224,0x0004003d,0x00000006, -0x000010db,0x000010da,0x000500ab,0x0000002f, -0x000010dc,0x000010db,0x000000a6,0x000600a9, -0x00000006,0x000010dd,0x000010dc,0x000000a6, -0x00000130,0x000500c5,0x00000006,0x000010de, -0x000010dd,0x00000239,0x00050041,0x00000156, -0x000010df,0x000000fc,0x000000da,0x0004003d, -0x00000007,0x000010e0,0x000010df,0x00050051, -0x00000006,0x0000124d,0x000010e0,0x00000000, -0x00050095,0x000000ab,0x0000124f,0x0000124d, -0x000000a6,0x00050051,0x00000006,0x00001250, -0x0000124f,0x00000001,0x00050051,0x00000006, -0x00001251,0x0000124f,0x00000000,0x00050051, -0x00000006,0x00001254,0x000010e0,0x00000001, -0x00050080,0x00000006,0x00001256,0x00001254, -0x00001250,0x00050050,0x00000007,0x00001257, -0x00001251,0x00001256,0x0004007c,0x00000014, -0x00001247,0x00001257,0x00060041,0x000000db, -0x0000123f,0x00001247,0x000000da,0x000000da, -0x0005003e,0x0000123f,0x000010de,0x00000002, -0x00000004,0x00050041,0x000000fe,0x000010e2, +0x00001118,0x00001117,0x000500ab,0x0000002f, +0x00001119,0x00001118,0x000000a6,0x000600a9, +0x00000006,0x0000111a,0x00001119,0x000000a6, +0x00000130,0x000500c5,0x00000006,0x0000111b, +0x0000111a,0x00000239,0x00050041,0x00000156, +0x0000111c,0x000000fc,0x000000da,0x0004003d, +0x00000007,0x0000111d,0x0000111c,0x00050051, +0x00000006,0x0000128a,0x0000111d,0x00000000, +0x00050095,0x000000ab,0x0000128c,0x0000128a, +0x000000a6,0x00050051,0x00000006,0x0000128d, +0x0000128c,0x00000001,0x00050051,0x00000006, +0x0000128e,0x0000128c,0x00000000,0x00050051, +0x00000006,0x00001291,0x0000111d,0x00000001, +0x00050080,0x00000006,0x00001293,0x00001291, +0x0000128d,0x00050050,0x00000007,0x00001294, +0x0000128e,0x00001293,0x0004007c,0x00000014, +0x00001284,0x00001294,0x00060041,0x000000db, +0x0000127c,0x00001284,0x000000da,0x000000da, +0x0005003e,0x0000127c,0x0000111b,0x00000002, +0x00000004,0x00050041,0x000000fe,0x0000111f, 0x000000fc,0x00000a97,0x0004003d,0x00000006, -0x000010e3,0x000010e2,0x00050086,0x00000006, -0x000010e4,0x000010e3,0x00000107,0x00050095, -0x000000ab,0x0000126f,0x0000124d,0x0000010a, -0x00050051,0x00000006,0x00001270,0x0000126f, -0x00000001,0x00050051,0x00000006,0x00001271, -0x0000126f,0x00000000,0x00050080,0x00000006, -0x00001276,0x00001254,0x00001270,0x00050050, -0x00000007,0x00001277,0x00001271,0x00001276, -0x0004007c,0x00000014,0x00001267,0x00001277, -0x00060041,0x000000db,0x0000125f,0x00001267, -0x000000da,0x000000da,0x0005003e,0x0000125f, -0x000010e4,0x00000002,0x00000004,0x00050095, -0x000000ab,0x0000128f,0x0000124d,0x00000111, -0x00050051,0x00000006,0x00001290,0x0000128f, -0x00000001,0x00050051,0x00000006,0x00001291, -0x0000128f,0x00000000,0x00050080,0x00000006, -0x00001296,0x00001254,0x00001290,0x00050050, -0x00000007,0x00001297,0x00001291,0x00001296, -0x0004007c,0x00000014,0x00001287,0x00001297, -0x00060041,0x000000db,0x0000127f,0x00001287, -0x000000da,0x000000da,0x0005003e,0x0000127f, +0x00001120,0x0000111f,0x00050086,0x00000006, +0x00001121,0x00001120,0x00000107,0x00050095, +0x000000ab,0x000012ac,0x0000128a,0x0000010a, +0x00050051,0x00000006,0x000012ad,0x000012ac, +0x00000001,0x00050051,0x00000006,0x000012ae, +0x000012ac,0x00000000,0x00050080,0x00000006, +0x000012b3,0x00001291,0x000012ad,0x00050050, +0x00000007,0x000012b4,0x000012ae,0x000012b3, +0x0004007c,0x00000014,0x000012a4,0x000012b4, +0x00060041,0x000000db,0x0000129c,0x000012a4, +0x000000da,0x000000da,0x0005003e,0x0000129c, +0x00001121,0x00000002,0x00000004,0x00050095, +0x000000ab,0x000012cc,0x0000128a,0x00000111, +0x00050051,0x00000006,0x000012cd,0x000012cc, +0x00000001,0x00050051,0x00000006,0x000012ce, +0x000012cc,0x00000000,0x00050080,0x00000006, +0x000012d3,0x00001291,0x000012cd,0x00050050, +0x00000007,0x000012d4,0x000012ce,0x000012d3, +0x0004007c,0x00000014,0x000012c4,0x000012d4, +0x00060041,0x000000db,0x000012bc,0x000012c4, +0x000000da,0x000000da,0x0005003e,0x000012bc, 0x000000a6,0x00000002,0x00000004,0x00050095, -0x000000ab,0x000012af,0x0000124d,0x00000118, -0x00050051,0x00000006,0x000012b0,0x000012af, -0x00000001,0x00050051,0x00000006,0x000012b1, -0x000012af,0x00000000,0x00050080,0x00000006, -0x000012b6,0x00001254,0x000012b0,0x00050050, -0x00000007,0x000012b7,0x000012b1,0x000012b6, -0x0004007c,0x00000014,0x000012a7,0x000012b7, -0x00060041,0x000000db,0x0000129f,0x000012a7, -0x000000da,0x000000da,0x0005003e,0x0000129f, -0x000010d4,0x00000002,0x00000004,0x00050095, -0x000000ab,0x000012d8,0x0000124d,0x0000011f, -0x00050051,0x00000006,0x000012d9,0x000012d8, -0x00000001,0x00050051,0x00000006,0x000012da, -0x000012d8,0x00000000,0x00050080,0x00000006, -0x000012df,0x00001254,0x000012d9,0x00050050, -0x00000007,0x000012e0,0x000012da,0x000012df, -0x0004007c,0x00000014,0x000012d0,0x000012e0, -0x00060041,0x000000db,0x000012c8,0x000012d0, -0x000000da,0x000000da,0x0005003e,0x000012c8, -0x0000117a,0x00000002,0x00000004,0x00050095, -0x000000ab,0x00001301,0x0000124d,0x00000189, -0x00050051,0x00000006,0x00001302,0x00001301, -0x00000001,0x00050051,0x00000006,0x00001303, -0x00001301,0x00000000,0x00050080,0x00000006, -0x00001308,0x00001254,0x00001302,0x00050050, -0x00000007,0x00001309,0x00001303,0x00001308, -0x0004007c,0x00000014,0x000012f9,0x00001309, -0x00060041,0x000000db,0x000012f1,0x000012f9, -0x000000da,0x000000da,0x0005003e,0x000012f1, -0x0000119b,0x00000002,0x00000004,0x00050095, -0x000000ab,0x0000132a,0x0000124d,0x00000150, -0x00050051,0x00000006,0x0000132b,0x0000132a, -0x00000001,0x00050051,0x00000006,0x0000132c, -0x0000132a,0x00000000,0x00050080,0x00000006, -0x00001331,0x00001254,0x0000132b,0x00050050, -0x00000007,0x00001332,0x0000132c,0x00001331, -0x0004007c,0x00000014,0x00001322,0x00001332, -0x00060041,0x000000db,0x0000131a,0x00001322, -0x000000da,0x000000da,0x0005003e,0x0000131a, -0x000011bc,0x00000002,0x00000004,0x00050095, -0x000000ab,0x00001353,0x0000124d,0x00000463, -0x00050051,0x00000006,0x00001354,0x00001353, -0x00000001,0x00050051,0x00000006,0x00001355, -0x00001353,0x00000000,0x00050080,0x00000006, -0x0000135a,0x00001254,0x00001354,0x00050050, -0x00000007,0x0000135b,0x00001355,0x0000135a, -0x0004007c,0x00000014,0x0000134b,0x0000135b, -0x00060041,0x000000db,0x00001343,0x0000134b, -0x000000da,0x000000da,0x0005003e,0x00001343, -0x000011dd,0x00000002,0x00000004,0x00050095, -0x000000ab,0x0000137c,0x0000124d,0x00000469, -0x00050051,0x00000006,0x0000137d,0x0000137c, -0x00000001,0x00050051,0x00000006,0x0000137e, -0x0000137c,0x00000000,0x00050080,0x00000006, -0x00001383,0x00001254,0x0000137d,0x00050050, -0x00000007,0x00001384,0x0000137e,0x00001383, -0x0004007c,0x00000014,0x00001374,0x00001384, -0x00060041,0x000000db,0x0000136c,0x00001374, -0x000000da,0x000000da,0x0005003e,0x0000136c, -0x000011fe,0x00000002,0x00000004,0x00050095, -0x000000ab,0x000013a5,0x0000124d,0x00000347, -0x00050051,0x00000006,0x000013a6,0x000013a5, -0x00000001,0x00050051,0x00000006,0x000013a7, -0x000013a5,0x00000000,0x00050080,0x00000006, -0x000013ac,0x00001254,0x000013a6,0x00050050, -0x00000007,0x000013ad,0x000013a7,0x000013ac, -0x0004007c,0x00000014,0x0000139d,0x000013ad, -0x00060041,0x000000db,0x00001395,0x0000139d, -0x000000da,0x000000da,0x0005003e,0x00001395, -0x0000121f,0x00000002,0x00000004,0x00050041, -0x000000fe,0x00001110,0x000000fc,0x0000023e, -0x0004003d,0x00000006,0x00001111,0x00001110, -0x00050095,0x000000ab,0x000013c5,0x0000124d, -0x00000352,0x00050051,0x00000006,0x000013c6, -0x000013c5,0x00000001,0x00050051,0x00000006, -0x000013c7,0x000013c5,0x00000000,0x00050080, -0x00000006,0x000013cc,0x00001254,0x000013c6, -0x00050050,0x00000007,0x000013cd,0x000013c7, -0x000013cc,0x0004007c,0x00000014,0x000013bd, -0x000013cd,0x00060041,0x000000db,0x000013b5, -0x000013bd,0x000000da,0x000000da,0x0005003e, -0x000013b5,0x00001111,0x00000002,0x00000004, -0x00050095,0x000000ab,0x000013e5,0x0000124d, -0x0000035d,0x00050051,0x00000006,0x000013e6, -0x000013e5,0x00000001,0x00050051,0x00000006, -0x000013e7,0x000013e5,0x00000000,0x00050080, -0x00000006,0x000013ec,0x00001254,0x000013e6, -0x00050050,0x00000007,0x000013ed,0x000013e7, -0x000013ec,0x0004007c,0x00000014,0x000013dd, -0x000013ed,0x00060041,0x000000db,0x000013d5, -0x000013dd,0x000000da,0x000000da,0x0005003e, -0x000013d5,0x000000a6,0x00000002,0x00000004, -0x00050084,0x00000006,0x000013f3,0x000010d2, -0x00000228,0x00050080,0x00000006,0x000013f4, -0x00001111,0x000013f3,0x000500c2,0x00000006, -0x000013f5,0x000013f4,0x00000233,0x000500c4, -0x00000006,0x000013f6,0x000013f5,0x0000020d, -0x000500c5,0x00000006,0x000013f7,0x000013f6, -0x00000246,0x00050095,0x000000ab,0x0000140f, -0x0000124d,0x00000368,0x00050051,0x00000006, -0x00001410,0x0000140f,0x00000001,0x00050051, -0x00000006,0x00001411,0x0000140f,0x00000000, -0x00050080,0x00000006,0x00001416,0x00001254, -0x00001410,0x00050050,0x00000007,0x00001417, -0x00001411,0x00001416,0x0004007c,0x00000014, -0x00001407,0x00001417,0x00060041,0x000000db, -0x000013ff,0x00001407,0x000000da,0x000000da, -0x0005003e,0x000013ff,0x000013f7,0x00000002, -0x00000004,0x00050041,0x000000fe,0x0000111d, +0x000000ab,0x000012ec,0x0000128a,0x00000118, +0x00050051,0x00000006,0x000012ed,0x000012ec, +0x00000001,0x00050051,0x00000006,0x000012ee, +0x000012ec,0x00000000,0x00050080,0x00000006, +0x000012f3,0x00001291,0x000012ed,0x00050050, +0x00000007,0x000012f4,0x000012ee,0x000012f3, +0x0004007c,0x00000014,0x000012e4,0x000012f4, +0x00060041,0x000000db,0x000012dc,0x000012e4, +0x000000da,0x000000da,0x0005003e,0x000012dc, +0x00001111,0x00000002,0x00000004,0x00050095, +0x000000ab,0x00001315,0x0000128a,0x0000011f, +0x00050051,0x00000006,0x00001316,0x00001315, +0x00000001,0x00050051,0x00000006,0x00001317, +0x00001315,0x00000000,0x00050080,0x00000006, +0x0000131c,0x00001291,0x00001316,0x00050050, +0x00000007,0x0000131d,0x00001317,0x0000131c, +0x0004007c,0x00000014,0x0000130d,0x0000131d, +0x00060041,0x000000db,0x00001305,0x0000130d, +0x000000da,0x000000da,0x0005003e,0x00001305, +0x000011b7,0x00000002,0x00000004,0x00050095, +0x000000ab,0x0000133e,0x0000128a,0x00000189, +0x00050051,0x00000006,0x0000133f,0x0000133e, +0x00000001,0x00050051,0x00000006,0x00001340, +0x0000133e,0x00000000,0x00050080,0x00000006, +0x00001345,0x00001291,0x0000133f,0x00050050, +0x00000007,0x00001346,0x00001340,0x00001345, +0x0004007c,0x00000014,0x00001336,0x00001346, +0x00060041,0x000000db,0x0000132e,0x00001336, +0x000000da,0x000000da,0x0005003e,0x0000132e, +0x000011d8,0x00000002,0x00000004,0x00050095, +0x000000ab,0x00001367,0x0000128a,0x00000150, +0x00050051,0x00000006,0x00001368,0x00001367, +0x00000001,0x00050051,0x00000006,0x00001369, +0x00001367,0x00000000,0x00050080,0x00000006, +0x0000136e,0x00001291,0x00001368,0x00050050, +0x00000007,0x0000136f,0x00001369,0x0000136e, +0x0004007c,0x00000014,0x0000135f,0x0000136f, +0x00060041,0x000000db,0x00001357,0x0000135f, +0x000000da,0x000000da,0x0005003e,0x00001357, +0x000011f9,0x00000002,0x00000004,0x00050095, +0x000000ab,0x00001390,0x0000128a,0x00000463, +0x00050051,0x00000006,0x00001391,0x00001390, +0x00000001,0x00050051,0x00000006,0x00001392, +0x00001390,0x00000000,0x00050080,0x00000006, +0x00001397,0x00001291,0x00001391,0x00050050, +0x00000007,0x00001398,0x00001392,0x00001397, +0x0004007c,0x00000014,0x00001388,0x00001398, +0x00060041,0x000000db,0x00001380,0x00001388, +0x000000da,0x000000da,0x0005003e,0x00001380, +0x0000121a,0x00000002,0x00000004,0x00050095, +0x000000ab,0x000013b9,0x0000128a,0x00000469, +0x00050051,0x00000006,0x000013ba,0x000013b9, +0x00000001,0x00050051,0x00000006,0x000013bb, +0x000013b9,0x00000000,0x00050080,0x00000006, +0x000013c0,0x00001291,0x000013ba,0x00050050, +0x00000007,0x000013c1,0x000013bb,0x000013c0, +0x0004007c,0x00000014,0x000013b1,0x000013c1, +0x00060041,0x000000db,0x000013a9,0x000013b1, +0x000000da,0x000000da,0x0005003e,0x000013a9, +0x0000123b,0x00000002,0x00000004,0x00050095, +0x000000ab,0x000013e2,0x0000128a,0x00000347, +0x00050051,0x00000006,0x000013e3,0x000013e2, +0x00000001,0x00050051,0x00000006,0x000013e4, +0x000013e2,0x00000000,0x00050080,0x00000006, +0x000013e9,0x00001291,0x000013e3,0x00050050, +0x00000007,0x000013ea,0x000013e4,0x000013e9, +0x0004007c,0x00000014,0x000013da,0x000013ea, +0x00060041,0x000000db,0x000013d2,0x000013da, +0x000000da,0x000000da,0x0005003e,0x000013d2, +0x0000125c,0x00000002,0x00000004,0x00050041, +0x000000fe,0x0000114d,0x000000fc,0x0000023e, +0x0004003d,0x00000006,0x0000114e,0x0000114d, +0x00050095,0x000000ab,0x00001402,0x0000128a, +0x00000352,0x00050051,0x00000006,0x00001403, +0x00001402,0x00000001,0x00050051,0x00000006, +0x00001404,0x00001402,0x00000000,0x00050080, +0x00000006,0x00001409,0x00001291,0x00001403, +0x00050050,0x00000007,0x0000140a,0x00001404, +0x00001409,0x0004007c,0x00000014,0x000013fa, +0x0000140a,0x00060041,0x000000db,0x000013f2, +0x000013fa,0x000000da,0x000000da,0x0005003e, +0x000013f2,0x0000114e,0x00000002,0x00000004, +0x00050095,0x000000ab,0x00001422,0x0000128a, +0x0000035d,0x00050051,0x00000006,0x00001423, +0x00001422,0x00000001,0x00050051,0x00000006, +0x00001424,0x00001422,0x00000000,0x00050080, +0x00000006,0x00001429,0x00001291,0x00001423, +0x00050050,0x00000007,0x0000142a,0x00001424, +0x00001429,0x0004007c,0x00000014,0x0000141a, +0x0000142a,0x00060041,0x000000db,0x00001412, +0x0000141a,0x000000da,0x000000da,0x0005003e, +0x00001412,0x000000a6,0x00000002,0x00000004, +0x00050084,0x00000006,0x00001430,0x0000110f, +0x00000228,0x00050080,0x00000006,0x00001431, +0x0000114e,0x00001430,0x000500c2,0x00000006, +0x00001432,0x00001431,0x00000233,0x000500c4, +0x00000006,0x00001433,0x00001432,0x0000020d, +0x000500c5,0x00000006,0x00001434,0x00001433, +0x00000246,0x00050095,0x000000ab,0x0000144c, +0x0000128a,0x00000368,0x00050051,0x00000006, +0x0000144d,0x0000144c,0x00000001,0x00050051, +0x00000006,0x0000144e,0x0000144c,0x00000000, +0x00050080,0x00000006,0x00001453,0x00001291, +0x0000144d,0x00050050,0x00000007,0x00001454, +0x0000144e,0x00001453,0x0004007c,0x00000014, +0x00001444,0x00001454,0x00060041,0x000000db, +0x0000143c,0x00001444,0x000000da,0x000000da, +0x0005003e,0x0000143c,0x00001434,0x00000002, +0x00000004,0x00050041,0x000000fe,0x0000115a, 0x000000fc,0x0000022c,0x0004003d,0x00000006, -0x0000111e,0x0000111d,0x00050095,0x000000ab, -0x0000142f,0x0000124d,0x00000374,0x00050051, -0x00000006,0x00001430,0x0000142f,0x00000001, -0x00050051,0x00000006,0x00001431,0x0000142f, -0x00000000,0x00050080,0x00000006,0x00001436, -0x00001254,0x00001430,0x00050050,0x00000007, -0x00001437,0x00001431,0x00001436,0x0004007c, -0x00000014,0x00001427,0x00001437,0x00060041, -0x000000db,0x0000141f,0x00001427,0x000000da, -0x000000da,0x0005003e,0x0000141f,0x0000111e, +0x0000115b,0x0000115a,0x00050095,0x000000ab, +0x0000146c,0x0000128a,0x00000374,0x00050051, +0x00000006,0x0000146d,0x0000146c,0x00000001, +0x00050051,0x00000006,0x0000146e,0x0000146c, +0x00000000,0x00050080,0x00000006,0x00001473, +0x00001291,0x0000146d,0x00050050,0x00000007, +0x00001474,0x0000146e,0x00001473,0x0004007c, +0x00000014,0x00001464,0x00001474,0x00060041, +0x000000db,0x0000145c,0x00001464,0x000000da, +0x000000da,0x0005003e,0x0000145c,0x0000115b, 0x00000002,0x00000004,0x00050041,0x000000fe, -0x00001122,0x000000fc,0x000009ef,0x0004003d, -0x00000006,0x00001123,0x00001122,0x00050095, -0x000000ab,0x0000144f,0x0000124d,0x0000037e, -0x00050051,0x00000006,0x00001450,0x0000144f, -0x00000001,0x00050051,0x00000006,0x00001451, -0x0000144f,0x00000000,0x00050080,0x00000006, -0x00001456,0x00001254,0x00001450,0x00050050, -0x00000007,0x00001457,0x00001451,0x00001456, -0x0004007c,0x00000014,0x00001447,0x00001457, -0x00060041,0x000000db,0x0000143f,0x00001447, -0x000000da,0x000000da,0x0005003e,0x0000143f, -0x00001123,0x00000002,0x00000004,0x00050095, -0x000000ab,0x0000146f,0x0000124d,0x00000388, -0x00050051,0x00000006,0x00001470,0x0000146f, -0x00000001,0x00050051,0x00000006,0x00001471, -0x0000146f,0x00000000,0x00050080,0x00000006, -0x00001476,0x00001254,0x00001470,0x00050050, -0x00000007,0x00001477,0x00001471,0x00001476, -0x0004007c,0x00000014,0x00001467,0x00001477, -0x00060041,0x000000db,0x0000145f,0x00001467, -0x000000da,0x000000da,0x0005003e,0x0000145f, +0x0000115f,0x000000fc,0x000009ef,0x0004003d, +0x00000006,0x00001160,0x0000115f,0x00050095, +0x000000ab,0x0000148c,0x0000128a,0x0000037e, +0x00050051,0x00000006,0x0000148d,0x0000148c, +0x00000001,0x00050051,0x00000006,0x0000148e, +0x0000148c,0x00000000,0x00050080,0x00000006, +0x00001493,0x00001291,0x0000148d,0x00050050, +0x00000007,0x00001494,0x0000148e,0x00001493, +0x0004007c,0x00000014,0x00001484,0x00001494, +0x00060041,0x000000db,0x0000147c,0x00001484, +0x000000da,0x000000da,0x0005003e,0x0000147c, +0x00001160,0x00000002,0x00000004,0x00050095, +0x000000ab,0x000014ac,0x0000128a,0x00000388, +0x00050051,0x00000006,0x000014ad,0x000014ac, +0x00000001,0x00050051,0x00000006,0x000014ae, +0x000014ac,0x00000000,0x00050080,0x00000006, +0x000014b3,0x00001291,0x000014ad,0x00050050, +0x00000007,0x000014b4,0x000014ae,0x000014b3, +0x0004007c,0x00000014,0x000014a4,0x000014b4, +0x00060041,0x000000db,0x0000149c,0x000014a4, +0x000000da,0x000000da,0x0005003e,0x0000149c, 0x000000a6,0x00000002,0x00000004,0x000200f9, 0x00000b4b,0x000200f8,0x00000b4b,0x000200f9, -0x00000bb6,0x000200f8,0x00000b47,0x00050041, +0x00000bf3,0x000200f8,0x00000b47,0x00050041, 0x000000fe,0x00000b4f,0x000000fc,0x000004d8, 0x0004003d,0x00000006,0x00000b50,0x00000b4f, 0x000500ae,0x0000002f,0x00000b51,0x00000b11, 0x00000b50,0x000300f7,0x00000b53,0x00000000, 0x000400fa,0x00000b51,0x00000b52,0x00000b53, -0x000200f8,0x00000b52,0x000200f9,0x00000bb6, +0x000200f8,0x00000b52,0x000200f9,0x00000bf3, 0x000200f8,0x00000b53,0x000500aa,0x0000002f, 0x00000b58,0x00000b13,0x00000b57,0x000300f7, 0x00000b5a,0x00000000,0x000400fa,0x00000b58, -0x00000b59,0x00000b6a,0x000200f8,0x00000b59, -0x00050084,0x00000006,0x00000b5c,0x0000010a, -0x00000b11,0x00050041,0x00000156,0x00000b60, +0x00000b59,0x00000b5a,0x000200f8,0x00000b59, +0x000500aa,0x0000002f,0x00000b5c,0x00000b11, +0x000000a6,0x000300f7,0x00000b5e,0x00000000, +0x000400fa,0x00000b5c,0x00000b5d,0x00000b5e, +0x000200f8,0x00000b5d,0x00050041,0x00000156, +0x00000b60,0x000000fc,0x00000205,0x0004003d, +0x00000007,0x00000b61,0x00000b60,0x00050051, +0x00000006,0x000014cb,0x00000b61,0x00000000, +0x00050095,0x000000ab,0x000014cd,0x000014cb, +0x0000010a,0x00050051,0x00000006,0x000014ce, +0x000014cd,0x00000001,0x00050051,0x00000006, +0x000014cf,0x000014cd,0x00000000,0x00050051, +0x00000006,0x000014d2,0x00000b61,0x00000001, +0x00050080,0x00000006,0x000014d4,0x000014d2, +0x000014ce,0x00050050,0x00000007,0x000014d5, +0x000014cf,0x000014d4,0x0004007c,0x00000014, +0x000014c5,0x000014d5,0x00060041,0x000000db, +0x000014bc,0x000014c5,0x000000da,0x000000da, +0x0006003d,0x00000006,0x000014bd,0x000014bc, +0x00000002,0x00000004,0x00050084,0x00000006, +0x00000b64,0x000014bd,0x00000107,0x00050041, +0x00000156,0x00000b66,0x000000fc,0x000000da, +0x0004003d,0x00000007,0x00000b67,0x00000b66, +0x00050051,0x00000006,0x000014eb,0x00000b67, +0x00000000,0x00050095,0x000000ab,0x000014ed, +0x000014eb,0x000000a6,0x00050051,0x00000006, +0x000014ee,0x000014ed,0x00000001,0x00050051, +0x00000006,0x000014ef,0x000014ed,0x00000000, +0x00050051,0x00000006,0x000014f2,0x00000b67, +0x00000001,0x00050080,0x00000006,0x000014f4, +0x000014f2,0x000014ee,0x00050050,0x00000007, +0x000014f5,0x000014ef,0x000014f4,0x0004007c, +0x00000014,0x000014e5,0x000014f5,0x00060041, +0x000000db,0x000014dd,0x000014e5,0x000000da, +0x000000da,0x0005003e,0x000014dd,0x00000b64, +0x00000002,0x00000004,0x00050095,0x000000ab, +0x0000150d,0x000014eb,0x0000010a,0x00050051, +0x00000006,0x0000150e,0x0000150d,0x00000001, +0x00050051,0x00000006,0x0000150f,0x0000150d, +0x00000000,0x00050080,0x00000006,0x00001514, +0x000014f2,0x0000150e,0x00050050,0x00000007, +0x00001515,0x0000150f,0x00001514,0x0004007c, +0x00000014,0x00001505,0x00001515,0x00060041, +0x000000db,0x000014fd,0x00001505,0x000000da, +0x000000da,0x0005003e,0x000014fd,0x000000a6, +0x00000002,0x00000004,0x000200f9,0x00000b5e, +0x000200f8,0x00000b5e,0x000200f9,0x00000bf3, +0x000200f8,0x00000b5a,0x000500aa,0x0000002f, +0x00000b74,0x00000b13,0x00000118,0x000300f7, +0x00000b76,0x00000000,0x000400fa,0x00000b74, +0x00000b75,0x00000b76,0x000200f8,0x00000b75, +0x00050084,0x00000006,0x00000b78,0x0000010a, +0x00000b11,0x00050041,0x00000156,0x00000b7a, 0x000000fc,0x00000205,0x0004003d,0x00000007, -0x00000b61,0x00000b60,0x00050051,0x00000006, -0x0000148e,0x00000b61,0x00000000,0x00050095, -0x000000ab,0x00001490,0x0000148e,0x00000b5c, -0x00050051,0x00000006,0x00001491,0x00001490, -0x00000001,0x00050051,0x00000006,0x00001492, -0x00001490,0x00000000,0x00050051,0x00000006, -0x00001495,0x00000b61,0x00000001,0x00050080, -0x00000006,0x00001497,0x00001495,0x00001491, -0x00050050,0x00000007,0x00001498,0x00001492, -0x00001497,0x0004007c,0x00000014,0x00001488, -0x00001498,0x00060041,0x000000db,0x0000147f, -0x00001488,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00001480,0x0000147f,0x00000002, -0x00000004,0x00050041,0x00000156,0x00000b65, +0x00000b7b,0x00000b7a,0x00050051,0x00000006, +0x0000152c,0x00000b7b,0x00000000,0x00050095, +0x000000ab,0x0000152e,0x0000152c,0x0000010a, +0x00050051,0x00000006,0x0000152f,0x0000152e, +0x00000001,0x00050051,0x00000006,0x00001530, +0x0000152e,0x00000000,0x00050051,0x00000006, +0x00001533,0x00000b7b,0x00000001,0x00050080, +0x00000006,0x00001535,0x00001533,0x0000152f, +0x00050050,0x00000007,0x00001536,0x00001530, +0x00001535,0x0004007c,0x00000014,0x00001526, +0x00001536,0x00060041,0x000000db,0x0000151d, +0x00001526,0x000000da,0x000000da,0x0006003d, +0x00000006,0x0000151e,0x0000151d,0x00000002, +0x00000004,0x00050084,0x00000006,0x00000b7e, +0x0000151e,0x00000107,0x000500b0,0x0000002f, +0x00000b7f,0x00000b78,0x00000b7e,0x000300f7, +0x00000b81,0x00000000,0x000400fa,0x00000b7f, +0x00000b80,0x00000b81,0x000200f8,0x00000b80, +0x00050095,0x000000ab,0x0000154f,0x0000152c, +0x00000b78,0x00050051,0x00000006,0x00001550, +0x0000154f,0x00000001,0x00050051,0x00000006, +0x00001551,0x0000154f,0x00000000,0x00050080, +0x00000006,0x00001556,0x00001533,0x00001550, +0x00050050,0x00000007,0x00001557,0x00001551, +0x00001556,0x0004007c,0x00000014,0x00001547, +0x00001557,0x00060041,0x000000db,0x0000153e, +0x00001547,0x000000da,0x000000da,0x0006003d, +0x00000006,0x0000153f,0x0000153e,0x00000002, +0x00000004,0x00050041,0x00000156,0x00000b8c, 0x000000fc,0x000000da,0x0004003d,0x00000007, -0x00000b66,0x00000b65,0x00050051,0x00000006, -0x000014ae,0x00000b66,0x00000000,0x00050095, -0x000000ab,0x000014b0,0x000014ae,0x00000b5c, -0x00050051,0x00000006,0x000014b1,0x000014b0, -0x00000001,0x00050051,0x00000006,0x000014b2, -0x000014b0,0x00000000,0x00050051,0x00000006, -0x000014b5,0x00000b66,0x00000001,0x00050080, -0x00000006,0x000014b7,0x000014b5,0x000014b1, -0x00050050,0x00000007,0x000014b8,0x000014b2, -0x000014b7,0x0004007c,0x00000014,0x000014a8, -0x000014b8,0x00060041,0x000000db,0x000014a0, -0x000014a8,0x000000da,0x000000da,0x0005003e, -0x000014a0,0x00001480,0x00000002,0x00000004, -0x000200f9,0x00000b5a,0x000200f8,0x00000b6a, -0x000500aa,0x0000002f,0x00000b6d,0x00000b13, -0x000000a6,0x000300f7,0x00000b6f,0x00000000, -0x000400fa,0x00000b6d,0x00000b6e,0x00000b90, -0x000200f8,0x00000b6e,0x00050041,0x000000fe, -0x00000b70,0x000000fc,0x000009ef,0x0004003d, -0x00000006,0x00000b71,0x00000b70,0x00050084, -0x00000006,0x00000b73,0x0000010a,0x00000b11, -0x00050080,0x00000006,0x00000b74,0x00000b71, -0x00000b73,0x00050041,0x00000156,0x00000b76, -0x000000fc,0x000000da,0x0004003d,0x00000007, -0x00000b77,0x00000b76,0x00050051,0x00000006, -0x000014ce,0x00000b77,0x00000000,0x00050095, -0x000000ab,0x000014d0,0x000014ce,0x00000b74, -0x00050051,0x00000006,0x000014d1,0x000014d0, -0x00000001,0x00050051,0x00000006,0x000014d2, -0x000014d0,0x00000000,0x00050051,0x00000006, -0x000014d5,0x00000b77,0x00000001,0x00050080, -0x00000006,0x000014d7,0x000014d5,0x000014d1, -0x00050050,0x00000007,0x000014d8,0x000014d2, -0x000014d7,0x0004007c,0x00000014,0x000014c8, -0x000014d8,0x00060041,0x000000db,0x000014c0, -0x000014c8,0x000000da,0x000000da,0x0005003e, -0x000014c0,0x00000380,0x00000002,0x00000004, -0x000500b0,0x0000002f,0x00000b7c,0x00000b11, -0x000002b7,0x000300f7,0x00000b7e,0x00000000, -0x000400fa,0x00000b7c,0x00000b7d,0x00000b7e, -0x000200f8,0x00000b7d,0x00050041,0x00000156, -0x00000b82,0x000000fc,0x00000154,0x0004003d, -0x00000007,0x00000b83,0x00000b82,0x00050051, -0x00000006,0x000014ee,0x00000b83,0x00000000, -0x00050095,0x000000ab,0x000014f0,0x000014ee, -0x00000b73,0x00050051,0x00000006,0x000014f1, -0x000014f0,0x00000001,0x00050051,0x00000006, -0x000014f2,0x000014f0,0x00000000,0x00050051, -0x00000006,0x000014f5,0x00000b83,0x00000001, -0x00050080,0x00000006,0x000014f7,0x000014f5, -0x000014f1,0x00050050,0x00000007,0x000014f8, -0x000014f2,0x000014f7,0x0004007c,0x00000014, -0x000014e8,0x000014f8,0x00060041,0x000000db, -0x000014e0,0x000014e8,0x000000da,0x000000da, -0x0005003e,0x000014e0,0x00000380,0x00000002, -0x00000004,0x00050080,0x00000006,0x00000b89, -0x00000118,0x00000b73,0x00050095,0x000000ab, -0x00001510,0x000014ee,0x00000b89,0x00050051, -0x00000006,0x00001511,0x00001510,0x00000001, -0x00050051,0x00000006,0x00001512,0x00001510, -0x00000000,0x00050080,0x00000006,0x00001517, -0x000014f5,0x00001511,0x00050050,0x00000007, -0x00001518,0x00001512,0x00001517,0x0004007c, -0x00000014,0x00001508,0x00001518,0x00060041, -0x000000db,0x00001500,0x00001508,0x000000da, -0x000000da,0x0005003e,0x00001500,0x000000a6, -0x00000002,0x00000004,0x000200f9,0x00000b7e, -0x000200f8,0x00000b7e,0x000200f9,0x00000b6f, -0x000200f8,0x00000b90,0x000500aa,0x0000002f, -0x00000b93,0x00000b13,0x000000b0,0x000300f7, -0x00000b95,0x00000000,0x000400fa,0x00000b93, -0x00000b94,0x00000b99,0x000200f8,0x00000b94, -0x000200f9,0x00001548,0x000200f8,0x00001548, -0x000700f5,0x00000006,0x0000312e,0x000000a6, -0x00000b94,0x00001558,0x00001556,0x000500b0, -0x0000002f,0x0000154b,0x0000312e,0x000002b7, -0x000400f6,0x00001559,0x00001556,0x00000000, -0x000400fa,0x0000154b,0x0000154c,0x00001559, -0x000200f8,0x0000154c,0x00050084,0x00000006, -0x0000154f,0x000002b7,0x00000b11,0x00050080, -0x00000006,0x00001551,0x0000154f,0x0000312e, -0x000300f7,0x00001616,0x00000000,0x000300fb, -0x000000a6,0x000015f4,0x000200f8,0x000015f4, -0x00050041,0x000000fe,0x000015f5,0x000000fc, -0x0000027b,0x0004003d,0x00000006,0x000015f6, -0x000015f5,0x000500aa,0x0000002f,0x000015f7, -0x000015f6,0x000000a6,0x000300f7,0x000015fa, -0x00000000,0x000400fa,0x000015f7,0x000015f8, -0x000015fa,0x000200f8,0x000015f8,0x000200f9, -0x00001616,0x000200f8,0x000015fa,0x000500aa, -0x0000002f,0x000015fd,0x000015f6,0x00000170, -0x000300f7,0x00001604,0x00000000,0x000400fa, -0x000015fd,0x000015fe,0x00001604,0x000200f8, -0x000015fe,0x00050084,0x00000006,0x00001600, -0x0000010a,0x00001551,0x00050041,0x00000156, -0x00001601,0x000000fc,0x0000020d,0x0004003d, -0x00000007,0x00001602,0x00001601,0x00050051, -0x00000006,0x0000162e,0x00001602,0x00000000, -0x00050095,0x000000ab,0x00001630,0x0000162e, -0x00001600,0x00050051,0x00000006,0x00001631, -0x00001630,0x00000001,0x00050051,0x00000006, -0x00001632,0x00001630,0x00000000,0x00050051, -0x00000006,0x00001635,0x00001602,0x00000001, -0x00050080,0x00000006,0x00001637,0x00001635, -0x00001631,0x00050050,0x00000007,0x00001638, -0x00001632,0x00001637,0x0004007c,0x00000014, -0x00001628,0x00001638,0x00060041,0x000000db, -0x0000161f,0x00001628,0x000000da,0x000000da, -0x0006003d,0x00000006,0x00001620,0x0000161f, -0x00000002,0x00000004,0x000200f9,0x00001616, -0x000200f8,0x00001604,0x000500c2,0x00000006, -0x00001606,0x00001551,0x00000154,0x00050084, -0x00000006,0x00001607,0x0000010a,0x00001606, -0x00050041,0x00000156,0x00001608,0x000000fc, -0x0000020d,0x0004003d,0x00000007,0x00001609, -0x00001608,0x00050051,0x00000006,0x0000164f, -0x00001609,0x00000000,0x00050095,0x000000ab, -0x00001651,0x0000164f,0x00001607,0x00050051, -0x00000006,0x00001652,0x00001651,0x00000001, -0x00050051,0x00000006,0x00001653,0x00001651, -0x00000000,0x00050051,0x00000006,0x00001656, -0x00001609,0x00000001,0x00050080,0x00000006, -0x00001658,0x00001656,0x00001652,0x00050050, -0x00000007,0x00001659,0x00001653,0x00001658, -0x0004007c,0x00000014,0x00001649,0x00001659, -0x00060041,0x000000db,0x00001640,0x00001649, -0x000000da,0x000000da,0x0006003d,0x00000006, -0x00001641,0x00001640,0x00000002,0x00000004, -0x000500c7,0x00000006,0x0000160c,0x00001551, -0x000000b0,0x000500ab,0x0000002f,0x0000160d, -0x0000160c,0x000000a6,0x000300f7,0x00001614, -0x00000000,0x000400fa,0x0000160d,0x0000160e, -0x00001611,0x000200f8,0x0000160e,0x000500c2, -0x00000006,0x00001610,0x00001641,0x0000023e, -0x000200f9,0x00001614,0x000200f8,0x00001611, -0x000500c7,0x00000006,0x00001613,0x00001641, -0x000002a3,0x000200f9,0x00001614,0x000200f8, -0x00001614,0x000700f5,0x00000006,0x00003138, -0x00001610,0x0000160e,0x00001613,0x00001611, -0x000200f9,0x00001616,0x000200f8,0x00001616, -0x000900f5,0x00000006,0x00003139,0x00001551, -0x000015f8,0x00001620,0x000015fe,0x00003138, -0x00001614,0x00050041,0x000000fe,0x0000166a, -0x000000fc,0x00000250,0x0004003d,0x00000006, -0x0000166b,0x0000166a,0x00050084,0x00000006, -0x0000166c,0x00003139,0x0000166b,0x00050041, -0x00000156,0x0000166d,0x000000fc,0x00000205, -0x0004003d,0x00000007,0x0000166e,0x0000166d, -0x00050051,0x00000006,0x00001689,0x0000166e, -0x00000000,0x00050095,0x000000ab,0x0000168b, -0x00001689,0x0000166c,0x00050051,0x00000006, -0x0000168c,0x0000168b,0x00000001,0x00050051, -0x00000006,0x0000168d,0x0000168b,0x00000000, -0x00050051,0x00000006,0x00001690,0x0000166e, -0x00000001,0x00050080,0x00000006,0x00001692, -0x00001690,0x0000168c,0x00050095,0x000000ab, -0x000016ac,0x0000168d,0x000000a6,0x00050051, -0x00000006,0x000016ad,0x000016ac,0x00000001, -0x00050051,0x00000006,0x000016ae,0x000016ac, -0x00000000,0x00050080,0x00000006,0x000016b3, -0x00001692,0x000016ad,0x00050050,0x00000007, -0x000016b4,0x000016ae,0x000016b3,0x0004007c, -0x00000014,0x000016a4,0x000016b4,0x00060041, -0x000000db,0x0000169b,0x000016a4,0x000000da, -0x000000da,0x0006003d,0x00000006,0x0000169c, -0x0000169b,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00001672,0x0000169c,0x00050095, -0x000000ab,0x000016cd,0x0000168d,0x0000010a, -0x00050051,0x00000006,0x000016ce,0x000016cd, -0x00000001,0x00050051,0x00000006,0x000016cf, -0x000016cd,0x00000000,0x00050080,0x00000006, -0x000016d4,0x00001692,0x000016ce,0x00050050, -0x00000007,0x000016d5,0x000016cf,0x000016d4, -0x0004007c,0x00000014,0x000016c5,0x000016d5, -0x00060041,0x000000db,0x000016bc,0x000016c5, -0x000000da,0x000000da,0x0006003d,0x00000006, -0x000016bd,0x000016bc,0x00000002,0x00000004, -0x0004007c,0x00000027,0x00001675,0x000016bd, -0x00050041,0x000000fe,0x00001676,0x000000fc, -0x00000266,0x0004003d,0x00000006,0x00001677, -0x00001676,0x000500aa,0x0000002f,0x00001678, -0x00001677,0x000000b0,0x000300f7,0x0000167e, -0x00000000,0x000400fa,0x00001678,0x00001679, -0x0000167a,0x000200f8,0x00001679,0x000200f9, -0x0000167e,0x000200f8,0x0000167a,0x00050095, -0x000000ab,0x000016ee,0x0000168d,0x00000111, -0x00050051,0x00000006,0x000016ef,0x000016ee, -0x00000001,0x00050051,0x00000006,0x000016f0, -0x000016ee,0x00000000,0x00050080,0x00000006, -0x000016f5,0x00001692,0x000016ef,0x00050050, -0x00000007,0x000016f6,0x000016f0,0x000016f5, -0x0004007c,0x00000014,0x000016e6,0x000016f6, -0x00060041,0x000000db,0x000016dd,0x000016e6, -0x000000da,0x000000da,0x0006003d,0x00000006, -0x000016de,0x000016dd,0x00000002,0x00000004, -0x0004007c,0x00000027,0x0000167d,0x000016de, -0x000200f9,0x0000167e,0x000200f8,0x0000167e, -0x000700f5,0x00000027,0x0000313a,0x0000026d, -0x00001679,0x0000167d,0x0000167a,0x00060050, -0x0000004b,0x00001683,0x00001672,0x00001675, -0x0000313a,0x000300f7,0x0000173c,0x00000000, -0x000300fb,0x000000a6,0x00001708,0x000200f8, -0x00001708,0x00050041,0x00000156,0x00001709, -0x000000fc,0x00000215,0x0004003d,0x00000007, -0x0000170a,0x00001709,0x00050051,0x00000006, -0x00001741,0x0000170a,0x00000000,0x000500aa, -0x0000002f,0x00001742,0x00001741,0x000000a6, -0x000300f7,0x00001747,0x00000000,0x000400fa, -0x00001742,0x00001743,0x00001747,0x000200f8, -0x00001743,0x00050051,0x00000006,0x00001745, -0x0000170a,0x00000001,0x000500aa,0x0000002f, -0x00001746,0x00001745,0x000000a6,0x000200f9, -0x00001747,0x000200f8,0x00001747,0x000700f5, -0x0000002f,0x00001748,0x00001742,0x00001708, -0x00001746,0x00001743,0x000300f7,0x0000170e, -0x00000000,0x000400fa,0x00001748,0x0000170c, -0x0000170e,0x000200f8,0x0000170c,0x000200f9, -0x0000173c,0x000200f8,0x0000170e,0x000200f9, -0x0000170f,0x000200f8,0x0000170f,0x000700f5, -0x00000006,0x0000313b,0x000000a6,0x0000170e, -0x00001739,0x00001713,0x000500b0,0x0000002f, -0x00001712,0x0000313b,0x000002b7,0x000400f6, -0x0000173a,0x00001713,0x00000000,0x000400fa, -0x00001712,0x00001713,0x0000173a,0x000200f8, -0x00001713,0x00050084,0x00000006,0x00001715, -0x0000011f,0x0000313b,0x00050095,0x000000ab, -0x00001761,0x00001741,0x00001715,0x00050051, -0x00000006,0x00001762,0x00001761,0x00000001, -0x00050051,0x00000006,0x00001763,0x00001761, -0x00000000,0x00050051,0x00000006,0x00001766, -0x0000170a,0x00000001,0x00050080,0x00000006, -0x00001768,0x00001766,0x00001762,0x00050050, -0x00000007,0x00001769,0x00001763,0x00001768, -0x0004007c,0x00000014,0x00001759,0x00001769, -0x00060041,0x000000db,0x00001750,0x00001759, +0x00000b8d,0x00000b8c,0x00050051,0x00000006, +0x0000156d,0x00000b8d,0x00000000,0x00050095, +0x000000ab,0x0000156f,0x0000156d,0x00000b78, +0x00050051,0x00000006,0x00001570,0x0000156f, +0x00000001,0x00050051,0x00000006,0x00001571, +0x0000156f,0x00000000,0x00050051,0x00000006, +0x00001574,0x00000b8d,0x00000001,0x00050080, +0x00000006,0x00001576,0x00001574,0x00001570, +0x00050050,0x00000007,0x00001577,0x00001571, +0x00001576,0x0004007c,0x00000014,0x00001567, +0x00001577,0x00060041,0x000000db,0x0000155f, +0x00001567,0x000000da,0x000000da,0x0005003e, +0x0000155f,0x0000153f,0x00000002,0x00000004, +0x000200f9,0x00000b81,0x000200f8,0x00000b81, +0x000200f9,0x00000bf3,0x000200f8,0x00000b76, +0x000500aa,0x0000002f,0x00000b95,0x00000b13, +0x00000b94,0x000300f7,0x00000b97,0x00000000, +0x000400fa,0x00000b95,0x00000b96,0x00000ba7, +0x000200f8,0x00000b96,0x00050084,0x00000006, +0x00000b99,0x0000010a,0x00000b11,0x00050041, +0x00000156,0x00000b9d,0x000000fc,0x00000205, +0x0004003d,0x00000007,0x00000b9e,0x00000b9d, +0x00050051,0x00000006,0x0000158e,0x00000b9e, +0x00000000,0x00050095,0x000000ab,0x00001590, +0x0000158e,0x00000b99,0x00050051,0x00000006, +0x00001591,0x00001590,0x00000001,0x00050051, +0x00000006,0x00001592,0x00001590,0x00000000, +0x00050051,0x00000006,0x00001595,0x00000b9e, +0x00000001,0x00050080,0x00000006,0x00001597, +0x00001595,0x00001591,0x00050050,0x00000007, +0x00001598,0x00001592,0x00001597,0x0004007c, +0x00000014,0x00001588,0x00001598,0x00060041, +0x000000db,0x0000157f,0x00001588,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00001580, +0x0000157f,0x00000002,0x00000004,0x00050041, +0x00000156,0x00000ba2,0x000000fc,0x000000da, +0x0004003d,0x00000007,0x00000ba3,0x00000ba2, +0x00050051,0x00000006,0x000015ae,0x00000ba3, +0x00000000,0x00050095,0x000000ab,0x000015b0, +0x000015ae,0x00000b99,0x00050051,0x00000006, +0x000015b1,0x000015b0,0x00000001,0x00050051, +0x00000006,0x000015b2,0x000015b0,0x00000000, +0x00050051,0x00000006,0x000015b5,0x00000ba3, +0x00000001,0x00050080,0x00000006,0x000015b7, +0x000015b5,0x000015b1,0x00050050,0x00000007, +0x000015b8,0x000015b2,0x000015b7,0x0004007c, +0x00000014,0x000015a8,0x000015b8,0x00060041, +0x000000db,0x000015a0,0x000015a8,0x000000da, +0x000000da,0x0005003e,0x000015a0,0x00001580, +0x00000002,0x00000004,0x000200f9,0x00000b97, +0x000200f8,0x00000ba7,0x000500aa,0x0000002f, +0x00000baa,0x00000b13,0x000000a6,0x000300f7, +0x00000bac,0x00000000,0x000400fa,0x00000baa, +0x00000bab,0x00000bcd,0x000200f8,0x00000bab, +0x00050041,0x000000fe,0x00000bad,0x000000fc, +0x000009ef,0x0004003d,0x00000006,0x00000bae, +0x00000bad,0x00050084,0x00000006,0x00000bb0, +0x0000010a,0x00000b11,0x00050080,0x00000006, +0x00000bb1,0x00000bae,0x00000bb0,0x00050041, +0x00000156,0x00000bb3,0x000000fc,0x000000da, +0x0004003d,0x00000007,0x00000bb4,0x00000bb3, +0x00050051,0x00000006,0x000015ce,0x00000bb4, +0x00000000,0x00050095,0x000000ab,0x000015d0, +0x000015ce,0x00000bb1,0x00050051,0x00000006, +0x000015d1,0x000015d0,0x00000001,0x00050051, +0x00000006,0x000015d2,0x000015d0,0x00000000, +0x00050051,0x00000006,0x000015d5,0x00000bb4, +0x00000001,0x00050080,0x00000006,0x000015d7, +0x000015d5,0x000015d1,0x00050050,0x00000007, +0x000015d8,0x000015d2,0x000015d7,0x0004007c, +0x00000014,0x000015c8,0x000015d8,0x00060041, +0x000000db,0x000015c0,0x000015c8,0x000000da, +0x000000da,0x0005003e,0x000015c0,0x00000380, +0x00000002,0x00000004,0x000500b0,0x0000002f, +0x00000bb9,0x00000b11,0x000002b7,0x000300f7, +0x00000bbb,0x00000000,0x000400fa,0x00000bb9, +0x00000bba,0x00000bbb,0x000200f8,0x00000bba, +0x00050041,0x00000156,0x00000bbf,0x000000fc, +0x00000154,0x0004003d,0x00000007,0x00000bc0, +0x00000bbf,0x00050051,0x00000006,0x000015ee, +0x00000bc0,0x00000000,0x00050095,0x000000ab, +0x000015f0,0x000015ee,0x00000bb0,0x00050051, +0x00000006,0x000015f1,0x000015f0,0x00000001, +0x00050051,0x00000006,0x000015f2,0x000015f0, +0x00000000,0x00050051,0x00000006,0x000015f5, +0x00000bc0,0x00000001,0x00050080,0x00000006, +0x000015f7,0x000015f5,0x000015f1,0x00050050, +0x00000007,0x000015f8,0x000015f2,0x000015f7, +0x0004007c,0x00000014,0x000015e8,0x000015f8, +0x00060041,0x000000db,0x000015e0,0x000015e8, +0x000000da,0x000000da,0x0005003e,0x000015e0, +0x00000380,0x00000002,0x00000004,0x00050080, +0x00000006,0x00000bc6,0x00000118,0x00000bb0, +0x00050095,0x000000ab,0x00001610,0x000015ee, +0x00000bc6,0x00050051,0x00000006,0x00001611, +0x00001610,0x00000001,0x00050051,0x00000006, +0x00001612,0x00001610,0x00000000,0x00050080, +0x00000006,0x00001617,0x000015f5,0x00001611, +0x00050050,0x00000007,0x00001618,0x00001612, +0x00001617,0x0004007c,0x00000014,0x00001608, +0x00001618,0x00060041,0x000000db,0x00001600, +0x00001608,0x000000da,0x000000da,0x0005003e, +0x00001600,0x000000a6,0x00000002,0x00000004, +0x000200f9,0x00000bbb,0x000200f8,0x00000bbb, +0x000200f9,0x00000bac,0x000200f8,0x00000bcd, +0x000500aa,0x0000002f,0x00000bd0,0x00000b13, +0x000000b0,0x000300f7,0x00000bd2,0x00000000, +0x000400fa,0x00000bd0,0x00000bd1,0x00000bd6, +0x000200f8,0x00000bd1,0x000200f9,0x00001648, +0x000200f8,0x00001648,0x000700f5,0x00000006, +0x0000323a,0x000000a6,0x00000bd1,0x00001658, +0x00001656,0x000500b0,0x0000002f,0x0000164b, +0x0000323a,0x000002b7,0x000400f6,0x00001659, +0x00001656,0x00000000,0x000400fa,0x0000164b, +0x0000164c,0x00001659,0x000200f8,0x0000164c, +0x00050084,0x00000006,0x0000164f,0x000002b7, +0x00000b11,0x00050080,0x00000006,0x00001651, +0x0000164f,0x0000323a,0x000300f7,0x00001716, +0x00000000,0x000300fb,0x000000a6,0x000016f4, +0x000200f8,0x000016f4,0x00050041,0x000000fe, +0x000016f5,0x000000fc,0x0000027b,0x0004003d, +0x00000006,0x000016f6,0x000016f5,0x000500aa, +0x0000002f,0x000016f7,0x000016f6,0x000000a6, +0x000300f7,0x000016fa,0x00000000,0x000400fa, +0x000016f7,0x000016f8,0x000016fa,0x000200f8, +0x000016f8,0x000200f9,0x00001716,0x000200f8, +0x000016fa,0x000500aa,0x0000002f,0x000016fd, +0x000016f6,0x00000170,0x000300f7,0x00001704, +0x00000000,0x000400fa,0x000016fd,0x000016fe, +0x00001704,0x000200f8,0x000016fe,0x00050084, +0x00000006,0x00001700,0x0000010a,0x00001651, +0x00050041,0x00000156,0x00001701,0x000000fc, +0x0000020d,0x0004003d,0x00000007,0x00001702, +0x00001701,0x00050051,0x00000006,0x0000172e, +0x00001702,0x00000000,0x00050095,0x000000ab, +0x00001730,0x0000172e,0x00001700,0x00050051, +0x00000006,0x00001731,0x00001730,0x00000001, +0x00050051,0x00000006,0x00001732,0x00001730, +0x00000000,0x00050051,0x00000006,0x00001735, +0x00001702,0x00000001,0x00050080,0x00000006, +0x00001737,0x00001735,0x00001731,0x00050050, +0x00000007,0x00001738,0x00001732,0x00001737, +0x0004007c,0x00000014,0x00001728,0x00001738, +0x00060041,0x000000db,0x0000171f,0x00001728, 0x000000da,0x000000da,0x0006003d,0x00000006, -0x00001751,0x00001750,0x00000002,0x00000004, -0x0004007c,0x00000027,0x0000171a,0x00001751, -0x00050080,0x00000006,0x0000171c,0x00001715, -0x0000010a,0x00050095,0x000000ab,0x00001782, -0x00001741,0x0000171c,0x00050051,0x00000006, -0x00001783,0x00001782,0x00000001,0x00050051, -0x00000006,0x00001784,0x00001782,0x00000000, -0x00050080,0x00000006,0x00001789,0x00001766, -0x00001783,0x00050050,0x00000007,0x0000178a, -0x00001784,0x00001789,0x0004007c,0x00000014, -0x0000177a,0x0000178a,0x00060041,0x000000db, -0x00001771,0x0000177a,0x000000da,0x000000da, -0x0006003d,0x00000006,0x00001772,0x00001771, +0x00001720,0x0000171f,0x00000002,0x00000004, +0x000200f9,0x00001716,0x000200f8,0x00001704, +0x000500c2,0x00000006,0x00001706,0x00001651, +0x00000154,0x00050084,0x00000006,0x00001707, +0x0000010a,0x00001706,0x00050041,0x00000156, +0x00001708,0x000000fc,0x0000020d,0x0004003d, +0x00000007,0x00001709,0x00001708,0x00050051, +0x00000006,0x0000174f,0x00001709,0x00000000, +0x00050095,0x000000ab,0x00001751,0x0000174f, +0x00001707,0x00050051,0x00000006,0x00001752, +0x00001751,0x00000001,0x00050051,0x00000006, +0x00001753,0x00001751,0x00000000,0x00050051, +0x00000006,0x00001756,0x00001709,0x00000001, +0x00050080,0x00000006,0x00001758,0x00001756, +0x00001752,0x00050050,0x00000007,0x00001759, +0x00001753,0x00001758,0x0004007c,0x00000014, +0x00001749,0x00001759,0x00060041,0x000000db, +0x00001740,0x00001749,0x000000da,0x000000da, +0x0006003d,0x00000006,0x00001741,0x00001740, +0x00000002,0x00000004,0x000500c7,0x00000006, +0x0000170c,0x00001651,0x000000b0,0x000500ab, +0x0000002f,0x0000170d,0x0000170c,0x000000a6, +0x000300f7,0x00001714,0x00000000,0x000400fa, +0x0000170d,0x0000170e,0x00001711,0x000200f8, +0x0000170e,0x000500c2,0x00000006,0x00001710, +0x00001741,0x0000023e,0x000200f9,0x00001714, +0x000200f8,0x00001711,0x000500c7,0x00000006, +0x00001713,0x00001741,0x000002a3,0x000200f9, +0x00001714,0x000200f8,0x00001714,0x000700f5, +0x00000006,0x00003244,0x00001710,0x0000170e, +0x00001713,0x00001711,0x000200f9,0x00001716, +0x000200f8,0x00001716,0x000900f5,0x00000006, +0x00003245,0x00001651,0x000016f8,0x00001720, +0x000016fe,0x00003244,0x00001714,0x00050041, +0x000000fe,0x0000176a,0x000000fc,0x00000250, +0x0004003d,0x00000006,0x0000176b,0x0000176a, +0x00050084,0x00000006,0x0000176c,0x00003245, +0x0000176b,0x00050041,0x00000156,0x0000176d, +0x000000fc,0x00000205,0x0004003d,0x00000007, +0x0000176e,0x0000176d,0x00050051,0x00000006, +0x00001789,0x0000176e,0x00000000,0x00050095, +0x000000ab,0x0000178b,0x00001789,0x0000176c, +0x00050051,0x00000006,0x0000178c,0x0000178b, +0x00000001,0x00050051,0x00000006,0x0000178d, +0x0000178b,0x00000000,0x00050051,0x00000006, +0x00001790,0x0000176e,0x00000001,0x00050080, +0x00000006,0x00001792,0x00001790,0x0000178c, +0x00050095,0x000000ab,0x000017ac,0x0000178d, +0x000000a6,0x00050051,0x00000006,0x000017ad, +0x000017ac,0x00000001,0x00050051,0x00000006, +0x000017ae,0x000017ac,0x00000000,0x00050080, +0x00000006,0x000017b3,0x00001792,0x000017ad, +0x00050050,0x00000007,0x000017b4,0x000017ae, +0x000017b3,0x0004007c,0x00000014,0x000017a4, +0x000017b4,0x00060041,0x000000db,0x0000179b, +0x000017a4,0x000000da,0x000000da,0x0006003d, +0x00000006,0x0000179c,0x0000179b,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00001772, +0x0000179c,0x00050095,0x000000ab,0x000017cd, +0x0000178d,0x0000010a,0x00050051,0x00000006, +0x000017ce,0x000017cd,0x00000001,0x00050051, +0x00000006,0x000017cf,0x000017cd,0x00000000, +0x00050080,0x00000006,0x000017d4,0x00001792, +0x000017ce,0x00050050,0x00000007,0x000017d5, +0x000017cf,0x000017d4,0x0004007c,0x00000014, +0x000017c5,0x000017d5,0x00060041,0x000000db, +0x000017bc,0x000017c5,0x000000da,0x000000da, +0x0006003d,0x00000006,0x000017bd,0x000017bc, +0x00000002,0x00000004,0x0004007c,0x00000027, +0x00001775,0x000017bd,0x00050041,0x000000fe, +0x00001776,0x000000fc,0x00000266,0x0004003d, +0x00000006,0x00001777,0x00001776,0x000500aa, +0x0000002f,0x00001778,0x00001777,0x000000b0, +0x000300f7,0x0000177e,0x00000000,0x000400fa, +0x00001778,0x00001779,0x0000177a,0x000200f8, +0x00001779,0x000200f9,0x0000177e,0x000200f8, +0x0000177a,0x00050095,0x000000ab,0x000017ee, +0x0000178d,0x00000111,0x00050051,0x00000006, +0x000017ef,0x000017ee,0x00000001,0x00050051, +0x00000006,0x000017f0,0x000017ee,0x00000000, +0x00050080,0x00000006,0x000017f5,0x00001792, +0x000017ef,0x00050050,0x00000007,0x000017f6, +0x000017f0,0x000017f5,0x0004007c,0x00000014, +0x000017e6,0x000017f6,0x00060041,0x000000db, +0x000017dd,0x000017e6,0x000000da,0x000000da, +0x0006003d,0x00000006,0x000017de,0x000017dd, 0x00000002,0x00000004,0x0004007c,0x00000027, -0x00001720,0x00001772,0x00050080,0x00000006, -0x00001722,0x00001715,0x00000111,0x00050095, -0x000000ab,0x000017a3,0x00001741,0x00001722, -0x00050051,0x00000006,0x000017a4,0x000017a3, -0x00000001,0x00050051,0x00000006,0x000017a5, -0x000017a3,0x00000000,0x00050080,0x00000006, -0x000017aa,0x00001766,0x000017a4,0x00050050, -0x00000007,0x000017ab,0x000017a5,0x000017aa, -0x0004007c,0x00000014,0x0000179b,0x000017ab, -0x00060041,0x000000db,0x00001792,0x0000179b, +0x0000177d,0x000017de,0x000200f9,0x0000177e, +0x000200f8,0x0000177e,0x000700f5,0x00000027, +0x00003246,0x0000026d,0x00001779,0x0000177d, +0x0000177a,0x00060050,0x0000004b,0x00001783, +0x00001772,0x00001775,0x00003246,0x000300f7, +0x0000183c,0x00000000,0x000300fb,0x000000a6, +0x00001808,0x000200f8,0x00001808,0x00050041, +0x00000156,0x00001809,0x000000fc,0x00000215, +0x0004003d,0x00000007,0x0000180a,0x00001809, +0x00050051,0x00000006,0x00001841,0x0000180a, +0x00000000,0x000500aa,0x0000002f,0x00001842, +0x00001841,0x000000a6,0x000300f7,0x00001847, +0x00000000,0x000400fa,0x00001842,0x00001843, +0x00001847,0x000200f8,0x00001843,0x00050051, +0x00000006,0x00001845,0x0000180a,0x00000001, +0x000500aa,0x0000002f,0x00001846,0x00001845, +0x000000a6,0x000200f9,0x00001847,0x000200f8, +0x00001847,0x000700f5,0x0000002f,0x00001848, +0x00001842,0x00001808,0x00001846,0x00001843, +0x000300f7,0x0000180e,0x00000000,0x000400fa, +0x00001848,0x0000180c,0x0000180e,0x000200f8, +0x0000180c,0x000200f9,0x0000183c,0x000200f8, +0x0000180e,0x000200f9,0x0000180f,0x000200f8, +0x0000180f,0x000700f5,0x00000006,0x00003247, +0x000000a6,0x0000180e,0x00001839,0x00001813, +0x000500b0,0x0000002f,0x00001812,0x00003247, +0x000002b7,0x000400f6,0x0000183a,0x00001813, +0x00000000,0x000400fa,0x00001812,0x00001813, +0x0000183a,0x000200f8,0x00001813,0x00050084, +0x00000006,0x00001815,0x0000011f,0x00003247, +0x00050095,0x000000ab,0x00001861,0x00001841, +0x00001815,0x00050051,0x00000006,0x00001862, +0x00001861,0x00000001,0x00050051,0x00000006, +0x00001863,0x00001861,0x00000000,0x00050051, +0x00000006,0x00001866,0x0000180a,0x00000001, +0x00050080,0x00000006,0x00001868,0x00001866, +0x00001862,0x00050050,0x00000007,0x00001869, +0x00001863,0x00001868,0x0004007c,0x00000014, +0x00001859,0x00001869,0x00060041,0x000000db, +0x00001850,0x00001859,0x000000da,0x000000da, +0x0006003d,0x00000006,0x00001851,0x00001850, +0x00000002,0x00000004,0x0004007c,0x00000027, +0x0000181a,0x00001851,0x00050080,0x00000006, +0x0000181c,0x00001815,0x0000010a,0x00050095, +0x000000ab,0x00001882,0x00001841,0x0000181c, +0x00050051,0x00000006,0x00001883,0x00001882, +0x00000001,0x00050051,0x00000006,0x00001884, +0x00001882,0x00000000,0x00050080,0x00000006, +0x00001889,0x00001866,0x00001883,0x00050050, +0x00000007,0x0000188a,0x00001884,0x00001889, +0x0004007c,0x00000014,0x0000187a,0x0000188a, +0x00060041,0x000000db,0x00001871,0x0000187a, 0x000000da,0x000000da,0x0006003d,0x00000006, -0x00001793,0x00001792,0x00000002,0x00000004, -0x0004007c,0x00000027,0x00001726,0x00001793, -0x00050080,0x00000006,0x00001728,0x00001715, -0x00000118,0x00050095,0x000000ab,0x000017c4, -0x00001741,0x00001728,0x00050051,0x00000006, -0x000017c5,0x000017c4,0x00000001,0x00050051, -0x00000006,0x000017c6,0x000017c4,0x00000000, -0x00050080,0x00000006,0x000017cb,0x00001766, -0x000017c5,0x00050050,0x00000007,0x000017cc, -0x000017c6,0x000017cb,0x0004007c,0x00000014, -0x000017bc,0x000017cc,0x00060041,0x000000db, -0x000017b3,0x000017bc,0x000000da,0x000000da, -0x0006003d,0x00000006,0x000017b4,0x000017b3, +0x00001872,0x00001871,0x00000002,0x00000004, +0x0004007c,0x00000027,0x00001820,0x00001872, +0x00050080,0x00000006,0x00001822,0x00001815, +0x00000111,0x00050095,0x000000ab,0x000018a3, +0x00001841,0x00001822,0x00050051,0x00000006, +0x000018a4,0x000018a3,0x00000001,0x00050051, +0x00000006,0x000018a5,0x000018a3,0x00000000, +0x00050080,0x00000006,0x000018aa,0x00001866, +0x000018a4,0x00050050,0x00000007,0x000018ab, +0x000018a5,0x000018aa,0x0004007c,0x00000014, +0x0000189b,0x000018ab,0x00060041,0x000000db, +0x00001892,0x0000189b,0x000000da,0x000000da, +0x0006003d,0x00000006,0x00001893,0x00001892, 0x00000002,0x00000004,0x0004007c,0x00000027, -0x0000172c,0x000017b4,0x00070050,0x000002bc, -0x0000172d,0x0000171a,0x00001720,0x00001726, -0x0000172c,0x0008004f,0x0000004b,0x00001730, -0x0000172d,0x0000172d,0x00000000,0x00000001, -0x00000002,0x00050094,0x00000027,0x00001732, -0x00001730,0x00001683,0x00050081,0x00000027, -0x00001735,0x00001732,0x0000172c,0x00050041, -0x00000028,0x00001736,0x00001705,0x0000313b, -0x0003003e,0x00001736,0x00001735,0x00050080, -0x00000006,0x00001739,0x0000313b,0x00000154, -0x000200f9,0x0000170f,0x000200f8,0x0000173a, -0x0004003d,0x0000004b,0x0000173b,0x00001705, -0x000200f9,0x0000173c,0x000200f8,0x0000173c, -0x000700f5,0x0000004b,0x0000313c,0x00001683, -0x0000170c,0x0000173b,0x0000173a,0x00050041, -0x0000004c,0x00001555,0x0000151a,0x0000312e, -0x0003003e,0x00001555,0x0000313c,0x000200f9, -0x00001556,0x000200f8,0x00001556,0x00050080, -0x00000006,0x00001558,0x0000312e,0x00000154, -0x000200f9,0x00001548,0x000200f8,0x00001559, -0x00050041,0x000000fe,0x0000155a,0x000000fc, -0x00000308,0x0004003d,0x00000006,0x0000155b, -0x0000155a,0x00050080,0x00000006,0x0000155d, -0x0000155b,0x00000b11,0x00050041,0x000000fe, -0x0000155e,0x000000fc,0x0000022c,0x0004003d, -0x00000006,0x0000155f,0x0000155e,0x00050084, -0x00000006,0x00001561,0x00000107,0x0000155d, -0x00050080,0x00000006,0x00001562,0x0000155f, -0x00001561,0x000200f9,0x00001563,0x000200f8, -0x00001563,0x000700f5,0x00000006,0x0000312f, -0x000000a6,0x00001559,0x0000158a,0x00001567, -0x000500b0,0x0000002f,0x00001566,0x0000312f, -0x000002b7,0x000400f6,0x0000158b,0x00001567, -0x00000000,0x000400fa,0x00001566,0x00001567, -0x0000158b,0x000200f8,0x00001567,0x00050084, -0x00000006,0x0000156a,0x00000118,0x0000312f, -0x00050080,0x00000006,0x0000156b,0x00001562, -0x0000156a,0x00050041,0x00000156,0x0000156d, -0x000000fc,0x000000da,0x0004003d,0x00000007, -0x0000156e,0x0000156d,0x00060041,0x00000028, -0x0000156f,0x0000151a,0x0000312f,0x000000a6, -0x0004003d,0x00000027,0x00001570,0x0000156f, -0x0004007c,0x00000006,0x000017d2,0x00001570, -0x00050051,0x00000006,0x000017eb,0x0000156e, -0x00000000,0x00050095,0x000000ab,0x000017ed, -0x000017eb,0x0000156b,0x00050051,0x00000006, -0x000017ee,0x000017ed,0x00000001,0x00050051, -0x00000006,0x000017ef,0x000017ed,0x00000000, -0x00050051,0x00000006,0x000017f2,0x0000156e, -0x00000001,0x00050080,0x00000006,0x000017f4, -0x000017f2,0x000017ee,0x00050050,0x00000007, -0x000017f5,0x000017ef,0x000017f4,0x0004007c, -0x00000014,0x000017e5,0x000017f5,0x00060041, -0x000000db,0x000017dd,0x000017e5,0x000000da, -0x000000da,0x0005003e,0x000017dd,0x000017d2, -0x00000002,0x00000004,0x00050080,0x00000006, -0x00001576,0x0000156b,0x0000010a,0x00060041, -0x00000028,0x0000157a,0x0000151a,0x0000312f, -0x000000b0,0x0004003d,0x00000027,0x0000157b, -0x0000157a,0x0004007c,0x00000006,0x000017fb, -0x0000157b,0x00050095,0x000000ab,0x00001816, -0x000017eb,0x00001576,0x00050051,0x00000006, -0x00001817,0x00001816,0x00000001,0x00050051, -0x00000006,0x00001818,0x00001816,0x00000000, -0x00050080,0x00000006,0x0000181d,0x000017f2, -0x00001817,0x00050050,0x00000007,0x0000181e, -0x00001818,0x0000181d,0x0004007c,0x00000014, -0x0000180e,0x0000181e,0x00060041,0x000000db, -0x00001806,0x0000180e,0x000000da,0x000000da, -0x0005003e,0x00001806,0x000017fb,0x00000002, -0x00000004,0x00050080,0x00000006,0x00001581, -0x0000156b,0x00000111,0x00060041,0x00000028, -0x00001585,0x0000151a,0x0000312f,0x00000170, -0x0004003d,0x00000027,0x00001586,0x00001585, -0x0004007c,0x00000006,0x00001824,0x00001586, -0x00050095,0x000000ab,0x0000183f,0x000017eb, -0x00001581,0x00050051,0x00000006,0x00001840, -0x0000183f,0x00000001,0x00050051,0x00000006, -0x00001841,0x0000183f,0x00000000,0x00050080, -0x00000006,0x00001846,0x000017f2,0x00001840, -0x00050050,0x00000007,0x00001847,0x00001841, -0x00001846,0x0004007c,0x00000014,0x00001837, -0x00001847,0x00060041,0x000000db,0x0000182f, -0x00001837,0x000000da,0x000000da,0x0005003e, -0x0000182f,0x00001824,0x00000002,0x00000004, -0x00050080,0x00000006,0x0000158a,0x0000312f, -0x00000154,0x000200f9,0x00001563,0x000200f8, -0x0000158b,0x00050080,0x00000006,0x0000158d, -0x00001562,0x00000347,0x00050041,0x00000156, -0x0000158e,0x000000fc,0x000000da,0x0004003d, -0x00000007,0x0000158f,0x0000158e,0x00060041, -0x00000028,0x00001590,0x0000151a,0x00000205, -0x000000a6,0x0004003d,0x00000027,0x00001591, -0x00001590,0x0004007c,0x00000006,0x0000184d, -0x00001591,0x00050051,0x00000006,0x00001866, -0x0000158f,0x00000000,0x00050095,0x000000ab, -0x00001868,0x00001866,0x0000158d,0x00050051, -0x00000006,0x00001869,0x00001868,0x00000001, -0x00050051,0x00000006,0x0000186a,0x00001868, -0x00000000,0x00050051,0x00000006,0x0000186d, -0x0000158f,0x00000001,0x00050080,0x00000006, -0x0000186f,0x0000186d,0x00001869,0x00050050, -0x00000007,0x00001870,0x0000186a,0x0000186f, -0x0004007c,0x00000014,0x00001860,0x00001870, -0x00060041,0x000000db,0x00001858,0x00001860, -0x000000da,0x000000da,0x0005003e,0x00001858, -0x0000184d,0x00000002,0x00000004,0x00050080, -0x00000006,0x00001594,0x00001562,0x00000352, -0x00060041,0x00000028,0x00001597,0x0000151a, -0x00000205,0x000000b0,0x0004003d,0x00000027, -0x00001598,0x00001597,0x0004007c,0x00000006, -0x00001876,0x00001598,0x00050095,0x000000ab, -0x00001891,0x00001866,0x00001594,0x00050051, -0x00000006,0x00001892,0x00001891,0x00000001, -0x00050051,0x00000006,0x00001893,0x00001891, -0x00000000,0x00050080,0x00000006,0x00001898, -0x0000186d,0x00001892,0x00050050,0x00000007, -0x00001899,0x00001893,0x00001898,0x0004007c, -0x00000014,0x00001889,0x00001899,0x00060041, -0x000000db,0x00001881,0x00001889,0x000000da, -0x000000da,0x0005003e,0x00001881,0x00001876, +0x00001826,0x00001893,0x00050080,0x00000006, +0x00001828,0x00001815,0x00000118,0x00050095, +0x000000ab,0x000018c4,0x00001841,0x00001828, +0x00050051,0x00000006,0x000018c5,0x000018c4, +0x00000001,0x00050051,0x00000006,0x000018c6, +0x000018c4,0x00000000,0x00050080,0x00000006, +0x000018cb,0x00001866,0x000018c5,0x00050050, +0x00000007,0x000018cc,0x000018c6,0x000018cb, +0x0004007c,0x00000014,0x000018bc,0x000018cc, +0x00060041,0x000000db,0x000018b3,0x000018bc, +0x000000da,0x000000da,0x0006003d,0x00000006, +0x000018b4,0x000018b3,0x00000002,0x00000004, +0x0004007c,0x00000027,0x0000182c,0x000018b4, +0x00070050,0x000002bc,0x0000182d,0x0000181a, +0x00001820,0x00001826,0x0000182c,0x0008004f, +0x0000004b,0x00001830,0x0000182d,0x0000182d, +0x00000000,0x00000001,0x00000002,0x00050094, +0x00000027,0x00001832,0x00001830,0x00001783, +0x00050081,0x00000027,0x00001835,0x00001832, +0x0000182c,0x00050041,0x00000028,0x00001836, +0x00001805,0x00003247,0x0003003e,0x00001836, +0x00001835,0x00050080,0x00000006,0x00001839, +0x00003247,0x00000154,0x000200f9,0x0000180f, +0x000200f8,0x0000183a,0x0004003d,0x0000004b, +0x0000183b,0x00001805,0x000200f9,0x0000183c, +0x000200f8,0x0000183c,0x000700f5,0x0000004b, +0x00003248,0x00001783,0x0000180c,0x0000183b, +0x0000183a,0x00050041,0x0000004c,0x00001655, +0x0000161a,0x0000323a,0x0003003e,0x00001655, +0x00003248,0x000200f9,0x00001656,0x000200f8, +0x00001656,0x00050080,0x00000006,0x00001658, +0x0000323a,0x00000154,0x000200f9,0x00001648, +0x000200f8,0x00001659,0x00050041,0x000000fe, +0x0000165a,0x000000fc,0x00000308,0x0004003d, +0x00000006,0x0000165b,0x0000165a,0x00050080, +0x00000006,0x0000165d,0x0000165b,0x00000b11, +0x00050041,0x000000fe,0x0000165e,0x000000fc, +0x0000022c,0x0004003d,0x00000006,0x0000165f, +0x0000165e,0x00050084,0x00000006,0x00001661, +0x00000107,0x0000165d,0x00050080,0x00000006, +0x00001662,0x0000165f,0x00001661,0x000200f9, +0x00001663,0x000200f8,0x00001663,0x000700f5, +0x00000006,0x0000323b,0x000000a6,0x00001659, +0x0000168a,0x00001667,0x000500b0,0x0000002f, +0x00001666,0x0000323b,0x000002b7,0x000400f6, +0x0000168b,0x00001667,0x00000000,0x000400fa, +0x00001666,0x00001667,0x0000168b,0x000200f8, +0x00001667,0x00050084,0x00000006,0x0000166a, +0x00000118,0x0000323b,0x00050080,0x00000006, +0x0000166b,0x00001662,0x0000166a,0x00050041, +0x00000156,0x0000166d,0x000000fc,0x000000da, +0x0004003d,0x00000007,0x0000166e,0x0000166d, +0x00060041,0x00000028,0x0000166f,0x0000161a, +0x0000323b,0x000000a6,0x0004003d,0x00000027, +0x00001670,0x0000166f,0x0004007c,0x00000006, +0x000018d2,0x00001670,0x00050051,0x00000006, +0x000018eb,0x0000166e,0x00000000,0x00050095, +0x000000ab,0x000018ed,0x000018eb,0x0000166b, +0x00050051,0x00000006,0x000018ee,0x000018ed, +0x00000001,0x00050051,0x00000006,0x000018ef, +0x000018ed,0x00000000,0x00050051,0x00000006, +0x000018f2,0x0000166e,0x00000001,0x00050080, +0x00000006,0x000018f4,0x000018f2,0x000018ee, +0x00050050,0x00000007,0x000018f5,0x000018ef, +0x000018f4,0x0004007c,0x00000014,0x000018e5, +0x000018f5,0x00060041,0x000000db,0x000018dd, +0x000018e5,0x000000da,0x000000da,0x0005003e, +0x000018dd,0x000018d2,0x00000002,0x00000004, +0x00050080,0x00000006,0x00001676,0x0000166b, +0x0000010a,0x00060041,0x00000028,0x0000167a, +0x0000161a,0x0000323b,0x000000b0,0x0004003d, +0x00000027,0x0000167b,0x0000167a,0x0004007c, +0x00000006,0x000018fb,0x0000167b,0x00050095, +0x000000ab,0x00001916,0x000018eb,0x00001676, +0x00050051,0x00000006,0x00001917,0x00001916, +0x00000001,0x00050051,0x00000006,0x00001918, +0x00001916,0x00000000,0x00050080,0x00000006, +0x0000191d,0x000018f2,0x00001917,0x00050050, +0x00000007,0x0000191e,0x00001918,0x0000191d, +0x0004007c,0x00000014,0x0000190e,0x0000191e, +0x00060041,0x000000db,0x00001906,0x0000190e, +0x000000da,0x000000da,0x0005003e,0x00001906, +0x000018fb,0x00000002,0x00000004,0x00050080, +0x00000006,0x00001681,0x0000166b,0x00000111, +0x00060041,0x00000028,0x00001685,0x0000161a, +0x0000323b,0x00000170,0x0004003d,0x00000027, +0x00001686,0x00001685,0x0004007c,0x00000006, +0x00001924,0x00001686,0x00050095,0x000000ab, +0x0000193f,0x000018eb,0x00001681,0x00050051, +0x00000006,0x00001940,0x0000193f,0x00000001, +0x00050051,0x00000006,0x00001941,0x0000193f, +0x00000000,0x00050080,0x00000006,0x00001946, +0x000018f2,0x00001940,0x00050050,0x00000007, +0x00001947,0x00001941,0x00001946,0x0004007c, +0x00000014,0x00001937,0x00001947,0x00060041, +0x000000db,0x0000192f,0x00001937,0x000000da, +0x000000da,0x0005003e,0x0000192f,0x00001924, 0x00000002,0x00000004,0x00050080,0x00000006, -0x0000159b,0x00001562,0x0000035d,0x00060041, -0x00000028,0x0000159e,0x0000151a,0x00000205, -0x00000170,0x0004003d,0x00000027,0x0000159f, -0x0000159e,0x0004007c,0x00000006,0x0000189f, -0x0000159f,0x00050095,0x000000ab,0x000018ba, -0x00001866,0x0000159b,0x00050051,0x00000006, -0x000018bb,0x000018ba,0x00000001,0x00050051, -0x00000006,0x000018bc,0x000018ba,0x00000000, -0x00050080,0x00000006,0x000018c1,0x0000186d, -0x000018bb,0x00050050,0x00000007,0x000018c2, -0x000018bc,0x000018c1,0x0004007c,0x00000014, -0x000018b2,0x000018c2,0x00060041,0x000000db, -0x000018aa,0x000018b2,0x000000da,0x000000da, -0x0005003e,0x000018aa,0x0000189f,0x00000002, -0x00000004,0x00050080,0x00000006,0x000015a2, -0x00001562,0x00000368,0x00050041,0x000000fe, -0x000015a5,0x000000fc,0x0000036a,0x0004003d, -0x00000006,0x000015a6,0x000015a5,0x00050095, -0x000000ab,0x000018da,0x00001866,0x000015a2, -0x00050051,0x00000006,0x000018db,0x000018da, -0x00000001,0x00050051,0x00000006,0x000018dc, -0x000018da,0x00000000,0x00050080,0x00000006, -0x000018e1,0x0000186d,0x000018db,0x00050050, -0x00000007,0x000018e2,0x000018dc,0x000018e1, -0x0004007c,0x00000014,0x000018d2,0x000018e2, -0x00060041,0x000000db,0x000018ca,0x000018d2, -0x000000da,0x000000da,0x0005003e,0x000018ca, -0x000015a6,0x00000002,0x00000004,0x00050080, -0x00000006,0x000015a9,0x00001562,0x00000374, -0x00050095,0x000000ab,0x000018fa,0x00001866, -0x000015a9,0x00050051,0x00000006,0x000018fb, -0x000018fa,0x00000001,0x00050051,0x00000006, -0x000018fc,0x000018fa,0x00000000,0x00050080, -0x00000006,0x00001901,0x0000186d,0x000018fb, -0x00050050,0x00000007,0x00001902,0x000018fc, -0x00001901,0x0004007c,0x00000014,0x000018f2, -0x00001902,0x00060041,0x000000db,0x000018ea, -0x000018f2,0x000000da,0x000000da,0x0005003e, -0x000018ea,0x00000b11,0x00000002,0x00000004, -0x00050080,0x00000006,0x000015af,0x00001562, -0x0000037e,0x00050095,0x000000ab,0x0000191a, -0x00001866,0x000015af,0x00050051,0x00000006, -0x0000191b,0x0000191a,0x00000001,0x00050051, -0x00000006,0x0000191c,0x0000191a,0x00000000, -0x00050080,0x00000006,0x00001921,0x0000186d, -0x0000191b,0x00050050,0x00000007,0x00001922, -0x0000191c,0x00001921,0x0004007c,0x00000014, -0x00001912,0x00001922,0x00060041,0x000000db, -0x0000190a,0x00001912,0x000000da,0x000000da, -0x0005003e,0x0000190a,0x00000380,0x00000002, -0x00000004,0x00050080,0x00000006,0x000015b4, -0x00001562,0x00000388,0x00050095,0x000000ab, -0x0000193a,0x00001866,0x000015b4,0x00050051, -0x00000006,0x0000193b,0x0000193a,0x00000001, -0x00050051,0x00000006,0x0000193c,0x0000193a, -0x00000000,0x00050080,0x00000006,0x00001941, -0x0000186d,0x0000193b,0x00050050,0x00000007, -0x00001942,0x0000193c,0x00001941,0x0004007c, -0x00000014,0x00001932,0x00001942,0x00060041, -0x000000db,0x0000192a,0x00001932,0x000000da, -0x000000da,0x0005003e,0x0000192a,0x0000038a, -0x00000002,0x00000004,0x00050041,0x0000004c, -0x000015b8,0x0000151a,0x000000da,0x0004003d, -0x0000004b,0x000015b9,0x000015b8,0x0004009c, -0x00000395,0x000015ba,0x000015b9,0x0004009a, -0x0000002f,0x000015bb,0x000015ba,0x000400a8, -0x0000002f,0x000015bc,0x000015bb,0x000300f7, -0x000015c2,0x00000000,0x000400fa,0x000015bc, -0x000015bd,0x000015c2,0x000200f8,0x000015bd, -0x00050041,0x0000004c,0x000015be,0x0000151a, -0x00000154,0x0004003d,0x0000004b,0x000015bf, -0x000015be,0x0004009c,0x00000395,0x000015c0, -0x000015bf,0x0004009a,0x0000002f,0x000015c1, -0x000015c0,0x000200f9,0x000015c2,0x000200f8, -0x000015c2,0x000700f5,0x0000002f,0x000015c3, -0x000015bb,0x0000158b,0x000015c1,0x000015bd, -0x000400a8,0x0000002f,0x000015c4,0x000015c3, -0x000300f7,0x000015ca,0x00000000,0x000400fa, -0x000015c4,0x000015c5,0x000015ca,0x000200f8, -0x000015c5,0x00050041,0x0000004c,0x000015c6, -0x0000151a,0x00000205,0x0004003d,0x0000004b, -0x000015c7,0x000015c6,0x0004009c,0x00000395, -0x000015c8,0x000015c7,0x0004009a,0x0000002f, -0x000015c9,0x000015c8,0x000200f9,0x000015ca, -0x000200f8,0x000015ca,0x000700f5,0x0000002f, -0x000015cb,0x000015c3,0x000015c2,0x000015c9, -0x000015c5,0x0004003d,0x0000004b,0x000015cd, -0x000015b8,0x00050041,0x0000004c,0x000015ce, -0x0000151a,0x00000154,0x0004003d,0x0000004b, -0x000015cf,0x000015ce,0x0007000c,0x0000004b, -0x000015d0,0x00000001,0x00000025,0x000015cd, -0x000015cf,0x00050041,0x0000004c,0x000015d1, -0x0000151a,0x00000205,0x0004003d,0x0000004b, -0x000015d2,0x000015d1,0x0007000c,0x0000004b, -0x000015d3,0x00000001,0x00000025,0x000015d0, -0x000015d2,0x0004003d,0x0000004b,0x000015d5, -0x000015b8,0x0004003d,0x0000004b,0x000015d7, -0x000015ce,0x0007000c,0x0000004b,0x000015d8, -0x00000001,0x00000028,0x000015d5,0x000015d7, -0x0004003d,0x0000004b,0x000015da,0x000015d1, -0x0007000c,0x0000004b,0x000015db,0x00000001, -0x00000028,0x000015d8,0x000015da,0x00060050, -0x00000395,0x0000319d,0x000015cb,0x000015cb, -0x000015cb,0x000600a9,0x0000004b,0x0000319e, -0x0000319d,0x0000319b,0x000015db,0x000600a9, -0x0000004b,0x000031a0,0x0000319d,0x00003199, -0x000015d3,0x00050041,0x000000fe,0x0000198c, -0x000000fc,0x000000fd,0x0004003d,0x00000006, -0x0000198d,0x0000198c,0x00050084,0x00000006, -0x0000198e,0x0000011f,0x0000198d,0x00050080, -0x00000006,0x0000198f,0x00000107,0x0000198e, -0x00050080,0x00000006,0x00001995,0x0000198d, -0x0000319c,0x00050086,0x00000006,0x00001996, -0x00001995,0x00000101,0x00050084,0x00000006, -0x00001988,0x00000107,0x00001996,0x00050080, -0x00000006,0x00001989,0x0000198f,0x00001988, -0x00050084,0x00000006,0x00001959,0x00000150, -0x0000155d,0x00050080,0x00000006,0x0000195a, -0x00001989,0x00001959,0x00050041,0x00000156, -0x0000195b,0x000000fc,0x00000154,0x0004003d, -0x00000007,0x0000195c,0x0000195b,0x00050051, -0x00000027,0x0000195f,0x000031a0,0x00000000, -0x0004007c,0x00000006,0x0000199c,0x0000195f, -0x00050051,0x00000006,0x000019b5,0x0000195c, -0x00000000,0x00050095,0x000000ab,0x000019b7, -0x000019b5,0x0000195a,0x00050051,0x00000006, -0x000019b8,0x000019b7,0x00000001,0x00050051, -0x00000006,0x000019b9,0x000019b7,0x00000000, -0x00050051,0x00000006,0x000019bc,0x0000195c, -0x00000001,0x00050080,0x00000006,0x000019be, -0x000019bc,0x000019b8,0x00050050,0x00000007, -0x000019bf,0x000019b9,0x000019be,0x0004007c, -0x00000014,0x000019af,0x000019bf,0x00060041, -0x000000db,0x000019a7,0x000019af,0x000000da, -0x000000da,0x0005003e,0x000019a7,0x0000199c, +0x0000168a,0x0000323b,0x00000154,0x000200f9, +0x00001663,0x000200f8,0x0000168b,0x00050080, +0x00000006,0x0000168d,0x00001662,0x00000347, +0x00050041,0x00000156,0x0000168e,0x000000fc, +0x000000da,0x0004003d,0x00000007,0x0000168f, +0x0000168e,0x00060041,0x00000028,0x00001690, +0x0000161a,0x00000205,0x000000a6,0x0004003d, +0x00000027,0x00001691,0x00001690,0x0004007c, +0x00000006,0x0000194d,0x00001691,0x00050051, +0x00000006,0x00001966,0x0000168f,0x00000000, +0x00050095,0x000000ab,0x00001968,0x00001966, +0x0000168d,0x00050051,0x00000006,0x00001969, +0x00001968,0x00000001,0x00050051,0x00000006, +0x0000196a,0x00001968,0x00000000,0x00050051, +0x00000006,0x0000196d,0x0000168f,0x00000001, +0x00050080,0x00000006,0x0000196f,0x0000196d, +0x00001969,0x00050050,0x00000007,0x00001970, +0x0000196a,0x0000196f,0x0004007c,0x00000014, +0x00001960,0x00001970,0x00060041,0x000000db, +0x00001958,0x00001960,0x000000da,0x000000da, +0x0005003e,0x00001958,0x0000194d,0x00000002, +0x00000004,0x00050080,0x00000006,0x00001694, +0x00001662,0x00000352,0x00060041,0x00000028, +0x00001697,0x0000161a,0x00000205,0x000000b0, +0x0004003d,0x00000027,0x00001698,0x00001697, +0x0004007c,0x00000006,0x00001976,0x00001698, +0x00050095,0x000000ab,0x00001991,0x00001966, +0x00001694,0x00050051,0x00000006,0x00001992, +0x00001991,0x00000001,0x00050051,0x00000006, +0x00001993,0x00001991,0x00000000,0x00050080, +0x00000006,0x00001998,0x0000196d,0x00001992, +0x00050050,0x00000007,0x00001999,0x00001993, +0x00001998,0x0004007c,0x00000014,0x00001989, +0x00001999,0x00060041,0x000000db,0x00001981, +0x00001989,0x000000da,0x000000da,0x0005003e, +0x00001981,0x00001976,0x00000002,0x00000004, +0x00050080,0x00000006,0x0000169b,0x00001662, +0x0000035d,0x00060041,0x00000028,0x0000169e, +0x0000161a,0x00000205,0x00000170,0x0004003d, +0x00000027,0x0000169f,0x0000169e,0x0004007c, +0x00000006,0x0000199f,0x0000169f,0x00050095, +0x000000ab,0x000019ba,0x00001966,0x0000169b, +0x00050051,0x00000006,0x000019bb,0x000019ba, +0x00000001,0x00050051,0x00000006,0x000019bc, +0x000019ba,0x00000000,0x00050080,0x00000006, +0x000019c1,0x0000196d,0x000019bb,0x00050050, +0x00000007,0x000019c2,0x000019bc,0x000019c1, +0x0004007c,0x00000014,0x000019b2,0x000019c2, +0x00060041,0x000000db,0x000019aa,0x000019b2, +0x000000da,0x000000da,0x0005003e,0x000019aa, +0x0000199f,0x00000002,0x00000004,0x00050080, +0x00000006,0x000016a2,0x00001662,0x00000368, +0x00050041,0x000000fe,0x000016a5,0x000000fc, +0x0000036a,0x0004003d,0x00000006,0x000016a6, +0x000016a5,0x00050095,0x000000ab,0x000019da, +0x00001966,0x000016a2,0x00050051,0x00000006, +0x000019db,0x000019da,0x00000001,0x00050051, +0x00000006,0x000019dc,0x000019da,0x00000000, +0x00050080,0x00000006,0x000019e1,0x0000196d, +0x000019db,0x00050050,0x00000007,0x000019e2, +0x000019dc,0x000019e1,0x0004007c,0x00000014, +0x000019d2,0x000019e2,0x00060041,0x000000db, +0x000019ca,0x000019d2,0x000000da,0x000000da, +0x0005003e,0x000019ca,0x000016a6,0x00000002, +0x00000004,0x00050080,0x00000006,0x000016a9, +0x00001662,0x00000374,0x00050095,0x000000ab, +0x000019fa,0x00001966,0x000016a9,0x00050051, +0x00000006,0x000019fb,0x000019fa,0x00000001, +0x00050051,0x00000006,0x000019fc,0x000019fa, +0x00000000,0x00050080,0x00000006,0x00001a01, +0x0000196d,0x000019fb,0x00050050,0x00000007, +0x00001a02,0x000019fc,0x00001a01,0x0004007c, +0x00000014,0x000019f2,0x00001a02,0x00060041, +0x000000db,0x000019ea,0x000019f2,0x000000da, +0x000000da,0x0005003e,0x000019ea,0x00000b11, 0x00000002,0x00000004,0x00050080,0x00000006, -0x00001962,0x0000195a,0x0000010a,0x00050051, -0x00000027,0x00001966,0x000031a0,0x00000001, -0x0004007c,0x00000006,0x000019c5,0x00001966, -0x00050095,0x000000ab,0x000019e0,0x000019b5, -0x00001962,0x00050051,0x00000006,0x000019e1, -0x000019e0,0x00000001,0x00050051,0x00000006, -0x000019e2,0x000019e0,0x00000000,0x00050080, -0x00000006,0x000019e7,0x000019bc,0x000019e1, -0x00050050,0x00000007,0x000019e8,0x000019e2, -0x000019e7,0x0004007c,0x00000014,0x000019d8, -0x000019e8,0x00060041,0x000000db,0x000019d0, -0x000019d8,0x000000da,0x000000da,0x0005003e, -0x000019d0,0x000019c5,0x00000002,0x00000004, -0x00050080,0x00000006,0x00001969,0x0000195a, -0x00000111,0x00050051,0x00000027,0x0000196d, -0x000031a0,0x00000002,0x0004007c,0x00000006, -0x000019ee,0x0000196d,0x00050095,0x000000ab, -0x00001a09,0x000019b5,0x00001969,0x00050051, -0x00000006,0x00001a0a,0x00001a09,0x00000001, -0x00050051,0x00000006,0x00001a0b,0x00001a09, -0x00000000,0x00050080,0x00000006,0x00001a10, -0x000019bc,0x00001a0a,0x00050050,0x00000007, -0x00001a11,0x00001a0b,0x00001a10,0x0004007c, -0x00000014,0x00001a01,0x00001a11,0x00060041, -0x000000db,0x000019f9,0x00001a01,0x000000da, -0x000000da,0x0005003e,0x000019f9,0x000019ee, +0x000016af,0x00001662,0x0000037e,0x00050095, +0x000000ab,0x00001a1a,0x00001966,0x000016af, +0x00050051,0x00000006,0x00001a1b,0x00001a1a, +0x00000001,0x00050051,0x00000006,0x00001a1c, +0x00001a1a,0x00000000,0x00050080,0x00000006, +0x00001a21,0x0000196d,0x00001a1b,0x00050050, +0x00000007,0x00001a22,0x00001a1c,0x00001a21, +0x0004007c,0x00000014,0x00001a12,0x00001a22, +0x00060041,0x000000db,0x00001a0a,0x00001a12, +0x000000da,0x000000da,0x0005003e,0x00001a0a, +0x00000380,0x00000002,0x00000004,0x00050080, +0x00000006,0x000016b4,0x00001662,0x00000388, +0x00050095,0x000000ab,0x00001a3a,0x00001966, +0x000016b4,0x00050051,0x00000006,0x00001a3b, +0x00001a3a,0x00000001,0x00050051,0x00000006, +0x00001a3c,0x00001a3a,0x00000000,0x00050080, +0x00000006,0x00001a41,0x0000196d,0x00001a3b, +0x00050050,0x00000007,0x00001a42,0x00001a3c, +0x00001a41,0x0004007c,0x00000014,0x00001a32, +0x00001a42,0x00060041,0x000000db,0x00001a2a, +0x00001a32,0x000000da,0x000000da,0x0005003e, +0x00001a2a,0x0000038a,0x00000002,0x00000004, +0x00050041,0x0000004c,0x000016b8,0x0000161a, +0x000000da,0x0004003d,0x0000004b,0x000016b9, +0x000016b8,0x0004009c,0x00000395,0x000016ba, +0x000016b9,0x0004009a,0x0000002f,0x000016bb, +0x000016ba,0x000400a8,0x0000002f,0x000016bc, +0x000016bb,0x000300f7,0x000016c2,0x00000000, +0x000400fa,0x000016bc,0x000016bd,0x000016c2, +0x000200f8,0x000016bd,0x00050041,0x0000004c, +0x000016be,0x0000161a,0x00000154,0x0004003d, +0x0000004b,0x000016bf,0x000016be,0x0004009c, +0x00000395,0x000016c0,0x000016bf,0x0004009a, +0x0000002f,0x000016c1,0x000016c0,0x000200f9, +0x000016c2,0x000200f8,0x000016c2,0x000700f5, +0x0000002f,0x000016c3,0x000016bb,0x0000168b, +0x000016c1,0x000016bd,0x000400a8,0x0000002f, +0x000016c4,0x000016c3,0x000300f7,0x000016ca, +0x00000000,0x000400fa,0x000016c4,0x000016c5, +0x000016ca,0x000200f8,0x000016c5,0x00050041, +0x0000004c,0x000016c6,0x0000161a,0x00000205, +0x0004003d,0x0000004b,0x000016c7,0x000016c6, +0x0004009c,0x00000395,0x000016c8,0x000016c7, +0x0004009a,0x0000002f,0x000016c9,0x000016c8, +0x000200f9,0x000016ca,0x000200f8,0x000016ca, +0x000700f5,0x0000002f,0x000016cb,0x000016c3, +0x000016c2,0x000016c9,0x000016c5,0x0004003d, +0x0000004b,0x000016cd,0x000016b8,0x00050041, +0x0000004c,0x000016ce,0x0000161a,0x00000154, +0x0004003d,0x0000004b,0x000016cf,0x000016ce, +0x0007000c,0x0000004b,0x000016d0,0x00000001, +0x00000025,0x000016cd,0x000016cf,0x00050041, +0x0000004c,0x000016d1,0x0000161a,0x00000205, +0x0004003d,0x0000004b,0x000016d2,0x000016d1, +0x0007000c,0x0000004b,0x000016d3,0x00000001, +0x00000025,0x000016d0,0x000016d2,0x0004003d, +0x0000004b,0x000016d5,0x000016b8,0x0004003d, +0x0000004b,0x000016d7,0x000016ce,0x0007000c, +0x0000004b,0x000016d8,0x00000001,0x00000028, +0x000016d5,0x000016d7,0x0004003d,0x0000004b, +0x000016da,0x000016d1,0x0007000c,0x0000004b, +0x000016db,0x00000001,0x00000028,0x000016d8, +0x000016da,0x00060050,0x00000395,0x000032a9, +0x000016cb,0x000016cb,0x000016cb,0x000600a9, +0x0000004b,0x000032aa,0x000032a9,0x000032a7, +0x000016db,0x000600a9,0x0000004b,0x000032ac, +0x000032a9,0x000032a5,0x000016d3,0x00050041, +0x000000fe,0x00001a8c,0x000000fc,0x000000fd, +0x0004003d,0x00000006,0x00001a8d,0x00001a8c, +0x00050084,0x00000006,0x00001a8e,0x0000011f, +0x00001a8d,0x00050080,0x00000006,0x00001a8f, +0x00000107,0x00001a8e,0x00050080,0x00000006, +0x00001a95,0x00001a8d,0x000032a8,0x00050086, +0x00000006,0x00001a96,0x00001a95,0x00000101, +0x00050084,0x00000006,0x00001a88,0x00000107, +0x00001a96,0x00050080,0x00000006,0x00001a89, +0x00001a8f,0x00001a88,0x00050084,0x00000006, +0x00001a59,0x00000150,0x0000165d,0x00050080, +0x00000006,0x00001a5a,0x00001a89,0x00001a59, +0x00050041,0x00000156,0x00001a5b,0x000000fc, +0x00000154,0x0004003d,0x00000007,0x00001a5c, +0x00001a5b,0x00050051,0x00000027,0x00001a5f, +0x000032ac,0x00000000,0x0004007c,0x00000006, +0x00001a9c,0x00001a5f,0x00050051,0x00000006, +0x00001ab5,0x00001a5c,0x00000000,0x00050095, +0x000000ab,0x00001ab7,0x00001ab5,0x00001a5a, +0x00050051,0x00000006,0x00001ab8,0x00001ab7, +0x00000001,0x00050051,0x00000006,0x00001ab9, +0x00001ab7,0x00000000,0x00050051,0x00000006, +0x00001abc,0x00001a5c,0x00000001,0x00050080, +0x00000006,0x00001abe,0x00001abc,0x00001ab8, +0x00050050,0x00000007,0x00001abf,0x00001ab9, +0x00001abe,0x0004007c,0x00000014,0x00001aaf, +0x00001abf,0x00060041,0x000000db,0x00001aa7, +0x00001aaf,0x000000da,0x000000da,0x0005003e, +0x00001aa7,0x00001a9c,0x00000002,0x00000004, +0x00050080,0x00000006,0x00001a62,0x00001a5a, +0x0000010a,0x00050051,0x00000027,0x00001a66, +0x000032ac,0x00000001,0x0004007c,0x00000006, +0x00001ac5,0x00001a66,0x00050095,0x000000ab, +0x00001ae0,0x00001ab5,0x00001a62,0x00050051, +0x00000006,0x00001ae1,0x00001ae0,0x00000001, +0x00050051,0x00000006,0x00001ae2,0x00001ae0, +0x00000000,0x00050080,0x00000006,0x00001ae7, +0x00001abc,0x00001ae1,0x00050050,0x00000007, +0x00001ae8,0x00001ae2,0x00001ae7,0x0004007c, +0x00000014,0x00001ad8,0x00001ae8,0x00060041, +0x000000db,0x00001ad0,0x00001ad8,0x000000da, +0x000000da,0x0005003e,0x00001ad0,0x00001ac5, 0x00000002,0x00000004,0x00050080,0x00000006, -0x00001970,0x0000195a,0x00000118,0x00050051, -0x00000027,0x00001974,0x0000319e,0x00000000, -0x0004007c,0x00000006,0x00001a17,0x00001974, -0x00050095,0x000000ab,0x00001a32,0x000019b5, -0x00001970,0x00050051,0x00000006,0x00001a33, -0x00001a32,0x00000001,0x00050051,0x00000006, -0x00001a34,0x00001a32,0x00000000,0x00050080, -0x00000006,0x00001a39,0x000019bc,0x00001a33, -0x00050050,0x00000007,0x00001a3a,0x00001a34, -0x00001a39,0x0004007c,0x00000014,0x00001a2a, -0x00001a3a,0x00060041,0x000000db,0x00001a22, -0x00001a2a,0x000000da,0x000000da,0x0005003e, -0x00001a22,0x00001a17,0x00000002,0x00000004, -0x00050080,0x00000006,0x00001977,0x0000195a, -0x0000011f,0x00050051,0x00000027,0x0000197b, -0x0000319e,0x00000001,0x0004007c,0x00000006, -0x00001a40,0x0000197b,0x00050095,0x000000ab, -0x00001a5b,0x000019b5,0x00001977,0x00050051, -0x00000006,0x00001a5c,0x00001a5b,0x00000001, -0x00050051,0x00000006,0x00001a5d,0x00001a5b, -0x00000000,0x00050080,0x00000006,0x00001a62, -0x000019bc,0x00001a5c,0x00050050,0x00000007, -0x00001a63,0x00001a5d,0x00001a62,0x0004007c, -0x00000014,0x00001a53,0x00001a63,0x00060041, -0x000000db,0x00001a4b,0x00001a53,0x000000da, -0x000000da,0x0005003e,0x00001a4b,0x00001a40, +0x00001a69,0x00001a5a,0x00000111,0x00050051, +0x00000027,0x00001a6d,0x000032ac,0x00000002, +0x0004007c,0x00000006,0x00001aee,0x00001a6d, +0x00050095,0x000000ab,0x00001b09,0x00001ab5, +0x00001a69,0x00050051,0x00000006,0x00001b0a, +0x00001b09,0x00000001,0x00050051,0x00000006, +0x00001b0b,0x00001b09,0x00000000,0x00050080, +0x00000006,0x00001b10,0x00001abc,0x00001b0a, +0x00050050,0x00000007,0x00001b11,0x00001b0b, +0x00001b10,0x0004007c,0x00000014,0x00001b01, +0x00001b11,0x00060041,0x000000db,0x00001af9, +0x00001b01,0x000000da,0x000000da,0x0005003e, +0x00001af9,0x00001aee,0x00000002,0x00000004, +0x00050080,0x00000006,0x00001a70,0x00001a5a, +0x00000118,0x00050051,0x00000027,0x00001a74, +0x000032aa,0x00000000,0x0004007c,0x00000006, +0x00001b17,0x00001a74,0x00050095,0x000000ab, +0x00001b32,0x00001ab5,0x00001a70,0x00050051, +0x00000006,0x00001b33,0x00001b32,0x00000001, +0x00050051,0x00000006,0x00001b34,0x00001b32, +0x00000000,0x00050080,0x00000006,0x00001b39, +0x00001abc,0x00001b33,0x00050050,0x00000007, +0x00001b3a,0x00001b34,0x00001b39,0x0004007c, +0x00000014,0x00001b2a,0x00001b3a,0x00060041, +0x000000db,0x00001b22,0x00001b2a,0x000000da, +0x000000da,0x0005003e,0x00001b22,0x00001b17, 0x00000002,0x00000004,0x00050080,0x00000006, -0x0000197e,0x0000195a,0x00000189,0x00050051, -0x00000027,0x00001982,0x0000319e,0x00000002, -0x0004007c,0x00000006,0x00001a69,0x00001982, -0x00050095,0x000000ab,0x00001a84,0x000019b5, -0x0000197e,0x00050051,0x00000006,0x00001a85, -0x00001a84,0x00000001,0x00050051,0x00000006, -0x00001a86,0x00001a84,0x00000000,0x00050080, -0x00000006,0x00001a8b,0x000019bc,0x00001a85, -0x00050050,0x00000007,0x00001a8c,0x00001a86, -0x00001a8b,0x0004007c,0x00000014,0x00001a7c, -0x00001a8c,0x00060041,0x000000db,0x00001a74, -0x00001a7c,0x000000da,0x000000da,0x0005003e, -0x00001a74,0x00001a69,0x00000002,0x00000004, -0x000300f7,0x00001acc,0x00000000,0x000300fb, -0x000000a6,0x00001a9b,0x000200f8,0x00001a9b, -0x000500bc,0x0000002f,0x00001ad3,0x0000195f, -0x00001974,0x000300f7,0x00001ada,0x00000000, -0x000400fa,0x00001ad3,0x00001ad4,0x00001ada, -0x000200f8,0x00001ad4,0x000500bc,0x0000002f, -0x00001ad9,0x00001966,0x0000197b,0x000200f9, -0x00001ada,0x000200f8,0x00001ada,0x000700f5, -0x0000002f,0x00001adb,0x00001ad3,0x00001a9b, -0x00001ad9,0x00001ad4,0x000300f7,0x00001ae2, -0x00000000,0x000400fa,0x00001adb,0x00001adc, -0x00001ae2,0x000200f8,0x00001adc,0x000500bc, -0x0000002f,0x00001ae1,0x0000196d,0x00001982, -0x000200f9,0x00001ae2,0x000200f8,0x00001ae2, -0x000700f5,0x0000002f,0x00001ae3,0x00001adb, -0x00001ada,0x00001ae1,0x00001adc,0x000400a8, -0x0000002f,0x00001ae4,0x00001ae3,0x000300f7, -0x00001aa0,0x00000000,0x000400fa,0x00001ae4, -0x00001a9f,0x00001aa0,0x000200f8,0x00001a9f, -0x000200f9,0x00001acc,0x000200f8,0x00001aa0, -0x00050081,0x0000004b,0x00001aa3,0x000031a0, -0x0000319e,0x0005008e,0x0000004b,0x00001aa4, -0x00001aa3,0x000001ed,0x00050095,0x000000ab, -0x00001af4,0x000019b5,0x000000a6,0x00050051, -0x00000006,0x00001af5,0x00001af4,0x00000001, -0x00050051,0x00000006,0x00001af6,0x00001af4, -0x00000000,0x00050080,0x00000006,0x00001afb, -0x000019bc,0x00001af5,0x00050050,0x00000007, -0x00001afc,0x00001af6,0x00001afb,0x0004007c, -0x00000014,0x00001aec,0x00001afc,0x00060041, -0x000000db,0x00001aa9,0x00001aec,0x000000da, -0x000000da,0x00050051,0x00000027,0x00001aab, -0x00001aa4,0x00000000,0x0004007c,0x00000006, -0x00001b02,0x00001aab,0x000500c7,0x00000006, -0x00001b04,0x00001b02,0x00000130,0x000500ab, -0x0000002f,0x00001b05,0x00001b04,0x000000a6, -0x000300f7,0x00001b0c,0x00000000,0x000400fa, -0x00001b05,0x00001b06,0x00001b09,0x000200f8, -0x00001b06,0x000400c8,0x00000006,0x00001b08, -0x00001b02,0x000200f9,0x00001b0c,0x000200f8, -0x00001b09,0x000500c5,0x00000006,0x00001b0b, -0x00001b02,0x00000130,0x000200f9,0x00001b0c, -0x000200f8,0x00001b0c,0x000700f5,0x00000006, -0x00003132,0x00001b08,0x00001b06,0x00001b0b, -0x00001b09,0x000700ed,0x00000006,0x00001aad, -0x00001aa9,0x000000b0,0x000000a6,0x00003132, -0x00060041,0x000000db,0x00001aaf,0x00001aec, -0x000000da,0x00000154,0x00050051,0x00000027, -0x00001ab1,0x00001aa4,0x00000001,0x0004007c, -0x00000006,0x00001b13,0x00001ab1,0x000500c7, -0x00000006,0x00001b15,0x00001b13,0x00000130, -0x000500ab,0x0000002f,0x00001b16,0x00001b15, -0x000000a6,0x000300f7,0x00001b1d,0x00000000, -0x000400fa,0x00001b16,0x00001b17,0x00001b1a, -0x000200f8,0x00001b17,0x000400c8,0x00000006, -0x00001b19,0x00001b13,0x000200f9,0x00001b1d, -0x000200f8,0x00001b1a,0x000500c5,0x00000006, -0x00001b1c,0x00001b13,0x00000130,0x000200f9, -0x00001b1d,0x000200f8,0x00001b1d,0x000700f5, -0x00000006,0x00003133,0x00001b19,0x00001b17, -0x00001b1c,0x00001b1a,0x000700ed,0x00000006, -0x00001ab3,0x00001aaf,0x000000b0,0x000000a6, -0x00003133,0x00060041,0x000000db,0x00001ab5, -0x00001aec,0x000000da,0x00000205,0x00050051, -0x00000027,0x00001ab7,0x00001aa4,0x00000002, -0x0004007c,0x00000006,0x00001b24,0x00001ab7, -0x000500c7,0x00000006,0x00001b26,0x00001b24, -0x00000130,0x000500ab,0x0000002f,0x00001b27, -0x00001b26,0x000000a6,0x000300f7,0x00001b2e, -0x00000000,0x000400fa,0x00001b27,0x00001b28, -0x00001b2b,0x000200f8,0x00001b28,0x000400c8, -0x00000006,0x00001b2a,0x00001b24,0x000200f9, -0x00001b2e,0x000200f8,0x00001b2b,0x000500c5, -0x00000006,0x00001b2d,0x00001b24,0x00000130, -0x000200f9,0x00001b2e,0x000200f8,0x00001b2e, -0x000700f5,0x00000006,0x00003134,0x00001b2a, -0x00001b28,0x00001b2d,0x00001b2b,0x000700ed, -0x00000006,0x00001ab9,0x00001ab5,0x000000b0, -0x000000a6,0x00003134,0x00060041,0x000000db, -0x00001abb,0x00001aec,0x000000da,0x0000020d, -0x000300f7,0x00001b3f,0x00000000,0x000400fa, -0x00001b05,0x00001b39,0x00001b3c,0x000200f8, -0x00001b39,0x000400c8,0x00000006,0x00001b3b, -0x00001b02,0x000200f9,0x00001b3f,0x000200f8, -0x00001b3c,0x000500c5,0x00000006,0x00001b3e, -0x00001b02,0x00000130,0x000200f9,0x00001b3f, -0x000200f8,0x00001b3f,0x000700f5,0x00000006, -0x00003135,0x00001b3b,0x00001b39,0x00001b3e, -0x00001b3c,0x000700ef,0x00000006,0x00001abf, -0x00001abb,0x000000b0,0x000000a6,0x00003135, -0x00060041,0x000000db,0x00001ac1,0x00001aec, -0x000000da,0x00000215,0x000300f7,0x00001b50, -0x00000000,0x000400fa,0x00001b16,0x00001b4a, -0x00001b4d,0x000200f8,0x00001b4a,0x000400c8, -0x00000006,0x00001b4c,0x00001b13,0x000200f9, -0x00001b50,0x000200f8,0x00001b4d,0x000500c5, -0x00000006,0x00001b4f,0x00001b13,0x00000130, -0x000200f9,0x00001b50,0x000200f8,0x00001b50, -0x000700f5,0x00000006,0x00003136,0x00001b4c, -0x00001b4a,0x00001b4f,0x00001b4d,0x000700ef, -0x00000006,0x00001ac5,0x00001ac1,0x000000b0, -0x000000a6,0x00003136,0x00060041,0x000000db, -0x00001ac7,0x00001aec,0x000000da,0x0000021d, -0x000300f7,0x00001b61,0x00000000,0x000400fa, -0x00001b27,0x00001b5b,0x00001b5e,0x000200f8, -0x00001b5b,0x000400c8,0x00000006,0x00001b5d, -0x00001b24,0x000200f9,0x00001b61,0x000200f8, -0x00001b5e,0x000500c5,0x00000006,0x00001b60, -0x00001b24,0x00000130,0x000200f9,0x00001b61, -0x000200f8,0x00001b61,0x000700f5,0x00000006, -0x00003137,0x00001b5d,0x00001b5b,0x00001b60, -0x00001b5e,0x000700ef,0x00000006,0x00001acb, -0x00001ac7,0x000000b0,0x000000a6,0x00003137, -0x000200f9,0x00001acc,0x000200f8,0x00001acc, -0x000200f9,0x00000b95,0x000200f8,0x00000b99, -0x000500aa,0x0000002f,0x00000b9c,0x00000b13, -0x00000170,0x000300f7,0x00000b9e,0x00000000, -0x000400fa,0x00000b9c,0x00000b9d,0x00000ba2, -0x000200f8,0x00000b9d,0x00050084,0x00000006, -0x00001bca,0x00000107,0x00000b11,0x000200f9, -0x00001bcb,0x000200f8,0x00001bcb,0x000700f5, -0x00000006,0x000030e4,0x000000a6,0x00000b9d, -0x00001bdc,0x00001bcf,0x000500b0,0x0000002f, -0x00001bce,0x000030e4,0x00000118,0x000400f6, -0x00001bdd,0x00001bcf,0x00000000,0x000400fa, -0x00001bce,0x00001bcf,0x00001bdd,0x000200f8, -0x00001bcf,0x00050084,0x00000006,0x00001bd3, -0x0000010a,0x000030e4,0x00050080,0x00000006, -0x00001bd4,0x00001bca,0x00001bd3,0x00050041, -0x00000156,0x00001bd5,0x000000fc,0x00000205, -0x0004003d,0x00000007,0x00001bd6,0x00001bd5, -0x00050051,0x00000006,0x00001d97,0x00001bd6, -0x00000000,0x00050095,0x000000ab,0x00001d99, -0x00001d97,0x00001bd4,0x00050051,0x00000006, -0x00001d9a,0x00001d99,0x00000001,0x00050051, -0x00000006,0x00001d9b,0x00001d99,0x00000000, -0x00050051,0x00000006,0x00001d9e,0x00001bd6, -0x00000001,0x00050080,0x00000006,0x00001da0, -0x00001d9e,0x00001d9a,0x00050050,0x00000007, -0x00001da1,0x00001d9b,0x00001da0,0x0004007c, -0x00000014,0x00001d91,0x00001da1,0x00060041, -0x000000db,0x00001d88,0x00001d91,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00001d89, -0x00001d88,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00001bd8,0x00001d89,0x00050041, -0x00000028,0x00001bd9,0x00001b65,0x000030e4, -0x0003003e,0x00001bd9,0x00001bd8,0x00050080, -0x00000006,0x00001bdc,0x000030e4,0x00000154, -0x000200f9,0x00001bcb,0x000200f8,0x00001bdd, -0x00050080,0x00000006,0x00001bdf,0x00001bca, -0x00000368,0x00050041,0x00000156,0x00001be0, +0x00001a77,0x00001a5a,0x0000011f,0x00050051, +0x00000027,0x00001a7b,0x000032aa,0x00000001, +0x0004007c,0x00000006,0x00001b40,0x00001a7b, +0x00050095,0x000000ab,0x00001b5b,0x00001ab5, +0x00001a77,0x00050051,0x00000006,0x00001b5c, +0x00001b5b,0x00000001,0x00050051,0x00000006, +0x00001b5d,0x00001b5b,0x00000000,0x00050080, +0x00000006,0x00001b62,0x00001abc,0x00001b5c, +0x00050050,0x00000007,0x00001b63,0x00001b5d, +0x00001b62,0x0004007c,0x00000014,0x00001b53, +0x00001b63,0x00060041,0x000000db,0x00001b4b, +0x00001b53,0x000000da,0x000000da,0x0005003e, +0x00001b4b,0x00001b40,0x00000002,0x00000004, +0x00050080,0x00000006,0x00001a7e,0x00001a5a, +0x00000189,0x00050051,0x00000027,0x00001a82, +0x000032aa,0x00000002,0x0004007c,0x00000006, +0x00001b69,0x00001a82,0x00050095,0x000000ab, +0x00001b84,0x00001ab5,0x00001a7e,0x00050051, +0x00000006,0x00001b85,0x00001b84,0x00000001, +0x00050051,0x00000006,0x00001b86,0x00001b84, +0x00000000,0x00050080,0x00000006,0x00001b8b, +0x00001abc,0x00001b85,0x00050050,0x00000007, +0x00001b8c,0x00001b86,0x00001b8b,0x0004007c, +0x00000014,0x00001b7c,0x00001b8c,0x00060041, +0x000000db,0x00001b74,0x00001b7c,0x000000da, +0x000000da,0x0005003e,0x00001b74,0x00001b69, +0x00000002,0x00000004,0x000300f7,0x00001bcc, +0x00000000,0x000300fb,0x000000a6,0x00001b9b, +0x000200f8,0x00001b9b,0x000500bc,0x0000002f, +0x00001bd3,0x00001a5f,0x00001a74,0x000300f7, +0x00001bda,0x00000000,0x000400fa,0x00001bd3, +0x00001bd4,0x00001bda,0x000200f8,0x00001bd4, +0x000500bc,0x0000002f,0x00001bd9,0x00001a66, +0x00001a7b,0x000200f9,0x00001bda,0x000200f8, +0x00001bda,0x000700f5,0x0000002f,0x00001bdb, +0x00001bd3,0x00001b9b,0x00001bd9,0x00001bd4, +0x000300f7,0x00001be2,0x00000000,0x000400fa, +0x00001bdb,0x00001bdc,0x00001be2,0x000200f8, +0x00001bdc,0x000500bc,0x0000002f,0x00001be1, +0x00001a6d,0x00001a82,0x000200f9,0x00001be2, +0x000200f8,0x00001be2,0x000700f5,0x0000002f, +0x00001be3,0x00001bdb,0x00001bda,0x00001be1, +0x00001bdc,0x000400a8,0x0000002f,0x00001be4, +0x00001be3,0x000300f7,0x00001ba0,0x00000000, +0x000400fa,0x00001be4,0x00001b9f,0x00001ba0, +0x000200f8,0x00001b9f,0x000200f9,0x00001bcc, +0x000200f8,0x00001ba0,0x00050081,0x0000004b, +0x00001ba3,0x000032ac,0x000032aa,0x0005008e, +0x0000004b,0x00001ba4,0x00001ba3,0x000001ed, +0x00050095,0x000000ab,0x00001bf4,0x00001ab5, +0x000000a6,0x00050051,0x00000006,0x00001bf5, +0x00001bf4,0x00000001,0x00050051,0x00000006, +0x00001bf6,0x00001bf4,0x00000000,0x00050080, +0x00000006,0x00001bfb,0x00001abc,0x00001bf5, +0x00050050,0x00000007,0x00001bfc,0x00001bf6, +0x00001bfb,0x0004007c,0x00000014,0x00001bec, +0x00001bfc,0x00060041,0x000000db,0x00001ba9, +0x00001bec,0x000000da,0x000000da,0x00050051, +0x00000027,0x00001bab,0x00001ba4,0x00000000, +0x0004007c,0x00000006,0x00001c02,0x00001bab, +0x000500c7,0x00000006,0x00001c04,0x00001c02, +0x00000130,0x000500ab,0x0000002f,0x00001c05, +0x00001c04,0x000000a6,0x000300f7,0x00001c0c, +0x00000000,0x000400fa,0x00001c05,0x00001c06, +0x00001c09,0x000200f8,0x00001c06,0x000400c8, +0x00000006,0x00001c08,0x00001c02,0x000200f9, +0x00001c0c,0x000200f8,0x00001c09,0x000500c5, +0x00000006,0x00001c0b,0x00001c02,0x00000130, +0x000200f9,0x00001c0c,0x000200f8,0x00001c0c, +0x000700f5,0x00000006,0x0000323e,0x00001c08, +0x00001c06,0x00001c0b,0x00001c09,0x000700ed, +0x00000006,0x00001bad,0x00001ba9,0x000000b0, +0x000000a6,0x0000323e,0x00060041,0x000000db, +0x00001baf,0x00001bec,0x000000da,0x00000154, +0x00050051,0x00000027,0x00001bb1,0x00001ba4, +0x00000001,0x0004007c,0x00000006,0x00001c13, +0x00001bb1,0x000500c7,0x00000006,0x00001c15, +0x00001c13,0x00000130,0x000500ab,0x0000002f, +0x00001c16,0x00001c15,0x000000a6,0x000300f7, +0x00001c1d,0x00000000,0x000400fa,0x00001c16, +0x00001c17,0x00001c1a,0x000200f8,0x00001c17, +0x000400c8,0x00000006,0x00001c19,0x00001c13, +0x000200f9,0x00001c1d,0x000200f8,0x00001c1a, +0x000500c5,0x00000006,0x00001c1c,0x00001c13, +0x00000130,0x000200f9,0x00001c1d,0x000200f8, +0x00001c1d,0x000700f5,0x00000006,0x0000323f, +0x00001c19,0x00001c17,0x00001c1c,0x00001c1a, +0x000700ed,0x00000006,0x00001bb3,0x00001baf, +0x000000b0,0x000000a6,0x0000323f,0x00060041, +0x000000db,0x00001bb5,0x00001bec,0x000000da, +0x00000205,0x00050051,0x00000027,0x00001bb7, +0x00001ba4,0x00000002,0x0004007c,0x00000006, +0x00001c24,0x00001bb7,0x000500c7,0x00000006, +0x00001c26,0x00001c24,0x00000130,0x000500ab, +0x0000002f,0x00001c27,0x00001c26,0x000000a6, +0x000300f7,0x00001c2e,0x00000000,0x000400fa, +0x00001c27,0x00001c28,0x00001c2b,0x000200f8, +0x00001c28,0x000400c8,0x00000006,0x00001c2a, +0x00001c24,0x000200f9,0x00001c2e,0x000200f8, +0x00001c2b,0x000500c5,0x00000006,0x00001c2d, +0x00001c24,0x00000130,0x000200f9,0x00001c2e, +0x000200f8,0x00001c2e,0x000700f5,0x00000006, +0x00003240,0x00001c2a,0x00001c28,0x00001c2d, +0x00001c2b,0x000700ed,0x00000006,0x00001bb9, +0x00001bb5,0x000000b0,0x000000a6,0x00003240, +0x00060041,0x000000db,0x00001bbb,0x00001bec, +0x000000da,0x0000020d,0x000300f7,0x00001c3f, +0x00000000,0x000400fa,0x00001c05,0x00001c39, +0x00001c3c,0x000200f8,0x00001c39,0x000400c8, +0x00000006,0x00001c3b,0x00001c02,0x000200f9, +0x00001c3f,0x000200f8,0x00001c3c,0x000500c5, +0x00000006,0x00001c3e,0x00001c02,0x00000130, +0x000200f9,0x00001c3f,0x000200f8,0x00001c3f, +0x000700f5,0x00000006,0x00003241,0x00001c3b, +0x00001c39,0x00001c3e,0x00001c3c,0x000700ef, +0x00000006,0x00001bbf,0x00001bbb,0x000000b0, +0x000000a6,0x00003241,0x00060041,0x000000db, +0x00001bc1,0x00001bec,0x000000da,0x00000215, +0x000300f7,0x00001c50,0x00000000,0x000400fa, +0x00001c16,0x00001c4a,0x00001c4d,0x000200f8, +0x00001c4a,0x000400c8,0x00000006,0x00001c4c, +0x00001c13,0x000200f9,0x00001c50,0x000200f8, +0x00001c4d,0x000500c5,0x00000006,0x00001c4f, +0x00001c13,0x00000130,0x000200f9,0x00001c50, +0x000200f8,0x00001c50,0x000700f5,0x00000006, +0x00003242,0x00001c4c,0x00001c4a,0x00001c4f, +0x00001c4d,0x000700ef,0x00000006,0x00001bc5, +0x00001bc1,0x000000b0,0x000000a6,0x00003242, +0x00060041,0x000000db,0x00001bc7,0x00001bec, +0x000000da,0x0000021d,0x000300f7,0x00001c61, +0x00000000,0x000400fa,0x00001c27,0x00001c5b, +0x00001c5e,0x000200f8,0x00001c5b,0x000400c8, +0x00000006,0x00001c5d,0x00001c24,0x000200f9, +0x00001c61,0x000200f8,0x00001c5e,0x000500c5, +0x00000006,0x00001c60,0x00001c24,0x00000130, +0x000200f9,0x00001c61,0x000200f8,0x00001c61, +0x000700f5,0x00000006,0x00003243,0x00001c5d, +0x00001c5b,0x00001c60,0x00001c5e,0x000700ef, +0x00000006,0x00001bcb,0x00001bc7,0x000000b0, +0x000000a6,0x00003243,0x000200f9,0x00001bcc, +0x000200f8,0x00001bcc,0x000200f9,0x00000bd2, +0x000200f8,0x00000bd6,0x000500aa,0x0000002f, +0x00000bd9,0x00000b13,0x00000170,0x000300f7, +0x00000bdb,0x00000000,0x000400fa,0x00000bd9, +0x00000bda,0x00000bdf,0x000200f8,0x00000bda, +0x00050084,0x00000006,0x00001cca,0x00000107, +0x00000b11,0x000200f9,0x00001ccb,0x000200f8, +0x00001ccb,0x000700f5,0x00000006,0x000031f0, +0x000000a6,0x00000bda,0x00001cdc,0x00001ccf, +0x000500b0,0x0000002f,0x00001cce,0x000031f0, +0x00000118,0x000400f6,0x00001cdd,0x00001ccf, +0x00000000,0x000400fa,0x00001cce,0x00001ccf, +0x00001cdd,0x000200f8,0x00001ccf,0x00050084, +0x00000006,0x00001cd3,0x0000010a,0x000031f0, +0x00050080,0x00000006,0x00001cd4,0x00001cca, +0x00001cd3,0x00050041,0x00000156,0x00001cd5, 0x000000fc,0x00000205,0x0004003d,0x00000007, -0x00001be1,0x00001be0,0x00050051,0x00000006, -0x00001db8,0x00001be1,0x00000000,0x00050095, -0x000000ab,0x00001dba,0x00001db8,0x00001bdf, -0x00050051,0x00000006,0x00001dbb,0x00001dba, -0x00000001,0x00050051,0x00000006,0x00001dbc, -0x00001dba,0x00000000,0x00050051,0x00000006, -0x00001dbf,0x00001be1,0x00000001,0x00050080, -0x00000006,0x00001dc1,0x00001dbf,0x00001dbb, -0x00050050,0x00000007,0x00001dc2,0x00001dbc, -0x00001dc1,0x0004007c,0x00000014,0x00001db2, -0x00001dc2,0x00060041,0x000000db,0x00001da9, -0x00001db2,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00001daa,0x00001da9,0x00000002, -0x00000004,0x00050080,0x00000006,0x00001be4, -0x00001bca,0x00000374,0x00050095,0x000000ab, -0x00001ddb,0x00001db8,0x00001be4,0x00050051, -0x00000006,0x00001ddc,0x00001ddb,0x00000001, -0x00050051,0x00000006,0x00001ddd,0x00001ddb, -0x00000000,0x00050080,0x00000006,0x00001de2, -0x00001dbf,0x00001ddc,0x00050050,0x00000007, -0x00001de3,0x00001ddd,0x00001de2,0x0004007c, -0x00000014,0x00001dd3,0x00001de3,0x00060041, -0x000000db,0x00001dca,0x00001dd3,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00001dcb, -0x00001dca,0x00000002,0x00000004,0x00050080, -0x00000006,0x00001be9,0x00001bca,0x0000037e, -0x00050095,0x000000ab,0x00001dfc,0x00001db8, -0x00001be9,0x00050051,0x00000006,0x00001dfd, -0x00001dfc,0x00000001,0x00050051,0x00000006, -0x00001dfe,0x00001dfc,0x00000000,0x00050080, -0x00000006,0x00001e03,0x00001dbf,0x00001dfd, -0x00050050,0x00000007,0x00001e04,0x00001dfe, -0x00001e03,0x0004007c,0x00000014,0x00001df4, -0x00001e04,0x00060041,0x000000db,0x00001deb, -0x00001df4,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00001dec,0x00001deb,0x00000002, -0x00000004,0x00050080,0x00000006,0x00001bee, -0x00001bca,0x00000388,0x00050095,0x000000ab, -0x00001e1d,0x00001db8,0x00001bee,0x00050051, -0x00000006,0x00001e1e,0x00001e1d,0x00000001, -0x00050051,0x00000006,0x00001e1f,0x00001e1d, -0x00000000,0x00050080,0x00000006,0x00001e24, -0x00001dbf,0x00001e1e,0x00050050,0x00000007, -0x00001e25,0x00001e1f,0x00001e24,0x0004007c, -0x00000014,0x00001e15,0x00001e25,0x00060041, -0x000000db,0x00001e0c,0x00001e15,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00001e0d, -0x00001e0c,0x00000002,0x00000004,0x00050041, -0x000000fe,0x00001bf3,0x000000fc,0x0000022c, -0x0004003d,0x00000006,0x00001bf4,0x00001bf3, -0x00050084,0x00000006,0x00001bf6,0x00000228, -0x00000b11,0x00050080,0x00000006,0x00001bf7, -0x00001bf4,0x00001bf6,0x000200f9,0x00001bf8, -0x000200f8,0x00001bf8,0x000700f5,0x00000006, -0x000030e5,0x000000a6,0x00001bdd,0x00001c09, -0x00001bfc,0x000500b0,0x0000002f,0x00001bfb, -0x000030e5,0x00000118,0x000400f6,0x00001c0a, -0x00001bfc,0x00000000,0x000400fa,0x00001bfb, -0x00001bfc,0x00001c0a,0x000200f8,0x00001bfc, -0x00050084,0x00000006,0x00001bff,0x0000010a, -0x000030e5,0x00050080,0x00000006,0x00001c00, -0x00001bf7,0x00001bff,0x00050041,0x00000156, -0x00001c02,0x000000fc,0x000000da,0x0004003d, -0x00000007,0x00001c03,0x00001c02,0x00050041, -0x00000028,0x00001c04,0x00001b65,0x000030e5, -0x0004003d,0x00000027,0x00001c05,0x00001c04, -0x0004007c,0x00000006,0x00001e2b,0x00001c05, -0x00050051,0x00000006,0x00001e44,0x00001c03, -0x00000000,0x00050095,0x000000ab,0x00001e46, -0x00001e44,0x00001c00,0x00050051,0x00000006, -0x00001e47,0x00001e46,0x00000001,0x00050051, -0x00000006,0x00001e48,0x00001e46,0x00000000, -0x00050051,0x00000006,0x00001e4b,0x00001c03, -0x00000001,0x00050080,0x00000006,0x00001e4d, -0x00001e4b,0x00001e47,0x00050050,0x00000007, -0x00001e4e,0x00001e48,0x00001e4d,0x0004007c, -0x00000014,0x00001e3e,0x00001e4e,0x00060041, -0x000000db,0x00001e36,0x00001e3e,0x000000da, -0x000000da,0x0005003e,0x00001e36,0x00001e2b, -0x00000002,0x00000004,0x00050080,0x00000006, -0x00001c09,0x000030e5,0x00000154,0x000200f9, -0x00001bf8,0x000200f8,0x00001c0a,0x00050080, -0x00000006,0x00001c0c,0x00001bf7,0x00000368, -0x00050041,0x00000156,0x00001c0d,0x000000fc, -0x000000da,0x0004003d,0x00000007,0x00001c0e, -0x00001c0d,0x00050051,0x00000006,0x00001e64, -0x00001c0e,0x00000000,0x00050095,0x000000ab, -0x00001e66,0x00001e64,0x00001c0c,0x00050051, -0x00000006,0x00001e67,0x00001e66,0x00000001, -0x00050051,0x00000006,0x00001e68,0x00001e66, -0x00000000,0x00050051,0x00000006,0x00001e6b, -0x00001c0e,0x00000001,0x00050080,0x00000006, -0x00001e6d,0x00001e6b,0x00001e67,0x00050050, -0x00000007,0x00001e6e,0x00001e68,0x00001e6d, -0x0004007c,0x00000014,0x00001e5e,0x00001e6e, -0x00060041,0x000000db,0x00001e56,0x00001e5e, -0x000000da,0x000000da,0x0005003e,0x00001e56, -0x00001daa,0x00000002,0x00000004,0x00050080, -0x00000006,0x00001c12,0x00001bf7,0x00000374, -0x00050095,0x000000ab,0x00001e86,0x00001e64, -0x00001c12,0x00050051,0x00000006,0x00001e87, -0x00001e86,0x00000001,0x00050051,0x00000006, -0x00001e88,0x00001e86,0x00000000,0x00050080, -0x00000006,0x00001e8d,0x00001e6b,0x00001e87, -0x00050050,0x00000007,0x00001e8e,0x00001e88, -0x00001e8d,0x0004007c,0x00000014,0x00001e7e, -0x00001e8e,0x00060041,0x000000db,0x00001e76, -0x00001e7e,0x000000da,0x000000da,0x0005003e, -0x00001e76,0x00001dcb,0x00000002,0x00000004, -0x000500aa,0x0000002f,0x00001e93,0x00001dec, -0x000000a6,0x000300f7,0x00001e98,0x00000000, -0x000400fa,0x00001e93,0x00001e94,0x00001e98, -0x000200f8,0x00001e94,0x000500aa,0x0000002f, -0x00001e97,0x00001e0d,0x000000a6,0x000200f9, -0x00001e98,0x000200f8,0x00001e98,0x000700f5, -0x0000002f,0x00001e99,0x00001e93,0x00001c0a, -0x00001e97,0x00001e94,0x000400a8,0x0000002f, -0x00001c1d,0x00001e99,0x000300f7,0x00001cb3, -0x00000000,0x000400fa,0x00001c1d,0x00001c1e, -0x00001cb3,0x000200f8,0x00001c1e,0x00050041, -0x00000156,0x00001c20,0x000000fc,0x0000021d, -0x0004003d,0x00000007,0x00001c21,0x00001c20, -0x00050051,0x00000006,0x00001ea1,0x00001c21, -0x00000000,0x00050095,0x000000ab,0x00001ea2, -0x00001dec,0x00001ea1,0x00050051,0x00000006, -0x00001ea3,0x00001ea2,0x00000001,0x00050051, -0x00000006,0x00001ea4,0x00001ea2,0x00000000, -0x00050051,0x00000006,0x00001ea9,0x00001c21, -0x00000001,0x00050080,0x00000006,0x00001eaa, -0x00001e0d,0x00001ea9,0x00050080,0x00000006, -0x00001eac,0x00001eaa,0x00001ea3,0x00050095, -0x000000ab,0x00001ec6,0x00001ea4,0x00000368, -0x00050051,0x00000006,0x00001ec7,0x00001ec6, -0x00000001,0x00050051,0x00000006,0x00001ec8, -0x00001ec6,0x00000000,0x00050080,0x00000006, -0x00001ecd,0x00001eac,0x00001ec7,0x00050050, -0x00000007,0x00001ece,0x00001ec8,0x00001ecd, -0x0004007c,0x00000014,0x00001ebe,0x00001ece, -0x00060041,0x000000db,0x00001eb5,0x00001ebe, +0x00001cd6,0x00001cd5,0x00050051,0x00000006, +0x00001e97,0x00001cd6,0x00000000,0x00050095, +0x000000ab,0x00001e99,0x00001e97,0x00001cd4, +0x00050051,0x00000006,0x00001e9a,0x00001e99, +0x00000001,0x00050051,0x00000006,0x00001e9b, +0x00001e99,0x00000000,0x00050051,0x00000006, +0x00001e9e,0x00001cd6,0x00000001,0x00050080, +0x00000006,0x00001ea0,0x00001e9e,0x00001e9a, +0x00050050,0x00000007,0x00001ea1,0x00001e9b, +0x00001ea0,0x0004007c,0x00000014,0x00001e91, +0x00001ea1,0x00060041,0x000000db,0x00001e88, +0x00001e91,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00001e89,0x00001e88,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00001cd8, +0x00001e89,0x00050041,0x00000028,0x00001cd9, +0x00001c65,0x000031f0,0x0003003e,0x00001cd9, +0x00001cd8,0x00050080,0x00000006,0x00001cdc, +0x000031f0,0x00000154,0x000200f9,0x00001ccb, +0x000200f8,0x00001cdd,0x00050080,0x00000006, +0x00001cdf,0x00001cca,0x00000368,0x00050041, +0x00000156,0x00001ce0,0x000000fc,0x00000205, +0x0004003d,0x00000007,0x00001ce1,0x00001ce0, +0x00050051,0x00000006,0x00001eb8,0x00001ce1, +0x00000000,0x00050095,0x000000ab,0x00001eba, +0x00001eb8,0x00001cdf,0x00050051,0x00000006, +0x00001ebb,0x00001eba,0x00000001,0x00050051, +0x00000006,0x00001ebc,0x00001eba,0x00000000, +0x00050051,0x00000006,0x00001ebf,0x00001ce1, +0x00000001,0x00050080,0x00000006,0x00001ec1, +0x00001ebf,0x00001ebb,0x00050050,0x00000007, +0x00001ec2,0x00001ebc,0x00001ec1,0x0004007c, +0x00000014,0x00001eb2,0x00001ec2,0x00060041, +0x000000db,0x00001ea9,0x00001eb2,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00001eaa, +0x00001ea9,0x00000002,0x00000004,0x00050080, +0x00000006,0x00001ce4,0x00001cca,0x00000374, +0x00050095,0x000000ab,0x00001edb,0x00001eb8, +0x00001ce4,0x00050051,0x00000006,0x00001edc, +0x00001edb,0x00000001,0x00050051,0x00000006, +0x00001edd,0x00001edb,0x00000000,0x00050080, +0x00000006,0x00001ee2,0x00001ebf,0x00001edc, +0x00050050,0x00000007,0x00001ee3,0x00001edd, +0x00001ee2,0x0004007c,0x00000014,0x00001ed3, +0x00001ee3,0x00060041,0x000000db,0x00001eca, +0x00001ed3,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00001ecb,0x00001eca,0x00000002, +0x00000004,0x00050080,0x00000006,0x00001ce9, +0x00001cca,0x0000037e,0x00050095,0x000000ab, +0x00001efc,0x00001eb8,0x00001ce9,0x00050051, +0x00000006,0x00001efd,0x00001efc,0x00000001, +0x00050051,0x00000006,0x00001efe,0x00001efc, +0x00000000,0x00050080,0x00000006,0x00001f03, +0x00001ebf,0x00001efd,0x00050050,0x00000007, +0x00001f04,0x00001efe,0x00001f03,0x0004007c, +0x00000014,0x00001ef4,0x00001f04,0x00060041, +0x000000db,0x00001eeb,0x00001ef4,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00001eec, +0x00001eeb,0x00000002,0x00000004,0x00050080, +0x00000006,0x00001cee,0x00001cca,0x00000388, +0x00050095,0x000000ab,0x00001f1d,0x00001eb8, +0x00001cee,0x00050051,0x00000006,0x00001f1e, +0x00001f1d,0x00000001,0x00050051,0x00000006, +0x00001f1f,0x00001f1d,0x00000000,0x00050080, +0x00000006,0x00001f24,0x00001ebf,0x00001f1e, +0x00050050,0x00000007,0x00001f25,0x00001f1f, +0x00001f24,0x0004007c,0x00000014,0x00001f15, +0x00001f25,0x00060041,0x000000db,0x00001f0c, +0x00001f15,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00001f0d,0x00001f0c,0x00000002, +0x00000004,0x00050041,0x000000fe,0x00001cf3, +0x000000fc,0x0000022c,0x0004003d,0x00000006, +0x00001cf4,0x00001cf3,0x00050084,0x00000006, +0x00001cf6,0x00000228,0x00000b11,0x00050080, +0x00000006,0x00001cf7,0x00001cf4,0x00001cf6, +0x000200f9,0x00001cf8,0x000200f8,0x00001cf8, +0x000700f5,0x00000006,0x000031f1,0x000000a6, +0x00001cdd,0x00001d09,0x00001cfc,0x000500b0, +0x0000002f,0x00001cfb,0x000031f1,0x00000118, +0x000400f6,0x00001d0a,0x00001cfc,0x00000000, +0x000400fa,0x00001cfb,0x00001cfc,0x00001d0a, +0x000200f8,0x00001cfc,0x00050084,0x00000006, +0x00001cff,0x0000010a,0x000031f1,0x00050080, +0x00000006,0x00001d00,0x00001cf7,0x00001cff, +0x00050041,0x00000156,0x00001d02,0x000000fc, +0x000000da,0x0004003d,0x00000007,0x00001d03, +0x00001d02,0x00050041,0x00000028,0x00001d04, +0x00001c65,0x000031f1,0x0004003d,0x00000027, +0x00001d05,0x00001d04,0x0004007c,0x00000006, +0x00001f2b,0x00001d05,0x00050051,0x00000006, +0x00001f44,0x00001d03,0x00000000,0x00050095, +0x000000ab,0x00001f46,0x00001f44,0x00001d00, +0x00050051,0x00000006,0x00001f47,0x00001f46, +0x00000001,0x00050051,0x00000006,0x00001f48, +0x00001f46,0x00000000,0x00050051,0x00000006, +0x00001f4b,0x00001d03,0x00000001,0x00050080, +0x00000006,0x00001f4d,0x00001f4b,0x00001f47, +0x00050050,0x00000007,0x00001f4e,0x00001f48, +0x00001f4d,0x0004007c,0x00000014,0x00001f3e, +0x00001f4e,0x00060041,0x000000db,0x00001f36, +0x00001f3e,0x000000da,0x000000da,0x0005003e, +0x00001f36,0x00001f2b,0x00000002,0x00000004, +0x00050080,0x00000006,0x00001d09,0x000031f1, +0x00000154,0x000200f9,0x00001cf8,0x000200f8, +0x00001d0a,0x00050080,0x00000006,0x00001d0c, +0x00001cf7,0x00000368,0x00050041,0x00000156, +0x00001d0d,0x000000fc,0x000000da,0x0004003d, +0x00000007,0x00001d0e,0x00001d0d,0x00050051, +0x00000006,0x00001f64,0x00001d0e,0x00000000, +0x00050095,0x000000ab,0x00001f66,0x00001f64, +0x00001d0c,0x00050051,0x00000006,0x00001f67, +0x00001f66,0x00000001,0x00050051,0x00000006, +0x00001f68,0x00001f66,0x00000000,0x00050051, +0x00000006,0x00001f6b,0x00001d0e,0x00000001, +0x00050080,0x00000006,0x00001f6d,0x00001f6b, +0x00001f67,0x00050050,0x00000007,0x00001f6e, +0x00001f68,0x00001f6d,0x0004007c,0x00000014, +0x00001f5e,0x00001f6e,0x00060041,0x000000db, +0x00001f56,0x00001f5e,0x000000da,0x000000da, +0x0005003e,0x00001f56,0x00001eaa,0x00000002, +0x00000004,0x00050080,0x00000006,0x00001d12, +0x00001cf7,0x00000374,0x00050095,0x000000ab, +0x00001f86,0x00001f64,0x00001d12,0x00050051, +0x00000006,0x00001f87,0x00001f86,0x00000001, +0x00050051,0x00000006,0x00001f88,0x00001f86, +0x00000000,0x00050080,0x00000006,0x00001f8d, +0x00001f6b,0x00001f87,0x00050050,0x00000007, +0x00001f8e,0x00001f88,0x00001f8d,0x0004007c, +0x00000014,0x00001f7e,0x00001f8e,0x00060041, +0x000000db,0x00001f76,0x00001f7e,0x000000da, +0x000000da,0x0005003e,0x00001f76,0x00001ecb, +0x00000002,0x00000004,0x000500aa,0x0000002f, +0x00001f93,0x00001eec,0x000000a6,0x000300f7, +0x00001f98,0x00000000,0x000400fa,0x00001f93, +0x00001f94,0x00001f98,0x000200f8,0x00001f94, +0x000500aa,0x0000002f,0x00001f97,0x00001f0d, +0x000000a6,0x000200f9,0x00001f98,0x000200f8, +0x00001f98,0x000700f5,0x0000002f,0x00001f99, +0x00001f93,0x00001d0a,0x00001f97,0x00001f94, +0x000400a8,0x0000002f,0x00001d1d,0x00001f99, +0x000300f7,0x00001db3,0x00000000,0x000400fa, +0x00001d1d,0x00001d1e,0x00001db3,0x000200f8, +0x00001d1e,0x00050041,0x00000156,0x00001d20, +0x000000fc,0x0000021d,0x0004003d,0x00000007, +0x00001d21,0x00001d20,0x00050051,0x00000006, +0x00001fa1,0x00001d21,0x00000000,0x00050095, +0x000000ab,0x00001fa2,0x00001eec,0x00001fa1, +0x00050051,0x00000006,0x00001fa3,0x00001fa2, +0x00000001,0x00050051,0x00000006,0x00001fa4, +0x00001fa2,0x00000000,0x00050051,0x00000006, +0x00001fa9,0x00001d21,0x00000001,0x00050080, +0x00000006,0x00001faa,0x00001f0d,0x00001fa9, +0x00050080,0x00000006,0x00001fac,0x00001faa, +0x00001fa3,0x00050095,0x000000ab,0x00001fc6, +0x00001fa4,0x00000368,0x00050051,0x00000006, +0x00001fc7,0x00001fc6,0x00000001,0x00050051, +0x00000006,0x00001fc8,0x00001fc6,0x00000000, +0x00050080,0x00000006,0x00001fcd,0x00001fac, +0x00001fc7,0x00050050,0x00000007,0x00001fce, +0x00001fc8,0x00001fcd,0x0004007c,0x00000014, +0x00001fbe,0x00001fce,0x00060041,0x000000db, +0x00001fb5,0x00001fbe,0x000000da,0x000000da, +0x0006003d,0x00000006,0x00001fb6,0x00001fb5, +0x00000002,0x00000004,0x00050095,0x000000ab, +0x00001fe7,0x00001fa4,0x0000011f,0x00050051, +0x00000006,0x00001fe8,0x00001fe7,0x00000001, +0x00050051,0x00000006,0x00001fe9,0x00001fe7, +0x00000000,0x00050080,0x00000006,0x00001fee, +0x00001fac,0x00001fe8,0x00050050,0x00000007, +0x00001fef,0x00001fe9,0x00001fee,0x0004007c, +0x00000014,0x00001fdf,0x00001fef,0x00060041, +0x000000db,0x00001fd6,0x00001fdf,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00001fd7, +0x00001fd6,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00001d27,0x00001fd7,0x00050095, +0x000000ab,0x00002008,0x00001fa4,0x00000189, +0x00050051,0x00000006,0x00002009,0x00002008, +0x00000001,0x00050051,0x00000006,0x0000200a, +0x00002008,0x00000000,0x00050080,0x00000006, +0x0000200f,0x00001fac,0x00002009,0x00050050, +0x00000007,0x00002010,0x0000200a,0x0000200f, +0x0004007c,0x00000014,0x00002000,0x00002010, +0x00060041,0x000000db,0x00001ff7,0x00002000, 0x000000da,0x000000da,0x0006003d,0x00000006, -0x00001eb6,0x00001eb5,0x00000002,0x00000004, -0x00050095,0x000000ab,0x00001ee7,0x00001ea4, -0x0000011f,0x00050051,0x00000006,0x00001ee8, -0x00001ee7,0x00000001,0x00050051,0x00000006, -0x00001ee9,0x00001ee7,0x00000000,0x00050080, -0x00000006,0x00001eee,0x00001eac,0x00001ee8, -0x00050050,0x00000007,0x00001eef,0x00001ee9, -0x00001eee,0x0004007c,0x00000014,0x00001edf, -0x00001eef,0x00060041,0x000000db,0x00001ed6, -0x00001edf,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00001ed7,0x00001ed6,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00001c27, -0x00001ed7,0x00050095,0x000000ab,0x00001f08, -0x00001ea4,0x00000189,0x00050051,0x00000006, -0x00001f09,0x00001f08,0x00000001,0x00050051, -0x00000006,0x00001f0a,0x00001f08,0x00000000, -0x00050080,0x00000006,0x00001f0f,0x00001eac, -0x00001f09,0x00050050,0x00000007,0x00001f10, -0x00001f0a,0x00001f0f,0x0004007c,0x00000014, -0x00001f00,0x00001f10,0x00060041,0x000000db, -0x00001ef7,0x00001f00,0x000000da,0x000000da, -0x0006003d,0x00000006,0x00001ef8,0x00001ef7, +0x00001ff8,0x00001ff7,0x00000002,0x00000004, +0x0004007c,0x00000027,0x00001d2a,0x00001ff8, +0x00050095,0x000000ab,0x00002029,0x00001fa4, +0x00000150,0x00050051,0x00000006,0x0000202a, +0x00002029,0x00000001,0x00050051,0x00000006, +0x0000202b,0x00002029,0x00000000,0x00050080, +0x00000006,0x00002030,0x00001fac,0x0000202a, +0x00050050,0x00000007,0x00002031,0x0000202b, +0x00002030,0x0004007c,0x00000014,0x00002021, +0x00002031,0x00060041,0x000000db,0x00002018, +0x00002021,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00002019,0x00002018,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00001d2d, +0x00002019,0x00050095,0x000000ab,0x0000204a, +0x00001fa4,0x00000463,0x00050051,0x00000006, +0x0000204b,0x0000204a,0x00000001,0x00050051, +0x00000006,0x0000204c,0x0000204a,0x00000000, +0x00050080,0x00000006,0x00002051,0x00001fac, +0x0000204b,0x00050050,0x00000007,0x00002052, +0x0000204c,0x00002051,0x0004007c,0x00000014, +0x00002042,0x00002052,0x00060041,0x000000db, +0x00002039,0x00002042,0x000000da,0x000000da, +0x0006003d,0x00000006,0x0000203a,0x00002039, 0x00000002,0x00000004,0x0004007c,0x00000027, -0x00001c2a,0x00001ef8,0x00050095,0x000000ab, -0x00001f29,0x00001ea4,0x00000150,0x00050051, -0x00000006,0x00001f2a,0x00001f29,0x00000001, -0x00050051,0x00000006,0x00001f2b,0x00001f29, -0x00000000,0x00050080,0x00000006,0x00001f30, -0x00001eac,0x00001f2a,0x00050050,0x00000007, -0x00001f31,0x00001f2b,0x00001f30,0x0004007c, -0x00000014,0x00001f21,0x00001f31,0x00060041, -0x000000db,0x00001f18,0x00001f21,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00001f19, -0x00001f18,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00001c2d,0x00001f19,0x00050095, -0x000000ab,0x00001f4a,0x00001ea4,0x00000463, -0x00050051,0x00000006,0x00001f4b,0x00001f4a, -0x00000001,0x00050051,0x00000006,0x00001f4c, -0x00001f4a,0x00000000,0x00050080,0x00000006, -0x00001f51,0x00001eac,0x00001f4b,0x00050050, -0x00000007,0x00001f52,0x00001f4c,0x00001f51, -0x0004007c,0x00000014,0x00001f42,0x00001f52, -0x00060041,0x000000db,0x00001f39,0x00001f42, +0x00001d31,0x0000203a,0x00050095,0x000000ab, +0x0000206b,0x00001fa4,0x00000469,0x00050051, +0x00000006,0x0000206c,0x0000206b,0x00000001, +0x00050051,0x00000006,0x0000206d,0x0000206b, +0x00000000,0x00050080,0x00000006,0x00002072, +0x00001fac,0x0000206c,0x00050050,0x00000007, +0x00002073,0x0000206d,0x00002072,0x0004007c, +0x00000014,0x00002063,0x00002073,0x00060041, +0x000000db,0x0000205a,0x00002063,0x000000da, +0x000000da,0x0006003d,0x00000006,0x0000205b, +0x0000205a,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00001d34,0x0000205b,0x00050095, +0x000000ab,0x0000208c,0x00001fa4,0x00000347, +0x00050051,0x00000006,0x0000208d,0x0000208c, +0x00000001,0x00050051,0x00000006,0x0000208e, +0x0000208c,0x00000000,0x00050080,0x00000006, +0x00002093,0x00001fac,0x0000208d,0x00050050, +0x00000007,0x00002094,0x0000208e,0x00002093, +0x0004007c,0x00000014,0x00002084,0x00002094, +0x00060041,0x000000db,0x0000207b,0x00002084, 0x000000da,0x000000da,0x0006003d,0x00000006, -0x00001f3a,0x00001f39,0x00000002,0x00000004, -0x0004007c,0x00000027,0x00001c31,0x00001f3a, -0x00050095,0x000000ab,0x00001f6b,0x00001ea4, -0x00000469,0x00050051,0x00000006,0x00001f6c, -0x00001f6b,0x00000001,0x00050051,0x00000006, -0x00001f6d,0x00001f6b,0x00000000,0x00050080, -0x00000006,0x00001f72,0x00001eac,0x00001f6c, -0x00050050,0x00000007,0x00001f73,0x00001f6d, -0x00001f72,0x0004007c,0x00000014,0x00001f63, -0x00001f73,0x00060041,0x000000db,0x00001f5a, -0x00001f63,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00001f5b,0x00001f5a,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00001c34, -0x00001f5b,0x00050095,0x000000ab,0x00001f8c, -0x00001ea4,0x00000347,0x00050051,0x00000006, -0x00001f8d,0x00001f8c,0x00000001,0x00050051, -0x00000006,0x00001f8e,0x00001f8c,0x00000000, -0x00050080,0x00000006,0x00001f93,0x00001eac, -0x00001f8d,0x00050050,0x00000007,0x00001f94, -0x00001f8e,0x00001f93,0x0004007c,0x00000014, -0x00001f84,0x00001f94,0x00060041,0x000000db, -0x00001f7b,0x00001f84,0x000000da,0x000000da, -0x0006003d,0x00000006,0x00001f7c,0x00001f7b, -0x00000002,0x00000004,0x0004007c,0x00000027, -0x00001c37,0x00001f7c,0x000500bc,0x0000002f, -0x00001f9b,0x00001c27,0x00001c31,0x000300f7, -0x00001fa2,0x00000000,0x000400fa,0x00001f9b, -0x00001f9c,0x00001fa2,0x000200f8,0x00001f9c, -0x000500bc,0x0000002f,0x00001fa1,0x00001c2a, -0x00001c34,0x000200f9,0x00001fa2,0x000200f8, -0x00001fa2,0x000700f5,0x0000002f,0x00001fa3, -0x00001f9b,0x00001c1e,0x00001fa1,0x00001f9c, -0x000300f7,0x00001faa,0x00000000,0x000400fa, -0x00001fa3,0x00001fa4,0x00001faa,0x000200f8, -0x00001fa4,0x000500bc,0x0000002f,0x00001fa9, -0x00001c2d,0x00001c37,0x000200f9,0x00001faa, -0x000200f8,0x00001faa,0x000700f5,0x0000002f, -0x00001fab,0x00001fa3,0x00001fa2,0x00001fa9, -0x00001fa4,0x000300f7,0x00001c41,0x00000000, -0x000400fa,0x00001fab,0x00001c3d,0x00001c41, -0x000200f8,0x00001c3d,0x000500c2,0x00000006, -0x00001c3f,0x00001daa,0x0000047e,0x000500ab, -0x0000002f,0x00001c40,0x00001c3f,0x000000a6, -0x000200f9,0x00001c41,0x000200f8,0x00001c41, -0x000700f5,0x0000002f,0x00001c42,0x00001fab, -0x00001faa,0x00001c40,0x00001c3d,0x000300f7, -0x00001cb2,0x00000000,0x000400fa,0x00001c42, -0x00001c43,0x00001cb2,0x000200f8,0x00001c43, -0x000200f9,0x00001c44,0x000200f8,0x00001c44, -0x000700f5,0x0000004b,0x0000311b,0x0000319b, -0x00001c43,0x00001cad,0x00001c48,0x000700f5, -0x0000004b,0x00003109,0x00003199,0x00001c43, -0x00001caa,0x00001c48,0x000700f5,0x00000006, -0x000030e6,0x000000a6,0x00001c43,0x00001cb0, -0x00001c48,0x000500b0,0x0000002f,0x00001c47, -0x000030e6,0x00000111,0x000400f6,0x00001cb1, -0x00001c48,0x00000000,0x000400fa,0x00001c47, -0x00001c48,0x00001cb1,0x000200f8,0x00001c48, -0x000500c7,0x00000006,0x00001c4a,0x000030e6, -0x000000b0,0x000500ab,0x0000002f,0x00001c4b, -0x00001c4a,0x000000a6,0x000600a9,0x00000027, -0x000031a1,0x00001c4b,0x00001c31,0x00001c27, -0x000500c7,0x00000006,0x00001c55,0x000030e6, -0x00000170,0x000500ab,0x0000002f,0x00001c56, -0x00001c55,0x000000a6,0x000600a9,0x00000027, -0x000031a2,0x00001c56,0x00001c34,0x00001c2a, -0x000500c7,0x00000006,0x00001c60,0x000030e6, -0x0000010a,0x000500ab,0x0000002f,0x00001c61, -0x00001c60,0x000000a6,0x000600a9,0x00000027, -0x000031a3,0x00001c61,0x00001c37,0x00001c2d, -0x00050041,0x00000028,0x00001c6b,0x00001b65, -0x000000da,0x0004003d,0x00000027,0x00001c6c, -0x00001c6b,0x00050085,0x00000027,0x00001c6f, -0x00001c6c,0x000031a1,0x00050041,0x00000028, -0x00001c70,0x00001b65,0x00000154,0x0004003d, -0x00000027,0x00001c71,0x00001c70,0x00050085, -0x00000027,0x00001c74,0x00001c71,0x000031a2, -0x00050081,0x00000027,0x00001c75,0x00001c6f, -0x00001c74,0x00050041,0x00000028,0x00001c76, -0x00001b65,0x00000205,0x0004003d,0x00000027, -0x00001c77,0x00001c76,0x00050085,0x00000027, -0x00001c7a,0x00001c77,0x000031a3,0x00050081, -0x00000027,0x00001c7b,0x00001c75,0x00001c7a, -0x00050041,0x00000028,0x00001c7c,0x00001b65, -0x0000020d,0x0004003d,0x00000027,0x00001c7d, -0x00001c7c,0x00050081,0x00000027,0x00001c7e, -0x00001c7b,0x00001c7d,0x00050041,0x00000028, -0x00001c7f,0x00001b65,0x00000215,0x0004003d, -0x00000027,0x00001c80,0x00001c7f,0x00050085, -0x00000027,0x00001c83,0x00001c80,0x000031a1, -0x00050041,0x00000028,0x00001c84,0x00001b65, -0x0000021d,0x0004003d,0x00000027,0x00001c85, -0x00001c84,0x00050085,0x00000027,0x00001c88, -0x00001c85,0x000031a2,0x00050081,0x00000027, -0x00001c89,0x00001c83,0x00001c88,0x00050041, -0x00000028,0x00001c8a,0x00001b65,0x00000233, -0x0004003d,0x00000027,0x00001c8b,0x00001c8a, -0x00050085,0x00000027,0x00001c8e,0x00001c8b, -0x000031a3,0x00050081,0x00000027,0x00001c8f, -0x00001c89,0x00001c8e,0x00050041,0x00000028, -0x00001c90,0x00001b65,0x000004d8,0x0004003d, -0x00000027,0x00001c91,0x00001c90,0x00050081, -0x00000027,0x00001c92,0x00001c8f,0x00001c91, -0x00050041,0x00000028,0x00001c93,0x00001b65, -0x00000308,0x0004003d,0x00000027,0x00001c94, -0x00001c93,0x00050085,0x00000027,0x00001c97, -0x00001c94,0x000031a1,0x00050041,0x00000028, -0x00001c98,0x00001b65,0x00000250,0x0004003d, -0x00000027,0x00001c99,0x00001c98,0x00050085, -0x00000027,0x00001c9c,0x00001c99,0x000031a2, -0x00050081,0x00000027,0x00001c9d,0x00001c97, -0x00001c9c,0x00050041,0x00000028,0x00001c9e, -0x00001b65,0x00000266,0x0004003d,0x00000027, -0x00001c9f,0x00001c9e,0x00050085,0x00000027, -0x00001ca2,0x00001c9f,0x000031a3,0x00050081, -0x00000027,0x00001ca3,0x00001c9d,0x00001ca2, -0x00050041,0x00000028,0x00001ca4,0x00001b65, -0x0000027b,0x0004003d,0x00000027,0x00001ca5, -0x00001ca4,0x00050081,0x00000027,0x00001ca6, -0x00001ca3,0x00001ca5,0x00060050,0x0000004b, -0x00001ca7,0x00001c7e,0x00001c92,0x00001ca6, -0x0007000c,0x0000004b,0x00001caa,0x00000001, -0x00000025,0x00003109,0x00001ca7,0x0007000c, -0x0000004b,0x00001cad,0x00000001,0x00000028, -0x0000311b,0x00001ca7,0x00050080,0x00000006, -0x00001cb0,0x000030e6,0x00000154,0x000200f9, -0x00001c44,0x000200f8,0x00001cb1,0x000200f9, -0x00001cb2,0x000200f8,0x00001cb2,0x000700f5, -0x0000004b,0x00003117,0x0000319b,0x00001c41, -0x0000311b,0x00001cb1,0x000700f5,0x0000004b, -0x00003105,0x00003199,0x00001c41,0x00003109, -0x00001cb1,0x000200f9,0x00001cb3,0x000200f8, -0x00001cb3,0x000700f5,0x0000004b,0x00003115, -0x0000319b,0x00001e98,0x00003117,0x00001cb2, -0x000700f5,0x0000004b,0x00003103,0x00003199, -0x00001e98,0x00003105,0x00001cb2,0x000700f5, -0x00000006,0x000030ef,0x00000380,0x00001e98, -0x00001eb6,0x00001cb2,0x00050041,0x00000028, -0x00001cb4,0x00001b65,0x000000da,0x0004003d, -0x00000027,0x00001cb5,0x00001cb4,0x000500b4, -0x0000002f,0x00001cb6,0x00001cb5,0x000004fc, -0x000300f7,0x00001cbb,0x00000000,0x000400fa, -0x00001cb6,0x00001cb7,0x00001cbb,0x000200f8, -0x00001cb7,0x00050041,0x00000028,0x00001cb8, -0x00001b65,0x00000154,0x0004003d,0x00000027, -0x00001cb9,0x00001cb8,0x000500b4,0x0000002f, -0x00001cba,0x00001cb9,0x0000026d,0x000200f9, -0x00001cbb,0x000200f8,0x00001cbb,0x000700f5, -0x0000002f,0x00001cbc,0x00001cb6,0x00001cb3, -0x00001cba,0x00001cb7,0x000300f7,0x00001cc1, -0x00000000,0x000400fa,0x00001cbc,0x00001cbd, -0x00001cc1,0x000200f8,0x00001cbd,0x00050041, -0x00000028,0x00001cbe,0x00001b65,0x00000205, -0x0004003d,0x00000027,0x00001cbf,0x00001cbe, -0x000500b4,0x0000002f,0x00001cc0,0x00001cbf, -0x0000026d,0x000200f9,0x00001cc1,0x000200f8, -0x00001cc1,0x000700f5,0x0000002f,0x00001cc2, -0x00001cbc,0x00001cbb,0x00001cc0,0x00001cbd, -0x000300f7,0x00001cc7,0x00000000,0x000400fa, -0x00001cc2,0x00001cc3,0x00001cc7,0x000200f8, -0x00001cc3,0x00050041,0x00000028,0x00001cc4, -0x00001b65,0x00000215,0x0004003d,0x00000027, -0x00001cc5,0x00001cc4,0x000500b4,0x0000002f, -0x00001cc6,0x00001cc5,0x0000026d,0x000200f9, -0x00001cc7,0x000200f8,0x00001cc7,0x000700f5, -0x0000002f,0x00001cc8,0x00001cc2,0x00001cc1, -0x00001cc6,0x00001cc3,0x000300f7,0x00001ccd, -0x00000000,0x000400fa,0x00001cc8,0x00001cc9, -0x00001ccd,0x000200f8,0x00001cc9,0x00050041, -0x00000028,0x00001cca,0x00001b65,0x0000021d, -0x0004003d,0x00000027,0x00001ccb,0x00001cca, -0x000500b4,0x0000002f,0x00001ccc,0x00001ccb, -0x000004fc,0x000200f9,0x00001ccd,0x000200f8, -0x00001ccd,0x000700f5,0x0000002f,0x00001cce, -0x00001cc8,0x00001cc7,0x00001ccc,0x00001cc9, -0x000300f7,0x00001cd3,0x00000000,0x000400fa, -0x00001cce,0x00001ccf,0x00001cd3,0x000200f8, -0x00001ccf,0x00050041,0x00000028,0x00001cd0, -0x00001b65,0x00000233,0x0004003d,0x00000027, -0x00001cd1,0x00001cd0,0x000500b4,0x0000002f, -0x00001cd2,0x00001cd1,0x0000026d,0x000200f9, -0x00001cd3,0x000200f8,0x00001cd3,0x000700f5, -0x0000002f,0x00001cd4,0x00001cce,0x00001ccd, -0x00001cd2,0x00001ccf,0x000300f7,0x00001cd9, -0x00000000,0x000400fa,0x00001cd4,0x00001cd5, -0x00001cd9,0x000200f8,0x00001cd5,0x00050041, -0x00000028,0x00001cd6,0x00001b65,0x00000308, -0x0004003d,0x00000027,0x00001cd7,0x00001cd6, -0x000500b4,0x0000002f,0x00001cd8,0x00001cd7, -0x0000026d,0x000200f9,0x00001cd9,0x000200f8, -0x00001cd9,0x000700f5,0x0000002f,0x00001cda, -0x00001cd4,0x00001cd3,0x00001cd8,0x00001cd5, -0x000300f7,0x00001cdf,0x00000000,0x000400fa, -0x00001cda,0x00001cdb,0x00001cdf,0x000200f8, -0x00001cdb,0x00050041,0x00000028,0x00001cdc, -0x00001b65,0x00000250,0x0004003d,0x00000027, -0x00001cdd,0x00001cdc,0x000500b4,0x0000002f, -0x00001cde,0x00001cdd,0x0000026d,0x000200f9, -0x00001cdf,0x000200f8,0x00001cdf,0x000700f5, -0x0000002f,0x00001ce0,0x00001cda,0x00001cd9, -0x00001cde,0x00001cdb,0x000300f7,0x00001ce5, -0x00000000,0x000400fa,0x00001ce0,0x00001ce1, -0x00001ce5,0x000200f8,0x00001ce1,0x00050041, -0x00000028,0x00001ce2,0x00001b65,0x00000266, -0x0004003d,0x00000027,0x00001ce3,0x00001ce2, -0x000500b4,0x0000002f,0x00001ce4,0x00001ce3, -0x000004fc,0x000200f9,0x00001ce5,0x000200f8, -0x00001ce5,0x000700f5,0x0000002f,0x00001ce6, -0x00001ce0,0x00001cdf,0x00001ce4,0x00001ce1, -0x00050080,0x00000006,0x00001ce8,0x00001bf7, -0x0000037e,0x000500c7,0x00000006,0x00001cea, -0x000030ef,0x00000531,0x000600a9,0x00000006, -0x00001cec,0x00001ce6,0x00000130,0x000000a6, -0x000500c5,0x00000006,0x00001ced,0x00001cea, -0x00001cec,0x00050095,0x000000ab,0x00001fc4, -0x00001e64,0x00001ce8,0x00050051,0x00000006, -0x00001fc5,0x00001fc4,0x00000001,0x00050051, -0x00000006,0x00001fc6,0x00001fc4,0x00000000, -0x00050080,0x00000006,0x00001fcb,0x00001e6b, -0x00001fc5,0x00050050,0x00000007,0x00001fcc, -0x00001fc6,0x00001fcb,0x0004007c,0x00000014, -0x00001fbc,0x00001fcc,0x00060041,0x000000db, -0x00001fb4,0x00001fbc,0x000000da,0x000000da, -0x0005003e,0x00001fb4,0x00001ced,0x00000002, -0x00000004,0x00050080,0x00000006,0x00001cf2, -0x00001bf7,0x00000388,0x000500c2,0x00000006, -0x00001cf5,0x00001dec,0x00000308,0x000500c4, -0x00000006,0x00001cf8,0x00001e0d,0x0000047e, -0x000500c5,0x00000006,0x00001cf9,0x00001cf5, -0x00001cf8,0x00050095,0x000000ab,0x00001fe4, -0x00001e64,0x00001cf2,0x00050051,0x00000006, -0x00001fe5,0x00001fe4,0x00000001,0x00050051, -0x00000006,0x00001fe6,0x00001fe4,0x00000000, -0x00050080,0x00000006,0x00001feb,0x00001e6b, -0x00001fe5,0x00050050,0x00000007,0x00001fec, -0x00001fe6,0x00001feb,0x0004007c,0x00000014, -0x00001fdc,0x00001fec,0x00060041,0x000000db, -0x00001fd4,0x00001fdc,0x000000da,0x000000da, -0x0005003e,0x00001fd4,0x00001cf9,0x00000002, -0x00000004,0x0004003d,0x00000027,0x00001cfe, -0x00001cb4,0x00050041,0x00000028,0x00001cff, -0x00001b65,0x00000215,0x0004003d,0x00000027, -0x00001d00,0x00001cff,0x00050041,0x00000028, -0x00001d01,0x00001b65,0x00000308,0x0004003d, -0x00000027,0x00001d02,0x00001d01,0x00050041, -0x00000028,0x00001d03,0x00001b65,0x00000154, -0x0004003d,0x00000027,0x00001d04,0x00001d03, -0x00050041,0x00000028,0x00001d05,0x00001b65, -0x0000021d,0x0004003d,0x00000027,0x00001d06, -0x00001d05,0x00050041,0x00000028,0x00001d07, -0x00001b65,0x00000250,0x0004003d,0x00000027, -0x00001d08,0x00001d07,0x00050041,0x00000028, -0x00001d09,0x00001b65,0x00000205,0x0004003d, -0x00000027,0x00001d0a,0x00001d09,0x00050041, -0x00000028,0x00001d0b,0x00001b65,0x00000233, -0x0004003d,0x00000027,0x00001d0c,0x00001d0b, -0x00050041,0x00000028,0x00001d0d,0x00001b65, -0x00000266,0x0004003d,0x00000027,0x00001d0e, -0x00001d0d,0x00060050,0x0000004b,0x00001d0f, -0x00001cfe,0x00001d00,0x00001d02,0x00060050, -0x0000004b,0x00001d10,0x00001d04,0x00001d06, -0x00001d08,0x00060050,0x0000004b,0x00001d11, -0x00001d0a,0x00001d0c,0x00001d0e,0x00060050, -0x0000054b,0x00001d12,0x00001d0f,0x00001d10, -0x00001d11,0x0006000c,0x00000027,0x00001d14, -0x00000001,0x00000021,0x00001d12,0x000500b7, -0x0000002f,0x00001d16,0x00001d14,0x0000026d, -0x000300f7,0x00001d1b,0x00000000,0x000400fa, -0x00001d16,0x00001d17,0x00001d1a,0x000200f8, -0x00001d17,0x0006000c,0x0000054b,0x00001d19, -0x00000001,0x00000022,0x00001d12,0x000200f9, -0x00001d1b,0x000200f8,0x00001d1a,0x000200f9, -0x00001d1b,0x000200f8,0x00001d1b,0x000700f5, -0x0000054b,0x000030f6,0x00001d19,0x00001d17, -0x00000571,0x00001d1a,0x0003003e,0x00001ba6, -0x000030f6,0x00050041,0x00000028,0x00001d1d, -0x00001b65,0x0000020d,0x0004003d,0x00000027, -0x00001d1e,0x00001d1d,0x00050041,0x00000028, -0x00001d1f,0x00001b65,0x000004d8,0x0004003d, -0x00000027,0x00001d20,0x00001d1f,0x00050041, -0x00000028,0x00001d21,0x00001b65,0x0000027b, -0x0004003d,0x00000027,0x00001d22,0x00001d21, -0x00060050,0x0000004b,0x00001d23,0x00001d1e, -0x00001d20,0x00001d22,0x00050091,0x0000004b, -0x00001d26,0x000030f6,0x00001d23,0x0004007f, -0x0000004b,0x00001d27,0x00001d26,0x0003003e, -0x00001ba9,0x00001d27,0x000200f9,0x00001d28, -0x000200f8,0x00001d28,0x000700f5,0x00000006, -0x000030f7,0x000000a6,0x00001d1b,0x00001d5b, -0x00001d2c,0x000500b0,0x0000002f,0x00001d2b, -0x000030f7,0x000002b7,0x000400f6,0x00001d5c, -0x00001d2c,0x00000000,0x000400fa,0x00001d2b, -0x00001d2c,0x00001d5c,0x000200f8,0x00001d2c, -0x00050080,0x00000006,0x00001d2e,0x00001bf7, -0x00000107,0x00050084,0x00000006,0x00001d30, -0x0000011f,0x000030f7,0x00050080,0x00000006, -0x00001d31,0x00001d2e,0x00001d30,0x00060041, -0x00000028,0x00001d35,0x00001ba6,0x000000da, -0x000030f7,0x0004003d,0x00000027,0x00001d36, -0x00001d35,0x0004007c,0x00000006,0x00001ff2, -0x00001d36,0x00050095,0x000000ab,0x0000200d, -0x00001e64,0x00001d31,0x00050051,0x00000006, -0x0000200e,0x0000200d,0x00000001,0x00050051, -0x00000006,0x0000200f,0x0000200d,0x00000000, -0x00050080,0x00000006,0x00002014,0x00001e6b, -0x0000200e,0x00050050,0x00000007,0x00002015, -0x0000200f,0x00002014,0x0004007c,0x00000014, -0x00002005,0x00002015,0x00060041,0x000000db, -0x00001ffd,0x00002005,0x000000da,0x000000da, -0x0005003e,0x00001ffd,0x00001ff2,0x00000002, -0x00000004,0x00050080,0x00000006,0x00001d39, -0x00001bf7,0x00000597,0x00050080,0x00000006, -0x00001d3c,0x00001d39,0x00001d30,0x00060041, -0x00000028,0x00001d40,0x00001ba6,0x00000154, -0x000030f7,0x0004003d,0x00000027,0x00001d41, -0x00001d40,0x0004007c,0x00000006,0x0000201b, -0x00001d41,0x00050095,0x000000ab,0x00002036, -0x00001e64,0x00001d3c,0x00050051,0x00000006, -0x00002037,0x00002036,0x00000001,0x00050051, -0x00000006,0x00002038,0x00002036,0x00000000, -0x00050080,0x00000006,0x0000203d,0x00001e6b, -0x00002037,0x00050050,0x00000007,0x0000203e, -0x00002038,0x0000203d,0x0004007c,0x00000014, -0x0000202e,0x0000203e,0x00060041,0x000000db, -0x00002026,0x0000202e,0x000000da,0x000000da, -0x0005003e,0x00002026,0x0000201b,0x00000002, -0x00000004,0x00050080,0x00000006,0x00001d44, -0x00001bf7,0x000005a6,0x00050080,0x00000006, -0x00001d47,0x00001d44,0x00001d30,0x00060041, -0x00000028,0x00001d4b,0x00001ba6,0x00000205, -0x000030f7,0x0004003d,0x00000027,0x00001d4c, -0x00001d4b,0x0004007c,0x00000006,0x00002044, -0x00001d4c,0x00050095,0x000000ab,0x0000205f, -0x00001e64,0x00001d47,0x00050051,0x00000006, -0x00002060,0x0000205f,0x00000001,0x00050051, -0x00000006,0x00002061,0x0000205f,0x00000000, -0x00050080,0x00000006,0x00002066,0x00001e6b, -0x00002060,0x00050050,0x00000007,0x00002067, -0x00002061,0x00002066,0x0004007c,0x00000014, -0x00002057,0x00002067,0x00060041,0x000000db, -0x0000204f,0x00002057,0x000000da,0x000000da, -0x0005003e,0x0000204f,0x00002044,0x00000002, -0x00000004,0x00050080,0x00000006,0x00001d4f, -0x00001bf7,0x000005b5,0x00050080,0x00000006, -0x00001d52,0x00001d4f,0x00001d30,0x00050041, -0x00000028,0x00001d56,0x00001ba9,0x000030f7, -0x0004003d,0x00000027,0x00001d57,0x00001d56, -0x0004007c,0x00000006,0x0000206d,0x00001d57, -0x00050095,0x000000ab,0x00002088,0x00001e64, -0x00001d52,0x00050051,0x00000006,0x00002089, -0x00002088,0x00000001,0x00050051,0x00000006, -0x0000208a,0x00002088,0x00000000,0x00050080, -0x00000006,0x0000208f,0x00001e6b,0x00002089, -0x00050050,0x00000007,0x00002090,0x0000208a, -0x0000208f,0x0004007c,0x00000014,0x00002080, -0x00002090,0x00060041,0x000000db,0x00002078, -0x00002080,0x000000da,0x000000da,0x0005003e, -0x00002078,0x0000206d,0x00000002,0x00000004, -0x00050080,0x00000006,0x00001d5b,0x000030f7, -0x00000154,0x000200f9,0x00001d28,0x000200f8, -0x00001d5c,0x00050080,0x00000006,0x00001d5e, -0x00001bf7,0x000005c6,0x00050095,0x000000ab, -0x000020a8,0x00001e64,0x00001d5e,0x00050051, -0x00000006,0x000020a9,0x000020a8,0x00000001, -0x00050051,0x00000006,0x000020aa,0x000020a8, -0x00000000,0x00050080,0x00000006,0x000020af, -0x00001e6b,0x000020a9,0x00050050,0x00000007, -0x000020b0,0x000020aa,0x000020af,0x0004007c, -0x00000014,0x000020a0,0x000020b0,0x00060041, -0x000000db,0x00002098,0x000020a0,0x000000da, -0x000000da,0x0005003e,0x00002098,0x00000b11, +0x0000207c,0x0000207b,0x00000002,0x00000004, +0x0004007c,0x00000027,0x00001d37,0x0000207c, +0x000500bc,0x0000002f,0x0000209b,0x00001d27, +0x00001d31,0x000300f7,0x000020a2,0x00000000, +0x000400fa,0x0000209b,0x0000209c,0x000020a2, +0x000200f8,0x0000209c,0x000500bc,0x0000002f, +0x000020a1,0x00001d2a,0x00001d34,0x000200f9, +0x000020a2,0x000200f8,0x000020a2,0x000700f5, +0x0000002f,0x000020a3,0x0000209b,0x00001d1e, +0x000020a1,0x0000209c,0x000300f7,0x000020aa, +0x00000000,0x000400fa,0x000020a3,0x000020a4, +0x000020aa,0x000200f8,0x000020a4,0x000500bc, +0x0000002f,0x000020a9,0x00001d2d,0x00001d37, +0x000200f9,0x000020aa,0x000200f8,0x000020aa, +0x000700f5,0x0000002f,0x000020ab,0x000020a3, +0x000020a2,0x000020a9,0x000020a4,0x000300f7, +0x00001d41,0x00000000,0x000400fa,0x000020ab, +0x00001d3d,0x00001d41,0x000200f8,0x00001d3d, +0x000500c2,0x00000006,0x00001d3f,0x00001eaa, +0x0000047e,0x000500ab,0x0000002f,0x00001d40, +0x00001d3f,0x000000a6,0x000200f9,0x00001d41, +0x000200f8,0x00001d41,0x000700f5,0x0000002f, +0x00001d42,0x000020ab,0x000020aa,0x00001d40, +0x00001d3d,0x000300f7,0x00001db2,0x00000000, +0x000400fa,0x00001d42,0x00001d43,0x00001db2, +0x000200f8,0x00001d43,0x000200f9,0x00001d44, +0x000200f8,0x00001d44,0x000700f5,0x0000004b, +0x00003227,0x000032a7,0x00001d43,0x00001dad, +0x00001d48,0x000700f5,0x0000004b,0x00003215, +0x000032a5,0x00001d43,0x00001daa,0x00001d48, +0x000700f5,0x00000006,0x000031f2,0x000000a6, +0x00001d43,0x00001db0,0x00001d48,0x000500b0, +0x0000002f,0x00001d47,0x000031f2,0x00000111, +0x000400f6,0x00001db1,0x00001d48,0x00000000, +0x000400fa,0x00001d47,0x00001d48,0x00001db1, +0x000200f8,0x00001d48,0x000500c7,0x00000006, +0x00001d4a,0x000031f2,0x000000b0,0x000500ab, +0x0000002f,0x00001d4b,0x00001d4a,0x000000a6, +0x000600a9,0x00000027,0x000032ad,0x00001d4b, +0x00001d31,0x00001d27,0x000500c7,0x00000006, +0x00001d55,0x000031f2,0x00000170,0x000500ab, +0x0000002f,0x00001d56,0x00001d55,0x000000a6, +0x000600a9,0x00000027,0x000032ae,0x00001d56, +0x00001d34,0x00001d2a,0x000500c7,0x00000006, +0x00001d60,0x000031f2,0x0000010a,0x000500ab, +0x0000002f,0x00001d61,0x00001d60,0x000000a6, +0x000600a9,0x00000027,0x000032af,0x00001d61, +0x00001d37,0x00001d2d,0x00050041,0x00000028, +0x00001d6b,0x00001c65,0x000000da,0x0004003d, +0x00000027,0x00001d6c,0x00001d6b,0x00050085, +0x00000027,0x00001d6f,0x00001d6c,0x000032ad, +0x00050041,0x00000028,0x00001d70,0x00001c65, +0x00000154,0x0004003d,0x00000027,0x00001d71, +0x00001d70,0x00050085,0x00000027,0x00001d74, +0x00001d71,0x000032ae,0x00050081,0x00000027, +0x00001d75,0x00001d6f,0x00001d74,0x00050041, +0x00000028,0x00001d76,0x00001c65,0x00000205, +0x0004003d,0x00000027,0x00001d77,0x00001d76, +0x00050085,0x00000027,0x00001d7a,0x00001d77, +0x000032af,0x00050081,0x00000027,0x00001d7b, +0x00001d75,0x00001d7a,0x00050041,0x00000028, +0x00001d7c,0x00001c65,0x0000020d,0x0004003d, +0x00000027,0x00001d7d,0x00001d7c,0x00050081, +0x00000027,0x00001d7e,0x00001d7b,0x00001d7d, +0x00050041,0x00000028,0x00001d7f,0x00001c65, +0x00000215,0x0004003d,0x00000027,0x00001d80, +0x00001d7f,0x00050085,0x00000027,0x00001d83, +0x00001d80,0x000032ad,0x00050041,0x00000028, +0x00001d84,0x00001c65,0x0000021d,0x0004003d, +0x00000027,0x00001d85,0x00001d84,0x00050085, +0x00000027,0x00001d88,0x00001d85,0x000032ae, +0x00050081,0x00000027,0x00001d89,0x00001d83, +0x00001d88,0x00050041,0x00000028,0x00001d8a, +0x00001c65,0x00000233,0x0004003d,0x00000027, +0x00001d8b,0x00001d8a,0x00050085,0x00000027, +0x00001d8e,0x00001d8b,0x000032af,0x00050081, +0x00000027,0x00001d8f,0x00001d89,0x00001d8e, +0x00050041,0x00000028,0x00001d90,0x00001c65, +0x000004d8,0x0004003d,0x00000027,0x00001d91, +0x00001d90,0x00050081,0x00000027,0x00001d92, +0x00001d8f,0x00001d91,0x00050041,0x00000028, +0x00001d93,0x00001c65,0x00000308,0x0004003d, +0x00000027,0x00001d94,0x00001d93,0x00050085, +0x00000027,0x00001d97,0x00001d94,0x000032ad, +0x00050041,0x00000028,0x00001d98,0x00001c65, +0x00000250,0x0004003d,0x00000027,0x00001d99, +0x00001d98,0x00050085,0x00000027,0x00001d9c, +0x00001d99,0x000032ae,0x00050081,0x00000027, +0x00001d9d,0x00001d97,0x00001d9c,0x00050041, +0x00000028,0x00001d9e,0x00001c65,0x00000266, +0x0004003d,0x00000027,0x00001d9f,0x00001d9e, +0x00050085,0x00000027,0x00001da2,0x00001d9f, +0x000032af,0x00050081,0x00000027,0x00001da3, +0x00001d9d,0x00001da2,0x00050041,0x00000028, +0x00001da4,0x00001c65,0x0000027b,0x0004003d, +0x00000027,0x00001da5,0x00001da4,0x00050081, +0x00000027,0x00001da6,0x00001da3,0x00001da5, +0x00060050,0x0000004b,0x00001da7,0x00001d7e, +0x00001d92,0x00001da6,0x0007000c,0x0000004b, +0x00001daa,0x00000001,0x00000025,0x00003215, +0x00001da7,0x0007000c,0x0000004b,0x00001dad, +0x00000001,0x00000028,0x00003227,0x00001da7, +0x00050080,0x00000006,0x00001db0,0x000031f2, +0x00000154,0x000200f9,0x00001d44,0x000200f8, +0x00001db1,0x000200f9,0x00001db2,0x000200f8, +0x00001db2,0x000700f5,0x0000004b,0x00003223, +0x000032a7,0x00001d41,0x00003227,0x00001db1, +0x000700f5,0x0000004b,0x00003211,0x000032a5, +0x00001d41,0x00003215,0x00001db1,0x000200f9, +0x00001db3,0x000200f8,0x00001db3,0x000700f5, +0x0000004b,0x00003221,0x000032a7,0x00001f98, +0x00003223,0x00001db2,0x000700f5,0x0000004b, +0x0000320f,0x000032a5,0x00001f98,0x00003211, +0x00001db2,0x000700f5,0x00000006,0x000031fb, +0x00000380,0x00001f98,0x00001fb6,0x00001db2, +0x00050041,0x00000028,0x00001db4,0x00001c65, +0x000000da,0x0004003d,0x00000027,0x00001db5, +0x00001db4,0x000500b4,0x0000002f,0x00001db6, +0x00001db5,0x000004fc,0x000300f7,0x00001dbb, +0x00000000,0x000400fa,0x00001db6,0x00001db7, +0x00001dbb,0x000200f8,0x00001db7,0x00050041, +0x00000028,0x00001db8,0x00001c65,0x00000154, +0x0004003d,0x00000027,0x00001db9,0x00001db8, +0x000500b4,0x0000002f,0x00001dba,0x00001db9, +0x0000026d,0x000200f9,0x00001dbb,0x000200f8, +0x00001dbb,0x000700f5,0x0000002f,0x00001dbc, +0x00001db6,0x00001db3,0x00001dba,0x00001db7, +0x000300f7,0x00001dc1,0x00000000,0x000400fa, +0x00001dbc,0x00001dbd,0x00001dc1,0x000200f8, +0x00001dbd,0x00050041,0x00000028,0x00001dbe, +0x00001c65,0x00000205,0x0004003d,0x00000027, +0x00001dbf,0x00001dbe,0x000500b4,0x0000002f, +0x00001dc0,0x00001dbf,0x0000026d,0x000200f9, +0x00001dc1,0x000200f8,0x00001dc1,0x000700f5, +0x0000002f,0x00001dc2,0x00001dbc,0x00001dbb, +0x00001dc0,0x00001dbd,0x000300f7,0x00001dc7, +0x00000000,0x000400fa,0x00001dc2,0x00001dc3, +0x00001dc7,0x000200f8,0x00001dc3,0x00050041, +0x00000028,0x00001dc4,0x00001c65,0x00000215, +0x0004003d,0x00000027,0x00001dc5,0x00001dc4, +0x000500b4,0x0000002f,0x00001dc6,0x00001dc5, +0x0000026d,0x000200f9,0x00001dc7,0x000200f8, +0x00001dc7,0x000700f5,0x0000002f,0x00001dc8, +0x00001dc2,0x00001dc1,0x00001dc6,0x00001dc3, +0x000300f7,0x00001dcd,0x00000000,0x000400fa, +0x00001dc8,0x00001dc9,0x00001dcd,0x000200f8, +0x00001dc9,0x00050041,0x00000028,0x00001dca, +0x00001c65,0x0000021d,0x0004003d,0x00000027, +0x00001dcb,0x00001dca,0x000500b4,0x0000002f, +0x00001dcc,0x00001dcb,0x000004fc,0x000200f9, +0x00001dcd,0x000200f8,0x00001dcd,0x000700f5, +0x0000002f,0x00001dce,0x00001dc8,0x00001dc7, +0x00001dcc,0x00001dc9,0x000300f7,0x00001dd3, +0x00000000,0x000400fa,0x00001dce,0x00001dcf, +0x00001dd3,0x000200f8,0x00001dcf,0x00050041, +0x00000028,0x00001dd0,0x00001c65,0x00000233, +0x0004003d,0x00000027,0x00001dd1,0x00001dd0, +0x000500b4,0x0000002f,0x00001dd2,0x00001dd1, +0x0000026d,0x000200f9,0x00001dd3,0x000200f8, +0x00001dd3,0x000700f5,0x0000002f,0x00001dd4, +0x00001dce,0x00001dcd,0x00001dd2,0x00001dcf, +0x000300f7,0x00001dd9,0x00000000,0x000400fa, +0x00001dd4,0x00001dd5,0x00001dd9,0x000200f8, +0x00001dd5,0x00050041,0x00000028,0x00001dd6, +0x00001c65,0x00000308,0x0004003d,0x00000027, +0x00001dd7,0x00001dd6,0x000500b4,0x0000002f, +0x00001dd8,0x00001dd7,0x0000026d,0x000200f9, +0x00001dd9,0x000200f8,0x00001dd9,0x000700f5, +0x0000002f,0x00001dda,0x00001dd4,0x00001dd3, +0x00001dd8,0x00001dd5,0x000300f7,0x00001ddf, +0x00000000,0x000400fa,0x00001dda,0x00001ddb, +0x00001ddf,0x000200f8,0x00001ddb,0x00050041, +0x00000028,0x00001ddc,0x00001c65,0x00000250, +0x0004003d,0x00000027,0x00001ddd,0x00001ddc, +0x000500b4,0x0000002f,0x00001dde,0x00001ddd, +0x0000026d,0x000200f9,0x00001ddf,0x000200f8, +0x00001ddf,0x000700f5,0x0000002f,0x00001de0, +0x00001dda,0x00001dd9,0x00001dde,0x00001ddb, +0x000300f7,0x00001de5,0x00000000,0x000400fa, +0x00001de0,0x00001de1,0x00001de5,0x000200f8, +0x00001de1,0x00050041,0x00000028,0x00001de2, +0x00001c65,0x00000266,0x0004003d,0x00000027, +0x00001de3,0x00001de2,0x000500b4,0x0000002f, +0x00001de4,0x00001de3,0x000004fc,0x000200f9, +0x00001de5,0x000200f8,0x00001de5,0x000700f5, +0x0000002f,0x00001de6,0x00001de0,0x00001ddf, +0x00001de4,0x00001de1,0x00050080,0x00000006, +0x00001de8,0x00001cf7,0x0000037e,0x000500c7, +0x00000006,0x00001dea,0x000031fb,0x00000531, +0x000600a9,0x00000006,0x00001dec,0x00001de6, +0x00000130,0x000000a6,0x000500c5,0x00000006, +0x00001ded,0x00001dea,0x00001dec,0x00050095, +0x000000ab,0x000020c4,0x00001f64,0x00001de8, +0x00050051,0x00000006,0x000020c5,0x000020c4, +0x00000001,0x00050051,0x00000006,0x000020c6, +0x000020c4,0x00000000,0x00050080,0x00000006, +0x000020cb,0x00001f6b,0x000020c5,0x00050050, +0x00000007,0x000020cc,0x000020c6,0x000020cb, +0x0004007c,0x00000014,0x000020bc,0x000020cc, +0x00060041,0x000000db,0x000020b4,0x000020bc, +0x000000da,0x000000da,0x0005003e,0x000020b4, +0x00001ded,0x00000002,0x00000004,0x00050080, +0x00000006,0x00001df2,0x00001cf7,0x00000388, +0x000500c2,0x00000006,0x00001df5,0x00001eec, +0x00000308,0x000500c4,0x00000006,0x00001df8, +0x00001f0d,0x0000047e,0x000500c5,0x00000006, +0x00001df9,0x00001df5,0x00001df8,0x00050095, +0x000000ab,0x000020e4,0x00001f64,0x00001df2, +0x00050051,0x00000006,0x000020e5,0x000020e4, +0x00000001,0x00050051,0x00000006,0x000020e6, +0x000020e4,0x00000000,0x00050080,0x00000006, +0x000020eb,0x00001f6b,0x000020e5,0x00050050, +0x00000007,0x000020ec,0x000020e6,0x000020eb, +0x0004007c,0x00000014,0x000020dc,0x000020ec, +0x00060041,0x000000db,0x000020d4,0x000020dc, +0x000000da,0x000000da,0x0005003e,0x000020d4, +0x00001df9,0x00000002,0x00000004,0x0004003d, +0x00000027,0x00001dfe,0x00001db4,0x00050041, +0x00000028,0x00001dff,0x00001c65,0x00000215, +0x0004003d,0x00000027,0x00001e00,0x00001dff, +0x00050041,0x00000028,0x00001e01,0x00001c65, +0x00000308,0x0004003d,0x00000027,0x00001e02, +0x00001e01,0x00050041,0x00000028,0x00001e03, +0x00001c65,0x00000154,0x0004003d,0x00000027, +0x00001e04,0x00001e03,0x00050041,0x00000028, +0x00001e05,0x00001c65,0x0000021d,0x0004003d, +0x00000027,0x00001e06,0x00001e05,0x00050041, +0x00000028,0x00001e07,0x00001c65,0x00000250, +0x0004003d,0x00000027,0x00001e08,0x00001e07, +0x00050041,0x00000028,0x00001e09,0x00001c65, +0x00000205,0x0004003d,0x00000027,0x00001e0a, +0x00001e09,0x00050041,0x00000028,0x00001e0b, +0x00001c65,0x00000233,0x0004003d,0x00000027, +0x00001e0c,0x00001e0b,0x00050041,0x00000028, +0x00001e0d,0x00001c65,0x00000266,0x0004003d, +0x00000027,0x00001e0e,0x00001e0d,0x00060050, +0x0000004b,0x00001e0f,0x00001dfe,0x00001e00, +0x00001e02,0x00060050,0x0000004b,0x00001e10, +0x00001e04,0x00001e06,0x00001e08,0x00060050, +0x0000004b,0x00001e11,0x00001e0a,0x00001e0c, +0x00001e0e,0x00060050,0x0000054b,0x00001e12, +0x00001e0f,0x00001e10,0x00001e11,0x0006000c, +0x00000027,0x00001e14,0x00000001,0x00000021, +0x00001e12,0x000500b7,0x0000002f,0x00001e16, +0x00001e14,0x0000026d,0x000300f7,0x00001e1b, +0x00000000,0x000400fa,0x00001e16,0x00001e17, +0x00001e1a,0x000200f8,0x00001e17,0x0006000c, +0x0000054b,0x00001e19,0x00000001,0x00000022, +0x00001e12,0x000200f9,0x00001e1b,0x000200f8, +0x00001e1a,0x000200f9,0x00001e1b,0x000200f8, +0x00001e1b,0x000700f5,0x0000054b,0x00003202, +0x00001e19,0x00001e17,0x00000571,0x00001e1a, +0x0003003e,0x00001ca6,0x00003202,0x00050041, +0x00000028,0x00001e1d,0x00001c65,0x0000020d, +0x0004003d,0x00000027,0x00001e1e,0x00001e1d, +0x00050041,0x00000028,0x00001e1f,0x00001c65, +0x000004d8,0x0004003d,0x00000027,0x00001e20, +0x00001e1f,0x00050041,0x00000028,0x00001e21, +0x00001c65,0x0000027b,0x0004003d,0x00000027, +0x00001e22,0x00001e21,0x00060050,0x0000004b, +0x00001e23,0x00001e1e,0x00001e20,0x00001e22, +0x00050091,0x0000004b,0x00001e26,0x00003202, +0x00001e23,0x0004007f,0x0000004b,0x00001e27, +0x00001e26,0x0003003e,0x00001ca9,0x00001e27, +0x000200f9,0x00001e28,0x000200f8,0x00001e28, +0x000700f5,0x00000006,0x00003203,0x000000a6, +0x00001e1b,0x00001e5b,0x00001e2c,0x000500b0, +0x0000002f,0x00001e2b,0x00003203,0x000002b7, +0x000400f6,0x00001e5c,0x00001e2c,0x00000000, +0x000400fa,0x00001e2b,0x00001e2c,0x00001e5c, +0x000200f8,0x00001e2c,0x00050080,0x00000006, +0x00001e2e,0x00001cf7,0x00000107,0x00050084, +0x00000006,0x00001e30,0x0000011f,0x00003203, +0x00050080,0x00000006,0x00001e31,0x00001e2e, +0x00001e30,0x00060041,0x00000028,0x00001e35, +0x00001ca6,0x000000da,0x00003203,0x0004003d, +0x00000027,0x00001e36,0x00001e35,0x0004007c, +0x00000006,0x000020f2,0x00001e36,0x00050095, +0x000000ab,0x0000210d,0x00001f64,0x00001e31, +0x00050051,0x00000006,0x0000210e,0x0000210d, +0x00000001,0x00050051,0x00000006,0x0000210f, +0x0000210d,0x00000000,0x00050080,0x00000006, +0x00002114,0x00001f6b,0x0000210e,0x00050050, +0x00000007,0x00002115,0x0000210f,0x00002114, +0x0004007c,0x00000014,0x00002105,0x00002115, +0x00060041,0x000000db,0x000020fd,0x00002105, +0x000000da,0x000000da,0x0005003e,0x000020fd, +0x000020f2,0x00000002,0x00000004,0x00050080, +0x00000006,0x00001e39,0x00001cf7,0x00000597, +0x00050080,0x00000006,0x00001e3c,0x00001e39, +0x00001e30,0x00060041,0x00000028,0x00001e40, +0x00001ca6,0x00000154,0x00003203,0x0004003d, +0x00000027,0x00001e41,0x00001e40,0x0004007c, +0x00000006,0x0000211b,0x00001e41,0x00050095, +0x000000ab,0x00002136,0x00001f64,0x00001e3c, +0x00050051,0x00000006,0x00002137,0x00002136, +0x00000001,0x00050051,0x00000006,0x00002138, +0x00002136,0x00000000,0x00050080,0x00000006, +0x0000213d,0x00001f6b,0x00002137,0x00050050, +0x00000007,0x0000213e,0x00002138,0x0000213d, +0x0004007c,0x00000014,0x0000212e,0x0000213e, +0x00060041,0x000000db,0x00002126,0x0000212e, +0x000000da,0x000000da,0x0005003e,0x00002126, +0x0000211b,0x00000002,0x00000004,0x00050080, +0x00000006,0x00001e44,0x00001cf7,0x000005a6, +0x00050080,0x00000006,0x00001e47,0x00001e44, +0x00001e30,0x00060041,0x00000028,0x00001e4b, +0x00001ca6,0x00000205,0x00003203,0x0004003d, +0x00000027,0x00001e4c,0x00001e4b,0x0004007c, +0x00000006,0x00002144,0x00001e4c,0x00050095, +0x000000ab,0x0000215f,0x00001f64,0x00001e47, +0x00050051,0x00000006,0x00002160,0x0000215f, +0x00000001,0x00050051,0x00000006,0x00002161, +0x0000215f,0x00000000,0x00050080,0x00000006, +0x00002166,0x00001f6b,0x00002160,0x00050050, +0x00000007,0x00002167,0x00002161,0x00002166, +0x0004007c,0x00000014,0x00002157,0x00002167, +0x00060041,0x000000db,0x0000214f,0x00002157, +0x000000da,0x000000da,0x0005003e,0x0000214f, +0x00002144,0x00000002,0x00000004,0x00050080, +0x00000006,0x00001e4f,0x00001cf7,0x000005b5, +0x00050080,0x00000006,0x00001e52,0x00001e4f, +0x00001e30,0x00050041,0x00000028,0x00001e56, +0x00001ca9,0x00003203,0x0004003d,0x00000027, +0x00001e57,0x00001e56,0x0004007c,0x00000006, +0x0000216d,0x00001e57,0x00050095,0x000000ab, +0x00002188,0x00001f64,0x00001e52,0x00050051, +0x00000006,0x00002189,0x00002188,0x00000001, +0x00050051,0x00000006,0x0000218a,0x00002188, +0x00000000,0x00050080,0x00000006,0x0000218f, +0x00001f6b,0x00002189,0x00050050,0x00000007, +0x00002190,0x0000218a,0x0000218f,0x0004007c, +0x00000014,0x00002180,0x00002190,0x00060041, +0x000000db,0x00002178,0x00002180,0x000000da, +0x000000da,0x0005003e,0x00002178,0x0000216d, 0x00000002,0x00000004,0x00050080,0x00000006, -0x00001d64,0x00001bf7,0x000005d0,0x00050095, -0x000000ab,0x000020c8,0x00001e64,0x00001d64, -0x00050051,0x00000006,0x000020c9,0x000020c8, -0x00000001,0x00050051,0x00000006,0x000020ca, -0x000020c8,0x00000000,0x00050080,0x00000006, -0x000020cf,0x00001e6b,0x000020c9,0x00050050, -0x00000007,0x000020d0,0x000020ca,0x000020cf, -0x0004007c,0x00000014,0x000020c0,0x000020d0, -0x00060041,0x000000db,0x000020b8,0x000020c0, -0x000000da,0x000000da,0x0005003e,0x000020b8, -0x00000380,0x00000002,0x00000004,0x00050080, -0x00000006,0x00001d69,0x00001bf7,0x000005d9, -0x00050095,0x000000ab,0x000020e8,0x00001e64, -0x00001d69,0x00050051,0x00000006,0x000020e9, -0x000020e8,0x00000001,0x00050051,0x00000006, -0x000020ea,0x000020e8,0x00000000,0x00050080, -0x00000006,0x000020ef,0x00001e6b,0x000020e9, -0x00050050,0x00000007,0x000020f0,0x000020ea, -0x000020ef,0x0004007c,0x00000014,0x000020e0, -0x000020f0,0x00060041,0x000000db,0x000020d8, -0x000020e0,0x000000da,0x000000da,0x0005003e, -0x000020d8,0x000000a6,0x00000002,0x00000004, -0x00050080,0x00000006,0x00001d6e,0x00001bf7, -0x000005e2,0x00050095,0x000000ab,0x00002108, -0x00001e64,0x00001d6e,0x00050051,0x00000006, -0x00002109,0x00002108,0x00000001,0x00050051, -0x00000006,0x0000210a,0x00002108,0x00000000, -0x00050080,0x00000006,0x0000210f,0x00001e6b, -0x00002109,0x00050050,0x00000007,0x00002110, -0x0000210a,0x0000210f,0x0004007c,0x00000014, -0x00002100,0x00002110,0x00060041,0x000000db, -0x000020f8,0x00002100,0x000000da,0x000000da, -0x0005003e,0x000020f8,0x000000a6,0x00000002, -0x00000004,0x000500b4,0x0000002f,0x00001d73, -0x00001d14,0x0000026d,0x00060050,0x00000395, -0x000031a4,0x00001d73,0x00001d73,0x00001d73, -0x000600a9,0x0000004b,0x000031a5,0x000031a4, -0x0000319b,0x00003115,0x000600a9,0x0000004b, -0x000031a7,0x000031a4,0x00003199,0x00003103, -0x00050041,0x000000fe,0x0000215a,0x000000fc, -0x000000fd,0x0004003d,0x00000006,0x0000215b, -0x0000215a,0x00050084,0x00000006,0x0000215c, -0x0000011f,0x0000215b,0x00050080,0x00000006, -0x0000215d,0x00000107,0x0000215c,0x00050080, -0x00000006,0x00002163,0x0000215b,0x0000319c, -0x00050086,0x00000006,0x00002164,0x00002163, -0x00000101,0x00050084,0x00000006,0x00002156, -0x00000107,0x00002164,0x00050080,0x00000006, -0x00002157,0x0000215d,0x00002156,0x00050084, -0x00000006,0x00002127,0x00000150,0x00000b11, -0x00050080,0x00000006,0x00002128,0x00002157, -0x00002127,0x00050041,0x00000156,0x00002129, -0x000000fc,0x00000154,0x0004003d,0x00000007, -0x0000212a,0x00002129,0x00050051,0x00000027, -0x0000212d,0x000031a7,0x00000000,0x0004007c, -0x00000006,0x0000216a,0x0000212d,0x00050051, -0x00000006,0x00002183,0x0000212a,0x00000000, -0x00050095,0x000000ab,0x00002185,0x00002183, -0x00002128,0x00050051,0x00000006,0x00002186, -0x00002185,0x00000001,0x00050051,0x00000006, -0x00002187,0x00002185,0x00000000,0x00050051, -0x00000006,0x0000218a,0x0000212a,0x00000001, -0x00050080,0x00000006,0x0000218c,0x0000218a, -0x00002186,0x00050050,0x00000007,0x0000218d, -0x00002187,0x0000218c,0x0004007c,0x00000014, -0x0000217d,0x0000218d,0x00060041,0x000000db, -0x00002175,0x0000217d,0x000000da,0x000000da, -0x0005003e,0x00002175,0x0000216a,0x00000002, -0x00000004,0x00050080,0x00000006,0x00002130, -0x00002128,0x0000010a,0x00050051,0x00000027, -0x00002134,0x000031a7,0x00000001,0x0004007c, -0x00000006,0x00002193,0x00002134,0x00050095, -0x000000ab,0x000021ae,0x00002183,0x00002130, -0x00050051,0x00000006,0x000021af,0x000021ae, -0x00000001,0x00050051,0x00000006,0x000021b0, -0x000021ae,0x00000000,0x00050080,0x00000006, -0x000021b5,0x0000218a,0x000021af,0x00050050, -0x00000007,0x000021b6,0x000021b0,0x000021b5, -0x0004007c,0x00000014,0x000021a6,0x000021b6, -0x00060041,0x000000db,0x0000219e,0x000021a6, -0x000000da,0x000000da,0x0005003e,0x0000219e, -0x00002193,0x00000002,0x00000004,0x00050080, -0x00000006,0x00002137,0x00002128,0x00000111, -0x00050051,0x00000027,0x0000213b,0x000031a7, -0x00000002,0x0004007c,0x00000006,0x000021bc, -0x0000213b,0x00050095,0x000000ab,0x000021d7, -0x00002183,0x00002137,0x00050051,0x00000006, -0x000021d8,0x000021d7,0x00000001,0x00050051, -0x00000006,0x000021d9,0x000021d7,0x00000000, -0x00050080,0x00000006,0x000021de,0x0000218a, -0x000021d8,0x00050050,0x00000007,0x000021df, -0x000021d9,0x000021de,0x0004007c,0x00000014, -0x000021cf,0x000021df,0x00060041,0x000000db, -0x000021c7,0x000021cf,0x000000da,0x000000da, -0x0005003e,0x000021c7,0x000021bc,0x00000002, -0x00000004,0x00050080,0x00000006,0x0000213e, -0x00002128,0x00000118,0x00050051,0x00000027, -0x00002142,0x000031a5,0x00000000,0x0004007c, -0x00000006,0x000021e5,0x00002142,0x00050095, -0x000000ab,0x00002200,0x00002183,0x0000213e, -0x00050051,0x00000006,0x00002201,0x00002200, -0x00000001,0x00050051,0x00000006,0x00002202, -0x00002200,0x00000000,0x00050080,0x00000006, -0x00002207,0x0000218a,0x00002201,0x00050050, -0x00000007,0x00002208,0x00002202,0x00002207, -0x0004007c,0x00000014,0x000021f8,0x00002208, -0x00060041,0x000000db,0x000021f0,0x000021f8, -0x000000da,0x000000da,0x0005003e,0x000021f0, -0x000021e5,0x00000002,0x00000004,0x00050080, -0x00000006,0x00002145,0x00002128,0x0000011f, -0x00050051,0x00000027,0x00002149,0x000031a5, -0x00000001,0x0004007c,0x00000006,0x0000220e, -0x00002149,0x00050095,0x000000ab,0x00002229, -0x00002183,0x00002145,0x00050051,0x00000006, -0x0000222a,0x00002229,0x00000001,0x00050051, -0x00000006,0x0000222b,0x00002229,0x00000000, -0x00050080,0x00000006,0x00002230,0x0000218a, -0x0000222a,0x00050050,0x00000007,0x00002231, -0x0000222b,0x00002230,0x0004007c,0x00000014, -0x00002221,0x00002231,0x00060041,0x000000db, -0x00002219,0x00002221,0x000000da,0x000000da, -0x0005003e,0x00002219,0x0000220e,0x00000002, -0x00000004,0x00050080,0x00000006,0x0000214c, -0x00002128,0x00000189,0x00050051,0x00000027, -0x00002150,0x000031a5,0x00000002,0x0004007c, -0x00000006,0x00002237,0x00002150,0x00050095, -0x000000ab,0x00002252,0x00002183,0x0000214c, -0x00050051,0x00000006,0x00002253,0x00002252, -0x00000001,0x00050051,0x00000006,0x00002254, -0x00002252,0x00000000,0x00050080,0x00000006, -0x00002259,0x0000218a,0x00002253,0x00050050, -0x00000007,0x0000225a,0x00002254,0x00002259, -0x0004007c,0x00000014,0x0000224a,0x0000225a, -0x00060041,0x000000db,0x00002242,0x0000224a, -0x000000da,0x000000da,0x0005003e,0x00002242, -0x00002237,0x00000002,0x00000004,0x000300f7, -0x0000229a,0x00000000,0x000300fb,0x000000a6, -0x00002269,0x000200f8,0x00002269,0x000500bc, -0x0000002f,0x000022a1,0x0000212d,0x00002142, -0x000300f7,0x000022a8,0x00000000,0x000400fa, -0x000022a1,0x000022a2,0x000022a8,0x000200f8, -0x000022a2,0x000500bc,0x0000002f,0x000022a7, -0x00002134,0x00002149,0x000200f9,0x000022a8, -0x000200f8,0x000022a8,0x000700f5,0x0000002f, -0x000022a9,0x000022a1,0x00002269,0x000022a7, -0x000022a2,0x000300f7,0x000022b0,0x00000000, -0x000400fa,0x000022a9,0x000022aa,0x000022b0, -0x000200f8,0x000022aa,0x000500bc,0x0000002f, -0x000022af,0x0000213b,0x00002150,0x000200f9, -0x000022b0,0x000200f8,0x000022b0,0x000700f5, -0x0000002f,0x000022b1,0x000022a9,0x000022a8, -0x000022af,0x000022aa,0x000400a8,0x0000002f, -0x000022b2,0x000022b1,0x000300f7,0x0000226e, -0x00000000,0x000400fa,0x000022b2,0x0000226d, -0x0000226e,0x000200f8,0x0000226d,0x000200f9, -0x0000229a,0x000200f8,0x0000226e,0x00050081, -0x0000004b,0x00002271,0x000031a7,0x000031a5, -0x0005008e,0x0000004b,0x00002272,0x00002271, -0x000001ed,0x00050095,0x000000ab,0x000022c2, -0x00002183,0x000000a6,0x00050051,0x00000006, -0x000022c3,0x000022c2,0x00000001,0x00050051, -0x00000006,0x000022c4,0x000022c2,0x00000000, -0x00050080,0x00000006,0x000022c9,0x0000218a, -0x000022c3,0x00050050,0x00000007,0x000022ca, -0x000022c4,0x000022c9,0x0004007c,0x00000014, -0x000022ba,0x000022ca,0x00060041,0x000000db, -0x00002277,0x000022ba,0x000000da,0x000000da, -0x00050051,0x00000027,0x00002279,0x00002272, -0x00000000,0x0004007c,0x00000006,0x000022d0, -0x00002279,0x000500c7,0x00000006,0x000022d2, -0x000022d0,0x00000130,0x000500ab,0x0000002f, -0x000022d3,0x000022d2,0x000000a6,0x000300f7, -0x000022da,0x00000000,0x000400fa,0x000022d3, -0x000022d4,0x000022d7,0x000200f8,0x000022d4, -0x000400c8,0x00000006,0x000022d6,0x000022d0, -0x000200f9,0x000022da,0x000200f8,0x000022d7, -0x000500c5,0x00000006,0x000022d9,0x000022d0, -0x00000130,0x000200f9,0x000022da,0x000200f8, -0x000022da,0x000700f5,0x00000006,0x0000311c, -0x000022d6,0x000022d4,0x000022d9,0x000022d7, -0x000700ed,0x00000006,0x0000227b,0x00002277, -0x000000b0,0x000000a6,0x0000311c,0x00060041, -0x000000db,0x0000227d,0x000022ba,0x000000da, -0x00000154,0x00050051,0x00000027,0x0000227f, -0x00002272,0x00000001,0x0004007c,0x00000006, -0x000022e1,0x0000227f,0x000500c7,0x00000006, -0x000022e3,0x000022e1,0x00000130,0x000500ab, -0x0000002f,0x000022e4,0x000022e3,0x000000a6, -0x000300f7,0x000022eb,0x00000000,0x000400fa, -0x000022e4,0x000022e5,0x000022e8,0x000200f8, -0x000022e5,0x000400c8,0x00000006,0x000022e7, -0x000022e1,0x000200f9,0x000022eb,0x000200f8, -0x000022e8,0x000500c5,0x00000006,0x000022ea, -0x000022e1,0x00000130,0x000200f9,0x000022eb, -0x000200f8,0x000022eb,0x000700f5,0x00000006, -0x0000311d,0x000022e7,0x000022e5,0x000022ea, -0x000022e8,0x000700ed,0x00000006,0x00002281, -0x0000227d,0x000000b0,0x000000a6,0x0000311d, -0x00060041,0x000000db,0x00002283,0x000022ba, -0x000000da,0x00000205,0x00050051,0x00000027, -0x00002285,0x00002272,0x00000002,0x0004007c, -0x00000006,0x000022f2,0x00002285,0x000500c7, -0x00000006,0x000022f4,0x000022f2,0x00000130, -0x000500ab,0x0000002f,0x000022f5,0x000022f4, -0x000000a6,0x000300f7,0x000022fc,0x00000000, -0x000400fa,0x000022f5,0x000022f6,0x000022f9, -0x000200f8,0x000022f6,0x000400c8,0x00000006, -0x000022f8,0x000022f2,0x000200f9,0x000022fc, -0x000200f8,0x000022f9,0x000500c5,0x00000006, -0x000022fb,0x000022f2,0x00000130,0x000200f9, -0x000022fc,0x000200f8,0x000022fc,0x000700f5, -0x00000006,0x0000311e,0x000022f8,0x000022f6, -0x000022fb,0x000022f9,0x000700ed,0x00000006, -0x00002287,0x00002283,0x000000b0,0x000000a6, -0x0000311e,0x00060041,0x000000db,0x00002289, -0x000022ba,0x000000da,0x0000020d,0x000300f7, -0x0000230d,0x00000000,0x000400fa,0x000022d3, -0x00002307,0x0000230a,0x000200f8,0x00002307, -0x000400c8,0x00000006,0x00002309,0x000022d0, -0x000200f9,0x0000230d,0x000200f8,0x0000230a, -0x000500c5,0x00000006,0x0000230c,0x000022d0, -0x00000130,0x000200f9,0x0000230d,0x000200f8, -0x0000230d,0x000700f5,0x00000006,0x0000311f, -0x00002309,0x00002307,0x0000230c,0x0000230a, -0x000700ef,0x00000006,0x0000228d,0x00002289, -0x000000b0,0x000000a6,0x0000311f,0x00060041, -0x000000db,0x0000228f,0x000022ba,0x000000da, -0x00000215,0x000300f7,0x0000231e,0x00000000, -0x000400fa,0x000022e4,0x00002318,0x0000231b, -0x000200f8,0x00002318,0x000400c8,0x00000006, -0x0000231a,0x000022e1,0x000200f9,0x0000231e, -0x000200f8,0x0000231b,0x000500c5,0x00000006, -0x0000231d,0x000022e1,0x00000130,0x000200f9, -0x0000231e,0x000200f8,0x0000231e,0x000700f5, -0x00000006,0x00003120,0x0000231a,0x00002318, -0x0000231d,0x0000231b,0x000700ef,0x00000006, -0x00002293,0x0000228f,0x000000b0,0x000000a6, -0x00003120,0x00060041,0x000000db,0x00002295, -0x000022ba,0x000000da,0x0000021d,0x000300f7, -0x0000232f,0x00000000,0x000400fa,0x000022f5, -0x00002329,0x0000232c,0x000200f8,0x00002329, -0x000400c8,0x00000006,0x0000232b,0x000022f2, -0x000200f9,0x0000232f,0x000200f8,0x0000232c, -0x000500c5,0x00000006,0x0000232e,0x000022f2, -0x00000130,0x000200f9,0x0000232f,0x000200f8, -0x0000232f,0x000700f5,0x00000006,0x00003121, -0x0000232b,0x00002329,0x0000232e,0x0000232c, -0x000700ef,0x00000006,0x00002299,0x00002295, -0x000000b0,0x000000a6,0x00003121,0x000200f9, -0x0000229a,0x000200f8,0x0000229a,0x000200f9, -0x00000b9e,0x000200f8,0x00000ba2,0x000500aa, -0x0000002f,0x00000ba5,0x00000b13,0x000002b7, -0x000300f7,0x00000ba7,0x00000000,0x000400fa, -0x00000ba5,0x00000ba6,0x00000bab,0x000200f8, -0x00000ba6,0x00050041,0x000000fe,0x000023e4, -0x000000fc,0x000000fd,0x0004003d,0x00000006, -0x000023e5,0x000023e4,0x00050084,0x00000006, -0x000023e6,0x0000011f,0x000023e5,0x00050080, -0x00000006,0x000023e7,0x00000107,0x000023e6, -0x00050080,0x00000006,0x000023ed,0x000023e5, -0x0000319c,0x00050086,0x00000006,0x000023ee, -0x000023ed,0x00000101,0x00050084,0x00000006, -0x000023e0,0x00000107,0x000023ee,0x00050080, -0x00000006,0x000023e1,0x000023e7,0x000023e0, -0x00050084,0x00000006,0x000023b5,0x00000150, -0x00000b11,0x00050080,0x00000006,0x000023b6, -0x000023e1,0x000023b5,0x00050041,0x00000156, -0x000023b7,0x000000fc,0x00000154,0x0004003d, -0x00000007,0x000023b8,0x000023b7,0x00050051, -0x00000006,0x00002405,0x000023b8,0x00000000, -0x00050095,0x000000ab,0x00002407,0x00002405, -0x000023b6,0x00050051,0x00000006,0x00002408, -0x00002407,0x00000001,0x00050051,0x00000006, -0x00002409,0x00002407,0x00000000,0x00050051, -0x00000006,0x0000240c,0x000023b8,0x00000001, -0x00050080,0x00000006,0x0000240e,0x0000240c, -0x00002408,0x00050050,0x00000007,0x0000240f, -0x00002409,0x0000240e,0x0004007c,0x00000014, -0x000023ff,0x0000240f,0x00060041,0x000000db, -0x000023f6,0x000023ff,0x000000da,0x000000da, -0x0006003d,0x00000006,0x000023f7,0x000023f6, -0x00000002,0x00000004,0x0004007c,0x00000027, -0x000023bb,0x000023f7,0x00050080,0x00000006, -0x000023bd,0x000023b6,0x0000010a,0x00050095, -0x000000ab,0x00002428,0x00002405,0x000023bd, -0x00050051,0x00000006,0x00002429,0x00002428, -0x00000001,0x00050051,0x00000006,0x0000242a, -0x00002428,0x00000000,0x00050080,0x00000006, -0x0000242f,0x0000240c,0x00002429,0x00050050, -0x00000007,0x00002430,0x0000242a,0x0000242f, -0x0004007c,0x00000014,0x00002420,0x00002430, -0x00060041,0x000000db,0x00002417,0x00002420, +0x00001e5b,0x00003203,0x00000154,0x000200f9, +0x00001e28,0x000200f8,0x00001e5c,0x00050080, +0x00000006,0x00001e5e,0x00001cf7,0x000005c6, +0x00050095,0x000000ab,0x000021a8,0x00001f64, +0x00001e5e,0x00050051,0x00000006,0x000021a9, +0x000021a8,0x00000001,0x00050051,0x00000006, +0x000021aa,0x000021a8,0x00000000,0x00050080, +0x00000006,0x000021af,0x00001f6b,0x000021a9, +0x00050050,0x00000007,0x000021b0,0x000021aa, +0x000021af,0x0004007c,0x00000014,0x000021a0, +0x000021b0,0x00060041,0x000000db,0x00002198, +0x000021a0,0x000000da,0x000000da,0x0005003e, +0x00002198,0x00000b11,0x00000002,0x00000004, +0x00050080,0x00000006,0x00001e64,0x00001cf7, +0x000005d0,0x00050095,0x000000ab,0x000021c8, +0x00001f64,0x00001e64,0x00050051,0x00000006, +0x000021c9,0x000021c8,0x00000001,0x00050051, +0x00000006,0x000021ca,0x000021c8,0x00000000, +0x00050080,0x00000006,0x000021cf,0x00001f6b, +0x000021c9,0x00050050,0x00000007,0x000021d0, +0x000021ca,0x000021cf,0x0004007c,0x00000014, +0x000021c0,0x000021d0,0x00060041,0x000000db, +0x000021b8,0x000021c0,0x000000da,0x000000da, +0x0005003e,0x000021b8,0x00000380,0x00000002, +0x00000004,0x00050080,0x00000006,0x00001e69, +0x00001cf7,0x000005d9,0x00050095,0x000000ab, +0x000021e8,0x00001f64,0x00001e69,0x00050051, +0x00000006,0x000021e9,0x000021e8,0x00000001, +0x00050051,0x00000006,0x000021ea,0x000021e8, +0x00000000,0x00050080,0x00000006,0x000021ef, +0x00001f6b,0x000021e9,0x00050050,0x00000007, +0x000021f0,0x000021ea,0x000021ef,0x0004007c, +0x00000014,0x000021e0,0x000021f0,0x00060041, +0x000000db,0x000021d8,0x000021e0,0x000000da, +0x000000da,0x0005003e,0x000021d8,0x000000a6, +0x00000002,0x00000004,0x00050080,0x00000006, +0x00001e6e,0x00001cf7,0x000005e2,0x00050095, +0x000000ab,0x00002208,0x00001f64,0x00001e6e, +0x00050051,0x00000006,0x00002209,0x00002208, +0x00000001,0x00050051,0x00000006,0x0000220a, +0x00002208,0x00000000,0x00050080,0x00000006, +0x0000220f,0x00001f6b,0x00002209,0x00050050, +0x00000007,0x00002210,0x0000220a,0x0000220f, +0x0004007c,0x00000014,0x00002200,0x00002210, +0x00060041,0x000000db,0x000021f8,0x00002200, +0x000000da,0x000000da,0x0005003e,0x000021f8, +0x000000a6,0x00000002,0x00000004,0x000500b4, +0x0000002f,0x00001e73,0x00001e14,0x0000026d, +0x00060050,0x00000395,0x000032b0,0x00001e73, +0x00001e73,0x00001e73,0x000600a9,0x0000004b, +0x000032b1,0x000032b0,0x000032a7,0x00003221, +0x000600a9,0x0000004b,0x000032b3,0x000032b0, +0x000032a5,0x0000320f,0x00050041,0x000000fe, +0x0000225a,0x000000fc,0x000000fd,0x0004003d, +0x00000006,0x0000225b,0x0000225a,0x00050084, +0x00000006,0x0000225c,0x0000011f,0x0000225b, +0x00050080,0x00000006,0x0000225d,0x00000107, +0x0000225c,0x00050080,0x00000006,0x00002263, +0x0000225b,0x000032a8,0x00050086,0x00000006, +0x00002264,0x00002263,0x00000101,0x00050084, +0x00000006,0x00002256,0x00000107,0x00002264, +0x00050080,0x00000006,0x00002257,0x0000225d, +0x00002256,0x00050084,0x00000006,0x00002227, +0x00000150,0x00000b11,0x00050080,0x00000006, +0x00002228,0x00002257,0x00002227,0x00050041, +0x00000156,0x00002229,0x000000fc,0x00000154, +0x0004003d,0x00000007,0x0000222a,0x00002229, +0x00050051,0x00000027,0x0000222d,0x000032b3, +0x00000000,0x0004007c,0x00000006,0x0000226a, +0x0000222d,0x00050051,0x00000006,0x00002283, +0x0000222a,0x00000000,0x00050095,0x000000ab, +0x00002285,0x00002283,0x00002228,0x00050051, +0x00000006,0x00002286,0x00002285,0x00000001, +0x00050051,0x00000006,0x00002287,0x00002285, +0x00000000,0x00050051,0x00000006,0x0000228a, +0x0000222a,0x00000001,0x00050080,0x00000006, +0x0000228c,0x0000228a,0x00002286,0x00050050, +0x00000007,0x0000228d,0x00002287,0x0000228c, +0x0004007c,0x00000014,0x0000227d,0x0000228d, +0x00060041,0x000000db,0x00002275,0x0000227d, +0x000000da,0x000000da,0x0005003e,0x00002275, +0x0000226a,0x00000002,0x00000004,0x00050080, +0x00000006,0x00002230,0x00002228,0x0000010a, +0x00050051,0x00000027,0x00002234,0x000032b3, +0x00000001,0x0004007c,0x00000006,0x00002293, +0x00002234,0x00050095,0x000000ab,0x000022ae, +0x00002283,0x00002230,0x00050051,0x00000006, +0x000022af,0x000022ae,0x00000001,0x00050051, +0x00000006,0x000022b0,0x000022ae,0x00000000, +0x00050080,0x00000006,0x000022b5,0x0000228a, +0x000022af,0x00050050,0x00000007,0x000022b6, +0x000022b0,0x000022b5,0x0004007c,0x00000014, +0x000022a6,0x000022b6,0x00060041,0x000000db, +0x0000229e,0x000022a6,0x000000da,0x000000da, +0x0005003e,0x0000229e,0x00002293,0x00000002, +0x00000004,0x00050080,0x00000006,0x00002237, +0x00002228,0x00000111,0x00050051,0x00000027, +0x0000223b,0x000032b3,0x00000002,0x0004007c, +0x00000006,0x000022bc,0x0000223b,0x00050095, +0x000000ab,0x000022d7,0x00002283,0x00002237, +0x00050051,0x00000006,0x000022d8,0x000022d7, +0x00000001,0x00050051,0x00000006,0x000022d9, +0x000022d7,0x00000000,0x00050080,0x00000006, +0x000022de,0x0000228a,0x000022d8,0x00050050, +0x00000007,0x000022df,0x000022d9,0x000022de, +0x0004007c,0x00000014,0x000022cf,0x000022df, +0x00060041,0x000000db,0x000022c7,0x000022cf, +0x000000da,0x000000da,0x0005003e,0x000022c7, +0x000022bc,0x00000002,0x00000004,0x00050080, +0x00000006,0x0000223e,0x00002228,0x00000118, +0x00050051,0x00000027,0x00002242,0x000032b1, +0x00000000,0x0004007c,0x00000006,0x000022e5, +0x00002242,0x00050095,0x000000ab,0x00002300, +0x00002283,0x0000223e,0x00050051,0x00000006, +0x00002301,0x00002300,0x00000001,0x00050051, +0x00000006,0x00002302,0x00002300,0x00000000, +0x00050080,0x00000006,0x00002307,0x0000228a, +0x00002301,0x00050050,0x00000007,0x00002308, +0x00002302,0x00002307,0x0004007c,0x00000014, +0x000022f8,0x00002308,0x00060041,0x000000db, +0x000022f0,0x000022f8,0x000000da,0x000000da, +0x0005003e,0x000022f0,0x000022e5,0x00000002, +0x00000004,0x00050080,0x00000006,0x00002245, +0x00002228,0x0000011f,0x00050051,0x00000027, +0x00002249,0x000032b1,0x00000001,0x0004007c, +0x00000006,0x0000230e,0x00002249,0x00050095, +0x000000ab,0x00002329,0x00002283,0x00002245, +0x00050051,0x00000006,0x0000232a,0x00002329, +0x00000001,0x00050051,0x00000006,0x0000232b, +0x00002329,0x00000000,0x00050080,0x00000006, +0x00002330,0x0000228a,0x0000232a,0x00050050, +0x00000007,0x00002331,0x0000232b,0x00002330, +0x0004007c,0x00000014,0x00002321,0x00002331, +0x00060041,0x000000db,0x00002319,0x00002321, +0x000000da,0x000000da,0x0005003e,0x00002319, +0x0000230e,0x00000002,0x00000004,0x00050080, +0x00000006,0x0000224c,0x00002228,0x00000189, +0x00050051,0x00000027,0x00002250,0x000032b1, +0x00000002,0x0004007c,0x00000006,0x00002337, +0x00002250,0x00050095,0x000000ab,0x00002352, +0x00002283,0x0000224c,0x00050051,0x00000006, +0x00002353,0x00002352,0x00000001,0x00050051, +0x00000006,0x00002354,0x00002352,0x00000000, +0x00050080,0x00000006,0x00002359,0x0000228a, +0x00002353,0x00050050,0x00000007,0x0000235a, +0x00002354,0x00002359,0x0004007c,0x00000014, +0x0000234a,0x0000235a,0x00060041,0x000000db, +0x00002342,0x0000234a,0x000000da,0x000000da, +0x0005003e,0x00002342,0x00002337,0x00000002, +0x00000004,0x000300f7,0x0000239a,0x00000000, +0x000300fb,0x000000a6,0x00002369,0x000200f8, +0x00002369,0x000500bc,0x0000002f,0x000023a1, +0x0000222d,0x00002242,0x000300f7,0x000023a8, +0x00000000,0x000400fa,0x000023a1,0x000023a2, +0x000023a8,0x000200f8,0x000023a2,0x000500bc, +0x0000002f,0x000023a7,0x00002234,0x00002249, +0x000200f9,0x000023a8,0x000200f8,0x000023a8, +0x000700f5,0x0000002f,0x000023a9,0x000023a1, +0x00002369,0x000023a7,0x000023a2,0x000300f7, +0x000023b0,0x00000000,0x000400fa,0x000023a9, +0x000023aa,0x000023b0,0x000200f8,0x000023aa, +0x000500bc,0x0000002f,0x000023af,0x0000223b, +0x00002250,0x000200f9,0x000023b0,0x000200f8, +0x000023b0,0x000700f5,0x0000002f,0x000023b1, +0x000023a9,0x000023a8,0x000023af,0x000023aa, +0x000400a8,0x0000002f,0x000023b2,0x000023b1, +0x000300f7,0x0000236e,0x00000000,0x000400fa, +0x000023b2,0x0000236d,0x0000236e,0x000200f8, +0x0000236d,0x000200f9,0x0000239a,0x000200f8, +0x0000236e,0x00050081,0x0000004b,0x00002371, +0x000032b3,0x000032b1,0x0005008e,0x0000004b, +0x00002372,0x00002371,0x000001ed,0x00050095, +0x000000ab,0x000023c2,0x00002283,0x000000a6, +0x00050051,0x00000006,0x000023c3,0x000023c2, +0x00000001,0x00050051,0x00000006,0x000023c4, +0x000023c2,0x00000000,0x00050080,0x00000006, +0x000023c9,0x0000228a,0x000023c3,0x00050050, +0x00000007,0x000023ca,0x000023c4,0x000023c9, +0x0004007c,0x00000014,0x000023ba,0x000023ca, +0x00060041,0x000000db,0x00002377,0x000023ba, +0x000000da,0x000000da,0x00050051,0x00000027, +0x00002379,0x00002372,0x00000000,0x0004007c, +0x00000006,0x000023d0,0x00002379,0x000500c7, +0x00000006,0x000023d2,0x000023d0,0x00000130, +0x000500ab,0x0000002f,0x000023d3,0x000023d2, +0x000000a6,0x000300f7,0x000023da,0x00000000, +0x000400fa,0x000023d3,0x000023d4,0x000023d7, +0x000200f8,0x000023d4,0x000400c8,0x00000006, +0x000023d6,0x000023d0,0x000200f9,0x000023da, +0x000200f8,0x000023d7,0x000500c5,0x00000006, +0x000023d9,0x000023d0,0x00000130,0x000200f9, +0x000023da,0x000200f8,0x000023da,0x000700f5, +0x00000006,0x00003228,0x000023d6,0x000023d4, +0x000023d9,0x000023d7,0x000700ed,0x00000006, +0x0000237b,0x00002377,0x000000b0,0x000000a6, +0x00003228,0x00060041,0x000000db,0x0000237d, +0x000023ba,0x000000da,0x00000154,0x00050051, +0x00000027,0x0000237f,0x00002372,0x00000001, +0x0004007c,0x00000006,0x000023e1,0x0000237f, +0x000500c7,0x00000006,0x000023e3,0x000023e1, +0x00000130,0x000500ab,0x0000002f,0x000023e4, +0x000023e3,0x000000a6,0x000300f7,0x000023eb, +0x00000000,0x000400fa,0x000023e4,0x000023e5, +0x000023e8,0x000200f8,0x000023e5,0x000400c8, +0x00000006,0x000023e7,0x000023e1,0x000200f9, +0x000023eb,0x000200f8,0x000023e8,0x000500c5, +0x00000006,0x000023ea,0x000023e1,0x00000130, +0x000200f9,0x000023eb,0x000200f8,0x000023eb, +0x000700f5,0x00000006,0x00003229,0x000023e7, +0x000023e5,0x000023ea,0x000023e8,0x000700ed, +0x00000006,0x00002381,0x0000237d,0x000000b0, +0x000000a6,0x00003229,0x00060041,0x000000db, +0x00002383,0x000023ba,0x000000da,0x00000205, +0x00050051,0x00000027,0x00002385,0x00002372, +0x00000002,0x0004007c,0x00000006,0x000023f2, +0x00002385,0x000500c7,0x00000006,0x000023f4, +0x000023f2,0x00000130,0x000500ab,0x0000002f, +0x000023f5,0x000023f4,0x000000a6,0x000300f7, +0x000023fc,0x00000000,0x000400fa,0x000023f5, +0x000023f6,0x000023f9,0x000200f8,0x000023f6, +0x000400c8,0x00000006,0x000023f8,0x000023f2, +0x000200f9,0x000023fc,0x000200f8,0x000023f9, +0x000500c5,0x00000006,0x000023fb,0x000023f2, +0x00000130,0x000200f9,0x000023fc,0x000200f8, +0x000023fc,0x000700f5,0x00000006,0x0000322a, +0x000023f8,0x000023f6,0x000023fb,0x000023f9, +0x000700ed,0x00000006,0x00002387,0x00002383, +0x000000b0,0x000000a6,0x0000322a,0x00060041, +0x000000db,0x00002389,0x000023ba,0x000000da, +0x0000020d,0x000300f7,0x0000240d,0x00000000, +0x000400fa,0x000023d3,0x00002407,0x0000240a, +0x000200f8,0x00002407,0x000400c8,0x00000006, +0x00002409,0x000023d0,0x000200f9,0x0000240d, +0x000200f8,0x0000240a,0x000500c5,0x00000006, +0x0000240c,0x000023d0,0x00000130,0x000200f9, +0x0000240d,0x000200f8,0x0000240d,0x000700f5, +0x00000006,0x0000322b,0x00002409,0x00002407, +0x0000240c,0x0000240a,0x000700ef,0x00000006, +0x0000238d,0x00002389,0x000000b0,0x000000a6, +0x0000322b,0x00060041,0x000000db,0x0000238f, +0x000023ba,0x000000da,0x00000215,0x000300f7, +0x0000241e,0x00000000,0x000400fa,0x000023e4, +0x00002418,0x0000241b,0x000200f8,0x00002418, +0x000400c8,0x00000006,0x0000241a,0x000023e1, +0x000200f9,0x0000241e,0x000200f8,0x0000241b, +0x000500c5,0x00000006,0x0000241d,0x000023e1, +0x00000130,0x000200f9,0x0000241e,0x000200f8, +0x0000241e,0x000700f5,0x00000006,0x0000322c, +0x0000241a,0x00002418,0x0000241d,0x0000241b, +0x000700ef,0x00000006,0x00002393,0x0000238f, +0x000000b0,0x000000a6,0x0000322c,0x00060041, +0x000000db,0x00002395,0x000023ba,0x000000da, +0x0000021d,0x000300f7,0x0000242f,0x00000000, +0x000400fa,0x000023f5,0x00002429,0x0000242c, +0x000200f8,0x00002429,0x000400c8,0x00000006, +0x0000242b,0x000023f2,0x000200f9,0x0000242f, +0x000200f8,0x0000242c,0x000500c5,0x00000006, +0x0000242e,0x000023f2,0x00000130,0x000200f9, +0x0000242f,0x000200f8,0x0000242f,0x000700f5, +0x00000006,0x0000322d,0x0000242b,0x00002429, +0x0000242e,0x0000242c,0x000700ef,0x00000006, +0x00002399,0x00002395,0x000000b0,0x000000a6, +0x0000322d,0x000200f9,0x0000239a,0x000200f8, +0x0000239a,0x000200f9,0x00000bdb,0x000200f8, +0x00000bdf,0x000500aa,0x0000002f,0x00000be2, +0x00000b13,0x000002b7,0x000300f7,0x00000be4, +0x00000000,0x000400fa,0x00000be2,0x00000be3, +0x00000be8,0x000200f8,0x00000be3,0x00050041, +0x000000fe,0x000024e4,0x000000fc,0x000000fd, +0x0004003d,0x00000006,0x000024e5,0x000024e4, +0x00050084,0x00000006,0x000024e6,0x0000011f, +0x000024e5,0x00050080,0x00000006,0x000024e7, +0x00000107,0x000024e6,0x00050080,0x00000006, +0x000024ed,0x000024e5,0x000032a8,0x00050086, +0x00000006,0x000024ee,0x000024ed,0x00000101, +0x00050084,0x00000006,0x000024e0,0x00000107, +0x000024ee,0x00050080,0x00000006,0x000024e1, +0x000024e7,0x000024e0,0x00050084,0x00000006, +0x000024b5,0x00000150,0x00000b11,0x00050080, +0x00000006,0x000024b6,0x000024e1,0x000024b5, +0x00050041,0x00000156,0x000024b7,0x000000fc, +0x00000154,0x0004003d,0x00000007,0x000024b8, +0x000024b7,0x00050051,0x00000006,0x00002505, +0x000024b8,0x00000000,0x00050095,0x000000ab, +0x00002507,0x00002505,0x000024b6,0x00050051, +0x00000006,0x00002508,0x00002507,0x00000001, +0x00050051,0x00000006,0x00002509,0x00002507, +0x00000000,0x00050051,0x00000006,0x0000250c, +0x000024b8,0x00000001,0x00050080,0x00000006, +0x0000250e,0x0000250c,0x00002508,0x00050050, +0x00000007,0x0000250f,0x00002509,0x0000250e, +0x0004007c,0x00000014,0x000024ff,0x0000250f, +0x00060041,0x000000db,0x000024f6,0x000024ff, 0x000000da,0x000000da,0x0006003d,0x00000006, -0x00002418,0x00002417,0x00000002,0x00000004, -0x0004007c,0x00000027,0x000023c1,0x00002418, -0x00050080,0x00000006,0x000023c3,0x000023b6, -0x00000111,0x00050095,0x000000ab,0x00002449, -0x00002405,0x000023c3,0x00050051,0x00000006, -0x0000244a,0x00002449,0x00000001,0x00050051, -0x00000006,0x0000244b,0x00002449,0x00000000, -0x00050080,0x00000006,0x00002450,0x0000240c, -0x0000244a,0x00050050,0x00000007,0x00002451, -0x0000244b,0x00002450,0x0004007c,0x00000014, -0x00002441,0x00002451,0x00060041,0x000000db, -0x00002438,0x00002441,0x000000da,0x000000da, -0x0006003d,0x00000006,0x00002439,0x00002438, -0x00000002,0x00000004,0x0004007c,0x00000027, -0x000023c7,0x00002439,0x00060050,0x0000004b, -0x000023c8,0x000023bb,0x000023c1,0x000023c7, -0x00050080,0x00000006,0x000023ca,0x000023b6, -0x00000118,0x00050095,0x000000ab,0x0000246a, -0x00002405,0x000023ca,0x00050051,0x00000006, -0x0000246b,0x0000246a,0x00000001,0x00050051, -0x00000006,0x0000246c,0x0000246a,0x00000000, -0x00050080,0x00000006,0x00002471,0x0000240c, -0x0000246b,0x00050050,0x00000007,0x00002472, -0x0000246c,0x00002471,0x0004007c,0x00000014, -0x00002462,0x00002472,0x00060041,0x000000db, -0x00002459,0x00002462,0x000000da,0x000000da, -0x0006003d,0x00000006,0x0000245a,0x00002459, +0x000024f7,0x000024f6,0x00000002,0x00000004, +0x0004007c,0x00000027,0x000024bb,0x000024f7, +0x00050080,0x00000006,0x000024bd,0x000024b6, +0x0000010a,0x00050095,0x000000ab,0x00002528, +0x00002505,0x000024bd,0x00050051,0x00000006, +0x00002529,0x00002528,0x00000001,0x00050051, +0x00000006,0x0000252a,0x00002528,0x00000000, +0x00050080,0x00000006,0x0000252f,0x0000250c, +0x00002529,0x00050050,0x00000007,0x00002530, +0x0000252a,0x0000252f,0x0004007c,0x00000014, +0x00002520,0x00002530,0x00060041,0x000000db, +0x00002517,0x00002520,0x000000da,0x000000da, +0x0006003d,0x00000006,0x00002518,0x00002517, 0x00000002,0x00000004,0x0004007c,0x00000027, -0x000023ce,0x0000245a,0x00050080,0x00000006, -0x000023d0,0x000023b6,0x0000011f,0x00050095, -0x000000ab,0x0000248b,0x00002405,0x000023d0, -0x00050051,0x00000006,0x0000248c,0x0000248b, -0x00000001,0x00050051,0x00000006,0x0000248d, -0x0000248b,0x00000000,0x00050080,0x00000006, -0x00002492,0x0000240c,0x0000248c,0x00050050, -0x00000007,0x00002493,0x0000248d,0x00002492, -0x0004007c,0x00000014,0x00002483,0x00002493, -0x00060041,0x000000db,0x0000247a,0x00002483, +0x000024c1,0x00002518,0x00050080,0x00000006, +0x000024c3,0x000024b6,0x00000111,0x00050095, +0x000000ab,0x00002549,0x00002505,0x000024c3, +0x00050051,0x00000006,0x0000254a,0x00002549, +0x00000001,0x00050051,0x00000006,0x0000254b, +0x00002549,0x00000000,0x00050080,0x00000006, +0x00002550,0x0000250c,0x0000254a,0x00050050, +0x00000007,0x00002551,0x0000254b,0x00002550, +0x0004007c,0x00000014,0x00002541,0x00002551, +0x00060041,0x000000db,0x00002538,0x00002541, 0x000000da,0x000000da,0x0006003d,0x00000006, -0x0000247b,0x0000247a,0x00000002,0x00000004, -0x0004007c,0x00000027,0x000023d4,0x0000247b, -0x00050080,0x00000006,0x000023d6,0x000023b6, -0x00000189,0x00050095,0x000000ab,0x000024ac, -0x00002405,0x000023d6,0x00050051,0x00000006, -0x000024ad,0x000024ac,0x00000001,0x00050051, -0x00000006,0x000024ae,0x000024ac,0x00000000, -0x00050080,0x00000006,0x000024b3,0x0000240c, -0x000024ad,0x00050050,0x00000007,0x000024b4, -0x000024ae,0x000024b3,0x0004007c,0x00000014, -0x000024a4,0x000024b4,0x00060041,0x000000db, -0x0000249b,0x000024a4,0x000000da,0x000000da, -0x0006003d,0x00000006,0x0000249c,0x0000249b, +0x00002539,0x00002538,0x00000002,0x00000004, +0x0004007c,0x00000027,0x000024c7,0x00002539, +0x00060050,0x0000004b,0x000024c8,0x000024bb, +0x000024c1,0x000024c7,0x00050080,0x00000006, +0x000024ca,0x000024b6,0x00000118,0x00050095, +0x000000ab,0x0000256a,0x00002505,0x000024ca, +0x00050051,0x00000006,0x0000256b,0x0000256a, +0x00000001,0x00050051,0x00000006,0x0000256c, +0x0000256a,0x00000000,0x00050080,0x00000006, +0x00002571,0x0000250c,0x0000256b,0x00050050, +0x00000007,0x00002572,0x0000256c,0x00002571, +0x0004007c,0x00000014,0x00002562,0x00002572, +0x00060041,0x000000db,0x00002559,0x00002562, +0x000000da,0x000000da,0x0006003d,0x00000006, +0x0000255a,0x00002559,0x00000002,0x00000004, +0x0004007c,0x00000027,0x000024ce,0x0000255a, +0x00050080,0x00000006,0x000024d0,0x000024b6, +0x0000011f,0x00050095,0x000000ab,0x0000258b, +0x00002505,0x000024d0,0x00050051,0x00000006, +0x0000258c,0x0000258b,0x00000001,0x00050051, +0x00000006,0x0000258d,0x0000258b,0x00000000, +0x00050080,0x00000006,0x00002592,0x0000250c, +0x0000258c,0x00050050,0x00000007,0x00002593, +0x0000258d,0x00002592,0x0004007c,0x00000014, +0x00002583,0x00002593,0x00060041,0x000000db, +0x0000257a,0x00002583,0x000000da,0x000000da, +0x0006003d,0x00000006,0x0000257b,0x0000257a, 0x00000002,0x00000004,0x0004007c,0x00000027, -0x000023da,0x0000249c,0x00060050,0x0000004b, -0x000023db,0x000023ce,0x000023d4,0x000023da, -0x000500bc,0x0000002f,0x000024bb,0x000023bb, -0x000023ce,0x000300f7,0x000024c2,0x00000000, -0x000400fa,0x000024bb,0x000024bc,0x000024c2, -0x000200f8,0x000024bc,0x000500bc,0x0000002f, -0x000024c1,0x000023c1,0x000023d4,0x000200f9, -0x000024c2,0x000200f8,0x000024c2,0x000700f5, -0x0000002f,0x000024c3,0x000024bb,0x00000ba6, -0x000024c1,0x000024bc,0x000300f7,0x000024ca, -0x00000000,0x000400fa,0x000024c3,0x000024c4, -0x000024ca,0x000200f8,0x000024c4,0x000500bc, -0x0000002f,0x000024c9,0x000023c7,0x000023da, -0x000200f9,0x000024ca,0x000200f8,0x000024ca, -0x000700f5,0x0000002f,0x000024cb,0x000024c3, -0x000024c2,0x000024c9,0x000024c4,0x000300f7, -0x00002394,0x00000000,0x000400fa,0x000024cb, -0x00002358,0x00002394,0x000200f8,0x00002358, -0x00050095,0x000000ab,0x000024dc,0x00002405, -0x000000a6,0x00050051,0x00000006,0x000024dd, -0x000024dc,0x00000001,0x00050051,0x00000006, -0x000024de,0x000024dc,0x00000000,0x00050080, -0x00000006,0x000024e3,0x0000240c,0x000024dd, -0x00050050,0x00000007,0x000024e4,0x000024de, -0x000024e3,0x0004007c,0x00000014,0x000024d4, -0x000024e4,0x00060041,0x000000db,0x0000235d, -0x000024d4,0x000000da,0x000000da,0x0006003d, -0x00000006,0x0000235e,0x0000235d,0x00000002, -0x00000004,0x000500c7,0x00000006,0x000024e9, -0x0000235e,0x00000130,0x000500ab,0x0000002f, -0x000024ea,0x000024e9,0x000000a6,0x000300f7, -0x000024f1,0x00000000,0x000400fa,0x000024ea, -0x000024eb,0x000024ee,0x000200f8,0x000024eb, -0x000500c7,0x00000006,0x000024ed,0x0000235e, -0x00000145,0x000200f9,0x000024f1,0x000200f8, -0x000024ee,0x000400c8,0x00000006,0x000024f0, -0x0000235e,0x000200f9,0x000024f1,0x000200f8, -0x000024f1,0x000700f5,0x00000006,0x000030db, -0x000024ed,0x000024eb,0x000024f0,0x000024ee, -0x0004007c,0x00000027,0x000024f3,0x000030db, -0x00060041,0x000000db,0x00002361,0x000024d4, -0x000000da,0x00000154,0x0006003d,0x00000006, -0x00002362,0x00002361,0x00000002,0x00000004, -0x000500c7,0x00000006,0x000024f8,0x00002362, -0x00000130,0x000500ab,0x0000002f,0x000024f9, -0x000024f8,0x000000a6,0x000300f7,0x00002500, -0x00000000,0x000400fa,0x000024f9,0x000024fa, -0x000024fd,0x000200f8,0x000024fa,0x000500c7, -0x00000006,0x000024fc,0x00002362,0x00000145, -0x000200f9,0x00002500,0x000200f8,0x000024fd, -0x000400c8,0x00000006,0x000024ff,0x00002362, -0x000200f9,0x00002500,0x000200f8,0x00002500, -0x000700f5,0x00000006,0x000030dc,0x000024fc, -0x000024fa,0x000024ff,0x000024fd,0x0004007c, -0x00000027,0x00002502,0x000030dc,0x00060041, -0x000000db,0x00002365,0x000024d4,0x000000da, -0x00000205,0x0006003d,0x00000006,0x00002366, -0x00002365,0x00000002,0x00000004,0x000500c7, -0x00000006,0x00002507,0x00002366,0x00000130, -0x000500ab,0x0000002f,0x00002508,0x00002507, -0x000000a6,0x000300f7,0x0000250f,0x00000000, -0x000400fa,0x00002508,0x00002509,0x0000250c, -0x000200f8,0x00002509,0x000500c7,0x00000006, -0x0000250b,0x00002366,0x00000145,0x000200f9, -0x0000250f,0x000200f8,0x0000250c,0x000400c8, -0x00000006,0x0000250e,0x00002366,0x000200f9, -0x0000250f,0x000200f8,0x0000250f,0x000700f5, -0x00000006,0x000030dd,0x0000250b,0x00002509, -0x0000250e,0x0000250c,0x0004007c,0x00000027, -0x00002511,0x000030dd,0x00060050,0x0000004b, -0x00002368,0x000024f3,0x00002502,0x00002511, -0x00060041,0x000000db,0x0000236a,0x000024d4, -0x000000da,0x0000020d,0x0006003d,0x00000006, -0x0000236b,0x0000236a,0x00000002,0x00000004, -0x000500c7,0x00000006,0x00002516,0x0000236b, -0x00000130,0x000500ab,0x0000002f,0x00002517, -0x00002516,0x000000a6,0x000300f7,0x0000251e, -0x00000000,0x000400fa,0x00002517,0x00002518, -0x0000251b,0x000200f8,0x00002518,0x000500c7, -0x00000006,0x0000251a,0x0000236b,0x00000145, -0x000200f9,0x0000251e,0x000200f8,0x0000251b, -0x000400c8,0x00000006,0x0000251d,0x0000236b, -0x000200f9,0x0000251e,0x000200f8,0x0000251e, -0x000700f5,0x00000006,0x000030de,0x0000251a, -0x00002518,0x0000251d,0x0000251b,0x0004007c, -0x00000027,0x00002520,0x000030de,0x00060041, -0x000000db,0x0000236e,0x000024d4,0x000000da, -0x00000215,0x0006003d,0x00000006,0x0000236f, -0x0000236e,0x00000002,0x00000004,0x000500c7, -0x00000006,0x00002525,0x0000236f,0x00000130, -0x000500ab,0x0000002f,0x00002526,0x00002525, -0x000000a6,0x000300f7,0x0000252d,0x00000000, -0x000400fa,0x00002526,0x00002527,0x0000252a, -0x000200f8,0x00002527,0x000500c7,0x00000006, -0x00002529,0x0000236f,0x00000145,0x000200f9, -0x0000252d,0x000200f8,0x0000252a,0x000400c8, -0x00000006,0x0000252c,0x0000236f,0x000200f9, -0x0000252d,0x000200f8,0x0000252d,0x000700f5, -0x00000006,0x000030df,0x00002529,0x00002527, -0x0000252c,0x0000252a,0x0004007c,0x00000027, -0x0000252f,0x000030df,0x00060041,0x000000db, -0x00002372,0x000024d4,0x000000da,0x0000021d, -0x0006003d,0x00000006,0x00002373,0x00002372, +0x000024d4,0x0000257b,0x00050080,0x00000006, +0x000024d6,0x000024b6,0x00000189,0x00050095, +0x000000ab,0x000025ac,0x00002505,0x000024d6, +0x00050051,0x00000006,0x000025ad,0x000025ac, +0x00000001,0x00050051,0x00000006,0x000025ae, +0x000025ac,0x00000000,0x00050080,0x00000006, +0x000025b3,0x0000250c,0x000025ad,0x00050050, +0x00000007,0x000025b4,0x000025ae,0x000025b3, +0x0004007c,0x00000014,0x000025a4,0x000025b4, +0x00060041,0x000000db,0x0000259b,0x000025a4, +0x000000da,0x000000da,0x0006003d,0x00000006, +0x0000259c,0x0000259b,0x00000002,0x00000004, +0x0004007c,0x00000027,0x000024da,0x0000259c, +0x00060050,0x0000004b,0x000024db,0x000024ce, +0x000024d4,0x000024da,0x000500bc,0x0000002f, +0x000025bb,0x000024bb,0x000024ce,0x000300f7, +0x000025c2,0x00000000,0x000400fa,0x000025bb, +0x000025bc,0x000025c2,0x000200f8,0x000025bc, +0x000500bc,0x0000002f,0x000025c1,0x000024c1, +0x000024d4,0x000200f9,0x000025c2,0x000200f8, +0x000025c2,0x000700f5,0x0000002f,0x000025c3, +0x000025bb,0x00000be3,0x000025c1,0x000025bc, +0x000300f7,0x000025ca,0x00000000,0x000400fa, +0x000025c3,0x000025c4,0x000025ca,0x000200f8, +0x000025c4,0x000500bc,0x0000002f,0x000025c9, +0x000024c7,0x000024da,0x000200f9,0x000025ca, +0x000200f8,0x000025ca,0x000700f5,0x0000002f, +0x000025cb,0x000025c3,0x000025c2,0x000025c9, +0x000025c4,0x000300f7,0x00002494,0x00000000, +0x000400fa,0x000025cb,0x00002458,0x00002494, +0x000200f8,0x00002458,0x00050095,0x000000ab, +0x000025dc,0x00002505,0x000000a6,0x00050051, +0x00000006,0x000025dd,0x000025dc,0x00000001, +0x00050051,0x00000006,0x000025de,0x000025dc, +0x00000000,0x00050080,0x00000006,0x000025e3, +0x0000250c,0x000025dd,0x00050050,0x00000007, +0x000025e4,0x000025de,0x000025e3,0x0004007c, +0x00000014,0x000025d4,0x000025e4,0x00060041, +0x000000db,0x0000245d,0x000025d4,0x000000da, +0x000000da,0x0006003d,0x00000006,0x0000245e, +0x0000245d,0x00000002,0x00000004,0x000500c7, +0x00000006,0x000025e9,0x0000245e,0x00000130, +0x000500ab,0x0000002f,0x000025ea,0x000025e9, +0x000000a6,0x000300f7,0x000025f1,0x00000000, +0x000400fa,0x000025ea,0x000025eb,0x000025ee, +0x000200f8,0x000025eb,0x000500c7,0x00000006, +0x000025ed,0x0000245e,0x00000145,0x000200f9, +0x000025f1,0x000200f8,0x000025ee,0x000400c8, +0x00000006,0x000025f0,0x0000245e,0x000200f9, +0x000025f1,0x000200f8,0x000025f1,0x000700f5, +0x00000006,0x000031e7,0x000025ed,0x000025eb, +0x000025f0,0x000025ee,0x0004007c,0x00000027, +0x000025f3,0x000031e7,0x00060041,0x000000db, +0x00002461,0x000025d4,0x000000da,0x00000154, +0x0006003d,0x00000006,0x00002462,0x00002461, 0x00000002,0x00000004,0x000500c7,0x00000006, -0x00002534,0x00002373,0x00000130,0x000500ab, -0x0000002f,0x00002535,0x00002534,0x000000a6, -0x000300f7,0x0000253c,0x00000000,0x000400fa, -0x00002535,0x00002536,0x00002539,0x000200f8, -0x00002536,0x000500c7,0x00000006,0x00002538, -0x00002373,0x00000145,0x000200f9,0x0000253c, -0x000200f8,0x00002539,0x000400c8,0x00000006, -0x0000253b,0x00002373,0x000200f9,0x0000253c, -0x000200f8,0x0000253c,0x000700f5,0x00000006, -0x000030e0,0x00002538,0x00002536,0x0000253b, -0x00002539,0x0004007c,0x00000027,0x0000253e, -0x000030e0,0x00060050,0x0000004b,0x00002375, -0x00002520,0x0000252f,0x0000253e,0x00050083, -0x0000004b,0x00002378,0x00002375,0x00002368, -0x0007000c,0x0000004b,0x00002379,0x00000001, -0x00000028,0x00002378,0x0000065b,0x00050081, -0x0000004b,0x0000237c,0x000023c8,0x000023db, -0x0005008e,0x0000004b,0x0000237d,0x0000237c, -0x000001ed,0x00050083,0x0000004b,0x0000237f, -0x0000237d,0x00002368,0x00050088,0x0000004b, -0x00002381,0x0000237f,0x00002379,0x0008000c, -0x0000004b,0x00002384,0x00000001,0x0000002b, -0x00002381,0x00000570,0x00003196,0x0005008e, -0x0000004b,0x00002385,0x00002384,0x0000066b, -0x0004006d,0x0000065d,0x00002386,0x00002385, -0x00050051,0x00000006,0x00002388,0x00002386, -0x00000000,0x000500c7,0x00000006,0x00002542, -0x00002388,0x000005fe,0x000500c4,0x00000006, -0x00002545,0x00002542,0x0000023e,0x000500c5, -0x00000006,0x00002546,0x00002542,0x00002545, -0x000500c7,0x00000006,0x00002547,0x00002546, -0x00000605,0x000500c4,0x00000006,0x0000254a, -0x00002547,0x00000308,0x000500c5,0x00000006, -0x0000254b,0x00002547,0x0000254a,0x000500c7, -0x00000006,0x0000254c,0x0000254b,0x0000060b, -0x000500c4,0x00000006,0x0000254f,0x0000254c, -0x00000215,0x000500c5,0x00000006,0x00002550, -0x0000254c,0x0000254f,0x000500c7,0x00000006, -0x00002551,0x00002550,0x00000611,0x000500c4, -0x00000006,0x00002554,0x00002551,0x00000205, -0x000500c5,0x00000006,0x00002555,0x00002551, -0x00002554,0x000500c7,0x00000006,0x00002556, -0x00002555,0x00000617,0x000500c4,0x00000006, -0x0000238a,0x00002556,0x00000205,0x00050051, -0x00000006,0x0000238c,0x00002386,0x00000001, -0x000500c7,0x00000006,0x0000255b,0x0000238c, -0x000005fe,0x000500c4,0x00000006,0x0000255e, -0x0000255b,0x0000023e,0x000500c5,0x00000006, -0x0000255f,0x0000255b,0x0000255e,0x000500c7, -0x00000006,0x00002560,0x0000255f,0x00000605, -0x000500c4,0x00000006,0x00002563,0x00002560, -0x00000308,0x000500c5,0x00000006,0x00002564, -0x00002560,0x00002563,0x000500c7,0x00000006, -0x00002565,0x00002564,0x0000060b,0x000500c4, -0x00000006,0x00002568,0x00002565,0x00000215, -0x000500c5,0x00000006,0x00002569,0x00002565, -0x00002568,0x000500c7,0x00000006,0x0000256a, -0x00002569,0x00000611,0x000500c4,0x00000006, -0x0000256d,0x0000256a,0x00000205,0x000500c5, -0x00000006,0x0000256e,0x0000256a,0x0000256d, -0x000500c7,0x00000006,0x0000256f,0x0000256e, -0x00000617,0x000500c4,0x00000006,0x0000238e, -0x0000256f,0x00000154,0x000500c5,0x00000006, -0x0000238f,0x0000238a,0x0000238e,0x00050051, -0x00000006,0x00002391,0x00002386,0x00000002, -0x000500c7,0x00000006,0x00002574,0x00002391, -0x000005fe,0x000500c4,0x00000006,0x00002577, -0x00002574,0x0000023e,0x000500c5,0x00000006, -0x00002578,0x00002574,0x00002577,0x000500c7, -0x00000006,0x00002579,0x00002578,0x00000605, -0x000500c4,0x00000006,0x0000257c,0x00002579, -0x00000308,0x000500c5,0x00000006,0x0000257d, -0x00002579,0x0000257c,0x000500c7,0x00000006, -0x0000257e,0x0000257d,0x0000060b,0x000500c4, -0x00000006,0x00002581,0x0000257e,0x00000215, -0x000500c5,0x00000006,0x00002582,0x0000257e, -0x00002581,0x000500c7,0x00000006,0x00002583, -0x00002582,0x00000611,0x000500c4,0x00000006, -0x00002586,0x00002583,0x00000205,0x000500c5, -0x00000006,0x00002587,0x00002583,0x00002586, -0x000500c7,0x00000006,0x00002588,0x00002587, -0x00000617,0x000500c5,0x00000006,0x00002393, -0x0000238f,0x00002588,0x000200f9,0x00002394, -0x000200f8,0x00002394,0x000700f5,0x00000006, -0x000030e1,0x00000531,0x000024ca,0x00002393, -0x0000253c,0x00050084,0x00000006,0x00002397, -0x0000010a,0x00000b11,0x00050080,0x00000006, -0x00002398,0x00000107,0x00002397,0x00050095, -0x000000ab,0x000025a3,0x00002405,0x00002398, -0x00050051,0x00000006,0x000025a4,0x000025a3, -0x00000001,0x00050051,0x00000006,0x000025a5, -0x000025a3,0x00000000,0x00050080,0x00000006, -0x000025aa,0x0000240c,0x000025a4,0x00050050, -0x00000007,0x000025ab,0x000025a5,0x000025aa, -0x0004007c,0x00000014,0x0000259b,0x000025ab, -0x00060041,0x000000db,0x00002593,0x0000259b, -0x000000da,0x000000da,0x0005003e,0x00002593, -0x000030e1,0x00000002,0x00000004,0x00050084, -0x00000006,0x000025b0,0x0000010a,0x000023e5, -0x00050080,0x00000006,0x000025b1,0x00000107, -0x000025b0,0x00050080,0x00000006,0x000023a0, -0x000025b1,0x00002397,0x00050095,0x000000ab, -0x000025c9,0x00002405,0x000023a0,0x00050051, -0x00000006,0x000025ca,0x000025c9,0x00000001, -0x00050051,0x00000006,0x000025cb,0x000025c9, -0x00000000,0x00050080,0x00000006,0x000025d0, -0x0000240c,0x000025ca,0x00050050,0x00000007, -0x000025d1,0x000025cb,0x000025d0,0x0004007c, -0x00000014,0x000025c1,0x000025d1,0x00060041, -0x000000db,0x000025b9,0x000025c1,0x000000da, -0x000000da,0x0005003e,0x000025b9,0x00000b11, -0x00000002,0x00000004,0x000200f9,0x00000ba7, -0x000200f8,0x00000bab,0x000500aa,0x0000002f, -0x00000bae,0x00000b13,0x00000246,0x000300f7, -0x00000bb0,0x00000000,0x000400fa,0x00000bae, -0x00000baf,0x00000bb0,0x000200f8,0x00000baf, -0x00050041,0x000000fe,0x00002620,0x000000fc, -0x00000308,0x0004003d,0x00000006,0x00002621, -0x00002620,0x00050080,0x00000006,0x00002623, -0x00002621,0x00000b11,0x00050041,0x000000fe, -0x00002729,0x000000fc,0x0000023e,0x0004003d, -0x00000006,0x0000272a,0x00002729,0x00050084, -0x00000006,0x0000272c,0x00002623,0x00000228, -0x00050080,0x00000006,0x0000272d,0x0000272a, -0x0000272c,0x000500c2,0x00000006,0x0000272e, -0x0000272d,0x00000233,0x000500c4,0x00000006, -0x0000272f,0x0000272e,0x0000020d,0x000500c5, -0x00000006,0x00002730,0x0000272f,0x00000246, -0x000200f9,0x0000262f,0x000200f8,0x0000262f, -0x000700f5,0x0000004b,0x00003096,0x0000319b, -0x00000baf,0x0000317f,0x0000270b,0x000700f5, -0x0000004b,0x00003094,0x00003199,0x00000baf, -0x0000317a,0x0000270b,0x000700f5,0x00000006, -0x00003091,0x000000a6,0x00000baf,0x0000270d, -0x0000270b,0x000500b0,0x0000002f,0x00002632, -0x00003091,0x0000010a,0x000400f6,0x0000270e, -0x0000270b,0x00000000,0x000400fa,0x00002632, -0x00002633,0x0000270e,0x000200f8,0x00002633, -0x00050084,0x00000006,0x00002635,0x0000010a, -0x00000b11,0x00050080,0x00000006,0x00002637, -0x00002635,0x00003091,0x00050041,0x000000fe, -0x0000263c,0x000000fc,0x0000027b,0x0004003d, -0x00000006,0x0000263d,0x0000263c,0x000500aa, -0x0000002f,0x0000263e,0x0000263d,0x000000b0, -0x000300f7,0x000026d4,0x00000000,0x000400fa, -0x0000263e,0x0000263f,0x00002684,0x000200f8, -0x0000263f,0x00050084,0x00000006,0x00002642, -0x0000010a,0x00003091,0x00050080,0x00000006, -0x00002643,0x0000272d,0x00002642,0x00050041, -0x00000156,0x00002644,0x000000fc,0x000000da, -0x0004003d,0x00000007,0x00002645,0x00002644, -0x00050051,0x00000006,0x00002747,0x00002645, -0x00000000,0x00050095,0x000000ab,0x00002749, -0x00002747,0x00002643,0x00050051,0x00000006, -0x0000274a,0x00002749,0x00000001,0x00050051, -0x00000006,0x0000274b,0x00002749,0x00000000, -0x00050051,0x00000006,0x0000274e,0x00002645, -0x00000001,0x00050080,0x00000006,0x00002750, -0x0000274e,0x0000274a,0x00050050,0x00000007, -0x00002751,0x0000274b,0x00002750,0x0004007c, -0x00000014,0x00002741,0x00002751,0x00060041, -0x000000db,0x00002738,0x00002741,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00002739, -0x00002738,0x00000002,0x00000004,0x000500ab, -0x0000002f,0x00002648,0x00002739,0x00000380, -0x000300f7,0x00002683,0x00000000,0x000400fa, -0x00002648,0x00002649,0x00002683,0x000200f8, -0x00002649,0x000500c2,0x00000006,0x00002755, -0x00002739,0x0000020d,0x00050084,0x00000006, -0x0000264c,0x00002755,0x00000107,0x000500c7, -0x00000006,0x0000264e,0x00002739,0x00000967, -0x000500aa,0x0000002f,0x0000264f,0x0000264e, -0x00000246,0x000300f7,0x00002676,0x00000000, -0x000400fa,0x0000264f,0x00002650,0x0000265c, -0x000200f8,0x00002650,0x00050041,0x000000fe, -0x00002651,0x000000fc,0x0000096c,0x0004003d, -0x00000006,0x00002652,0x00002651,0x00050082, -0x00000006,0x00002656,0x0000264c,0x0000272a, -0x00050086,0x00000006,0x00002657,0x00002656, -0x00000228,0x00050080,0x00000006,0x00002658, -0x00002652,0x00002657,0x00050041,0x000000fe, -0x00002795,0x000000fc,0x000000fd,0x0004003d, -0x00000006,0x00002796,0x00002795,0x00050084, -0x00000006,0x00002797,0x0000011f,0x00002796, -0x00050080,0x00000006,0x00002798,0x00000107, -0x00002797,0x00050080,0x00000006,0x0000279e, -0x00002796,0x0000319c,0x00050086,0x00000006, -0x0000279f,0x0000279e,0x00000101,0x00050084, -0x00000006,0x00002791,0x00000107,0x0000279f, -0x00050080,0x00000006,0x00002792,0x00002798, -0x00002791,0x00050084,0x00000006,0x00002766, -0x00000150,0x00002658,0x00050080,0x00000006, -0x00002767,0x00002792,0x00002766,0x00050041, -0x00000156,0x00002768,0x000000fc,0x00000154, -0x0004003d,0x00000007,0x00002769,0x00002768, -0x00050051,0x00000006,0x000027b6,0x00002769, -0x00000000,0x00050095,0x000000ab,0x000027b8, -0x000027b6,0x00002767,0x00050051,0x00000006, -0x000027b9,0x000027b8,0x00000001,0x00050051, -0x00000006,0x000027ba,0x000027b8,0x00000000, -0x00050051,0x00000006,0x000027bd,0x00002769, -0x00000001,0x00050080,0x00000006,0x000027bf, -0x000027bd,0x000027b9,0x00050050,0x00000007, -0x000027c0,0x000027ba,0x000027bf,0x0004007c, -0x00000014,0x000027b0,0x000027c0,0x00060041, -0x000000db,0x000027a7,0x000027b0,0x000000da, -0x000000da,0x0006003d,0x00000006,0x000027a8, -0x000027a7,0x00000002,0x00000004,0x0004007c, -0x00000027,0x0000276c,0x000027a8,0x00050080, -0x00000006,0x0000276e,0x00002767,0x0000010a, -0x00050095,0x000000ab,0x000027d9,0x000027b6, -0x0000276e,0x00050051,0x00000006,0x000027da, -0x000027d9,0x00000001,0x00050051,0x00000006, -0x000027db,0x000027d9,0x00000000,0x00050080, -0x00000006,0x000027e0,0x000027bd,0x000027da, -0x00050050,0x00000007,0x000027e1,0x000027db, -0x000027e0,0x0004007c,0x00000014,0x000027d1, -0x000027e1,0x00060041,0x000000db,0x000027c8, -0x000027d1,0x000000da,0x000000da,0x0006003d, -0x00000006,0x000027c9,0x000027c8,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002772, -0x000027c9,0x00050080,0x00000006,0x00002774, -0x00002767,0x00000111,0x00050095,0x000000ab, -0x000027fa,0x000027b6,0x00002774,0x00050051, -0x00000006,0x000027fb,0x000027fa,0x00000001, -0x00050051,0x00000006,0x000027fc,0x000027fa, -0x00000000,0x00050080,0x00000006,0x00002801, -0x000027bd,0x000027fb,0x00050050,0x00000007, -0x00002802,0x000027fc,0x00002801,0x0004007c, -0x00000014,0x000027f2,0x00002802,0x00060041, -0x000000db,0x000027e9,0x000027f2,0x000000da, -0x000000da,0x0006003d,0x00000006,0x000027ea, -0x000027e9,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00002778,0x000027ea,0x00060050, -0x0000004b,0x00002779,0x0000276c,0x00002772, -0x00002778,0x00050080,0x00000006,0x0000277b, -0x00002767,0x00000118,0x00050095,0x000000ab, -0x0000281b,0x000027b6,0x0000277b,0x00050051, -0x00000006,0x0000281c,0x0000281b,0x00000001, -0x00050051,0x00000006,0x0000281d,0x0000281b, -0x00000000,0x00050080,0x00000006,0x00002822, -0x000027bd,0x0000281c,0x00050050,0x00000007, -0x00002823,0x0000281d,0x00002822,0x0004007c, -0x00000014,0x00002813,0x00002823,0x00060041, -0x000000db,0x0000280a,0x00002813,0x000000da, -0x000000da,0x0006003d,0x00000006,0x0000280b, -0x0000280a,0x00000002,0x00000004,0x0004007c, -0x00000027,0x0000277f,0x0000280b,0x00050080, -0x00000006,0x00002781,0x00002767,0x0000011f, -0x00050095,0x000000ab,0x0000283c,0x000027b6, -0x00002781,0x00050051,0x00000006,0x0000283d, -0x0000283c,0x00000001,0x00050051,0x00000006, -0x0000283e,0x0000283c,0x00000000,0x00050080, -0x00000006,0x00002843,0x000027bd,0x0000283d, -0x00050050,0x00000007,0x00002844,0x0000283e, -0x00002843,0x0004007c,0x00000014,0x00002834, -0x00002844,0x00060041,0x000000db,0x0000282b, -0x00002834,0x000000da,0x000000da,0x0006003d, -0x00000006,0x0000282c,0x0000282b,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002785, -0x0000282c,0x00050080,0x00000006,0x00002787, -0x00002767,0x00000189,0x00050095,0x000000ab, -0x0000285d,0x000027b6,0x00002787,0x00050051, -0x00000006,0x0000285e,0x0000285d,0x00000001, -0x00050051,0x00000006,0x0000285f,0x0000285d, -0x00000000,0x00050080,0x00000006,0x00002864, -0x000027bd,0x0000285e,0x00050050,0x00000007, -0x00002865,0x0000285f,0x00002864,0x0004007c, -0x00000014,0x00002855,0x00002865,0x00060041, -0x000000db,0x0000284c,0x00002855,0x000000da, -0x000000da,0x0006003d,0x00000006,0x0000284d, -0x0000284c,0x00000002,0x00000004,0x0004007c, -0x00000027,0x0000278b,0x0000284d,0x00060050, -0x0000004b,0x0000278c,0x0000277f,0x00002785, -0x0000278b,0x000200f9,0x00002676,0x000200f8, -0x0000265c,0x00050041,0x000000fe,0x0000265e, -0x000000fc,0x0000022c,0x0004003d,0x00000006, -0x0000265f,0x0000265e,0x00050082,0x00000006, -0x00002660,0x0000264c,0x0000265f,0x00050041, -0x000000fe,0x00002868,0x000000fc,0x00000224, -0x0004003d,0x00000006,0x00002869,0x00002868, -0x000500ab,0x0000002f,0x0000286a,0x00002869, -0x000000a6,0x000600a9,0x00000006,0x0000286b, -0x0000286a,0x00000228,0x00000107,0x00050086, -0x00000006,0x00002662,0x00002660,0x0000286b, -0x00050041,0x000000fe,0x000028ab,0x000000fc, -0x000000fd,0x0004003d,0x00000006,0x000028ac, -0x000028ab,0x00050084,0x00000006,0x000028ad, -0x0000011f,0x000028ac,0x00050080,0x00000006, -0x000028ae,0x00000107,0x000028ad,0x00050080, -0x00000006,0x000028b4,0x000028ac,0x0000319c, -0x00050086,0x00000006,0x000028b5,0x000028b4, -0x00000101,0x00050084,0x00000006,0x000028a7, -0x00000107,0x000028b5,0x00050080,0x00000006, -0x000028a8,0x000028ae,0x000028a7,0x00050084, -0x00000006,0x0000287c,0x00000150,0x00002662, -0x00050080,0x00000006,0x0000287d,0x000028a8, -0x0000287c,0x00050041,0x00000156,0x0000287e, -0x000000fc,0x00000154,0x0004003d,0x00000007, -0x0000287f,0x0000287e,0x00050051,0x00000006, -0x000028cc,0x0000287f,0x00000000,0x00050095, -0x000000ab,0x000028ce,0x000028cc,0x0000287d, -0x00050051,0x00000006,0x000028cf,0x000028ce, -0x00000001,0x00050051,0x00000006,0x000028d0, -0x000028ce,0x00000000,0x00050051,0x00000006, -0x000028d3,0x0000287f,0x00000001,0x00050080, -0x00000006,0x000028d5,0x000028d3,0x000028cf, -0x00050050,0x00000007,0x000028d6,0x000028d0, -0x000028d5,0x0004007c,0x00000014,0x000028c6, -0x000028d6,0x00060041,0x000000db,0x000028bd, -0x000028c6,0x000000da,0x000000da,0x0006003d, -0x00000006,0x000028be,0x000028bd,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002882, -0x000028be,0x00050080,0x00000006,0x00002884, -0x0000287d,0x0000010a,0x00050095,0x000000ab, -0x000028ef,0x000028cc,0x00002884,0x00050051, -0x00000006,0x000028f0,0x000028ef,0x00000001, -0x00050051,0x00000006,0x000028f1,0x000028ef, -0x00000000,0x00050080,0x00000006,0x000028f6, -0x000028d3,0x000028f0,0x00050050,0x00000007, -0x000028f7,0x000028f1,0x000028f6,0x0004007c, -0x00000014,0x000028e7,0x000028f7,0x00060041, -0x000000db,0x000028de,0x000028e7,0x000000da, -0x000000da,0x0006003d,0x00000006,0x000028df, -0x000028de,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00002888,0x000028df,0x00050080, -0x00000006,0x0000288a,0x0000287d,0x00000111, -0x00050095,0x000000ab,0x00002910,0x000028cc, -0x0000288a,0x00050051,0x00000006,0x00002911, -0x00002910,0x00000001,0x00050051,0x00000006, -0x00002912,0x00002910,0x00000000,0x00050080, -0x00000006,0x00002917,0x000028d3,0x00002911, -0x00050050,0x00000007,0x00002918,0x00002912, -0x00002917,0x0004007c,0x00000014,0x00002908, -0x00002918,0x00060041,0x000000db,0x000028ff, -0x00002908,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00002900,0x000028ff,0x00000002, -0x00000004,0x0004007c,0x00000027,0x0000288e, -0x00002900,0x00060050,0x0000004b,0x0000288f, -0x00002882,0x00002888,0x0000288e,0x00050080, -0x00000006,0x00002891,0x0000287d,0x00000118, -0x00050095,0x000000ab,0x00002931,0x000028cc, -0x00002891,0x00050051,0x00000006,0x00002932, -0x00002931,0x00000001,0x00050051,0x00000006, -0x00002933,0x00002931,0x00000000,0x00050080, -0x00000006,0x00002938,0x000028d3,0x00002932, -0x00050050,0x00000007,0x00002939,0x00002933, -0x00002938,0x0004007c,0x00000014,0x00002929, -0x00002939,0x00060041,0x000000db,0x00002920, -0x00002929,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00002921,0x00002920,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002895, -0x00002921,0x00050080,0x00000006,0x00002897, -0x0000287d,0x0000011f,0x00050095,0x000000ab, -0x00002952,0x000028cc,0x00002897,0x00050051, -0x00000006,0x00002953,0x00002952,0x00000001, -0x00050051,0x00000006,0x00002954,0x00002952, -0x00000000,0x00050080,0x00000006,0x00002959, -0x000028d3,0x00002953,0x00050050,0x00000007, -0x0000295a,0x00002954,0x00002959,0x0004007c, -0x00000014,0x0000294a,0x0000295a,0x00060041, -0x000000db,0x00002941,0x0000294a,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00002942, -0x00002941,0x00000002,0x00000004,0x0004007c, -0x00000027,0x0000289b,0x00002942,0x00050080, -0x00000006,0x0000289d,0x0000287d,0x00000189, -0x00050095,0x000000ab,0x00002973,0x000028cc, -0x0000289d,0x00050051,0x00000006,0x00002974, -0x00002973,0x00000001,0x00050051,0x00000006, -0x00002975,0x00002973,0x00000000,0x00050080, -0x00000006,0x0000297a,0x000028d3,0x00002974, -0x00050050,0x00000007,0x0000297b,0x00002975, -0x0000297a,0x0004007c,0x00000014,0x0000296b, -0x0000297b,0x00060041,0x000000db,0x00002962, -0x0000296b,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00002963,0x00002962,0x00000002, -0x00000004,0x0004007c,0x00000027,0x000028a1, -0x00002963,0x00060050,0x0000004b,0x000028a2, -0x00002895,0x0000289b,0x000028a1,0x000300f7, -0x00002675,0x00000000,0x000400fa,0x0000286a, -0x0000266a,0x00002675,0x000200f8,0x0000266a, -0x00050084,0x00000006,0x0000266e,0x00000228, -0x00002662,0x00050080,0x00000006,0x0000266f, -0x0000265f,0x0000266e,0x00050080,0x00000006, -0x00002670,0x0000266f,0x000005d0,0x00050095, -0x000000ab,0x00002993,0x00002747,0x00002670, -0x00050051,0x00000006,0x00002994,0x00002993, -0x00000001,0x00050051,0x00000006,0x00002995, -0x00002993,0x00000000,0x00050080,0x00000006, -0x0000299a,0x0000274e,0x00002994,0x00050050, -0x00000007,0x0000299b,0x00002995,0x0000299a, -0x0004007c,0x00000014,0x0000298b,0x0000299b, -0x00060041,0x000000db,0x00002983,0x0000298b, -0x000000da,0x000000da,0x0005003e,0x00002983, -0x00002730,0x00000002,0x00000004,0x000200f9, -0x00002675,0x000200f8,0x00002675,0x000200f9, -0x00002676,0x000200f8,0x00002676,0x000700f5, -0x0000004b,0x000030ab,0x0000278c,0x00002650, -0x000028a2,0x00002675,0x000700f5,0x0000004b, -0x000030a9,0x00002779,0x00002650,0x0000288f, -0x00002675,0x00050051,0x00000027,0x0000299f, -0x000030a9,0x00000000,0x00050051,0x00000027, -0x000029a1,0x000030ab,0x00000000,0x000500bc, -0x0000002f,0x000029a2,0x0000299f,0x000029a1, -0x000300f7,0x000029a9,0x00000000,0x000400fa, -0x000029a2,0x000029a3,0x000029a9,0x000200f8, -0x000029a3,0x00050051,0x00000027,0x000029a5, -0x000030a9,0x00000001,0x00050051,0x00000027, -0x000029a7,0x000030ab,0x00000001,0x000500bc, -0x0000002f,0x000029a8,0x000029a5,0x000029a7, -0x000200f9,0x000029a9,0x000200f8,0x000029a9, -0x000700f5,0x0000002f,0x000029aa,0x000029a2, -0x00002676,0x000029a8,0x000029a3,0x000300f7, -0x000029b1,0x00000000,0x000400fa,0x000029aa, -0x000029ab,0x000029b1,0x000200f8,0x000029ab, -0x00050051,0x00000027,0x000029ad,0x000030a9, -0x00000002,0x00050051,0x00000027,0x000029af, -0x000030ab,0x00000002,0x000500bc,0x0000002f, -0x000029b0,0x000029ad,0x000029af,0x000200f9, -0x000029b1,0x000200f8,0x000029b1,0x000700f5, -0x0000002f,0x000029b2,0x000029aa,0x000029a9, -0x000029b0,0x000029ab,0x000300f7,0x00002682, -0x00000000,0x000400fa,0x000029b2,0x0000267b, -0x00002682,0x000200f8,0x0000267b,0x0007000c, -0x0000004b,0x0000267e,0x00000001,0x00000025, -0x00003094,0x000030a9,0x0007000c,0x0000004b, -0x00002681,0x00000001,0x00000028,0x00003096, -0x000030ab,0x000200f9,0x00002682,0x000200f8, -0x00002682,0x000700f5,0x0000004b,0x00003181, -0x00003096,0x000029b1,0x00002681,0x0000267b, -0x000700f5,0x0000004b,0x0000317c,0x00003094, -0x000029b1,0x0000267e,0x0000267b,0x000200f9, -0x00002683,0x000200f8,0x00002683,0x000700f5, -0x0000004b,0x00003180,0x00003096,0x0000263f, -0x00003181,0x00002682,0x000700f5,0x0000004b, -0x0000317b,0x00003094,0x0000263f,0x0000317c, -0x00002682,0x000700f5,0x0000004b,0x000030d7, -0x0000319b,0x0000263f,0x000030ab,0x00002682, -0x000700f5,0x0000004b,0x000030d2,0x00003199, -0x0000263f,0x000030a9,0x00002682,0x000200f9, -0x000026d4,0x000200f8,0x00002684,0x00050041, -0x000000fe,0x00002686,0x000000fc,0x00000250, -0x0004003d,0x00000006,0x00002687,0x00002686, -0x000500b0,0x0000002f,0x00002688,0x00002637, -0x00002687,0x000300f7,0x000026d3,0x00000000, -0x000400fa,0x00002688,0x00002689,0x000026d3, -0x000200f8,0x00002689,0x00050041,0x000000fe, -0x0000268a,0x000000fc,0x00000266,0x0004003d, -0x00000006,0x0000268b,0x0000268a,0x000500aa, -0x0000002f,0x0000268c,0x0000268b,0x00000380, -0x000300f7,0x000026b8,0x00000000,0x000400fa, -0x0000268c,0x0000268d,0x000026aa,0x000200f8, -0x0000268d,0x00050041,0x000000fe,0x000029b6, -0x000000fc,0x000000fd,0x0004003d,0x00000006, -0x000029b7,0x000029b6,0x00050084,0x00000006, -0x000029b8,0x0000010a,0x000029b7,0x00050080, -0x00000006,0x000029b9,0x00000107,0x000029b8, -0x00050084,0x00000006,0x00002690,0x0000010a, -0x00002637,0x00050080,0x00000006,0x00002691, -0x000029b9,0x00002690,0x00050041,0x00000156, -0x00002692,0x000000fc,0x00000154,0x0004003d, -0x00000007,0x00002693,0x00002692,0x00050051, -0x00000006,0x000029d0,0x00002693,0x00000000, -0x00050095,0x000000ab,0x000029d2,0x000029d0, -0x00002691,0x00050051,0x00000006,0x000029d3, -0x000029d2,0x00000001,0x00050051,0x00000006, -0x000029d4,0x000029d2,0x00000000,0x00050051, -0x00000006,0x000029d7,0x00002693,0x00000001, -0x00050080,0x00000006,0x000029d9,0x000029d7, -0x000029d3,0x00050050,0x00000007,0x000029da, -0x000029d4,0x000029d9,0x0004007c,0x00000014, -0x000029ca,0x000029da,0x00060041,0x000000db, -0x000029c1,0x000029ca,0x000000da,0x000000da, -0x0006003d,0x00000006,0x000029c2,0x000029c1, -0x00000002,0x00000004,0x00050041,0x000000fe, -0x000029dd,0x000000fc,0x0000022c,0x0004003d, -0x00000006,0x000029de,0x000029dd,0x00050041, -0x000000fe,0x000029ec,0x000000fc,0x00000224, -0x0004003d,0x00000006,0x000029ed,0x000029ec, -0x000500ab,0x0000002f,0x000029ee,0x000029ed, -0x000000a6,0x000600a9,0x00000006,0x000029ef, -0x000029ee,0x00000228,0x00000107,0x00050084, -0x00000006,0x000029e1,0x000029c2,0x000029ef, -0x00050080,0x00000006,0x000029e2,0x000029de, -0x000029e1,0x000500c2,0x00000006,0x000029e3, -0x000029e2,0x00000233,0x000500c4,0x00000006, -0x000029e4,0x000029e3,0x0000020d,0x000600a9, -0x00000006,0x000029e8,0x000029ee,0x00000239, -0x000000a6,0x000500c5,0x00000006,0x000029e9, -0x000029e4,0x000029e8,0x00050084,0x00000006, -0x00002a31,0x0000011f,0x000029b7,0x00050080, -0x00000006,0x00002a32,0x00000107,0x00002a31, -0x00050080,0x00000006,0x00002a38,0x000029b7, -0x0000319c,0x00050086,0x00000006,0x00002a39, -0x00002a38,0x00000101,0x00050084,0x00000006, -0x00002a2b,0x00000107,0x00002a39,0x00050080, -0x00000006,0x00002a2c,0x00002a32,0x00002a2b, -0x00050084,0x00000006,0x00002a00,0x00000150, -0x000029c2,0x00050080,0x00000006,0x00002a01, -0x00002a2c,0x00002a00,0x00050095,0x000000ab, -0x00002a52,0x000029d0,0x00002a01,0x00050051, -0x00000006,0x00002a53,0x00002a52,0x00000001, -0x00050051,0x00000006,0x00002a54,0x00002a52, -0x00000000,0x00050080,0x00000006,0x00002a59, -0x000029d7,0x00002a53,0x00050050,0x00000007, -0x00002a5a,0x00002a54,0x00002a59,0x0004007c, -0x00000014,0x00002a4a,0x00002a5a,0x00060041, -0x000000db,0x00002a41,0x00002a4a,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00002a42, -0x00002a41,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00002a06,0x00002a42,0x00050080, -0x00000006,0x00002a08,0x00002a01,0x0000010a, -0x00050095,0x000000ab,0x00002a73,0x000029d0, -0x00002a08,0x00050051,0x00000006,0x00002a74, -0x00002a73,0x00000001,0x00050051,0x00000006, -0x00002a75,0x00002a73,0x00000000,0x00050080, -0x00000006,0x00002a7a,0x000029d7,0x00002a74, -0x00050050,0x00000007,0x00002a7b,0x00002a75, -0x00002a7a,0x0004007c,0x00000014,0x00002a6b, -0x00002a7b,0x00060041,0x000000db,0x00002a62, -0x00002a6b,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00002a63,0x00002a62,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002a0c, -0x00002a63,0x00050080,0x00000006,0x00002a0e, -0x00002a01,0x00000111,0x00050095,0x000000ab, -0x00002a94,0x000029d0,0x00002a0e,0x00050051, -0x00000006,0x00002a95,0x00002a94,0x00000001, -0x00050051,0x00000006,0x00002a96,0x00002a94, -0x00000000,0x00050080,0x00000006,0x00002a9b, -0x000029d7,0x00002a95,0x00050050,0x00000007, -0x00002a9c,0x00002a96,0x00002a9b,0x0004007c, -0x00000014,0x00002a8c,0x00002a9c,0x00060041, -0x000000db,0x00002a83,0x00002a8c,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00002a84, -0x00002a83,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00002a12,0x00002a84,0x00060050, -0x0000004b,0x00002a13,0x00002a06,0x00002a0c, -0x00002a12,0x00050080,0x00000006,0x00002a15, -0x00002a01,0x00000118,0x00050095,0x000000ab, -0x00002ab5,0x000029d0,0x00002a15,0x00050051, -0x00000006,0x00002ab6,0x00002ab5,0x00000001, -0x00050051,0x00000006,0x00002ab7,0x00002ab5, -0x00000000,0x00050080,0x00000006,0x00002abc, -0x000029d7,0x00002ab6,0x00050050,0x00000007, -0x00002abd,0x00002ab7,0x00002abc,0x0004007c, -0x00000014,0x00002aad,0x00002abd,0x00060041, -0x000000db,0x00002aa4,0x00002aad,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00002aa5, -0x00002aa4,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00002a19,0x00002aa5,0x00050080, -0x00000006,0x00002a1b,0x00002a01,0x0000011f, -0x00050095,0x000000ab,0x00002ad6,0x000029d0, -0x00002a1b,0x00050051,0x00000006,0x00002ad7, -0x00002ad6,0x00000001,0x00050051,0x00000006, -0x00002ad8,0x00002ad6,0x00000000,0x00050080, -0x00000006,0x00002add,0x000029d7,0x00002ad7, -0x00050050,0x00000007,0x00002ade,0x00002ad8, -0x00002add,0x0004007c,0x00000014,0x00002ace, -0x00002ade,0x00060041,0x000000db,0x00002ac5, -0x00002ace,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00002ac6,0x00002ac5,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002a1f, -0x00002ac6,0x00050080,0x00000006,0x00002a21, -0x00002a01,0x00000189,0x00050095,0x000000ab, -0x00002af7,0x000029d0,0x00002a21,0x00050051, -0x00000006,0x00002af8,0x00002af7,0x00000001, -0x00050051,0x00000006,0x00002af9,0x00002af7, -0x00000000,0x00050080,0x00000006,0x00002afe, -0x000029d7,0x00002af8,0x00050050,0x00000007, -0x00002aff,0x00002af9,0x00002afe,0x0004007c, -0x00000014,0x00002aef,0x00002aff,0x00060041, -0x000000db,0x00002ae6,0x00002aef,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00002ae7, -0x00002ae6,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00002a25,0x00002ae7,0x00060050, -0x0000004b,0x00002a26,0x00002a19,0x00002a1f, -0x00002a25,0x000300f7,0x000026a9,0x00000000, -0x000400fa,0x000029ee,0x0000269e,0x000026a9, -0x000200f8,0x0000269e,0x00050084,0x00000006, -0x000026a2,0x00000228,0x000029c2,0x00050080, -0x00000006,0x000026a3,0x000029de,0x000026a2, -0x00050080,0x00000006,0x000026a4,0x000026a3, -0x000005d0,0x00050041,0x00000156,0x000026a5, +0x000025f8,0x00002462,0x00000130,0x000500ab, +0x0000002f,0x000025f9,0x000025f8,0x000000a6, +0x000300f7,0x00002600,0x00000000,0x000400fa, +0x000025f9,0x000025fa,0x000025fd,0x000200f8, +0x000025fa,0x000500c7,0x00000006,0x000025fc, +0x00002462,0x00000145,0x000200f9,0x00002600, +0x000200f8,0x000025fd,0x000400c8,0x00000006, +0x000025ff,0x00002462,0x000200f9,0x00002600, +0x000200f8,0x00002600,0x000700f5,0x00000006, +0x000031e8,0x000025fc,0x000025fa,0x000025ff, +0x000025fd,0x0004007c,0x00000027,0x00002602, +0x000031e8,0x00060041,0x000000db,0x00002465, +0x000025d4,0x000000da,0x00000205,0x0006003d, +0x00000006,0x00002466,0x00002465,0x00000002, +0x00000004,0x000500c7,0x00000006,0x00002607, +0x00002466,0x00000130,0x000500ab,0x0000002f, +0x00002608,0x00002607,0x000000a6,0x000300f7, +0x0000260f,0x00000000,0x000400fa,0x00002608, +0x00002609,0x0000260c,0x000200f8,0x00002609, +0x000500c7,0x00000006,0x0000260b,0x00002466, +0x00000145,0x000200f9,0x0000260f,0x000200f8, +0x0000260c,0x000400c8,0x00000006,0x0000260e, +0x00002466,0x000200f9,0x0000260f,0x000200f8, +0x0000260f,0x000700f5,0x00000006,0x000031e9, +0x0000260b,0x00002609,0x0000260e,0x0000260c, +0x0004007c,0x00000027,0x00002611,0x000031e9, +0x00060050,0x0000004b,0x00002468,0x000025f3, +0x00002602,0x00002611,0x00060041,0x000000db, +0x0000246a,0x000025d4,0x000000da,0x0000020d, +0x0006003d,0x00000006,0x0000246b,0x0000246a, +0x00000002,0x00000004,0x000500c7,0x00000006, +0x00002616,0x0000246b,0x00000130,0x000500ab, +0x0000002f,0x00002617,0x00002616,0x000000a6, +0x000300f7,0x0000261e,0x00000000,0x000400fa, +0x00002617,0x00002618,0x0000261b,0x000200f8, +0x00002618,0x000500c7,0x00000006,0x0000261a, +0x0000246b,0x00000145,0x000200f9,0x0000261e, +0x000200f8,0x0000261b,0x000400c8,0x00000006, +0x0000261d,0x0000246b,0x000200f9,0x0000261e, +0x000200f8,0x0000261e,0x000700f5,0x00000006, +0x000031ea,0x0000261a,0x00002618,0x0000261d, +0x0000261b,0x0004007c,0x00000027,0x00002620, +0x000031ea,0x00060041,0x000000db,0x0000246e, +0x000025d4,0x000000da,0x00000215,0x0006003d, +0x00000006,0x0000246f,0x0000246e,0x00000002, +0x00000004,0x000500c7,0x00000006,0x00002625, +0x0000246f,0x00000130,0x000500ab,0x0000002f, +0x00002626,0x00002625,0x000000a6,0x000300f7, +0x0000262d,0x00000000,0x000400fa,0x00002626, +0x00002627,0x0000262a,0x000200f8,0x00002627, +0x000500c7,0x00000006,0x00002629,0x0000246f, +0x00000145,0x000200f9,0x0000262d,0x000200f8, +0x0000262a,0x000400c8,0x00000006,0x0000262c, +0x0000246f,0x000200f9,0x0000262d,0x000200f8, +0x0000262d,0x000700f5,0x00000006,0x000031eb, +0x00002629,0x00002627,0x0000262c,0x0000262a, +0x0004007c,0x00000027,0x0000262f,0x000031eb, +0x00060041,0x000000db,0x00002472,0x000025d4, +0x000000da,0x0000021d,0x0006003d,0x00000006, +0x00002473,0x00002472,0x00000002,0x00000004, +0x000500c7,0x00000006,0x00002634,0x00002473, +0x00000130,0x000500ab,0x0000002f,0x00002635, +0x00002634,0x000000a6,0x000300f7,0x0000263c, +0x00000000,0x000400fa,0x00002635,0x00002636, +0x00002639,0x000200f8,0x00002636,0x000500c7, +0x00000006,0x00002638,0x00002473,0x00000145, +0x000200f9,0x0000263c,0x000200f8,0x00002639, +0x000400c8,0x00000006,0x0000263b,0x00002473, +0x000200f9,0x0000263c,0x000200f8,0x0000263c, +0x000700f5,0x00000006,0x000031ec,0x00002638, +0x00002636,0x0000263b,0x00002639,0x0004007c, +0x00000027,0x0000263e,0x000031ec,0x00060050, +0x0000004b,0x00002475,0x00002620,0x0000262f, +0x0000263e,0x00050083,0x0000004b,0x00002478, +0x00002475,0x00002468,0x0007000c,0x0000004b, +0x00002479,0x00000001,0x00000028,0x00002478, +0x0000065b,0x00050081,0x0000004b,0x0000247c, +0x000024c8,0x000024db,0x0005008e,0x0000004b, +0x0000247d,0x0000247c,0x000001ed,0x00050083, +0x0000004b,0x0000247f,0x0000247d,0x00002468, +0x00050088,0x0000004b,0x00002481,0x0000247f, +0x00002479,0x0008000c,0x0000004b,0x00002484, +0x00000001,0x0000002b,0x00002481,0x00000570, +0x000032a2,0x0005008e,0x0000004b,0x00002485, +0x00002484,0x0000066b,0x0004006d,0x0000065d, +0x00002486,0x00002485,0x00050051,0x00000006, +0x00002488,0x00002486,0x00000000,0x000500c7, +0x00000006,0x00002642,0x00002488,0x000005fe, +0x000500c4,0x00000006,0x00002645,0x00002642, +0x0000023e,0x000500c5,0x00000006,0x00002646, +0x00002642,0x00002645,0x000500c7,0x00000006, +0x00002647,0x00002646,0x00000605,0x000500c4, +0x00000006,0x0000264a,0x00002647,0x00000308, +0x000500c5,0x00000006,0x0000264b,0x00002647, +0x0000264a,0x000500c7,0x00000006,0x0000264c, +0x0000264b,0x0000060b,0x000500c4,0x00000006, +0x0000264f,0x0000264c,0x00000215,0x000500c5, +0x00000006,0x00002650,0x0000264c,0x0000264f, +0x000500c7,0x00000006,0x00002651,0x00002650, +0x00000611,0x000500c4,0x00000006,0x00002654, +0x00002651,0x00000205,0x000500c5,0x00000006, +0x00002655,0x00002651,0x00002654,0x000500c7, +0x00000006,0x00002656,0x00002655,0x00000617, +0x000500c4,0x00000006,0x0000248a,0x00002656, +0x00000205,0x00050051,0x00000006,0x0000248c, +0x00002486,0x00000001,0x000500c7,0x00000006, +0x0000265b,0x0000248c,0x000005fe,0x000500c4, +0x00000006,0x0000265e,0x0000265b,0x0000023e, +0x000500c5,0x00000006,0x0000265f,0x0000265b, +0x0000265e,0x000500c7,0x00000006,0x00002660, +0x0000265f,0x00000605,0x000500c4,0x00000006, +0x00002663,0x00002660,0x00000308,0x000500c5, +0x00000006,0x00002664,0x00002660,0x00002663, +0x000500c7,0x00000006,0x00002665,0x00002664, +0x0000060b,0x000500c4,0x00000006,0x00002668, +0x00002665,0x00000215,0x000500c5,0x00000006, +0x00002669,0x00002665,0x00002668,0x000500c7, +0x00000006,0x0000266a,0x00002669,0x00000611, +0x000500c4,0x00000006,0x0000266d,0x0000266a, +0x00000205,0x000500c5,0x00000006,0x0000266e, +0x0000266a,0x0000266d,0x000500c7,0x00000006, +0x0000266f,0x0000266e,0x00000617,0x000500c4, +0x00000006,0x0000248e,0x0000266f,0x00000154, +0x000500c5,0x00000006,0x0000248f,0x0000248a, +0x0000248e,0x00050051,0x00000006,0x00002491, +0x00002486,0x00000002,0x000500c7,0x00000006, +0x00002674,0x00002491,0x000005fe,0x000500c4, +0x00000006,0x00002677,0x00002674,0x0000023e, +0x000500c5,0x00000006,0x00002678,0x00002674, +0x00002677,0x000500c7,0x00000006,0x00002679, +0x00002678,0x00000605,0x000500c4,0x00000006, +0x0000267c,0x00002679,0x00000308,0x000500c5, +0x00000006,0x0000267d,0x00002679,0x0000267c, +0x000500c7,0x00000006,0x0000267e,0x0000267d, +0x0000060b,0x000500c4,0x00000006,0x00002681, +0x0000267e,0x00000215,0x000500c5,0x00000006, +0x00002682,0x0000267e,0x00002681,0x000500c7, +0x00000006,0x00002683,0x00002682,0x00000611, +0x000500c4,0x00000006,0x00002686,0x00002683, +0x00000205,0x000500c5,0x00000006,0x00002687, +0x00002683,0x00002686,0x000500c7,0x00000006, +0x00002688,0x00002687,0x00000617,0x000500c5, +0x00000006,0x00002493,0x0000248f,0x00002688, +0x000200f9,0x00002494,0x000200f8,0x00002494, +0x000700f5,0x00000006,0x000031ed,0x00000531, +0x000025ca,0x00002493,0x0000263c,0x00050084, +0x00000006,0x00002497,0x0000010a,0x00000b11, +0x00050080,0x00000006,0x00002498,0x00000107, +0x00002497,0x00050095,0x000000ab,0x000026a3, +0x00002505,0x00002498,0x00050051,0x00000006, +0x000026a4,0x000026a3,0x00000001,0x00050051, +0x00000006,0x000026a5,0x000026a3,0x00000000, +0x00050080,0x00000006,0x000026aa,0x0000250c, +0x000026a4,0x00050050,0x00000007,0x000026ab, +0x000026a5,0x000026aa,0x0004007c,0x00000014, +0x0000269b,0x000026ab,0x00060041,0x000000db, +0x00002693,0x0000269b,0x000000da,0x000000da, +0x0005003e,0x00002693,0x000031ed,0x00000002, +0x00000004,0x00050084,0x00000006,0x000026b0, +0x0000010a,0x000024e5,0x00050080,0x00000006, +0x000026b1,0x00000107,0x000026b0,0x00050080, +0x00000006,0x000024a0,0x000026b1,0x00002497, +0x00050095,0x000000ab,0x000026c9,0x00002505, +0x000024a0,0x00050051,0x00000006,0x000026ca, +0x000026c9,0x00000001,0x00050051,0x00000006, +0x000026cb,0x000026c9,0x00000000,0x00050080, +0x00000006,0x000026d0,0x0000250c,0x000026ca, +0x00050050,0x00000007,0x000026d1,0x000026cb, +0x000026d0,0x0004007c,0x00000014,0x000026c1, +0x000026d1,0x00060041,0x000000db,0x000026b9, +0x000026c1,0x000000da,0x000000da,0x0005003e, +0x000026b9,0x00000b11,0x00000002,0x00000004, +0x000200f9,0x00000be4,0x000200f8,0x00000be8, +0x000500aa,0x0000002f,0x00000beb,0x00000b13, +0x00000246,0x000300f7,0x00000bed,0x00000000, +0x000400fa,0x00000beb,0x00000bec,0x00000bed, +0x000200f8,0x00000bec,0x00050041,0x000000fe, +0x00002720,0x000000fc,0x00000308,0x0004003d, +0x00000006,0x00002721,0x00002720,0x00050080, +0x00000006,0x00002723,0x00002721,0x00000b11, +0x00050041,0x000000fe,0x00002829,0x000000fc, +0x0000023e,0x0004003d,0x00000006,0x0000282a, +0x00002829,0x00050084,0x00000006,0x0000282c, +0x00002723,0x00000228,0x00050080,0x00000006, +0x0000282d,0x0000282a,0x0000282c,0x000500c2, +0x00000006,0x0000282e,0x0000282d,0x00000233, +0x000500c4,0x00000006,0x0000282f,0x0000282e, +0x0000020d,0x000500c5,0x00000006,0x00002830, +0x0000282f,0x00000246,0x000200f9,0x0000272f, +0x000200f8,0x0000272f,0x000700f5,0x0000004b, +0x000031a2,0x000032a7,0x00000bec,0x0000328b, +0x0000280b,0x000700f5,0x0000004b,0x000031a0, +0x000032a5,0x00000bec,0x00003286,0x0000280b, +0x000700f5,0x00000006,0x0000319d,0x000000a6, +0x00000bec,0x0000280d,0x0000280b,0x000500b0, +0x0000002f,0x00002732,0x0000319d,0x0000010a, +0x000400f6,0x0000280e,0x0000280b,0x00000000, +0x000400fa,0x00002732,0x00002733,0x0000280e, +0x000200f8,0x00002733,0x00050084,0x00000006, +0x00002735,0x0000010a,0x00000b11,0x00050080, +0x00000006,0x00002737,0x00002735,0x0000319d, +0x00050041,0x000000fe,0x0000273c,0x000000fc, +0x0000027b,0x0004003d,0x00000006,0x0000273d, +0x0000273c,0x000500aa,0x0000002f,0x0000273e, +0x0000273d,0x000000b0,0x000300f7,0x000027d4, +0x00000000,0x000400fa,0x0000273e,0x0000273f, +0x00002784,0x000200f8,0x0000273f,0x00050084, +0x00000006,0x00002742,0x0000010a,0x0000319d, +0x00050080,0x00000006,0x00002743,0x0000282d, +0x00002742,0x00050041,0x00000156,0x00002744, 0x000000fc,0x000000da,0x0004003d,0x00000007, -0x000026a6,0x000026a5,0x00050051,0x00000006, -0x00002b15,0x000026a6,0x00000000,0x00050095, -0x000000ab,0x00002b17,0x00002b15,0x000026a4, -0x00050051,0x00000006,0x00002b18,0x00002b17, -0x00000001,0x00050051,0x00000006,0x00002b19, -0x00002b17,0x00000000,0x00050051,0x00000006, -0x00002b1c,0x000026a6,0x00000001,0x00050080, -0x00000006,0x00002b1e,0x00002b1c,0x00002b18, -0x00050050,0x00000007,0x00002b1f,0x00002b19, -0x00002b1e,0x0004007c,0x00000014,0x00002b0f, -0x00002b1f,0x00060041,0x000000db,0x00002b07, -0x00002b0f,0x000000da,0x000000da,0x0005003e, -0x00002b07,0x00002730,0x00000002,0x00000004, -0x000200f9,0x000026a9,0x000200f8,0x000026a9, -0x000200f9,0x000026b8,0x000200f8,0x000026aa, -0x00050080,0x00000006,0x000026ae,0x0000268b, -0x00002637,0x00050084,0x00000006,0x00002b25, -0x000026ae,0x00000228,0x00050080,0x00000006, -0x00002b26,0x0000272a,0x00002b25,0x000500c2, -0x00000006,0x00002b27,0x00002b26,0x00000233, -0x000500c4,0x00000006,0x00002b28,0x00002b27, -0x0000020d,0x000500c5,0x00000006,0x00002b29, -0x00002b28,0x00000246,0x00050041,0x000000fe, -0x000026b1,0x000000fc,0x0000096c,0x0004003d, -0x00000006,0x000026b2,0x000026b1,0x00050080, -0x00000006,0x000026b4,0x000026b2,0x000026ae, -0x00050041,0x000000fe,0x00002b69,0x000000fc, -0x000000fd,0x0004003d,0x00000006,0x00002b6a, -0x00002b69,0x00050084,0x00000006,0x00002b6b, -0x0000011f,0x00002b6a,0x00050080,0x00000006, -0x00002b6c,0x00000107,0x00002b6b,0x00050080, -0x00000006,0x00002b72,0x00002b6a,0x0000319c, -0x00050086,0x00000006,0x00002b73,0x00002b72, -0x00000101,0x00050084,0x00000006,0x00002b65, -0x00000107,0x00002b73,0x00050080,0x00000006, -0x00002b66,0x00002b6c,0x00002b65,0x00050084, -0x00000006,0x00002b3a,0x00000150,0x000026b4, -0x00050080,0x00000006,0x00002b3b,0x00002b66, -0x00002b3a,0x00050041,0x00000156,0x00002b3c, +0x00002745,0x00002744,0x00050051,0x00000006, +0x00002847,0x00002745,0x00000000,0x00050095, +0x000000ab,0x00002849,0x00002847,0x00002743, +0x00050051,0x00000006,0x0000284a,0x00002849, +0x00000001,0x00050051,0x00000006,0x0000284b, +0x00002849,0x00000000,0x00050051,0x00000006, +0x0000284e,0x00002745,0x00000001,0x00050080, +0x00000006,0x00002850,0x0000284e,0x0000284a, +0x00050050,0x00000007,0x00002851,0x0000284b, +0x00002850,0x0004007c,0x00000014,0x00002841, +0x00002851,0x00060041,0x000000db,0x00002838, +0x00002841,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00002839,0x00002838,0x00000002, +0x00000004,0x000500ab,0x0000002f,0x00002748, +0x00002839,0x00000380,0x000300f7,0x00002783, +0x00000000,0x000400fa,0x00002748,0x00002749, +0x00002783,0x000200f8,0x00002749,0x000500c2, +0x00000006,0x00002855,0x00002839,0x0000020d, +0x00050084,0x00000006,0x0000274c,0x00002855, +0x00000107,0x000500c7,0x00000006,0x0000274e, +0x00002839,0x00000967,0x000500aa,0x0000002f, +0x0000274f,0x0000274e,0x00000246,0x000300f7, +0x00002776,0x00000000,0x000400fa,0x0000274f, +0x00002750,0x0000275c,0x000200f8,0x00002750, +0x00050041,0x000000fe,0x00002751,0x000000fc, +0x0000096c,0x0004003d,0x00000006,0x00002752, +0x00002751,0x00050082,0x00000006,0x00002756, +0x0000274c,0x0000282a,0x00050086,0x00000006, +0x00002757,0x00002756,0x00000228,0x00050080, +0x00000006,0x00002758,0x00002752,0x00002757, +0x00050041,0x000000fe,0x00002895,0x000000fc, +0x000000fd,0x0004003d,0x00000006,0x00002896, +0x00002895,0x00050084,0x00000006,0x00002897, +0x0000011f,0x00002896,0x00050080,0x00000006, +0x00002898,0x00000107,0x00002897,0x00050080, +0x00000006,0x0000289e,0x00002896,0x000032a8, +0x00050086,0x00000006,0x0000289f,0x0000289e, +0x00000101,0x00050084,0x00000006,0x00002891, +0x00000107,0x0000289f,0x00050080,0x00000006, +0x00002892,0x00002898,0x00002891,0x00050084, +0x00000006,0x00002866,0x00000150,0x00002758, +0x00050080,0x00000006,0x00002867,0x00002892, +0x00002866,0x00050041,0x00000156,0x00002868, 0x000000fc,0x00000154,0x0004003d,0x00000007, -0x00002b3d,0x00002b3c,0x00050051,0x00000006, -0x00002b8a,0x00002b3d,0x00000000,0x00050095, -0x000000ab,0x00002b8c,0x00002b8a,0x00002b3b, -0x00050051,0x00000006,0x00002b8d,0x00002b8c, -0x00000001,0x00050051,0x00000006,0x00002b8e, -0x00002b8c,0x00000000,0x00050051,0x00000006, -0x00002b91,0x00002b3d,0x00000001,0x00050080, -0x00000006,0x00002b93,0x00002b91,0x00002b8d, -0x00050050,0x00000007,0x00002b94,0x00002b8e, -0x00002b93,0x0004007c,0x00000014,0x00002b84, -0x00002b94,0x00060041,0x000000db,0x00002b7b, -0x00002b84,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00002b7c,0x00002b7b,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002b40, -0x00002b7c,0x00050080,0x00000006,0x00002b42, -0x00002b3b,0x0000010a,0x00050095,0x000000ab, -0x00002bad,0x00002b8a,0x00002b42,0x00050051, -0x00000006,0x00002bae,0x00002bad,0x00000001, -0x00050051,0x00000006,0x00002baf,0x00002bad, -0x00000000,0x00050080,0x00000006,0x00002bb4, -0x00002b91,0x00002bae,0x00050050,0x00000007, -0x00002bb5,0x00002baf,0x00002bb4,0x0004007c, -0x00000014,0x00002ba5,0x00002bb5,0x00060041, -0x000000db,0x00002b9c,0x00002ba5,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00002b9d, -0x00002b9c,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00002b46,0x00002b9d,0x00050080, -0x00000006,0x00002b48,0x00002b3b,0x00000111, -0x00050095,0x000000ab,0x00002bce,0x00002b8a, -0x00002b48,0x00050051,0x00000006,0x00002bcf, -0x00002bce,0x00000001,0x00050051,0x00000006, -0x00002bd0,0x00002bce,0x00000000,0x00050080, -0x00000006,0x00002bd5,0x00002b91,0x00002bcf, -0x00050050,0x00000007,0x00002bd6,0x00002bd0, -0x00002bd5,0x0004007c,0x00000014,0x00002bc6, -0x00002bd6,0x00060041,0x000000db,0x00002bbd, -0x00002bc6,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00002bbe,0x00002bbd,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002b4c, -0x00002bbe,0x00060050,0x0000004b,0x00002b4d, -0x00002b40,0x00002b46,0x00002b4c,0x00050080, -0x00000006,0x00002b4f,0x00002b3b,0x00000118, -0x00050095,0x000000ab,0x00002bef,0x00002b8a, -0x00002b4f,0x00050051,0x00000006,0x00002bf0, -0x00002bef,0x00000001,0x00050051,0x00000006, -0x00002bf1,0x00002bef,0x00000000,0x00050080, -0x00000006,0x00002bf6,0x00002b91,0x00002bf0, -0x00050050,0x00000007,0x00002bf7,0x00002bf1, -0x00002bf6,0x0004007c,0x00000014,0x00002be7, -0x00002bf7,0x00060041,0x000000db,0x00002bde, -0x00002be7,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00002bdf,0x00002bde,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002b53, -0x00002bdf,0x00050080,0x00000006,0x00002b55, -0x00002b3b,0x0000011f,0x00050095,0x000000ab, -0x00002c10,0x00002b8a,0x00002b55,0x00050051, -0x00000006,0x00002c11,0x00002c10,0x00000001, -0x00050051,0x00000006,0x00002c12,0x00002c10, -0x00000000,0x00050080,0x00000006,0x00002c17, -0x00002b91,0x00002c11,0x00050050,0x00000007, -0x00002c18,0x00002c12,0x00002c17,0x0004007c, -0x00000014,0x00002c08,0x00002c18,0x00060041, -0x000000db,0x00002bff,0x00002c08,0x000000da, -0x000000da,0x0006003d,0x00000006,0x00002c00, -0x00002bff,0x00000002,0x00000004,0x0004007c, -0x00000027,0x00002b59,0x00002c00,0x00050080, -0x00000006,0x00002b5b,0x00002b3b,0x00000189, -0x00050095,0x000000ab,0x00002c31,0x00002b8a, -0x00002b5b,0x00050051,0x00000006,0x00002c32, -0x00002c31,0x00000001,0x00050051,0x00000006, -0x00002c33,0x00002c31,0x00000000,0x00050080, -0x00000006,0x00002c38,0x00002b91,0x00002c32, -0x00050050,0x00000007,0x00002c39,0x00002c33, -0x00002c38,0x0004007c,0x00000014,0x00002c29, -0x00002c39,0x00060041,0x000000db,0x00002c20, -0x00002c29,0x000000da,0x000000da,0x0006003d, -0x00000006,0x00002c21,0x00002c20,0x00000002, -0x00000004,0x0004007c,0x00000027,0x00002b5f, -0x00002c21,0x00060050,0x0000004b,0x00002b60, -0x00002b53,0x00002b59,0x00002b5f,0x000200f9, -0x000026b8,0x000200f8,0x000026b8,0x000700f5, -0x0000004b,0x0000309b,0x00002a26,0x000026a9, -0x00002b60,0x000026aa,0x000700f5,0x0000004b, -0x00003099,0x00002a13,0x000026a9,0x00002b4d, -0x000026aa,0x000700f5,0x00000006,0x00003097, -0x000029e9,0x000026a9,0x00002b29,0x000026aa, -0x00050041,0x000000fe,0x000026b9,0x000000fc, -0x000009ef,0x0004003d,0x00000006,0x000026ba, -0x000026b9,0x000500c2,0x00000006,0x00002c3d, -0x00003097,0x0000020d,0x00050041,0x000000fe, -0x000026bd,0x000000fc,0x0000022c,0x0004003d, -0x00000006,0x000026be,0x000026bd,0x00050086, -0x00000006,0x000026bf,0x000026be,0x00000107, -0x00050082,0x00000006,0x000026c0,0x00002c3d, -0x000026bf,0x00050084,0x00000006,0x000026c1, -0x0000010a,0x000026c0,0x00050080,0x00000006, -0x000026c2,0x000026ba,0x000026c1,0x00050041, -0x00000156,0x000026c3,0x000000fc,0x000000da, -0x0004003d,0x00000007,0x000026c4,0x000026c3, -0x00050051,0x00000006,0x00002c53,0x000026c4, -0x00000000,0x00050095,0x000000ab,0x00002c55, -0x00002c53,0x000026c2,0x00050051,0x00000006, -0x00002c56,0x00002c55,0x00000001,0x00050051, -0x00000006,0x00002c57,0x00002c55,0x00000000, -0x00050051,0x00000006,0x00002c5a,0x000026c4, -0x00000001,0x00050080,0x00000006,0x00002c5c, -0x00002c5a,0x00002c56,0x00050050,0x00000007, -0x00002c5d,0x00002c57,0x00002c5c,0x0004007c, -0x00000014,0x00002c4d,0x00002c5d,0x00060041, -0x000000db,0x00002c45,0x00002c4d,0x000000da, -0x000000da,0x0005003e,0x00002c45,0x00002730, -0x00000002,0x00000004,0x00050051,0x00000027, -0x00002c61,0x00003099,0x00000000,0x00050051, -0x00000027,0x00002c63,0x0000309b,0x00000000, -0x000500bc,0x0000002f,0x00002c64,0x00002c61, -0x00002c63,0x000300f7,0x00002c6b,0x00000000, -0x000400fa,0x00002c64,0x00002c65,0x00002c6b, -0x000200f8,0x00002c65,0x00050051,0x00000027, -0x00002c67,0x00003099,0x00000001,0x00050051, -0x00000027,0x00002c69,0x0000309b,0x00000001, -0x000500bc,0x0000002f,0x00002c6a,0x00002c67, -0x00002c69,0x000200f9,0x00002c6b,0x000200f8, -0x00002c6b,0x000700f5,0x0000002f,0x00002c6c, -0x00002c64,0x000026b8,0x00002c6a,0x00002c65, -0x000300f7,0x00002c73,0x00000000,0x000400fa, -0x00002c6c,0x00002c6d,0x00002c73,0x000200f8, -0x00002c6d,0x00050051,0x00000027,0x00002c6f, -0x00003099,0x00000002,0x00050051,0x00000027, -0x00002c71,0x0000309b,0x00000002,0x000500bc, -0x0000002f,0x00002c72,0x00002c6f,0x00002c71, -0x000200f9,0x00002c73,0x000200f8,0x00002c73, -0x000700f5,0x0000002f,0x00002c74,0x00002c6c, -0x00002c6b,0x00002c72,0x00002c6d,0x000300f7, -0x000026d2,0x00000000,0x000400fa,0x00002c74, -0x000026cb,0x000026d2,0x000200f8,0x000026cb, -0x0007000c,0x0000004b,0x000026ce,0x00000001, -0x00000025,0x00003094,0x00003099,0x0007000c, -0x0000004b,0x000026d1,0x00000001,0x00000028, -0x00003096,0x0000309b,0x000200f9,0x000026d2, -0x000200f8,0x000026d2,0x000700f5,0x0000004b, -0x00003183,0x00003096,0x00002c73,0x000026d1, -0x000026cb,0x000700f5,0x0000004b,0x0000317e, -0x00003094,0x00002c73,0x000026ce,0x000026cb, -0x000200f9,0x000026d3,0x000200f8,0x000026d3, -0x000700f5,0x0000004b,0x00003182,0x00003096, -0x00002684,0x00003183,0x000026d2,0x000700f5, -0x0000004b,0x0000317d,0x00003094,0x00002684, -0x0000317e,0x000026d2,0x000700f5,0x0000004b, -0x000030d9,0x0000319b,0x00002684,0x0000309b, -0x000026d2,0x000700f5,0x0000004b,0x000030d4, -0x00003199,0x00002684,0x00003099,0x000026d2, -0x000700f5,0x00000006,0x000030cd,0x00000380, -0x00002684,0x00003097,0x000026d2,0x000200f9, -0x000026d4,0x000200f8,0x000026d4,0x000700f5, -0x0000004b,0x0000317f,0x00003180,0x00002683, -0x00003182,0x000026d3,0x000700f5,0x0000004b, -0x0000317a,0x0000317b,0x00002683,0x0000317d, -0x000026d3,0x000700f5,0x0000004b,0x000030d6, -0x000030d7,0x00002683,0x000030d9,0x000026d3, -0x000700f5,0x0000004b,0x000030d1,0x000030d2, -0x00002683,0x000030d4,0x000026d3,0x000700f5, -0x00000006,0x000030c6,0x00002739,0x00002683, -0x000030cd,0x000026d3,0x00050084,0x00000006, -0x000026d7,0x0000010a,0x00003091,0x00050080, -0x00000006,0x000026d8,0x0000272d,0x000026d7, -0x00050041,0x00000156,0x000026d9,0x000000fc, -0x000000da,0x0004003d,0x00000007,0x000026da, -0x000026d9,0x00050051,0x00000006,0x00002c8b, -0x000026da,0x00000000,0x00050095,0x000000ab, -0x00002c8d,0x00002c8b,0x000026d8,0x00050051, -0x00000006,0x00002c8e,0x00002c8d,0x00000001, -0x00050051,0x00000006,0x00002c8f,0x00002c8d, -0x00000000,0x00050051,0x00000006,0x00002c92, -0x000026da,0x00000001,0x00050080,0x00000006, -0x00002c94,0x00002c92,0x00002c8e,0x00050050, -0x00000007,0x00002c95,0x00002c8f,0x00002c94, -0x0004007c,0x00000014,0x00002c85,0x00002c95, -0x00060041,0x000000db,0x00002c7d,0x00002c85, -0x000000da,0x000000da,0x0005003e,0x00002c7d, -0x000030c6,0x00000002,0x00000004,0x00050080, -0x00000006,0x000026de,0x0000272d,0x0000011f, -0x00050084,0x00000006,0x000026e0,0x00000150, -0x00003091,0x00050080,0x00000006,0x000026e1, -0x000026de,0x000026e0,0x00050051,0x00000027, -0x000026e6,0x000030d1,0x00000000,0x0004007c, -0x00000006,0x00002c9b,0x000026e6,0x00050095, -0x000000ab,0x00002cb6,0x00002c8b,0x000026e1, -0x00050051,0x00000006,0x00002cb7,0x00002cb6, -0x00000001,0x00050051,0x00000006,0x00002cb8, -0x00002cb6,0x00000000,0x00050080,0x00000006, -0x00002cbd,0x00002c92,0x00002cb7,0x00050050, -0x00000007,0x00002cbe,0x00002cb8,0x00002cbd, -0x0004007c,0x00000014,0x00002cae,0x00002cbe, -0x00060041,0x000000db,0x00002ca6,0x00002cae, -0x000000da,0x000000da,0x0005003e,0x00002ca6, -0x00002c9b,0x00000002,0x00000004,0x00050080, -0x00000006,0x000026e9,0x000026e1,0x0000010a, -0x00050051,0x00000027,0x000026ed,0x000030d1, -0x00000001,0x0004007c,0x00000006,0x00002cc4, -0x000026ed,0x00050095,0x000000ab,0x00002cdf, -0x00002c8b,0x000026e9,0x00050051,0x00000006, -0x00002ce0,0x00002cdf,0x00000001,0x00050051, -0x00000006,0x00002ce1,0x00002cdf,0x00000000, -0x00050080,0x00000006,0x00002ce6,0x00002c92, -0x00002ce0,0x00050050,0x00000007,0x00002ce7, -0x00002ce1,0x00002ce6,0x0004007c,0x00000014, -0x00002cd7,0x00002ce7,0x00060041,0x000000db, -0x00002ccf,0x00002cd7,0x000000da,0x000000da, -0x0005003e,0x00002ccf,0x00002cc4,0x00000002, -0x00000004,0x00050080,0x00000006,0x000026f0, -0x000026e1,0x00000111,0x00050051,0x00000027, -0x000026f4,0x000030d1,0x00000002,0x0004007c, -0x00000006,0x00002ced,0x000026f4,0x00050095, -0x000000ab,0x00002d08,0x00002c8b,0x000026f0, -0x00050051,0x00000006,0x00002d09,0x00002d08, -0x00000001,0x00050051,0x00000006,0x00002d0a, -0x00002d08,0x00000000,0x00050080,0x00000006, -0x00002d0f,0x00002c92,0x00002d09,0x00050050, -0x00000007,0x00002d10,0x00002d0a,0x00002d0f, -0x0004007c,0x00000014,0x00002d00,0x00002d10, -0x00060041,0x000000db,0x00002cf8,0x00002d00, -0x000000da,0x000000da,0x0005003e,0x00002cf8, -0x00002ced,0x00000002,0x00000004,0x00050080, -0x00000006,0x000026f7,0x000026e1,0x00000118, -0x00050051,0x00000027,0x000026fb,0x000030d6, -0x00000000,0x0004007c,0x00000006,0x00002d16, -0x000026fb,0x00050095,0x000000ab,0x00002d31, -0x00002c8b,0x000026f7,0x00050051,0x00000006, -0x00002d32,0x00002d31,0x00000001,0x00050051, -0x00000006,0x00002d33,0x00002d31,0x00000000, -0x00050080,0x00000006,0x00002d38,0x00002c92, -0x00002d32,0x00050050,0x00000007,0x00002d39, -0x00002d33,0x00002d38,0x0004007c,0x00000014, -0x00002d29,0x00002d39,0x00060041,0x000000db, -0x00002d21,0x00002d29,0x000000da,0x000000da, -0x0005003e,0x00002d21,0x00002d16,0x00000002, -0x00000004,0x00050080,0x00000006,0x000026fe, -0x000026e1,0x0000011f,0x00050051,0x00000027, -0x00002702,0x000030d6,0x00000001,0x0004007c, -0x00000006,0x00002d3f,0x00002702,0x00050095, -0x000000ab,0x00002d5a,0x00002c8b,0x000026fe, -0x00050051,0x00000006,0x00002d5b,0x00002d5a, -0x00000001,0x00050051,0x00000006,0x00002d5c, -0x00002d5a,0x00000000,0x00050080,0x00000006, -0x00002d61,0x00002c92,0x00002d5b,0x00050050, -0x00000007,0x00002d62,0x00002d5c,0x00002d61, -0x0004007c,0x00000014,0x00002d52,0x00002d62, -0x00060041,0x000000db,0x00002d4a,0x00002d52, -0x000000da,0x000000da,0x0005003e,0x00002d4a, -0x00002d3f,0x00000002,0x00000004,0x00050080, -0x00000006,0x00002705,0x000026e1,0x00000189, -0x00050051,0x00000027,0x00002709,0x000030d6, -0x00000002,0x0004007c,0x00000006,0x00002d68, -0x00002709,0x00050095,0x000000ab,0x00002d83, -0x00002c8b,0x00002705,0x00050051,0x00000006, -0x00002d84,0x00002d83,0x00000001,0x00050051, -0x00000006,0x00002d85,0x00002d83,0x00000000, -0x00050080,0x00000006,0x00002d8a,0x00002c92, -0x00002d84,0x00050050,0x00000007,0x00002d8b, -0x00002d85,0x00002d8a,0x0004007c,0x00000014, -0x00002d7b,0x00002d8b,0x00060041,0x000000db, -0x00002d73,0x00002d7b,0x000000da,0x000000da, -0x0005003e,0x00002d73,0x00002d68,0x00000002, -0x00000004,0x000200f9,0x0000270b,0x000200f8, -0x0000270b,0x00050080,0x00000006,0x0000270d, -0x00003091,0x00000154,0x000200f9,0x0000262f, -0x000200f8,0x0000270e,0x000200f9,0x0000270f, -0x000200f8,0x0000270f,0x000700f5,0x00000006, -0x00003092,0x000000a6,0x0000270e,0x0000271e, -0x00002713,0x000500b0,0x0000002f,0x00002712, -0x00003092,0x0000010a,0x000400f6,0x0000271f, -0x00002713,0x00000000,0x000400fa,0x00002712, -0x00002713,0x0000271f,0x000200f8,0x00002713, -0x00050080,0x00000006,0x00002715,0x0000272d, -0x000005c6,0x00050084,0x00000006,0x00002717, -0x0000010a,0x00003092,0x00050080,0x00000006, -0x00002718,0x00002715,0x00002717,0x00050041, -0x00000156,0x00002719,0x000000fc,0x000000da, -0x0004003d,0x00000007,0x0000271a,0x00002719, -0x00050051,0x00000006,0x00002da1,0x0000271a, -0x00000000,0x00050095,0x000000ab,0x00002da3, -0x00002da1,0x00002718,0x00050051,0x00000006, -0x00002da4,0x00002da3,0x00000001,0x00050051, -0x00000006,0x00002da5,0x00002da3,0x00000000, -0x00050051,0x00000006,0x00002da8,0x0000271a, -0x00000001,0x00050080,0x00000006,0x00002daa, -0x00002da8,0x00002da4,0x00050050,0x00000007, -0x00002dab,0x00002da5,0x00002daa,0x0004007c, -0x00000014,0x00002d9b,0x00002dab,0x00060041, -0x000000db,0x00002d93,0x00002d9b,0x000000da, -0x000000da,0x0005003e,0x00002d93,0x000000a6, -0x00000002,0x00000004,0x00050080,0x00000006, -0x0000271e,0x00003092,0x00000154,0x000200f9, -0x0000270f,0x000200f8,0x0000271f,0x00050041, -0x000000fe,0x00002720,0x000000fc,0x0000096c, -0x0004003d,0x00000006,0x00002721,0x00002720, -0x00050080,0x00000006,0x00002723,0x00002721, -0x00002623,0x00050041,0x000000fe,0x00002df5, -0x000000fc,0x000000fd,0x0004003d,0x00000006, -0x00002df6,0x00002df5,0x00050084,0x00000006, -0x00002df7,0x0000011f,0x00002df6,0x00050080, -0x00000006,0x00002df8,0x00000107,0x00002df7, -0x00050080,0x00000006,0x00002dfe,0x00002df6, -0x0000319c,0x00050086,0x00000006,0x00002dff, -0x00002dfe,0x00000101,0x00050084,0x00000006, -0x00002df1,0x00000107,0x00002dff,0x00050080, -0x00000006,0x00002df2,0x00002df8,0x00002df1, -0x00050084,0x00000006,0x00002dc2,0x00000150, -0x00002723,0x00050080,0x00000006,0x00002dc3, -0x00002df2,0x00002dc2,0x00050041,0x00000156, -0x00002dc4,0x000000fc,0x00000154,0x0004003d, -0x00000007,0x00002dc5,0x00002dc4,0x00050051, -0x00000027,0x00002dc8,0x00003094,0x00000000, -0x0004007c,0x00000006,0x00002e05,0x00002dc8, -0x00050051,0x00000006,0x00002e1e,0x00002dc5, -0x00000000,0x00050095,0x000000ab,0x00002e20, -0x00002e1e,0x00002dc3,0x00050051,0x00000006, -0x00002e21,0x00002e20,0x00000001,0x00050051, -0x00000006,0x00002e22,0x00002e20,0x00000000, -0x00050051,0x00000006,0x00002e25,0x00002dc5, -0x00000001,0x00050080,0x00000006,0x00002e27, -0x00002e25,0x00002e21,0x00050050,0x00000007, -0x00002e28,0x00002e22,0x00002e27,0x0004007c, -0x00000014,0x00002e18,0x00002e28,0x00060041, -0x000000db,0x00002e10,0x00002e18,0x000000da, -0x000000da,0x0005003e,0x00002e10,0x00002e05, -0x00000002,0x00000004,0x00050080,0x00000006, -0x00002dcb,0x00002dc3,0x0000010a,0x00050051, -0x00000027,0x00002dcf,0x00003094,0x00000001, -0x0004007c,0x00000006,0x00002e2e,0x00002dcf, -0x00050095,0x000000ab,0x00002e49,0x00002e1e, -0x00002dcb,0x00050051,0x00000006,0x00002e4a, -0x00002e49,0x00000001,0x00050051,0x00000006, -0x00002e4b,0x00002e49,0x00000000,0x00050080, -0x00000006,0x00002e50,0x00002e25,0x00002e4a, -0x00050050,0x00000007,0x00002e51,0x00002e4b, -0x00002e50,0x0004007c,0x00000014,0x00002e41, -0x00002e51,0x00060041,0x000000db,0x00002e39, -0x00002e41,0x000000da,0x000000da,0x0005003e, -0x00002e39,0x00002e2e,0x00000002,0x00000004, -0x00050080,0x00000006,0x00002dd2,0x00002dc3, -0x00000111,0x00050051,0x00000027,0x00002dd6, -0x00003094,0x00000002,0x0004007c,0x00000006, -0x00002e57,0x00002dd6,0x00050095,0x000000ab, -0x00002e72,0x00002e1e,0x00002dd2,0x00050051, -0x00000006,0x00002e73,0x00002e72,0x00000001, -0x00050051,0x00000006,0x00002e74,0x00002e72, -0x00000000,0x00050080,0x00000006,0x00002e79, -0x00002e25,0x00002e73,0x00050050,0x00000007, -0x00002e7a,0x00002e74,0x00002e79,0x0004007c, -0x00000014,0x00002e6a,0x00002e7a,0x00060041, -0x000000db,0x00002e62,0x00002e6a,0x000000da, -0x000000da,0x0005003e,0x00002e62,0x00002e57, +0x00002869,0x00002868,0x00050051,0x00000006, +0x000028b6,0x00002869,0x00000000,0x00050095, +0x000000ab,0x000028b8,0x000028b6,0x00002867, +0x00050051,0x00000006,0x000028b9,0x000028b8, +0x00000001,0x00050051,0x00000006,0x000028ba, +0x000028b8,0x00000000,0x00050051,0x00000006, +0x000028bd,0x00002869,0x00000001,0x00050080, +0x00000006,0x000028bf,0x000028bd,0x000028b9, +0x00050050,0x00000007,0x000028c0,0x000028ba, +0x000028bf,0x0004007c,0x00000014,0x000028b0, +0x000028c0,0x00060041,0x000000db,0x000028a7, +0x000028b0,0x000000da,0x000000da,0x0006003d, +0x00000006,0x000028a8,0x000028a7,0x00000002, +0x00000004,0x0004007c,0x00000027,0x0000286c, +0x000028a8,0x00050080,0x00000006,0x0000286e, +0x00002867,0x0000010a,0x00050095,0x000000ab, +0x000028d9,0x000028b6,0x0000286e,0x00050051, +0x00000006,0x000028da,0x000028d9,0x00000001, +0x00050051,0x00000006,0x000028db,0x000028d9, +0x00000000,0x00050080,0x00000006,0x000028e0, +0x000028bd,0x000028da,0x00050050,0x00000007, +0x000028e1,0x000028db,0x000028e0,0x0004007c, +0x00000014,0x000028d1,0x000028e1,0x00060041, +0x000000db,0x000028c8,0x000028d1,0x000000da, +0x000000da,0x0006003d,0x00000006,0x000028c9, +0x000028c8,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002872,0x000028c9,0x00050080, +0x00000006,0x00002874,0x00002867,0x00000111, +0x00050095,0x000000ab,0x000028fa,0x000028b6, +0x00002874,0x00050051,0x00000006,0x000028fb, +0x000028fa,0x00000001,0x00050051,0x00000006, +0x000028fc,0x000028fa,0x00000000,0x00050080, +0x00000006,0x00002901,0x000028bd,0x000028fb, +0x00050050,0x00000007,0x00002902,0x000028fc, +0x00002901,0x0004007c,0x00000014,0x000028f2, +0x00002902,0x00060041,0x000000db,0x000028e9, +0x000028f2,0x000000da,0x000000da,0x0006003d, +0x00000006,0x000028ea,0x000028e9,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00002878, +0x000028ea,0x00060050,0x0000004b,0x00002879, +0x0000286c,0x00002872,0x00002878,0x00050080, +0x00000006,0x0000287b,0x00002867,0x00000118, +0x00050095,0x000000ab,0x0000291b,0x000028b6, +0x0000287b,0x00050051,0x00000006,0x0000291c, +0x0000291b,0x00000001,0x00050051,0x00000006, +0x0000291d,0x0000291b,0x00000000,0x00050080, +0x00000006,0x00002922,0x000028bd,0x0000291c, +0x00050050,0x00000007,0x00002923,0x0000291d, +0x00002922,0x0004007c,0x00000014,0x00002913, +0x00002923,0x00060041,0x000000db,0x0000290a, +0x00002913,0x000000da,0x000000da,0x0006003d, +0x00000006,0x0000290b,0x0000290a,0x00000002, +0x00000004,0x0004007c,0x00000027,0x0000287f, +0x0000290b,0x00050080,0x00000006,0x00002881, +0x00002867,0x0000011f,0x00050095,0x000000ab, +0x0000293c,0x000028b6,0x00002881,0x00050051, +0x00000006,0x0000293d,0x0000293c,0x00000001, +0x00050051,0x00000006,0x0000293e,0x0000293c, +0x00000000,0x00050080,0x00000006,0x00002943, +0x000028bd,0x0000293d,0x00050050,0x00000007, +0x00002944,0x0000293e,0x00002943,0x0004007c, +0x00000014,0x00002934,0x00002944,0x00060041, +0x000000db,0x0000292b,0x00002934,0x000000da, +0x000000da,0x0006003d,0x00000006,0x0000292c, +0x0000292b,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002885,0x0000292c,0x00050080, +0x00000006,0x00002887,0x00002867,0x00000189, +0x00050095,0x000000ab,0x0000295d,0x000028b6, +0x00002887,0x00050051,0x00000006,0x0000295e, +0x0000295d,0x00000001,0x00050051,0x00000006, +0x0000295f,0x0000295d,0x00000000,0x00050080, +0x00000006,0x00002964,0x000028bd,0x0000295e, +0x00050050,0x00000007,0x00002965,0x0000295f, +0x00002964,0x0004007c,0x00000014,0x00002955, +0x00002965,0x00060041,0x000000db,0x0000294c, +0x00002955,0x000000da,0x000000da,0x0006003d, +0x00000006,0x0000294d,0x0000294c,0x00000002, +0x00000004,0x0004007c,0x00000027,0x0000288b, +0x0000294d,0x00060050,0x0000004b,0x0000288c, +0x0000287f,0x00002885,0x0000288b,0x000200f9, +0x00002776,0x000200f8,0x0000275c,0x00050041, +0x000000fe,0x0000275e,0x000000fc,0x0000022c, +0x0004003d,0x00000006,0x0000275f,0x0000275e, +0x00050082,0x00000006,0x00002760,0x0000274c, +0x0000275f,0x00050041,0x000000fe,0x00002968, +0x000000fc,0x00000224,0x0004003d,0x00000006, +0x00002969,0x00002968,0x000500ab,0x0000002f, +0x0000296a,0x00002969,0x000000a6,0x000600a9, +0x00000006,0x0000296b,0x0000296a,0x00000228, +0x00000107,0x00050086,0x00000006,0x00002762, +0x00002760,0x0000296b,0x00050041,0x000000fe, +0x000029ab,0x000000fc,0x000000fd,0x0004003d, +0x00000006,0x000029ac,0x000029ab,0x00050084, +0x00000006,0x000029ad,0x0000011f,0x000029ac, +0x00050080,0x00000006,0x000029ae,0x00000107, +0x000029ad,0x00050080,0x00000006,0x000029b4, +0x000029ac,0x000032a8,0x00050086,0x00000006, +0x000029b5,0x000029b4,0x00000101,0x00050084, +0x00000006,0x000029a7,0x00000107,0x000029b5, +0x00050080,0x00000006,0x000029a8,0x000029ae, +0x000029a7,0x00050084,0x00000006,0x0000297c, +0x00000150,0x00002762,0x00050080,0x00000006, +0x0000297d,0x000029a8,0x0000297c,0x00050041, +0x00000156,0x0000297e,0x000000fc,0x00000154, +0x0004003d,0x00000007,0x0000297f,0x0000297e, +0x00050051,0x00000006,0x000029cc,0x0000297f, +0x00000000,0x00050095,0x000000ab,0x000029ce, +0x000029cc,0x0000297d,0x00050051,0x00000006, +0x000029cf,0x000029ce,0x00000001,0x00050051, +0x00000006,0x000029d0,0x000029ce,0x00000000, +0x00050051,0x00000006,0x000029d3,0x0000297f, +0x00000001,0x00050080,0x00000006,0x000029d5, +0x000029d3,0x000029cf,0x00050050,0x00000007, +0x000029d6,0x000029d0,0x000029d5,0x0004007c, +0x00000014,0x000029c6,0x000029d6,0x00060041, +0x000000db,0x000029bd,0x000029c6,0x000000da, +0x000000da,0x0006003d,0x00000006,0x000029be, +0x000029bd,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002982,0x000029be,0x00050080, +0x00000006,0x00002984,0x0000297d,0x0000010a, +0x00050095,0x000000ab,0x000029ef,0x000029cc, +0x00002984,0x00050051,0x00000006,0x000029f0, +0x000029ef,0x00000001,0x00050051,0x00000006, +0x000029f1,0x000029ef,0x00000000,0x00050080, +0x00000006,0x000029f6,0x000029d3,0x000029f0, +0x00050050,0x00000007,0x000029f7,0x000029f1, +0x000029f6,0x0004007c,0x00000014,0x000029e7, +0x000029f7,0x00060041,0x000000db,0x000029de, +0x000029e7,0x000000da,0x000000da,0x0006003d, +0x00000006,0x000029df,0x000029de,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00002988, +0x000029df,0x00050080,0x00000006,0x0000298a, +0x0000297d,0x00000111,0x00050095,0x000000ab, +0x00002a10,0x000029cc,0x0000298a,0x00050051, +0x00000006,0x00002a11,0x00002a10,0x00000001, +0x00050051,0x00000006,0x00002a12,0x00002a10, +0x00000000,0x00050080,0x00000006,0x00002a17, +0x000029d3,0x00002a11,0x00050050,0x00000007, +0x00002a18,0x00002a12,0x00002a17,0x0004007c, +0x00000014,0x00002a08,0x00002a18,0x00060041, +0x000000db,0x000029ff,0x00002a08,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00002a00, +0x000029ff,0x00000002,0x00000004,0x0004007c, +0x00000027,0x0000298e,0x00002a00,0x00060050, +0x0000004b,0x0000298f,0x00002982,0x00002988, +0x0000298e,0x00050080,0x00000006,0x00002991, +0x0000297d,0x00000118,0x00050095,0x000000ab, +0x00002a31,0x000029cc,0x00002991,0x00050051, +0x00000006,0x00002a32,0x00002a31,0x00000001, +0x00050051,0x00000006,0x00002a33,0x00002a31, +0x00000000,0x00050080,0x00000006,0x00002a38, +0x000029d3,0x00002a32,0x00050050,0x00000007, +0x00002a39,0x00002a33,0x00002a38,0x0004007c, +0x00000014,0x00002a29,0x00002a39,0x00060041, +0x000000db,0x00002a20,0x00002a29,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00002a21, +0x00002a20,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002995,0x00002a21,0x00050080, +0x00000006,0x00002997,0x0000297d,0x0000011f, +0x00050095,0x000000ab,0x00002a52,0x000029cc, +0x00002997,0x00050051,0x00000006,0x00002a53, +0x00002a52,0x00000001,0x00050051,0x00000006, +0x00002a54,0x00002a52,0x00000000,0x00050080, +0x00000006,0x00002a59,0x000029d3,0x00002a53, +0x00050050,0x00000007,0x00002a5a,0x00002a54, +0x00002a59,0x0004007c,0x00000014,0x00002a4a, +0x00002a5a,0x00060041,0x000000db,0x00002a41, +0x00002a4a,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00002a42,0x00002a41,0x00000002, +0x00000004,0x0004007c,0x00000027,0x0000299b, +0x00002a42,0x00050080,0x00000006,0x0000299d, +0x0000297d,0x00000189,0x00050095,0x000000ab, +0x00002a73,0x000029cc,0x0000299d,0x00050051, +0x00000006,0x00002a74,0x00002a73,0x00000001, +0x00050051,0x00000006,0x00002a75,0x00002a73, +0x00000000,0x00050080,0x00000006,0x00002a7a, +0x000029d3,0x00002a74,0x00050050,0x00000007, +0x00002a7b,0x00002a75,0x00002a7a,0x0004007c, +0x00000014,0x00002a6b,0x00002a7b,0x00060041, +0x000000db,0x00002a62,0x00002a6b,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00002a63, +0x00002a62,0x00000002,0x00000004,0x0004007c, +0x00000027,0x000029a1,0x00002a63,0x00060050, +0x0000004b,0x000029a2,0x00002995,0x0000299b, +0x000029a1,0x000300f7,0x00002775,0x00000000, +0x000400fa,0x0000296a,0x0000276a,0x00002775, +0x000200f8,0x0000276a,0x00050084,0x00000006, +0x0000276e,0x00000228,0x00002762,0x00050080, +0x00000006,0x0000276f,0x0000275f,0x0000276e, +0x00050080,0x00000006,0x00002770,0x0000276f, +0x000005d0,0x00050095,0x000000ab,0x00002a93, +0x00002847,0x00002770,0x00050051,0x00000006, +0x00002a94,0x00002a93,0x00000001,0x00050051, +0x00000006,0x00002a95,0x00002a93,0x00000000, +0x00050080,0x00000006,0x00002a9a,0x0000284e, +0x00002a94,0x00050050,0x00000007,0x00002a9b, +0x00002a95,0x00002a9a,0x0004007c,0x00000014, +0x00002a8b,0x00002a9b,0x00060041,0x000000db, +0x00002a83,0x00002a8b,0x000000da,0x000000da, +0x0005003e,0x00002a83,0x00002830,0x00000002, +0x00000004,0x000200f9,0x00002775,0x000200f8, +0x00002775,0x000200f9,0x00002776,0x000200f8, +0x00002776,0x000700f5,0x0000004b,0x000031b7, +0x0000288c,0x00002750,0x000029a2,0x00002775, +0x000700f5,0x0000004b,0x000031b5,0x00002879, +0x00002750,0x0000298f,0x00002775,0x00050051, +0x00000027,0x00002a9f,0x000031b5,0x00000000, +0x00050051,0x00000027,0x00002aa1,0x000031b7, +0x00000000,0x000500bc,0x0000002f,0x00002aa2, +0x00002a9f,0x00002aa1,0x000300f7,0x00002aa9, +0x00000000,0x000400fa,0x00002aa2,0x00002aa3, +0x00002aa9,0x000200f8,0x00002aa3,0x00050051, +0x00000027,0x00002aa5,0x000031b5,0x00000001, +0x00050051,0x00000027,0x00002aa7,0x000031b7, +0x00000001,0x000500bc,0x0000002f,0x00002aa8, +0x00002aa5,0x00002aa7,0x000200f9,0x00002aa9, +0x000200f8,0x00002aa9,0x000700f5,0x0000002f, +0x00002aaa,0x00002aa2,0x00002776,0x00002aa8, +0x00002aa3,0x000300f7,0x00002ab1,0x00000000, +0x000400fa,0x00002aaa,0x00002aab,0x00002ab1, +0x000200f8,0x00002aab,0x00050051,0x00000027, +0x00002aad,0x000031b5,0x00000002,0x00050051, +0x00000027,0x00002aaf,0x000031b7,0x00000002, +0x000500bc,0x0000002f,0x00002ab0,0x00002aad, +0x00002aaf,0x000200f9,0x00002ab1,0x000200f8, +0x00002ab1,0x000700f5,0x0000002f,0x00002ab2, +0x00002aaa,0x00002aa9,0x00002ab0,0x00002aab, +0x000300f7,0x00002782,0x00000000,0x000400fa, +0x00002ab2,0x0000277b,0x00002782,0x000200f8, +0x0000277b,0x0007000c,0x0000004b,0x0000277e, +0x00000001,0x00000025,0x000031a0,0x000031b5, +0x0007000c,0x0000004b,0x00002781,0x00000001, +0x00000028,0x000031a2,0x000031b7,0x000200f9, +0x00002782,0x000200f8,0x00002782,0x000700f5, +0x0000004b,0x0000328d,0x000031a2,0x00002ab1, +0x00002781,0x0000277b,0x000700f5,0x0000004b, +0x00003288,0x000031a0,0x00002ab1,0x0000277e, +0x0000277b,0x000200f9,0x00002783,0x000200f8, +0x00002783,0x000700f5,0x0000004b,0x0000328c, +0x000031a2,0x0000273f,0x0000328d,0x00002782, +0x000700f5,0x0000004b,0x00003287,0x000031a0, +0x0000273f,0x00003288,0x00002782,0x000700f5, +0x0000004b,0x000031e3,0x000032a7,0x0000273f, +0x000031b7,0x00002782,0x000700f5,0x0000004b, +0x000031de,0x000032a5,0x0000273f,0x000031b5, +0x00002782,0x000200f9,0x000027d4,0x000200f8, +0x00002784,0x00050041,0x000000fe,0x00002786, +0x000000fc,0x00000250,0x0004003d,0x00000006, +0x00002787,0x00002786,0x000500b0,0x0000002f, +0x00002788,0x00002737,0x00002787,0x000300f7, +0x000027d3,0x00000000,0x000400fa,0x00002788, +0x00002789,0x000027d3,0x000200f8,0x00002789, +0x00050041,0x000000fe,0x0000278a,0x000000fc, +0x00000266,0x0004003d,0x00000006,0x0000278b, +0x0000278a,0x000500aa,0x0000002f,0x0000278c, +0x0000278b,0x00000380,0x000300f7,0x000027b8, +0x00000000,0x000400fa,0x0000278c,0x0000278d, +0x000027aa,0x000200f8,0x0000278d,0x00050041, +0x000000fe,0x00002ab6,0x000000fc,0x000000fd, +0x0004003d,0x00000006,0x00002ab7,0x00002ab6, +0x00050084,0x00000006,0x00002ab8,0x0000010a, +0x00002ab7,0x00050080,0x00000006,0x00002ab9, +0x00000107,0x00002ab8,0x00050084,0x00000006, +0x00002790,0x0000010a,0x00002737,0x00050080, +0x00000006,0x00002791,0x00002ab9,0x00002790, +0x00050041,0x00000156,0x00002792,0x000000fc, +0x00000154,0x0004003d,0x00000007,0x00002793, +0x00002792,0x00050051,0x00000006,0x00002ad0, +0x00002793,0x00000000,0x00050095,0x000000ab, +0x00002ad2,0x00002ad0,0x00002791,0x00050051, +0x00000006,0x00002ad3,0x00002ad2,0x00000001, +0x00050051,0x00000006,0x00002ad4,0x00002ad2, +0x00000000,0x00050051,0x00000006,0x00002ad7, +0x00002793,0x00000001,0x00050080,0x00000006, +0x00002ad9,0x00002ad7,0x00002ad3,0x00050050, +0x00000007,0x00002ada,0x00002ad4,0x00002ad9, +0x0004007c,0x00000014,0x00002aca,0x00002ada, +0x00060041,0x000000db,0x00002ac1,0x00002aca, +0x000000da,0x000000da,0x0006003d,0x00000006, +0x00002ac2,0x00002ac1,0x00000002,0x00000004, +0x00050041,0x000000fe,0x00002add,0x000000fc, +0x0000022c,0x0004003d,0x00000006,0x00002ade, +0x00002add,0x00050041,0x000000fe,0x00002aec, +0x000000fc,0x00000224,0x0004003d,0x00000006, +0x00002aed,0x00002aec,0x000500ab,0x0000002f, +0x00002aee,0x00002aed,0x000000a6,0x000600a9, +0x00000006,0x00002aef,0x00002aee,0x00000228, +0x00000107,0x00050084,0x00000006,0x00002ae1, +0x00002ac2,0x00002aef,0x00050080,0x00000006, +0x00002ae2,0x00002ade,0x00002ae1,0x000500c2, +0x00000006,0x00002ae3,0x00002ae2,0x00000233, +0x000500c4,0x00000006,0x00002ae4,0x00002ae3, +0x0000020d,0x000600a9,0x00000006,0x00002ae8, +0x00002aee,0x00000239,0x000000a6,0x000500c5, +0x00000006,0x00002ae9,0x00002ae4,0x00002ae8, +0x00050084,0x00000006,0x00002b31,0x0000011f, +0x00002ab7,0x00050080,0x00000006,0x00002b32, +0x00000107,0x00002b31,0x00050080,0x00000006, +0x00002b38,0x00002ab7,0x000032a8,0x00050086, +0x00000006,0x00002b39,0x00002b38,0x00000101, +0x00050084,0x00000006,0x00002b2b,0x00000107, +0x00002b39,0x00050080,0x00000006,0x00002b2c, +0x00002b32,0x00002b2b,0x00050084,0x00000006, +0x00002b00,0x00000150,0x00002ac2,0x00050080, +0x00000006,0x00002b01,0x00002b2c,0x00002b00, +0x00050095,0x000000ab,0x00002b52,0x00002ad0, +0x00002b01,0x00050051,0x00000006,0x00002b53, +0x00002b52,0x00000001,0x00050051,0x00000006, +0x00002b54,0x00002b52,0x00000000,0x00050080, +0x00000006,0x00002b59,0x00002ad7,0x00002b53, +0x00050050,0x00000007,0x00002b5a,0x00002b54, +0x00002b59,0x0004007c,0x00000014,0x00002b4a, +0x00002b5a,0x00060041,0x000000db,0x00002b41, +0x00002b4a,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00002b42,0x00002b41,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00002b06, +0x00002b42,0x00050080,0x00000006,0x00002b08, +0x00002b01,0x0000010a,0x00050095,0x000000ab, +0x00002b73,0x00002ad0,0x00002b08,0x00050051, +0x00000006,0x00002b74,0x00002b73,0x00000001, +0x00050051,0x00000006,0x00002b75,0x00002b73, +0x00000000,0x00050080,0x00000006,0x00002b7a, +0x00002ad7,0x00002b74,0x00050050,0x00000007, +0x00002b7b,0x00002b75,0x00002b7a,0x0004007c, +0x00000014,0x00002b6b,0x00002b7b,0x00060041, +0x000000db,0x00002b62,0x00002b6b,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00002b63, +0x00002b62,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002b0c,0x00002b63,0x00050080, +0x00000006,0x00002b0e,0x00002b01,0x00000111, +0x00050095,0x000000ab,0x00002b94,0x00002ad0, +0x00002b0e,0x00050051,0x00000006,0x00002b95, +0x00002b94,0x00000001,0x00050051,0x00000006, +0x00002b96,0x00002b94,0x00000000,0x00050080, +0x00000006,0x00002b9b,0x00002ad7,0x00002b95, +0x00050050,0x00000007,0x00002b9c,0x00002b96, +0x00002b9b,0x0004007c,0x00000014,0x00002b8c, +0x00002b9c,0x00060041,0x000000db,0x00002b83, +0x00002b8c,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00002b84,0x00002b83,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00002b12, +0x00002b84,0x00060050,0x0000004b,0x00002b13, +0x00002b06,0x00002b0c,0x00002b12,0x00050080, +0x00000006,0x00002b15,0x00002b01,0x00000118, +0x00050095,0x000000ab,0x00002bb5,0x00002ad0, +0x00002b15,0x00050051,0x00000006,0x00002bb6, +0x00002bb5,0x00000001,0x00050051,0x00000006, +0x00002bb7,0x00002bb5,0x00000000,0x00050080, +0x00000006,0x00002bbc,0x00002ad7,0x00002bb6, +0x00050050,0x00000007,0x00002bbd,0x00002bb7, +0x00002bbc,0x0004007c,0x00000014,0x00002bad, +0x00002bbd,0x00060041,0x000000db,0x00002ba4, +0x00002bad,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00002ba5,0x00002ba4,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00002b19, +0x00002ba5,0x00050080,0x00000006,0x00002b1b, +0x00002b01,0x0000011f,0x00050095,0x000000ab, +0x00002bd6,0x00002ad0,0x00002b1b,0x00050051, +0x00000006,0x00002bd7,0x00002bd6,0x00000001, +0x00050051,0x00000006,0x00002bd8,0x00002bd6, +0x00000000,0x00050080,0x00000006,0x00002bdd, +0x00002ad7,0x00002bd7,0x00050050,0x00000007, +0x00002bde,0x00002bd8,0x00002bdd,0x0004007c, +0x00000014,0x00002bce,0x00002bde,0x00060041, +0x000000db,0x00002bc5,0x00002bce,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00002bc6, +0x00002bc5,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002b1f,0x00002bc6,0x00050080, +0x00000006,0x00002b21,0x00002b01,0x00000189, +0x00050095,0x000000ab,0x00002bf7,0x00002ad0, +0x00002b21,0x00050051,0x00000006,0x00002bf8, +0x00002bf7,0x00000001,0x00050051,0x00000006, +0x00002bf9,0x00002bf7,0x00000000,0x00050080, +0x00000006,0x00002bfe,0x00002ad7,0x00002bf8, +0x00050050,0x00000007,0x00002bff,0x00002bf9, +0x00002bfe,0x0004007c,0x00000014,0x00002bef, +0x00002bff,0x00060041,0x000000db,0x00002be6, +0x00002bef,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00002be7,0x00002be6,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00002b25, +0x00002be7,0x00060050,0x0000004b,0x00002b26, +0x00002b19,0x00002b1f,0x00002b25,0x000300f7, +0x000027a9,0x00000000,0x000400fa,0x00002aee, +0x0000279e,0x000027a9,0x000200f8,0x0000279e, +0x00050084,0x00000006,0x000027a2,0x00000228, +0x00002ac2,0x00050080,0x00000006,0x000027a3, +0x00002ade,0x000027a2,0x00050080,0x00000006, +0x000027a4,0x000027a3,0x000005d0,0x00050041, +0x00000156,0x000027a5,0x000000fc,0x000000da, +0x0004003d,0x00000007,0x000027a6,0x000027a5, +0x00050051,0x00000006,0x00002c15,0x000027a6, +0x00000000,0x00050095,0x000000ab,0x00002c17, +0x00002c15,0x000027a4,0x00050051,0x00000006, +0x00002c18,0x00002c17,0x00000001,0x00050051, +0x00000006,0x00002c19,0x00002c17,0x00000000, +0x00050051,0x00000006,0x00002c1c,0x000027a6, +0x00000001,0x00050080,0x00000006,0x00002c1e, +0x00002c1c,0x00002c18,0x00050050,0x00000007, +0x00002c1f,0x00002c19,0x00002c1e,0x0004007c, +0x00000014,0x00002c0f,0x00002c1f,0x00060041, +0x000000db,0x00002c07,0x00002c0f,0x000000da, +0x000000da,0x0005003e,0x00002c07,0x00002830, +0x00000002,0x00000004,0x000200f9,0x000027a9, +0x000200f8,0x000027a9,0x000200f9,0x000027b8, +0x000200f8,0x000027aa,0x00050080,0x00000006, +0x000027ae,0x0000278b,0x00002737,0x00050084, +0x00000006,0x00002c25,0x000027ae,0x00000228, +0x00050080,0x00000006,0x00002c26,0x0000282a, +0x00002c25,0x000500c2,0x00000006,0x00002c27, +0x00002c26,0x00000233,0x000500c4,0x00000006, +0x00002c28,0x00002c27,0x0000020d,0x000500c5, +0x00000006,0x00002c29,0x00002c28,0x00000246, +0x00050041,0x000000fe,0x000027b1,0x000000fc, +0x0000096c,0x0004003d,0x00000006,0x000027b2, +0x000027b1,0x00050080,0x00000006,0x000027b4, +0x000027b2,0x000027ae,0x00050041,0x000000fe, +0x00002c69,0x000000fc,0x000000fd,0x0004003d, +0x00000006,0x00002c6a,0x00002c69,0x00050084, +0x00000006,0x00002c6b,0x0000011f,0x00002c6a, +0x00050080,0x00000006,0x00002c6c,0x00000107, +0x00002c6b,0x00050080,0x00000006,0x00002c72, +0x00002c6a,0x000032a8,0x00050086,0x00000006, +0x00002c73,0x00002c72,0x00000101,0x00050084, +0x00000006,0x00002c65,0x00000107,0x00002c73, +0x00050080,0x00000006,0x00002c66,0x00002c6c, +0x00002c65,0x00050084,0x00000006,0x00002c3a, +0x00000150,0x000027b4,0x00050080,0x00000006, +0x00002c3b,0x00002c66,0x00002c3a,0x00050041, +0x00000156,0x00002c3c,0x000000fc,0x00000154, +0x0004003d,0x00000007,0x00002c3d,0x00002c3c, +0x00050051,0x00000006,0x00002c8a,0x00002c3d, +0x00000000,0x00050095,0x000000ab,0x00002c8c, +0x00002c8a,0x00002c3b,0x00050051,0x00000006, +0x00002c8d,0x00002c8c,0x00000001,0x00050051, +0x00000006,0x00002c8e,0x00002c8c,0x00000000, +0x00050051,0x00000006,0x00002c91,0x00002c3d, +0x00000001,0x00050080,0x00000006,0x00002c93, +0x00002c91,0x00002c8d,0x00050050,0x00000007, +0x00002c94,0x00002c8e,0x00002c93,0x0004007c, +0x00000014,0x00002c84,0x00002c94,0x00060041, +0x000000db,0x00002c7b,0x00002c84,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00002c7c, +0x00002c7b,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002c40,0x00002c7c,0x00050080, +0x00000006,0x00002c42,0x00002c3b,0x0000010a, +0x00050095,0x000000ab,0x00002cad,0x00002c8a, +0x00002c42,0x00050051,0x00000006,0x00002cae, +0x00002cad,0x00000001,0x00050051,0x00000006, +0x00002caf,0x00002cad,0x00000000,0x00050080, +0x00000006,0x00002cb4,0x00002c91,0x00002cae, +0x00050050,0x00000007,0x00002cb5,0x00002caf, +0x00002cb4,0x0004007c,0x00000014,0x00002ca5, +0x00002cb5,0x00060041,0x000000db,0x00002c9c, +0x00002ca5,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00002c9d,0x00002c9c,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00002c46, +0x00002c9d,0x00050080,0x00000006,0x00002c48, +0x00002c3b,0x00000111,0x00050095,0x000000ab, +0x00002cce,0x00002c8a,0x00002c48,0x00050051, +0x00000006,0x00002ccf,0x00002cce,0x00000001, +0x00050051,0x00000006,0x00002cd0,0x00002cce, +0x00000000,0x00050080,0x00000006,0x00002cd5, +0x00002c91,0x00002ccf,0x00050050,0x00000007, +0x00002cd6,0x00002cd0,0x00002cd5,0x0004007c, +0x00000014,0x00002cc6,0x00002cd6,0x00060041, +0x000000db,0x00002cbd,0x00002cc6,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00002cbe, +0x00002cbd,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002c4c,0x00002cbe,0x00060050, +0x0000004b,0x00002c4d,0x00002c40,0x00002c46, +0x00002c4c,0x00050080,0x00000006,0x00002c4f, +0x00002c3b,0x00000118,0x00050095,0x000000ab, +0x00002cef,0x00002c8a,0x00002c4f,0x00050051, +0x00000006,0x00002cf0,0x00002cef,0x00000001, +0x00050051,0x00000006,0x00002cf1,0x00002cef, +0x00000000,0x00050080,0x00000006,0x00002cf6, +0x00002c91,0x00002cf0,0x00050050,0x00000007, +0x00002cf7,0x00002cf1,0x00002cf6,0x0004007c, +0x00000014,0x00002ce7,0x00002cf7,0x00060041, +0x000000db,0x00002cde,0x00002ce7,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00002cdf, +0x00002cde,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002c53,0x00002cdf,0x00050080, +0x00000006,0x00002c55,0x00002c3b,0x0000011f, +0x00050095,0x000000ab,0x00002d10,0x00002c8a, +0x00002c55,0x00050051,0x00000006,0x00002d11, +0x00002d10,0x00000001,0x00050051,0x00000006, +0x00002d12,0x00002d10,0x00000000,0x00050080, +0x00000006,0x00002d17,0x00002c91,0x00002d11, +0x00050050,0x00000007,0x00002d18,0x00002d12, +0x00002d17,0x0004007c,0x00000014,0x00002d08, +0x00002d18,0x00060041,0x000000db,0x00002cff, +0x00002d08,0x000000da,0x000000da,0x0006003d, +0x00000006,0x00002d00,0x00002cff,0x00000002, +0x00000004,0x0004007c,0x00000027,0x00002c59, +0x00002d00,0x00050080,0x00000006,0x00002c5b, +0x00002c3b,0x00000189,0x00050095,0x000000ab, +0x00002d31,0x00002c8a,0x00002c5b,0x00050051, +0x00000006,0x00002d32,0x00002d31,0x00000001, +0x00050051,0x00000006,0x00002d33,0x00002d31, +0x00000000,0x00050080,0x00000006,0x00002d38, +0x00002c91,0x00002d32,0x00050050,0x00000007, +0x00002d39,0x00002d33,0x00002d38,0x0004007c, +0x00000014,0x00002d29,0x00002d39,0x00060041, +0x000000db,0x00002d20,0x00002d29,0x000000da, +0x000000da,0x0006003d,0x00000006,0x00002d21, +0x00002d20,0x00000002,0x00000004,0x0004007c, +0x00000027,0x00002c5f,0x00002d21,0x00060050, +0x0000004b,0x00002c60,0x00002c53,0x00002c59, +0x00002c5f,0x000200f9,0x000027b8,0x000200f8, +0x000027b8,0x000700f5,0x0000004b,0x000031a7, +0x00002b26,0x000027a9,0x00002c60,0x000027aa, +0x000700f5,0x0000004b,0x000031a5,0x00002b13, +0x000027a9,0x00002c4d,0x000027aa,0x000700f5, +0x00000006,0x000031a3,0x00002ae9,0x000027a9, +0x00002c29,0x000027aa,0x00050041,0x000000fe, +0x000027b9,0x000000fc,0x000009ef,0x0004003d, +0x00000006,0x000027ba,0x000027b9,0x000500c2, +0x00000006,0x00002d3d,0x000031a3,0x0000020d, +0x00050041,0x000000fe,0x000027bd,0x000000fc, +0x0000022c,0x0004003d,0x00000006,0x000027be, +0x000027bd,0x00050086,0x00000006,0x000027bf, +0x000027be,0x00000107,0x00050082,0x00000006, +0x000027c0,0x00002d3d,0x000027bf,0x00050084, +0x00000006,0x000027c1,0x0000010a,0x000027c0, +0x00050080,0x00000006,0x000027c2,0x000027ba, +0x000027c1,0x00050041,0x00000156,0x000027c3, +0x000000fc,0x000000da,0x0004003d,0x00000007, +0x000027c4,0x000027c3,0x00050051,0x00000006, +0x00002d53,0x000027c4,0x00000000,0x00050095, +0x000000ab,0x00002d55,0x00002d53,0x000027c2, +0x00050051,0x00000006,0x00002d56,0x00002d55, +0x00000001,0x00050051,0x00000006,0x00002d57, +0x00002d55,0x00000000,0x00050051,0x00000006, +0x00002d5a,0x000027c4,0x00000001,0x00050080, +0x00000006,0x00002d5c,0x00002d5a,0x00002d56, +0x00050050,0x00000007,0x00002d5d,0x00002d57, +0x00002d5c,0x0004007c,0x00000014,0x00002d4d, +0x00002d5d,0x00060041,0x000000db,0x00002d45, +0x00002d4d,0x000000da,0x000000da,0x0005003e, +0x00002d45,0x00002830,0x00000002,0x00000004, +0x00050051,0x00000027,0x00002d61,0x000031a5, +0x00000000,0x00050051,0x00000027,0x00002d63, +0x000031a7,0x00000000,0x000500bc,0x0000002f, +0x00002d64,0x00002d61,0x00002d63,0x000300f7, +0x00002d6b,0x00000000,0x000400fa,0x00002d64, +0x00002d65,0x00002d6b,0x000200f8,0x00002d65, +0x00050051,0x00000027,0x00002d67,0x000031a5, +0x00000001,0x00050051,0x00000027,0x00002d69, +0x000031a7,0x00000001,0x000500bc,0x0000002f, +0x00002d6a,0x00002d67,0x00002d69,0x000200f9, +0x00002d6b,0x000200f8,0x00002d6b,0x000700f5, +0x0000002f,0x00002d6c,0x00002d64,0x000027b8, +0x00002d6a,0x00002d65,0x000300f7,0x00002d73, +0x00000000,0x000400fa,0x00002d6c,0x00002d6d, +0x00002d73,0x000200f8,0x00002d6d,0x00050051, +0x00000027,0x00002d6f,0x000031a5,0x00000002, +0x00050051,0x00000027,0x00002d71,0x000031a7, +0x00000002,0x000500bc,0x0000002f,0x00002d72, +0x00002d6f,0x00002d71,0x000200f9,0x00002d73, +0x000200f8,0x00002d73,0x000700f5,0x0000002f, +0x00002d74,0x00002d6c,0x00002d6b,0x00002d72, +0x00002d6d,0x000300f7,0x000027d2,0x00000000, +0x000400fa,0x00002d74,0x000027cb,0x000027d2, +0x000200f8,0x000027cb,0x0007000c,0x0000004b, +0x000027ce,0x00000001,0x00000025,0x000031a0, +0x000031a5,0x0007000c,0x0000004b,0x000027d1, +0x00000001,0x00000028,0x000031a2,0x000031a7, +0x000200f9,0x000027d2,0x000200f8,0x000027d2, +0x000700f5,0x0000004b,0x0000328f,0x000031a2, +0x00002d73,0x000027d1,0x000027cb,0x000700f5, +0x0000004b,0x0000328a,0x000031a0,0x00002d73, +0x000027ce,0x000027cb,0x000200f9,0x000027d3, +0x000200f8,0x000027d3,0x000700f5,0x0000004b, +0x0000328e,0x000031a2,0x00002784,0x0000328f, +0x000027d2,0x000700f5,0x0000004b,0x00003289, +0x000031a0,0x00002784,0x0000328a,0x000027d2, +0x000700f5,0x0000004b,0x000031e5,0x000032a7, +0x00002784,0x000031a7,0x000027d2,0x000700f5, +0x0000004b,0x000031e0,0x000032a5,0x00002784, +0x000031a5,0x000027d2,0x000700f5,0x00000006, +0x000031d9,0x00000380,0x00002784,0x000031a3, +0x000027d2,0x000200f9,0x000027d4,0x000200f8, +0x000027d4,0x000700f5,0x0000004b,0x0000328b, +0x0000328c,0x00002783,0x0000328e,0x000027d3, +0x000700f5,0x0000004b,0x00003286,0x00003287, +0x00002783,0x00003289,0x000027d3,0x000700f5, +0x0000004b,0x000031e2,0x000031e3,0x00002783, +0x000031e5,0x000027d3,0x000700f5,0x0000004b, +0x000031dd,0x000031de,0x00002783,0x000031e0, +0x000027d3,0x000700f5,0x00000006,0x000031d2, +0x00002839,0x00002783,0x000031d9,0x000027d3, +0x00050084,0x00000006,0x000027d7,0x0000010a, +0x0000319d,0x00050080,0x00000006,0x000027d8, +0x0000282d,0x000027d7,0x00050041,0x00000156, +0x000027d9,0x000000fc,0x000000da,0x0004003d, +0x00000007,0x000027da,0x000027d9,0x00050051, +0x00000006,0x00002d8b,0x000027da,0x00000000, +0x00050095,0x000000ab,0x00002d8d,0x00002d8b, +0x000027d8,0x00050051,0x00000006,0x00002d8e, +0x00002d8d,0x00000001,0x00050051,0x00000006, +0x00002d8f,0x00002d8d,0x00000000,0x00050051, +0x00000006,0x00002d92,0x000027da,0x00000001, +0x00050080,0x00000006,0x00002d94,0x00002d92, +0x00002d8e,0x00050050,0x00000007,0x00002d95, +0x00002d8f,0x00002d94,0x0004007c,0x00000014, +0x00002d85,0x00002d95,0x00060041,0x000000db, +0x00002d7d,0x00002d85,0x000000da,0x000000da, +0x0005003e,0x00002d7d,0x000031d2,0x00000002, +0x00000004,0x00050080,0x00000006,0x000027de, +0x0000282d,0x0000011f,0x00050084,0x00000006, +0x000027e0,0x00000150,0x0000319d,0x00050080, +0x00000006,0x000027e1,0x000027de,0x000027e0, +0x00050051,0x00000027,0x000027e6,0x000031dd, +0x00000000,0x0004007c,0x00000006,0x00002d9b, +0x000027e6,0x00050095,0x000000ab,0x00002db6, +0x00002d8b,0x000027e1,0x00050051,0x00000006, +0x00002db7,0x00002db6,0x00000001,0x00050051, +0x00000006,0x00002db8,0x00002db6,0x00000000, +0x00050080,0x00000006,0x00002dbd,0x00002d92, +0x00002db7,0x00050050,0x00000007,0x00002dbe, +0x00002db8,0x00002dbd,0x0004007c,0x00000014, +0x00002dae,0x00002dbe,0x00060041,0x000000db, +0x00002da6,0x00002dae,0x000000da,0x000000da, +0x0005003e,0x00002da6,0x00002d9b,0x00000002, +0x00000004,0x00050080,0x00000006,0x000027e9, +0x000027e1,0x0000010a,0x00050051,0x00000027, +0x000027ed,0x000031dd,0x00000001,0x0004007c, +0x00000006,0x00002dc4,0x000027ed,0x00050095, +0x000000ab,0x00002ddf,0x00002d8b,0x000027e9, +0x00050051,0x00000006,0x00002de0,0x00002ddf, +0x00000001,0x00050051,0x00000006,0x00002de1, +0x00002ddf,0x00000000,0x00050080,0x00000006, +0x00002de6,0x00002d92,0x00002de0,0x00050050, +0x00000007,0x00002de7,0x00002de1,0x00002de6, +0x0004007c,0x00000014,0x00002dd7,0x00002de7, +0x00060041,0x000000db,0x00002dcf,0x00002dd7, +0x000000da,0x000000da,0x0005003e,0x00002dcf, +0x00002dc4,0x00000002,0x00000004,0x00050080, +0x00000006,0x000027f0,0x000027e1,0x00000111, +0x00050051,0x00000027,0x000027f4,0x000031dd, +0x00000002,0x0004007c,0x00000006,0x00002ded, +0x000027f4,0x00050095,0x000000ab,0x00002e08, +0x00002d8b,0x000027f0,0x00050051,0x00000006, +0x00002e09,0x00002e08,0x00000001,0x00050051, +0x00000006,0x00002e0a,0x00002e08,0x00000000, +0x00050080,0x00000006,0x00002e0f,0x00002d92, +0x00002e09,0x00050050,0x00000007,0x00002e10, +0x00002e0a,0x00002e0f,0x0004007c,0x00000014, +0x00002e00,0x00002e10,0x00060041,0x000000db, +0x00002df8,0x00002e00,0x000000da,0x000000da, +0x0005003e,0x00002df8,0x00002ded,0x00000002, +0x00000004,0x00050080,0x00000006,0x000027f7, +0x000027e1,0x00000118,0x00050051,0x00000027, +0x000027fb,0x000031e2,0x00000000,0x0004007c, +0x00000006,0x00002e16,0x000027fb,0x00050095, +0x000000ab,0x00002e31,0x00002d8b,0x000027f7, +0x00050051,0x00000006,0x00002e32,0x00002e31, +0x00000001,0x00050051,0x00000006,0x00002e33, +0x00002e31,0x00000000,0x00050080,0x00000006, +0x00002e38,0x00002d92,0x00002e32,0x00050050, +0x00000007,0x00002e39,0x00002e33,0x00002e38, +0x0004007c,0x00000014,0x00002e29,0x00002e39, +0x00060041,0x000000db,0x00002e21,0x00002e29, +0x000000da,0x000000da,0x0005003e,0x00002e21, +0x00002e16,0x00000002,0x00000004,0x00050080, +0x00000006,0x000027fe,0x000027e1,0x0000011f, +0x00050051,0x00000027,0x00002802,0x000031e2, +0x00000001,0x0004007c,0x00000006,0x00002e3f, +0x00002802,0x00050095,0x000000ab,0x00002e5a, +0x00002d8b,0x000027fe,0x00050051,0x00000006, +0x00002e5b,0x00002e5a,0x00000001,0x00050051, +0x00000006,0x00002e5c,0x00002e5a,0x00000000, +0x00050080,0x00000006,0x00002e61,0x00002d92, +0x00002e5b,0x00050050,0x00000007,0x00002e62, +0x00002e5c,0x00002e61,0x0004007c,0x00000014, +0x00002e52,0x00002e62,0x00060041,0x000000db, +0x00002e4a,0x00002e52,0x000000da,0x000000da, +0x0005003e,0x00002e4a,0x00002e3f,0x00000002, +0x00000004,0x00050080,0x00000006,0x00002805, +0x000027e1,0x00000189,0x00050051,0x00000027, +0x00002809,0x000031e2,0x00000002,0x0004007c, +0x00000006,0x00002e68,0x00002809,0x00050095, +0x000000ab,0x00002e83,0x00002d8b,0x00002805, +0x00050051,0x00000006,0x00002e84,0x00002e83, +0x00000001,0x00050051,0x00000006,0x00002e85, +0x00002e83,0x00000000,0x00050080,0x00000006, +0x00002e8a,0x00002d92,0x00002e84,0x00050050, +0x00000007,0x00002e8b,0x00002e85,0x00002e8a, +0x0004007c,0x00000014,0x00002e7b,0x00002e8b, +0x00060041,0x000000db,0x00002e73,0x00002e7b, +0x000000da,0x000000da,0x0005003e,0x00002e73, +0x00002e68,0x00000002,0x00000004,0x000200f9, +0x0000280b,0x000200f8,0x0000280b,0x00050080, +0x00000006,0x0000280d,0x0000319d,0x00000154, +0x000200f9,0x0000272f,0x000200f8,0x0000280e, +0x000200f9,0x0000280f,0x000200f8,0x0000280f, +0x000700f5,0x00000006,0x0000319e,0x000000a6, +0x0000280e,0x0000281e,0x00002813,0x000500b0, +0x0000002f,0x00002812,0x0000319e,0x0000010a, +0x000400f6,0x0000281f,0x00002813,0x00000000, +0x000400fa,0x00002812,0x00002813,0x0000281f, +0x000200f8,0x00002813,0x00050080,0x00000006, +0x00002815,0x0000282d,0x000005c6,0x00050084, +0x00000006,0x00002817,0x0000010a,0x0000319e, +0x00050080,0x00000006,0x00002818,0x00002815, +0x00002817,0x00050041,0x00000156,0x00002819, +0x000000fc,0x000000da,0x0004003d,0x00000007, +0x0000281a,0x00002819,0x00050051,0x00000006, +0x00002ea1,0x0000281a,0x00000000,0x00050095, +0x000000ab,0x00002ea3,0x00002ea1,0x00002818, +0x00050051,0x00000006,0x00002ea4,0x00002ea3, +0x00000001,0x00050051,0x00000006,0x00002ea5, +0x00002ea3,0x00000000,0x00050051,0x00000006, +0x00002ea8,0x0000281a,0x00000001,0x00050080, +0x00000006,0x00002eaa,0x00002ea8,0x00002ea4, +0x00050050,0x00000007,0x00002eab,0x00002ea5, +0x00002eaa,0x0004007c,0x00000014,0x00002e9b, +0x00002eab,0x00060041,0x000000db,0x00002e93, +0x00002e9b,0x000000da,0x000000da,0x0005003e, +0x00002e93,0x000000a6,0x00000002,0x00000004, +0x00050080,0x00000006,0x0000281e,0x0000319e, +0x00000154,0x000200f9,0x0000280f,0x000200f8, +0x0000281f,0x00050041,0x000000fe,0x00002820, +0x000000fc,0x0000096c,0x0004003d,0x00000006, +0x00002821,0x00002820,0x00050080,0x00000006, +0x00002823,0x00002821,0x00002723,0x00050041, +0x000000fe,0x00002ef5,0x000000fc,0x000000fd, +0x0004003d,0x00000006,0x00002ef6,0x00002ef5, +0x00050084,0x00000006,0x00002ef7,0x0000011f, +0x00002ef6,0x00050080,0x00000006,0x00002ef8, +0x00000107,0x00002ef7,0x00050080,0x00000006, +0x00002efe,0x00002ef6,0x000032a8,0x00050086, +0x00000006,0x00002eff,0x00002efe,0x00000101, +0x00050084,0x00000006,0x00002ef1,0x00000107, +0x00002eff,0x00050080,0x00000006,0x00002ef2, +0x00002ef8,0x00002ef1,0x00050084,0x00000006, +0x00002ec2,0x00000150,0x00002823,0x00050080, +0x00000006,0x00002ec3,0x00002ef2,0x00002ec2, +0x00050041,0x00000156,0x00002ec4,0x000000fc, +0x00000154,0x0004003d,0x00000007,0x00002ec5, +0x00002ec4,0x00050051,0x00000027,0x00002ec8, +0x000031a0,0x00000000,0x0004007c,0x00000006, +0x00002f05,0x00002ec8,0x00050051,0x00000006, +0x00002f1e,0x00002ec5,0x00000000,0x00050095, +0x000000ab,0x00002f20,0x00002f1e,0x00002ec3, +0x00050051,0x00000006,0x00002f21,0x00002f20, +0x00000001,0x00050051,0x00000006,0x00002f22, +0x00002f20,0x00000000,0x00050051,0x00000006, +0x00002f25,0x00002ec5,0x00000001,0x00050080, +0x00000006,0x00002f27,0x00002f25,0x00002f21, +0x00050050,0x00000007,0x00002f28,0x00002f22, +0x00002f27,0x0004007c,0x00000014,0x00002f18, +0x00002f28,0x00060041,0x000000db,0x00002f10, +0x00002f18,0x000000da,0x000000da,0x0005003e, +0x00002f10,0x00002f05,0x00000002,0x00000004, +0x00050080,0x00000006,0x00002ecb,0x00002ec3, +0x0000010a,0x00050051,0x00000027,0x00002ecf, +0x000031a0,0x00000001,0x0004007c,0x00000006, +0x00002f2e,0x00002ecf,0x00050095,0x000000ab, +0x00002f49,0x00002f1e,0x00002ecb,0x00050051, +0x00000006,0x00002f4a,0x00002f49,0x00000001, +0x00050051,0x00000006,0x00002f4b,0x00002f49, +0x00000000,0x00050080,0x00000006,0x00002f50, +0x00002f25,0x00002f4a,0x00050050,0x00000007, +0x00002f51,0x00002f4b,0x00002f50,0x0004007c, +0x00000014,0x00002f41,0x00002f51,0x00060041, +0x000000db,0x00002f39,0x00002f41,0x000000da, +0x000000da,0x0005003e,0x00002f39,0x00002f2e, 0x00000002,0x00000004,0x00050080,0x00000006, -0x00002dd9,0x00002dc3,0x00000118,0x00050051, -0x00000027,0x00002ddd,0x00003096,0x00000000, -0x0004007c,0x00000006,0x00002e80,0x00002ddd, -0x00050095,0x000000ab,0x00002e9b,0x00002e1e, -0x00002dd9,0x00050051,0x00000006,0x00002e9c, -0x00002e9b,0x00000001,0x00050051,0x00000006, -0x00002e9d,0x00002e9b,0x00000000,0x00050080, -0x00000006,0x00002ea2,0x00002e25,0x00002e9c, -0x00050050,0x00000007,0x00002ea3,0x00002e9d, -0x00002ea2,0x0004007c,0x00000014,0x00002e93, -0x00002ea3,0x00060041,0x000000db,0x00002e8b, -0x00002e93,0x000000da,0x000000da,0x0005003e, -0x00002e8b,0x00002e80,0x00000002,0x00000004, -0x00050080,0x00000006,0x00002de0,0x00002dc3, -0x0000011f,0x00050051,0x00000027,0x00002de4, -0x00003096,0x00000001,0x0004007c,0x00000006, -0x00002ea9,0x00002de4,0x00050095,0x000000ab, -0x00002ec4,0x00002e1e,0x00002de0,0x00050051, -0x00000006,0x00002ec5,0x00002ec4,0x00000001, -0x00050051,0x00000006,0x00002ec6,0x00002ec4, -0x00000000,0x00050080,0x00000006,0x00002ecb, -0x00002e25,0x00002ec5,0x00050050,0x00000007, -0x00002ecc,0x00002ec6,0x00002ecb,0x0004007c, -0x00000014,0x00002ebc,0x00002ecc,0x00060041, -0x000000db,0x00002eb4,0x00002ebc,0x000000da, -0x000000da,0x0005003e,0x00002eb4,0x00002ea9, +0x00002ed2,0x00002ec3,0x00000111,0x00050051, +0x00000027,0x00002ed6,0x000031a0,0x00000002, +0x0004007c,0x00000006,0x00002f57,0x00002ed6, +0x00050095,0x000000ab,0x00002f72,0x00002f1e, +0x00002ed2,0x00050051,0x00000006,0x00002f73, +0x00002f72,0x00000001,0x00050051,0x00000006, +0x00002f74,0x00002f72,0x00000000,0x00050080, +0x00000006,0x00002f79,0x00002f25,0x00002f73, +0x00050050,0x00000007,0x00002f7a,0x00002f74, +0x00002f79,0x0004007c,0x00000014,0x00002f6a, +0x00002f7a,0x00060041,0x000000db,0x00002f62, +0x00002f6a,0x000000da,0x000000da,0x0005003e, +0x00002f62,0x00002f57,0x00000002,0x00000004, +0x00050080,0x00000006,0x00002ed9,0x00002ec3, +0x00000118,0x00050051,0x00000027,0x00002edd, +0x000031a2,0x00000000,0x0004007c,0x00000006, +0x00002f80,0x00002edd,0x00050095,0x000000ab, +0x00002f9b,0x00002f1e,0x00002ed9,0x00050051, +0x00000006,0x00002f9c,0x00002f9b,0x00000001, +0x00050051,0x00000006,0x00002f9d,0x00002f9b, +0x00000000,0x00050080,0x00000006,0x00002fa2, +0x00002f25,0x00002f9c,0x00050050,0x00000007, +0x00002fa3,0x00002f9d,0x00002fa2,0x0004007c, +0x00000014,0x00002f93,0x00002fa3,0x00060041, +0x000000db,0x00002f8b,0x00002f93,0x000000da, +0x000000da,0x0005003e,0x00002f8b,0x00002f80, 0x00000002,0x00000004,0x00050080,0x00000006, -0x00002de7,0x00002dc3,0x00000189,0x00050051, -0x00000027,0x00002deb,0x00003096,0x00000002, -0x0004007c,0x00000006,0x00002ed2,0x00002deb, -0x00050095,0x000000ab,0x00002eed,0x00002e1e, -0x00002de7,0x00050051,0x00000006,0x00002eee, -0x00002eed,0x00000001,0x00050051,0x00000006, -0x00002eef,0x00002eed,0x00000000,0x00050080, -0x00000006,0x00002ef4,0x00002e25,0x00002eee, -0x00050050,0x00000007,0x00002ef5,0x00002eef, -0x00002ef4,0x0004007c,0x00000014,0x00002ee5, -0x00002ef5,0x00060041,0x000000db,0x00002edd, -0x00002ee5,0x000000da,0x000000da,0x0005003e, -0x00002edd,0x00002ed2,0x00000002,0x00000004, -0x000200f9,0x00000bb0,0x000200f8,0x00000bb0, -0x000200f9,0x00000ba7,0x000200f8,0x00000ba7, -0x000200f9,0x00000b9e,0x000200f8,0x00000b9e, -0x000200f9,0x00000b95,0x000200f8,0x00000b95, -0x000200f9,0x00000b6f,0x000200f8,0x00000b6f, -0x000200f9,0x00000b5a,0x000200f8,0x00000b5a, -0x000200f9,0x00000bb6,0x000200f8,0x00000bb6, -0x000100fd,0x00010038} +0x00002ee0,0x00002ec3,0x0000011f,0x00050051, +0x00000027,0x00002ee4,0x000031a2,0x00000001, +0x0004007c,0x00000006,0x00002fa9,0x00002ee4, +0x00050095,0x000000ab,0x00002fc4,0x00002f1e, +0x00002ee0,0x00050051,0x00000006,0x00002fc5, +0x00002fc4,0x00000001,0x00050051,0x00000006, +0x00002fc6,0x00002fc4,0x00000000,0x00050080, +0x00000006,0x00002fcb,0x00002f25,0x00002fc5, +0x00050050,0x00000007,0x00002fcc,0x00002fc6, +0x00002fcb,0x0004007c,0x00000014,0x00002fbc, +0x00002fcc,0x00060041,0x000000db,0x00002fb4, +0x00002fbc,0x000000da,0x000000da,0x0005003e, +0x00002fb4,0x00002fa9,0x00000002,0x00000004, +0x00050080,0x00000006,0x00002ee7,0x00002ec3, +0x00000189,0x00050051,0x00000027,0x00002eeb, +0x000031a2,0x00000002,0x0004007c,0x00000006, +0x00002fd2,0x00002eeb,0x00050095,0x000000ab, +0x00002fed,0x00002f1e,0x00002ee7,0x00050051, +0x00000006,0x00002fee,0x00002fed,0x00000001, +0x00050051,0x00000006,0x00002fef,0x00002fed, +0x00000000,0x00050080,0x00000006,0x00002ff4, +0x00002f25,0x00002fee,0x00050050,0x00000007, +0x00002ff5,0x00002fef,0x00002ff4,0x0004007c, +0x00000014,0x00002fe5,0x00002ff5,0x00060041, +0x000000db,0x00002fdd,0x00002fe5,0x000000da, +0x000000da,0x0005003e,0x00002fdd,0x00002fd2, +0x00000002,0x00000004,0x000200f9,0x00000bed, +0x000200f8,0x00000bed,0x000200f9,0x00000be4, +0x000200f8,0x00000be4,0x000200f9,0x00000bdb, +0x000200f8,0x00000bdb,0x000200f9,0x00000bd2, +0x000200f8,0x00000bd2,0x000200f9,0x00000bac, +0x000200f8,0x00000bac,0x000200f9,0x00000b97, +0x000200f8,0x00000b97,0x000200f9,0x00000bf3, +0x000200f8,0x00000bf3,0x000100fd,0x00010038} diff --git a/runtime/test/bink_audio_test.cpp b/runtime/test/bink_audio_test.cpp index 2156e5effa..8616d91654 100644 --- a/runtime/test/bink_audio_test.cpp +++ b/runtime/test/bink_audio_test.cpp @@ -237,7 +237,7 @@ int main() { header.flags[i]); if (!header.audio_tracks) { std::printf("SKIP (movie has no audio tracks)\n"); - return 0; + return 77; // nothing was checked: a ctest SKIP (SKIP_RETURN_CODE 77), not a pass } try { diff --git a/runtime/test/check_texture_readback_sync.cmake b/runtime/test/check_texture_readback_sync.cmake index f821567898..81ef3f24ea 100644 --- a/runtime/test/check_texture_readback_sync.cmake +++ b/runtime/test/check_texture_readback_sync.cmake @@ -1,10 +1,11 @@ # Run with -DTOOL= -DSPIRV= # -DOUTPUT= -P runtime/test/check_texture_readback_sync.cmake. +# For a cross build, pass the configured emulator as "-DRUNNER=". # Requires the Khronos validation layer and a device that supports the texture harness. execute_process( COMMAND "${CMAKE_COMMAND}" -E env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer VK_LAYER_ENABLES=VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT - "${TOOL}" cube "${OUTPUT}" + ${RUNNER} "${TOOL}" cube "${OUTPUT}" WORKING_DIRECTORY "${SPIRV}" TIMEOUT 90 RESULT_VARIABLE code OUTPUT_VARIABLE log ERROR_VARIABLE log) if(NOT code STREQUAL "0" OR NOT log MATCHES "vk_texture_test cube: PASSED" diff --git a/runtime/test/check_vk_pipeline_cli.cmake b/runtime/test/check_vk_pipeline_cli.cmake index 74fa1e4399..5e3d2f114e 100644 --- a/runtime/test/check_vk_pipeline_cli.cmake +++ b/runtime/test/check_vk_pipeline_cli.cmake @@ -28,7 +28,8 @@ execute_process(COMMAND ${RUNNER} "${TOOL}" "${TEST_DIR}" --jobs 2 --start 3 --count 0 --max-bytes 0 --large-module-bytes 0 --slow 0.5 --stage cs --stats report.csv RESULT_VARIABLE code OUTPUT_VARIABLE log ERROR_VARIABLE log TIMEOUT 5) -if(NOT code STREQUAL "2" OR NOT log MATCHES "malformed JSON") +# The index parser names the file and where it stopped (#1847: "index.json: expected '{' at byte 0"). +if(NOT code STREQUAL "2" OR NOT log MATCHES "index.json: ") message(FATAL_ERROR "Expected valid arguments to reach the malformed index, got ${code}\n${log}") endif() @@ -37,7 +38,9 @@ foreach(bytes -1 1.5 4294967296) file(WRITE "${TEST_DIR}/index.json" "{\"example\":{\"stage\":\"cs\",\"lds_bytes\":${bytes}}}\n") execute_process(COMMAND ${RUNNER} "${TOOL}" "${TEST_DIR}" RESULT_VARIABLE code OUTPUT_VARIABLE log ERROR_VARIABLE log TIMEOUT 5) - if(NOT code STREQUAL "2" OR NOT log MATCHES "malformed JSON") + # The index parser names the file and where it stopped (#1847), e.g. "index.json: expected unsigned 32-bit + # lds_bytes at byte 37"; 1.5 stops after the 1 ("expected ',' or '}'"). + if(NOT code STREQUAL "2" OR NOT log MATCHES "index.json: expected") message(FATAL_ERROR "lds_bytes=${bytes}: expected a malformed index, got ${code}\n${log}") endif() endforeach() diff --git a/runtime/test/d3d12_buffer_uav_test.cpp b/runtime/test/d3d12_buffer_uav_test.cpp new file mode 100644 index 0000000000..cf936012ac --- /dev/null +++ b/runtime/test/d3d12_buffer_uav_test.cpp @@ -0,0 +1,699 @@ +// Typed buffer UAVs and UAV counters (docs/d3d12_vulkan.md section 3.4, "Buffer UAVs"), through the D3D12 API on the +// proxy, with compute shaders that are translator output (test/shaders/cs_buf_typed.asm and cs_buf_counter.asm, +// hand-written RDNA2), plus D3D12-only behaviour compared with the host runtime on the same adapter. +// +// Part 1, one DIRECT list: a compute root signature (four root constants and a table of six UAVs), two compute PSOs. +// cs_buf_typed writes typed buffer views (R32_UINT with an atomic add, R16G16B16A16_FLOAT, R8G8B8A8_UNORM from +// FirstElement 16, R32G32B32A32_UINT, R32_SINT) and reads an R32_FLOAT view. Two views are shorter +// than the dispatch (240 and 250 elements of 256): the V#'s NUM_RECORDS is the bound, so stores past +// it leave the buffer's sentinel and loads past it give 0. +// cs_buf_counter a structured UAV with a counter at CounterOffsetInBytes 4096 of another buffer: 256 lanes append +// (buffer_atomic_add on the counter V# in the slot's upper half, store at the returned index), then +// 128 lanes consume (buffer_atomic_sub, load the record just below). "CopyStructureCount" in D3D12 +// is CopyBufferRegion of the counter's 4 bytes into a buffer: read after the append (256) and after +// the consume (128). Lane order is up to the GPU, so records are compared as sets. +// Everything is compared with a CPU reference, word by word, error 0. +// Part 2, the layer's device (no proxy) and the host runtime on the SAME adapter (LUID): typed buffer UAVs created with +// CreateUnorderedAccessView and cleared with ClearUnorderedAccessViewUint / Float (thirteen formats, sub-ranges, an +// element range ending off a word boundary), and a structured UAV with a counter: a clear of the structured view and +// of the counter's own word through a raw view. The bytes read back are compared with the host's; with no host D3D12 +// the layer's are compared with the model of uav_clear.h. +// Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation (0 errors required). +#include "vk_test_device.h" +#include "d3d12_test_shaders.h" +#include "d3d12_copy_compare.h" +#include "../shims/d3d12_com.h" +#include "../shims/d3d12_xs_device.h" +#include "../src/gfx10_descriptors.h" +#include "../src/shader_library.h" +#include "../src/uav_clear.h" + +#include +#include +#include +#include +#include + +#ifndef LEONIDA_TEST_BUFFER_UAV_DIR +#error "LEONIDA_TEST_BUFFER_UAV_DIR must name the folder build.py wrote (spirv/index.json, fssm/cs_*.fssm)" +#endif + +#define EXPECT(condition) do { \ + if (!(condition)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); return 1; } \ +} while (0) + +using namespace d3d12test; +using XboxHeapHandleFn = std::uint64_t(WINAPI*)(void* heap); // heap slots 9/10: handle in RAX +namespace g = leonida::gfx10; +namespace uc = leonida::uav_clear; + +namespace { + +std::vector read_file(const std::filesystem::path& path) { + std::ifstream in(path, std::ios::binary); + return {std::istreambuf_iterator(in), std::istreambuf_iterator()}; +} + +constexpr UINT lanes = 256; +constexpr UINT seed = 0x00c0ffee, multiplier = 0x01000193; +constexpr std::uint32_t sentinel = 0xa5a5a5a5u; +constexpr UINT out0_elements = 240, in4_elements = 250, out2_first = 16; +constexpr UINT64 counter_offset = 4096, counter_buffer_bytes = 8192; +constexpr UINT consumed = 128; + +// The buffers of part 1: sizes, in the order of their slices of the upload and of the readback buffer. +enum Buf { out0, out1, out2, out3, in4, out5, records, counter, consumed_out, buffer_count }; +constexpr UINT64 sizes[buffer_count] = {lanes * 4, lanes * 8, (out2_first + lanes) * 4, lanes * 16, lanes * 4, + lanes * 4, lanes * 8, counter_buffer_bytes, consumed * 8}; +constexpr UINT64 slice(Buf which) { + UINT64 at = 0; + for (int i = 0; i < which; ++i) at += (sizes[i] + 255) / 256 * 256; + return at; +} +constexpr UINT64 total_bytes = slice(consumed_out) + (sizes[consumed_out] + 255) / 256 * 256; +constexpr UINT64 count_after_append = total_bytes, count_after_consume = total_bytes + 4; +constexpr UINT64 readback_bytes = total_bytes + 8; + +std::uint16_t half_bits(float value) { // exact for the values the reference uses (finite, in the normal range) + const std::uint32_t f = std::bit_cast(value); + if (!(f & 0x7fffffffu)) return std::uint16_t(f >> 16); + const int exponent = int((f >> 23) & 0xff) - 127 + 15; + return std::uint16_t(((f >> 16) & 0x8000) | (exponent << 10) | ((f >> 13) & 0x3ff)); +} + +float input_value(UINT g) { return float(g) - 100.5f; } + +struct Reference { + std::vector words[buffer_count]; +}; + +Reference reference() { + Reference ref; + for (int i = 0; i < buffer_count; ++i) ref.words[i].assign(sizes[i] / 4, sentinel); + for (UINT g = 0; g < lanes; ++g) { + if (g < out0_elements) ref.words[out0][g] = (g * multiplier + seed) + g; + const float x = float(g); + ref.words[out1][g * 2] = half_bits(x) | std::uint32_t(half_bits(x + 0.5f)) << 16; + ref.words[out1][g * 2 + 1] = half_bits(-1.0f - x) | std::uint32_t(half_bits(0.25f)) << 16; + const std::uint32_t k = g & 255; + ref.words[out2][out2_first + g] = k | (255 - k) << 8 | 0xff000000u; + ref.words[out3][g * 4 + 0] = g; + ref.words[out3][g * 4 + 1] = g ^ 0xffff; + ref.words[out3][g * 4 + 2] = g * 7; + ref.words[out3][g * 4 + 3] = 0xa5; + ref.words[in4][g] = std::bit_cast(input_value(g)); + ref.words[out5][g] = g < in4_elements ? std::uint32_t(int(2.0f * input_value(g))) : 0; + } + return ref; +} + +D3D12_RESOURCE_BARRIER uav_barrier(ID3D12Resource* resource) { + D3D12_RESOURCE_BARRIER b{}; + b.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + b.UAV.pResource = resource; + return b; +} + +D3D12_UNORDERED_ACCESS_VIEW_DESC buffer_view(DXGI_FORMAT format, UINT64 first, UINT count, UINT stride, + UINT64 counter_at = 0, D3D12_BUFFER_UAV_FLAGS flags = D3D12_BUFFER_UAV_FLAG_NONE) { + D3D12_UNORDERED_ACCESS_VIEW_DESC view{}; + view.Format = format; + view.ViewDimension = D3D12_UAV_DIMENSION_BUFFER; + view.Buffer = {first, count, stride, counter_at, flags}; + return view; +} + +// What a V# in a slot says, as the shader loads it. +struct Vsharp { + std::uint64_t address; + std::uint32_t stride, records, format, oob; +}; +Vsharp vsharp(const void* slot_pointer, unsigned dword = 0) { + std::uint32_t w[4]; + std::memcpy(w, static_cast(slot_pointer) + dword, sizeof(w)); + return {(std::uint64_t(w[1] & 0xffff) << 32) | w[0], w[1] >> 16 & 0x3fff, w[2], w[3] >> 12 & 0x7f, w[3] >> 28 & 3}; +} + +// ---- part 1 ----------------------------------------------------------------------------------------------------- + +int run_shaders(vktest::Device& d, const std::filesystem::path& root_dir, unsigned& words_checked) { + leonida::ShaderLibrary library; + EXPECT(library.load((root_dir / "spirv").string())); + const auto program = [&](const char* name) { return read_file(root_dir / "fssm" / (std::string(name) + ".fssm")); }; + const auto typed_fssm = program("cs_buf_typed"), counter_fssm = program("cs_buf_counter"); + EXPECT(typed_fssm.size() >= 0x150 && counter_fssm.size() >= 0x150 && typed_fssm != counter_fssm); + EXPECT(library.find("cs", leonida::sha256_hex(typed_fssm)) && library.find("cs", leonida::sha256_hex(counter_fssm))); + const auto typed_container = shader_container(typed_fssm), counter_container = shader_container(counter_fssm); + + rt::d3d12::VulkanDeviceInfo info{}; + info.get_instance_proc = d.instance_proc; + info.instance = d.instance; + info.physical = d.physical; + info.device = d.device; + info.queue = d.queue; + info.queue_family = d.family; + info.buffer_device_address = true; + info.bindless = d.bindless; + info.bindless_partially_bound = d.partially_bound; + info.image_view_min_lod = d.image_view_min_lod; + info.shader_dir = (root_dir / "spirv").string(); + ID3D12Device* inner = nullptr; + EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&inner)))); + Ref device; + EXPECT(SUCCEEDED(rt::d3d12_xs::create_device_proxy(inner, __uuidof(ID3D12Device), + reinterpret_cast(&device.p)))); + rt::d3d12::set_device_outer(inner, device.p); + EXPECT(rt::d3d12::bindless_set(device.p) != VK_NULL_HANDLE); + + D3D12_DESCRIPTOR_RANGE uav_range{D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 6, 0, 0, 0}; + D3D12_ROOT_PARAMETER params[2] = {}; + params[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; + params[0].Constants = {0, 0, 4}; + params[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + params[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + params[1].DescriptorTable = {1, &uav_range}; + params[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{}; + root_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0; + root_desc.Desc_1_0 = {2, params, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE}; + const auto root_blob = serialize_root_signature(root_desc); + EXPECT(!root_blob.empty()); + Ref root; + EXPECT(SUCCEEDED(device->CreateRootSignature(0, root_blob.data(), root_blob.size(), IID_PPV_ARGS(&root.p)))); + D3D12_COMPUTE_PIPELINE_STATE_DESC pso_desc{}; + pso_desc.pRootSignature = root.p; + pso_desc.CS = {typed_container.data(), typed_container.size()}; + Ref pso_typed, pso_counter; + EXPECT(SUCCEEDED(device->CreateComputePipelineState(&pso_desc, IID_PPV_ARGS(&pso_typed.p)))); + pso_desc.CS = {counter_container.data(), counter_container.size()}; + EXPECT(SUCCEEDED(device->CreateComputePipelineState(&pso_desc, IID_PPV_ARGS(&pso_counter.p)))); + + const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT}, upload_heap{D3D12_HEAP_TYPE_UPLOAD}, + readback_heap{D3D12_HEAP_TYPE_READBACK}; + Ref upload, readback, buf[buffer_count]; + const auto create = [&](Ref& out, const D3D12_HEAP_PROPERTIES& heap, UINT64 bytes, + D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES state) { + const auto desc = buffer_desc(bytes, flags); + return SUCCEEDED(device->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &desc, state, nullptr, + IID_PPV_ARGS(&out.p))); + }; + EXPECT(create(upload, upload_heap, total_bytes, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ)); + EXPECT(create(readback, readback_heap, readback_bytes, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COPY_DEST)); + for (int i = 0; i < buffer_count; ++i) + EXPECT(create(buf[i], default_heap, sizes[i], D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, + D3D12_RESOURCE_STATE_COPY_DEST)); + Reference want = reference(); + { + std::uint8_t* mapped = nullptr; + EXPECT(SUCCEEDED(upload->Map(0, nullptr, reinterpret_cast(&mapped)))); + for (UINT64 i = 0; i < total_bytes / 4; ++i) std::memcpy(mapped + i * 4, &sentinel, 4); + // The input buffer holds floats; the counter's own word starts at 0 (the rest of its buffer is sentinel). + std::memcpy(mapped + slice(in4), want.words[in4].data(), sizes[in4]); + std::memset(mapped + slice(counter) + counter_offset, 0, 4); + upload->Unmap(0, nullptr); + } + + // The table: slots 0..5 typed views for cs_buf_typed; slot 6 a structured UAV with a counter, slot 7 a raw output + // for cs_buf_counter (its table starts at slot 6). + const D3D12_DESCRIPTOR_HEAP_DESC heap_desc{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 12, + D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, 0}; + Ref heap; + EXPECT(SUCCEEDED(device->CreateDescriptorHeap(&heap_desc, IID_PPV_ARGS(&heap.p)))); + const std::uint64_t cpu = reinterpret_cast(slot(heap.p, 9))(heap.p); + const std::uint64_t gpu = reinterpret_cast(slot(heap.p, 10))(heap.p); + const UINT step = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + EXPECT(cpu && gpu >= 0x10000 && gpu < (1ull << 32) && step == 32); // the shaders step 32 bytes a slot + const auto handle = [&](UINT i) { return D3D12_CPU_DESCRIPTOR_HANDLE{SIZE_T(cpu + std::uint64_t(i) * step)}; }; + const auto make = [&](UINT i, Buf which, const D3D12_UNORDERED_ACCESS_VIEW_DESC& view, ID3D12Resource* counter_res = nullptr) { + device->CreateUnorderedAccessView(buf[which].p, counter_res, &view, handle(i)); + }; + make(0, out0, buffer_view(DXGI_FORMAT_R32_UINT, 0, out0_elements, 0)); + make(1, out1, buffer_view(DXGI_FORMAT_R16G16B16A16_FLOAT, 0, lanes, 0)); + make(2, out2, buffer_view(DXGI_FORMAT_R8G8B8A8_UNORM, out2_first, lanes, 0)); + make(3, out3, buffer_view(DXGI_FORMAT_R32G32B32A32_UINT, 0, lanes, 0)); + make(4, in4, buffer_view(DXGI_FORMAT_R32_FLOAT, 0, in4_elements, 0)); + make(5, out5, buffer_view(DXGI_FORMAT_R32_SINT, 0, lanes, 0)); + make(6, records, buffer_view(DXGI_FORMAT_UNKNOWN, 0, lanes, 8, counter_offset), buf[counter].p); + make(7, consumed_out, buffer_view(DXGI_FORMAT_R32_TYPELESS, 0, consumed * 2, 0, 0, D3D12_BUFFER_UAV_FLAG_RAW)); + + // The V#s the shaders load: format code, element size as stride, element count, OOB_SELECT 1 (structured); the + // R8G8B8A8 view starts 16 elements in; the counter V# is raw (stride 0, 4 bytes, OOB_SELECT 3) in the slot's upper half. + const auto at = [&](UINT i) { return reinterpret_cast(handle(i).ptr); }; + const auto expect_typed = [&](UINT i, Buf which, UINT code, UINT bytes, UINT elements, UINT first) { + const Vsharp v = vsharp(at(i)); + return v.address == buf[which]->GetGPUVirtualAddress() + UINT64(first) * bytes && v.stride == bytes && + v.records == elements && v.format == code && v.oob == 1; + }; + EXPECT(expect_typed(0, out0, 20, 4, out0_elements, 0)); // GFX10_FORMAT_32_UINT + EXPECT(expect_typed(1, out1, 71, 8, lanes, 0)); // 16_16_16_16_FLOAT + EXPECT(expect_typed(2, out2, 56, 4, lanes, out2_first)); // 8_8_8_8_UNORM + EXPECT(expect_typed(3, out3, 75, 16, lanes, 0)); // 32_32_32_32_UINT + EXPECT(expect_typed(4, in4, 22, 4, in4_elements, 0)); // 32_FLOAT + EXPECT(expect_typed(5, out5, 21, 4, lanes, 0)); // 32_SINT + { + const Vsharp v = vsharp(at(6)), c = vsharp(at(6), 4); + EXPECT(v.address == buf[records]->GetGPUVirtualAddress() && v.stride == 8 && v.records == lanes && v.format == 0 && + v.oob == 0); + EXPECT(c.address == buf[counter]->GetGPUVirtualAddress() + counter_offset && c.stride == 0 && c.records == 4 && + c.format == 0 && c.oob == 3); + const Vsharp r = vsharp(at(7)); + EXPECT(r.address == buf[consumed_out]->GetGPUVirtualAddress() && r.stride == 0 && r.records == consumed * 8 && + r.oob == 3); + // A view with no counter leaves the slot's upper half zero. + const Vsharp none = vsharp(at(7), 4); + EXPECT(!none.address && !none.records); + } + + D3D12_COMMAND_QUEUE_DESC queue_desc{}; + queue_desc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT; + Ref queue; + EXPECT(SUCCEEDED(device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p)))); + Ref allocator; + Ref list; + Ref fence; + EXPECT(SUCCEEDED(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p)))); + EXPECT(SUCCEEDED(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr, + IID_PPV_ARGS(&list.p)))); + EXPECT(SUCCEEDED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p)))); + + constexpr auto uav_state = D3D12_RESOURCE_STATE_UNORDERED_ACCESS; + for (int i = 0; i < buffer_count; ++i) list->CopyBufferRegion(buf[i].p, 0, upload.p, slice(Buf(i)), sizes[i]); + D3D12_RESOURCE_BARRIER barriers[buffer_count]; + for (int i = 0; i < buffer_count; ++i) barriers[i] = transition(buf[i].p, D3D12_RESOURCE_STATE_COPY_DEST, uav_state); + list->ResourceBarrier(buffer_count, barriers); + ID3D12DescriptorHeap* heaps[] = {heap.p}; + list->SetDescriptorHeaps(1, heaps); + list->SetComputeRootSignature(root.p); + const auto constants = [&](std::uint32_t a, std::uint32_t b) { + const std::uint32_t values[4] = {a, b, 0, 0}; + list->SetComputeRoot32BitConstants(0, 4, values, 0); + }; + list->SetPipelineState(pso_typed.p); + constants(seed, multiplier); + list->SetComputeRootDescriptorTable(1, D3D12_GPU_DESCRIPTOR_HANDLE{gpu}); + list->Dispatch(lanes / 64, 1, 1); + list->SetPipelineState(pso_counter.p); + constants(0, 0); // append + list->SetComputeRootDescriptorTable(1, D3D12_GPU_DESCRIPTOR_HANDLE{gpu + 6ull * step}); + list->Dispatch(lanes / 64, 1, 1); + D3D12_RESOURCE_BARRIER sync[2] = {uav_barrier(buf[records].p), uav_barrier(buf[counter].p)}; + list->ResourceBarrier(2, sync); + // CopyStructureCount: the counter's 4 bytes into a buffer, after the append. + D3D12_RESOURCE_BARRIER to_copy = transition(buf[counter].p, uav_state, D3D12_RESOURCE_STATE_COPY_SOURCE); + list->ResourceBarrier(1, &to_copy); + list->CopyBufferRegion(readback.p, count_after_append, buf[counter].p, counter_offset, 4); + D3D12_RESOURCE_BARRIER back = transition(buf[counter].p, D3D12_RESOURCE_STATE_COPY_SOURCE, uav_state); + list->ResourceBarrier(1, &back); + constants(1, 0); // consume + list->Dispatch(consumed / 64, 1, 1); + for (int i = 0; i < buffer_count; ++i) barriers[i] = transition(buf[i].p, uav_state, D3D12_RESOURCE_STATE_COPY_SOURCE); + list->ResourceBarrier(buffer_count, barriers); + for (int i = 0; i < buffer_count; ++i) list->CopyBufferRegion(readback.p, slice(Buf(i)), buf[i].p, 0, sizes[i]); + list->CopyBufferRegion(readback.p, count_after_consume, buf[counter].p, counter_offset, 4); + EXPECT(list->Close() == S_OK); + ID3D12CommandList* lists[] = {list.p}; + queue->ExecuteCommandLists(1, lists); + EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success); + EXPECT(SUCCEEDED(queue->Signal(fence.p, 1))); + const HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr); + EXPECT(event != nullptr); + EXPECT(SUCCEEDED(fence->SetEventOnCompletion(1, event))); + if (WaitForSingleObject(event, 20000) != WAIT_OBJECT_0) { + std::fprintf(stderr, "the fence never reached 1\n"); + return 1; + } + CloseHandle(event); + + std::vector got; + { + void* mapped = nullptr; + EXPECT(SUCCEEDED(readback->Map(0, nullptr, &mapped))); + got.assign(static_cast(mapped), static_cast(mapped) + readback_bytes); + readback->Unmap(0, nullptr); + } + const auto word_at = [&](UINT64 offset) { + std::uint32_t value = 0; + std::memcpy(&value, got.data() + offset, 4); + return value; + }; + + unsigned mismatches = 0; + const auto compare = [&](const char* what, Buf which, const std::vector& expected) { + unsigned bad = 0; + for (std::size_t i = 0; i < expected.size(); ++i) { + ++words_checked; + const std::uint32_t value = word_at(slice(which) + i * 4); + if (value == expected[i]) continue; + ++mismatches; + if (bad++ < 4) std::fprintf(stderr, "%s word %zu: got %08x want %08x\n", what, i, value, expected[i]); + } + if (bad) std::fprintf(stderr, "%s: %u of %zu words differ\n", what, bad, expected.size()); + }; + compare("R32_UINT store + atomic add (240 of 256 elements)", out0, want.words[out0]); + compare("R16G16B16A16_FLOAT store", out1, want.words[out1]); + compare("R8G8B8A8_UNORM store (FirstElement 16)", out2, want.words[out2]); + compare("R32G32B32A32_UINT store", out3, want.words[out3]); + compare("R32_FLOAT input untouched", in4, want.words[in4]); + compare("R32_FLOAT load -> R32_SINT store (250 of 256 loads in range)", out5, want.words[out5]); + + // The counter: 256 after the append, 128 after the consume, and nothing else of its buffer touched. + ++words_checked; + if (word_at(count_after_append) != lanes) { + std::fprintf(stderr, "counter after the append: %u, want %u\n", word_at(count_after_append), lanes); + ++mismatches; + } + ++words_checked; + if (word_at(count_after_consume) != lanes - consumed) { + std::fprintf(stderr, "counter after the consume: %u, want %u\n", word_at(count_after_consume), lanes - consumed); + ++mismatches; + } + for (UINT64 i = 0; i < counter_buffer_bytes / 4; ++i) { + ++words_checked; + const std::uint32_t expected = i == counter_offset / 4 ? lanes - consumed : sentinel; + if (word_at(slice(counter) + i * 4) != expected && mismatches++ < 12) + std::fprintf(stderr, "counter buffer word %llu: got %08x want %08x\n", static_cast(i), + word_at(slice(counter) + i * 4), expected); + } + // The appended records: every g exactly once with its second field, in whatever order the lanes took the counter. + std::vector> appended, taken; + for (UINT i = 0; i < lanes; ++i) + appended.push_back({word_at(slice(records) + i * 8), word_at(slice(records) + i * 8 + 4)}); + std::vector> sorted = appended; + std::sort(sorted.begin(), sorted.end()); + for (UINT i = 0; i < lanes; ++i) { + ++words_checked; + if (sorted[i][0] != i || sorted[i][1] != i * 3 + 1) { + if (mismatches++ < 12) + std::fprintf(stderr, "appended record %u (sorted): { %u, %u }, want { %u, %u }\n", i, sorted[i][0], + sorted[i][1], i, i * 3 + 1); + } + } + // The consumed ones: the records at indices 128..255 (the counter went from 256 down to 128), each once. + for (UINT i = 0; i < consumed; ++i) + taken.push_back({word_at(slice(consumed_out) + i * 8), word_at(slice(consumed_out) + i * 8 + 4)}); + std::vector> tail(appended.begin() + (lanes - consumed), appended.end()); + std::sort(taken.begin(), taken.end()); + std::sort(tail.begin(), tail.end()); + for (UINT i = 0; i < consumed; ++i) { + ++words_checked; + if (taken[i] != tail[i] && mismatches++ < 12) + std::fprintf(stderr, "consumed record %u (sorted): { %u, %u }, want { %u, %u }\n", i, taken[i][0], taken[i][1], + tail[i][0], tail[i][1]); + } + EXPECT(!mismatches); + + for (auto& b : buf) b.reset(); + upload.reset(); readback.reset(); list.reset(); allocator.reset(); fence.reset(); queue.reset(); + pso_typed.reset(); pso_counter.reset(); root.reset(); heap.reset(); + EXPECT(rt::d3d12_xs::device_proxy_ref_count(device.p) == 1); + return 0; +} + +// ---- part 2 ----------------------------------------------------------------------------------------------------- + +struct ClearCase { + DXGI_FORMAT format; + VkFormat vulkan; // for the model + bool is_float; + std::array values; + UINT64 byte_offset; + UINT elements; +}; +std::uint32_t fb(float f) { return std::bit_cast(f); } + +// Values in the domain D3D12 defines the same on every driver: no exact .5 ties in a float -> UNORM rounding (the RTX 5070's +// D3D12 rounds 127.5 down, the layer and the spec's round-to-nearest up) and no integer wider than its channel (the low bits +// are kept here, one vendor clamps). +const ClearCase clear_cases[] = { + {DXGI_FORMAT_R32_UINT, VK_FORMAT_R32_UINT, false, {0x12345678, 0, 0, 0}, 0, 16}, + {DXGI_FORMAT_R32_SINT, VK_FORMAT_R32_SINT, false, {0xfffffff0, 0, 0, 0}, 256, 8}, + {DXGI_FORMAT_R32_FLOAT, VK_FORMAT_R32_SFLOAT, true, {fb(1.5f), 0, 0, 0}, 512, 8}, + {DXGI_FORMAT_R16G16B16A16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, true, {fb(1.0f), fb(0.5f), fb(-2.0f), fb(0.25f)}, 768, 8}, + {DXGI_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, true, {fb(1.0f), fb(0.4f), fb(0.2f), fb(2.0f)}, 1024, 16}, + {DXGI_FORMAT_R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_UINT, false, {0xf1, 2, 3, 0x80}, 1280, 16}, + {DXGI_FORMAT_R32G32B32A32_UINT, VK_FORMAT_R32G32B32A32_UINT, false, {1, 2, 3, 4}, 1536, 4}, + {DXGI_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM, true, {fb(0.25f), 0, 0, 0}, 1792, 16}, + {DXGI_FORMAT_R8_UNORM, VK_FORMAT_R8_UNORM, true, {fb(0.2f), 0, 0, 0}, 2048, 21}, // ends off a word boundary + {DXGI_FORMAT_R10G10B10A2_UNORM, VK_FORMAT_A2B10G10R10_UNORM_PACK32, true, {fb(0.25f), fb(0.4f), fb(0.75f), fb(1.0f)}, 2304, 8}, + {DXGI_FORMAT_R11G11B10_FLOAT, VK_FORMAT_B10G11R11_UFLOAT_PACK32, true, {fb(1.0f), fb(2.0f), fb(0.5f), 0}, 2560, 8}, + {DXGI_FORMAT_R16G16_FLOAT, VK_FORMAT_R16G16_SFLOAT, true, {fb(1.5f), fb(-0.5f), 0, 0}, 2816, 8}, + {DXGI_FORMAT_R8G8_UINT, VK_FORMAT_R8G8_UINT, false, {0xaa, 0xbb, 0, 0}, 3072, 10}, +}; +constexpr UINT64 api_data_bytes = 4096, api_records_bytes = 4096; +constexpr UINT api_readback = api_data_bytes + api_records_bytes + counter_buffer_bytes; + +// The same scenario on `device`: bytes read back, or empty on failure. host: a real heap pair (a non-shader-visible one the +// views are made in, a shader-visible one the clear's GPU handle comes from), as the PC runtime wants; the layer takes the +// CPU handle and ignores the GPU one. +bool run_api(ID3D12Device* device, bool host, std::vector& out, std::vector& supported_by_host) { + const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT}, upload_heap{D3D12_HEAP_TYPE_UPLOAD}, + readback_heap{D3D12_HEAP_TYPE_READBACK}; + const auto create = [&](Ref& r, const D3D12_HEAP_PROPERTIES& heap, UINT64 bytes, + D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES state) { + const auto desc = buffer_desc(bytes, flags); + return SUCCEEDED(device->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &desc, state, nullptr, + IID_PPV_ARGS(&r.p))); + }; + constexpr auto uav_flag = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; + Ref data, structured, counter_buffer, upload, readback; + if (!create(data, default_heap, api_data_bytes, uav_flag, D3D12_RESOURCE_STATE_UNORDERED_ACCESS) || + !create(structured, default_heap, api_records_bytes, uav_flag, D3D12_RESOURCE_STATE_COPY_DEST) || + !create(counter_buffer, default_heap, counter_buffer_bytes, uav_flag, D3D12_RESOURCE_STATE_COPY_DEST) || + !create(upload, upload_heap, api_records_bytes + counter_buffer_bytes, D3D12_RESOURCE_FLAG_NONE, + D3D12_RESOURCE_STATE_GENERIC_READ) || + !create(readback, readback_heap, api_readback, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COPY_DEST)) + return std::fprintf(stderr, "resource creation failed\n"), false; + { + std::uint8_t* mapped = nullptr; + if (FAILED(upload->Map(0, nullptr, reinterpret_cast(&mapped)))) return std::fprintf(stderr, "run_api: line %d\n", __LINE__), false; + std::memset(mapped, 0x11, api_records_bytes + counter_buffer_bytes); + const std::uint32_t seven = 7; + std::memcpy(mapped + api_records_bytes + counter_offset, &seven, 4); // the counter's word + upload->Unmap(0, nullptr); + } + constexpr UINT slots = 24; + Ref cpu_heap, gpu_heap; + D3D12_DESCRIPTOR_HEAP_DESC desc{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, slots, D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0}; + if (FAILED(device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&cpu_heap.p)))) return std::fprintf(stderr, "run_api: line %d\n", __LINE__), false; + if (host) { + desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; + if (FAILED(device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&gpu_heap.p)))) return std::fprintf(stderr, "run_api: line %d\n", __LINE__), false; + } + const UINT step = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + const auto cpu = [&](UINT i) { + D3D12_CPU_DESCRIPTOR_HANDLE h = cpu_heap->GetCPUDescriptorHandleForHeapStart(); + h.ptr += SIZE_T(i) * step; + return h; + }; + const auto gpu = [&](UINT i) { + if (!host) return D3D12_GPU_DESCRIPTOR_HANDLE{0}; + D3D12_GPU_DESCRIPTOR_HANDLE h = gpu_heap->GetGPUDescriptorHandleForHeapStart(); + h.ptr += UINT64(i) * step; + return h; + }; + UINT next_slot = 0; + const auto make = [&](ID3D12Resource* resource, ID3D12Resource* counter, const D3D12_UNORDERED_ACCESS_VIEW_DESC& view) { + const UINT i = next_slot++; + device->CreateUnorderedAccessView(resource, counter, &view, cpu(i)); + if (host) { + D3D12_CPU_DESCRIPTOR_HANDLE visible = gpu_heap->GetCPUDescriptorHandleForHeapStart(); + visible.ptr += SIZE_T(i) * step; + device->CopyDescriptorsSimple(1, visible, cpu(i), D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + } + return i; + }; + + Ref queue; + Ref allocator; + Ref list; + Ref fence; + const D3D12_COMMAND_QUEUE_DESC queue_desc{D3D12_COMMAND_LIST_TYPE_DIRECT}; + if (FAILED(device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p))) || + FAILED(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p))) || + FAILED(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr, IID_PPV_ARGS(&list.p))) || + FAILED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p)))) + return std::fprintf(stderr, "run_api: line %d\n", __LINE__), false; + ID3D12DescriptorHeap* heaps[] = {gpu_heap.p}; + if (host) list->SetDescriptorHeaps(1, heaps); + + const auto clear = [&](UINT slot_index, ID3D12Resource* resource, bool is_float, const std::array& v) { + if (is_float) { + const float f[4] = {std::bit_cast(v[0]), std::bit_cast(v[1]), std::bit_cast(v[2]), + std::bit_cast(v[3])}; + list->ClearUnorderedAccessViewFloat(gpu(slot_index), cpu(slot_index), resource, f, 0, nullptr); + } else { + list->ClearUnorderedAccessViewUint(gpu(slot_index), cpu(slot_index), resource, v.data(), 0, nullptr); + } + const D3D12_RESOURCE_BARRIER barrier = uav_barrier(resource); + list->ResourceBarrier(1, &barrier); + }; + // The whole buffer 0xcdcdcdcd through a raw view, then each case's elements through a typed view. + clear(make(data.p, nullptr, buffer_view(DXGI_FORMAT_R32_TYPELESS, 0, api_data_bytes / 4, 0, 0, D3D12_BUFFER_UAV_FLAG_RAW)), + data.p, false, {0xcdcdcdcd, 0, 0, 0}); + supported_by_host.assign(std::size(clear_cases), true); + for (std::size_t c = 0; c < std::size(clear_cases); ++c) { + const ClearCase& test = clear_cases[c]; + if (host) { + D3D12_FEATURE_DATA_FORMAT_SUPPORT support{test.format}; + supported_by_host[c] = SUCCEEDED(device->CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT, &support, sizeof(support))) && + (support.Support2 & D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE); + } + if (!supported_by_host[c]) continue; + const UINT size = uc::layout(test.vulkan)->bytes; + clear(make(data.p, nullptr, buffer_view(test.format, test.byte_offset / size, test.elements, 0)), data.p, + test.is_float, test.values); + } + // A structured view with a counter. The clear writes the records and leaves the counter (preset to 7) alone ... + list->CopyBufferRegion(structured.p, 0, upload.p, 0, api_records_bytes); + list->CopyBufferRegion(counter_buffer.p, 0, upload.p, api_records_bytes, counter_buffer_bytes); + D3D12_RESOURCE_BARRIER to_uav[2] = {transition(structured.p, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS), + transition(counter_buffer.p, D3D12_RESOURCE_STATE_COPY_DEST, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS)}; + list->ResourceBarrier(2, to_uav); + clear(make(structured.p, counter_buffer.p, buffer_view(DXGI_FORMAT_UNKNOWN, 0, 256, 16, counter_offset)), structured.p, + false, {0xab, 0xcd, 0xef, 0x01}); + // ... and a raw view of the counter's own word (element 1024) clears it, as a game resets its counter. + clear(make(counter_buffer.p, nullptr, buffer_view(DXGI_FORMAT_R32_TYPELESS, counter_offset / 4, 1, 0, 0, D3D12_BUFFER_UAV_FLAG_RAW)), + counter_buffer.p, false, {3, 0, 0, 0}); + D3D12_RESOURCE_BARRIER to_copy[3] = { + transition(data.p, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE), + transition(structured.p, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE), + transition(counter_buffer.p, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COPY_SOURCE)}; + list->ResourceBarrier(3, to_copy); + list->CopyBufferRegion(readback.p, 0, data.p, 0, api_data_bytes); + list->CopyBufferRegion(readback.p, api_data_bytes, structured.p, 0, api_records_bytes); + list->CopyBufferRegion(readback.p, api_data_bytes + api_records_bytes, counter_buffer.p, 0, counter_buffer_bytes); + if (const HRESULT hr = list->Close(); FAILED(hr)) return std::fprintf(stderr, "Close: %08lx\n", static_cast(hr)), false; + ID3D12CommandList* lists[] = {list.p}; + queue->ExecuteCommandLists(1, lists); + if (!host && rt::d3d12::last_execute_result(queue.p) != leonida::ReplayResult::success) + return std::fprintf(stderr, "replay result %d\n", int(rt::d3d12::last_execute_result(queue.p))), false; + if (FAILED(queue->Signal(fence.p, 1))) return std::fprintf(stderr, "run_api: line %d\n", __LINE__), false; + const HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr); + if (!event || FAILED(fence->SetEventOnCompletion(1, event)) || WaitForSingleObject(event, 20000) != WAIT_OBJECT_0) + return std::fprintf(stderr, "run_api: line %d\n", __LINE__), false; + CloseHandle(event); + void* mapped = nullptr; + if (FAILED(readback->Map(0, nullptr, &mapped))) return std::fprintf(stderr, "run_api: line %d\n", __LINE__), false; + out.assign(static_cast(mapped), static_cast(mapped) + api_readback); + readback->Unmap(0, nullptr); + return true; +} + +// What D3D12 says the same sequence leaves, from uav_clear.h: the model for a run with no host runtime to compare with. +std::vector model(const std::vector& supported) { + std::vector bytes(api_readback, 0x11); + std::fill(bytes.begin(), bytes.begin() + api_data_bytes, std::uint8_t(0xcd)); + for (std::size_t c = 0; c < std::size(clear_cases); ++c) { + const ClearCase& test = clear_cases[c]; + uc::Element e{}; + if (!supported[c] || !uc::encode(test.vulkan, test.is_float, test.values, e)) continue; + for (UINT64 i = 0; i < UINT64(test.elements) * e.size; ++i) bytes[test.byte_offset + i] = e.bytes[i % e.size]; + } + // A structured view clears every 32-bit word to the first value (D3D12 ignores the other three). + for (UINT64 i = 0; i < api_records_bytes; ++i) bytes[api_data_bytes + i] = i % 4 == 0 ? 0xab : 0; + const std::uint32_t three = 3; + std::memcpy(bytes.data() + api_data_bytes + api_records_bytes + counter_offset, &three, 4); + return bytes; +} + +} // namespace + +int main() { + vktest::Device d; + const auto device_status = d.initialize(); + if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips + if (device_status != vktest::DeviceStatus::ready) return 1; + if (!d.bindless) { + std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n"); + return 77; + } + const std::filesystem::path root_dir = LEONIDA_TEST_BUFFER_UAV_DIR; + + unsigned words = 0; + if (const int status = run_shaders(d, root_dir, words)) return status; + + // Part 2: the layer's device and the host's on the same adapter. + std::vector ours, host_bytes; + std::vector supported; + { + rt::d3d12::VulkanDeviceInfo info{}; + info.get_instance_proc = d.instance_proc; + info.instance = d.instance; + info.physical = d.physical; + info.device = d.device; + info.queue = d.queue; + info.queue_family = d.family; + info.buffer_device_address = true; // the V# holds the buffer's address + Ref device; + EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&device.p)))); + EXPECT(run_api(device.p, false, ours, supported)); + } + std::string host_name = "none"; + bool compared = false; + { + VkPhysicalDeviceIDProperties id{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES}; + VkPhysicalDeviceProperties2 properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &id}; + d.instance_fn("vkGetPhysicalDeviceProperties2")(d.physical, &properties); + copycmp::Ptr host; + LUID luid{}; + std::memcpy(&luid, id.deviceLUID, sizeof(luid)); + if (id.deviceLUIDValid && copycmp::try_create_host(host, host_name, &luid)) { + std::vector host_supported; + EXPECT(run_api(host.p, true, host_bytes, host_supported)); + supported = host_supported; + compared = true; + } + } + if (!compared) { + std::printf("no host D3D12 device on the layer's adapter: the layer's bytes are compared with uav_clear.h\n"); + host_bytes = model(supported); + host_name = "the uav_clear.h model"; + } else { + // The layer ran every case; the host only those its adapter can store typed. Mask the others in both. + for (std::size_t c = 0; c < std::size(clear_cases); ++c) { + if (supported[c]) continue; + const ClearCase& test = clear_cases[c]; + const UINT size = uc::layout(test.vulkan)->bytes; + std::fill_n(ours.begin() + test.byte_offset, UINT64(test.elements) * size, std::uint8_t(0)); + std::fill_n(host_bytes.begin() + test.byte_offset, UINT64(test.elements) * size, std::uint8_t(0)); + std::printf("host adapter has no typed UAV store for DXGI format %d: that case is not compared\n", + int(test.format)); + } + } + EXPECT(ours.size() == api_readback && host_bytes.size() == api_readback); + unsigned differing = 0; + for (std::size_t i = 0; i < ours.size(); ++i) { + ++words; + if (ours[i] == host_bytes[i]) continue; + if (differing++ < 12) { + const char* where = i < api_data_bytes ? "typed clears" : i < api_data_bytes + api_records_bytes ? "structured clear with a counter" : "counter buffer"; + std::fprintf(stderr, "%s byte %zu: layer %02x, %s %02x\n", where, i, ours[i], host_name.c_str(), host_bytes[i]); + } + } + if (differing) { + // Say which clear case the first differing byte belongs to. + for (std::size_t c = 0; c < std::size(clear_cases); ++c) { + const ClearCase& test = clear_cases[c]; + const UINT size = uc::layout(test.vulkan)->bytes; + for (UINT64 i = 0; i < UINT64(test.elements) * size; ++i) + if (ours[test.byte_offset + i] != host_bytes[test.byte_offset + i]) { + std::fprintf(stderr, "case %zu (DXGI format %d) differs\n", c, int(test.format)); + break; + } + } + std::fprintf(stderr, "%u bytes differ\n", differing); + return 1; + } + if (d.validation_errors()) { + std::fprintf(stderr, "%u validation errors\n", d.validation_errors()); + return 1; + } + std::printf("Buffer UAVs: typed views (R32_UINT with an atomic, R16G16B16A16_FLOAT, R8G8B8A8_UNORM from FirstElement 16, " + "R32G32B32A32_UINT, R32_FLOAT loads, R32_SINT) written by a translated compute shader with NUM_RECORDS " + "as the bound, and a structured UAV with a counter at offset 4096 appended to by 256 lanes and consumed " + "by 128 (counter 256 then 128 through CopyBufferRegion) matched the CPU reference; typed-buffer and " + "counter clears matched %s: %u values compared, error 0\n", + host_name.c_str(), words); + return 0; +} diff --git a/runtime/test/d3d12_compute_test.cpp b/runtime/test/d3d12_compute_test.cpp index e53f9ab4ba..2d9dff03f8 100644 --- a/runtime/test/d3d12_compute_test.cpp +++ b/runtime/test/d3d12_compute_test.cpp @@ -505,6 +505,8 @@ int main() { } for (auto* r : {&out_a, &out_b, &constants, &readback}) r->reset(); + pso67.reset(); + unknown67.reset(); pso.reset(); root.reset(); heap.reset(); diff --git a/runtime/test/d3d12_descriptor_test.cpp b/runtime/test/d3d12_descriptor_test.cpp index 2f6d059c33..13c10d0432 100644 --- a/runtime/test/d3d12_descriptor_test.cpp +++ b/runtime/test/d3d12_descriptor_test.cpp @@ -698,6 +698,42 @@ int main() { const auto null_at = [&](UINT i) { return std::all_of(view_bytes(i), view_bytes(i) + step, [](std::uint8_t byte) { return byte == 0; }); }; + // An explicit D3D12_SRV_DIMENSION_TEXTURE1D view on a 1D texture array selects layer zero (like TEXTURE2D + // and TEXTURE2DMS on 2D arrays), while a default (nullptr) SRV on a 1D array remains a null descriptor. + { + auto line_array_desc = line_desc; + line_array_desc.DepthOrArraySize = 3; + Ref line_array; + EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &line_array_desc, + D3D12_RESOURCE_STATE_COMMON, nullptr, + IID_PPV_ARGS(&line_array.p)))); + D3D12_DESCRIPTOR_HEAP_DESC la_heap_desc{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 2, + D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0}; + Ref la_heap; + EXPECT(SUCCEEDED(device->CreateDescriptorHeap(&la_heap_desc, IID_PPV_ARGS(&la_heap.p)))); + const std::uint64_t la_cpu = reinterpret_cast(slot(la_heap.p, 9))(la_heap.p); + const D3D12_CPU_DESCRIPTOR_HANDLE la_default{SIZE_T(la_cpu)}, la_slice0{SIZE_T(la_cpu + step)}; + std::memset(reinterpret_cast(la_default.ptr), 0x77, step); + device->CreateShaderResourceView(line_array.p, nullptr, la_default); + EXPECT(std::all_of(reinterpret_cast(la_default.ptr), + reinterpret_cast(la_default.ptr) + step, + [](std::uint8_t byte) { return byte == 0; })); + D3D12_SHADER_RESOURCE_VIEW_DESC la_view{}; + la_view.Format = DXGI_FORMAT_UNKNOWN; + la_view.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE1D; + la_view.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; + la_view.Texture1D = {1, 1, 0}; + device->CreateShaderResourceView(line_array.p, &la_view, la_slice0); + g::ImageWords la_words{}; + std::memcpy(la_words.data(), reinterpret_cast(la_slice0.ptr), sizeof(la_words)); + g::Image la_image{}; + EXPECT(g::is_image(la_words) && g::decode(la_words, la_image) && + la_image.type == g::ImageType::image_1d && la_image.first_mip == 1 && la_image.mip_count == 1 && + la_image.first_layer == 0 && la_image.layer_count == 1); + std::uint32_t la_key[8]{}; + std::memcpy(la_key, la_words.data(), sizeof(la_key)); + EXPECT(rt::d3d12::bindless_hash_lookup(device.p, la_key) != 0); + } D3D12_RESOURCE_DESC ms_desc = texture_desc; ms_desc.Width = ms_desc.Height = 4; ms_desc.SampleDesc.Count = 4; diff --git a/runtime/test/d3d12_m4_compute_test.cpp b/runtime/test/d3d12_m4_compute_test.cpp new file mode 100644 index 0000000000..bd3a555fdd --- /dev/null +++ b/runtime/test/d3d12_m4_compute_test.cpp @@ -0,0 +1,395 @@ +// Milestone M4, the synthetic part (docs/d3d12_vulkan.md section 6): a compute workload with the structure a game's asset +// streaming and compute passes have, through the D3D12 API on the proxy, with compute shaders that are translator output +// (test/shaders/cs_m4_fill.asm and cs_m4_indirect.asm, hand-written RDNA2). +// Three queues' worth of work, each its own command list type: +// COPY queue streams an input buffer: CopyBufferRegion from an UPLOAD buffer into a DEFAULT buffer that was created +// in COMMON (promoted to COPY_DEST there), then Signal(copy fence, 1). +// COMPUTE queue Wait(copy fence, 1), then one list: a barrier COMMON -> UNORDERED_ACCESS for the input, a compute root +// signature (four root constants and a descriptor table of five UAVs: a structured buffer, a raw +// buffer, an R32_UINT RWTexture2D, the raw input and a raw output), a compute PSO, and Dispatch with +// four groups. That shader fills the structured buffer and the image from the input and writes the +// arguments of the next dispatch into the raw buffer. Barriers (a transition of the argument buffer to +// INDIRECT_ARGUMENT and UAV barriers on the buffer and the image) and ExecuteIndirect with a dispatch +// command signature runs a second PSO whose group count is that buffer's first word: it reads the +// structured buffer and the image back and writes the raw output. Everything then goes to COMMON and +// the queue does Signal(compute fence, 1). +// COPY queue Wait(compute fence, 1), a COPY list that copies the five results (four buffers and the image through +// CopyTextureRegion) to a READBACK buffer, Signal(copy fence, 2). The CPU waits for that with +// SetEventOnCompletion and an event. +// When the Vulkan family has two queues, the copy and the compute D3D12 queue get their own VkQueue (so the fences are +// real cross-queue semaphores); with one, they share it. Either way the three batches are submitted in dependency order. +// Compared with a CPU reference, word by word, error 0: the input after the round trip, the structured buffer, the +// argument buffer, the image and the indirect dispatch's output (which also shows that exactly the 3 groups the +// first dispatch asked for ran). +// Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation (0 errors required). +#include "vk_test_device.h" +#include "d3d12_test_shaders.h" +#include "../shims/d3d12_com.h" +#include "../shims/d3d12_xs_device.h" +#include "../src/shader_library.h" + +#include +#include + +#ifndef LEONIDA_TEST_M4_DIR +#error "LEONIDA_TEST_M4_DIR must name the folder build.py wrote (spirv/index.json, fssm/cs_*.fssm)" +#endif + +#define EXPECT(condition) do { \ + if (!(condition)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); return 1; } \ +} while (0) + +using namespace d3d12test; +using XboxHeapHandleFn = std::uint64_t(WINAPI*)(void* heap); // heap slots 9/10: handle in RAX + +namespace { + +std::vector read_file(const std::filesystem::path& path) { + std::ifstream in(path, std::ios::binary); + return {std::istreambuf_iterator(in), std::istreambuf_iterator()}; +} + +constexpr UINT records = 256; // fill: 4 groups of 64 +constexpr UINT second_groups = 3; // the indirect dispatch: 3 groups of 64 +constexpr UINT image_dim = 16; // 16 x 16 R32_UINT, one texel a record +constexpr UINT seed = 0x00c0ffee, multiplier = 0x01000193; +// The readback buffer: the structured buffer, the argument buffer's 16 bytes, the second output, the input, the image. +constexpr UINT64 data_bytes = records * 16, args_bytes = 16, out2_bytes = second_groups * 64 * 8, in_bytes = records * 4; +constexpr UINT64 offset_data = 0, offset_args = offset_data + data_bytes, offset_out2 = offset_args + args_bytes, + offset_in = offset_out2 + out2_bytes; +constexpr UINT64 offset_image = (offset_in + in_bytes + 511) / 512 * 512; +constexpr UINT image_pitch = D3D12_TEXTURE_DATA_PITCH_ALIGNMENT; +constexpr UINT64 readback_bytes = offset_image + UINT64(image_dim) * image_pitch; + +std::uint32_t rotr(std::uint32_t v, unsigned n) { return (v >> n) | (v << (32 - n)); } +std::uint32_t input_word(UINT g) { return (g + 1) * 0x9e3779b1u ^ (g << 7); } + +struct Reference { + std::vector data, args, in, image, out2; +}; +Reference reference() { + Reference ref; + ref.args = {second_groups, 1, 1, 0xc0de0001u}; + ref.data.resize(records * 4); + ref.image.resize(image_dim * image_dim); + for (UINT g = 0; g < records; ++g) { + const std::uint32_t in = input_word(g); + ref.in.push_back(in); + ref.data[g * 4 + 0] = in + seed; + ref.data[g * 4 + 1] = g * multiplier; + ref.data[g * 4 + 2] = in ^ (g << 8); + ref.data[g * 4 + 3] = rotr(in, 13); + const UINT x = g & 15, y = g >> 4; + ref.image[y * image_dim + x] = in * 3 + x * 0x10001u + y; + } + for (UINT g = 0; g < second_groups * 64; ++g) { + const std::uint32_t t = ref.image[g]; // (g & 15, g >> 4) is texel g of the row-major image + ref.out2.push_back((ref.data[g * 4 + 0] + t) ^ ref.data[g * 4 + 3]); + ref.out2.push_back((ref.data[g * 4 + 2] ^ t) + ref.data[g * 4 + 1]); + } + return ref; +} + +} // namespace + +int main() { + vktest::Device d; + d.queue_count_wanted = 2; // the copy queue and the compute queue each get a VkQueue where the family has two + const auto device_status = d.initialize(); + if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips + if (device_status != vktest::DeviceStatus::ready) return 1; + if (!d.bindless) { + std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n"); + return 77; + } + + const std::filesystem::path root_dir = LEONIDA_TEST_M4_DIR; + leonida::ShaderLibrary library; + EXPECT(library.load((root_dir / "spirv").string())); + const auto program = [&](const char* name) { return read_file(root_dir / "fssm" / (std::string(name) + ".fssm")); }; + const auto fill = program("cs_m4_fill"), indirect = program("cs_m4_indirect"); + EXPECT(fill.size() >= 0x150 && indirect.size() >= 0x150 && fill != indirect); + EXPECT(library.find("cs", leonida::sha256_hex(fill)) && library.find("cs", leonida::sha256_hex(indirect))); + const auto fill_container = shader_container(fill), indirect_container = shader_container(indirect); + + const bool distinct_queues = d.queues.size() >= 2; + Reference want = reference(); + std::vector got; + { + rt::d3d12::VulkanDeviceInfo info{}; + info.get_instance_proc = d.instance_proc; + info.instance = d.instance; + info.physical = d.physical; + info.device = d.device; + info.queue = d.queue; + info.queue_family = d.family; + if (distinct_queues) info.command_queues = d.queues; + info.buffer_device_address = true; + info.bindless = d.bindless; + info.bindless_partially_bound = d.partially_bound; + info.image_view_min_lod = d.image_view_min_lod; + info.shader_dir = (root_dir / "spirv").string(); + ID3D12Device* inner = nullptr; + EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&inner)))); + Ref device; + EXPECT(SUCCEEDED(rt::d3d12_xs::create_device_proxy(inner, __uuidof(ID3D12Device), + reinterpret_cast(&device.p)))); + rt::d3d12::set_device_outer(inner, device.p); + EXPECT(rt::d3d12::bindless_set(device.p) != VK_NULL_HANDLE); + + // [0] four 32-bit constants (s0..s3), [1] a table of five UAVs (s[4:5]). + D3D12_DESCRIPTOR_RANGE uav_range{D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 5, 0, 0, 0}; + D3D12_ROOT_PARAMETER params[2] = {}; + params[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; + params[0].Constants = {0, 0, 4}; + params[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + params[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + params[1].DescriptorTable = {1, &uav_range}; + params[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL; + D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{}; + root_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0; + root_desc.Desc_1_0 = {2, params, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE}; + const auto root_blob = serialize_root_signature(root_desc); + EXPECT(!root_blob.empty()); + Ref root; + EXPECT(SUCCEEDED(device->CreateRootSignature(0, root_blob.data(), root_blob.size(), IID_PPV_ARGS(&root.p)))); + + D3D12_COMPUTE_PIPELINE_STATE_DESC pso_desc{}; + pso_desc.pRootSignature = root.p; + pso_desc.CS = {fill_container.data(), fill_container.size()}; + Ref pso_fill, pso_indirect; + EXPECT(SUCCEEDED(device->CreateComputePipelineState(&pso_desc, IID_PPV_ARGS(&pso_fill.p)))); + pso_desc.CS = {indirect_container.data(), indirect_container.size()}; + EXPECT(SUCCEEDED(device->CreateComputePipelineState(&pso_desc, IID_PPV_ARGS(&pso_indirect.p)))); + + D3D12_INDIRECT_ARGUMENT_DESC argument{}; + argument.Type = D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH; + D3D12_COMMAND_SIGNATURE_DESC signature_desc{}; + signature_desc.ByteStride = sizeof(D3D12_DISPATCH_ARGUMENTS); + signature_desc.NumArgumentDescs = 1; + signature_desc.pArgumentDescs = &argument; + Ref signature; + EXPECT(SUCCEEDED(device->CreateCommandSignature(&signature_desc, nullptr, IID_PPV_ARGS(&signature.p)))); + + const D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT}; + const D3D12_HEAP_PROPERTIES upload_heap{D3D12_HEAP_TYPE_UPLOAD}; + const D3D12_HEAP_PROPERTIES readback_heap{D3D12_HEAP_TYPE_READBACK}; + constexpr auto uav_flag = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; + constexpr auto uav_state = D3D12_RESOURCE_STATE_UNORDERED_ACCESS; + constexpr auto common = D3D12_RESOURCE_STATE_COMMON; + Ref upload, input, data, args, out2, image, readback; + const auto create_buffer = [&](Ref& out, const D3D12_HEAP_PROPERTIES& heap, UINT64 bytes, + D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES state) { + const auto desc = buffer_desc(bytes, flags); + return SUCCEEDED(device->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &desc, state, nullptr, + IID_PPV_ARGS(&out.p))); + }; + EXPECT(create_buffer(upload, upload_heap, in_bytes, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ)); + EXPECT(create_buffer(input, default_heap, in_bytes, uav_flag, common)); + EXPECT(create_buffer(data, default_heap, data_bytes, uav_flag, uav_state)); + EXPECT(create_buffer(args, default_heap, 256, uav_flag, uav_state)); + EXPECT(create_buffer(out2, default_heap, out2_bytes, uav_flag, uav_state)); + EXPECT(create_buffer(readback, readback_heap, readback_bytes, D3D12_RESOURCE_FLAG_NONE, + D3D12_RESOURCE_STATE_COPY_DEST)); + D3D12_RESOURCE_DESC image_desc{}; + image_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + image_desc.Width = image_desc.Height = image_dim; + image_desc.DepthOrArraySize = 1; + image_desc.MipLevels = 1; + image_desc.Format = DXGI_FORMAT_R32_UINT; + image_desc.SampleDesc.Count = 1; + image_desc.Flags = uav_flag; + EXPECT(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &image_desc, uav_state, + nullptr, IID_PPV_ARGS(&image.p)))); + { + std::uint32_t* mapped = nullptr; + EXPECT(SUCCEEDED(upload->Map(0, nullptr, reinterpret_cast(&mapped)))); + for (UINT g = 0; g < records; ++g) mapped[g] = input_word(g); + upload->Unmap(0, nullptr); + } + + // The table: slot 0 structured buffer (stride 16), 1 raw argument buffer, 2 image, 3 raw input, 4 raw output. + const D3D12_DESCRIPTOR_HEAP_DESC heap_desc{D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, 5, + D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE, 0}; + Ref heap; + EXPECT(SUCCEEDED(device->CreateDescriptorHeap(&heap_desc, IID_PPV_ARGS(&heap.p)))); + const std::uint64_t cpu = reinterpret_cast(slot(heap.p, 9))(heap.p); + const std::uint64_t gpu = reinterpret_cast(slot(heap.p, 10))(heap.p); + const UINT step = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + EXPECT(cpu && gpu >= 0x10000 && gpu < (1ull << 32) && step == 32); // the shaders step 32 bytes a slot + const auto handle = [&](UINT i) { return D3D12_CPU_DESCRIPTOR_HANDLE{SIZE_T(cpu + std::uint64_t(i) * step)}; }; + const auto buffer_view = [](DXGI_FORMAT format, UINT count, UINT stride, D3D12_BUFFER_UAV_FLAGS flags) { + D3D12_UNORDERED_ACCESS_VIEW_DESC view{}; + view.Format = format; + view.ViewDimension = D3D12_UAV_DIMENSION_BUFFER; + view.Buffer = {0, count, stride, 0, flags}; + return view; + }; + auto view = buffer_view(DXGI_FORMAT_UNKNOWN, records, 16, D3D12_BUFFER_UAV_FLAG_NONE); + device->CreateUnorderedAccessView(data.p, nullptr, &view, handle(0)); + view = buffer_view(DXGI_FORMAT_R32_TYPELESS, 4, 0, D3D12_BUFFER_UAV_FLAG_RAW); // the 16 bytes of arguments + device->CreateUnorderedAccessView(args.p, nullptr, &view, handle(1)); + D3D12_UNORDERED_ACCESS_VIEW_DESC image_view{}; + image_view.Format = DXGI_FORMAT_R32_UINT; + image_view.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D; + device->CreateUnorderedAccessView(image.p, nullptr, &image_view, handle(2)); + view = buffer_view(DXGI_FORMAT_R32_TYPELESS, records, 0, D3D12_BUFFER_UAV_FLAG_RAW); + device->CreateUnorderedAccessView(input.p, nullptr, &view, handle(3)); + view = buffer_view(DXGI_FORMAT_R32_TYPELESS, UINT(out2_bytes / 4), 0, D3D12_BUFFER_UAV_FLAG_RAW); + device->CreateUnorderedAccessView(out2.p, nullptr, &view, handle(4)); + // The V# of the structured view and the T# of the image view are what the shader loads from the table. + std::uint32_t v_data[4], v_args[4]; + std::memcpy(v_data, reinterpret_cast(handle(0).ptr), sizeof(v_data)); + std::memcpy(v_args, reinterpret_cast(handle(1).ptr), sizeof(v_args)); + EXPECT(v_data[0] == std::uint32_t(data->GetGPUVirtualAddress()) && (v_data[1] >> 16 & 0x3fff) == 16 && + v_data[2] == records); + EXPECT(v_args[0] == std::uint32_t(args->GetGPUVirtualAddress()) && (v_args[1] >> 16 & 0x3fff) == 0 && + v_args[2] == 16); + + D3D12_COMMAND_QUEUE_DESC queue_desc{}; + Ref copy_queue, compute_queue; + queue_desc.Type = D3D12_COMMAND_LIST_TYPE_COPY; + EXPECT(SUCCEEDED(device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(©_queue.p)))); + queue_desc.Type = D3D12_COMMAND_LIST_TYPE_COMPUTE; + EXPECT(SUCCEEDED(device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&compute_queue.p)))); + Ref stream_alloc, compute_alloc, readback_alloc; + Ref stream_list, compute_list, readback_list; + Ref copy_fence, compute_fence; + const auto make_list = [&](D3D12_COMMAND_LIST_TYPE type, Ref& alloc, + Ref& list) { + return SUCCEEDED(device->CreateCommandAllocator(type, IID_PPV_ARGS(&alloc.p))) && + SUCCEEDED(device->CreateCommandList(0, type, alloc.p, nullptr, IID_PPV_ARGS(&list.p))); + }; + EXPECT(make_list(D3D12_COMMAND_LIST_TYPE_COPY, stream_alloc, stream_list)); + EXPECT(make_list(D3D12_COMMAND_LIST_TYPE_COMPUTE, compute_alloc, compute_list)); + EXPECT(make_list(D3D12_COMMAND_LIST_TYPE_COPY, readback_alloc, readback_list)); + EXPECT(SUCCEEDED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(©_fence.p)))); + EXPECT(SUCCEEDED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&compute_fence.p)))); + + // Copy list 1: stream the input in (the buffer is in COMMON and is promoted to COPY_DEST by the copy). This is the + // first submission after the UAV views were written, and a copy queue: it must not initialize the storage image + // (the compute queue does, in the submission that dispatches), or the data written later would be at risk. + stream_list->CopyBufferRegion(input.p, 0, upload.p, 0, in_bytes); + EXPECT(stream_list->Close() == S_OK); + + D3D12_TEXTURE_COPY_LOCATION dst{}, src{}; + dst.pResource = readback.p; + dst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + dst.PlacedFootprint = {offset_image, {DXGI_FORMAT_R32_UINT, image_dim, image_dim, 1, image_pitch}}; + src.pResource = image.p; + src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + + // Compute list. + ID3D12DescriptorHeap* heaps[] = {heap.p}; + D3D12_RESOURCE_BARRIER acquire = transition(input.p, common, uav_state); + compute_list->ResourceBarrier(1, &acquire); + compute_list->SetDescriptorHeaps(1, heaps); + compute_list->SetComputeRootSignature(root.p); + compute_list->SetPipelineState(pso_fill.p); + const std::uint32_t constants[4] = {seed, multiplier, second_groups, 0}; + compute_list->SetComputeRoot32BitConstants(0, 4, constants, 0); + compute_list->SetComputeRootDescriptorTable(1, D3D12_GPU_DESCRIPTOR_HANDLE{gpu}); + compute_list->Dispatch(records / 64, 1, 1); + D3D12_RESOURCE_BARRIER between[3] = {transition(args.p, uav_state, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT), + {}, {}}; + for (int i : {1, 2}) { + between[i].Type = D3D12_RESOURCE_BARRIER_TYPE_UAV; + between[i].UAV.pResource = i == 1 ? data.p : image.p; + } + compute_list->ResourceBarrier(3, between); + compute_list->SetPipelineState(pso_indirect.p); // the root arguments stay + compute_list->ExecuteIndirect(signature.p, 1, args.p, 0, nullptr, 0); + D3D12_RESOURCE_BARRIER release[5] = {transition(data.p, uav_state, common), + transition(args.p, D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT, common), + transition(out2.p, uav_state, common), + transition(input.p, uav_state, common), + transition(image.p, uav_state, common)}; + compute_list->ResourceBarrier(5, release); + EXPECT(compute_list->Close() == S_OK); + + // Copy list 2: the results to the readback buffer, once the compute queue is done. + readback_list->CopyBufferRegion(readback.p, offset_data, data.p, 0, data_bytes); + readback_list->CopyBufferRegion(readback.p, offset_args, args.p, 0, args_bytes); + readback_list->CopyBufferRegion(readback.p, offset_out2, out2.p, 0, out2_bytes); + readback_list->CopyBufferRegion(readback.p, offset_in, input.p, 0, in_bytes); + readback_list->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr); + EXPECT(readback_list->Close() == S_OK); + + const auto execute = [&](ID3D12CommandQueue* queue, ID3D12GraphicsCommandList* list) { + ID3D12CommandList* lists[] = {list}; + queue->ExecuteCommandLists(1, lists); + return rt::d3d12::last_execute_result(queue) == leonida::ReplayResult::success; + }; + const auto submit_copy = [&] { + return execute(copy_queue.p, stream_list.p) && SUCCEEDED(copy_queue->Signal(copy_fence.p, 1)); + }; + const auto submit_readback = [&] { + return SUCCEEDED(copy_queue->Wait(compute_fence.p, 1)) && execute(copy_queue.p, readback_list.p) && + SUCCEEDED(copy_queue->Signal(copy_fence.p, 2)); + }; + const auto submit_compute = [&] { + return SUCCEEDED(compute_queue->Wait(copy_fence.p, 1)) && execute(compute_queue.p, compute_list.p) && + SUCCEEDED(compute_queue->Signal(compute_fence.p, 1)); + }; + // In dependency order: the layer replays a list at ExecuteCommandLists and tracks every image's layout in that + // order, so a list that waits for another queue's signal has to be submitted after the list it waits for + // (the Wait-before-Signal order d3d12_queue_wait_test covers, without a resource handed over). + EXPECT(submit_copy() && submit_compute() && submit_readback()); + + const HANDLE event = CreateEventW(nullptr, FALSE, FALSE, nullptr); + EXPECT(event != nullptr); + EXPECT(SUCCEEDED(copy_fence->SetEventOnCompletion(2, event))); + if (WaitForSingleObject(event, 20000) != WAIT_OBJECT_0) { + std::fprintf(stderr, "the copy fence never reached 2 (compute fence at %llu)\n", + static_cast(compute_fence->GetCompletedValue())); + return 1; + } + CloseHandle(event); + EXPECT(copy_fence->GetCompletedValue() >= 2 && compute_fence->GetCompletedValue() >= 1); + + void* mapped = nullptr; + EXPECT(SUCCEEDED(readback->Map(0, nullptr, &mapped))); + got.assign(static_cast(mapped), static_cast(mapped) + readback_bytes); + readback->Unmap(0, nullptr); + + for (auto* r : {&upload, &input, &data, &args, &out2, &image, &readback}) r->reset(); + stream_list.reset(); compute_list.reset(); readback_list.reset(); + stream_alloc.reset(); compute_alloc.reset(); readback_alloc.reset(); + copy_fence.reset(); compute_fence.reset(); + signature.reset(); pso_fill.reset(); pso_indirect.reset(); root.reset(); heap.reset(); + copy_queue.reset(); compute_queue.reset(); + EXPECT(rt::d3d12_xs::device_proxy_ref_count(device.p) == 1); + } + + unsigned mismatches = 0, words = 0; + const auto compare = [&](const char* what, UINT64 offset, const std::vector& expected, UINT pitch, + UINT row_words) { + unsigned bad = 0; + for (std::size_t i = 0; i < expected.size(); ++i) { + std::uint32_t value = 0; + const UINT64 at = offset + (pitch ? (i / row_words) * pitch + (i % row_words) * 4 : i * 4); + std::memcpy(&value, got.data() + at, 4); + ++words; + if (value == expected[i]) continue; + ++mismatches; + if (bad++ < 4) std::fprintf(stderr, "%s word %zu: got %08x want %08x\n", what, i, value, expected[i]); + } + if (bad) std::fprintf(stderr, "%s: %u of %zu words differ\n", what, bad, expected.size()); + }; + compare("input (copy queue round trip)", offset_in, want.in, 0, 0); + compare("structured buffer", offset_data, want.data, 0, 0); + compare("dispatch arguments", offset_args, want.args, 0, 0); + compare("image", offset_image, want.image, image_pitch, image_dim); + compare("indirect dispatch output", offset_out2, want.out2, 0, 0); + EXPECT(!mismatches); + if (d.validation_errors()) { + std::fprintf(stderr, "%u validation errors\n", d.validation_errors()); + return 1; + } + std::printf("M4: a COPY queue streamed an input buffer in, a COMPUTE queue ran a compute PSO over a UAV table " + "(structured buffer, raw buffers, an R32_UINT storage image) and a second dispatch through " + "ExecuteIndirect from arguments the first wrote, and a COPY queue behind a cross-queue fence read the " + "results back (%s): %u words matched the CPU reference (error 0)\n", + distinct_queues ? "two VkQueues" : "one VkQueue", words); + return 0; +} diff --git a/runtime/test/d3d12_pipeline_library_test.cpp b/runtime/test/d3d12_pipeline_library_test.cpp new file mode 100644 index 0000000000..cd7b411e59 --- /dev/null +++ b/runtime/test/d3d12_pipeline_library_test.cpp @@ -0,0 +1,316 @@ +// Synthetic GPU test for ID3D12Device1::CreatePipelineLibrary and ID3D12PipelineLibrary / ID3D12PipelineLibrary1: +// - empty library creation (0-byte blob), null-output capability check (S_FALSE), and invalid/foreign/corrupt +// blob rejection (E_INVALIDARG for null pointer with non-zero size, D3D12_ERROR_DRIVER_VERSION_MISMATCH for +// unrecognized or corrupt headers); +// - StorePipeline (unique names, duplicate rejection, null/empty name rejection, null/foreign PSO rejection); +// - LoadComputePipeline, LoadGraphicsPipeline, and ID3D12PipelineLibrary1::LoadPipeline (including cross-type +// mismatch rejection when a compute PSO is requested through LoadGraphicsPipeline or vice versa); +// - GetSerializedSize + Serialize round-trip into a second CreatePipelineLibrary; +// - GPU execution of both loaded compute and loaded graphics PSOs under LEONIDA_VK_VALIDATION=1. +// No game data. +#include "vk_test_device.h" +#include "d3d12_test_shaders.h" +#include "../shims/d3d12_com.h" +#include "../src/shader_library.h" + +#include +#include +#include +#include + +#if !defined(LEONIDA_TEST_CS_SPV) || !defined(LEONIDA_TEST_VS_SPV) || !defined(LEONIDA_TEST_PS_SPV) +#error "LEONIDA_TEST_CS_SPV, LEONIDA_TEST_VS_SPV and LEONIDA_TEST_PS_SPV must be defined" +#endif + +#define EXPECT(condition) do { \ + if (!(condition)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #condition); return 1; } \ +} while (0) + +using namespace d3d12test; + +namespace { + +struct Vertex { + float x, y; + std::uint8_t r, g, b, a; +}; + +D3D12_RESOURCE_DESC tex2d_desc(UINT w, UINT h, DXGI_FORMAT fmt, D3D12_RESOURCE_FLAGS flags) { + D3D12_RESOURCE_DESC d{}; + d.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + d.Width = w; + d.Height = h; + d.DepthOrArraySize = 1; + d.MipLevels = 1; + d.Format = fmt; + d.SampleDesc = {1, 0}; + d.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; + d.Flags = flags; + return d; +} + +} // namespace + +int main() { + vktest::Device d; + const auto status = d.initialize(); + if (status == vktest::DeviceStatus::unavailable) { + std::fprintf(stderr, "SKIP: no usable Vulkan 1.3 device\n"); + return 77; + } + EXPECT(status == vktest::DeviceStatus::ready); + + const auto cs_prog = fssm_program({0x43532001, 0xbf810000}); + const auto vs_prog = fssm_program({0x56532001, 0xbf810000}); + const auto ps_prog = fssm_program({0x50532001, 0xbf810000}); + const auto cs_dxbc = shader_container(cs_prog); + const auto vs_dxbc = shader_container(vs_prog); + const auto ps_dxbc = shader_container(ps_prog); + + const auto lib_dir = std::filesystem::temp_directory_path() / "leonida_pipeline_library_test"; + std::filesystem::create_directories(lib_dir); + std::filesystem::copy_file(LEONIDA_TEST_CS_SPV, lib_dir / "cs.spv", + std::filesystem::copy_options::overwrite_existing); + std::filesystem::copy_file(LEONIDA_TEST_VS_SPV, lib_dir / "vs.spv", + std::filesystem::copy_options::overwrite_existing); + std::filesystem::copy_file(LEONIDA_TEST_PS_SPV, lib_dir / "ps.spv", + std::filesystem::copy_options::overwrite_existing); + { + std::ofstream idx(lib_dir / "index.json", std::ios::binary); + idx << "{\"cs\": {\"stage\": \"cs\", \"fssm_sha256\": \"" << leonida::sha256_hex(cs_prog) + << "\", \"bindings\": [], \"push_constant_bytes\": 144},\n" + " \"vs\": {\"stage\": \"vs\", \"fssm_sha256\": \"" << leonida::sha256_hex(vs_prog) + << "\", \"bindings\": [], \"push_constant_bytes\": 144, \"input_signature\": [" + "{\"semantic\": \"COLOR\", \"semantic_index\": 0, \"register\": 0, \"mask\": 15, \"rw_mask\": 15, " + "\"system_value\": 0, \"component_type\": \"float\"}, " + "{\"semantic\": \"POSITION\", \"semantic_index\": 0, \"register\": 1, \"mask\": 3, \"rw_mask\": 3, " + "\"system_value\": 0, \"component_type\": \"float\"}]},\n" + " \"ps\": {\"stage\": \"ps\", \"fssm_sha256\": \"" << leonida::sha256_hex(ps_prog) + << "\", \"bindings\": [], \"push_constant_bytes\": 144, \"outputs\": [0]}}"; + } + + rt::d3d12::VulkanDeviceInfo info{}; + info.get_instance_proc = d.instance_proc; + info.instance = d.instance; + info.physical = d.physical; + info.device = d.device; + info.queue = d.queue; + info.queue_family = d.family; + info.buffer_device_address = true; + info.shader_dir = lib_dir.string(); + + Ref device; + EXPECT(SUCCEEDED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&device.p)))); + + // 1. CreatePipelineLibrary creation, capability check (null output -> S_FALSE), and invalid/corrupt blobs. + { + EXPECT(device->CreatePipelineLibrary(nullptr, 0, __uuidof(ID3D12PipelineLibrary), nullptr) == S_FALSE); + Ref bad; + EXPECT(device->CreatePipelineLibrary(nullptr, 16, IID_PPV_ARGS(&bad.p)) == E_INVALIDARG && !bad.p); + const std::uint32_t foreign[4] = {0xDEADBEEFu, 1u, 0u, 0u}; + EXPECT(device->CreatePipelineLibrary(foreign, sizeof(foreign), IID_PPV_ARGS(&bad.p)) == + D3D12_ERROR_DRIVER_VERSION_MISMATCH && + !bad.p); + const std::uint8_t tiny[4] = {1, 2, 3, 4}; + EXPECT(device->CreatePipelineLibrary(tiny, sizeof(tiny), IID_PPV_ARGS(&bad.p)) == + D3D12_ERROR_DRIVER_VERSION_MISMATCH && + !bad.p); + } + + // 2. Build one compute PSO and one graphics PSO. + D3D12_DESCRIPTOR_RANGE uav_range{D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 1, 1, 0, 0}; + D3D12_ROOT_PARAMETER cs_params[3]{}; + cs_params[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; + cs_params[0].Constants = {0, 0, 1}; + cs_params[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV; + cs_params[1].Descriptor = {0, 0}; + cs_params[2].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + cs_params[2].DescriptorTable = {1, &uav_range}; + D3D12_VERSIONED_ROOT_SIGNATURE_DESC cs_rs_desc{}; + cs_rs_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0; + cs_rs_desc.Desc_1_0 = {3, cs_params, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_NONE}; + const auto cs_rs_blob = serialize_root_signature(cs_rs_desc); + Ref cs_rs; + EXPECT(SUCCEEDED(device->CreateRootSignature(0, cs_rs_blob.data(), cs_rs_blob.size(), IID_PPV_ARGS(&cs_rs.p)))); + + D3D12_COMPUTE_PIPELINE_STATE_DESC cs_desc{}; + cs_desc.pRootSignature = cs_rs.p; + cs_desc.CS = {cs_dxbc.data(), cs_dxbc.size()}; + Ref cs_pso; + EXPECT(SUCCEEDED(device->CreateComputePipelineState(&cs_desc, IID_PPV_ARGS(&cs_pso.p)))); + + D3D12_ROOT_PARAMETER gfx_params[2]{}; + gfx_params[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS; + gfx_params[0].Constants = {0, 0, 2}; + gfx_params[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV; + gfx_params[1].Descriptor = {1, 0}; + D3D12_VERSIONED_ROOT_SIGNATURE_DESC gfx_rs_desc{}; + gfx_rs_desc.Version = D3D_ROOT_SIGNATURE_VERSION_1_0; + gfx_rs_desc.Desc_1_0 = {2, gfx_params, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT}; + const auto gfx_rs_blob = serialize_root_signature(gfx_rs_desc); + Ref gfx_rs; + EXPECT(SUCCEEDED(device->CreateRootSignature(0, gfx_rs_blob.data(), gfx_rs_blob.size(), IID_PPV_ARGS(&gfx_rs.p)))); + + const D3D12_INPUT_ELEMENT_DESC input_elems[2] = { + {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0}, + {"COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D12_APPEND_ALIGNED_ELEMENT, + D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0}, + }; + D3D12_GRAPHICS_PIPELINE_STATE_DESC gfx_desc{}; + gfx_desc.pRootSignature = gfx_rs.p; + gfx_desc.VS = {vs_dxbc.data(), vs_dxbc.size()}; + gfx_desc.PS = {ps_dxbc.data(), ps_dxbc.size()}; + gfx_desc.BlendState.RenderTarget[0].RenderTargetWriteMask = D3D12_COLOR_WRITE_ENABLE_ALL; + gfx_desc.SampleMask = 0xFFFFFFFFu; + gfx_desc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID; + gfx_desc.RasterizerState.CullMode = D3D12_CULL_MODE_BACK; + gfx_desc.RasterizerState.DepthClipEnable = TRUE; + gfx_desc.InputLayout = {input_elems, 2}; + gfx_desc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + gfx_desc.NumRenderTargets = 1; + gfx_desc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM; + gfx_desc.SampleDesc = {1, 0}; + Ref gfx_pso; + EXPECT(SUCCEEDED(device->CreateGraphicsPipelineState(&gfx_desc, IID_PPV_ARGS(&gfx_pso.p)))); + + // 3. Store, load, cross-type rejection, and serialize round-trip. + Ref lib; + EXPECT(SUCCEEDED(device->CreatePipelineLibrary(nullptr, 0, IID_PPV_ARGS(&lib.p))) && lib.p); + Ref parent_dev; + EXPECT(SUCCEEDED(lib->GetDevice(IID_PPV_ARGS(&parent_dev.p))) && parent_dev.p); + + EXPECT(lib->StorePipeline(nullptr, cs_pso.p) == E_INVALIDARG); + EXPECT(lib->StorePipeline(L"", cs_pso.p) == E_INVALIDARG); + EXPECT(lib->StorePipeline(L"cs", nullptr) == E_INVALIDARG); + EXPECT(SUCCEEDED(lib->StorePipeline(L"cs", cs_pso.p))); + EXPECT(lib->StorePipeline(L"cs", cs_pso.p) == E_INVALIDARG); // duplicate name + EXPECT(SUCCEEDED(lib->StorePipeline(L"gfx", gfx_pso.p))); + + Ref loaded_cs, loaded_gfx, loaded_any, wrong; + EXPECT(lib->LoadComputePipeline(L"missing", &cs_desc, IID_PPV_ARGS(&wrong.p)) == E_INVALIDARG && !wrong.p); + EXPECT(lib->LoadComputePipeline(L"gfx", &cs_desc, IID_PPV_ARGS(&wrong.p)) == E_INVALIDARG && !wrong.p); + EXPECT(lib->LoadGraphicsPipeline(L"cs", &gfx_desc, IID_PPV_ARGS(&wrong.p)) == E_INVALIDARG && !wrong.p); + EXPECT(SUCCEEDED(lib->LoadComputePipeline(L"cs", &cs_desc, IID_PPV_ARGS(&loaded_cs.p))) && loaded_cs.p); + EXPECT(SUCCEEDED(lib->LoadGraphicsPipeline(L"gfx", &gfx_desc, IID_PPV_ARGS(&loaded_gfx.p))) && loaded_gfx.p); + + std::uint32_t dummy_stream = 0; + D3D12_PIPELINE_STATE_STREAM_DESC stream_desc{sizeof(dummy_stream), &dummy_stream}; + D3D12_PIPELINE_STATE_STREAM_DESC empty_stream{0, nullptr}; + EXPECT(lib->LoadPipeline(L"gfx", &empty_stream, IID_PPV_ARGS(&wrong.p)) == E_INVALIDARG && !wrong.p); + EXPECT(SUCCEEDED(lib->LoadPipeline(L"gfx", &stream_desc, IID_PPV_ARGS(&loaded_any.p))) && loaded_any.p); + + const SIZE_T blob_size = lib->GetSerializedSize(); + EXPECT(blob_size >= 16); + std::vector blob(blob_size); + EXPECT(lib->Serialize(nullptr, blob_size) == E_INVALIDARG); + EXPECT(lib->Serialize(blob.data(), blob_size - 1) == E_INVALIDARG); + EXPECT(SUCCEEDED(lib->Serialize(blob.data(), blob_size))); + + Ref reloaded; + EXPECT(SUCCEEDED(device->CreatePipelineLibrary(blob.data(), blob.size(), IID_PPV_ARGS(&reloaded.p))) && reloaded.p); + + // 4. Execute the loaded compute PSO and loaded graphics PSO on the GPU. + Ref queue; + const D3D12_COMMAND_QUEUE_DESC qd{D3D12_COMMAND_LIST_TYPE_DIRECT, 0, D3D12_COMMAND_QUEUE_FLAG_NONE, 0}; + EXPECT(SUCCEEDED(device->CreateCommandQueue(&qd, IID_PPV_ARGS(&queue.p)))); + Ref alloc; + EXPECT(SUCCEEDED(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&alloc.p)))); + Ref list; + EXPECT(SUCCEEDED( + device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, alloc.p, nullptr, IID_PPV_ARGS(&list.p)))); + Ref fence; + EXPECT(SUCCEEDED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p)))); + + constexpr UINT W = 16, H = 16; + const D3D12_HEAP_PROPERTIES hp_def{D3D12_HEAP_TYPE_DEFAULT}; + const D3D12_HEAP_PROPERTIES hp_up{D3D12_HEAP_TYPE_UPLOAD}; + const D3D12_HEAP_PROPERTIES hp_rb{D3D12_HEAP_TYPE_READBACK}; + const auto rtd = tex2d_desc(W, H, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET); + const Vertex verts[4] = { + {-1.0f, 1.0f, 255, 0, 0, 255}, + { 0.0f, 1.0f, 255, 0, 0, 255}, + { 0.0f, 0.0f, 255, 0, 0, 255}, + {-1.0f, 0.0f, 255, 0, 0, 255}, + }; + const std::uint16_t indices[6] = {0, 1, 2, 0, 2, 3}; + const float tint[4] = {1.0f, 0.0f, 1.0f, 1.0f}; + const auto vbd = buffer_desc(sizeof(verts)); + const auto ibd = buffer_desc(sizeof(indices)); + const auto cbd = buffer_desc(256); + Ref rt, vb, ib, cb, rb; + EXPECT(SUCCEEDED(device->CreateCommittedResource(&hp_def, D3D12_HEAP_FLAG_NONE, &rtd, + D3D12_RESOURCE_STATE_RENDER_TARGET, nullptr, IID_PPV_ARGS(&rt.p)))); + EXPECT(SUCCEEDED(device->CreateCommittedResource(&hp_up, D3D12_HEAP_FLAG_NONE, &vbd, + D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&vb.p)))); + EXPECT(SUCCEEDED(device->CreateCommittedResource(&hp_up, D3D12_HEAP_FLAG_NONE, &ibd, + D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&ib.p)))); + EXPECT(SUCCEEDED(device->CreateCommittedResource(&hp_up, D3D12_HEAP_FLAG_NONE, &cbd, + D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&cb.p)))); + void* p = nullptr; + EXPECT(SUCCEEDED(vb->Map(0, nullptr, &p))); + std::memcpy(p, verts, sizeof(verts)); + vb->Unmap(0, nullptr); + EXPECT(SUCCEEDED(ib->Map(0, nullptr, &p))); + std::memcpy(p, indices, sizeof(indices)); + ib->Unmap(0, nullptr); + EXPECT(SUCCEEDED(cb->Map(0, nullptr, &p))); + std::memcpy(p, tint, sizeof(tint)); + cb->Unmap(0, nullptr); + + D3D12_PLACED_SUBRESOURCE_FOOTPRINT fp{}; + UINT64 total_bytes = 0; + device->GetCopyableFootprints(&rtd, 0, 1, 0, &fp, nullptr, nullptr, &total_bytes); + const auto rbd = buffer_desc(total_bytes); + EXPECT(SUCCEEDED(device->CreateCommittedResource(&hp_rb, D3D12_HEAP_FLAG_NONE, &rbd, + D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_PPV_ARGS(&rb.p)))); + + Ref rtv_heap; + const D3D12_DESCRIPTOR_HEAP_DESC rhd{D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 1, D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0}; + EXPECT(SUCCEEDED(device->CreateDescriptorHeap(&rhd, IID_PPV_ARGS(&rtv_heap.p)))); + const auto rtv = rtv_heap->GetCPUDescriptorHandleForHeapStart(); + device->CreateRenderTargetView(rt.p, nullptr, rtv); + + const float blue[4] = {0.0f, 0.0f, 1.0f, 1.0f}; + list->ClearRenderTargetView(rtv, blue, 0, nullptr); + list->OMSetRenderTargets(1, &rtv, FALSE, nullptr); + const D3D12_VIEWPORT vp{0, 0, float(W), float(H), 0.0f, 1.0f}; + const D3D12_RECT sc{0, 0, LONG(W), LONG(H)}; + list->RSSetViewports(1, &vp); + list->RSSetScissorRects(1, &sc); + list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + const D3D12_VERTEX_BUFFER_VIEW vbv{vb->GetGPUVirtualAddress(), sizeof(verts), sizeof(Vertex)}; + const D3D12_INDEX_BUFFER_VIEW ibv{ib->GetGPUVirtualAddress(), sizeof(indices), DXGI_FORMAT_R16_UINT}; + list->IASetVertexBuffers(0, 1, &vbv); + list->IASetIndexBuffer(&ibv); + list->SetGraphicsRootSignature(gfx_rs.p); + const float offset[2] = {0.0f, 0.0f}; + list->SetGraphicsRoot32BitConstants(0, 2, offset, 0); + list->SetGraphicsRootConstantBufferView(1, cb->GetGPUVirtualAddress()); + list->SetPipelineState(loaded_gfx.p); + list->DrawIndexedInstanced(6, 1, 0, 0, 0); + + const auto to_src = transition(rt.p, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + list->ResourceBarrier(1, &to_src); + D3D12_TEXTURE_COPY_LOCATION src_loc{rt.p, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {0}}; + D3D12_TEXTURE_COPY_LOCATION dst_loc{rb.p, D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT, {}}; + dst_loc.PlacedFootprint = fp; + list->CopyTextureRegion(&dst_loc, 0, 0, 0, &src_loc, nullptr); + EXPECT(SUCCEEDED(list->Close())); + ID3D12CommandList* lists[] = {list.p}; + queue->ExecuteCommandLists(1, lists); + EXPECT(rt::d3d12::last_execute_result(queue.p) == leonida::ReplayResult::success); + EXPECT(SUCCEEDED(queue->Signal(fence.p, 1)) && SUCCEEDED(fence->SetEventOnCompletion(1, nullptr))); + + EXPECT(SUCCEEDED(rb->Map(0, nullptr, &p))); + const auto* bytes = static_cast(p); + std::uint32_t tl = 0, br = 0; + std::memcpy(&tl, bytes + 2 * fp.Footprint.RowPitch + 2 * 4, 4); + std::memcpy(&br, bytes + 12 * fp.Footprint.RowPitch + 12 * 4, 4); + EXPECT(tl == 0xFF0000FFu); // red quad drawn by PSO loaded from PipelineLibrary + EXPECT(br == 0xFFFF0000u); // blue background clear + rb->Unmap(0, nullptr); + + EXPECT(d.validation_errors() == 0); + std::printf("d3d12_pipeline_library_test: ok\n"); + return 0; +} diff --git a/runtime/test/d3d12_present_test.cpp b/runtime/test/d3d12_present_test.cpp index 8b28eb67a8..f01fb902be 100644 --- a/runtime/test/d3d12_present_test.cpp +++ b/runtime/test/d3d12_present_test.cpp @@ -115,6 +115,8 @@ int fail_semaphore_in = 0; // armed: the n-th vkCreateSemaphore fr bool fail_surface_formats = false; // armed: the next surface-format query fails before creation bool observe_next_swapchain = false; bool report_undefined_extent = false; // armed: surface capabilities reports undefined extent (0xFFFFFFFF) +bool undefined_extent_queried = false; +VkExtent2D last_swapchain_extent{}; VkSwapchainKHR last_created_swapchain = VK_NULL_HANDLE; VkSwapchainKHR observed_old_swapchain = VK_NULL_HANDLE; unsigned out_of_date = 0; // presents the real driver reported out of date @@ -170,6 +172,7 @@ VKAPI_ATTR VkResult VKAPI_CALL surface_formats(VkPhysicalDevice physical, VkSurf VKAPI_ATTR VkResult VKAPI_CALL create_swapchain(VkDevice device, const VkSwapchainCreateInfoKHR* info, const VkAllocationCallbacks* allocator, VkSwapchainKHR* out) { + if (info) last_swapchain_extent = info->imageExtent; if (observe_next_swapchain) { observed_old_swapchain = info->oldSwapchain; observe_next_swapchain = false; @@ -185,6 +188,7 @@ VKAPI_ATTR VkResult VKAPI_CALL get_surface_capabilities(VkPhysicalDevice physica if (result == VK_SUCCESS && report_undefined_extent && caps) { caps->currentExtent.width = 0xFFFFFFFF; caps->currentExtent.height = 0xFFFFFFFF; + undefined_extent_queried = true; } return result; } @@ -409,9 +413,14 @@ int main() { EXPECT(SUCCEEDED(fence->SetEventOnCompletion(signalled, nullptr))); // 4. Undefined surface extent (0xFFFFFFFF, reported by Intel UHD graphics / Win32 WSI; D3D-165): - // the presenter queries the window client extent and clamps to surface bounds. + // switch vsync to 0 to force swapchain recreation, verifying that vkGetPhysicalDeviceSurfaceCapabilitiesKHR + // is reached while armed and that vkCreateSwapchainKHR receives the clamped client extent (400x300) + // instead of 0xFFFFFFFF. driver::report_undefined_extent = true; - EXPECT(frame(1)); + driver::undefined_extent_queried = false; + EXPECT(frame(0)); + EXPECT(driver::undefined_extent_queried); + EXPECT(driver::last_swapchain_extent.width == 400 && driver::last_swapchain_extent.height == 300); EXPECT(presenter->extent().width == 400 && presenter->extent().height == 300); driver::report_undefined_extent = false; diff --git a/runtime/test/d3d12_translated_draw_test.cpp b/runtime/test/d3d12_translated_draw_test.cpp index 80bd911c10..c6b660dda2 100644 --- a/runtime/test/d3d12_translated_draw_test.cpp +++ b/runtime/test/d3d12_translated_draw_test.cpp @@ -63,8 +63,8 @@ struct Vertex { }; using Pixel = std::array; -constexpr UINT extent = 64; -constexpr UINT pitch = extent * sizeof(Pixel); // 1024, a multiple of 256 +constexpr UINT target_extent = 64; +constexpr UINT pitch = target_extent * sizeof(Pixel); // 1024, a multiple of 256 // A V# for the vertex records: stride 32, `records` records, format 32_32_32_32_FLOAT, identity swizzle. The // out-of-range mode is structured (an index checked against num_records), which is what the hardware does with an @@ -113,7 +113,7 @@ int main() { vertex(-1, 0, c2), vertex(-1, -1, c2), vertex(0, -1, c2)}; static_assert(sizeof(Vertex) == 32 && sizeof(vertices) == 288); - std::vector pixels(extent * extent); + std::vector pixels(target_extent * target_extent); { rt::d3d12::VulkanDeviceInfo info{}; info.get_instance_proc = d.instance_proc; @@ -178,13 +178,13 @@ int main() { EXPECT(SUCCEEDED(device->CreateCommittedResource(&upload_heap, D3D12_HEAP_FLAG_NONE, &upload_desc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&upload.p)))); - const auto readback_desc = buffer_desc(pitch * extent); + const auto readback_desc = buffer_desc(pitch * target_extent); EXPECT(SUCCEEDED(device->CreateCommittedResource(&readback_heap, D3D12_HEAP_FLAG_NONE, &readback_desc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_PPV_ARGS(&readback.p)))); D3D12_RESOURCE_DESC rt_desc{}; rt_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; - rt_desc.Width = rt_desc.Height = extent; + rt_desc.Width = rt_desc.Height = target_extent; rt_desc.DepthOrArraySize = 1; rt_desc.MipLevels = 1; rt_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; @@ -245,8 +245,8 @@ int main() { ID3D12DescriptorHeap* heaps[] = {srv_heap.p}; list->SetDescriptorHeaps(1, heaps); list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); - const D3D12_VIEWPORT viewport{0, 0, float(extent), float(extent), 0, 1}; - const D3D12_RECT scissor{0, 0, LONG(extent), LONG(extent)}; + const D3D12_VIEWPORT viewport{0, 0, float(target_extent), float(target_extent), 0, 1}; + const D3D12_RECT scissor{0, 0, LONG(target_extent), LONG(target_extent)}; list->RSSetViewports(1, &viewport); list->RSSetScissorRects(1, &scissor); list->OMSetRenderTargets(1, &rtv, FALSE, nullptr); @@ -271,7 +271,7 @@ int main() { D3D12_TEXTURE_COPY_LOCATION dst{}; dst.pResource = readback.p; dst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; - dst.PlacedFootprint = {0, {DXGI_FORMAT_R32G32B32A32_FLOAT, extent, extent, 1, pitch}}; + dst.PlacedFootprint = {0, {DXGI_FORMAT_R32G32B32A32_FLOAT, target_extent, target_extent, 1, pitch}}; D3D12_TEXTURE_COPY_LOCATION src{}; src.pResource = target.p; src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; @@ -302,10 +302,10 @@ int main() { const Pixel top_left = {0.125f, 1.0f, 0.75f, 1.0f}, bottom_right = {0.25f, 1.125f, 0.875f, 1.0f}; const Pixel bottom_left = {0.75f, 0.25f, 0.75f, 1.0f}; unsigned mismatches = 0, edge = 0, edge_triangle = 0, edge_clear = 0; - for (UINT row = 0; row < extent; ++row) { - for (UINT col = 0; col < extent; ++col) { - const bool top = row < extent / 2, left = col < extent / 2; - const Pixel& got = pixels[row * extent + col]; + for (UINT row = 0; row < target_extent; ++row) { + for (UINT col = 0; col < target_extent; ++col) { + const bool top = row < target_extent / 2, left = col < target_extent / 2; + const Pixel& got = pixels[row * target_extent + col]; const auto bits_equal = [&](const Pixel& want) { return std::memcmp(&got, &want, sizeof(Pixel)) == 0; }; const Pixel* want; if (top) { @@ -340,6 +340,6 @@ int main() { "pixels on the triangle's diagonal (%u its colour, %u the clear colour). User data from a descriptor " "table and root constants, V# vertex fetch from the arena, PS constants " "through the code base\n", - extent * extent - edge, extent * extent, edge, edge_triangle, edge_clear); + target_extent * target_extent - edge, target_extent * target_extent, edge, edge_triangle, edge_clear); return 0; } diff --git a/runtime/test/d3d12_typeless_rtv_test.cpp b/runtime/test/d3d12_typeless_rtv_test.cpp index cc6054f850..d8b8d841e9 100644 --- a/runtime/test/d3d12_typeless_rtv_test.cpp +++ b/runtime/test/d3d12_typeless_rtv_test.cpp @@ -213,19 +213,36 @@ bool clear_and_read(ID3D12Device* device, DXGI_FORMAT whole_format, DXGI_FORMAT return true; } bool rejects_view(ID3D12Device* device, DXGI_FORMAT resource_format, const D3D12_RENDER_TARGET_VIEW_DESC* view, - UINT16 mips = 1, UINT16 layers = 1) { + UINT16 mips = 1, UINT16 layers = 1, UINT samples = 1, + const DXGI_FORMAT* cast_list = nullptr, UINT32 cast_count = 0) { Ref resource; D3D12_HEAP_PROPERTIES heap_properties{D3D12_HEAP_TYPE_DEFAULT}; - D3D12_RESOURCE_DESC texture{}; - texture.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; - texture.Width = texture.Height = 4; - texture.DepthOrArraySize = layers; - texture.MipLevels = mips; - texture.Format = resource_format; - texture.SampleDesc.Count = 1; - texture.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; - CHECK(SUCCEEDED(device->CreateCommittedResource(&heap_properties, D3D12_HEAP_FLAG_NONE, &texture, - D3D12_RESOURCE_STATE_RENDER_TARGET, nullptr, IID_PPV_ARGS(&resource.p)))); + if (cast_count) { + Ref device10; + CHECK(SUCCEEDED(device->QueryInterface(IID_PPV_ARGS(&device10.p)))); + D3D12_RESOURCE_DESC1 tex1{}; + tex1.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + tex1.Width = tex1.Height = 4; + tex1.DepthOrArraySize = layers; + tex1.MipLevels = mips; + tex1.Format = resource_format; + tex1.SampleDesc.Count = samples; + tex1.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + CHECK(SUCCEEDED(device10->CreateCommittedResource3(&heap_properties, D3D12_HEAP_FLAG_NONE, &tex1, + D3D12_BARRIER_LAYOUT_RENDER_TARGET, nullptr, nullptr, cast_count, cast_list, + IID_PPV_ARGS(&resource.p)))); + } else { + D3D12_RESOURCE_DESC texture{}; + texture.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + texture.Width = texture.Height = 4; + texture.DepthOrArraySize = layers; + texture.MipLevels = mips; + texture.Format = resource_format; + texture.SampleDesc.Count = samples; + texture.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + CHECK(SUCCEEDED(device->CreateCommittedResource(&heap_properties, D3D12_HEAP_FLAG_NONE, &texture, + D3D12_RESOURCE_STATE_RENDER_TARGET, nullptr, IID_PPV_ARGS(&resource.p)))); + } Ref heap; const D3D12_DESCRIPTOR_HEAP_DESC desc{D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 1, D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0}; CHECK(SUCCEEDED(device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&heap.p)))); @@ -237,7 +254,7 @@ bool rejects_view(ID3D12Device* device, DXGI_FORMAT resource_format, const D3D12 const auto handle = heap->GetCPUDescriptorHandleForHeapStart(); // For the supported shape, overwrite a valid slot too: rejection must not leave its old RTV active. D3D12_RENDER_TARGET_VIEW_DESC seed{}; - seed.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + seed.ViewDimension = samples > 1 ? D3D12_RTV_DIMENSION_TEXTURE2DMS : D3D12_RTV_DIMENSION_TEXTURE2D; seed.Format = resource_format == DXGI_FORMAT_R8G8B8A8_TYPELESS ? DXGI_FORMAT_R8G8B8A8_UNORM : resource_format; device->CreateRenderTargetView(resource.p, &seed, handle); device->CreateRenderTargetView(resource.p, view, handle); @@ -246,6 +263,150 @@ bool rejects_view(ID3D12Device* device, DXGI_FORMAT resource_format, const D3D12 CHECK(list->Close() == E_INVALIDARG); // The invalid list is never sent to the GPU. return true; } + +bool clear_and_read_msaa(ID3D12Device* device, DXGI_FORMAT resource_format, + const DXGI_FORMAT* cast_list, UINT32 cast_count, + DXGI_FORMAT whole_format, DXGI_FORMAT rect_format, bool partial, + bool array, UINT first_layer, UINT layer_count, + std::vector& pixels) { + Ref queue; + Ref allocator; + Ref list; + Ref fence; + D3D12_COMMAND_QUEUE_DESC queue_desc{}; + CHECK(SUCCEEDED(device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&queue.p)))); + CHECK(SUCCEEDED(device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&allocator.p)))); + CHECK(SUCCEEDED(device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, allocator.p, nullptr, + IID_PPV_ARGS(&list.p)))); + CHECK(SUCCEEDED(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence.p)))); + + constexpr UINT width = 5, height = 3; + const UINT16 layers = array ? 4 : 1; + Ref msaa, resolved, readback; + D3D12_HEAP_PROPERTIES default_heap{D3D12_HEAP_TYPE_DEFAULT}; + if (cast_count) { + Ref device10; + CHECK(SUCCEEDED(device->QueryInterface(IID_PPV_ARGS(&device10.p)))); + D3D12_RESOURCE_DESC1 tex1{}; + tex1.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + tex1.Width = width; + tex1.Height = height; + tex1.DepthOrArraySize = layers; + tex1.MipLevels = 1; + tex1.Format = resource_format; + tex1.SampleDesc.Count = 4; + tex1.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + CHECK(SUCCEEDED(device10->CreateCommittedResource3(&default_heap, D3D12_HEAP_FLAG_NONE, &tex1, + D3D12_BARRIER_LAYOUT_RENDER_TARGET, nullptr, nullptr, cast_count, cast_list, + IID_PPV_ARGS(&msaa.p)))); + } else { + D3D12_RESOURCE_DESC tex{}; + tex.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + tex.Width = width; + tex.Height = height; + tex.DepthOrArraySize = layers; + tex.MipLevels = 1; + tex.Format = resource_format; + tex.SampleDesc.Count = 4; + tex.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + CHECK(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &tex, + D3D12_RESOURCE_STATE_RENDER_TARGET, nullptr, IID_PPV_ARGS(&msaa.p)))); + } + D3D12_RESOURCE_DESC resolved_desc{}; + resolved_desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + resolved_desc.Width = width; + resolved_desc.Height = height; + resolved_desc.DepthOrArraySize = layers; + resolved_desc.MipLevels = 1; + resolved_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + resolved_desc.SampleDesc.Count = 1; + CHECK(SUCCEEDED(device->CreateCommittedResource(&default_heap, D3D12_HEAP_FLAG_NONE, &resolved_desc, + D3D12_RESOURCE_STATE_RESOLVE_DEST, nullptr, IID_PPV_ARGS(&resolved.p)))); + + std::vector placed(layers); + UINT64 total = 0; + device->GetCopyableFootprints(&resolved_desc, 0, layers, 0, placed.data(), nullptr, nullptr, &total); + D3D12_RESOURCE_DESC buf{}; + buf.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; + buf.Width = total; + buf.Height = buf.SampleDesc.Count = 1; + buf.DepthOrArraySize = buf.MipLevels = 1; + buf.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; + D3D12_HEAP_PROPERTIES rb_heap{D3D12_HEAP_TYPE_READBACK}; + CHECK(SUCCEEDED(device->CreateCommittedResource(&rb_heap, D3D12_HEAP_FLAG_NONE, &buf, + D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_PPV_ARGS(&readback.p)))); + + Ref rtv_heap; + const D3D12_DESCRIPTOR_HEAP_DESC rtv_desc{D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 2, D3D12_DESCRIPTOR_HEAP_FLAG_NONE, 0}; + CHECK(SUCCEEDED(device->CreateDescriptorHeap(&rtv_desc, IID_PPV_ARGS(&rtv_heap.p)))); + const auto h0 = rtv_heap->GetCPUDescriptorHandleForHeapStart(); + const D3D12_CPU_DESCRIPTOR_HANDLE h1{h0.ptr + device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV)}; + + D3D12_RENDER_TARGET_VIEW_DESC view{}; + view.ViewDimension = array ? D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY : D3D12_RTV_DIMENSION_TEXTURE2DMS; + if (array) { + view.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + for (UINT layer = 0; layer < layers; ++layer) { + view.Texture2DMSArray = {layer, 1}; + device->CreateRenderTargetView(msaa.p, &view, h0); + const FLOAT seed[] = {FLOAT(layer + 1) * 0.1f, 0.2f, 0.3f, 1.0f}; + list->ClearRenderTargetView(h0, seed, 0, nullptr); + } + view.Texture2DMSArray = {first_layer, layer_count}; + } + view.Format = whole_format; + device->CreateRenderTargetView(msaa.p, &view, h0); + view.Format = rect_format; + device->CreateRenderTargetView(msaa.p, &view, h1); + const FLOAT full[4] = {0.25f, 0.5f, 0.75f, 0.25f}; + const FLOAT part[4] = {0.0031308f, 0.18f, 0.5f, 0.75f}; + list->ClearRenderTargetView(h0, full, 0, nullptr); + const D3D12_RECT rect{1, 1, 4, 3}; + if (partial) list->ClearRenderTargetView(h1, part, 1, &rect); + + D3D12_RESOURCE_BARRIER b{}; + b.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; + b.Transition = {msaa.p, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_RESOLVE_SOURCE}; + list->ResourceBarrier(1, &b); + for (UINT layer = 0; layer < layers; ++layer) + list->ResolveSubresource(resolved.p, layer, msaa.p, layer, DXGI_FORMAT_R8G8B8A8_UNORM); + b.Transition = {resolved.p, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, + D3D12_RESOURCE_STATE_RESOLVE_DEST, D3D12_RESOURCE_STATE_COPY_SOURCE}; + list->ResourceBarrier(1, &b); + D3D12_TEXTURE_COPY_LOCATION src{}, dst{}; + src.pResource = resolved.p; + src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + dst.pResource = readback.p; + dst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + for (UINT layer = 0; layer < layers; ++layer) { + src.SubresourceIndex = layer; + dst.PlacedFootprint = placed[layer]; + list->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr); + } + CHECK(SUCCEEDED(list->Close())); + ID3D12CommandList* lists[] = {list.p}; + queue->ExecuteCommandLists(1, lists); + CHECK(SUCCEEDED(queue->Signal(fence.p, 1))); + Event event; + CHECK(event.handle); + CHECK(SUCCEEDED(fence->SetEventOnCompletion(1, event.handle))); + CHECK(WaitForSingleObject(event.handle, 5000) == WAIT_OBJECT_0); + void* mapped = nullptr; + const D3D12_RANGE range{0, SIZE_T(total)}; + CHECK(SUCCEEDED(readback->Map(0, &range, &mapped)) && mapped); + pixels.clear(); + for (const auto& footprint : placed) { + const auto& f = footprint.Footprint; + for (UINT y = 0; y < f.Height; ++y) { + const auto* row = static_cast(mapped) + footprint.Offset + y * f.RowPitch; + pixels.insert(pixels.end(), row, row + f.Width * 4); + } + } + const D3D12_RANGE none{}; + readback->Unmap(0, &none); + return true; +} } // namespace int main() { @@ -452,8 +613,10 @@ int main() { regressions, vk.conditional_rendering ? "enabled" : "unavailable (predicated cases skipped)"); if (mismatches) return 1; const auto rejects = [&](DXGI_FORMAT resource_format, const D3D12_RENDER_TARGET_VIEW_DESC* view, - UINT16 mips = 1, UINT16 layers = 1) { - if (!rejects_view(ours.p, resource_format, view, mips, layers)) return false; + UINT16 mips = 1, UINT16 layers = 1, UINT samples = 1, + const DXGI_FORMAT* cast_list = nullptr, UINT32 cast_count = 0) { + if (!rejects_view(ours.p, resource_format, view, mips, layers, samples, cast_list, cast_count)) + return false; ++rejected; return true; }; @@ -501,6 +664,64 @@ int main() { invalid.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DARRAY; invalid.Texture2DArray = {1, 1, 2, 1}; if (!rejects(DXGI_FORMAT_R8G8B8A8_TYPELESS, &invalid, 3, 4)) return 1; + + // 4x MSAA typeless and castable RGBA8 RTVs (TEXTURE2DMS / TEXTURE2DMSARRAY) compared against WARP. + { + const DXGI_FORMAT srgb_list[] = {DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB}; + const auto compare_msaa = [&](DXGI_FORMAT resource_format, const DXGI_FORMAT* cast_list, + UINT32 cast_count, DXGI_FORMAT full, DXGI_FORMAT rect, bool partial, + bool array, UINT first_layer, UINT layer_count) { + std::vector actual, expected; + if (!clear_and_read_msaa(ours.p, resource_format, cast_list, cast_count, full, rect, partial, array, + first_layer, layer_count, actual) || + !clear_and_read_msaa(host.p, resource_format, cast_list, cast_count, full, rect, partial, array, + first_layer, layer_count, expected)) + return false; + ++comparisons; + if (actual.size() != expected.size()) return false; + for (std::size_t i = 0; i < actual.size(); ++i) { + if (std::abs(int(actual[i]) - int(expected[i])) > 1) { + std::fprintf(stderr, "MSAA RTV mismatch fmt %d full %d rect %d array %d byte %zu: ours %u WARP %u\n", + int(resource_format), int(full), int(rect), int(array), i, unsigned(actual[i]), + unsigned(expected[i])); + ++mismatches; + return false; + } + } + return true; + }; + if (!compare_msaa(DXGI_FORMAT_R8G8B8A8_TYPELESS, nullptr, 0, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, false, false, 0, 1)) + return 1; + if (!compare_msaa(DXGI_FORMAT_R8G8B8A8_TYPELESS, nullptr, 0, DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, true, false, 0, 1)) + return 1; + if (!compare_msaa(DXGI_FORMAT_R8G8B8A8_TYPELESS, nullptr, 0, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM, true, true, 1, 2)) + return 1; + Ref host10; + if (SUCCEEDED(host->QueryInterface(IID_PPV_ARGS(&host10.p)))) { + if (!compare_msaa(DXGI_FORMAT_R8G8B8A8_UNORM, srgb_list, 2, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, false, false, 0, 1)) + return 1; + if (!compare_msaa(DXGI_FORMAT_R8G8B8A8_UNORM, srgb_list, 2, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UNORM, true, true, 1, 2)) + return 1; + } + // MSAA vs 1x view-dimension mismatches, out-of-range MSAA array slices, and unlisted castable formats. + D3D12_RENDER_TARGET_VIEW_DESC bad_msaa{}; + bad_msaa.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; + bad_msaa.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + if (!rejects(DXGI_FORMAT_R8G8B8A8_TYPELESS, &bad_msaa, 1, 1, 4)) return 1; + bad_msaa.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DMS; + if (!rejects(DXGI_FORMAT_R8G8B8A8_TYPELESS, &bad_msaa, 1, 1, 1)) return 1; + bad_msaa.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY; + bad_msaa.Texture2DMSArray = {3, 2}; + if (!rejects(DXGI_FORMAT_R8G8B8A8_TYPELESS, &bad_msaa, 1, 4, 4)) return 1; + bad_msaa.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DMS; + bad_msaa.Format = DXGI_FORMAT_R8G8B8A8_UINT; + if (!rejects(DXGI_FORMAT_R8G8B8A8_UNORM, &bad_msaa, 1, 1, 4, srgb_list, 2)) return 1; + } } if (vk.validation_errors()) return 1; std::printf("typeless RTV: %u WARP readbacks matched, descriptor snapshots and format-cache order checked; %u unsupported/invalid views rejected\n", diff --git a/runtime/test/d3d12_vulkan_device_test.cpp b/runtime/test/d3d12_vulkan_device_test.cpp index a528202bc1..9d49740e00 100644 --- a/runtime/test/d3d12_vulkan_device_test.cpp +++ b/runtime/test/d3d12_vulkan_device_test.cpp @@ -2229,6 +2229,32 @@ HRESULT fence(ID3D12Device* device, D3D12_FENCE_FLAGS flags, REFIID riid = __uui return released(device->CreateFence(0, flags, riid, &out), &out); } +// A 64 KiB heap description for the CreateHeap/CreateHeap1 cases (D3D-238). +D3D12_HEAP_DESC heap_desc_of(UINT64 alignment, D3D12_HEAP_PROPERTIES properties = {D3D12_HEAP_TYPE_DEFAULT}, + D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE, UINT64 size = 64 * 1024) { + D3D12_HEAP_DESC desc{}; + desc.SizeInBytes = size; + desc.Properties = properties; + desc.Alignment = alignment; + desc.Flags = flags; + return desc; +} + +HRESULT heap_create(ID3D12Device* device, D3D12_HEAP_DESC desc) { + void* out = nullptr; + return released(device->CreateHeap(&desc, __uuidof(ID3D12Heap), &out), &out); +} + +// CreateHeap1 without a protected session; E_NOINTERFACE when the device has no ID3D12Device4. +HRESULT heap_create1(ID3D12Device* device, D3D12_HEAP_DESC desc) { + ID3D12Device4* device4 = nullptr; + if (FAILED(device->QueryInterface(IID_PPV_ARGS(&device4)))) return E_NOINTERFACE; + void* out = nullptr; + const HRESULT hr = device4->CreateHeap1(&desc, nullptr, __uuidof(ID3D12Heap), &out); + device4->Release(); + return released(hr, &out); +} + // Map on a fresh committed resource; `range` is the read range, or null. HRESULT map(ID3D12Device* device, D3D12_HEAP_PROPERTIES heap, D3D12_RESOURCE_DESC desc, D3D12_RESOURCE_STATES state, UINT subresource, const D3D12_RANGE* range, bool want_pointer = true) { @@ -2818,6 +2844,42 @@ int compare_invalid_arguments(ID3D12Device* ours) { return d->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &desc, D3D12_RESOURCE_STATE_COMMON, nullptr, __uuidof(ID3D12Resource), nullptr); }}, + // CreateHeap and CreateHeap1 (D3D-238): the four descriptions the host refused on an RX 5700 and WARP, the + // heap-property rules CreateCommittedResource shares. A refusal needs no arena; the valid neighbours do, so + // compare_heap_neighbours compares them on the standalone device. + {"heap: alignment 4096", [](ID3D12Device* d) { return heap_create(d, heap_desc_of(4096)); }}, + {"heap1: alignment 4096", [](ID3D12Device* d) { return heap_create1(d, heap_desc_of(4096)); }}, + {"heap: custom heap, unknown page property", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_CUSTOM, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_L0})); + }}, + {"heap1: custom heap, unknown page property", [](ID3D12Device* d) { + return heap_create1(d, heap_desc_of(0, {D3D12_HEAP_TYPE_CUSTOM, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_L0})); + }}, + {"heap: all three DENY flags", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT}, + D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | + D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES)); + }}, + {"heap1: all three DENY flags", [](ID3D12Device* d) { + return heap_create1(d, heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT}, + D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | + D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES)); + }}, + {"heap: type 0", [](ID3D12Device* d) { return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE(0)})); }}, + {"heap1: type 0", [](ID3D12Device* d) { return heap_create1(d, heap_desc_of(0, {D3D12_HEAP_TYPE(0)})); }}, + {"heap: custom heap, unknown pool", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_CUSTOM, D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE, + D3D12_MEMORY_POOL_UNKNOWN})); + }}, + {"heap: default heap with a CPU page property", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT, D3D12_CPU_PAGE_PROPERTY_WRITE_BACK})); + }}, + {"heap: default heap with a memory pool", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + D3D12_MEMORY_POOL_L0})); + }}, // CreateDescriptorHeap. A null description faults in the host runtime, so it is not compared. {"descriptor heap: null output", [](ID3D12Device* d) { const D3D12_DESCRIPTOR_HEAP_DESC desc{D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 4}; @@ -3053,6 +3115,59 @@ int compare_invalid_arguments(ID3D12Device* ours) { return mismatches; } +// D3D-238: the valid neighbours of the CreateHeap/CreateHeap1 refusals in compare_invalid_arguments, compared +// with the host on a device that has the GPU address arena (without it the layer answers every heap E_NOTIMPL). +int compare_heap_neighbours(ID3D12Device* ours) { + Ref host; + if (!create_host_device(host)) return -1; + struct Case { + const char* name; + InvalidCase call; + }; + static const Case cases[] = { + {"heap: alignment 0", [](ID3D12Device* d) { return heap_create(d, heap_desc_of(0)); }}, + {"heap: alignment 64 KiB", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT)); + }}, + {"heap: alignment 4 MiB", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT, + {D3D12_HEAP_TYPE_DEFAULT}, D3D12_HEAP_FLAG_NONE, + D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT)); + }}, + {"heap1: alignment 4 MiB", [](ID3D12Device* d) { + return heap_create1(d, heap_desc_of(D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT, + {D3D12_HEAP_TYPE_DEFAULT}, D3D12_HEAP_FLAG_NONE, + D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT)); + }}, + {"heap: size 1000", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT}, D3D12_HEAP_FLAG_NONE, 1000)); + }}, + {"heap: upload", [](ID3D12Device* d) { return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_UPLOAD})); }}, + {"heap: readback", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_READBACK})); + }}, + {"heap: custom write-combine L0", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_CUSTOM, D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE, + D3D12_MEMORY_POOL_L0})); + }}, + {"heap1: custom write-combine L0", [](ID3D12Device* d) { + return heap_create1(d, heap_desc_of(0, {D3D12_HEAP_TYPE_CUSTOM, D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE, + D3D12_MEMORY_POOL_L0})); + }}, + {"heap: ALLOW_ONLY_BUFFERS (two DENY flags)", [](ID3D12Device* d) { + return heap_create(d, heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT}, D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS)); + }}, + }; + int mismatches = 0; + for (const Case& c : cases) { + const HRESULT a = call_guarded(c.call, ours), b = call_guarded(c.call, host.p); + if (a == b) continue; + ++mismatches; + std::fprintf(stderr, "invalid arguments %s: ours 0x%08lx, host 0x%08lx\n", c.name, a, b); + } + return mismatches; +} + } // namespace int main() { @@ -3478,6 +3593,68 @@ int main() { std::printf("invalid arguments: no host D3D12 device to compare with, skipped\n"); EXPECT(argument_mismatches <= 0); + // D3D-236: CreateCommandQueue with D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME requires + // SeIncreaseBasePriorityPrivilege enabled in the token, matching the Windows D3D12 runtime. + { + const D3D12_COMMAND_QUEUE_DESC rt_desc{ + D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME, + D3D12_COMMAND_QUEUE_FLAG_NONE, 0}; + struct RestoreOverride { + ~RestoreOverride() { rt::d3d12::set_global_realtime_privilege_override_for_test(-1); } + } restore_override; + + rt::d3d12::set_global_realtime_privilege_override_for_test(0); + EXPECT(!rt::d3d12::has_global_realtime_privilege()); + Ref denied_q; + EXPECT(device->CreateCommandQueue(&rt_desc, IID_PPV_ARGS(&denied_q.p)) == DXGI_ERROR_ACCESS_DENIED); + EXPECT(!denied_q.p); + EXPECT(device->CreateCommandQueue(&rt_desc, __uuidof(ID3D12CommandQueue), nullptr) == + DXGI_ERROR_ACCESS_DENIED); + + rt::d3d12::set_global_realtime_privilege_override_for_test(1); + EXPECT(rt::d3d12::has_global_realtime_privilege()); + EXPECT(device->CreateCommandQueue(&rt_desc, __uuidof(ID3D12CommandQueue), nullptr) == E_UNEXPECTED); + Ref granted_q; + EXPECT(SUCCEEDED(device->CreateCommandQueue(&rt_desc, IID_PPV_ARGS(&granted_q.p))) && granted_q.p); + if (granted_q.p) { + EXPECT(granted_q->GetDesc().Priority == D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME); + } + granted_q.reset(); + rt::d3d12::set_global_realtime_privilege_override_for_test(-1); + + // When the process token holds SeIncreaseBasePriorityPrivilege (e.g. an elevated session), toggle the + // real token privilege and verify both states against the host D3D12 runtime. + HANDLE token = nullptr; + LUID luid{}; + if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token)) { + if (LookupPrivilegeValueW(nullptr, L"SeIncreaseBasePriorityPrivilege", &luid)) { + TOKEN_PRIVILEGES tp{}, prev{}; + DWORD prev_len = 0; + tp.PrivilegeCount = 1; + tp.Privileges[0].Luid = luid; + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + if (AdjustTokenPrivileges(token, FALSE, &tp, sizeof(prev), &prev, &prev_len) && + GetLastError() == ERROR_SUCCESS) { + EXPECT(rt::d3d12::has_global_realtime_privilege()); + EXPECT(command_queue(device.p, rt_desc) == S_OK); + Ref host; + if (create_host_device(host)) { + EXPECT(command_queue(host.p, rt_desc) == S_OK); + } + tp.Privileges[0].Attributes = 0; + if (AdjustTokenPrivileges(token, FALSE, &tp, 0, nullptr, nullptr) && + GetLastError() == ERROR_SUCCESS) { + EXPECT(!rt::d3d12::has_global_realtime_privilege()); + EXPECT(command_queue(device.p, rt_desc) == DXGI_ERROR_ACCESS_DENIED); + if (host.p) EXPECT(command_queue(host.p, rt_desc) == DXGI_ERROR_ACCESS_DENIED); + } + AdjustTokenPrivileges(token, FALSE, &prev, 0, nullptr, nullptr); + } + } + CloseHandle(token); + } + } + const int depth_quality_mismatches = compare_depth_multisample_quality_levels(device.p, depth_sample_counts); if (depth_quality_mismatches < 0) std::printf("Depth/stencil MSAA quality queries: no host D3D12 device to compare with, skipped\n"); @@ -4856,6 +5033,52 @@ int main() { upload_heap_desc.Properties.Type = D3D12_HEAP_TYPE_UPLOAD; EXPECT(SUCCEEDED(standalone->CreateHeap(&upload_heap_desc, IID_PPV_ARGS(&upload_placed_heap.p)))); + // D3D-238: heap descriptions the host refuses (RX 5700 and WARP), from CreateHeap and CreateHeap1 alike, and + // their valid neighbours. compare_invalid_arguments and compare_heap_neighbours check them against a host. + { + const D3D12_HEAP_FLAGS deny_all = D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | + D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES; + const D3D12_HEAP_DESC refused_heaps[] = { + heap_desc_of(4096), + heap_desc_of(0, {D3D12_HEAP_TYPE_CUSTOM, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, D3D12_MEMORY_POOL_L0}), + heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT}, deny_all), + heap_desc_of(0, {D3D12_HEAP_TYPE(0)}), + heap_desc_of(0, {D3D12_HEAP_TYPE_CUSTOM, D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE, + D3D12_MEMORY_POOL_UNKNOWN}), + heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT, D3D12_CPU_PAGE_PROPERTY_WRITE_BACK}), + heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT}, D3D12_HEAP_FLAG_NONE, 0), + }; + for (const D3D12_HEAP_DESC& hd : refused_heaps) { + EXPECT(heap_create(standalone.p, hd) == E_INVALIDARG); + EXPECT(heap_create1(standalone.p, hd) == E_INVALIDARG); + } + const D3D12_HEAP_DESC accepted_heaps[] = { + heap_desc_of(0), + heap_desc_of(D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT), + heap_desc_of(D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT, {D3D12_HEAP_TYPE_DEFAULT}, + D3D12_HEAP_FLAG_NONE, D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT), + heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT}, D3D12_HEAP_FLAG_NONE, 1000), + heap_desc_of(0, {D3D12_HEAP_TYPE_UPLOAD}), + heap_desc_of(0, {D3D12_HEAP_TYPE_READBACK}), + heap_desc_of(0, {D3D12_HEAP_TYPE_CUSTOM, D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE, D3D12_MEMORY_POOL_L0}), + heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT}, D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS), + heap_desc_of(0, {D3D12_HEAP_TYPE_DEFAULT}, + D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES), + }; + for (const D3D12_HEAP_DESC& hd : accepted_heaps) { + EXPECT(heap_create(standalone.p, hd) == S_OK); + EXPECT(heap_create1(standalone.p, hd) == S_OK); + } + Ref device4; + Ref unused; + EXPECT(SUCCEEDED(standalone->QueryInterface(IID_PPV_ARGS(&device4.p)))); + EXPECT(device4->CreateHeap1(&placed_heap_desc, nullptr, IID_PPV_ARGS(&unused.p)) == S_OK && unused.p); + const int heap_mismatches = compare_heap_neighbours(standalone.p); + if (heap_mismatches < 0) + std::printf("CreateHeap valid neighbours: no host D3D12 device to compare with, skipped\n"); + EXPECT(heap_mismatches <= 0); + } + auto tiled_2d = [&](UINT w, UINT h, DXGI_FORMAT fmt, UINT16 mips, D3D12_RESOURCE_FLAGS flags, UINT64 align = 0) { D3D12_RESOURCE_DESC d = texture_desc(w, h, fmt, flags, mips); @@ -5133,6 +5356,7 @@ int main() { {msaa_heap.p, msaa_heap_desc.SizeInBytes - 65536, msaa_unk_small_desc}, {upload_placed_heap.p, 0, msaa_unk_small_desc}, {deny_rt_heap.p, 0, msaa_unk_small_desc}, + {deny_rt_heap.p, 0, tiled_rt_desc}, {msaa_heap.p, 0, msaa_desc(256, 256, 4, 0, D3D12_TEXTURE_LAYOUT_UNKNOWN, D3D12_RESOURCE_FLAG_NONE)}, {msaa_heap.p, 0, @@ -5149,6 +5373,18 @@ int main() { nullptr, IID_PPV_ARGS(&fail.p)) == E_INVALIDARG); EXPECT(!fail.p); } + D3D12_HEAP_DESC only_rt_desc = tiled_heap_desc; + only_rt_desc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES; + Ref only_rt_heap; + EXPECT(SUCCEEDED(standalone->CreateHeap(&only_rt_desc, IID_PPV_ARGS(&only_rt_heap.p)))); + for (const D3D12_RESOURCE_DESC& bad_only_rt : + {texture_desc(64, 64, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_FLAG_NONE, 1), + buffer_desc(4096)}) { + Ref fail; + EXPECT(standalone->CreatePlacedResource(only_rt_heap.p, 0, &bad_only_rt, D3D12_RESOURCE_STATE_COMMON, + nullptr, IID_PPV_ARGS(&fail.p)) == E_INVALIDARG); + EXPECT(!fail.p); + } } // Clear placed 4x MSAA RTVs (UNKNOWN + tiled) and DSV, resolve, and read back to verify GPU execution. diff --git a/runtime/test/d3d12_xdxr_rt_test.cpp b/runtime/test/d3d12_xdxr_rt_test.cpp index 0b4d3da526..51f357fc1d 100644 --- a/runtime/test/d3d12_xdxr_rt_test.cpp +++ b/runtime/test/d3d12_xdxr_rt_test.cpp @@ -3,7 +3,9 @@ // unindexed triangle soup, and an R16-indexed grid with a 16-byte stride and a 3x4 transform) and a TLAS of three // instances are built through the D3D12 API, sized by GetRaytracingAccelerationStructurePrebuildInfo, copied to // readback buffers and written to ; the BLAS is then updated in place (PERFORM_UPDATE) after its soup moves, -// and written again as d3d12_blas_update as .bin + .json at their console GPU virtual addresses. +// and written again as d3d12_blas_update; then its postbuild COMPACTED_SIZE and a TLAS rebuild's CURRENT_SIZE are +// checked against the prebuild sizes, and the BLAS is compacted (CopyRaytracingAccelerationStructure COMPACT) into a +// buffer of exactly that size, written as d3d12_blas_compacted as .bin + .json at their console GPU virtual addresses. // `python -I tools/xdxr_bvh.py check-build ` validates them and traces rays against brute force (ctest: // d3d12_xdxr_rt + d3d12_xdxr_rt_check). Exit 77 without a Vulkan device, or with LEONIDA_RT_AS=khr. No game files. #include "../shims/d3d12_com.h" @@ -336,6 +338,71 @@ int main(int argc, char** argv) { "{\"kind\": \"blas\", \"address\": " + std::to_string(blas->GetGPUVirtualAddress()) + ", \"triangles\": " + triangles_json(moved) + "}\n")) return fail("BLAS readback after the update"); + + // ---- postbuild info and compaction: EmitRaytracingAccelerationStructurePostbuildInfo for both structures, a + // TLAS rebuild with a CURRENT_SIZE postbuild desc, then COMPACT the BLAS into a buffer of exactly its size ---- + auto submit = [&](UINT64 value) { + if (FAILED(list->Close())) return false; + queue->ExecuteCommandLists(1, lists); + if (FAILED(queue->Signal(fence.p, value))) return false; + HANDLE e = CreateEventW(nullptr, FALSE, FALSE, nullptr); + const bool ok = e && SUCCEEDED(fence->SetEventOnCompletion(value, e)) && + WaitForSingleObject(e, 10000) == WAIT_OBJECT_0; + if (e) CloseHandle(e); + return ok; + }; + Ref info, info_rb; + if (FAILED(hr = buffer(device.p, D3D12_HEAP_TYPE_DEFAULT, 24, D3D12_RESOURCE_STATE_UNORDERED_ACCESS, uav, info.put())) || + FAILED(hr = buffer(device.p, D3D12_HEAP_TYPE_READBACK, 24, D3D12_RESOURCE_STATE_COPY_DEST, + D3D12_RESOURCE_FLAG_NONE, info_rb.put()))) + return fail("postbuild buffers", hr); + if (FAILED(allocator->Reset()) || FAILED(list->Reset(allocator.p, nullptr))) return fail("Reset for postbuild"); + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC compacted_desc{ + info->GetGPUVirtualAddress(), D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE}; + const D3D12_GPU_VIRTUAL_ADDRESS both[2] = {blas->GetGPUVirtualAddress(), tlas->GetGPUVirtualAddress()}; + list->EmitRaytracingAccelerationStructurePostbuildInfo(&compacted_desc, 2, both); + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC current_desc{ + info->GetGPUVirtualAddress() + 16, D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_CURRENT_SIZE}; + build = {}; + build.Inputs = tlas_inputs; + build.DestAccelerationStructureData = tlas->GetGPUVirtualAddress(); + build.ScratchAccelerationStructureData = scratch->GetGPUVirtualAddress(); + list->BuildRaytracingAccelerationStructure(&build, 1, ¤t_desc); + list->ResourceBarrier(1, &barrier); + list->CopyBufferRegion(info_rb.p, 0, info.p, 0, 24); + if (!submit(3)) return fail("postbuild submission"); + UINT64 sizes[3] = {}; + { + void* p = nullptr; + if (FAILED(info_rb->Map(0, nullptr, &p))) return fail("Map postbuild"); + std::memcpy(sizes, p, sizeof sizes); + info_rb->Unmap(0, nullptr); + } + // the builds are exactly their prebuild size, so the compacted size is that size + if (sizes[0] != blas_info.ResultDataMaxSizeInBytes || sizes[1] != tlas_info.ResultDataMaxSizeInBytes || + sizes[2] != tlas_info.ResultDataMaxSizeInBytes) { + std::fprintf(stderr, "postbuild sizes %llu %llu %llu, prebuild %llu %llu\n", + static_cast(sizes[0]), static_cast(sizes[1]), + static_cast(sizes[2]), + static_cast(blas_info.ResultDataMaxSizeInBytes), + static_cast(tlas_info.ResultDataMaxSizeInBytes)); + return fail("postbuild sizes"); + } + Ref compacted, compacted_rb; + if (FAILED(hr = buffer(device.p, D3D12_HEAP_TYPE_DEFAULT, sizes[0], as_state, uav, compacted.put())) || + FAILED(hr = buffer(device.p, D3D12_HEAP_TYPE_READBACK, sizes[0], D3D12_RESOURCE_STATE_COPY_DEST, + D3D12_RESOURCE_FLAG_NONE, compacted_rb.put()))) + return fail("compacted buffers", hr); + if (FAILED(allocator->Reset()) || FAILED(list->Reset(allocator.p, nullptr))) return fail("Reset for compaction"); + list->CopyRaytracingAccelerationStructure(compacted->GetGPUVirtualAddress(), blas->GetGPUVirtualAddress(), + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_COMPACT); + list->ResourceBarrier(1, &barrier); + list->CopyBufferRegion(compacted_rb.p, 0, compacted.p, 0, sizes[0]); + if (!submit(4)) return fail("compaction submission"); + if (!dump(compacted_rb.p, sizes[0], "d3d12_blas_compacted", + "{\"kind\": \"blas\", \"address\": " + std::to_string(compacted->GetGPUVirtualAddress()) + + ", \"triangles\": " + triangles_json(moved) + "}\n")) + return fail("compacted BLAS readback"); std::printf("d3d12_xdxr_rt: BLAS %llu bytes (prebuild %llu), TLAS (prebuild %llu), written to %s\n", static_cast(blas_info.ResultDataMaxSizeInBytes), static_cast(blas_info.ResultDataMaxSizeInBytes), diff --git a/runtime/test/descriptor_table_test.cpp b/runtime/test/descriptor_table_test.cpp index a24a9c6e2b..26fb390836 100644 --- a/runtime/test/descriptor_table_test.cpp +++ b/runtime/test/descriptor_table_test.cpp @@ -233,7 +233,7 @@ int test_clear_resets_table() { return 0; } -int test_erase_and_cluster_compact() { +int test_erase_and_reinsert() { DescriptorTable table(16); const std::uint32_t k1[8] = {1, 10, 100, 1000, 2, 20, 200, 2000}; @@ -310,12 +310,12 @@ int test_change_tracking() { EXPECT(!changes.all && changes.slots.size() == 1 && changes.slots.front() == slot); EXPECT(table.read_slot(slot, read) && read[8] == 43); - // Erasing marks the slot it was in and the ones the cluster compaction moved. + // Erasing marks only the slot it was in: no other entry moves. EXPECT(table.insert(k2, 7)); table.take_changes(); EXPECT(table.erase(k1)); changes = table.take_changes(); - EXPECT(!changes.all && !changes.slots.empty() && changes.slots.front() == slot); + EXPECT(!changes.all && changes.slots.size() == 1 && changes.slots.front() == slot); // Growth changes the mask, so everything re-uploads. const std::size_t before = table.capacity(); @@ -366,6 +366,48 @@ int test_relocation_marks_both_slots() { return 0; } +// Shaders keep probing the GPU copy of the table while an erase is uploaded without waiting for idle +// (BindlessSet::flush_needs_idle), so an erase must leave every other key's slot exactly as it was. +int test_erase_moves_no_other_entry() { + DescriptorTable table(64); + const std::uint32_t slots = std::uint32_t(table.capacity()); + // Five keys with one home: they fill five consecutive slots, the cluster the old erase compacted. + std::array keys{}; + for (std::uint32_t i = 0; i < keys.size(); ++i) { + auto& key = keys[i]; + key[0] = i + 1; + while ((hash_descriptor_key(key) & (slots - 1)) != slots - 2) ++key[7]; // the cluster wraps the end + EXPECT(table.insert_or_update(key.data(), 200 + i) == DescriptorTable::InsertResult::added); + } + table.take_changes(); + const auto before = table.build_gpu_buffer(); + + EXPECT(table.erase(keys[1].data())); + const DescriptorTable::Changes changes = table.take_changes(); + EXPECT(!changes.all && changes.slots.size() == 1); + const std::uint32_t hole = changes.slots.front(); + const auto after = table.build_gpu_buffer(); + for (std::uint32_t s = 0; s < slots; ++s) { + const bool same = std::memcmp(&before[1 + s * 10], &after[1 + s * 10], 10 * sizeof(std::uint32_t)) == 0; + EXPECT(same == (s != hole)); + } + for (std::uint32_t w = 0; w < 10; ++w) EXPECT(after[1 + hole * 10 + w] == 0); // an empty slot: a miss + for (std::uint32_t i = 0; i < keys.size(); ++i) EXPECT(table.lookup(keys[i]) == (i == 1 ? 0u : 200 + i)); + + // Keys past the hole are still found after more erases, and a new key of the same home reuses the hole. + EXPECT(table.erase(keys[0].data())); + EXPECT(table.lookup(keys[4]) == 204 && table.lookup(keys[3]) == 203); + DescriptorKey extra = keys[0]; + extra[0] = 100; + while ((hash_descriptor_key(extra) & (slots - 1)) != slots - 2) ++extra[7]; + table.take_changes(); + EXPECT(table.insert_or_update(extra.data(), 300) == DescriptorTable::InsertResult::added); + const DescriptorTable::Changes reuse = table.take_changes(); + EXPECT(reuse.slots.size() == 1 && reuse.slots.front() == slots - 2); // the first hole of the probe window + EXPECT(table.lookup(extra) == 300 && table.size() == 4); + return 0; +} + int main() { EXPECT(test_fnv1a_hash_matches_contract() == 0); EXPECT(test_ssharp_key_padding() == 0); @@ -376,9 +418,10 @@ int main() { EXPECT(test_gpu_buffer_serialization() == 0); EXPECT(test_change_tracking() == 0); EXPECT(test_relocation_marks_both_slots() == 0); + EXPECT(test_erase_moves_no_other_entry() == 0); EXPECT(test_multithreaded_insert_and_lookup() == 0); EXPECT(test_clear_resets_table() == 0); - EXPECT(test_erase_and_cluster_compact() == 0); + EXPECT(test_erase_and_reinsert() == 0); std::printf("descriptor_table_test: all tests passed (0 failures)\n"); return 0; diff --git a/runtime/test/dxgi_swapchain_test.cpp b/runtime/test/dxgi_swapchain_test.cpp index c427076409..c22397d901 100644 --- a/runtime/test/dxgi_swapchain_test.cpp +++ b/runtime/test/dxgi_swapchain_test.cpp @@ -458,6 +458,9 @@ int main() { // Frame 2: ResizeBuffers to explicit 37x19 on the unchanged 128x128 HWND, clear to green, read back all 703 pixels, Present. if (FAILED(sc->ResizeBuffers(2, 37, 19, DXGI_FORMAT_UNKNOWN, 0))) return fail("ResizeBuffers"); + DXGI_SWAP_CHAIN_DESC1 preserved_format{}; + if (FAILED(sc->GetDesc1(&preserved_format)) || preserved_format.Format != scd.Format) + return fail("ResizeBuffers with DXGI_FORMAT_UNKNOWN changed the format"); const float green[4] = {0.0f, 1.0f, 0.0f, 1.0f}; if (run_clear_readback_present(37, 19, green, 0, 255, 0) != 0) return 1; @@ -618,9 +621,28 @@ int main() { return fail("GetRotation(nullptr) should return E_INVALIDARG"); } - // Unsupported swapchain format must fail explicitly instead of silently downgrading to BGRA8. - if (sc->ResizeBuffers(2, 37, 19, DXGI_FORMAT_R32_UINT, 0) != DXGI_ERROR_UNSUPPORTED) - return fail("ResizeBuffers should reject unsupported format DXGI_FORMAT_R32_UINT"); + constexpr DXGI_FORMAT invalid_formats[] = { + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R32_UINT, + }; + { + DXGI_SWAP_CHAIN_DESC1 before{}, after{}; + if (FAILED(sc->GetDesc1(&before))) return fail("GetDesc1 before invalid formats"); + const UINT node_masks[2] = {1, 1}; + IUnknown* const present_queues[2] = {queue, queue}; + for (DXGI_FORMAT format : invalid_formats) { + if (sc->ResizeBuffers(2, 64, 64, format, 0) != E_INVALIDARG || + sc->ResizeBuffers1(2, 64, 64, format, 0, node_masks, present_queues) != E_INVALIDARG) + return fail("ResizeBuffers and ResizeBuffers1 should reject invalid flip-model formats"); + } + if (FAILED(sc->GetDesc1(&after)) || after.Format != before.Format || after.BufferCount != before.BufferCount || + after.Width != before.Width || after.Height != before.Height) + return fail("Invalid format changed the existing swapchain"); + ID3D12Resource* buffer = nullptr; + if (FAILED(sc->GetBuffer(sc->GetCurrentBackBufferIndex(), IID_PPV_ARGS(&buffer))) || !buffer) + return fail("GetBuffer after invalid swapchain formats"); + buffer->Release(); + } // Measured on host DXGI (RTX 5070 and WARP): DXGI_PRESENT_TEST returns S_OK without presenting, so the back // buffer index and last present count stay; a sync interval above 4 is DXGI_ERROR_INVALID_CALL and presents nothing. @@ -798,6 +820,21 @@ int main() { HWND hwnd2 = create_test_window(200, 150); if (!hwnd2) return fail("CreateWindowExW (second)"); GetClientRect(hwnd2, &cr); + const auto rejects_creation_format = [&](DXGI_FORMAT format) { + DXGI_SWAP_CHAIN_DESC1 invalid = scd; + invalid.Format = format; + IDXGISwapChain1* rejected = nullptr; + const HRESULT hr = factory->CreateSwapChainForHwnd(queue, hwnd2, &invalid, nullptr, nullptr, &rejected); + if (rejected) { + rejected->Release(); + return false; + } + return hr == DXGI_ERROR_INVALID_CALL; + }; + if (!rejects_creation_format(DXGI_FORMAT_UNKNOWN)) + return fail("CreateSwapChainForHwnd accepted DXGI_FORMAT_UNKNOWN"); + for (DXGI_FORMAT format : invalid_formats) + if (!rejects_creation_format(format)) return fail("CreateSwapChainForHwnd invalid flip-model format"); DXGI_SWAP_CHAIN_DESC1 zd = scd; zd.Width = 0; zd.Height = 0; diff --git a/runtime/test/fixtures/tiny_gdk_load.cpp b/runtime/test/fixtures/tiny_gdk_load.cpp index 780b10edb7..291d3a5d71 100644 --- a/runtime/test/fixtures/tiny_gdk_load.cpp +++ b/runtime/test/fixtures/tiny_gdk_load.cpp @@ -51,10 +51,27 @@ int main() { HRESULT hr = init(0, 0, 0x02, &options); if (hr != S_OK) return fail("InitializeApiImplEx2", static_cast(hr)); - // XThreadingImpl, the first class XCurl.dll references (docs/runtime_imports.md); not provided offline yet. + // XThreadingImpl, the first class XCurl.dll references (docs/runtime_imports.md), used as its thunks do: the + // class id as both ids, a slot with `this` first, then Release (slot 2). Slot 12 is XTaskQueueCreate, 17 + // XTaskQueueCloseHandle. const GUID threading = {0x073b7dcb, 0x1fcf, 0x4030, {0x94, 0xbe, 0xe3, 0xc9, 0xeb, 0x62, 0x34, 0x28}}; + void* obj = nullptr; + hr = query(&threading, threading, &obj); + if (hr != S_OK || !obj) return fail("QueryApiImpl hands out XThreadingImpl", static_cast(hr)); + void* const* vtable = *static_cast(obj); + using Create = HRESULT(STDMETHODCALLTYPE*)(void*, UINT32, UINT32, void**); + using Close = void(STDMETHODCALLTYPE*)(void*, void*); + using Release = ULONG(STDMETHODCALLTYPE*)(void*); + void* queue = nullptr; + hr = reinterpret_cast(vtable[12])(obj, 0, 0, &queue); // XTaskQueueDispatchMode::Manual twice + if (hr != S_OK || !queue) return fail("XThreadingImpl slot 12 (XTaskQueueCreate)", static_cast(hr)); + reinterpret_cast(vtable[17])(obj, queue); + reinterpret_cast(vtable[2])(obj); + + // A class not served yet (XNetworkingImpl) is refused, with the out pointer cleared. + const GUID networking = {0x37e56907, 0x2f10, 0x41e8, {0xb7, 0x2f, 0x36, 0xed, 0xb1, 0x85, 0x33, 0x1a}}; void* out = reinterpret_cast(1); - hr = query(&threading, threading, &out); + hr = query(&networking, networking, &out); if (hr != static_cast(0x80070032) || out != nullptr) return fail("QueryApiImpl refuses an unprovided class and clears its out pointer", static_cast(hr)); hr = uninit(); diff --git a/runtime/test/shaders/build.py b/runtime/test/shaders/build.py index c9796f244d..7ec6608d61 100644 --- a/runtime/test/shaders/build.py +++ b/runtime/test/shaders/build.py @@ -20,6 +20,8 @@ VK_KHR_shader_fma; the test programs enable it when the device has it, else they exit 77) or --fma glsl. With LEONIDA_BARY_FALLBACK=1, pixel shaders that read raw barycentrics are translated with --bary-fallback, and each gets a pass-through geometry shader, .bary_gs.spv, that check.py draws it with (tools/bary_fallback_gs.py). +Under that or LEONIDA_F16_INTERP_FALLBACK=1, ps_ij_computed isn't built: its computed I/J pair needs PerVertexKHR +inputs, and check.py reports it as SKIP. """ import json import os @@ -38,6 +40,8 @@ MC = mc_command.mc_command() RSRC2, GROUP = 0x8088, (64, 1, 1) +# Not built under LEONIDA_BARY_FALLBACK=1 or LEONIDA_F16_INTERP_FALLBACK=1 (see main). +NEEDS_PER_VERTEX_INPUTS = ("ps_ij_computed",) sys.path.insert(0, HERE) # this script is also run with python -I from compute_fixture import compute_header # noqa: E402 @@ -58,8 +62,8 @@ def asm_mattr(path): CLIP_CASES = {"vs_clip": 1, "vs_clip_param4": 4, "vs_clip_undeclared": 1} -def asm_fssm(path): - """The synthetic FSSM program a vs_/ps_ shader's header asks for, or None.""" +def asm_fssm_fields(path): + """(offset, words) of the "fssm-at" and "fssm-data" header comments, (None, []) without them.""" at, words = None, [] for ln in Path(path).read_text(encoding="utf-8").splitlines(): s = ln.strip() @@ -71,11 +75,27 @@ def asm_fssm(path): m = re.match(r";\s*fssm-data:\s*(.*)", s) if m: words += [int(w, 0) for w in m.group(1).split()] + return at, words + + +def asm_fssm(path): + """The synthetic FSSM program a vs_/ps_ shader's header asks for, or None.""" + at, words = asm_fssm_fields(path) if at is None or not words or at < 4 or at % 4: return None return b"FSSM" + bytes(at - 4) + b"".join(struct.pack("= f32(zx2 + zy2): + break + xy = f32(zx * zy) + zx, zy = f32(f32(zx2 - zy2) + cx), f32(f32(xy + xy) + cy) + n += 1 + counts.append(n) + return counts + + +def mandelbrot_problem(px): + """ps_mandelbrot: channel 3 is the lane's iteration count. A lane that leaves EXEC too early or late, or a loop + that ends on the wrong branch, changes counts; the colour channels are only for looking at the frame.""" + w = int(len(px) ** 0.5) + if w * w != len(px): + return f"{len(px)} pixels is not a square frame" + want = mandelbrot_counts(w) + wrong = [(i, p[3], e) for i, (p, e) in enumerate(zip(px, want)) if p[3] != e] + if not wrong: + return "" + i, got, e = wrong[0] + return f"{len(wrong)} of {len(px)} iteration counts differ, e.g. pixel ({i % w}, {i // w}) {got} instead of {e}" + + def pixel_test(tools, spirv, name): path = os.path.join(spirv, name + ".spv") if name == "ps_ij_computed" and (BARY_FALLBACK or F16_HALVES): @@ -1170,6 +1232,8 @@ def pixel_test(tools, spirv, name): c = collections.Counter((a, b) for a, b, _, _ in px) fine = c[(8, 1)] and c[(8, 0)] and c[(7, 0)] and set(c) <= {(8, 1), (8, 0), (7, 0)} return "" if fine else f"(s5, bit) counts {dict(c)}" + if name == "ps_mandelbrot": + return mandelbrot_problem(px) return "no check written for this shader" @@ -1223,6 +1287,7 @@ def main(): results.append(("cs_fmt_1010102", fmt_1010102_test(tools, spirv))) results.append(("cs_fmt_sint32", fmt_sint32_test(tools, spirv))) results.append(("cs_fmt_xy_xyz", fmt_xy_xyz_test(tools, spirv))) + results.append(("cs_tbuffer_store", tbuffer_store_test(tools, spirv))) for name, groups, want in GLOBAL_OFFSET: results.append((name, compute_test(tools, spirv, name, groups, "dump", expected_words=want))) results.append(("cs_user_sgprs", compute_test(tools, spirv, "cs_user_sgprs", "1", "dump", diff --git a/runtime/test/shaders/cs_buf_counter.asm b/runtime/test/shaders/cs_buf_counter.asm new file mode 100644 index 0000000000..9bbe84beab --- /dev/null +++ b/runtime/test/shaders/cs_buf_counter.asm @@ -0,0 +1,40 @@ +; group: 64,1,1 +; rsrc2: 0x808c +; fssm-at: 0x150 +; fssm-data: 0x4e554f43 0x3d524554 +; UAV counters (D3D12 CreateUnorderedAccessView with pCounterResource): AppendStructuredBuffer and +; ConsumeStructuredBuffer as hand-written RDNA2, the way docs/d3d12_vulkan.md section 3.4 describes the contract: +; the counter is a second, raw 4-byte V# in the upper 16 bytes of the view's descriptor slot, and append and consume +; are buffer atomics on it. Run: d3d12_buffer_uav_test (a compute PSO found by the SHA-256 of its synthetic FSSM header). +; The branch skips the 10 dwords of the append path (checked with llvm-mc -show-encoding). +; User data, from the root signature: [0] four 32-bit constants, [1] a descriptor table of six UAVs, TGID_X in s6: +; s0 = mode: 0 append, 1 consume s[4:5] = console VA of the table's first slot (32 bytes a slot) +; slot 0 (+0x00): V#, structured buffer, stride 8, 256 records; the counter V# in +0x10 (raw, 4 bytes) +; slot 1 (+0x20): V#, raw buffer, 128 records of 8 bytes (written by consume) +; g = 64 * group + lane +; append: i = counter++ (buffer_atomic_add, glc returns the old value); record i = { g, g * 3 + 1 } +; consume: i = --counter (the old value of buffer_atomic_sub, minus one); out[g] = record i +s_load_dwordx8 s[8:15], s[4:5], 0x0 +s_load_dwordx4 s[16:19], s[4:5], 0x20 +s_lshl_b32 s7, s6, 6 +s_waitcnt lgkmcnt(0) +v_add_nc_u32_e32 v1, s7, v0 +v_mov_b32_e32 v2, 1 +s_cmp_eq_u32 s0, 0 +s_cbranch_scc0 10 +buffer_atomic_add v2, off, s[12:15], 0 glc +s_waitcnt vmcnt(0) +v_mul_lo_u32 v6, v1, 3 +v_add_nc_u32_e32 v6, 1, v6 +v_mov_b32_e32 v5, v1 +buffer_store_dwordx2 v[5:6], v2, s[8:11], 0 idxen +s_endpgm +; consume: +buffer_atomic_sub v2, off, s[12:15], 0 glc +s_waitcnt vmcnt(0) +v_add_nc_u32_e32 v2, -1, v2 +buffer_load_dwordx2 v[5:6], v2, s[8:11], 0 idxen +s_waitcnt vmcnt(0) +v_lshlrev_b32_e32 v7, 3, v1 +buffer_store_dwordx2 v[5:6], v7, s[16:19], 0 offen +s_endpgm diff --git a/runtime/test/shaders/cs_buf_typed.asm b/runtime/test/shaders/cs_buf_typed.asm new file mode 100644 index 0000000000..b101343e8f --- /dev/null +++ b/runtime/test/shaders/cs_buf_typed.asm @@ -0,0 +1,63 @@ +; group: 64,1,1 +; rsrc2: 0x808c +; fssm-at: 0x150 +; fssm-data: 0x44505954 0x3d424655 +; Typed buffer UAVs (D3D12 CreateUnorderedAccessView with a Format on a BUFFER view): hand-written RDNA2 the way a +; translated `RWBuffer` shader reads and writes them. Run: d3d12_buffer_uav_test (a compute PSO found by the +; SHA-256 of its synthetic FSSM header, as for the other cs_ shaders). +; User data, from the root signature: [0] four 32-bit constants, [1] a descriptor table of six UAVs. RSRC2 0x808c = +; six user SGPRs and TGID_X, so the group index is s6: +; s0 = seed s1 = multiplier s[4:5] = console VA of the table's first slot (a slot is 32 bytes, a V# in its first 16) +; slot 0 (+0x00): V#, typed R32_UINT, 240 elements of a 256-element buffer (written, then atomically added to) +; slot 1 (+0x20): V#, typed R16G16B16A16_FLOAT, 256 elements (written) +; slot 2 (+0x40): V#, typed R8G8B8A8_UNORM, 256 elements from element 16 of the buffer (written) +; slot 3 (+0x60): V#, typed R32G32B32A32_UINT, 256 elements (written) +; slot 4 (+0x80): V#, typed R32_FLOAT, 250 elements of a 256-element buffer (read) +; slot 5 (+0xa0): V#, typed R32_SINT, 256 elements (written) +; g = 64 * group + lane, 0..255 (an index past a view's NUM_RECORDS is out of range: a load gives 0, a store or an +; atomic touches nothing): +; slot 0: element g = g * mul + seed, then += g +; slot 1: element g = { f16(g), f16(g + 0.5), f16(-1 - g), f16(0.25) } +; slot 2: element g = unorm8 { (g & 255) / 255, (255 - (g & 255)) / 255, 0, 1 } +; slot 3: element g = { g, g ^ 0xffff, g * 7, 0xa5 } +; slot 5: element g = (int)(2 * input[g]), input[g] = g - 100.5 +s_load_dwordx4 s[8:11], s[4:5], 0x0 +s_load_dwordx4 s[12:15], s[4:5], 0x20 +s_load_dwordx4 s[16:19], s[4:5], 0x40 +s_load_dwordx4 s[20:23], s[4:5], 0x60 +s_load_dwordx4 s[24:27], s[4:5], 0x80 +s_load_dwordx4 s[28:31], s[4:5], 0xa0 +s_lshl_b32 s7, s6, 6 +s_waitcnt lgkmcnt(0) +v_add_nc_u32_e32 v1, s7, v0 +v_mul_lo_u32 v2, v1, s1 +v_add_nc_u32_e32 v2, s0, v2 +buffer_store_format_x v2, v1, s[8:11], 0 idxen +v_mov_b32_e32 v3, v1 +buffer_atomic_add v3, v1, s[8:11], 0 idxen +v_cvt_f32_u32_e32 v4, v1 +v_add_f32_e32 v5, 0.5, v4 +v_sub_f32_e32 v6, -1.0, v4 +v_mov_b32_e32 v7, 0x3e800000 +buffer_store_format_xyzw v[4:7], v1, s[12:15], 0 idxen +v_and_b32_e32 v8, 255, v1 +v_cvt_f32_ubyte0_e32 v9, v8 +v_mov_b32_e32 v10, 0x3b808081 +v_mul_f32_e32 v11, v9, v10 +v_sub_nc_u32_e32 v12, 255, v8 +v_cvt_f32_ubyte0_e32 v12, v12 +v_mul_f32_e32 v12, v12, v10 +v_mov_b32_e32 v13, 0 +v_mov_b32_e32 v14, 1.0 +buffer_store_format_xyzw v[11:14], v1, s[16:19], 0 idxen +v_mov_b32_e32 v15, v1 +v_xor_b32_e32 v16, 0xffff, v1 +v_mul_lo_u32 v17, v1, 7 +v_mov_b32_e32 v18, 0xa5 +buffer_store_format_xyzw v[15:18], v1, s[20:23], 0 idxen +buffer_load_format_x v19, v1, s[24:27], 0 idxen +s_waitcnt vmcnt(0) +v_add_f32_e32 v19, v19, v19 +v_cvt_i32_f32_e32 v19, v19 +buffer_store_format_x v19, v1, s[28:31], 0 idxen +s_endpgm diff --git a/runtime/test/shaders/cs_lds_b64_cmpst.asm b/runtime/test/shaders/cs_lds_b64_cmpst.asm new file mode 100644 index 0000000000..0998d85765 --- /dev/null +++ b/runtime/test/shaders/cs_lds_b64_cmpst.asm @@ -0,0 +1,132 @@ +; GPU test for the two LDS families that docs/design.md lists as not GPU-verified: +; ds_cmpst_b32 (the non-returning compare-and-store) and the b64 2-address forms +; (ds_read2_b64 / ds_write2_b64 and their st64 variants). +; +; LDS 4 KiB (RSRC2 0x40088), group 32x1x1, only lane 0 runs. The output words are +; derived from the RDNA2 ISA's 2-address and DS_CMPST_B32 pseudocode: +; +; out[0..3] ds_write2_b64 then ds_read2_b64 at base 0x20, offset0:1 offset1:3, +; writes A at 0x28 and B at 0x38 (unit 8), reads the same two elements: +; A.lo A.hi B.lo B.hi +; out[4] ds_read2st64_b64 at base 0x100, offset0:0 offset1:1 (unit 512): +; XOR of the four dwords seeded at 0x100 and 0x300 +; out[5] ds_write2st64_b64 at base 0x100, offset0:0 offset1:1, then plain +; ds_read_b32 at 0x100/0x104/0x300/0x304: XOR of the four dwords +; out[6] ds_read2_b64 v[2:5], v2 at base 0x200 (vdst overlaps vaddr): the +; second element's low dword, 0xBBBB000B, read before v2 is overwritten +; out[7] ds_cmpst_b32 hit (mem 0x13572468 -> 0x2468ABCD) XOR the miss case's +; unchanged word (0x11111111): 0x3579BADC +; +; Run: vk_compute_test cs_lds_b64_cmpst.spv 1 dump +; -> out[0..7] = 0x11110001 0x22220002 0x33330003 0x44440004 +; 0xCCCC000C 0x44440004 0xBBBB000B 0x3579BADC +; rsrc2: 0x40088 +; group: 32,1,1 +; mattr: +wavefrontsize32,-wavefrontsize64 +v_cmpx_eq_u32_e32 0, v0 + +; --- ds_write2_b64 / ds_read2_b64, unit 8 bytes --- +v_mov_b32_e32 v2, 0x20 +v_mov_b32_e32 v4, 0x11110001 +v_mov_b32_e32 v5, 0x22220002 +v_mov_b32_e32 v6, 0x33330003 +v_mov_b32_e32 v7, 0x44440004 +ds_write2_b64 v2, v[4:5], v[6:7] offset0:1 offset1:3 +s_waitcnt lgkmcnt(0) +ds_read2_b64 v[10:13], v2 offset0:1 offset1:3 +s_waitcnt lgkmcnt(0) +v_mov_b32_e32 v21, 0 +buffer_store_dword v10, v21, s[0:3], 0 offen +v_mov_b32_e32 v21, 4 +buffer_store_dword v11, v21, s[0:3], 0 offen +v_mov_b32_e32 v21, 8 +buffer_store_dword v12, v21, s[0:3], 0 offen +v_mov_b32_e32 v21, 12 +buffer_store_dword v13, v21, s[0:3], 0 offen + +; --- ds_read2st64_b64, unit 512 bytes: seed 0x100 and 0x300 --- +v_mov_b32_e32 v1, 0x100 +v_mov_b32_e32 v3, 0x55550005 +ds_write_b32 v1, v3 +v_mov_b32_e32 v1, 0x104 +v_mov_b32_e32 v3, 0x66660006 +ds_write_b32 v1, v3 +v_mov_b32_e32 v1, 0x300 +v_mov_b32_e32 v3, 0x77770007 +ds_write_b32 v1, v3 +v_mov_b32_e32 v1, 0x304 +v_mov_b32_e32 v3, 0x88880008 +ds_write_b32 v1, v3 +s_waitcnt lgkmcnt(0) +v_mov_b32_e32 v2, 0x100 +ds_read2st64_b64 v[10:13], v2 offset0:0 offset1:1 +s_waitcnt lgkmcnt(0) +v_xor_b32_e32 v14, v10, v11 +v_xor_b32_e32 v14, v14, v12 +v_xor_b32_e32 v14, v14, v13 +v_mov_b32_e32 v21, 16 +buffer_store_dword v14, v21, s[0:3], 0 offen + +; --- ds_write2st64_b64, unit 512 bytes: A at 0x100, B at 0x300 --- +v_mov_b32_e32 v2, 0x100 +ds_write2st64_b64 v2, v[4:5], v[6:7] offset0:0 offset1:1 +s_waitcnt lgkmcnt(0) +v_mov_b32_e32 v1, 0x100 +ds_read_b32 v10, v1 +v_mov_b32_e32 v1, 0x104 +ds_read_b32 v11, v1 +v_mov_b32_e32 v1, 0x300 +ds_read_b32 v12, v1 +v_mov_b32_e32 v1, 0x304 +ds_read_b32 v13, v1 +s_waitcnt lgkmcnt(0) +v_xor_b32_e32 v15, v10, v11 +v_xor_b32_e32 v15, v15, v12 +v_xor_b32_e32 v15, v15, v13 +v_mov_b32_e32 v21, 20 +buffer_store_dword v15, v21, s[0:3], 0 offen + +; --- ds_read2_b64 with vdst overlapping vaddr: v[2:5] <- base v2 --- +v_mov_b32_e32 v1, 0x200 +v_mov_b32_e32 v3, 0x99990009 +ds_write_b32 v1, v3 +v_mov_b32_e32 v1, 0x204 +v_mov_b32_e32 v3, 0xAAAA000A +ds_write_b32 v1, v3 +v_mov_b32_e32 v1, 0x208 +v_mov_b32_e32 v3, 0xBBBB000B +ds_write_b32 v1, v3 +v_mov_b32_e32 v1, 0x20C +v_mov_b32_e32 v3, 0xCCCC000C +ds_write_b32 v1, v3 +s_waitcnt lgkmcnt(0) +v_mov_b32_e32 v2, 0x200 +ds_read2_b64 v[2:5], v2 offset0:0 offset1:1 +s_waitcnt lgkmcnt(0) +v_mov_b32_e32 v21, 24 +buffer_store_dword v4, v21, s[0:3], 0 offen + +; --- ds_cmpst_b32: hit at 0x400, miss at 0x404 --- +v_mov_b32_e32 v1, 0x400 +v_mov_b32_e32 v3, 0x13572468 +ds_write_b32 v1, v3 +v_mov_b32_e32 v1, 0x404 +v_mov_b32_e32 v3, 0x11111111 +ds_write_b32 v1, v3 +s_waitcnt lgkmcnt(0) +v_mov_b32_e32 v1, 0x400 +v_mov_b32_e32 v3, 0x13572468 +v_mov_b32_e32 v4, 0x2468ABCD +ds_cmpst_b32 v1, v3, v4 +s_waitcnt lgkmcnt(0) +ds_read_b32 v10, v1 +v_mov_b32_e32 v1, 0x404 +v_mov_b32_e32 v3, 0 +v_mov_b32_e32 v4, 0xFFFFFFFF +ds_cmpst_b32 v1, v3, v4 +s_waitcnt lgkmcnt(0) +ds_read_b32 v11, v1 +v_xor_b32_e32 v16, v10, v11 +v_mov_b32_e32 v21, 28 +buffer_store_dword v16, v21, s[0:3], 0 offen +s_endpgm diff --git a/runtime/test/shaders/cs_m4_fill.asm b/runtime/test/shaders/cs_m4_fill.asm new file mode 100644 index 0000000000..1af46dac91 --- /dev/null +++ b/runtime/test/shaders/cs_m4_fill.asm @@ -0,0 +1,51 @@ +; group: 64,1,1 +; rsrc2: 0x808c +; fssm-at: 0x150 +; fssm-data: 0x4c4c4946 0x3d344d5f +; M4 compute shader 1: fills a structured UAV buffer and a typed UAV image from a raw input buffer, and writes the +; arguments of the next (indirect) dispatch. Run: d3d12_m4_compute_test (a compute PSO found by the SHA-256 of its +; synthetic FSSM header, as for the other cs_ shaders). +; User data, from the root signature: [0] four 32-bit constants, [1] a descriptor table of five UAVs. RSRC2 0x808c = +; six user SGPRs and TGID_X, so the group index is s6: +; s0 = seed s1 = multiplier s2 = group count of the indirect dispatch s3 = unused +; s[4:5] = console VA of the table's first slot. A slot is 32 bytes: a V# in its first 16 bytes or a T# in all 32. +; slot 0 (+0x00): V#, structured buffer, stride 16, 256 records (written) +; slot 1 (+0x20): V#, raw buffer, the arguments of the indirect dispatch (written) +; slot 2 (+0x40): T#, 16x16 R32_UINT image (written) +; slot 3 (+0x60): V#, raw buffer, 256 input words (read) +; slot 4 (+0x80): V#, raw buffer, the second shader's output (not used here) +; g = 64 * group + lane, 0..255: in = input[g] +; record g = { in + seed, g * mul, in ^ (g << 8), rotr(in, 13) } +; image(x = g & 15, y = g >> 4) = in * 3 + x * 0x10001 + y +; g == 0 also writes the arguments { s2, 1, 1, 0xc0de0001 } +s_load_dwordx4 s[8:11], s[4:5], 0x0 +s_load_dwordx4 s[12:15], s[4:5], 0x20 +s_load_dwordx8 s[16:23], s[4:5], 0x40 +s_load_dwordx4 s[24:27], s[4:5], 0x60 +s_lshl_b32 s7, s6, 6 +s_waitcnt lgkmcnt(0) +v_add_nc_u32_e32 v1, s7, v0 +v_lshlrev_b32_e32 v2, 2, v1 +buffer_load_dword v3, v2, s[24:27], 0 offen +s_waitcnt vmcnt(0) +v_add_nc_u32_e32 v4, s0, v3 +v_mul_lo_u32 v5, v1, s1 +v_lshlrev_b32_e32 v6, 8, v1 +v_xor_b32_e32 v6, v3, v6 +v_alignbit_b32 v7, v3, v3, 13 +buffer_store_dwordx4 v[4:7], v1, s[8:11], 0 idxen +v_and_b32_e32 v8, 15, v1 +v_lshrrev_b32_e32 v9, 4, v1 +v_mul_u32_u24_e32 v10, 0x10001, v8 +v_mul_lo_u32 v11, v3, 3 +v_add_nc_u32_e32 v10, v10, v11 +v_add_nc_u32_e32 v10, v10, v9 +image_store v10, v[8:9], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +v_cmpx_eq_u32_e32 0, v1 +v_mov_b32_e32 v12, 0 +v_mov_b32_e32 v13, s2 +v_mov_b32_e32 v14, 1 +v_mov_b32_e32 v15, 1 +v_mov_b32_e32 v16, 0xc0de0001 +buffer_store_dwordx4 v[13:16], v12, s[12:15], 0 offen +s_endpgm diff --git a/runtime/test/shaders/cs_m4_indirect.asm b/runtime/test/shaders/cs_m4_indirect.asm new file mode 100644 index 0000000000..8a23596bf0 --- /dev/null +++ b/runtime/test/shaders/cs_m4_indirect.asm @@ -0,0 +1,28 @@ +; group: 64,1,1 +; rsrc2: 0x808c +; fssm-at: 0x150 +; fssm-data: 0x44444e49 0x3d344d5f +; M4 compute shader 2: runs under ExecuteIndirect with the arguments cs_m4_fill wrote ({ groups, 1, 1 }), reads the +; structured buffer and the image the first dispatch wrote, and writes a raw output buffer. Run: +; d3d12_m4_compute_test. Same root signature, user data and table as cs_m4_fill (see there): +; slot 0: structured buffer (read) slot 2: R32_UINT image (read, image_load) slot 4: raw output (written) +; g = 64 * group + lane; t = image(g & 15, g >> 4); record g = { w0, w1, w2, w3 } +; out[g] = { (w0 + t) ^ w3, (w2 ^ t) + w1 } at byte offset 8 * g +s_load_dwordx4 s[8:11], s[4:5], 0x0 +s_load_dwordx8 s[16:23], s[4:5], 0x40 +s_load_dwordx4 s[12:15], s[4:5], 0x80 +s_lshl_b32 s7, s6, 6 +s_waitcnt lgkmcnt(0) +v_add_nc_u32_e32 v1, s7, v0 +buffer_load_dwordx4 v[4:7], v1, s[8:11], 0 idxen +v_and_b32_e32 v8, 15, v1 +v_lshrrev_b32_e32 v9, 4, v1 +image_load v10, v[8:9], s[16:23] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm +s_waitcnt vmcnt(0) +v_add_nc_u32_e32 v11, v4, v10 +v_xor_b32_e32 v11, v11, v7 +v_xor_b32_e32 v12, v6, v10 +v_add_nc_u32_e32 v12, v12, v5 +v_lshlrev_b32_e32 v13, 3, v1 +buffer_store_dwordx2 v[11:12], v13, s[12:15], 0 offen +s_endpgm diff --git a/runtime/test/shaders/cs_tbuffer_store.asm b/runtime/test/shaders/cs_tbuffer_store.asm new file mode 100644 index 0000000000..a6e0e78e5d --- /dev/null +++ b/runtime/test/shaders/cs_tbuffer_store.asm @@ -0,0 +1,275 @@ +; tbuffer_store_format_* and its d16 forms. Every expected word was measured by running this body natively on a Radeon +; 680M (gfx1035, RDNA2) through tools/hw_oracle's kernel wrapper, with s[0:3] set to the V# vk_compute_test passes; +; wave32 and wave64 gave the same 52 words. One thread runs. +; - The instruction's format replaces the V#'s, for the encoding, the element size and the bounds check alike. No +; format modifier means GFX10's default, BUF_FMT_8_UNORM: one byte, its neighbours kept. +; - A store writes its format's whole element: components the format has but the instruction doesn't give are 0 +; (xy into 16_16_16_16 leaves z = w = 0); components the format doesn't have are dropped (xyzw into 32_32 writes +; x, y; into 32 only x). +; - d16 data is two 16-bit values per VGPR, low half first. +; - Bounds (OOB_SELECT 3): the instruction's element must end inside num_records. With NR 0x298, an xy store of a +; 16-byte element at 0x290 writes nothing, though a V# that says 32_FLOAT has a 4-byte element; with NR 0x2a1, an +; 8_UNORM byte at 0x2a0 is written, though the V#'s 16-byte element would not fit. +; - A V# whose FORMAT is 0 (INVALID) disables the store, though the instruction brings its own format. +; Store regions 0x200..0x2cf start as 0xa5a50000 | address; out[0..51] are the 13 regions read back, in source order. +; Run: VKC_OUT_WORDS=192 VKC_DUMP= vk_compute_test cs_tbuffer_store.spv 1 dump; check.py compares words 0..127 of +; the dump with TBUFFER_STORE_WORDS and 76 untouched 0xeeeeeeee words. +v_cmpx_eq_u32_e32 0, v0 +; the store regions 0x200..0x2cf hold 0xa5a50000 | their address +v_mov_b32_e32 v1, 0xa5a50200 +v_mov_b32_e32 v2, 0xa5a50204 +v_mov_b32_e32 v3, 0xa5a50208 +v_mov_b32_e32 v4, 0xa5a5020c +v_mov_b32_e32 v5, 0x200 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a50210 +v_mov_b32_e32 v2, 0xa5a50214 +v_mov_b32_e32 v3, 0xa5a50218 +v_mov_b32_e32 v4, 0xa5a5021c +v_mov_b32_e32 v5, 0x210 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a50220 +v_mov_b32_e32 v2, 0xa5a50224 +v_mov_b32_e32 v3, 0xa5a50228 +v_mov_b32_e32 v4, 0xa5a5022c +v_mov_b32_e32 v5, 0x220 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a50230 +v_mov_b32_e32 v2, 0xa5a50234 +v_mov_b32_e32 v3, 0xa5a50238 +v_mov_b32_e32 v4, 0xa5a5023c +v_mov_b32_e32 v5, 0x230 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a50240 +v_mov_b32_e32 v2, 0xa5a50244 +v_mov_b32_e32 v3, 0xa5a50248 +v_mov_b32_e32 v4, 0xa5a5024c +v_mov_b32_e32 v5, 0x240 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a50250 +v_mov_b32_e32 v2, 0xa5a50254 +v_mov_b32_e32 v3, 0xa5a50258 +v_mov_b32_e32 v4, 0xa5a5025c +v_mov_b32_e32 v5, 0x250 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a50260 +v_mov_b32_e32 v2, 0xa5a50264 +v_mov_b32_e32 v3, 0xa5a50268 +v_mov_b32_e32 v4, 0xa5a5026c +v_mov_b32_e32 v5, 0x260 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a50270 +v_mov_b32_e32 v2, 0xa5a50274 +v_mov_b32_e32 v3, 0xa5a50278 +v_mov_b32_e32 v4, 0xa5a5027c +v_mov_b32_e32 v5, 0x270 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a50280 +v_mov_b32_e32 v2, 0xa5a50284 +v_mov_b32_e32 v3, 0xa5a50288 +v_mov_b32_e32 v4, 0xa5a5028c +v_mov_b32_e32 v5, 0x280 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a50290 +v_mov_b32_e32 v2, 0xa5a50294 +v_mov_b32_e32 v3, 0xa5a50298 +v_mov_b32_e32 v4, 0xa5a5029c +v_mov_b32_e32 v5, 0x290 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a502a0 +v_mov_b32_e32 v2, 0xa5a502a4 +v_mov_b32_e32 v3, 0xa5a502a8 +v_mov_b32_e32 v4, 0xa5a502ac +v_mov_b32_e32 v5, 0x2a0 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a502b0 +v_mov_b32_e32 v2, 0xa5a502b4 +v_mov_b32_e32 v3, 0xa5a502b8 +v_mov_b32_e32 v4, 0xa5a502bc +v_mov_b32_e32 v5, 0x2b0 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +v_mov_b32_e32 v1, 0xa5a502c0 +v_mov_b32_e32 v2, 0xa5a502c4 +v_mov_b32_e32 v3, 0xa5a502c8 +v_mov_b32_e32 v4, 0xa5a502cc +v_mov_b32_e32 v5, 0x2c0 +buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen +s_waitcnt_vscnt null, 0x0 +s_mov_b32 s4, s0 +s_mov_b32 s5, s1 +; 0x200: tbuffer_store_format_xyzw, xyzw, 32_32_32_32_FLOAT over a V# that says 32_FLOAT: all four dwords +v_mov_b32_e32 v20, 0x3f800000 +v_mov_b32_e32 v21, 0x40000000 +v_mov_b32_e32 v22, 0x40400000 +v_mov_b32_e32 v23, 0x40800000 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x31016fac +v_mov_b32_e32 v5, 0x200 +tbuffer_store_format_xyzw v[20:23], v5, s[4:7], 0 format:[BUF_FMT_32_32_32_32_FLOAT] offen +; 0x210: tbuffer_store_format_xy, xy, 16_16_16_16_FLOAT over a V# that says 32_32_32_32_FLOAT: the 8-byte element, z = w = 0 +v_mov_b32_e32 v20, 0x3f800000 +v_mov_b32_e32 v21, 0x40000000 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x3104dfac +v_mov_b32_e32 v5, 0x210 +tbuffer_store_format_xy v[20:21], v5, s[4:7], 0 format:[BUF_FMT_16_16_16_16_FLOAT] offen +; 0x220: tbuffer_store_format_xyz, xyz, 8_8_8_8_UINT over a V# that says 32_FLOAT +v_mov_b32_e32 v20, 0x1 +v_mov_b32_e32 v21, 0x2 +v_mov_b32_e32 v22, 0x3 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x31016fac +v_mov_b32_e32 v5, 0x220 +tbuffer_store_format_xyz v[20:22], v5, s[4:7], 0 format:[BUF_FMT_8_8_8_8_UINT] offen +; 0x230: tbuffer_store_format_x, x, no format modifier (GFX10 default 8_UNORM) at byte 1, over a V# that says 32_32_32_32_FLOAT +v_mov_b32_e32 v20, 0x3f800000 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x3104dfac +v_mov_b32_e32 v5, 0x231 +tbuffer_store_format_x v20, v5, s[4:7], 0 offen +; 0x240: tbuffer_store_format_x, x, 16_FLOAT at byte 2 (the high half) +v_mov_b32_e32 v20, 0x40000000 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x31016fac +v_mov_b32_e32 v5, 0x242 +tbuffer_store_format_x v20, v5, s[4:7], 0 format:[BUF_FMT_16_FLOAT] offen +; 0x250: tbuffer_store_format_xyzw, xyzw, 2_10_10_10_UNORM (1.0, 0.0, 0.25, 1.0) +v_mov_b32_e32 v20, 0x3f800000 +v_mov_b32_e32 v21, 0x0 +v_mov_b32_e32 v22, 0x3e800000 +v_mov_b32_e32 v23, 0x3f800000 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x31016fac +v_mov_b32_e32 v5, 0x250 +tbuffer_store_format_xyzw v[20:23], v5, s[4:7], 0 format:[BUF_FMT_2_10_10_10_UNORM] offen +; 0x260: tbuffer_store_format_xyzw, xyzw into 32_32_FLOAT: only x, y +v_mov_b32_e32 v20, 0x3f800000 +v_mov_b32_e32 v21, 0x40000000 +v_mov_b32_e32 v22, 0x40400000 +v_mov_b32_e32 v23, 0x40800000 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x3104dfac +v_mov_b32_e32 v5, 0x260 +tbuffer_store_format_xyzw v[20:23], v5, s[4:7], 0 format:[BUF_FMT_32_32_FLOAT] offen +; 0x270: tbuffer_store_format_d16_xy, d16_xy, 16_16_FLOAT (packed 1.0, 2.0) +v_mov_b32_e32 v20, 0x40003c00 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x3104dfac +v_mov_b32_e32 v5, 0x270 +tbuffer_store_format_d16_xy v20, v5, s[4:7], 0 format:[BUF_FMT_16_16_FLOAT] offen +; 0x280: tbuffer_store_format_d16_xyzw, d16_xyzw, 8_8_8_8_UNORM (packed 1.0, 0.5, 0.0, 1.0) +v_mov_b32_e32 v20, 0x38003c00 +v_mov_b32_e32 v21, 0x3c000000 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x31016fac +v_mov_b32_e32 v5, 0x280 +tbuffer_store_format_d16_xyzw v[20:21], v5, s[4:7], 0 format:[BUF_FMT_8_8_8_8_UNORM] offen +; 0x290: tbuffer_store_format_xy, xy, 32_32_32_32_FLOAT, NR 0x298 over a V# that says 32_FLOAT: x, y end at 0x298, the element at 0x2a0 +v_mov_b32_e32 v20, 0x3f800000 +v_mov_b32_e32 v21, 0x40000000 +s_mov_b32 s6, 0x298 +s_mov_b32 s7, 0x31016fac +v_mov_b32_e32 v5, 0x290 +tbuffer_store_format_xy v[20:21], v5, s[4:7], 0 format:[BUF_FMT_32_32_32_32_FLOAT] offen +; 0x2a0: tbuffer_store_format_x, x, 8_UNORM, NR 0x2a1 over a V# that says 32_32_32_32_FLOAT: the byte fits, the V#'s element would not +v_mov_b32_e32 v20, 0x3f800000 +s_mov_b32 s6, 0x2a1 +s_mov_b32 s7, 0x3104dfac +v_mov_b32_e32 v5, 0x2a0 +tbuffer_store_format_x v20, v5, s[4:7], 0 format:[BUF_FMT_8_UNORM] offen +; 0x2b0: tbuffer_store_format_xyzw, xyzw into 32_FLOAT (one channel) over a V# that says 32_32_32_32_FLOAT: only x +v_mov_b32_e32 v20, 0x3f800000 +v_mov_b32_e32 v21, 0x40000000 +v_mov_b32_e32 v22, 0x40400000 +v_mov_b32_e32 v23, 0x40800000 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x3104dfac +v_mov_b32_e32 v5, 0x2b0 +tbuffer_store_format_xyzw v[20:23], v5, s[4:7], 0 format:[BUF_FMT_32_FLOAT] offen +; 0x2c0: tbuffer_store_format_xy, xy, 32_32_FLOAT over a V# whose FORMAT is 0 (INVALID): nothing +v_mov_b32_e32 v20, 0x3f800000 +v_mov_b32_e32 v21, 0x40000000 +s_mov_b32 s6, 0xffffffff +s_mov_b32 s7, 0x31000fac +v_mov_b32_e32 v5, 0x2c0 +tbuffer_store_format_xy v[20:21], v5, s[4:7], 0 format:[BUF_FMT_32_32_FLOAT] offen +s_waitcnt_vscnt null, 0x0 +; out[0..3]: the 16 bytes at 0x200 +v_mov_b32_e32 v5, 0x200 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x0 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[4..7]: the 16 bytes at 0x210 +v_mov_b32_e32 v5, 0x210 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x10 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[8..11]: the 16 bytes at 0x220 +v_mov_b32_e32 v5, 0x220 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x20 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[12..15]: the 16 bytes at 0x230 +v_mov_b32_e32 v5, 0x230 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x30 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[16..19]: the 16 bytes at 0x240 +v_mov_b32_e32 v5, 0x240 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x40 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[20..23]: the 16 bytes at 0x250 +v_mov_b32_e32 v5, 0x250 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x50 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[24..27]: the 16 bytes at 0x260 +v_mov_b32_e32 v5, 0x260 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x60 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[28..31]: the 16 bytes at 0x270 +v_mov_b32_e32 v5, 0x270 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x70 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[32..35]: the 16 bytes at 0x280 +v_mov_b32_e32 v5, 0x280 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x80 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[36..39]: the 16 bytes at 0x290 +v_mov_b32_e32 v5, 0x290 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0x90 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[40..43]: the 16 bytes at 0x2a0 +v_mov_b32_e32 v5, 0x2a0 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0xa0 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[44..47]: the 16 bytes at 0x2b0 +v_mov_b32_e32 v5, 0x2b0 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0xb0 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +; out[48..51]: the 16 bytes at 0x2c0 +v_mov_b32_e32 v5, 0x2c0 +buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen +s_waitcnt vmcnt(0) +v_mov_b32_e32 v6, 0xc0 +buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen +s_endpgm diff --git a/runtime/test/shaders/ps_mandelbrot.asm b/runtime/test/shaders/ps_mandelbrot.asm new file mode 100644 index 0000000000..98c70f6cc4 --- /dev/null +++ b/runtime/test/shaders/ps_mandelbrot.asm @@ -0,0 +1,46 @@ +; Mandelbrot set: a divergent backward loop with EXEC masking. Each lane iterates z = z^2 + c until |z|^2 > 4 or +; 64 iterations, with c from attr0.xy (u, v 0..1 over the image) mapped to [-2.25, 0.75] x [-1.5, 1.5]. A lane that +; escapes drops out of EXEC (s_and_b32 exec_lo, exec_lo, vcc_lo); s_cbranch_execz leaves the loop once every lane has +; escaped, else the uniform counter s10 ends it after 64 rounds. EXEC is restored from s20 before the export. +; Only v_mul/v_add/v_sub (no FMA), so a float32 model on the CPU gives the same counts. +; Branch offsets are dwords from the next instruction: execz +9 forward to the restore, scc1 -15 back to the loop top. +; Run: vk_harness vs_ids.spv ps_mandelbrot.spv out.raw +; -> mrt0 = (sqrt(t), t*t, 4t(1-t), iteration count as raw bits) with t = count / 64 +v_interp_p1_f32_e32 v2, v0, attr0.x +v_interp_p2_f32_e32 v2, v1, attr0.x +v_interp_p1_f32_e32 v3, v0, attr0.y +v_interp_p2_f32_e32 v3, v1, attr0.y +v_mul_f32_e32 v4, 0x40400000, v2 +v_add_f32_e32 v4, 0xc0100000, v4 +v_mul_f32_e32 v5, 0x40400000, v3 +v_add_f32_e32 v5, 0xbfc00000, v5 +v_mov_b32_e32 v6, 0 +v_mov_b32_e32 v7, 0 +v_mov_b32_e32 v8, 0 +s_mov_b32 s10, 0 +s_mov_b32 s20, exec_lo +v_mul_f32_e32 v9, v6, v6 +v_mul_f32_e32 v10, v7, v7 +v_add_f32_e32 v11, v9, v10 +v_cmp_ge_f32_e32 vcc_lo, 4.0, v11 +s_and_b32 exec_lo, exec_lo, vcc_lo +s_cbranch_execz 9 +v_sub_f32_e32 v12, v9, v10 +v_mul_f32_e32 v13, v6, v7 +v_add_f32_e32 v13, v13, v13 +v_add_f32_e32 v6, v12, v4 +v_add_f32_e32 v7, v13, v5 +v_add_nc_u32_e32 v8, 1, v8 +s_add_u32 s10, s10, 1 +s_cmp_lt_u32 s10, 64 +s_cbranch_scc1 -15 +s_mov_b32 exec_lo, s20 +v_cvt_f32_u32_e32 v14, v8 +v_mul_f32_e32 v14, 0x3c800000, v14 +v_sqrt_f32_e32 v15, v14 +v_mul_f32_e32 v16, v14, v14 +v_sub_f32_e32 v17, 1.0, v14 +v_mul_f32_e32 v17, v14, v17 +v_mul_f32_e32 v17, 4.0, v17 +exp mrt0 v15, v16, v17, v8 done vm +s_endpgm diff --git a/runtime/test/shaders/vs_w64_a_skip.asm b/runtime/test/shaders/vs_w64_a_skip.asm new file mode 100644 index 0000000000..dac0d885e3 --- /dev/null +++ b/runtime/test/shaders/vs_w64_a_skip.asm @@ -0,0 +1,45 @@ +; TEST-251 (SHADER-10 tier A, vertex stage): the skip regions and the loop of ps_w64_a_skip in a wave64 vertex shader, +; without its whole-quad mask (vertex quads are lanes, not pixels). Vertex v (v0 = vertex index) has x = v & 63 and +; y = v >> 6, so every word is a function of v and not of the lane the vertex landed on. It stores (r0, r1, r2, r3) +; to its record at heap 0x1000 + 16 * v through the V# in s[0:3]. +; (1) a skip region behind s_cbranch_execz: only lanes with x % 4 == 1 run it. r0 = x % 4 == 1 ? 7 * y + x : 1000 + x. +; (2) r1 = x % 4 == 1 (the VCC of (1), per lane). +; (3) s_cbranch_vccz over a region that narrows EXEC to that VCC. r2 = 2000 + y + (y % 4 == 2 ? 9 : 0). +; (4) a loop closed by s_cbranch_execnz, no scalar state carried. r3 = x % 4 + 1. +; Run: VKH_VERTICES=960 VKH_SGPRS=0,0,65536,0x30000000 VKH_HEAP=0=0 VKH_HEAP_DUMP=heap.raw vk_harness +; vs_w64_a_skip.spv out.raw, with and without RADV_PERFTEST=gewave32: equal records, and equal +; to the expected words. +; mattr: +wavefrontsize64,-wavefrontsize32 +v_and_b32_e32 v2, 63, v0 +v_lshrrev_b32_e32 v3, 6, v0 +s_mov_b64 s[10:11], exec +v_add_nc_u32_e32 v6, 0x3e8, v2 +v_and_b32_e32 v4, 3, v2 +v_cmp_eq_u32_e32 vcc, 1, v4 +v_cndmask_b32_e64 v7, 0, 1, vcc +s_and_saveexec_b64 s[12:13], vcc +s_cbranch_execz 2 +v_mul_u32_u24_e32 v6, 7, v3 +v_add_nc_u32_e32 v6, v6, v2 +s_or_b64 exec, exec, s[12:13] +v_and_b32_e32 v5, 3, v3 +v_add_nc_u32_e32 v8, 0x7d0, v3 +v_cmp_eq_u32_e32 vcc, 2, v5 +s_cbranch_vccz 3 +s_and_saveexec_b64 s[16:17], vcc +v_add_nc_u32_e32 v8, 9, v8 +s_or_b64 exec, exec, s[16:17] +v_add_nc_u32_e32 v10, 1, v4 +v_mov_b32_e32 v9, 0 +v_add_nc_u32_e32 v9, 1, v9 +v_cmp_lt_u32_e32 vcc, v9, v10 +s_and_b64 exec, exec, vcc +s_cbranch_execnz -4 +s_mov_b64 exec, s[10:11] +v_lshlrev_b32_e32 v12, 4, v0 +v_add_nc_u32_e32 v12, 0x1000, v12 +buffer_store_dwordx4 v[6:9], v12, s[0:3], 0 offen +v_mov_b32_e32 v5, 0 +exp pos0 v5, v5, v5, v5 done +exp param0 v5, v5, v5, v5 +s_endpgm diff --git a/runtime/test/shaders/vs_w64_b_ballot_atomic.asm b/runtime/test/shaders/vs_w64_b_ballot_atomic.asm new file mode 100644 index 0000000000..f718c25f8a --- /dev/null +++ b/runtime/test/shaders/vs_w64_b_ballot_atomic.asm @@ -0,0 +1,42 @@ +; TEST-251 (SHADER-10 tier B, vertex stage): the wave-aggregated atomic of ps_w64_b_ballot_atomic in a wave64 vertex +; shader. Vertex v (v0 = vertex index) has x = v & 63; vertices with x % 4 == 1 are the "wanted" lanes. EXEC = the +; wanted lanes; n = s_bcnt1_i32_b64 exec; rank = v_mbcnt_lo/hi of EXEC; the lane of rank 0 does buffer_atomic_add of n +; to the counter at heap offset 0 and gets the old value back; v_readfirstlane broadcasts it as the base; every wanted +; vertex stores v + 1 at heap offset 0x100 + 4 * (base + rank). Whatever the wave size and the packing, every wanted +; vertex gets a slot of its own and the counter ends at the number of wanted vertices (240 of 960); which vertex gets +; which slot depends on the packing, so the slots are compared as a set. Its record at heap 0x1000 + 16 * v holds +; (x % 4 == 1, 0, 0, 0). +; Run: VKH_VERTICES=960 VKH_SGPRS=0,0,65536,0x30000000 VKH_HEAP=0=0 VKH_HEAP_DUMP=heap.raw vk_harness +; vs_w64_b_ballot_atomic.spv out.raw, with and without RADV_PERFTEST=gewave32. +; mattr: +wavefrontsize64,-wavefrontsize32 +v_and_b32_e32 v2, 63, v0 +v_and_b32_e32 v4, 3, v2 +s_mov_b64 s[10:11], exec +v_cmp_eq_u32_e32 vcc, 1, v4 +v_cndmask_b32_e64 v6, 0, 1, vcc +s_and_saveexec_b64 s[12:13], vcc +s_bcnt1_i32_b64 s6, exec +v_mbcnt_lo_u32_b32 v10, exec_lo, 0 +v_mbcnt_hi_u32_b32 v10, exec_hi, v10 +v_cmp_eq_u32_e32 vcc, 0, v10 +s_and_saveexec_b64 s[14:15], vcc +v_mov_b32_e32 v11, s6 +v_mov_b32_e32 v13, 0 +buffer_atomic_add v11, v13, s[0:3], 0 offen glc +s_or_b64 exec, exec, s[14:15] +v_readfirstlane_b32 s7, v11 +v_add_nc_u32_e32 v13, s7, v10 +v_lshlrev_b32_e32 v13, 2, v13 +v_add_nc_u32_e32 v14, 1, v0 +buffer_store_dword v14, v13, s[0:3], 0 offen offset:256 +s_mov_b64 exec, s[10:11] +v_mov_b32_e32 v7, 0 +v_mov_b32_e32 v8, 0 +v_mov_b32_e32 v9, 0 +v_lshlrev_b32_e32 v12, 4, v0 +v_add_nc_u32_e32 v12, 0x1000, v12 +buffer_store_dwordx4 v[6:9], v12, s[0:3], 0 offen +v_mov_b32_e32 v5, 0 +exp pos0 v5, v5, v5, v5 done +exp param0 v5, v5, v5, v5 +s_endpgm diff --git a/runtime/test/shaders/vs_w64_b_readlane_uniform.asm b/runtime/test/shaders/vs_w64_b_readlane_uniform.asm new file mode 100644 index 0000000000..0fb85008da --- /dev/null +++ b/runtime/test/shaders/vs_w64_b_readlane_uniform.asm @@ -0,0 +1,33 @@ +; TEST-251 (SHADER-10 tier B, vertex stage): v_readfirstlane and v_readlane (lanes 40 and 63) of wave-uniform VGPRs +; in a wave64 vertex shader, the vertex twin of ps_w64_b_readfirstlane and ps_w64_b_readlane_uniform. s4 is a user +; SGPR (VKH_SGPRS sets it to 123), copied to a VGPR and read back; so is the constant 77. Every lane holds the same +; value, so the scalar does not depend on which lane is read, on the wave size or on how many vertices a wave got. +; Vertex v (v0 = vertex index) has x = v & 63. r0 = x + 123 (readfirstlane), r1 = 123 + 77 (readlane 40 and 63), +; r2 = x + 123 (readlane 40), r3 = 77 * 2 + 123 (readfirstlane), stored to its record at heap 0x1000 + 16 * v +; through the V# in s[0:3]. +; Run: VKH_VERTICES=960 VKH_SGPRS=0,0,65536,0x30000000,123 VKH_HEAP=0=0 VKH_HEAP_DUMP=heap.raw vk_harness +; vs_w64_b_readlane_uniform.spv out.raw, with and without RADV_PERFTEST=gewave32: equal, and +; equal to the expected words. +; mattr: +wavefrontsize64,-wavefrontsize32 +v_and_b32_e32 v2, 63, v0 +s_mov_b64 s[10:11], exec +v_mov_b32_e32 v5, s4 +v_mov_b32_e32 v4, 77 +v_readfirstlane_b32 s20, v5 +v_add_nc_u32_e32 v6, s20, v2 +v_readlane_b32 s21, v5, 40 +v_readlane_b32 s22, v4, 63 +s_add_u32 s23, s21, s22 +v_mov_b32_e32 v7, s23 +v_add_nc_u32_e32 v8, s21, v2 +v_readfirstlane_b32 s24, v4 +s_lshl_b32 s24, s24, 1 +s_add_u32 s24, s24, s20 +v_mov_b32_e32 v9, s24 +v_lshlrev_b32_e32 v12, 4, v0 +v_add_nc_u32_e32 v12, 0x1000, v12 +buffer_store_dwordx4 v[6:9], v12, s[0:3], 0 offen +v_mov_b32_e32 v5, 0 +exp pos0 v5, v5, v5, v5 done +exp param0 v5, v5, v5, v5 +s_endpgm diff --git a/runtime/test/shaders/vs_w64_b_waterfall.asm b/runtime/test/shaders/vs_w64_b_waterfall.asm new file mode 100644 index 0000000000..8142598424 --- /dev/null +++ b/runtime/test/shaders/vs_w64_b_waterfall.asm @@ -0,0 +1,35 @@ +; TEST-251 (SHADER-10 tier B, vertex stage): the waterfall loop of ps_w64_b_waterfall in a wave64 vertex shader. +; Vertex v (v0 = vertex index) has x = v & 63, y = v >> 6 and the key a = x % 4 + 4 * (y % 4). The loop takes +; v_readfirstlane of the key, runs the lanes holding it (v_cmp_eq, s_and_saveexec), retires them (s_xor exec) and +; repeats while lanes are left (s_cbranch_execnz); the scalar is used only inside the body. It runs once per distinct +; key of the wave or of the 32-lane subgroup, and every vertex ends with r0 = 17 * a + x, r1 = a, r2 = r3 = 0, stored +; to its record at heap 0x1000 + 16 * v through the V# in s[0:3]. +; Run: VKH_VERTICES=960 VKH_SGPRS=0,0,65536,0x30000000 VKH_HEAP=0=0 VKH_HEAP_DUMP=heap.raw vk_harness +; vs_w64_b_waterfall.spv out.raw, with and without RADV_PERFTEST=gewave32: equal, and equal to +; the expected words. +; mattr: +wavefrontsize64,-wavefrontsize32 +v_and_b32_e32 v2, 63, v0 +v_lshrrev_b32_e32 v3, 6, v0 +v_and_b32_e32 v4, 3, v2 +v_and_b32_e32 v5, 3, v3 +v_lshl_add_u32 v4, v5, 2, v4 +v_mov_b32_e32 v6, 0 +s_mov_b64 s[10:11], exec +v_readfirstlane_b32 s20, v4 +v_cmp_eq_u32_e32 vcc, s20, v4 +s_and_saveexec_b64 s[12:13], vcc +s_mul_i32 s21, s20, 17 +v_add_nc_u32_e32 v6, s21, v2 +s_xor_b64 exec, exec, s[12:13] +s_cbranch_execnz -7 +s_mov_b64 exec, s[10:11] +v_mov_b32_e32 v7, v4 +v_mov_b32_e32 v8, 0 +v_mov_b32_e32 v9, 0 +v_lshlrev_b32_e32 v12, 4, v0 +v_add_nc_u32_e32 v12, 0x1000, v12 +buffer_store_dwordx4 v[6:9], v12, s[0:3], 0 offen +v_mov_b32_e32 v5, 0 +exp pos0 v5, v5, v5, v5 done +exp param0 v5, v5, v5, v5 +s_endpgm diff --git a/runtime/test/shaders/vs_w64_c_bcnt_export.asm b/runtime/test/shaders/vs_w64_c_bcnt_export.asm new file mode 100644 index 0000000000..84dd9bf537 --- /dev/null +++ b/runtime/test/shaders/vs_w64_c_bcnt_export.asm @@ -0,0 +1,23 @@ +; TEST-251 (SHADER-10 tier C, vertex stage): a lane count used as data. Vertex v (v0 = vertex index) has x = v & 63; +; s_bcnt1_i32_b64 counts the lanes of its wave with x % 4 == 1, which depends on the wave size and on how many +; vertices the driver put in the wave. r0 = that count (partition dependent), r1 = x % 4 == 1, r2 = r3 = 0, stored to +; its record at heap 0x1000 + 16 * v through the V# in s[0:3]. +; Run: VKH_VERTICES=960 VKH_SGPRS=0,0,65536,0x30000000 VKH_HEAP=0=0 VKH_HEAP_DUMP=heap.raw vk_harness +; vs_w64_c_bcnt_export.spv out.raw, with and without RADV_PERFTEST=gewave32: r1 equal, r0 +; differs. +; mattr: +wavefrontsize64,-wavefrontsize32 +v_and_b32_e32 v2, 63, v0 +v_and_b32_e32 v4, 3, v2 +v_cmp_eq_u32_e32 vcc, 1, v4 +s_bcnt1_i32_b64 s6, vcc +v_mov_b32_e32 v6, s6 +v_cndmask_b32_e64 v7, 0, 1, vcc +v_mov_b32_e32 v8, 0 +v_mov_b32_e32 v9, 0 +v_lshlrev_b32_e32 v12, 4, v0 +v_add_nc_u32_e32 v12, 0x1000, v12 +buffer_store_dwordx4 v[6:9], v12, s[0:3], 0 offen +v_mov_b32_e32 v5, 0 +exp pos0 v5, v5, v5, v5 done +exp param0 v5, v5, v5, v5 +s_endpgm diff --git a/runtime/test/shaders/vs_w64_c_lane_id.asm b/runtime/test/shaders/vs_w64_c_lane_id.asm new file mode 100644 index 0000000000..c698503335 --- /dev/null +++ b/runtime/test/shaders/vs_w64_c_lane_id.asm @@ -0,0 +1,21 @@ +; TEST-251 (SHADER-10 tier C, vertex stage): the raw lane number (v_mbcnt_lo/hi of -1) used as data. Each vertex v +; (v0 = vertex index) stores (lane id, lane id & 31, v, 0) to its record at heap 0x1000 + 16 * v through the V# in +; s[0:3]. In a wave64 VS some vertices get lanes 32..63; in a wave32 VS none do, so r0 and r1 depend on how the driver +; packed the vertices into waves and r2 does not. w64_graphics.py also uses it as its probe: the largest r0 shows the +; wave size the driver picked (63 by default on RADV GFX12, 31 with RADV_PERFTEST=gewave32). +; Run: VKH_VERTICES=960 VKH_SGPRS=0,0,65536,0x30000000 VKH_HEAP=0=0 VKH_HEAP_DUMP=heap.raw vk_harness +; vs_w64_c_lane_id.spv out.raw, with and without RADV_PERFTEST=gewave32 (the triangles have +; zero area, so nothing is drawn). +; mattr: +wavefrontsize64,-wavefrontsize32 +v_mbcnt_lo_u32_b32 v6, -1, 0 +v_mbcnt_hi_u32_b32 v6, -1, v6 +v_and_b32_e32 v7, 31, v6 +v_mov_b32_e32 v8, v0 +v_mov_b32_e32 v9, 0 +v_lshlrev_b32_e32 v12, 4, v0 +v_add_nc_u32_e32 v12, 0x1000, v12 +buffer_store_dwordx4 v[6:9], v12, s[0:3], 0 offen +v_mov_b32_e32 v5, 0 +exp pos0 v5, v5, v5, v5 done +exp param0 v5, v5, v5, v5 +s_endpgm diff --git a/runtime/test/shaders/vs_w64_c_readlane.asm b/runtime/test/shaders/vs_w64_c_readlane.asm new file mode 100644 index 0000000000..d472b1ee59 --- /dev/null +++ b/runtime/test/shaders/vs_w64_c_readlane.asm @@ -0,0 +1,23 @@ +; TEST-251 (SHADER-10 tier C, vertex stage): v_readlane of a varying value (the vertex index) at lanes 40 and 7. In a +; wave64 VS every lane gets the vertex in hardware lane 40 (or 7) of its wave; in a wave32 VS lane 40 wraps or is +; undefined and lane 7 is the vertex of another wave. Vertex v (v0 = vertex index): r0 = readlane 40, r1 = v, +; r2 = readlane 7 (both partition dependent), r3 = 0, stored to its record at heap 0x1000 + 16 * v through the V# in +; s[0:3]. +; Run: VKH_VERTICES=960 VKH_SGPRS=0,0,65536,0x30000000 VKH_HEAP=0=0 VKH_HEAP_DUMP=heap.raw vk_harness +; vs_w64_c_readlane.spv out.raw, with and without RADV_PERFTEST=gewave32: r1 equal, r2 differs. +; mattr: +wavefrontsize64,-wavefrontsize32 +s_mov_b64 s[10:11], exec +v_mov_b32_e32 v4, v0 +v_readlane_b32 s6, v4, 40 +v_readlane_b32 s7, v4, 7 +v_mov_b32_e32 v6, s6 +v_mov_b32_e32 v7, v4 +v_mov_b32_e32 v8, s7 +v_mov_b32_e32 v9, 0 +v_lshlrev_b32_e32 v12, 4, v0 +v_add_nc_u32_e32 v12, 0x1000, v12 +buffer_store_dwordx4 v[6:9], v12, s[0:3], 0 offen +v_mov_b32_e32 v5, 0 +exp pos0 v5, v5, v5, v5 done +exp param0 v5, v5, v5, v5 +s_endpgm diff --git a/runtime/test/shaders/w64_graphics.py b/runtime/test/shaders/w64_graphics.py index 91424af99e..6e281d4b4b 100644 --- a/runtime/test/shaders/w64_graphics.py +++ b/runtime/test/shaders/w64_graphics.py @@ -1,5 +1,5 @@ -"""SHADER-10 GPU checks: wave64 pixel shaders on 32-lane subgroups (docs/design.md, "Wave64 graphics: partition -invariance"). +"""SHADER-10 GPU checks: wave64 pixel and vertex shaders on 32-lane subgroups (docs/design.md, "Wave64 graphics: +partition invariance"). python3 -I runtime/test/shaders/w64_graphics.py [tools dir] [name ...] @@ -16,6 +16,13 @@ checked against the derived words (tiers A, B), the tier C check is skipped, and two environment variables let a second device stand in for the missing size: W64G_SAVE_REF= stores each 64-lane run of a device that can require it, and W64G_REF= compares every run of the other device with those files (equal for A and B, different for C). + +The vs_w64_* fixtures (TEST-251) are vertex shaders: Vulkan cannot require a vertex subgroup size, so the two sizes +come from RADV, which runs the VS stage as wave64 by default and as wave32 with RADV_PERFTEST=gewave32 (GFX10+). +Each draws 960 vertices with zero area (VKH_VERTICES) and stores four words per vertex to the heap; vs_w64_c_lane_id +doubles as the probe that the wave size really changed, and without RADV only the default-size checks run. RADV packs +62 or 64 vertices into a wave64 and 30 or 32 into a wave32, so the 32-lane run is a repacking, not the two halves of +the 64-lane waves: a stricter test of tiers A and B, which key every word on the vertex index. """ import os import struct @@ -106,6 +113,25 @@ def _c_execz_sgpr(i): return (7 if _on(i) else None, _on(i), 0, 0) # r0 = s5: 7 only where the active side ran +# vs_w64_* fixtures: i is the vertex index, x = i % 64 and y = i // 64 as for a pixel. +def _vs_a_skip(i): + x, y = _x(i), _y(i) + return (7 * y + x if x % 4 == 1 else 1000 + x, int(x % 4 == 1), 2000 + y + (9 if y % 4 == 2 else 0), x % 4 + 1) + + +def _vs_b_readlane_uniform(i): + return (_x(i) + 123, 200, _x(i) + 123, 277) + + +def _vs_c_lane_id(i): + return (None, None, i, 0) # r0, r1 = the lane the vertex got + + +VS_ENV = {"VKH_SGPRS": "0,0,65536,0x30000000", "VKH_HEAP": "0=0"} +VS_VERTICES = 960 # 15 rows of 64 vertices: several waves at either size, and partial ones +VS_RECORDS = 0x1000 // 4 # heap word of vertex 0's record (4 words per vertex); below it, the atomic's counter and slots + + # name -> (tier, expected words per pixel (None = not fixed), environment of the draw) FIXTURES = { "ps_w64_a_skip": ("A", _a_skip, {}), @@ -122,13 +148,70 @@ def _c_execz_sgpr(i): "ps_w64_c_vote_else": ("C", _c_vote_else, {}), "ps_w64_c_scc_vote": ("C", _c_scc_vote, {}), "ps_w64_c_execz_sgpr": ("C", _c_execz_sgpr, {}), + "vs_w64_a_skip": ("A", _vs_a_skip, VS_ENV), + "vs_w64_b_waterfall": ("B", _b_waterfall, VS_ENV), + "vs_w64_b_readlane_uniform": ("B", _vs_b_readlane_uniform, dict(VS_ENV, VKH_SGPRS=VS_ENV["VKH_SGPRS"] + ",123")), + "vs_w64_b_ballot_atomic": ("B", _b_ballot, VS_ENV), + "vs_w64_c_bcnt_export": ("C", _c_bcnt, VS_ENV), + "vs_w64_c_readlane": ("C", _c_readlane, VS_ENV), + "vs_w64_c_lane_id": ("C", _vs_c_lane_id, VS_ENV), } +VS_PROBE = "vs_w64_c_lane_id" +_vs_applied = {} + + +def _radv_perftest(size): + """RADV_PERFTEST for a vertex draw at `size`. Vulkan cannot require a vertex subgroup size (requiredSubgroupSizeStages + has no VERTEX on RADV or on the AMD driver), but RADV runs the VS/GS (NGG) stage as wave32 with gewave32 and as + wave64 without it on GFX10+. Other drivers ignore the variable; the probe then finds no change.""" + flags = [f for f in os.environ.get("RADV_PERFTEST", "").split(",") if f and f != "gewave32"] + return ",".join(flags + ["gewave32"] * (size == 32)) + + +def _vs_wave_size(tools, spirv, size, tmp): + """Whether a vertex draw at `size` really ran at that wave size: the largest lane id of VS_PROBE is 32..63 in a + wave64 VS and below 32 in a wave32 one. Size 32 also needs size 64 to work, so that the two draws differ.""" + if size not in _vs_applied: + def top(s): + words = _draw_vs(tools, spirv, VS_PROBE, s, tmp)[0] + return None if words is None else max(w[0] for w in words) + lane64, lane32 = top(64), top(32) + _vs_applied[64] = lane64 is not None and 32 <= lane64 < 64 + _vs_applied[32] = _vs_applied[64] and lane32 is not None and lane32 < 32 + return _vs_applied[size] + + +def _draw_vs(tools, spirv, name, size, tmp): + """(records, heap) of one vertex draw at `size` (None: as the environment says), or (None, message).""" + env = dict(os.environ, **FIXTURES[name][2]) + if size: + env["RADV_PERFTEST"] = _radv_perftest(size) + raw, heap = Path(tmp) / f"{name}.{size}.raw", Path(tmp) / f"{name}.{size}.heap" + env.update(VKH_VERTICES=str(VS_VERTICES), VKH_HEAP_DUMP=str(heap)) + env.pop("VKH_SUBGROUP_SIZE", None) + # The triangles have zero area, so no pixel is drawn and any fragment shader does. + cmd = [os.path.join(tools, "vk_harness" + EXE), os.path.join(spirv, name + ".spv"), + os.path.join(spirv, "ps_w64_a_skip.spv"), str(raw)] + r = subprocess.run(cmd, capture_output=True, text=True, env=env, timeout=120) + out = r.stdout + r.stderr + if r.returncode == UNSUPPORTED: + return None, "unsupported: " + out.strip().splitlines()[-1] + if r.returncode or not heap.is_file(): + return None, f"exit {r.returncode}: {' | '.join(out.strip().splitlines()[-3:])}" + words = list(struct.unpack("<%dI" % (65536 // 4), heap.read_bytes())) + return [tuple(words[VS_RECORDS + 4 * v:VS_RECORDS + 4 * v + 4]) for v in range(VS_VERTICES)], words + def draw(tools, spirv, name, size, tmp): """(words per pixel, heap words or None, applied) of one draw. `applied`: the required size took effect (size None: no size asked, applied is None). The words are None when the draw failed; then `heap` is the message.""" tier, expect, extra = FIXTURES[name] + if name.startswith("vs_"): + words, heap = _draw_vs(tools, spirv, name, size, tmp) + if words is None: + return None, heap, None + return words, heap, _vs_wave_size(tools, spirv, size, tmp) if size else None env = dict(os.environ, **extra) env.pop("VKH_SUBGROUP_SIZE", None) if size: @@ -168,15 +251,16 @@ def expected_problem(name, words, heap): if wrong: i, w, want = wrong[0] return f"{len(wrong)} of {len(words)} pixels differ from the derived words, first ({_x(i)},{_y(i)}): got {w}, want {want}" - if name == "ps_w64_b_ballot_atomic": - want = sorted(_y(i) * W + _x(i) + 1 for i in range(W * H) if _x(i) % 4 == 1) + if name.endswith("_b_ballot_atomic"): + want = sorted(i + 1 for i in range(len(words)) if _x(i) % 4 == 1) n = len(want) if heap[0] != n: return f"counter is {heap[0]}, want {n}" slots = heap[64:64 + n] if sorted(slots) != want: return f"slot words are not the {n} wanted pixel numbers once each ({len(set(slots))} distinct)" - if any(heap[64 + n:]) or any(heap[1:64]): + end = VS_RECORDS if name.startswith("vs_") else len(heap) # the vertex records follow the slots + if any(heap[64 + n:end]) or any(heap[1:64]): return "words outside the counter and the slots were written" return "" @@ -184,7 +268,7 @@ def expected_problem(name, words, heap): def comparable(name, words, heap): """What two draws of the same fixture must share when the shader is partition invariant.""" stable = [tuple(0 if g is None else v for g, v in zip(FIXTURES[name][1](i), w)) for i, w in enumerate(words)] - if name == "ps_w64_b_ballot_atomic": + if name.endswith("_b_ballot_atomic"): return stable, sorted(heap[64:64 + heap[0]]), heap[0] return stable, None, None @@ -240,7 +324,7 @@ def check(tools, spirv, name): if not partition_dependent(name, ref_words, words): return "tier C but the run equals the 64-lane reference: the detector is wrong" compared = True - elif name != "ps_w64_b_ballot_atomic" and comparable(name, ref_words, None) != comparable(name, words, None): + elif not name.endswith("_b_ballot_atomic") and comparable(name, ref_words, None) != comparable(name, words, None): return "the run differs from the 64-lane reference" if tier == "C" and not compared: return Skip("SKIP (tier C needs a device that can require both 64 and 32, or W64G_REF)") diff --git a/runtime/test/typeless_rtv_test.cpp b/runtime/test/typeless_rtv_test.cpp index be935c1232..87fa46acb5 100644 --- a/runtime/test/typeless_rtv_test.cpp +++ b/runtime/test/typeless_rtv_test.cpp @@ -262,9 +262,27 @@ int main() { EXPECT(rejects(wrong, {1, 0, 1, 2, ColorViewFormat::rgba8_srgb}, ReplayResult::invalid_subresource)); wrong = binding; wrong.volume = true; EXPECT(rejects(wrong, {1, 0, 0, 1, ColorViewFormat::rgba8_srgb})); - wrong = binding; wrong.samples = 4; - EXPECT(rejects(wrong, {1, 0, 0, 1, ColorViewFormat::rgba8_uint})); - checks += 8; + { + auto msaa = binding; msaa.samples = 4; + for (const auto [format, expected] : formats) { + CommandList ms_list; + EXPECT(ms_list.clear_render_target({1, 0, 0, 1, format}, color) && ms_list.close()); + EXPECT(run(ms_list, msaa, vk) == ReplayResult::success); + const bool attachment = format != ColorViewFormat::rgba8_unorm; + EXPECT(image_clears == (attachment ? 0u : 1u) && attachment_clears == (attachment ? 1u : 0u)); + EXPECT(!attachment || (requested_format == expected && rendering_layers == 1)); + ++checks; + } + auto msaa_layered = layered; msaa_layered.mip_levels = 1; msaa_layered.samples = 4; + CommandList ms_layer_list; + EXPECT(ms_layer_list.clear_render_target({1, 0, 1, 2, ColorViewFormat::rgba8_srgb}, color) && + ms_layer_list.close()); + EXPECT(run(ms_layer_list, msaa_layered, vk) == ReplayResult::success); + EXPECT(attachment_clears == 1 && requested_format == VK_FORMAT_R8G8B8A8_SRGB); + EXPECT(requested_range.baseArrayLayer == 1 && requested_range.layerCount == 2 && rendering_layers == 2); + ++checks; + } + checks += 7; CommandList list; EXPECT(list.clear_render_target({1, 0, 0, 1, ColorViewFormat::rgba8_srgb}, color) && list.close()); auto unavailable = vk; unavailable.begin_rendering = nullptr; diff --git a/runtime/test/vk_bindless_test.cpp b/runtime/test/vk_bindless_test.cpp index 419a1dda4f..041f6f648d 100644 --- a/runtime/test/vk_bindless_test.cpp +++ b/runtime/test/vk_bindless_test.cpp @@ -902,7 +902,7 @@ int main(int argc, char** argv) { // 2. Without its key the T# is a miss: index 0, the fallback image of zeros. const float zeros[4] = {0, 0, 0, 0}; EXPECT(set.erase_key(tsharp) && !set.erase_key(tsharp)); - EXPECT(set.flush_needs_idle()); // erasing may move the keys behind it; nothing is running here + EXPECT(!set.flush_needs_idle()); // erasing empties its slot only: the three keys ahead stay where they are EXPECT(flush() && !set.flush_needs_idle()); CHECK(draw()); compare("2 miss", zeros); diff --git a/runtime/test/vk_descriptor_bench.cpp b/runtime/test/vk_descriptor_bench.cpp index 07be76abb2..5f5e721c80 100644 --- a/runtime/test/vk_descriptor_bench.cpp +++ b/runtime/test/vk_descriptor_bench.cpp @@ -7,7 +7,7 @@ // dispatch against CPU DescriptorTable::lookup() before timing. // // Usage: -// vk_descriptor_bench [--sizes 1000,10000,100000] [--groups 4096] [--iters 64] [--reps 25] [--warmup 5] +// vk_descriptor_bench [--sizes 1000,10000,100000] [--groups 4096] [--iters 64] [--reps 25] [--warmup 5] [--warmup-ms 300] // [--memory all|device|host|rebar] [--device N] [--list-devices] [--quick] [--csv] // [--dump-spv PREFIX] [--self-test] // LEONIDA_VK_VALIDATION=1 enables VK_LAYER_KHRONOS_validation; any validation error fails the run. @@ -969,6 +969,7 @@ struct Options { std::uint32_t reps = 25u; std::uint32_t warmup = 5u; double max_dispatch_ms = 120.0; + double warmup_ms = 300.0; // keep running the timed dispatch until this much time has passed (0 = off) std::optional device_index; MemoryFilter mem_filter = MemoryFilter::All; bool list_devices = false; @@ -985,6 +986,8 @@ void print_usage() { " --iters N lookups per invocation per dispatch (default: 64)\n" " --reps N timed repetitions per scenario (default: 25)\n" " --warmup N warmup dispatches before timing (default: 5)\n" + " --warmup-ms F then keep dispatching until F ms have passed, so the GPU clocks are up before the\n" + " first timed run, 0=off (default: 300; --quick turns it off)\n" " --max-dispatch-ms F auto-scale slow dispatches to avoid OS TDR, 0=off (default: 120)\n" " --memory MODE all|device|host|rebar (default: all)\n" " --device N select physical device index from --list-devices\n" @@ -1031,6 +1034,7 @@ bool parse_args(int argc, const char* const* argv, Options& opt, bool& show_help opt.groups = 16u; opt.iters = 4u; opt.warmup = 1u; + opt.warmup_ms = 0.0; opt.reps = 3u; } else if (arg == "--groups") { const char* v = nullptr; @@ -1051,6 +1055,13 @@ bool parse_args(int argc, const char* const* argv, Options& opt, bool& show_help const double val = std::strtod(v, &end); if (*v == '\0' || *end != '\0' || !std::isfinite(val) || val < 0.0) return false; opt.max_dispatch_ms = val; + } else if (arg == "--warmup-ms") { + const char* v = nullptr; + if (!need_val(v)) return false; + char* end = nullptr; + const double val = std::strtod(v, &end); + if (*v == '\0' || *end != '\0' || !std::isfinite(val) || val < 0.0) return false; + opt.warmup_ms = val; } else if (arg == "--device") { const char* v = nullptr; std::uint32_t idx = 0u; @@ -1164,6 +1175,19 @@ int run_self_test() { return 1; } + { + const char* const ok_args[] = {"vk_descriptor_bench", "--warmup-ms", "0"}; + const char* const bad_args[] = {"vk_descriptor_bench", "--warmup-ms", "-1"}; + const char* const quick_args[] = {"vk_descriptor_bench", "--quick"}; + Options o_ok, o_bad, o_quick, o_default; + bool h = false; + if (o_default.warmup_ms != 300.0 || !parse_args(3, ok_args, o_ok, h) || o_ok.warmup_ms != 0.0 || + parse_args(3, bad_args, o_bad, h) || !parse_args(2, quick_args, o_quick, h) || o_quick.warmup_ms != 0.0) { + std::fprintf(stderr, "self-test: --warmup-ms parsing or its default is wrong\n"); + return 1; + } + } + const struct { const char* name; ShaderKind kind; @@ -2134,6 +2158,22 @@ int main(int argc, char** argv) { } } + // A handful of dispatches is not enough to bring the clocks up on every GPU: with --warmup 5 an idle + // RX 7600 measured the first placement ~1.8x slower than with --warmup 200, and the RTX 4050 ~1.3x + // (TEST-277). Keep running the command that is about to be timed for --warmup-ms. + if (opt.warmup_ms > 0.0) { + const auto w0 = std::chrono::steady_clock::now(); + for (;;) { + if (!submit_and_wait(bench_cmd)) { + cleanup_all(keys_buf, map_buf); + return 1; + } + const double spent = + std::chrono::duration(std::chrono::steady_clock::now() - w0).count(); + if (spent >= opt.warmup_ms) break; + } + } + std::vector samples_ms; samples_ms.reserve(eff_reps); for (std::uint32_t r = 0; r < eff_reps; ++r) { diff --git a/runtime/test/vk_harness.cpp b/runtime/test/vk_harness.cpp index f7f86fa51b..360a20fa7f 100644 --- a/runtime/test/vk_harness.cpp +++ b/runtime/test/vk_harness.cpp @@ -240,6 +240,17 @@ int main(int argc, char** argv) { return 2; } } + // Translated shaders declare a 144-byte push-constant block (user SGPRs, heap base, code base; see VKH_SGPRS / + // VKH_HEAP); --mesh-compute modules and their vertex shaders add the output address (152 bytes). A device with + // fewer bytes (128, the Vulkan minimum, as on some Intel Arc drivers and AMD's Windows driver for RDNA2 iGPUs) + // cannot take that range: declaring it anyway is invalid, and there a shader reading past the limit crashed or + // hung the device. 77, as vk_texture_test and vk_bindless_test: a device limit, not a wrong result (D3D-14). + const uint32_t pc_bytes = mesh_compute ? 152u : 144u; + if (props.limits.maxPushConstantsSize < pc_bytes) { + std::fprintf(stderr, "unsupported: need %u push constant bytes, device has %u\n", pc_bytes, + props.limits.maxPushConstantsSize); + return 77; + } // VKH_MESH=1: the first shader is a mesh shader (VK_EXT_mesh_shader), drawn with vkCmdDrawMeshTasksEXT(1,1,1). const bool mesh = !mesh_compute && (group_readback || std::getenv("VKH_MESH") != nullptr); VkPhysicalDeviceMeshShaderFeaturesEXT meshf{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT}; @@ -454,12 +465,11 @@ int main(int argc, char** argv) { VkPipelineColorBlendAttachmentState cba{}; cba.colorWriteMask = 0xF; VkPipelineColorBlendStateCreateInfo cb{VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO}; cb.attachmentCount = 1; cb.pAttachments = &cba; - // Translated shaders declare a 144-byte push-constant block (user SGPRs, heap base, code base; see VKH_SGPRS / - // VKH_HEAP); --mesh-compute modules and their vertex shaders add the output address (152 bytes). + // The push-constant block (pc_bytes, checked against the device limit above). const VkShaderStageFlags pcs = (mesh ? VK_SHADER_STAGE_MESH_BIT_EXT : VK_SHADER_STAGE_VERTEX_BIT) | VK_SHADER_STAGE_FRAGMENT_BIT | (gs_path ? VK_SHADER_STAGE_GEOMETRY_BIT : 0) | (mesh_compute ? VK_SHADER_STAGE_COMPUTE_BIT : 0); - VkPushConstantRange pcr{pcs, 0, mesh_compute ? 152u : 144u}; + VkPushConstantRange pcr{pcs, 0, pc_bytes}; VkPipelineLayoutCreateInfo pli{VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO}; pli.pushConstantRangeCount = 1; pli.pPushConstantRanges = &pcr; VkPipelineLayout pl; CHECK(vkCreatePipelineLayout(dev, &pli, nullptr, &pl)); @@ -564,7 +574,6 @@ int main(int argc, char** argv) { std::memcpy(pc, shifts, sizeof(shifts)); } auto push = reinterpret_cast(vkGetDeviceProcAddr(dev, "vkCmdPushConstants")); - const uint32_t pc_bytes = mesh_compute ? 152u : 144u; if (mesh_compute) { // The mesh shader as compute, then make its stores visible to the vertex shader's reads. LOADD(vkCmdDispatch); LOADD(vkCmdPipelineBarrier); @@ -591,7 +600,11 @@ int main(int argc, char** argv) { } vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipe); push(cmd, pl, pcs, 0, pc_bytes, pc); - if (mesh_compute) + // VKH_VERTICES=: draw n vertices instead of one triangle, so a vertex shader fills whole waves (TEST-251). + const char* vertices_env = std::getenv("VKH_VERTICES"); + if (const unsigned vertices = vertices_env ? unsigned(std::strtoul(vertices_env, nullptr, 10)) : 0; vertices && !mesh) + vkCmdDraw(cmd, vertices, 1, 0, 0); + else if (mesh_compute) vkCmdDraw(cmd, uint32_t(mesh_groups * mesh_prims * 3), 1, 0, 0); else if (mesh) reinterpret_cast(vkGetDeviceProcAddr(dev, "vkCmdDrawMeshTasksEXT"))(cmd, groups[0], groups[1], groups[2]); diff --git a/runtime/test/vk_overlapping_occlusion_test.cpp b/runtime/test/vk_overlapping_occlusion_test.cpp index cc9372feb1..2a510d33a2 100644 --- a/runtime/test/vk_overlapping_occlusion_test.cpp +++ b/runtime/test/vk_overlapping_occlusion_test.cpp @@ -135,13 +135,14 @@ struct Draws { std::vector extents; std::size_t next = 0; bool overflow = false; - bool every = false; // --bisect: one 1x1 draw before every end, no schedule + bool every = false; // --bisect: one 1x1 draw before every end, no schedule + bool no_draw = false; // --bisect --no-draw: no draws at all, every query stays empty }; Draws* draws = nullptr; VKAPI_ATTR void VKAPI_CALL end_query_with_draw(VkCommandBuffer cb, VkQueryPool pool, std::uint32_t index) { if (draws->every) { - draws->fixture.draw(cb, 1); + if (!draws->no_draw) draws->fixture.draw(cb, 1); } else if (draws->next == draws->extents.size()) { draws->overflow = true; } else if (const auto extent = draws->extents[draws->next++]) { @@ -159,9 +160,13 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_device_proc(VkDevice device, const // submission is waited for before the next, so the last "running" line before a hang or a lost device names the // pattern. --gated queues them all behind one semaphore the CPU signals afterwards, as the full test does. Named // phases run only those, in the order below. Only completion is checked, not values. +// Two switches separate the draw from the resolve: --no-draw leaves every query empty (no rendering scope inside +// it), --no-resolve records the queries but never copies or sums their results. struct Bisect { bool enabled = false; bool gated = false; + bool no_draw = false; + bool no_resolve = false; std::vector phases; bool wants(const char* name) const { return phases.empty() || std::find(phases.begin(), phases.end(), name) != phases.end(); @@ -184,8 +189,9 @@ int run(vktest::Device& d, const char* vertex, const char* fragment, const Bisec schedule.extents.insert(schedule.extents.end(), 2 * bursts + 1, 1); // The statistics lists below: a split query (two segments), two unsplit references and a second split query. if (d.pipeline_statistics_query) schedule.extents.insert(schedule.extents.end(), {3, 5, 3, 5, 3, 5}); - schedule.extents.insert(schedule.extents.end(), {2, 0, 0, 0}); + schedule.extents.insert(schedule.extents.end(), {2, 0, 0, 0, 1}); schedule.every = bisect.enabled; + schedule.no_draw = bisect.no_draw; draws = &schedule; VulkanContext context(get_device_proc, d.device, true, d.conditional_rendering); EXPECT(context.loaded()); @@ -236,30 +242,37 @@ int run(vktest::Device& d, const char* vertex, const char* fragment, const Bisec if (!bisect.wants(name)) return nullptr; return &lists.emplace_back(name, CommandList{}).second; }; + const auto resolve = [&](CommandList* l, const ResolveQueries& r) { + return bisect.no_resolve || l->resolve_queries(r); + }; if (auto* l = add("crossing")) { // two queries of one heap overlap; resolve while one is active EXPECT(l->begin_query({a, occ, 0}) && l->begin_query({a, occ, 1}) && l->end_query({a, occ, 0})); - EXPECT(l->resolve_queries({a, occ, 0, 1, dst_id, 8}) && l->end_query({a, occ, 1})); - EXPECT(l->resolve_queries({a, occ, 0, 2, dst_id, 24})); + EXPECT(resolve(l, {a, occ, 0, 1, dst_id, 8}) && l->end_query({a, occ, 1})); + EXPECT(resolve(l, {a, occ, 0, 2, dst_id, 24})); + } + if (auto* l = add("active")) { // a resolve inside one active query, without an overlap + EXPECT(l->begin_query({a, occ, 0}) && l->end_query({a, occ, 0}) && l->begin_query({a, occ, 3})); + EXPECT(resolve(l, {a, occ, 0, 1, dst_id, 128}) && l->end_query({a, occ, 3})); } if (auto* l = add("nested")) { // the same index in two heaps, one inside the other EXPECT(l->begin_query({a, occ, 2}) && l->begin_query({b, occ, 2})); EXPECT(l->end_query({b, occ, 2}) && l->end_query({a, occ, 2})); - EXPECT(l->resolve_queries({a, occ, 2, 1, dst_id, 40}) && l->resolve_queries({b, occ, 2, 1, dst_id, 48})); + EXPECT(resolve(l, {a, occ, 2, 1, dst_id, 40}) && resolve(l, {b, occ, 2, 1, dst_id, 48})); } if (auto* l = add("unwritten")) { // a query never begun: zero fill - EXPECT(l->resolve_queries({b, occ, 0, 1, dst_id, 56})); + EXPECT(resolve(l, {b, occ, 0, 1, dst_id, 56})); } if (auto* l = add("binary")) { // the binary-occlusion compute resolve EXPECT(l->begin_query({a, binary, 3}) && l->end_query({a, binary, 3})); - EXPECT(l->resolve_queries({a, binary, 3, 1, dst_id, 64})); + EXPECT(resolve(l, {a, binary, 3, 1, dst_id, 64})); } if (d.conditional_rendering) { if (auto* l = add("predicated")) { // both compute resolves under a false predicate EXPECT(l->begin_query({a, binary, 3}) && l->end_query({a, binary, 3})); EXPECT(l->set_predication({predicate_id, 0, d3d12_predication::equal_zero})); - EXPECT(l->resolve_queries({a, binary, 3, 1, dst_id, 64})); - EXPECT(l->resolve_queries({a, occ, 0, 1, dst_id, 72})); - EXPECT(l->resolve_queries({a, binary, 3, 1, dst_id, 80})); + EXPECT(resolve(l, {a, binary, 3, 1, dst_id, 64})); + EXPECT(resolve(l, {a, occ, 0, 1, dst_id, 72})); + EXPECT(resolve(l, {a, binary, 3, 1, dst_id, 80})); EXPECT(copy_control.record(*l)); } } @@ -267,14 +280,24 @@ int run(vktest::Device& d, const char* vertex, const char* fragment, const Bisec EXPECT(l->begin_query({a, occ, 3})); for (std::uint32_t i = 0; i < bursts; ++i) EXPECT(l->begin_query({b, occ, 0}) && l->end_query({b, occ, 0})); EXPECT(l->end_query({a, occ, 3})); - EXPECT(l->resolve_queries({a, occ, 3, 1, dst_id, 88}) && l->resolve_queries({b, occ, 0, 1, dst_id, 96})); + EXPECT(resolve(l, {a, occ, 3, 1, dst_id, 88}) && resolve(l, {b, occ, 0, 1, dst_id, 96})); } if (auto* l = add("replace")) { // every heap query begun and ended again, then resolved for (const auto& [heap, index] : {std::pair{a, 0u}, std::pair{a, 1u}, std::pair{a, 2u}, std::pair{b, 2u}}) EXPECT(l->begin_query({heap, occ, index}) && l->end_query({heap, occ, index})); - EXPECT(l->resolve_queries({a, occ, 0, 2, dst_id, 112})); + EXPECT(resolve(l, {a, occ, 0, 2, dst_id, 112})); } EXPECT(!lists.empty()); + std::printf("bisect:%s%s%s\n", bisect.gated ? " gated" : " ungated", bisect.no_draw ? " no-draw" : " draws", + bisect.no_resolve ? " no-resolve" : " resolves"); + // After a TDR, AMD's Windows driver lets vkQueueWaitIdle succeed (#1540); every timeline semaphore then reads + // UINT64_MAX, so the gate's value is checked as well as what the context has seen. + const auto get_value = d.fn("vkGetSemaphoreCounterValue"); + const auto lost = [&] { + std::uint64_t value = 0; + return context.is_device_lost() || get_value(d.device, gate.semaphore(), &value) != VK_SUCCESS || + value == UINT64_MAX; + }; if (bisect.gated) queue.wait(gate.semaphore(), 1); for (auto& [name, list] : lists) { EXPECT(list.close()); @@ -286,15 +309,15 @@ int run(vktest::Device& d, const char* vertex, const char* fragment, const Bisec std::printf("%s: execute returned %d\n", name, int(result)); return 1; } - if (!bisect.gated && !queue.idle()) { - std::printf("%s: vkQueueWaitIdle failed (device lost?)\n", name); + if (!bisect.gated && (!queue.idle() || lost())) { + std::printf("%s: device lost\n", name); return 1; } } if (bisect.gated) { EXPECT(gate.signal(1)); - if (!queue.idle()) { - std::printf("gated: vkQueueWaitIdle failed (device lost?)\n"); + if (!queue.idle() || lost()) { + std::printf("gated: device lost\n"); return 1; } } @@ -414,13 +437,22 @@ int run(vktest::Device& d, const char* vertex, const char* fragment, const Bisec EXPECT(replace.close()); const CommandList* fourth[] = {&replace}; EXPECT(queue.execute(fourth) == ReplayResult::success); + + // A resolve inside one active query, with no overlap. + CommandList single; + EXPECT(single.begin_query({a, occ, 3})); + EXPECT(single.resolve_queries({a, occ, 0, 1, dst_id, 128})); + EXPECT(single.end_query({a, occ, 3})); + EXPECT(single.close()); + const CommandList* fifth[] = {&single}; + EXPECT(queue.execute(fifth) == ReplayResult::success); EXPECT(!schedule.overflow && schedule.next == schedule.extents.size()); EXPECT(gate.signal(1)); EXPECT(queue.idle()); std::map expected = { {8, 80}, {24, 80}, {32, 20}, {40, 84}, {48, 16}, {56, 0}, {64, 1}, {72, 80}, {80, 1}, - {88, 2 * bursts + 1}, {96, 1}, {112, 4}, {120, 0}, + {88, 2 * bursts + 1}, {96, 1}, {112, 4}, {120, 0}, {128, 4}, }; if (fixture.statistics) expected[0] = 2 * bursts + 1; // the sum resolved inside the statistics query for (VkDeviceSize offset = 0; offset < size; offset += 8) { @@ -460,7 +492,7 @@ int run(vktest::Device& d, const char* vertex, const char* fragment, const Bisec static_cast(word(0, 0)), static_cast(word(0, 7))); } std::printf("crossing 80/20; nested 84/16; %u segments summed; alternating binary results 1/1; " - "offsets and gated overwrites exact\n", + "resolve inside an active query 4; offsets and gated overwrites exact\n", 2 * bursts + 1); EXPECT(copy_control.check()); return 0; @@ -468,13 +500,15 @@ int run(vktest::Device& d, const char* vertex, const char* fragment, const Bisec } // namespace -// vk_overlapping_occlusion_test [--bisect [--gated] [phase...]] +// vk_overlapping_occlusion_test [--bisect [--gated] [--no-draw] [--no-resolve] [phase...]] int main(int argc, char** argv) { EXPECT(argc >= 3); Bisect bisect; for (int i = 3; i < argc; ++i) { if (std::strcmp(argv[i], "--bisect") == 0) bisect.enabled = true; else if (std::strcmp(argv[i], "--gated") == 0) bisect.gated = true; + else if (std::strcmp(argv[i], "--no-draw") == 0) bisect.no_draw = true; + else if (std::strcmp(argv[i], "--no-resolve") == 0) bisect.no_resolve = true; else bisect.phases.emplace_back(argv[i]); } EXPECT(argc == 3 || bisect.enabled); diff --git a/runtime/test/vk_pipeline_check.cpp b/runtime/test/vk_pipeline_check.cpp index c3172645a6..f7b3fc925a 100644 --- a/runtime/test/vk_pipeline_check.cpp +++ b/runtime/test/vk_pipeline_check.cpp @@ -22,6 +22,12 @@ // --cache-feedback count each stage's successful pipelines by VkPipelineCreationFeedback: hits (VALID and // APPLICATION_PIPELINE_CACHE_HIT), no hit reported (VALID only) and unavailable (no VALID bit, or a // pre-1.3 device without VK_EXT_pipeline_creation_feedback). The three add up to the ok count. +// --isolate (POSIX only) check in child processes, --isolate-batch modules at a time (default 256), so a module +// that kills the driver (SIGFPE, SIGSEGV, ...) is recorded as failed ("MODULE CRASH") and the pass +// goes on. A crashed batch is bisected to the module. Children run one after the other and share +// cache.bin. Not compatible with --stats. +// test hook VK_PIPELINE_CHECK_SIMULATE_CRASH=[:SIGNAL] raises SIGNAL (default SIGFPE) +// just before the pipeline of a matching module is created. Only for testing --isolate. #include "vulkan_loader.h" #include "vk_device_pick.h" #include "pipeline_cache_file.h" @@ -34,6 +40,8 @@ #include #include #include +#include +#include #include #include #include @@ -49,6 +57,13 @@ #include #include +#ifndef _WIN32 +#include +#include +#include +#include +#endif + static PFN_vkGetInstanceProcAddr gipa; struct VertexInputMeta { @@ -283,11 +298,13 @@ struct JsonParser { std::map read_index(const std::string& path, std::string& err) { std::ifstream f(path, std::ios::binary); - std::string s((std::istreambuf_iterator(f)), {}); std::map out; + if (!f) { err = "cannot open the file"; return out; } // a missing index must not read as an empty corpus + std::string s((std::istreambuf_iterator(f)), {}); + if (f.bad()) { err = "read error"; return out; } JsonParser p{s, 0}; p.ws(); - if (p.i >= s.size()) return out; + if (p.i >= s.size()) { err = "the file is empty (an intentionally empty index is {})"; return out; } if (!p.consume('{')) { err = "expected '{' at byte " + std::to_string(p.i); return out; } while (!p.error && p.i < s.size()) { if (p.consume('}')) return out; @@ -383,6 +400,116 @@ static_assert(feedback_outcome(VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT) == 1); static_assert(feedback_outcome(VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT | VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT) == 0); +// Test hook (see the header): VK_PIPELINE_CHECK_SIMULATE_CRASH=[:SIGNAL]. +struct SimulatedCrash { + bool enabled = false; + std::string pattern; + int sig = SIGFPE; +}; + +int signal_from_name(std::string n) { + for (char& c : n) c = static_cast(std::toupper(static_cast(c))); + if (n.rfind("SIG", 0) == 0) n = n.substr(3); + if (n == "FPE") return SIGFPE; + if (n == "SEGV") return SIGSEGV; + if (n == "ABRT") return SIGABRT; + if (n == "ILL") return SIGILL; + if (n == "TERM") return SIGTERM; +#ifndef _WIN32 + if (n == "BUS") return SIGBUS; + if (n == "KILL") return SIGKILL; +#endif + return 0; +} + +SimulatedCrash read_simulated_crash() { + SimulatedCrash c; + const char* env = std::getenv("VK_PIPELINE_CHECK_SIMULATE_CRASH"); + if (!env || !*env) return c; + std::string v = env; + const size_t colon = v.rfind(':'); + if (colon != std::string::npos) { + if (const int sig = signal_from_name(v.substr(colon + 1))) { + c.sig = sig; + v.resize(colon); + } + } + c.enabled = true; + c.pattern = v; + return c; +} + +#ifndef _WIN32 +std::string signal_label(int sig) { + switch (sig) { + case SIGFPE: return "SIGFPE"; + case SIGSEGV: return "SIGSEGV"; + case SIGABRT: return "SIGABRT"; + case SIGILL: return "SIGILL"; + case SIGBUS: return "SIGBUS"; + case SIGKILL: return "SIGKILL"; + case SIGTERM: return "SIGTERM"; + default: return "signal " + std::to_string(sig); + } +} + +// --isolate: one child run of this executable over [start, start + count) of the stage-filtered list. +struct ChildRun { + bool ready = false; // reached the work loop (ISO-READY): Vulkan and the cache were set up + bool done = false; // finished the pass and saved the cache (ISO-DONE) + bool cache_ok = true; + int sig = 0; // killed by this signal + int status = 0; // exit status when it exited + std::string out; // its stdout +}; + +ChildRun run_child(const std::string& exe, const std::string& dir, const std::vector& pass, + const std::string& cache_path, size_t start, size_t count) { + ChildRun r; + std::vector args = {exe, dir}; + if (!cache_path.empty()) args.push_back(cache_path); + for (const auto& a : pass) args.push_back(a); + args.insert(args.end(), {"--isolate-child", "--start", std::to_string(start), "--count", std::to_string(count)}); + std::vector argv; + for (auto& a : args) argv.push_back(a.data()); + argv.push_back(nullptr); + int fds[2]; + if (pipe(fds) != 0) { r.status = 127; return r; } + std::fflush(nullptr); + const pid_t pid = fork(); + if (pid < 0) { close(fds[0]); close(fds[1]); r.status = 127; return r; } + if (pid == 0) { + dup2(fds[1], 1); + close(fds[0]); close(fds[1]); + execv(exe.c_str(), argv.data()); + _exit(127); + } + close(fds[1]); + char buf[4096]; + for (;;) { + const ssize_t n = read(fds[0], buf, sizeof buf); + if (n > 0) r.out.append(buf, size_t(n)); + else if (n < 0 && errno == EINTR) continue; + else break; + } + close(fds[0]); + int st = 0; + while (waitpid(pid, &st, 0) < 0 && errno == EINTR) {} + if (WIFSIGNALED(st)) r.sig = WTERMSIG(st); + else r.status = WIFEXITED(st) ? WEXITSTATUS(st) : 1; + size_t pos = 0; + while (pos < r.out.size()) { + size_t e = r.out.find('\n', pos); + if (e == std::string::npos) e = r.out.size(); + const std::string_view line(r.out.data() + pos, e - pos); + if (line == "ISO-READY") r.ready = true; + else if (line.rfind("ISO-DONE", 0) == 0) { r.done = true; r.cache_ok = line.find("cache_ok=0") == std::string_view::npos; } + pos = e + 1; + } + return r; +} +#endif + } // namespace int main(int argc, char** argv) { @@ -390,7 +517,7 @@ int main(int argc, char** argv) { std::fprintf(stderr, "usage: vk_pipeline_check [cache.bin] [--jobs N] [--start I] [--count N] [--slow SEC] " "[--max-bytes N] [--large-module-bytes N] [--stage all|cs|graphics | --compute-only | --graphics-only] " - "[--stats FILE] [--cache-feedback]\n"); + "[--stats FILE] [--cache-feedback] [--isolate [--isolate-batch N]]\n"); return 2; } std::setvbuf(stdout, nullptr, _IOLBF, 1 << 16); // failures reach a redirected log as they happen @@ -400,7 +527,8 @@ int main(int argc, char** argv) { size_t large_module_bytes = 4 * 1024 * 1024; double slow = 30.0; std::string stage_filter = "all"; - bool cache_feedback = false; + bool cache_feedback = false, isolate = false, iso_child = false; + size_t isolate_batch = 256; for (int i = 2; i < argc; i++) { std::string a = argv[i]; auto value = [&]() -> std::string_view { @@ -428,6 +556,12 @@ int main(int argc, char** argv) { else if (a == "--large-module-bytes") valid = number(large_module_bytes); else if (a == "--stats") valid = !(stats_path = value()).empty(); else if (a == "--cache-feedback") cache_feedback = true; + else if (a == "--isolate") isolate = true; + else if (a == "--isolate-child") iso_child = true; // internal: the parent's child runs + else if (a == "--isolate-batch") { // parsed like the other numbers (#1735); at least one per batch + valid = number(isolate_batch); + isolate_batch = std::max(1, isolate_batch); + } else cache_path = a; if (!valid) { std::fprintf(stderr, "%s requires a valid value\n", a.c_str()); @@ -439,10 +573,21 @@ int main(int argc, char** argv) { return 2; } + if (isolate && !stats_path.empty()) { + std::fprintf(stderr, "--isolate cannot be combined with --stats\n"); + return 2; + } +#ifdef _WIN32 + if (isolate) { + std::fprintf(stderr, "--isolate is not supported on Windows (it needs fork/waitpid); run without it\n"); + return 2; + } +#endif + std::string index_err; auto index = read_index(dir + "/index.json", index_err); if (!index_err.empty()) { - std::fprintf(stderr, "error: malformed JSON in %s/index.json: %s\n", dir.c_str(), index_err.c_str()); + std::fprintf(stderr, "error: cannot use %s/index.json: %s\n", dir.c_str(), index_err.c_str()); return 2; } std::fprintf(stderr, "%zu shaders in index\n", index.size()); @@ -458,6 +603,115 @@ int main(int argc, char** argv) { const auto [lo, hi] = shader_slice(all.size(), start, count); const std::vector work(all.begin() + lo, all.begin() + hi); +#ifndef _WIN32 + if (isolate) { + // Parent: no Vulkan here. Run the check in child processes, one at a time, in batches of --isolate-batch + // modules. A child that dies mid-batch has its output discarded and the batch is bisected until the one + // module that kills the driver is found; the clean sub-runs partition the rest, so nothing is counted twice. + std::string exe = argv[0]; + std::error_code ec; + if (auto self = std::filesystem::read_symlink("/proc/self/exe", ec); !ec) exe = self.string(); + std::vector pass = {"--jobs", std::to_string(jobs), "--slow", std::to_string(slow), "--stage", stage_filter, + "--max-bytes", std::to_string(max_bytes), + "--large-module-bytes", std::to_string(large_module_bytes)}; + if (cache_feedback) pass.push_back("--cache-feedback"); + struct Agg { uint32_t mod_ok = 0, mod_bad = 0, pipe_ok = 0, pipe_bad = 0, pipe_skip = 0, big = 0, crashed = 0, fb[3] = {}; }; + std::map agg; + std::vector crashes; + bool cache_ok = true, setup_failed = false; + size_t unreproduced = 0; + const auto t_iso = std::chrono::steady_clock::now(); + std::fprintf(stderr, "isolating %zu shaders [%zu, %zu) (stage=%s) in child processes, %zu per batch\n", + work.size(), lo, hi, stage_filter.c_str(), isolate_batch); + auto commit = [&](const ChildRun& r) { + size_t pos = 0; + while (pos < r.out.size()) { + size_t e = r.out.find('\n', pos); + if (e == std::string::npos) e = r.out.size(); + const std::string line = r.out.substr(pos, e - pos); + pos = e + 1; + // The parent prints one cache line at the end instead of one per child. + if (line == "ISO-READY" || line.rfind("ISO-DONE", 0) == 0 || line.rfind("pipeline cache: ", 0) == 0) continue; + if (line.rfind("ISO-RESULT ", 0) == 0) { + char st[16]; + unsigned v[9] = {}; + if (std::sscanf(line.c_str(), "ISO-RESULT %15s %u %u %u %u %u %u %u %u %u", st, v, v + 1, v + 2, v + 3, + v + 4, v + 5, v + 6, v + 7, v + 8) == 10) { + Agg& a = agg[st]; + a.mod_ok += v[0]; a.mod_bad += v[1]; a.pipe_ok += v[2]; a.pipe_bad += v[3]; a.pipe_skip += v[4]; + a.big += v[5]; a.fb[0] += v[6]; a.fb[1] += v[7]; a.fb[2] += v[8]; + } + continue; + } + std::printf("%s\n", line.c_str()); + } + std::fflush(stdout); + if (!r.cache_ok) cache_ok = false; + }; + // Returns the number of failures recorded for [s, s + n): crashed modules, or 1 for a crash that vanished. + auto bisect = [&](auto&& self, size_t s, size_t n) -> size_t { + if (setup_failed) return 0; + const ChildRun r = run_child(exe, dir, pass, cache_path, s, n); + if (r.done) { commit(r); return 0; } + if (!r.ready) { // died or exited before the work loop: not a module's fault + std::fputs(r.out.c_str(), stdout); + if (r.sig) std::fprintf(stderr, "error: a child process died during setup (%s)\n", signal_label(r.sig).c_str()); + else std::fprintf(stderr, "error: a child process failed during setup (exit status %d)\n", r.status); + setup_failed = true; + return 0; + } + const std::string why = r.sig ? "driver crashed: " + signal_label(r.sig) + : "driver exited with status " + std::to_string(r.status); + if (n == 1) { + const std::string& name = *all[s].first; + const std::string& st = all[s].second->stage; + std::printf("MODULE CRASH %s (%s, %s)\n", name.c_str(), st.c_str(), why.c_str()); + std::fflush(stdout); + crashes.push_back(name + " (" + st + ", " + why + ")"); + agg[st].pipe_bad++; + agg[st].crashed++; + return 1; + } + std::fprintf(stderr, "child over [%zu, %zu) died (%s); bisecting\n", s, s + n, why.c_str()); + const size_t half = n / 2; + size_t found = self(self, s, half); + found += self(self, s + half, n - half); + if (found == 0 && !setup_failed) { + std::printf("MODULE CRASH [%zu, %zu) not reproduced when split (%s); counted as failed\n", s, s + n, why.c_str()); + ++unreproduced; + return 1; + } + return found; + }; + for (size_t s = lo; s < hi && !setup_failed; s += isolate_batch) bisect(bisect, s, std::min(isolate_batch, hi - s)); + if (setup_failed) return 1; + bool failed = !crashes.empty() || unreproduced || !cache_ok; + for (const auto& [st, a] : agg) { + std::printf("%s: %u modules ok, %u failed\n", st.c_str(), a.mod_ok, a.mod_bad); + std::printf("%s pipelines: %u ok, %u failed, %u skipped\n", st.c_str(), a.pipe_ok, a.pipe_bad, a.pipe_skip); + if (a.crashed) std::printf(" %s crashed the driver: %u (counted as failed)\n", st.c_str(), a.crashed); + if (cache_feedback) + std::printf(" %s cache feedback: %u hits, %u no hit reported, %u unavailable\n", st.c_str(), a.fb[0], a.fb[1], a.fb[2]); + if (a.mod_bad || a.pipe_bad) failed = true; + } + uint32_t big_total = 0; + for (const auto& [st, a] : agg) big_total += a.big; + if (big_total) std::printf("big modules skipped: %u (limit %zu bytes)\n", big_total, max_bytes); + if (!crashes.empty()) { + std::printf("modules that crashed the driver: %zu\n", crashes.size()); + for (const auto& c : crashes) std::printf(" %s\n", c.c_str()); + } + if (unreproduced) std::printf("crashes not reproduced after splitting: %zu\n", unreproduced); + if (!cache_path.empty()) { + const auto sz = std::filesystem::file_size(cache_path, ec); + if (!ec) std::printf("pipeline cache: %ju bytes -> %s\n", static_cast(sz), cache_path.c_str()); + } + std::printf("wall time: %.1fs (isolated)\n", + std::chrono::duration(std::chrono::steady_clock::now() - t_iso).count()); + return failed ? 1 : 0; + } +#endif + // Scan selected shaders to request only the optional extensions they actually use. bool want_mesh = false, want_bary = false, want_lock = false, want_m8 = false, want_fma = false; for (auto& [_, meta] : work) { @@ -800,6 +1054,15 @@ int main(int argc, char** argv) { if (n_done % 250 == 0) std::fprintf(stderr, " pipelines %u (%.0fs elapsed)\n", n_done, elapsed()); }; + const SimulatedCrash sim_crash = read_simulated_crash(); + auto maybe_simulate_crash = [&](const std::string& name) { // test hook, see the header + if (sim_crash.enabled && name.find(sim_crash.pattern) != std::string::npos) { + std::fprintf(stderr, "simulating signal %d before the pipeline of %s\n", sim_crash.sig, name.c_str()); + std::fflush(nullptr); + std::raise(sim_crash.sig); + } + }; + auto worker = [&] { for (size_t k; (k = next++) < work.size();) { const std::string& name = *work[k].first; @@ -871,6 +1134,7 @@ int main(int argc, char** argv) { const auto t0 = std::chrono::steady_clock::now(); { std::lock_guard g(mu); inflight[std::this_thread::get_id()] = {name, t0}; } VkPipeline p = VK_NULL_HANDLE; + maybe_simulate_crash(name); VkResult r = vkCreateComputePipelines(dev, cache, 1, &cpi, nullptr, &p); const double sec = std::chrono::duration(std::chrono::steady_clock::now() - t0).count(); if (r == VK_SUCCESS) write_stats(name, stage, VK_SHADER_STAGE_COMPUTE_BIT, p); @@ -1040,6 +1304,7 @@ int main(int argc, char** argv) { const auto t0 = std::chrono::steady_clock::now(); { std::lock_guard g(mu); inflight[std::this_thread::get_id()] = {name, t0}; } VkPipeline p = VK_NULL_HANDLE; + maybe_simulate_crash(name); VkResult r = vkCreateGraphicsPipelines(dev, cache, 1, &gpci, nullptr, &p); const double sec = std::chrono::duration(std::chrono::steady_clock::now() - t0).count(); if (r == VK_SUCCESS) write_stats(name, stage, stage_bit(stage), p); @@ -1057,6 +1322,8 @@ int main(int argc, char** argv) { } } }; + if (iso_child) std::printf("ISO-READY\n"); + std::fflush(stdout); std::vector pool; for (uint32_t t = 0; t < jobs; t++) pool.emplace_back(worker); // Watchdog: names every compile running past 60 s (about once a minute) and saves the cache every 10 minutes. @@ -1095,6 +1362,20 @@ int main(int argc, char** argv) { for (auto& [st, _] : modules_bad) all_stages.insert(st); for (auto& [st, _] : stats) all_stages.insert(st); + if (iso_child) { // --isolate child: machine-readable counts; the parent prints the summary + for (const auto& st : all_stages) { + const StageStats* s = stats.count(st) ? &stats[st] : nullptr; + uint32_t big = big_skipped.count(st) ? big_skipped[st] : 0; + std::printf("ISO-RESULT %s %u %u %u %u %u %u %u %u %u\n", st.c_str(), modules_ok[st], modules_bad[st], + s ? s->pipes_ok : 0u, s ? s->pipes_bad : 0u, s ? s->pipes_skipped : 0u, big, + s ? s->feedback[0] : 0u, s ? s->feedback[1] : 0u, s ? s->feedback[2] : 0u); + } + const bool saved = save_cache(true); + std::printf("ISO-DONE cache_ok=%d\n", saved ? 1 : 0); + std::fflush(stdout); + return saved ? 0 : 1; + } + bool check_failed = false; for (const auto& st : all_stages) { std::printf("%s: %u modules ok, %u failed\n", st.c_str(), modules_ok[st], modules_bad[st]); diff --git a/runtime/test/vk_presenter_sync_test.cpp b/runtime/test/vk_presenter_sync_test.cpp index 46a2531ef6..8f5c7d7d04 100644 --- a/runtime/test/vk_presenter_sync_test.cpp +++ b/runtime/test/vk_presenter_sync_test.cpp @@ -21,10 +21,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -220,20 +222,36 @@ int main() { // Next present succeeds, runs the deferred zero-fill, commits GENERAL, and unlocks tracker_mutex_ before // vkQueuePresentKHR so other threads' emit() / layout() calls are not blocked by presentation. - std::atomic read_done{false}; + std::mutex sync_mutex; + std::condition_variable sync_cv; + bool reader_started = false; + bool read_done = false; VkImageLayout seen_during_present = VK_IMAGE_LAYOUT_UNDEFINED; bool unblocked_during_present = false; std::thread reader; driver::on_next_present = [&] { reader = std::thread([&] { - seen_during_present = context.layout(1, 0); - read_done.store(true, std::memory_order_release); + { + std::lock_guard lk(sync_mutex); + reader_started = true; + } + sync_cv.notify_all(); + const VkImageLayout layout = context.layout(1, 0); + { + std::lock_guard lk(sync_mutex); + seen_during_present = layout; + read_done = true; + } + sync_cv.notify_all(); }); - std::this_thread::sleep_for(std::chrono::milliseconds(30)); - unblocked_during_present = read_done.load(std::memory_order_acquire); + std::unique_lock lk(sync_mutex); + const bool started = sync_cv.wait_for(lk, std::chrono::seconds(2), [&] { return reader_started; }); + unblocked_during_present = + started && sync_cv.wait_for(lk, std::chrono::milliseconds(500), [&] { return read_done; }); }; - EXPECT(presenter.present(1, true) == VK_SUCCESS); + const VkResult present_rc = presenter.present(1, true); if (reader.joinable()) reader.join(); + EXPECT(present_rc == VK_SUCCESS); EXPECT(unblocked_during_present); EXPECT(seen_during_present == VK_IMAGE_LAYOUT_GENERAL); EXPECT(context.layout(1, 0) == VK_IMAGE_LAYOUT_GENERAL); diff --git a/runtime/test/vk_test_device.h b/runtime/test/vk_test_device.h index 635a3107b5..1e54a94879 100644 --- a/runtime/test/vk_test_device.h +++ b/runtime/test/vk_test_device.h @@ -1,10 +1,12 @@ -// Shared setup for the GPU tests of the D3D12 layer: a Vulkan 1.3 device with dynamicRendering, synchronization2, -// timelineSemaphore and separateDepthStencilLayouts, images, buffers and one-shot submissions. +// Shared setup for the GPU tests of the D3D12 layer: a Vulkan 1.3 device (or 1.2 with VK_KHR_dynamic_rendering and +// VK_KHR_synchronization2) with dynamicRendering, synchronization2, timelineSemaphore and +// separateDepthStencilLayouts, images, buffers and one-shot submissions. // Set LEONIDA_VK_VALIDATION=1 to run under VK_LAYER_KHRONOS_validation; Device::validation_errors() counts errors. #pragma once #include "vulkan_loader.h" #include "../src/vulkan_device_filter.h" +#include "../src/vulkan13_features.h" #include "vk_device_pick.h" #include "../src/subgroup_size.h" @@ -82,6 +84,12 @@ class Device { VkDevice device = VK_NULL_HANDLE; VkQueue queue = VK_NULL_HANDLE; std::uint32_t family = 0; + // Set before initialize(): how many queues of `family` to create (fewer if the family has fewer). `queues` holds the + // handles; queues[0] == queue. A test that wants distinct VkQueues for its D3D12 queues passes them on as + // VulkanDeviceInfo::command_queues when there is more than one. + std::uint32_t queue_count_wanted = 1; + std::uint32_t family_queue_count = 1; // the family's queueCount, known after the device is chosen + std::vector queues; bool validation = false; bool bc = false; // textureCompressionBC enabled VkPhysicalDeviceFeatures enabled{}; // the core features enabled on `device` @@ -134,9 +142,10 @@ class Device { reinterpret_cast(instance_proc(instance, "vkDestroyInstance"))(instance, nullptr); } + // A Vulkan 1.3 function falls back to its KHR name on a 1.2 device. template F fn(const char* name) const { - return reinterpret_cast(device_proc(device, name)); + return reinterpret_cast(leonida::device_proc_or_khr(device_proc, device, name)); } template @@ -263,10 +272,16 @@ class Device { if (result != VK_SUCCESS) return failure("vkEnumeratePhysicalDevices", result); VkPhysicalDeviceProperties chosen{}; int best_rank = -1; + const auto features2_of = instance_fn("vkGetPhysicalDeviceFeatures2"); + const auto device_extensions_of = + instance_fn("vkEnumerateDeviceExtensionProperties"); + leonida::Vulkan13Features candidate13; for (auto candidate : devices) { VkPhysicalDeviceProperties props{}; properties_of(candidate, &props); - if (props.apiVersion < VK_API_VERSION_1_3 || !leonida::vulkan_device_wanted(props.deviceName)) continue; + if (!leonida::vulkan_device_wanted(props.deviceName)) continue; + candidate13.query(candidate, props.apiVersion, features2_of, device_extensions_of); + if (!candidate13.usable()) continue; std::uint32_t family_count = 0; families_of(candidate, &family_count, nullptr); std::vector families(family_count); @@ -277,8 +292,10 @@ class Device { rank > best_rank) { physical = candidate; family = i; + family_queue_count = families[i].queueCount; chosen = props; best_rank = rank; + v13_.choose(candidate13); } break; } @@ -286,22 +303,25 @@ class Device { if (!physical) { if (const std::string filter = leonida::vulkan_device_filter(); !filter.empty()) { // A filter that matches nothing fails the test instead of skipping it. - std::fprintf(stderr, "LEONIDA_VK_DEVICE=%s: no Vulkan 1.3 device with a graphics queue matches\n", + std::fprintf(stderr, + "LEONIDA_VK_DEVICE=%s: no Vulkan 1.3 device (or 1.2 with VK_KHR_dynamic_rendering and " + "VK_KHR_synchronization2) with a graphics queue matches\n", filter.c_str()); return DeviceStatus::failed; } - std::fprintf(stderr, "no Vulkan 1.3 device with a graphics queue\n"); + std::fprintf(stderr, "no Vulkan 1.3 device (or 1.2 with VK_KHR_dynamic_rendering and " + "VK_KHR_synchronization2) with a graphics queue\n"); return DeviceStatus::unavailable; } - std::printf("device: %s%s\n", chosen.deviceName, validation ? " (validation on)" : ""); + std::printf("device: %s%s%s\n", chosen.deviceName, v13_.core ? "" : " (Vulkan 1.2 + KHR extensions)", + validation ? " (validation on)" : ""); - VkPhysicalDeviceVulkan13Features features13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; - VkPhysicalDeviceVulkan11Features features11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &features13}; + VkPhysicalDeviceVulkan11Features features11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES}; VkPhysicalDeviceVulkan12Features features12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &features11}; VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &features12}; - instance_fn("vkGetPhysicalDeviceFeatures2")(physical, &features); - if (!features13.dynamicRendering || !features13.synchronization2 || !features12.timelineSemaphore || - !features12.separateDepthStencilLayouts || !features12.bufferDeviceAddress) { + features2_of(physical, &features); + if (!features12.timelineSemaphore || !features12.separateDepthStencilLayouts || + !features12.bufferDeviceAddress) { std::fprintf(stderr, "the device lacks dynamicRendering, synchronization2, timelineSemaphore or " "separateDepthStencilLayouts\n"); return DeviceStatus::unavailable; @@ -327,14 +347,8 @@ class Device { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT}; enable_conditional.conditionalRendering = VK_TRUE; - VkPhysicalDeviceVulkan13Features enable13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES, - conditional_rendering ? &enable_conditional : nullptr}; - enable13.dynamicRendering = VK_TRUE; - enable13.synchronization2 = VK_TRUE; - enable13.subgroupSizeControl = features13.subgroupSizeControl; - enable13.computeFullSubgroups = features13.computeFullSubgroups; leonida::query_subgroup_size_caps(instance_fn("vkGetPhysicalDeviceProperties2"), - physical, features13.subgroupSizeControl, features13.computeFullSubgroups, + physical, v13_.subgroup_size_control, v13_.compute_full_subgroups, subgroup); std::printf("subgroup sizes: %u..%u (default %u), requirable in stages 0x%x, subgroupSizeControl %s, " "computeFullSubgroups %s\n", @@ -342,7 +356,8 @@ class Device { subgroup.subgroup_size_control ? "on" : "off", subgroup.compute_full_subgroups ? "on" : "off"); // shaderDrawParameters, where available: translated vertex shaders will read BaseVertex and BaseInstance once PR 436 // (zero-based VS ids) is in; harmless before. - VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &enable13}; + VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, + v13_.enable(conditional_rendering ? &enable_conditional : nullptr)}; enable11.shaderDrawParameters = features11.shaderDrawParameters; VkPhysicalDeviceVulkan12Features enable12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &enable11}; enable12.timelineSemaphore = VK_TRUE; @@ -369,11 +384,11 @@ class Device { enable12.samplerFilterMinmax = sampler_filter_minmax; enable12.bufferDeviceAddress = VK_TRUE; - const float priority = 1.0f; + const std::vector priority(std::max(1u, std::min(queue_count_wanted, family_queue_count)), 1.0f); VkDeviceQueueCreateInfo queue_info{VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO}; queue_info.queueFamilyIndex = family; - queue_info.queueCount = 1; - queue_info.pQueuePriorities = &priority; + queue_info.queueCount = std::max(1u, std::min(queue_count_wanted, family_queue_count)); + queue_info.pQueuePriorities = priority.data(); VkPhysicalDeviceFeatures enable{}; enable.textureCompressionBC = features.features.textureCompressionBC; // BC uploads, where available enable.shaderInt64 = features.features.shaderInt64; // translated shaders declare Int64 (index features) @@ -399,8 +414,8 @@ class Device { instance_fn("vkGetPhysicalDeviceFeatures2")(physical, &query); image_view_min_lod = min_lod.minLod == VK_TRUE; if (image_view_min_lod) { - min_lod.pNext = enable13.pNext; - enable13.pNext = &min_lod; + min_lod.pNext = *v13_.next(); + *v13_.next() = &min_lod; } } VkPhysicalDeviceHostImageCopyFeaturesEXT host_copy{ @@ -413,8 +428,8 @@ class Device { } const char* host_image_copy_name = VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME; if (host_image_copy) { - host_copy.pNext = enable13.pNext; // after the conditional rendering features, if any - enable13.pNext = &host_copy; + host_copy.pNext = *v13_.next(); // after the conditional rendering features, if any + *v13_.next() = &host_copy; } #ifdef VK_KHR_SHADER_FMA_EXTENSION_NAME @@ -427,8 +442,8 @@ class Device { instance_fn("vkGetPhysicalDeviceFeatures2")(physical, &query); shader_fma = fma_features.shaderFmaFloat32 == VK_TRUE; if (shader_fma) { - fma_features.pNext = enable13.pNext; - enable13.pNext = &fma_features; + fma_features.pNext = *v13_.next(); + *v13_.next() = &fma_features; } } #endif @@ -442,6 +457,7 @@ class Device { device_info.pEnabledFeatures = &enable; enabled = enable; std::vector device_extensions; + v13_.add_extensions(device_extensions); if (image_view_min_lod) device_extensions.push_back(VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME); if (conditional_rendering) device_extensions.push_back(conditional_extension); if (host_image_copy) device_extensions.push_back(host_image_copy_name); @@ -462,8 +478,8 @@ class Device { VkPhysicalDeviceFeatures2 query{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &swapchain_m1}; instance_fn("vkGetPhysicalDeviceFeatures2")(physical, &query); if (swapchain_m1.swapchainMaintenance1 == VK_TRUE) { - swapchain_m1.pNext = enable13.pNext; - enable13.pNext = &swapchain_m1; + swapchain_m1.pNext = *v13_.next(); + *v13_.next() = &swapchain_m1; device_extensions.push_back(name); swapchain_maintenance1 = true; } @@ -478,7 +494,10 @@ class Device { result = instance_fn("vkCreateDevice")(physical, &device_info, nullptr, &device); if (result != VK_SUCCESS) return failure("vkCreateDevice", result); device_proc = instance_fn("vkGetDeviceProcAddr"); - fn("vkGetDeviceQueue")(device, family, 0, &queue); + queues.resize(queue_info.queueCount); + for (std::uint32_t i = 0; i < queue_info.queueCount; ++i) + fn("vkGetDeviceQueue")(device, family, i, &queues[i]); + queue = queues[0]; instance_fn("vkGetPhysicalDeviceMemoryProperties")(physical, &memory_); VkCommandPoolCreateInfo pool{VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO}; @@ -628,6 +647,7 @@ class Device { VkDebugUtilsMessengerEXT messenger_ = VK_NULL_HANDLE; VkCommandPool pool_ = VK_NULL_HANDLE; VkPhysicalDeviceMemoryProperties memory_{}; + leonida::Vulkan13Features v13_; // the chosen device's dynamicRendering/synchronization2 path std::vector> images_; std::vector> buffers_; }; diff --git a/runtime/test/vk_xdxr_build_test.cpp b/runtime/test/vk_xdxr_build_test.cpp index 6f354b2b23..1f4686869f 100644 --- a/runtime/test/vk_xdxr_build_test.cpp +++ b/runtime/test/vk_xdxr_build_test.cpp @@ -6,7 +6,8 @@ // // Cases: one triangle; five (two levels); 1000 random triangles; an indexed R16 grid with a 16-byte vertex stride; // R32 indices with R32G32 vertices; a geometry transform; two geometries with an inactive (NaN) triangle; no -// triangles; 5000 triangles (many radix-sort tiles); updates (refits) in place and into another buffer; a TLAS of four instances (rotated and scaled, one with mask 0, one with no BLAS). +// triangles; 5000 triangles (many radix-sort tiles); updates (refits) in place and into another buffer; clones and a +// compaction (CopyRaytracingAccelerationStructure) with the postbuild size; a TLAS of four instances (rotated and scaled, one with mask 0, one with no BLAS). // Exit 77 when there is no Vulkan device with bufferDeviceAddress. // `vk_xdxr_build_test ` instead times BLAS builds of that many random triangles (wall clock of // one submission each, after one warm-up; result and scratch in device-local memory), then in-place updates @@ -431,6 +432,67 @@ int main(int argc, char** argv) { } json2 += "]}\n"; EXPECT(write_file(dir + "/tlas_refit.json", json2.data(), json2.size())); + + // CopyRaytracingAccelerationStructure: a clone of blas_random, its COMPACTED_SIZE (postbuild), a compaction into + // a buffer of exactly that size, and a clone of the refitted TLAS. The copies are position-independent. + { + XdxrLayout blas_layout; + EXPECT(blas_layout.compute(1000, false)); + Buffer clone = make(gpu, blas_layout.size + 256), info = make(gpu, 16); + EXPECT(clone.buffer && info.buffer); + const std::uint64_t clone_at = (clone.address + 255) & ~std::uint64_t(255); + std::memset(info.map, 0xab, 16); + EXPECT(gpu.run([&](VkCommandBuffer cb) { + const bool ok = builder.record_copy(cb, random.address, clone_at, blas_layout.size) && + builder.record_postbuild(cb, random.address, info.address) && + builder.record_postbuild(cb, clone_at, info.address + 8); + barrier_to_host(gpu, cb); + return ok; + })); + std::uint64_t compacted = 0, clone_size = 0; + std::memcpy(&compacted, info.map, 8); + std::memcpy(&clone_size, static_cast(info.map) + 8, 8); + EXPECT(compacted == blas_layout.size); // a build is exactly its layout's size + EXPECT(clone_size == compacted); + auto dump_blas = [&](const std::string& name, const Buffer& b, std::uint64_t at, std::size_t bytes) { + const std::string j = "{\"kind\": \"blas\", \"address\": " + std::to_string(at) + + ", \"triangles\": " + tris_json(random.tris) + "}\n"; + return write_file(dir + "/" + name + ".bin", static_cast(b.map) + (at - b.address), bytes) && + write_file(dir + "/" + name + ".json", j.data(), j.size()); + }; + EXPECT(dump_blas("blas_clone", clone, clone_at, blas_layout.size)); + // COMPACT into exactly the compacted size; a guard word after it must survive + Buffer packed = make(gpu, std::size_t(compacted) + 256 + 4); + EXPECT(packed.buffer); + const std::uint64_t packed_at = (packed.address + 255) & ~std::uint64_t(255); + const std::uint32_t guard = 0x600dc0deu; + std::memcpy(static_cast(packed.map) + (packed_at - packed.address) + compacted, &guard, 4); + EXPECT(gpu.run([&](VkCommandBuffer cb) { + const bool ok = builder.record_copy(cb, clone_at, packed_at, compacted + 4); // more room than needed + barrier_to_host(gpu, cb); + return ok; + })); + std::uint32_t after = 0; + std::memcpy(&after, static_cast(packed.map) + (packed_at - packed.address) + compacted, 4); + EXPECT(after == guard); // the copy stops at the source's own size + EXPECT(dump_blas("blas_compacted", packed, packed_at, std::size_t(compacted))); + + Buffer tclone = make(gpu, layout.size + 256); + EXPECT(tclone.buffer); + const std::uint64_t tclone_at = (tclone.address + 255) & ~std::uint64_t(255); + EXPECT(gpu.run([&](VkCommandBuffer cb) { + const bool ok = builder.record_copy(cb, base, tclone_at, layout.size); + barrier_to_host(gpu, cb); + return ok; + })); + EXPECT(write_file(dir + "/tlas_refit_clone.bin", static_cast(tclone.map) + (tclone_at - tclone.address), + layout.size)); + std::string json3 = json2; + json3.replace(json3.find(std::to_string(base)), std::to_string(base).size(), std::to_string(tclone_at)); + EXPECT(write_file(dir + "/tlas_refit_clone.json", json3.data(), json3.size())); + std::printf("copies: blas_clone, blas_compacted (%llu bytes), tlas_refit_clone\n", + static_cast(compacted)); + } std::printf("tlas: %u instances, %u bytes\nvk_xdxr_build_test: built every case\n", count, layout.size); return 0; } diff --git a/runtime/test/xgameruntime_test.cpp b/runtime/test/xgameruntime_test.cpp index ac36f40d96..8f50576627 100644 --- a/runtime/test/xgameruntime_test.cpp +++ b/runtime/test/xgameruntime_test.cpp @@ -51,8 +51,36 @@ using AsyncCompleteFn = void(__stdcall*)(XAsyncBlock*, HRESULT, size_t); using AsyncResultSizeFn = HRESULT(__stdcall*)(XAsyncBlock*, size_t*); using AsyncResultFn = HRESULT(__stdcall*)(XAsyncBlock*, const void*, size_t, void*, size_t*); +struct XVersion { + union { + struct { + uint16_t major; + uint16_t minor; + uint16_t build; + uint16_t revision; + }; + uint64_t Value; + }; +}; +static_assert(sizeof(XVersion) == 8, "XVersion must be 8 bytes per GDK spec"); + +struct XSystemAnalyticsInfo { + XVersion osVersion; + XVersion hostingOsVersion; + char family[64]; + char form[64]; +}; +static_assert(sizeof(XSystemAnalyticsInfo) == 144, "XSystemAnalyticsInfo must be 144 bytes per GDK spec"); + +using AnalyticsInfoFn = XSystemAnalyticsInfo(__stdcall*)(); +using PackageIdentifierFn = HRESULT(__stdcall*)(size_t, char*); +using PackageMountPathFn = HRESULT(__stdcall*)(void*, size_t, char*); +using PackagedProcessFn = bool(__stdcall*)(); + const char* const kNames[] = { "XGameRuntimeInitialize", "XGameRuntimeUninitialize", "XSystemGetDeviceType", "XSystemGetConsoleId", + "XSystemGetAnalyticsInfo", "XPackageGetCurrentProcessPackageIdentifier", "XPackageGetMountPath", + "XPackageIsPackagedProcess", "XTaskQueueCreate", "XTaskQueueCreateComposite", "XTaskQueueGetPort", "XTaskQueueDuplicateHandle", "XTaskQueueCloseHandle", "XTaskQueueTerminate", "XTaskQueueDispatch", "XTaskQueueSubmitCallback", "XTaskQueueSubmitDelayedCallback", "XTaskQueueRegisterWaiter", "XTaskQueueUnregisterWaiter", @@ -182,6 +210,89 @@ void check_run_time_load() { void* out = reinterpret_cast(1); check(query(&some_class, some_class, &out) == static_cast(0x80070032) && out == nullptr, "QueryApiImpl refuses a class it doesn't provide yet (HRESULT 0x80070032) and clears the out pointer"); + + // XThreadingImpl and XErrorImpl, driven the way xgameruntime.lib's thunks in the package's DLLs do: QueryApiImpl + // with the class id as both ids, one vtable slot with `this` first, then Release (slot 2). + const GUID threading = {0x073b7dcb, 0x1fcf, 0x4030, {0x94, 0xbe, 0xe3, 0xc9, 0xeb, 0x62, 0x34, 0x28}}; + const GUID error_cls = {0x8ca467f7, 0x22e8, 0x4096, {0x84, 0x56, 0xbb, 0x8a, 0xa1, 0x3f, 0x79, 0xd8}}; + using Fn = void*; + auto slot = [](void* obj, int index) { return (*static_cast(obj))[index]; }; + auto release = [&](void* obj) { reinterpret_cast(slot(obj, 2))(obj); }; + auto get = [&](const GUID& cls) { + void* p = nullptr; + return query(&cls, cls, &p) == S_OK ? p : nullptr; + }; + void* t = get(threading); + check(t != nullptr, "QueryApiImpl hands out XThreadingImpl for its class id"); + if (t) { + void* again = get(threading); + check(again == t, "XThreadingImpl is one process-wide object"); + release(again); + XTaskQueueHandle queue = nullptr; + using Create = HRESULT(STDMETHODCALLTYPE*)(void*, XTaskQueueDispatchMode, XTaskQueueDispatchMode, + XTaskQueueHandle*); + check(reinterpret_cast(slot(t, 12))(t, XTaskQueueDispatchMode::Manual, XTaskQueueDispatchMode::Manual, + &queue) == S_OK && queue, + "slot 12 is XTaskQueueCreate"); + static std::atomic s_ran{0}; + using Submit = HRESULT(STDMETHODCALLTYPE*)(void*, XTaskQueueHandle, XTaskQueuePort, void*, + XTaskQueueCallback*); + XTaskQueueCallback* cb = [](void* ctx, bool canceled) { + if (!canceled) static_cast*>(ctx)->fetch_add(1); + }; + check(reinterpret_cast(slot(t, 18))(t, queue, XTaskQueuePort::Work, &s_ran, cb) == S_OK, + "slot 18 is XTaskQueueSubmitCallback"); + using Dispatch = bool(STDMETHODCALLTYPE*)(void*, XTaskQueueHandle, XTaskQueuePort, uint32_t); + check(reinterpret_cast(slot(t, 16))(t, queue, XTaskQueuePort::Work, 0) && s_ran.load() == 1, + "slot 16 is XTaskQueueDispatch: the callback ran on the work port"); + XTaskQueueHandle dup = nullptr; + using Dup = HRESULT(STDMETHODCALLTYPE*)(void*, XTaskQueueHandle, XTaskQueueHandle*); + check(reinterpret_cast(slot(t, 15))(t, queue, &dup) == S_OK && dup, + "slot 15 is XTaskQueueDuplicateHandle"); + using Close = void(STDMETHODCALLTYPE*)(void*, XTaskQueueHandle); + reinterpret_cast(slot(t, 17))(t, dup); + reinterpret_cast(slot(t, 17))(t, queue); + using SetSensitive = HRESULT(STDMETHODCALLTYPE*)(void*, bool); + using IsSensitive = bool(STDMETHODCALLTYPE*)(void*); + check(reinterpret_cast(slot(t, 27))(t, true) == S_OK && + reinterpret_cast(slot(t, 30))(t) && + reinterpret_cast(slot(t, 27))(t, false) == S_OK && + !reinterpret_cast(slot(t, 30))(t), + "slots 27 and 30 set and read this thread's time-sensitive flag"); + void* unk = nullptr; + const GUID iunknown = {0, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}}; + using QI = HRESULT(STDMETHODCALLTYPE*)(void*, REFIID, void**); + check(reinterpret_cast(slot(t, 0))(t, iunknown, &unk) == S_OK && unk == t && + reinterpret_cast(slot(t, 0))(t, error_cls, &unk) == E_NOINTERFACE && !unk, + "QueryInterface answers IUnknown and the class id, not another class"); + release(t); + release(t); + } + void* e = get(error_cls); + check(e != nullptr, "QueryApiImpl hands out XErrorImpl for its class id"); + if (e) { + struct Seen { + HRESULT hr; + char msg[32]; + } seen{}; + using Callback = bool(CALLBACK*)(HRESULT, const char*, void*); + Callback on_error = [](HRESULT hr, const char* msg, void* ctx) { + auto* s = static_cast(ctx); + s->hr = hr; + strncpy_s(s->msg, msg ? msg : "", _TRUNCATE); + return true; + }; + using SetCallback = void(STDMETHODCALLTYPE*)(void*, Callback, void*); + using Report = void(STDMETHODCALLTYPE*)(void*, HRESULT, const char*); + reinterpret_cast(slot(e, 4))(e, on_error, &seen); + reinterpret_cast(slot(e, 3))(e, E_FAIL, "offline test"); + check(seen.hr == E_FAIL && std::strcmp(seen.msg, "offline test") == 0, + "slot 3 is XErrorReport and reaches the callback slot 4 (XErrorSetCallback) set"); + reinterpret_cast(slot(e, 4))(e, nullptr, nullptr); + using SetOptions = HRESULT(STDMETHODCALLTYPE*)(void*, uint32_t, uint32_t); + check(reinterpret_cast(slot(e, 5))(e, 0, 0) == S_OK, "slot 5 is XErrorSetOptions"); + release(e); + } check(uninit_api() == S_OK, "UninitializeApiImpl succeeds"); HMODULE k32 = load_w(L"kernel32.dll"); @@ -229,6 +340,53 @@ int main() { check(console_id(sizeof(id), id, &used) == S_OK && used == 39 && std::strlen(id) == 38, "XSystemGetConsoleId fills 39 bytes (38 characters and the terminator)"); + auto analytics_info = get("XSystemGetAnalyticsInfo"); + XSystemAnalyticsInfo info = analytics_info(); + check(info.osVersion.major == 10 && info.osVersion.minor == 0 && info.osVersion.build == 22000 && + info.osVersion.revision == 0, + "XSystemGetAnalyticsInfo returns osVersion 10.0.22000.0"); + check(info.hostingOsVersion.major == 10 && info.hostingOsVersion.minor == 0 && + info.hostingOsVersion.build == 22000 && info.hostingOsVersion.revision == 0, + "XSystemGetAnalyticsInfo returns hostingOsVersion 10.0.22000.0"); + check(std::strcmp(info.family, "Xbox") == 0, "XSystemGetAnalyticsInfo returns family 'Xbox'"); + check(std::strcmp(info.form, "Xbox Series X") == 0, "XSystemGetAnalyticsInfo returns form 'Xbox Series X'"); + + auto package_id = get("XPackageGetCurrentProcessPackageIdentifier"); + check(package_id(0, nullptr) == E_INVALIDARG, "XPackageGetCurrentProcessPackageIdentifier rejects null buffer and size 0"); + char pkg_id[64] = {}; + check(package_id(0, pkg_id) == E_INVALIDARG, "XPackageGetCurrentProcessPackageIdentifier rejects size 0 with buffer"); + check(package_id(10, nullptr) == E_INVALIDARG, "XPackageGetCurrentProcessPackageIdentifier rejects null pointer with size"); + check(package_id(16, pkg_id) == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), + "XPackageGetCurrentProcessPackageIdentifier rejects insufficient buffer"); + check(package_id(sizeof(pkg_id), pkg_id) == S_OK && std::strlen(pkg_id) == 32, + "XPackageGetCurrentProcessPackageIdentifier fills 33-byte package identifier"); + + SetEnvironmentVariableA("LEONIDA_PACKAGE_ID", "CustomTestPackageId_123456789012"); + check(package_id(sizeof(pkg_id), pkg_id) == S_OK && + std::strcmp(pkg_id, "CustomTestPackageId_123456789012") == 0, + "XPackageGetCurrentProcessPackageIdentifier respects LEONIDA_PACKAGE_ID override"); + SetEnvironmentVariableA("LEONIDA_PACKAGE_ID", nullptr); + + auto mount_path = get("XPackageGetMountPath"); + check(mount_path(nullptr, 0, nullptr) == E_INVALIDARG, "XPackageGetMountPath rejects null buffer and size 0"); + char mnt_path[MAX_PATH] = {}; + check(mount_path(nullptr, 0, mnt_path) == E_INVALIDARG, "XPackageGetMountPath rejects size 0 with buffer"); + check(mount_path(nullptr, 10, nullptr) == E_INVALIDARG, "XPackageGetMountPath rejects null pointer with size"); + + SetEnvironmentVariableA("LEONIDA_GAME_DIR", "C:\\LeonidaGameDir"); + check(mount_path(nullptr, 5, mnt_path) == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), + "XPackageGetMountPath rejects insufficient buffer"); + check(mount_path(nullptr, sizeof(mnt_path), mnt_path) == S_OK && + std::strcmp(mnt_path, "C:\\LeonidaGameDir") == 0, + "XPackageGetMountPath returns configured game directory"); + SetEnvironmentVariableA("LEONIDA_GAME_DIR", nullptr); + + auto is_packaged = get("XPackageIsPackagedProcess"); + check(is_packaged() == true, "XPackageIsPackagedProcess returns true by default"); + SetEnvironmentVariableA("LEONIDA_PACKAGED", "0"); + check(is_packaged() == false, "XPackageIsPackagedProcess respects LEONIDA_PACKAGED=0 override"); + SetEnvironmentVariableA("LEONIDA_PACKAGED", nullptr); + // Work on the thread pool, completions dispatched by the "game loop" on this thread. auto create = get("XTaskQueueCreate"); auto close = get("XTaskQueueCloseHandle"); diff --git a/scripts/audit_shader4_regs.py b/scripts/audit_shader4_regs.py index ac22c856c1..6a6c449dea 100644 --- a/scripts/audit_shader4_regs.py +++ b/scripts/audit_shader4_regs.py @@ -371,7 +371,7 @@ def main(argv=None): if a.json_out: try: os.makedirs(os.path.dirname(os.path.abspath(a.json_out)), exist_ok=True) - with open(a.json_out, "w", encoding="utf-8") as f: + with open(a.json_out, "w", encoding="utf-8", newline="\n") as f: json.dump(rep, f, indent=2) f.write("\n") except OSError as e: diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index d1d6e402d5..025504fb86 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py @@ -25,7 +25,7 @@ import mc_command # noqa: E402 sys.path.insert(0, SHADER_DIR) from build import CLIP_CASES, clip_container, shader_source -from check import Skip, clip_test, fmt_1010102_test, fmt_sint32_test, fmt_xy_xyz_test +from check import Skip, clip_test, fmt_1010102_test, fmt_sint32_test, fmt_xy_xyz_test, tbuffer_store_test from compute_fixture import compute_header from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test) from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, @@ -38,7 +38,7 @@ from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip, vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py -from check import PIXEL_VERTEX, interp_f16_high_problem, ij_computed_problem # pixel producers and checks +from check import PIXEL_VERTEX, interp_f16_high_problem, ij_computed_problem, mandelbrot_problem # pixel producers and checks from check import GET_LOD_TESTS, STORE_WORDS, get_lod_test, store_words_problem # TEST-184: image atomics and queries from check import wide_pixel_skip # ps_w64x_readlane: judged only where the fragment stage was required 64-wide @@ -115,7 +115,7 @@ def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: continue if ln.startswith("\t"): lines.append(ln) - with open(s_path, "w", encoding="utf-8") as f: + with open(s_path, "w", encoding="utf-8", newline="\n") as f: f.write("\n".join(lines) + "\n") @@ -542,7 +542,9 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool, OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test", "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test", "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test", - "ps_m3_post": "d3d12_m3_frame_test"} + "ps_m3_post": "d3d12_m3_frame_test", + "cs_m4_fill": "d3d12_m4_compute_test", "cs_m4_indirect": "d3d12_m4_compute_test", + "cs_buf_typed": "d3d12_buffer_uav_test", "cs_buf_counter": "d3d12_buffer_uav_test"} # Shaders a selected test draws with, built even when the filter leaves them out (#192). @@ -839,6 +841,10 @@ def run_suite(a, work: str) -> int: # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) results.append((name, not problem, problem or "128/128 dumped words exact")) + elif name == "cs_tbuffer_store": + # tbuffer_store_format_*: the instruction's format, words measured natively on a Radeon 680M (the .asm header) + problem = tbuffer_store_test(a.build, spirv_dir, cs_env) + results.append((name, not problem, problem or "128/128 dumped words exact")) elif name == "cs_global_neg_offset": # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement. @@ -879,7 +885,7 @@ def run_suite(a, work: str) -> int: "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", - "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64"): + "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst"): cs_dump_wants = { "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000], # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone @@ -901,6 +907,9 @@ def run_suite(a, work: str) -> int: "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE], # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header) "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], + # ds_cmpst_b32 and the b64 2-address forms (cs_lds_b64_cmpst.asm header) + "cs_lds_b64_cmpst": [0x11110001, 0x22220002, 0x33330003, 0x44440004, + 0xCCCC000C, 0x44440004, 0xBBBB000B, 0x3579BADC], # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant "cs_exec_const": [16, 8, 2, 16, 0, 16], # constant lane masks: lane L takes bit L (cs_w32_mask_imm.asm / cs_w64_mask_imm.asm headers) @@ -969,7 +978,8 @@ def run_suite(a, work: str) -> int: "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", - "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", + "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", + "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial if partial and not emulated: cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") @@ -981,7 +991,8 @@ def run_suite(a, work: str) -> int: ok, detail = None, str(skip) else: ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, - hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16")) + hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16", + "cs_lds_b64_cmpst")) results.append((name, ok, detail)) elif name == "cs_imgstore": rc, msg = run_cmd([vk_store, spv]) @@ -1172,6 +1183,11 @@ def run_suite(a, work: str) -> int: with open(raw, "rb") as source: problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read()))) ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6" + elif name == "ps_mandelbrot": + with open(raw, "rb") as source: + px = list(struct.iter_unpack("<4I", source.read())) + problem = mandelbrot_problem(px) + ok, detail = not problem, problem or f"{len(px)}/{len(px)} iteration counts match the float32 model" else: ok, detail = False, "no checker defined" results.append((name, ok, detail)) diff --git a/scripts/run_wine_tests.py b/scripts/run_wine_tests.py index b55ea9b91c..0a02525e53 100644 --- a/scripts/run_wine_tests.py +++ b/scripts/run_wine_tests.py @@ -251,7 +251,7 @@ def main() -> int: if args.summary: try: _make_parent(args.summary) - with open(args.summary, "a", encoding="utf-8") as f: + with open(args.summary, "a", encoding="utf-8", newline="\n") as f: f.write(f"### Windows tests under {args.label or 'Wine'}\n\n") f.write(f"{counts['pass']} passed, {counts['fail']} failed, {counts['skip']} skipped.\n\n") f.write("| Test | Result | Required |\n|---|---|---|\n") diff --git a/tests/semantic/README.md b/tests/semantic/README.md index 65b7410834..5244ec9b3b 100644 --- a/tests/semantic/README.md +++ b/tests/semantic/README.md @@ -35,6 +35,10 @@ What they check (`tools/rdna2spirv.py`, pixel shaders plus one compute shader): RDNA2 ISA's swizzled buffer_offset and its OOB_SELECT 3 rule (docs/design.md Swizzled buffer addressing): the exact addresses loaded and stored for dword, multi-dword and typed accesses, each with a literal and a run-time V#, and the GPU fixture `cs_buf_swizzle` on 64 threads. +- `test_tbuffer_store.py` runs the GPU test `cs_tbuffer_store` (13 `tbuffer_store_format_*` stores through V#s + whose format differs from the instruction's, or is 0) and asserts the 52 words `check.py` expects, measured natively on a + Radeon 680M; also the default `BUF_FMT_8_UNORM` byte, a format without an encoder staying `Unsupported`, and the + store's data VGPRs counting as reads. - `test_scalar_mem_smem.py` runs the code `Gen.scalar_load` emits with its own small evaluator (64-bit addresses, forward selection constructs) and asserts the SGPR values and the addresses read, including the measured SMEM truncation, `s_buffer_load` `NUM_RECORDS` bound and signed `s_load` immediate. diff --git a/tests/semantic/fixtures/disasm/cs_tbuffer_store.s b/tests/semantic/fixtures/disasm/cs_tbuffer_store.s new file mode 100644 index 0000000000..9f52a7b82d --- /dev/null +++ b/tests/semantic/fixtures/disasm/cs_tbuffer_store.s @@ -0,0 +1,233 @@ +; cs_tbuffer_store test fixture generated by tests/semantic/regen_fixtures.py from runtime/test/shaders/cs_tbuffer_store.asm + v_cmpx_eq_u32_e32 0, v0 + v_mov_b32_e32 v1, 0xa5a50200 + v_mov_b32_e32 v2, 0xa5a50204 + v_mov_b32_e32 v3, 0xa5a50208 + v_mov_b32_e32 v4, 0xa5a5020c + v_mov_b32_e32 v5, 0x200 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a50210 + v_mov_b32_e32 v2, 0xa5a50214 + v_mov_b32_e32 v3, 0xa5a50218 + v_mov_b32_e32 v4, 0xa5a5021c + v_mov_b32_e32 v5, 0x210 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a50220 + v_mov_b32_e32 v2, 0xa5a50224 + v_mov_b32_e32 v3, 0xa5a50228 + v_mov_b32_e32 v4, 0xa5a5022c + v_mov_b32_e32 v5, 0x220 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a50230 + v_mov_b32_e32 v2, 0xa5a50234 + v_mov_b32_e32 v3, 0xa5a50238 + v_mov_b32_e32 v4, 0xa5a5023c + v_mov_b32_e32 v5, 0x230 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a50240 + v_mov_b32_e32 v2, 0xa5a50244 + v_mov_b32_e32 v3, 0xa5a50248 + v_mov_b32_e32 v4, 0xa5a5024c + v_mov_b32_e32 v5, 0x240 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a50250 + v_mov_b32_e32 v2, 0xa5a50254 + v_mov_b32_e32 v3, 0xa5a50258 + v_mov_b32_e32 v4, 0xa5a5025c + v_mov_b32_e32 v5, 0x250 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a50260 + v_mov_b32_e32 v2, 0xa5a50264 + v_mov_b32_e32 v3, 0xa5a50268 + v_mov_b32_e32 v4, 0xa5a5026c + v_mov_b32_e32 v5, 0x260 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a50270 + v_mov_b32_e32 v2, 0xa5a50274 + v_mov_b32_e32 v3, 0xa5a50278 + v_mov_b32_e32 v4, 0xa5a5027c + v_mov_b32_e32 v5, 0x270 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a50280 + v_mov_b32_e32 v2, 0xa5a50284 + v_mov_b32_e32 v3, 0xa5a50288 + v_mov_b32_e32 v4, 0xa5a5028c + v_mov_b32_e32 v5, 0x280 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a50290 + v_mov_b32_e32 v2, 0xa5a50294 + v_mov_b32_e32 v3, 0xa5a50298 + v_mov_b32_e32 v4, 0xa5a5029c + v_mov_b32_e32 v5, 0x290 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a502a0 + v_mov_b32_e32 v2, 0xa5a502a4 + v_mov_b32_e32 v3, 0xa5a502a8 + v_mov_b32_e32 v4, 0xa5a502ac + v_mov_b32_e32 v5, 0x2a0 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a502b0 + v_mov_b32_e32 v2, 0xa5a502b4 + v_mov_b32_e32 v3, 0xa5a502b8 + v_mov_b32_e32 v4, 0xa5a502bc + v_mov_b32_e32 v5, 0x2b0 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + v_mov_b32_e32 v1, 0xa5a502c0 + v_mov_b32_e32 v2, 0xa5a502c4 + v_mov_b32_e32 v3, 0xa5a502c8 + v_mov_b32_e32 v4, 0xa5a502cc + v_mov_b32_e32 v5, 0x2c0 + buffer_store_dwordx4 v[1:4], v5, s[0:3], 0 offen + s_waitcnt_vscnt null, 0x0 + s_mov_b32 s4, s0 + s_mov_b32 s5, s1 + v_mov_b32_e32 v20, 0x3f800000 + v_mov_b32_e32 v21, 0x40000000 + v_mov_b32_e32 v22, 0x40400000 + v_mov_b32_e32 v23, 0x40800000 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x31016fac + v_mov_b32_e32 v5, 0x200 + tbuffer_store_format_xyzw v[20:23], v5, s[4:7], 0 format:[BUF_FMT_32_32_32_32_FLOAT] offen + v_mov_b32_e32 v20, 0x3f800000 + v_mov_b32_e32 v21, 0x40000000 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x3104dfac + v_mov_b32_e32 v5, 0x210 + tbuffer_store_format_xy v[20:21], v5, s[4:7], 0 format:[BUF_FMT_16_16_16_16_FLOAT] offen + v_mov_b32_e32 v20, 0x1 + v_mov_b32_e32 v21, 0x2 + v_mov_b32_e32 v22, 0x3 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x31016fac + v_mov_b32_e32 v5, 0x220 + tbuffer_store_format_xyz v[20:22], v5, s[4:7], 0 format:[BUF_FMT_8_8_8_8_UINT] offen + v_mov_b32_e32 v20, 0x3f800000 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x3104dfac + v_mov_b32_e32 v5, 0x231 + tbuffer_store_format_x v20, v5, s[4:7], 0 offen + v_mov_b32_e32 v20, 0x40000000 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x31016fac + v_mov_b32_e32 v5, 0x242 + tbuffer_store_format_x v20, v5, s[4:7], 0 format:[BUF_FMT_16_FLOAT] offen + v_mov_b32_e32 v20, 0x3f800000 + v_mov_b32_e32 v21, 0x0 + v_mov_b32_e32 v22, 0x3e800000 + v_mov_b32_e32 v23, 0x3f800000 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x31016fac + v_mov_b32_e32 v5, 0x250 + tbuffer_store_format_xyzw v[20:23], v5, s[4:7], 0 format:[BUF_FMT_2_10_10_10_UNORM] offen + v_mov_b32_e32 v20, 0x3f800000 + v_mov_b32_e32 v21, 0x40000000 + v_mov_b32_e32 v22, 0x40400000 + v_mov_b32_e32 v23, 0x40800000 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x3104dfac + v_mov_b32_e32 v5, 0x260 + tbuffer_store_format_xyzw v[20:23], v5, s[4:7], 0 format:[BUF_FMT_32_32_FLOAT] offen + v_mov_b32_e32 v20, 0x40003c00 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x3104dfac + v_mov_b32_e32 v5, 0x270 + tbuffer_store_format_d16_xy v20, v5, s[4:7], 0 format:[BUF_FMT_16_16_FLOAT] offen + v_mov_b32_e32 v20, 0x38003c00 + v_mov_b32_e32 v21, 0x3c000000 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x31016fac + v_mov_b32_e32 v5, 0x280 + tbuffer_store_format_d16_xyzw v[20:21], v5, s[4:7], 0 format:[BUF_FMT_8_8_8_8_UNORM] offen + v_mov_b32_e32 v20, 0x3f800000 + v_mov_b32_e32 v21, 0x40000000 + s_mov_b32 s6, 0x298 + s_mov_b32 s7, 0x31016fac + v_mov_b32_e32 v5, 0x290 + tbuffer_store_format_xy v[20:21], v5, s[4:7], 0 format:[BUF_FMT_32_32_32_32_FLOAT] offen + v_mov_b32_e32 v20, 0x3f800000 + s_mov_b32 s6, 0x2a1 + s_mov_b32 s7, 0x3104dfac + v_mov_b32_e32 v5, 0x2a0 + tbuffer_store_format_x v20, v5, s[4:7], 0 format:[BUF_FMT_8_UNORM] offen + v_mov_b32_e32 v20, 0x3f800000 + v_mov_b32_e32 v21, 0x40000000 + v_mov_b32_e32 v22, 0x40400000 + v_mov_b32_e32 v23, 0x40800000 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x3104dfac + v_mov_b32_e32 v5, 0x2b0 + tbuffer_store_format_xyzw v[20:23], v5, s[4:7], 0 format:[BUF_FMT_32_FLOAT] offen + v_mov_b32_e32 v20, 0x3f800000 + v_mov_b32_e32 v21, 0x40000000 + s_mov_b32 s6, 0xffffffff + s_mov_b32 s7, 0x31000fac + v_mov_b32_e32 v5, 0x2c0 + tbuffer_store_format_xy v[20:21], v5, s[4:7], 0 format:[BUF_FMT_32_32_FLOAT] offen + s_waitcnt_vscnt null, 0x0 + v_mov_b32_e32 v5, 0x200 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x0 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x210 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x10 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x220 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x20 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x230 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x30 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x240 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x40 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x250 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x50 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x260 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x60 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x270 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x70 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x280 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x80 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x290 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0x90 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x2a0 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0xa0 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x2b0 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0xb0 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + v_mov_b32_e32 v5, 0x2c0 + buffer_load_dwordx4 v[10:13], v5, s[0:3], 0 offen + s_waitcnt vmcnt(0) + v_mov_b32_e32 v6, 0xc0 + buffer_store_dwordx4 v[10:13], v6, s[0:3], 0 offen + s_endpgm diff --git a/tests/semantic/regen_fixtures.py b/tests/semantic/regen_fixtures.py index a7c9cb6960..28a6fa232d 100644 --- a/tests/semantic/regen_fixtures.py +++ b/tests/semantic/regen_fixtures.py @@ -26,6 +26,7 @@ "ps_f32_mods", "ps_f64_mods", "ps_sff_imm", "cs_w32_lds_u8_d16", "cs_w32_lane_wrap", "ps_bary", "cs_oob_select", "cs_oob_tail", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_buf_swizzle", # swizzled MUBUF / ADD_TID (test_buffer_swizzle.py) + "cs_tbuffer_store", # tbuffer_store_format_*, words measured natively on a Radeon 680M # TEST-175: GPU fixtures for the docs/design.md rules that were checked on the CPU only "ps_cmp_nlg", "ps_cvt_off", "ps_fmac_f16_mods", "ps_vop3_const_mods", "ps_interp_f32_mods", "ps_interp_mov_mods", "ps_f16_pack_mods", # v_pack_b32_f16 neg/abs (SHADER-260) diff --git a/tests/semantic/spirv_mini_interp.py b/tests/semantic/spirv_mini_interp.py index 05650dec89..3afc81c69c 100644 --- a/tests/semantic/spirv_mini_interp.py +++ b/tests/semantic/spirv_mini_interp.py @@ -43,13 +43,29 @@ class InvalidModule(AssertionError): def check_structure(body): - """spirv-val's merge rule (SPIR-V 2.16.2): OpSelectionMerge must be the second-to-last instruction of its block, + """spirv-val's merge, phi and Function-variable rules (SPIR-V 2.16.1-2): OpSelectionMerge must be the second-to-last instruction of its block, directly before OpBranchConditional or OpSwitch, and OpLoopMerge directly before OpBranch or OpBranchConditional. Until 2026-11-22 the interpreter skipped merges, so a translator change that put an instruction between a merge and its branch (#1633: OpLoad %active) passed every semantic test while every driver rejected the module. `body` is the list of (result, opcode, operands, line) of a function.""" follow = {"OpSelectionMerge": ("OpBranchConditional", "OpSwitch"), "OpLoopMerge": ("OpBranch", "OpBranchConditional")} + # OpPhi must come first in its block: only OpLabel or other OpPhi before it (SPIR-V 2.16.2, "OpPhi ... must be + # the first instructions of a block"). A phi emitted after an instruction of the merge block is rejected by + # spirv-val, and every translator path that merges a guarded load (OpPhi of the loaded and the kept value) + # depends on the order. + # Function-storage OpVariable belongs in the function's first block (SPIR-V 2.16.1). + prev, blocks = None, 0 + for _, op, a, line in body: + if op == "OpPhi" and prev not in ("OpLabel", "OpPhi"): + raise InvalidModule(f"{line!r} follows {prev or 'the start of the function'}, not OpLabel or OpPhi") + if op == "OpFunction": + blocks = 0 + elif op == "OpLabel": + blocks += 1 + elif op == "OpVariable" and a[1:2] == ["Function"] and blocks > 1: + raise InvalidModule(f"{line!r} is a Function variable outside the function's first block") + prev = op for k, (_, op, _, line) in enumerate(body): if op in follow: nxt = body[k + 1][1] if k + 1 < len(body) else None diff --git a/tests/semantic/spirv_wave_interp.py b/tests/semantic/spirv_wave_interp.py index a3adf65442..0331c7b37a 100644 --- a/tests/semantic/spirv_wave_interp.py +++ b/tests/semantic/spirv_wave_interp.py @@ -160,7 +160,12 @@ def __init__(self, text): raise UnsupportedConstruct(f"{op} before the first label") if res and a and op != "OpStore": self.id_type[res] = a[0] + if op == "OpVariable" and a[1:2] == ["Function"] and len(self.blocks) > 1: + raise InvalidModule(f"{line!r} is a Function variable outside the function's first block") if op == "OpPhi": + if cur.body: + raise InvalidModule(f"{line!r} follows a non-phi instruction of its block (spirv-val: " + "OpPhi must come first)") cur.phis.append((res, a)) elif op in ("OpSelectionMerge", "OpLoopMerge"): cur.merge = (op, a[0], a[1] if op == "OpLoopMerge" else None) diff --git a/tests/semantic/test_alu_add_co_clamp.py b/tests/semantic/test_alu_add_co_clamp.py new file mode 100644 index 0000000000..b39b8b26e8 --- /dev/null +++ b/tests/semantic/test_alu_add_co_clamp.py @@ -0,0 +1,183 @@ +"""Semantic interpreter tests for VOP3 clamp on RDNA2 carry-out u32 add/sub ops. + +Covers all six carry-out forms: v_add_co_u32, v_sub_co_u32, v_subrev_co_u32, v_add_co_ci_u32, v_sub_co_ci_u32, +and v_subrev_co_ci_u32. With VOP3 `clamp`, RDNA2 hardware (measured natively on gfx1035 and gfx1036, wave32 & +wave64) saturates D to 0xFFFFFFFF on add carry or 0 on sub borrow while still writing the real carry/borrow bit +into sdst (0 for inactive EXEC lanes). Without `clamp`, D wraps at 32 bits. No game files. +""" +import os +import random +import struct +import sys +import tempfile +import unittest +import warnings + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(os.path.dirname(HERE)) +TOOLS_DIR = os.environ.get("LEONIDA_TOOLS_DIR") or os.path.join(ROOT, "tools") + +sys.dont_write_bytecode = True +sys.path.insert(0, TOOLS_DIR) +sys.path.insert(0, HERE) + +import rdna2spirv # noqa: E402 +import spirv_mini_interp as si # noqa: E402 + +M32 = 0xFFFFFFFF +STUB_DXBC = b"DXBC" + bytes(24) + struct.pack(" tuple[int, int]: + x, y = x & M32, y & M32 + if op.startswith("v_subrev_co"): + x, y = y, x + sub = "sub" in op + c = (1 if cin else 0) if op.endswith("ci_u32") else 0 + if sub: + full = x - y - c + carry = 1 if full < 0 else 0 + res = 0 if (clamp and carry) else (full & M32) + else: + full = x + y + c + carry = 1 if full > M32 else 0 + res = M32 if (clamp and carry) else (full & M32) + return res, carry + + +def run_case(op: str, x: int, y: int, cin: int, clamp: bool, cd: str = "vcc_lo") -> tuple[int, int]: + if _TMP_DIR is None: + setUpModule() + mod = " clamp" if clamp else "" + lines = [ + f"v_mov_b32 v1, {x:#x}", + f"v_mov_b32 v2, {y:#x}", + f"s_mov_b32 vcc_lo, {-1 if cin else 0}", + ] + if op.endswith("ci_u32"): + lines.append(f"{op}_e64 v0, {cd}, v1, v2, vcc_lo{mod}") + else: + lines.append(f"{op} v0, {cd}, v1, v2{mod}") + if cd == "null": + lines.append("v_mov_b32 v7, 0") + else: + lines.append(f"v_cndmask_b32_e64 v7, 0, 1, {cd}") + lines += [ + "v_and_b32 v5, 0xffff, v0", + "v_lshrrev_b32 v6, 16, v0", + "v_or_b32 v5, 0x40000000, v5", + "v_or_b32 v6, 0x40000000, v6", + "v_or_b32 v7, 0x40000000, v7", + ] + asm = "; test_add_co_clamp\n" + "".join(f"\t{ln}\n" for ln in lines) + "\texp mrt0 v5, v6, v7, v5 done vm\n\ts_endpgm\n" + with open(_SRC_PATH, "w", encoding="utf-8", newline="\n") as f: + f.write(asm) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ResourceWarning) + spv = rdna2spirv.translate(_SRC_PATH) + lo, hi, cword = si.run_fragment(spv)["%out_mrt0"][:3] + assert lo >> 16 == 0x4000 and hi >> 16 == 0x4000 and cword >> 16 == 0x4000, (hex(lo), hex(hi), hex(cword)) + return (lo & 0xFFFF) | ((hi & 0xFFFF) << 16), cword & 1 + + +class AddCoClampTests(unittest.TestCase): + def test_edge_pairs_all_six_ops(self): + for op in CO_OPS: + for clamp in (False, True): + for x, y in EDGE_PAIRS: + self.assertEqual(run_case(op, x, y, 0, clamp), ref(op, x, y, 0, clamp), + (op, hex(x), hex(y), clamp)) + for op in CO_CI_OPS: + for clamp in (False, True): + for cin in (0, 1): + for x, y in EDGE_PAIRS: + self.assertEqual(run_case(op, x, y, cin, clamp), ref(op, x, y, cin, clamp), + (op, hex(x), hex(y), cin, clamp)) + + def test_null_and_sgpr_carry_dests(self): + for op in ("v_add_co_u32", "v_sub_co_u32", "v_add_co_ci_u32", "v_sub_co_ci_u32"): + x, y, cin = (0xFFFFFFFF, 1, 1) if "add" in op else (0, 1, 1) + want_d, want_c = ref(op, x, y, cin, True) + got_d, _ = run_case(op, x, y, cin, True, cd="null") + self.assertEqual(got_d, want_d, (op, "null")) + self.assertEqual(run_case(op, x, y, cin, True, cd="s12"), (want_d, want_c), (op, "s12")) + + def test_inactive_exec_lane(self): + if _TMP_DIR is None: + setUpModule() + lines = [ + "v_mov_b32 v0, 0x12345678", + "v_mov_b32 v1, 0xffffffff", + "v_mov_b32 v2, 0xffffffff", + "s_mov_b32 vcc_lo, -1", + "s_mov_b32 s10, exec_lo", + "s_mov_b32 exec_lo, 0", + "v_add_co_u32 v0, vcc_lo, v1, v2 clamp", + "s_mov_b32 exec_lo, s10", + "v_cndmask_b32_e64 v7, 0, 1, vcc_lo", + "v_and_b32 v5, 0xffff, v0", + "v_lshrrev_b32 v6, 16, v0", + "v_or_b32 v5, 0x40000000, v5", + "v_or_b32 v6, 0x40000000, v6", + "v_or_b32 v7, 0x40000000, v7", + ] + asm = "; test_inactive\n" + "".join(f"\t{ln}\n" for ln in lines) + "\texp mrt0 v5, v6, v7, v5 done vm\n\ts_endpgm\n" + with open(_SRC_PATH, "w", encoding="utf-8", newline="\n") as f: + f.write(asm) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ResourceWarning) + spv = rdna2spirv.translate(_SRC_PATH) + lo, hi, cword = si.run_fragment(spv)["%out_mrt0"][:3] + self.assertEqual((lo & 0xFFFF) | ((hi & 0xFFFF) << 16), 0x12345678) + self.assertEqual(cword & 1, 0) + + def test_seeded_random(self): + rng = random.Random(20261122) + for op in CO_OPS + CO_CI_OPS: + for _ in range(12): + x, y = rng.randrange(1 << 32), rng.randrange(1 << 32) + cin = rng.randrange(2) + for clamp in (False, True): + self.assertEqual(run_case(op, x, y, cin, clamp), ref(op, x, y, cin, clamp), + (op, hex(x), hex(y), cin, clamp)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/semantic/test_alu_cvt_flr_rpi.py b/tests/semantic/test_alu_cvt_flr_rpi.py index f31e82d994..eb9239af80 100644 --- a/tests/semantic/test_alu_cvt_flr_rpi.py +++ b/tests/semantic/test_alu_cvt_flr_rpi.py @@ -1,13 +1,16 @@ """Semantic interpreter tests for RDNA2 v_cvt_flr_i32_f32 and v_cvt_rpi_i32_f32. -RDNA ISA pseudocode: v_cvt_flr_i32_f32 is f32_to_i32(floor(S0)), v_cvt_rpi_i32_f32 is f32_to_i32(floor(S0 + 0.5)), -with the + 0.5 rounded in binary32 like any f32 add. f32_to_i32 saturates as v_cvt_i32_f32 does (#300): at or past -+-2^31, and +-inf, it gives INT_MAX / INT_MIN; NaN gives 0. Each case translates a synthetic pixel shader with -tools/rdna2spirv.py, runs it in tests/semantic/spirv_mini_interp.py and compares the result with a plain-Python -reference. Denormal inputs are left out (the float mode that would flush them is not modelled). The result leaves -through exp as two 16-bit halves ORed into 0x40000000, so no export channel is a NaN or denormal pattern that a -float round trip could change. +Measured natively on RDNA2 (gfx1035 & gfx1036, wave32 & wave64): v_cvt_flr_i32_f32 is sat_i32(floor(S0)), and +v_cvt_rpi_i32_f32 is sat_i32(floor(S0 + 0.5)) computed **exactly** (without binary32 rounding of S0 + 0.5, so +0x3EFFFFFF = 0.49999997 gives 0, 0x4B000001 gives 0x00800001, and 0x4B7FFFFF gives 0x00FFFFFF). Values at or past ++-2^31, +-inf, and NaNs all saturate by the sign bit of the operand (+ -> 0x7FFFFFFF, - -> 0x80000000), unlike +v_cvt_i32_f32 which returns 0 for NaN. Each case translates a synthetic pixel shader with tools/rdna2spirv.py, runs +it in tests/semantic/spirv_mini_interp.py and compares the result with an exact plain-Python reference. Denormal +inputs are left out (the float mode that would flush them is not modelled). The result leaves through exp as two +16-bit halves ORed into 0x40000000, so no export channel is a NaN or denormal pattern that a float round trip could +change. """ +from fractions import Fraction import math import os import random @@ -32,38 +35,34 @@ STUB_DXBC = b"DXBC" + bytes(24) + struct.pack(" float: - return struct.unpack(" float: - try: - return struct.unpack(" int: - if math.isnan(x): - return 0 - if x >= 2.0 ** 31: - return 0x7FFFFFFF - if x < -(2.0 ** 31): - return 0x80000000 - return int(x) & M32 - - def ref(op: str, u: int) -> int: - x = u2f(u) + u &= M32 + sign = (u >> 31) & 1 + exp = (u >> 23) & 0xFF + mant = u & 0x7FFFFF + if exp == 0xFF: + return 0x80000000 if sign else 0x7FFFFFFF + if exp == 0: + x = Fraction(mant, 1 << 149) + else: + x = Fraction((1 << 23) | mant) * (Fraction(2) ** (exp - 150)) + if sign: + x = -x if op == "v_cvt_rpi_i32_f32": - x = f32(x + 0.5) # exact in double, then one rounding to binary32 - return f32_to_i32(math.floor(x) if math.isfinite(x) else x) + x += Fraction(1, 2) + iv = math.floor(x) + if iv >= (1 << 31): + return 0x7FFFFFFF + if iv < -(1 << 31): + return 0x80000000 + return iv & M32 OPS = ("v_cvt_flr_i32_f32", "v_cvt_rpi_i32_f32") -VALUES = [0x00000000, 0x80000000, 0x3F000000, 0xBF000000, 0x3EFFFFFF, 0xBEFFFFFF, 0x3FC00000, 0xBFC00000, - 0x40200000, 0xC0200000, 0x3F7FFFFF, 0x4B000001, 0xCB000001, 0x4EFFFFFF, 0xCEFFFFFF, 0x4F000000, - 0xCF000000, 0xCF000001, 0x7F7FFFFF, 0xFF7FFFFF, 0x7F800000, 0xFF800000, 0x7FC00000, 0xFFC00000, 0x7F800001] +VALUES = [0x00000000, 0x80000000, 0x3F000000, 0xBF000000, 0x3EFFFFFF, 0xBEFFFFFF, 0xBF000001, 0x3FC00000, 0xBFC00000, + 0x40200000, 0xC0200000, 0x3F7FFFFF, 0x4AFFFFFF, 0x4B000000, 0x4B000001, 0x4B7FFFFF, 0xCB000001, 0x4EFFFFFF, + 0xCEFFFFFF, 0x4F000000, 0xCF000000, 0xCF000001, 0x7F7FFFFF, 0xFF7FFFFF, 0x7F800000, 0xFF800000, 0x7FC00000, + 0xFFC00000, 0x7F800001, 0xFF800001] _TMP_DIR = None _SRC_PATH = None @@ -112,9 +111,12 @@ def test_reference(self): self.assertEqual(ref("v_cvt_flr_i32_f32", 0xC0200000), (-3) & M32) # floor(-2.5) self.assertEqual(ref("v_cvt_rpi_i32_f32", 0xC0200000), (-2) & M32) # floor(-2.5 + 0.5) self.assertEqual(ref("v_cvt_rpi_i32_f32", 0x40200000), 3) # 2.5 rounds up - self.assertEqual(ref("v_cvt_rpi_i32_f32", 0x3EFFFFFF), 1) # 0.49999997 + 0.5 rounds to 1.0 + self.assertEqual(ref("v_cvt_rpi_i32_f32", 0x3EFFFFFF), 0) # 0.49999997 -> exact floor(x+0.5) = 0 + self.assertEqual(ref("v_cvt_rpi_i32_f32", 0x4B000001), 0x00800001) # 8388609.0 -> exact, not 8388610 + self.assertEqual(ref("v_cvt_rpi_i32_f32", 0x4B7FFFFF), 0x00FFFFFF) # 16777215.0 -> exact, not 16777216 self.assertEqual(ref("v_cvt_flr_i32_f32", 0xCF000001), 0x80000000) # below -2^31: saturated - self.assertEqual(ref("v_cvt_flr_i32_f32", 0x7FC00000), 0) # NaN + self.assertEqual(ref("v_cvt_flr_i32_f32", 0x7FC00000), 0x7FFFFFFF) # +NaN saturates to INT_MAX + self.assertEqual(ref("v_cvt_flr_i32_f32", 0xFFC00000), 0x80000000) # -NaN saturates to INT_MIN def test_edge_values(self): for op in OPS: diff --git a/tests/semantic/test_buffer_format_narrow_int.py b/tests/semantic/test_buffer_format_narrow_int.py new file mode 100644 index 0000000000..0b1fbd15bf --- /dev/null +++ b/tests/semantic/test_buffer_format_narrow_int.py @@ -0,0 +1,257 @@ +"""Narrow integer typed-buffer formats (8/16-bit UINT and SINT) in tools/rdna2spirv.py, against words measured natively. + +Every expected word below was read back from an AMD Radeon RDNA2 iGPU (gfx1036, Ryzen 9 9950X3D, Windows AMD +driver, through tools/hw_oracle with AMD clang 23 from rocm-sdk-core 10.0.0), in wave32 and wave64 alike, with the +same V# and instruction the translated shader gets here: + +- loads: `buffer_load_format_xyzw` and `_d16_xyzw` from four source dwords (SOURCE) with DST_SEL XYZW and X011. UINT + zero-extends and SINT sign-extends each channel; missing channels repeat the format's own (c mod n); DST_SEL 1 is + integer 1; d16 packs each result as a 16-bit integer. +- stores: `buffer_store_format_x/xy/xyzw` of four value sets into a buffer filled with 0xDEAD0000, with the V# + selectors the runtime gives each format (gfx10_descriptors.h: X001, XY01, XYZW). UINT saturates to the channel + (unsigned), SINT clamps the signed 32-bit value to [-2^(w-1), 2^(w-1) - 1]; a 1-2 byte element keeps the rest + of its dword. + +Formats 27, 60 and 69 (16_16_UINT, 8_8_8_8_UINT, 16_16_16_16_UINT) were decoded before; they are the control. +""" +from __future__ import annotations + +import os +import struct +import sys +import tempfile +import unittest +import warnings + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(os.path.dirname(HERE)) +sys.dont_write_bytecode = True +sys.path.insert(0, os.environ.get("LEONIDA_TOOLS_DIR") or os.path.join(ROOT, "tools")) +sys.path.insert(0, HERE) + +import rdna2spirv # noqa: E402 +import spirv_mini_interp as si # noqa: E402 + +STUB_DXBC = b"DXBC" + bytes(24) + struct.pack(" tuple: + """Translate a pixel shader whose V# (s[0:3], raw, 256 bytes) points at BASE with this format and selectors.""" + with tempfile.TemporaryDirectory() as tmp: + os.mkdir(os.path.join(tmp, "disasm")) + src = os.path.join(tmp, "disasm", "ps_narrow_int.s") + with open(os.path.join(tmp, "ps_narrow_int.dxbc"), "wb") as f: + f.write(STUB_DXBC) + with open(src, "w", encoding="utf-8") as f: + f.write("; test_buffer_format_narrow_int\n" + f"\ts_mov_b32 s0, {BASE:#x}\n\ts_mov_b32 s1, 0\n\ts_mov_b32 s2, 0x100\n" + f"\ts_mov_b32 s3, {fmt << 12 | dst_sel | 1 << 24 | 3 << 28:#x}\n\tv_mov_b32 v1, 0\n" + body) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ResourceWarning) + spv = rdna2spirv.translate(src) + return si.run_fragment(spv, memory=memory)["%out_mrt0"] + + +def load(fmt: int, dst_sel: int, d16: bool = False) -> tuple: + regs, dst = ("v[2:3]", "v2, v3, v2, v3") if d16 else ("v[2:5]", "v2, v3, v4, v5") + body = (f"\tbuffer_load_format_{'d16_' if d16 else ''}xyzw {regs}, v1, s[0:3], 0 offen\n" + f"\ts_waitcnt vmcnt(0)\n\texp mrt0 {dst} done vm\n\ts_endpgm\n") + return run(fmt, body, dst_sel, {BASE + 4 * i: w for i, w in enumerate(SOURCE)}) + + +def store(fmt: int, values: tuple, n: int, channels: int) -> tuple: + memory = {BASE: 0xDEAD0000, BASE + 4: 0xDEAD0000} + movs = "".join(f"\tv_mov_b32 v{2 + i}, {v:#x}\n" for i, v in enumerate(values[:n])) + regs = "v2" if n == 1 else f"v[2:{1 + n}]" + body = (movs + f"\tbuffer_store_format_{'xyzw'[:n]} {regs}, v1, s[0:3], 0 offen\n" + "\texp mrt0 v2, v2, v2, v2 done vm\n\ts_endpgm\n") + run(fmt, body, RUNTIME_SEL[channels], memory) + return memory[BASE], memory[BASE + 4] + + +class NarrowIntegerLoads(unittest.TestCase): + def test_measured_words(self): + for fmt, (xyzw, x011, d16) in LOADS.items(): + with self.subTest(fmt=fmt): + self.assertEqual(load(fmt, SEL_XYZW), xyzw, "DST_SEL XYZW") + self.assertEqual(load(fmt, SEL_X011), x011, "DST_SEL X011: 0 and integer 1") + self.assertEqual(load(fmt, SEL_XYZW, d16=True)[:2], d16, "d16") + + +class NarrowIntegerStores(unittest.TestCase): + def test_measured_words(self): + for (fmt, values, n), want in STORES.items(): + with self.subTest(fmt=fmt, values=values, n=n): + self.assertEqual(store(fmt, VALUES[values], n, CHANNELS[fmt]), want) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/semantic/test_buffer_load_format.py b/tests/semantic/test_buffer_load_format.py index c5cf73a70c..30f32bb318 100644 --- a/tests/semantic/test_buffer_load_format.py +++ b/tests/semantic/test_buffer_load_format.py @@ -33,6 +33,7 @@ # V# FORMAT codes (word3 bits 12-18), from rdna2spirv.FORMATS FMT_U32, FMT_U32X2, FMT_U32X4, FMT_UINT8X4, FMT_UINT16X2, FMT_UINT16X4, FMT_F16 = 20, 62, 75, 60, 27, 69, 13 FMT_F32, FMT_F32X2, FMT_F32X3, FMT_UNORM8, FMT_UNORM8X4 = 22, 64, 74, 1, 56 +FMT_UNORM16, FMT_SNORM16, FMT_UNORM16X2 = 7, 8, 23 DST_SEL_XYZW = 4 | 5 << 3 | 6 << 6 | 7 << 9 # DST_SEL (X, 0, 1, 1): code 4, 0, 1, 1 — SHADER-86 measures float 1.0 vs integer 1 DST_SEL_X_0_1_1 = 4 | 0 << 3 | 1 << 6 | 1 << 9 @@ -150,9 +151,9 @@ def test_odd_and_even_component_writes(self): class D16NormalizedRounding(unittest.TestCase): - """d16 narrows a normalized value to f16 with round to nearest even, like the d16 image results (#489; inferred - for the hardware, not measured). These bytes are among the about half of unorm8 values where round toward zero, - which PackHalf2x16 becomes on AMD drivers, gives 1 ulp less.""" + """d16 narrows a normalized value to f16 with round to nearest even (#489; measured for typed buffer loads on an + RX 6700, BUILD-161). These bytes are among the about half of unorm8 values where round toward zero, which + PackHalf2x16 becomes on AMD drivers, gives 1 ulp less.""" def test_unorm8_x(self): # byte 5 is 0xbe: 190/255 is 0x39f6 to nearest even, 0x39f5 toward zero @@ -163,6 +164,40 @@ def test_unorm8x4_xyzw(self): self.assertEqual(load_format(FMT_UNORM8X4, 4, 4, d16=True)[:2], (0x39F63B7F, 0x3AF7396D)) +class D16NormalizedRoundsOnce(unittest.TestCase): + """BUILD-161, measured on an RX 6700 (gfx1031) with tools/d16_format_probe.py: d16 rounds the exact UNORM/SNORM + quotient once, straight to f16. The f32 decode followed by f16_bits rounds twice, which is 1 ulp high where the + f32 lands exactly on an f16 halfway point: UNORM16 0xffaf and 0xffef, SNORM16 0x7ff7 and 0x8009.""" + + def d16_x(self, fmt, half, op="buffer_load_format", mods=""): + return load_format(fmt, 0, 1, memory={BASE: half}, d16=True, op=op, mods=mods)[0] + + def test_unorm16_and_snorm16_halfway_values(self): + for fmt, half, want in ((FMT_UNORM16, 0xFFEF, 0x3BFF), (FMT_UNORM16, 0xFFAF, 0x3BFD), + (FMT_SNORM16, 0x7FF7, 0x3BFF), (FMT_SNORM16, 0x8009, 0xBBFF)): + with self.subTest(fmt=fmt, half=hex(half)): + self.assertEqual(self.d16_x(fmt, half), 0x12340000 | want) + + def test_mtbuf_takes_the_same_rule(self): + self.assertEqual(self.d16_x(FMT_UNORM16, 0xFFEF, "tbuffer_load_format", " format:[BUF_FMT_16_UNORM]"), + 0x12343BFF) + self.assertEqual(self.d16_x(FMT_SNORM16, 0x8009, "tbuffer_load_format", " format:[BUF_FMT_16_SNORM]"), + 0x1234BBFF) + + def test_neighbours_and_the_f32_result_are_unchanged(self): + self.assertEqual(self.d16_x(FMT_UNORM16, 0xFFEE), 0x12343BFF) # 65518/65535: not a halfway f32 + self.assertEqual(self.d16_x(FMT_UNORM16, 0xFFFF), 0x12343C00) + self.assertEqual(load_format(FMT_UNORM16, 0, 1, memory={BASE: 0xFFEF})[0], 0x3F7FF000) + + def test_a_float_format_on_the_halfway_value_still_ties_to_even(self): + self.assertEqual(self.d16_x(FMT_F32, 0x3F7FF000), 0x12343C00) + self.assertEqual(self.d16_x(FMT_F32, 0xBF7FB000), 0x1234BBFE) + + def test_both_halves_of_a_pair(self): + got = load_format(FMT_UNORM16X2, 0, 2, memory={BASE: 0xFFAF << 16 | 0xFFEF}, d16=True)[0] + self.assertEqual(got, 0x3BFD3BFF) + + class CrossingDwordBoundary(unittest.TestCase): """An element that starts mid-dword must read the following dwords, not re-read dword 0. diff --git a/tests/semantic/test_interp_merge_check.py b/tests/semantic/test_interp_merge_check.py index 382955f5fa..22156da603 100644 --- a/tests/semantic/test_interp_merge_check.py +++ b/tests/semantic/test_interp_merge_check.py @@ -1,4 +1,4 @@ -"""spirv_mini_interp and spirv_wave_interp reject a module that breaks spirv-val's merge rule. +"""spirv_mini_interp and spirv_wave_interp reject a module that breaks spirv-val's merge or phi rule. OpSelectionMerge must directly precede OpBranchConditional / OpSwitch, and OpLoopMerge directly precede OpBranch / OpBranchConditional (SPIR-V 2.16.2). Both interpreters used to skip merges, so #1633's first version, with an @@ -74,5 +74,76 @@ def test_loop_merge_rule(self): si.check_structure([ok[0]]) +CS_LINES = ["v_mov_b32_e32 v1, 0x40", "global_load_dword v2, v1, s[0:1]", "s_waitcnt vmcnt(0)", + "v_mov_b32_e32 v3, 0", "buffer_store_dword v2, v3, s[0:3], 0 offen", "s_endpgm"] + + +def cs_spv(): + from test_salu64_bitwise_data import translate_cs + text = translate_cs(CS_LINES) + assert " = OpPhi " in text + return text + + +def run_cs(text): + mem = {0x40: 0x1234} + si.run_workgroup(text, 1, 64, inputs_for=lambda i: {"%wg_id": (0, 0, 0), "%local_id": (i, 0, 0), "%sg_lane": i}, + push_constants=[0, 0, 0x1000, 0x31016FAC] + [0] * 32, memory=mem) + return mem + + +class PhiRule(unittest.TestCase): + """OpPhi must be the first instructions of its block: only OpLabel or OpPhi before it (SPIR-V 2.16.2).""" + + def test_translated_module_runs(self): + self.assertEqual(run_cs(cs_spv())[0], 0x1234) + + def test_phi_after_another_instruction(self): + lines = cs_spv().splitlines() + k = next(i for i, ln in enumerate(lines) if " = OpPhi " in ln) + lines[k], lines[k + 1] = lines[k + 1], lines[k] # the phi now follows a non-phi instruction + bad = "\n".join(lines) + "\n" + with self.assertRaisesRegex(si.InvalidModule, "OpPhi"): + run_cs(bad) + + def test_rule_directly(self): + lab = (None, "OpLabel", [], "%b = OpLabel") + phi = ("%p", "OpPhi", [], "%p = OpPhi %uint %a %x %c %y") + add = ("%q", "OpIAdd", [], "%q = OpIAdd %uint %a %a") + si.check_structure([lab, phi, phi, add]) + with self.assertRaisesRegex(si.InvalidModule, "OpPhi"): + si.check_structure([lab, add, phi]) + with self.assertRaisesRegex(wi.InvalidModule, "OpPhi"): + wi.run_wave("OpFunction %void None %f\n%b = OpLabel\n%q = OpIAdd %uint %a %a\n" + "%p = OpPhi %uint %a %x %c %y\nOpReturn\nOpFunctionEnd\n", wave=32) + + +class FunctionVariableRule(unittest.TestCase): + """A Function-storage OpVariable belongs in the function's first block (SPIR-V 2.16.1).""" + + def test_rule_directly(self): + lab = (None, "OpLabel", [], "%b = OpLabel") + var = ("%v", "OpVariable", ["%_ptr_Function_uint", "Function"], "%v = OpVariable %_ptr_Function_uint Function") + br = (None, "OpBranch", ["%c"], "OpBranch %c") + si.check_structure([lab, var, br, lab]) + with self.assertRaisesRegex(si.InvalidModule, "first block"): + si.check_structure([lab, br, lab, var]) + # a new function starts counting again + fn = ("%f", "OpFunction", [], "%f = OpFunction %void None %t") + si.check_structure([fn, lab, br, lab, fn, lab, var]) + + def test_translated_module_with_a_variable_moved(self): + lines = cs_spv().splitlines() + k = next(i for i, ln in enumerate(lines) if " OpVariable " in ln and " Function" in ln) + var = lines.pop(k) + last_label = max(i for i, ln in enumerate(lines) if ln.strip().endswith("= OpLabel")) + lines.insert(last_label + 1, var) + bad = "\n".join(lines) + "\n" + with self.assertRaisesRegex(si.InvalidModule, "first block"): + run_cs(bad) + with self.assertRaisesRegex(wi.InvalidModule, "first block"): + wi.run_wave(bad, wave=32) + + if __name__ == "__main__": unittest.main() diff --git a/tests/semantic/test_mask_src_sgpr_const.py b/tests/semantic/test_mask_src_sgpr_const.py new file mode 100644 index 0000000000..ddeaff21f4 --- /dev/null +++ b/tests/semantic/test_mask_src_sgpr_const.py @@ -0,0 +1,114 @@ +"""A constant lane mask that reaches a mask consumer through an SGPR: lane L takes bit L of the constant. + +`s_mov_b32 s20, 0x3ffffc00; s_and_saveexec_b32 s6, s20` leaves lanes 10..29 active on hardware. Gen.mask_src read the +SGPR's raw value, which is the same non-zero constant in every invocation, so every lane stayed on (found writing +#1771's GPU test; the immediate form `s_and_saveexec_b32 s6, 0x3ffffc00` was already right). Each case runs a +translated pixel shader in tests/semantic/spirv_wave_interp.py as one wave and compares every lane with the +immediate form and with the bits of the constant. Masks built by compares still work (they hold 0 / ~0 per lane). +Standard library only; no GPU, no game files. +""" +import os +import sys +import unittest + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.dont_write_bytecode = True +sys.path.insert(0, HERE) + +from test_salu64_bitwise_data import run_ps_wave # noqa: E402 (also puts tools/ on sys.path) + +EPILOGUE = ["v_mov_b32 v0, 0", "v_mov_b32 v2, 0", "v_mov_b32 v3, 0"] + + +def active_lanes(lines, wave): + """Lanes whose v1 ends as 0x22: the ones the mask under test left active.""" + outs, _ = run_ps_wave(["v_mov_b32 v1, 0x11"] + lines + ["v_mov_b32 v1, 0x22", f"s_mov_b{wave} exec, -1"] + + EPILOGUE, wave=wave) + return [lane for lane in range(wave) if outs[lane][1] == 0x22] + + +def bits(v, wave): + return [lane for lane in range(wave) if v >> lane & 1] + + +class SgprConstantMask(unittest.TestCase): + def test_saveexec_wave32(self): + for c in (0x3FFFFC00, 0x00000001, 0x80000000, 0x0000FF00, 0x55555555): + with self.subTest(c=hex(c)): + via_sgpr = active_lanes([f"s_mov_b32 s20, {c:#x}", "s_and_saveexec_b32 s6, s20"], 32) + via_imm = active_lanes([f"s_and_saveexec_b32 s6, {c:#x}"], 32) + self.assertEqual(via_sgpr, bits(c, 32)) + self.assertEqual(via_sgpr, via_imm) + + def test_exec_write_and_cndmask(self): + c = 0x0F0F00FF + self.assertEqual(active_lanes([f"s_mov_b32 s20, {c:#x}", "s_and_b32 exec_lo, exec_lo, s20"], 32), bits(c, 32)) + outs, _ = run_ps_wave([f"s_mov_b32 s20, {c:#x}", "v_cndmask_b32_e64 v1, 0, 1, s20"] + EPILOGUE, wave=32) + self.assertEqual([lane for lane in range(32) if outs[lane][1] == 1], bits(c, 32)) + + def test_sop2_with_a_constant_and_exec(self): + # 32-bit bitwise SOP2 on EXEC with a constant, inline or in an SGPR (both were taken whole before). + c, full = 0x0F0F00FF, 0xFFFFFFFF # EXEC starts with every lane on + for kind, want in (("and", full & c), ("andn2", full & ~c), ("or", full | c), ("xor", full ^ c)): + for src in (f"{c:#x}", "s20"): + with self.subTest(op=kind, src=src): + lines = [f"s_mov_b32 s20, {c:#x}", f"s_{kind}_b32 exec_lo, exec_lo, {src}"] + self.assertEqual(active_lanes(lines, 32), bits(want & full, 32)) + + def test_exec_lo_from_an_sgpr_constant(self): + c = 0x00FF00F0 + self.assertEqual(active_lanes([f"s_mov_b32 s20, {c:#x}", "s_mov_b32 exec_lo, s20"], 32), bits(c, 32)) + + def test_wave64_pair_takes_each_half_from_its_own_sgpr(self): + lo, hi = 0x0000FFFF, 0xF0000000 + lanes = active_lanes([f"s_mov_b32 s20, {lo:#x}", f"s_mov_b32 s21, {hi:#x}", + "s_and_saveexec_b64 s[6:7], s[20:21]"], 64) + self.assertEqual(lanes, bits(lo | hi << 32, 64)) + + def test_masks_from_compares_still_work(self): + lines = ["v_mbcnt_lo_u32_b32 v4, -1, 0", "v_cmp_gt_u32_e64 s20, 12, v4", "s_and_saveexec_b32 s6, s20"] + self.assertEqual(active_lanes(lines, 32), list(range(12))) + lines = ["v_mbcnt_lo_u32_b32 v4, -1, 0", "v_mbcnt_hi_u32_b32 v4, -1, v4", "v_cmp_lt_u32_e64 s[20:21], 40, v4", + "s_and_saveexec_b64 s[6:7], s[20:21]"] + self.assertEqual(active_lanes(lines, 64), list(range(41, 64))) + + +class MaskAndConstantIntoAnSgpr(unittest.TestCase): + """@Pierre-Kookis's case on #1792 (GPU-reproduced on AMD RDNA2 and an RTX 4070 Ti SUPER): an SOP2 of EXEC with a + constant into a plain SGPR is data, and s_bcnt1 counts the wave's bits. The first version of this fix put each + lane's bit there and got 32 / 0 instead of 1 / 8.""" + + def test_s_and_of_exec_with_a_constant_counts_the_wave_bits(self): + import struct + import tempfile + import warnings + import spirv_mini_interp as si + from support import STUB_DXBC, rdna2spirv + lines = ["s_and_b32 s20, exec_lo, 1", "s_bcnt1_i32_b32 s21, s20", "s_and_b32 s22, exec_lo, 0xff00", + "s_bcnt1_i32_b32 s23, s22", "v_lshlrev_b32 v3, 3, v0", "v_mov_b32_e32 v1, s21", + "buffer_store_dword v1, v3, s[0:3], 0 offen", "v_add_nc_u32 v3, 4, v3", "v_mov_b32_e32 v1, s23", + "buffer_store_dword v1, v3, s[0:3], 0 offen", "s_endpgm"] + with tempfile.TemporaryDirectory() as tmp: + os.mkdir(os.path.join(tmp, "disasm")) + os.mkdir(os.path.join(tmp, "fssm")) + with open(os.path.join(tmp, "cs_bcnt.dxbc"), "wb") as f: + f.write(STUB_DXBC) + hdr = bytearray(0x148) + struct.pack_into("<4I", hdr, 0x138, 0x88, 32, 1, 1) + with open(os.path.join(tmp, "fssm", "cs_bcnt.fssm"), "wb") as f: + f.write(hdr) + src = os.path.join(tmp, "disasm", "cs_bcnt.s") + with open(src, "w", encoding="utf-8") as f: + f.write("; cs_bcnt\n" + "".join(f"\t{ln}\n" for ln in lines)) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", ResourceWarning) + spv = rdna2spirv.translate(src) + mem = si.run_workgroup(spv, 32, 32, inputs_for=lambda i: {"%wg_id": (0, 0, 0), "%local_id": (i, 0, 0), + "%sg_lane": i}, + push_constants=[0, 0, 0x1000, 0x31016FAC] + [0] * 28, memory={}) + for lane in range(32): + self.assertEqual((mem[8 * lane], mem[8 * lane + 4]), (1, 8), f"lane {lane}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/semantic/test_tbuffer_store.py b/tests/semantic/test_tbuffer_store.py new file mode 100644 index 0000000000..890c68d5d7 --- /dev/null +++ b/tests/semantic/test_tbuffer_store.py @@ -0,0 +1,86 @@ +"""tbuffer_store_format_* (MTBUF stores with the instruction's own format) through the translator and the interpreter. + +cs_tbuffer_store.asm stores into 13 sentinel-filled regions through V#s whose FORMAT differs from the instruction's, +then reads every region back into out[0..51]. check.py's TBUFFER_STORE_WORDS holds the words a Radeon 680M (gfx1035) +gives natively; the rules are in the .asm header. Here the translated fixture runs on the CPU and must give the same +words, so the GPU test, the hardware and the translation are kept in step. +""" +import os +import struct +import sys +import unittest + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(os.path.dirname(HERE)) +sys.path.insert(0, HERE) +sys.path.insert(0, os.path.join(ROOT, "runtime", "test", "shaders")) +sys.path.insert(0, os.environ.get("LEONIDA_TOOLS_DIR") or os.path.join(ROOT, "tools")) + +import check # noqa: E402 (runtime/test/shaders/check.py; importing it runs nothing) +import rdna2spirv # noqa: E402 +import support # noqa: E402 + + +def fssm(rsrc2, group): + """The compute-shader header words the translator reads: COMPUTE_PGM_RSRC2 and the thread-group size.""" + header = bytearray(0x148) + struct.pack_into("<4I", header, 0x138, rsrc2, *group) + return bytes(header) + + +# 4 user SGPRs (the output V#), workgroup id in s4, 64x1x1 threads: the header build.py gives the GPU tests. +CS_FSSM = fssm(0x8088, (64, 1, 1)) +# The output V# vk_compute_test passes in s[0:3]: base 0, num_records 0xffffffff, 32_FLOAT, OOB_SELECT 3. +OUT_VSHARP = [0, 0, 0xFFFFFFFF, 0x31016FAC] + + +def run(spv): + memory = {} + outputs = support.run_fragment(spv, inputs={"%wg_id": (0, 0, 0), "%local_id": (0, 0, 0)}, + push_constants=OUT_VSHARP + [0] * 28, memory=memory) + return outputs, memory + + +class TbufferStoreFixture(unittest.TestCase): + def test_words_match_the_native_measurement(self): + outputs, memory = run(support.translate_fixture("cs_tbuffer_store", fssm=CS_FSSM)) + self.assertEqual(outputs, {}) + want = check.TBUFFER_STORE_WORDS + got = [memory.get(4 * i, 0) for i in range(len(want))] + for i, (g, w) in enumerate(zip(got, want)): + with self.subTest(out=i, region=hex(0x200 + 16 * (i // 4))): + self.assertEqual(f"{g:#010x}", f"{w:#010x}") + # The regions themselves hold the same words, and nothing lands between out[] and the regions. + self.assertEqual([memory.get(0x200 + 4 * i, 0) for i in range(len(want))], want) + self.assertEqual(sorted(a for a in memory if len(want) * 4 <= a < 0x200), []) + + +class TbufferStoreTranslation(unittest.TestCase): + def store(self, fmt_mod): + return support.translate_lines("cs_tbuf_one", [ + "v_mov_b32_e32 v20, 1.0", "v_mov_b32_e32 v5, 0x200", + f"tbuffer_store_format_x v20, v5, s[0:3], 0{fmt_mod} offen", "s_endpgm"], fssm=CS_FSSM) + + def test_format_outside_formats_is_unsupported(self): + # BUF_FMT_8_USCALED is a GFX10 format the FORMATS table has no encoder for: reported, never guessed. + # (BUF_FMT_8_UINT was the example until #1871 added the measured 8/16-bit UINT/SINT formats.) + with self.assertRaises(rdna2spirv.Unsupported): + self.store(" format:[BUF_FMT_8_USCALED]") + + def test_default_format_is_one_unorm_byte(self): + # No modifier is GFX10's default, BUF_FMT_8_UNORM: 1.0 is 0xff in the low byte, the other three kept. + spv = self.store("") + memory = {0x200: 0x11223344} + support.run_fragment(spv, inputs={"%wg_id": (0, 0, 0), "%local_id": (0, 0, 0)}, + push_constants=OUT_VSHARP + [0] * 28, memory=memory) + self.assertEqual(f"{memory[0x200]:#010x}", "0x112233ff") + + def test_data_vgprs_are_read(self): + # read_before_write_vgprs: a store's vdata is a source, as for buffer_store. + import shader_ir + ins = shader_ir.parse_line("\ttbuffer_store_format_xy v[7:8], v5, s[4:7], 0 format:[BUF_FMT_32_32_FLOAT] offen") + self.assertEqual(sorted(rdna2spirv.read_before_write_vgprs([ins])), [5, 7, 8]) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_awc_names.py b/tests/test_awc_names.py index b73cacc860..766cdd12de 100644 --- a/tests/test_awc_names.py +++ b/tests/test_awc_names.py @@ -188,6 +188,21 @@ def test_end_to_end(self): with open(json_out, encoding="utf-8") as fh: self.assertEqual(json.load(fh)["summary"]["banks"]["streams"], 3) + def test_rejects_output_aliasing_conversation(self): + with tempfile.TemporaryDirectory() as tmp: + bank = write(os.path.join(tmp, "one.awc"), make_bank(["zz_rootau_abcd_01"])) + original = b"ZZ_ROOTAU_ABCD\x00ZZ_A\x00" + conv = write(os.path.join(tmp, "c.pso"), original) + alias = os.path.join(tmp, ".", "c.pso") + err = io.StringIO() + with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(err): + with self.assertRaises(SystemExit) as cm: + A.main([bank, "--conversations", conv, "--out", alias]) + self.assertEqual(cm.exception.code, 2) + self.assertIn("--out must not overwrite an input", err.getvalue()) + with open(conv, "rb") as f: + self.assertEqual(f.read(), original) + def test_hashdict_json_words(self): with tempfile.TemporaryDirectory() as tmp: path = write(os.path.join(tmp, "hashes.json"), json.dumps({"0000abcd": "Some_Word"})) diff --git a/tests/test_bink_names.py b/tests/test_bink_names.py index 1a52eeb54f..a78eb28e3a 100644 --- a/tests/test_bink_names.py +++ b/tests/test_bink_names.py @@ -194,6 +194,18 @@ def test_single_pipe_row_and_split_rows_agree(self): class TestCli(unittest.TestCase): + def test_rejects_negative_max_skip(self): + with tempfile.TemporaryDirectory() as tmp: + xml = os.path.join(tmp, "list.xml") + with open(xml, "w", encoding="utf-8") as f: + f.write(mount_xml([])) + err = io.StringIO() + with contextlib.redirect_stdout(io.StringIO()), contextlib.redirect_stderr(err): + with self.assertRaises(SystemExit) as cm: + names_mod.main([tmp, "--mount", xml, "--max-skip", "-1"]) + self.assertEqual(cm.exception.code, 2) + self.assertIn("--max-skip must be 0 or more", err.getvalue()) + def test_archive_end_to_end(self): shapes = [(1280, 720, 40), (1920, 1080, 50), (512, 512, 15)] with tempfile.TemporaryDirectory() as tmp: diff --git a/tests/test_ctest_registration.py b/tests/test_ctest_registration.py index cfaad282fd..980c11cec1 100644 --- a/tests/test_ctest_registration.py +++ b/tests/test_ctest_registration.py @@ -63,6 +63,38 @@ def test_indirect_rt_skips_with_the_ctest_skip_code(self): self.assertEqual(len(skips), 3, f"expected three whole-test SKIP paths, got {len(skips)}") self.assertEqual(skips, [77, 77, 77], "SKIP paths must return 77 for SKIP_RETURN_CODE 77") + def test_whole_test_skips_return_the_skip_code(self): + # A test registered with SKIP_RETURN_CODE 77 that prints SKIP and returns 0 is counted as passed although it + # checked nothing: bink_audio_test did that for a movie without audio tracks after #1580. + wrong = whole_test_skips_not_77(self.cmake, ROOT / "runtime") + self.assertEqual(wrong, [], f"SKIP followed by a return code other than 77: {wrong}") + + +def whole_test_skips_not_77(cmake_text, runtime_dir): + """[(source:line, code)] for a SKIP print directly followed by `return N;` (N != 77) in the sources of a test + registered with SKIP_RETURN_CODE 77. A SKIP print with no return right after it skips one section, not the test.""" + skip_tests = set(re.findall(r"set_tests_properties\(\s*([A-Za-z0-9_]+)\s+PROPERTIES[^)]*SKIP_RETURN_CODE\s+77", + cmake_text)) + commands = dict(re.findall(r"add_test\(\s*NAME\s+([A-Za-z0-9_]+)\s+COMMAND\s+\"?([A-Za-z0-9_]+)", cmake_text)) + wrong = [] + for test in sorted(skip_tests): + exe = commands.get(test) + m = exe and re.search(r"add_executable\(\s*" + re.escape(exe) + r"\b([^)]*)\)", cmake_text) + if not m: + continue + for src in re.findall(r"(test/[A-Za-z0-9_./]+\.cpp)", m.group(1)): + path = runtime_dir / src + if not path.is_file(): + continue + lines = path.read_text(encoding="utf-8", errors="replace").splitlines() + for i, line in enumerate(lines): + if not re.search(r'(printf|puts)\(\s*"SKIP', line): + continue + after = re.match(r"\s*return\s+(\w+)\s*;", lines[i + 1]) if i + 1 < len(lines) else None + if after and after.group(1) != "77": + wrong.append((f"{src}:{i + 2}", after.group(1))) + return wrong + if __name__ == "__main__": unittest.main() diff --git a/tests/test_d16_format_probe.py b/tests/test_d16_format_probe.py new file mode 100644 index 0000000000..320116d6dc --- /dev/null +++ b/tests/test_d16_format_probe.py @@ -0,0 +1,222 @@ +"""tools/d16_format_probe.py: the candidate rules, the GFX10 descriptor, what each kernel stages and loads, the +comparison and its exit codes (through a fake oracle that plays the GPU), and the exit-77 contract. The last class +runs on the hardware when the oracle tools are present and the GPU is GFX10, and is skipped otherwise. Standard +library only.""" +import io +import json +import os +from contextlib import redirect_stdout +from pathlib import Path +import re +import subprocess +import sys +import tempfile +import unittest +from unittest import mock + +TOOLS = Path(__file__).resolve().parents[1] / "tools" +sys.path.insert(0, str(TOOLS)) +import d16_format_probe as pr # noqa: E402 +from hw_oracle import asm, runner # noqa: E402 + + +class Rules(unittest.TestCase): + def test_self_test(self): + with redirect_stdout(io.StringIO()): + self.assertEqual(pr.self_test(), 0) + + def test_the_489_counts_in_docs_design(self): + # docs/design.md ("d16 and f16 format narrowing"): with RTZ narrowing 123 of 256 UNORM8, 31,742 of 65,536 + # UNORM16 and 110 of 256 SNORM8 values came out 1 ulp low + self.assertEqual(pr.rte_rtz_disagreements("unorm", 8), 123) + self.assertEqual(pr.rte_rtz_disagreements("snorm", 8), 110) + self.assertEqual(pr.rte_rtz_disagreements("unorm", 16), 31742) + + def test_only_four_16_bit_values_separate_one_rounding_from_two(self): + split = {(k, v) for k in ("unorm", "snorm") for v in range(65536) + if pr.models16(k, 16, v)["rte"] != pr.models16(k, 16, v)["f32_rte"]} + self.assertEqual(split, {("unorm", 0xFFAF), ("unorm", 0xFFEF), ("snorm", 0x7FF7), ("snorm", 0x8009)}) + + def test_8_and_10_bit_formats_only_tell_rte_from_rtz(self): + for kind, n in (("unorm", 8), ("snorm", 8), ("unorm", 10)): + for v in range(1 << n): + m = pr.models16(kind, n, v) + self.assertEqual(len({m["f32_rte"], m["rte"], m["mul_rte"], m["f32_rte_flush"]}), 1, (kind, v)) + + def test_snorm_minimum_is_minus_one_and_f32_decode_is_exact(self): + self.assertEqual(pr.models16("snorm", 8, 0x80)["f32_rte"], 0xBC00) + self.assertEqual(pr.models16("snorm", 8, 0x81)["f32_rte"], 0xBC00) + self.assertEqual(pr.models32("unorm", 16, 0xFFFF)["f32_rte"], 0x3F800000) + self.assertEqual(pr.models32("unorm", 8, 0x80)["f32_rte"], 0x3F008081) # 128 / 255 + + +class Kernels(unittest.TestCase): + def test_descriptor_word3(self): + w = pr.descriptor_word3(8) + self.assertEqual([w & 7, w >> 3 & 7, w >> 6 & 7, w >> 9 & 7], [4, 5, 6, 7]) + self.assertEqual((w >> 12 & 0x7F, w >> 24 & 1, w >> 28 & 3, w >> 30), (8, 1, 3, 0)) + + def test_every_value_is_staged_once(self): + for fmt, (_, _, n) in pr.FORMATS.items(): + seen = [] + for inst, base in pr.jobs(fmt): + if inst != "buffer_d16": + continue + self.assertEqual(pr.kernel_lines(inst, fmt, base)[0], f"v_add_nc_u32 v1, 0x{base:x}, v0") + seen += [(base + t) & ((1 << n) - 1) for t in range(min(pr.THREADS, (1 << n) - base))] + self.assertEqual(seen, list(range(1 << n)), fmt) + + def test_mtbuf_names_the_format_and_mubuf_takes_it_from_the_descriptor(self): + lines = pr.kernel_lines("tbuffer_d16", "snorm16", 0) + self.assertIn("format:8 offen glc dlc", lines[10]) + self.assertTrue(pr.kernel_lines("buffer_d16", "snorm16", 0)[10].startswith("buffer_load_format_d16_x")) + self.assertIn(f"s_mov_b32 s11, 0x{pr.descriptor_word3(8):x}", lines) + + def test_kernels_assemble_for_rdna2(self): + try: + clang = runner.find_clang() + except runner.Unavailable as e: + self.skipTest(str(e)) + kernels = [asm.Kernel(pr.kernel_lines(inst, fmt, 0), 32, pr.THREADS, pr.WORDS, raw=True, vgprs=8, sgprs=16) + for fmt in pr.FORMATS for inst in pr.INSTS] + text, names, _ = asm.module_text(kernels, "gfx1031", wave=32) + with tempfile.TemporaryDirectory() as d: + s = Path(d) / "k.s" + s.write_text(text, encoding="utf-8") + r = subprocess.run([clang, "--target=amdgcn-amd-amdhsa", "-mcpu=gfx1031", "-c", str(s), "-o", + str(Path(d) / "k.o")], capture_output=True, text=True) + self.assertEqual(r.returncode, 0, r.stderr[:800]) + self.assertIn("global_store_dword v4, v3, s[2:3]", text) + self.assertIn("s_waitcnt_vscnt null, 0x0", text) + + +class FakeOracle: + """Plays the GPU: reads each kernel's base, format code and load, and answers with a rule's bits.""" + arch = "gfx1031" + device = "fake gfx1031" + + def __init__(self, rule="rte", clobber_hi=False, wave64_off=None): + self.rule, self.clobber_hi, self.wave64_off = rule, clobber_hi, wave64_off + + def run(self, kernels, words=4): + code_of = {c: (f, k, n) for f, (c, k, n) in pr.FORMATS.items()} + out = [] + for k in kernels: + base = int(re.search(r"0x([0-9a-f]+)", k.lines[0]).group(1), 16) + w3 = int(next(ln for ln in k.lines if ln.startswith("s_mov_b32 s11")).split("0x")[1], 16) + fmt, kind, n = code_of[w3 >> 12 & 0x7F] + load = k.lines[10] + staged = [(base + t) & ((1 << n) - 1) for t in range(pr.THREADS)] + res = [] + for v in staged: + if kind == "f16": + bits = v + elif load.startswith("buffer_load_format_x"): + res.append(pr.models32(kind, n, v)["f32_rte"]) + continue + else: + bits = pr.models16(kind, n, v)[self.rule] + if self.wave64_off is not None and k.wave == 64 and v == self.wave64_off: + bits ^= 1 + hi = 0 if self.clobber_hi else pr.HI_SEED + res.append(hi | bits) + out.append(staged + res) + return out + + def close(self): + pass + + +def run_main(oracle, *args): + buf = io.StringIO() + with mock.patch.object(runner, "open_oracle", return_value=oracle), redirect_stdout(buf): + rc = pr.main(["--formats", "unorm8,float16", *args]) + return rc, buf.getvalue() + + +class Compare(unittest.TestCase): + def test_the_translators_rule_matches_everywhere(self): + rc, out = run_main(FakeOracle()) + self.assertEqual(rc, 0, out) + self.assertIn("off the rule 0", out) + self.assertIn("own bits 65536/65536", out) + + def test_double_rounding_hardware_shows_the_four_halfway_values(self): + buf = io.StringIO() + with mock.patch.object(runner, "open_oracle", return_value=FakeOracle("f32_rte")), redirect_stdout(buf): + rc = pr.main(["--formats", "unorm16,snorm16", "--waves", "32"]) + self.assertEqual(rc, 0, buf.getvalue()) + self.assertEqual(buf.getvalue().count("off the rule 2"), 4) # MUBUF and MTBUF, two formats + self.assertIn("value 0xffef: hw 0x3c00, rule 0x3bff", buf.getvalue()) + + def test_rtz_hardware_is_a_finding_not_a_failure(self): + with tempfile.TemporaryDirectory() as d: + j = os.path.join(d, "r.json") + rc, out = run_main(FakeOracle("f32_rtz"), "--json", j) + with open(j, encoding="utf-8") as f: + rep = json.load(f) + self.assertEqual(rc, 0, out) + d16 = rep["formats"]["unorm8"]["insts"]["buffer_d16"] + self.assertEqual(d16["off_rule"], 123) + self.assertEqual(d16["match"]["f32_rtz"], 256) + self.assertIn("f32_rtz", d16["first_off"][0]["fits"]) + + def test_a_wave_difference_exits_1(self): + rc, out = run_main(FakeOracle(wave64_off=9)) + self.assertEqual(rc, 1, out) + + def test_a_clobbered_high_half_is_a_harness_error(self): + rc, out = run_main(FakeOracle(clobber_hi=True)) + self.assertEqual(rc, 2, out) + self.assertIn("high half", out) + + def test_not_gfx10_exits_77(self): + o = FakeOracle() + o.arch = "gfx1150" + rc, out = run_main(o) + self.assertEqual(rc, 77, out) + + +class Cli(unittest.TestCase): + def test_exits_77_without_the_tools(self): + env = dict(os.environ, LEONIDA_AMD_CLANG=str(TOOLS / "no-such-clang.exe"), LEONIDA_HW_DRM_NODE="") + r = subprocess.run([sys.executable, "-I", str(TOOLS / "d16_format_probe.py"), "--formats", "unorm8"], + capture_output=True, text=True, env=env) + self.assertEqual(r.returncode, 77, r.stdout + r.stderr) + self.assertIn("unavailable", r.stdout) + + def test_unknown_format_is_a_usage_error(self): + r = subprocess.run([sys.executable, "-I", str(TOOLS / "d16_format_probe.py"), "--formats", "unorm12"], + capture_output=True, text=True) + self.assertEqual(r.returncode, 2) + self.assertIn("unorm12", r.stderr) + + +class OnHardware(unittest.TestCase): + @classmethod + def setUpClass(cls): + try: + cls.oracle = runner.open_oracle() + except runner.Unavailable as e: + raise unittest.SkipTest(f"hardware oracle unavailable: {e}") from None + if asm.family(cls.oracle.arch) != "gfx10": + cls.oracle.close() + raise unittest.SkipTest(f"{cls.oracle.arch} is not GFX10") + + @classmethod + def tearDownClass(cls): + cls.oracle.close() + + def test_unorm8_controls_hold_and_both_wave_sizes_agree(self): + w32 = pr.sweep(self.oracle, "unorm8", 32) + w64 = pr.sweep(self.oracle, "unorm8", 64) + self.assertEqual(w32, w64) + res = pr.classify("unorm8", w32) + self.assertEqual(res["control"], []) + self.assertEqual(w32["buffer_d16"][255] & 0xFFFF, 0x3C00) + self.assertEqual(w32["buffer_d16"][0] & 0xFFFF, 0) + self.assertEqual(w32["buffer_f32"][255], 0x3F800000) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_docs_design_rows.py b/tests/test_docs_design_rows.py new file mode 100644 index 0000000000..5da04ba599 --- /dev/null +++ b/tests/test_docs_design_rows.py @@ -0,0 +1,64 @@ +"""Each table in docs/design.md, docs/README.md and docs/testing.md names a topic once. + + python -I tests/test_docs_design_rows.py + +The translator contract table is where every new rule is recorded (CONTRIBUTING.md, AGENTS.md). When two branches +edit the same row and a merge keeps both sides, the table ends up with two rows for one topic, each holding facts the +other lacks, and a reader who stops at the first one misses the rest. On 2026-11-22 twenty topics appeared two to six +times; the docs index and the testing guide's "Known problems" had the same pattern. This test fails on a repeated +first cell within one table of those pages, where the first cell is the topic (other pages repeat it on purpose, e.g. +one row per benchmark size). No game files or build tools. +""" +import os +import unittest + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +PAGES = ("design.md", "README.md", "testing.md") + + +def repeated_topics(lines): + """[(topic, [1-based line numbers])] for first cells that appear more than once in one table.""" + found = [] + table, in_fence = [], False + + def close(): + seen = {} + for n in table[2:]: # skip the header and the |---| rule + cells = lines[n - 1].split("|") + if len(cells) > 2 and cells[1].strip(): + seen.setdefault(cells[1].strip(), []).append(n) + found.extend((k, v) for k, v in seen.items() if len(v) > 1) + + for n, line in enumerate(lines, 1): + if line.lstrip().startswith("```"): + in_fence = not in_fence + if not in_fence and line.startswith("|"): + table.append(n) + continue + if table: + close() + table = [] + if table: + close() + return found + + +class DesignTableRows(unittest.TestCase): + def test_checker_finds_a_repeated_topic_within_one_table_only(self): + lines = ["| Topic | Rule |", "|---|---|", "| EXEC | old |", "| LDS | x |", "| EXEC | new |", "", + "| Topic | Rule |", "|---|---|", "| LDS | other table |", "```", "| EXEC | in a code block |", + "| EXEC | in a code block |", "```"] + self.assertEqual(repeated_topics(lines), [("EXEC", [3, 5])]) + + def test_each_page_names_each_topic_once_per_table(self): + for page in PAGES: + with self.subTest(page=page): + with open(os.path.join(ROOT, "docs", page), encoding="utf-8") as f: + lines = f.read().split("\n") + repeated = repeated_topics(lines) + self.assertEqual(repeated, [], f"rows to merge into one in docs/{page} (topic, lines): " + + "; ".join(f"{k[:60]!r} at {v}" for k, v in repeated)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_docs_list_items.py b/tests/test_docs_list_items.py new file mode 100644 index 0000000000..029994b0d6 --- /dev/null +++ b/tests/test_docs_list_items.py @@ -0,0 +1,72 @@ +"""No list item in the Markdown docs is repeated a few lines later. + + python -I tests/test_docs_list_items.py + +When two branches rewrite the same bullet and a merge keeps both sides, the page shows the bullet twice: the current +text and the one it replaced, often next to each other (docs/d3d12_vulkan.md had its RTV/DSV bullet twice and its +"Hash-table cost" / "Wave64" risks twice each; docs/character_models.md kept the first line of a rewritten bullet). +A reader cannot tell which copy is current. This test flags two list items within WINDOW lines of each other whose +openings match. Reads tracked Markdown only; no game files. +""" +import os +import re +import subprocess +import unittest + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +ITEM = re.compile(r"^(\s*)(?:[-*+]|\d+[.)])\s+(\S.*)$") +WINDOW = 8 # lines between the two items +OPENING = 60 # characters of the item's text that must match (after the list marker) + + +def repeated_items(text): + """[(line a, line b)] for list items within WINDOW lines whose first OPENING characters are equal.""" + items, in_fence = [], False + for n, line in enumerate(text.split("\n"), 1): + if line.lstrip().startswith("```"): + in_fence = not in_fence + continue + m = None if in_fence else ITEM.match(line) + if m and len(m.group(2)) >= OPENING: + items.append((n, len(m.group(1)), m.group(2)[:OPENING])) + found = [] + for i, (n, indent, head) in enumerate(items): + for n2, indent2, head2 in items[i + 1:]: + if n2 - n > WINDOW: + break + if indent2 == indent and head2 == head: + found.append((n, n2)) + return found + + +def markdown_files(): + try: + out = subprocess.run(["git", "ls-files", "*.md"], cwd=ROOT, capture_output=True, text=True, check=True).stdout + files = out.split() + except (OSError, subprocess.CalledProcessError): + files = [os.path.relpath(os.path.join(r, f), ROOT).replace(os.sep, "/") + for r, d, fs in os.walk(ROOT) if ".git" not in r for f in fs if f.endswith(".md")] + return [f for f in files if not f.startswith("third_party/")] + + +class RepeatedListItems(unittest.TestCase): + def test_checker_flags_a_repeated_item_only(self): + current = "- **Wave64.** A native wave64 shader needs a 64-wide subgroup in its stage: AMD can require it" + old = "- **Wave64.** A native wave64 shader needs a 64-wide subgroup in its stage: AMD (old wording)" + text = "\n".join([current, " continued", "- **Other.** " + "x" * 70, old, "", + "- **19 two-slice 2D arrays** (`depth = 2`, `depth - 1 = 1`) appeared as `depth = 1`", + "- **99 three-slice 2D arrays** (`depth = 3`, `depth - 1 = 2`) appeared as `depth = 2`", + "```", current, current, "```"]) + self.assertEqual(repeated_items(text), [(1, 4)]) + + def test_docs_have_no_repeated_list_items(self): + found = [] + for path in markdown_files(): + with open(os.path.join(ROOT, path), encoding="utf-8") as f: + found += [f"{path}:{a} and :{b}" for a, b in repeated_items(f.read())] + self.assertEqual(found, [], "a list item repeated a few lines later (keep the current copy): " + + "; ".join(found)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_docs_repo_paths.py b/tests/test_docs_repo_paths.py new file mode 100644 index 0000000000..69f19b0e23 --- /dev/null +++ b/tests/test_docs_repo_paths.py @@ -0,0 +1,79 @@ +"""Repository paths the docs name in backticks exist. + + python -I tests/test_docs_repo_paths.py + +`tests/test_docs_links.py` checks Markdown links; this checks the other way the docs point at code, a backticked +`tools/...`, `runtime/...`, `tests/...` or `scripts/...` path. A rename, or a page written against an unmerged pull +request, leaves such a path pointing at nothing (docs/saves.md described #279's `xgameruntime_services.cpp` as the +runtime's save store while #279 was still open). Reads tracked files only (`git ls-files`, with a directory walk when +git is not available); no game files. +""" +import os +import re +import subprocess +import unittest + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +PATH = re.compile(r"`((?:tools|runtime|tests|scripts)/[A-Za-z0-9_./\-]+)`") +# Pages that quote another project's tree (SCARAB, americas-recomp): their paths are not this repository's. +OTHER_PROJECTS = {"docs/fssm_crosscheck.md", "docs/d3d12_xs_surface.md"} +# Build output, not tracked. +BUILD_OUTPUT = ("runtime/build",) + + +def tracked_files(): + try: + out = subprocess.run(["git", "ls-files"], cwd=ROOT, capture_output=True, text=True, check=True).stdout + return [p for p in out.splitlines() if p] + except (OSError, subprocess.CalledProcessError): + found = [] + for root, dirs, files in os.walk(ROOT): + dirs[:] = [d for d in dirs if d not in (".git", "build", "__pycache__")] + found += [os.path.relpath(os.path.join(root, f), ROOT).replace(os.sep, "/") for f in files] + return found + + +def missing_paths(pages, files): + """[(page:line, path)] for backticked repository paths in `pages` ({name: text}) that `files` lacks.""" + known = set(files) + for f in files: + parts = f.split("/") + known.update("/".join(parts[:i]) for i in range(1, len(parts))) + out = [] + for page, text in sorted(pages.items()): + in_fence = False + for n, line in enumerate(text.split("\n"), 1): + if line.lstrip().startswith("```"): + in_fence = not in_fence + continue + if in_fence or "://" in line: # a link into another repository names its paths + continue + for m in PATH.finditer(line): + path = m.group(1).rstrip("/.") + if "*" in path or path.startswith(BUILD_OUTPUT) or path in known: + continue + out.append((f"{page}:{n}", path)) + return out + + +class DocsRepoPaths(unittest.TestCase): + def test_checker_reports_only_the_missing_path(self): + pages = {"docs/a.md": "Run `tools/real.py`, then `tools/gone.py`.\n```\n`tools/in_fence.py`\n```\n" + "`runtime/build/x.exe` and `tests/` and [`tools/x.py`](https://example.org/tools/x.py)"} + self.assertEqual(missing_paths(pages, ["tools/real.py", "tests/t.py"]), [("docs/a.md:1", "tools/gone.py")]) + + def test_docs_name_existing_paths(self): + files = tracked_files() + pages = {} + for p in files: + if p.startswith("docs/") and p.endswith(".md") and p not in OTHER_PROJECTS: + with open(os.path.join(ROOT, p), encoding="utf-8") as f: + pages[p] = f.read() + self.assertTrue(pages) + missing = missing_paths(pages, files) + self.assertEqual(missing, [], "backticked paths that name no tracked file: " + + "; ".join(f"{where} {path}" for where, path in missing)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_feature_scan.py b/tests/test_feature_scan.py index a3e80ae439..41a4dd8158 100644 --- a/tests/test_feature_scan.py +++ b/tests/test_feature_scan.py @@ -318,9 +318,103 @@ def test_v_perm_b32_selectors(): assert failures == 0, f"{failures} v_perm_b32 check(s) failed" +def psv0(records, size=24, truncate=False): + """PSV0 payload: a 24-byte runtime info, then the resource count, record size and (type, kind) records.""" + body = struct.pack("= 24 else b"") + body += rec + bytes(size - len(rec)) + return body[:-4] if truncate else body + + +def listing(lines): + """A .s listing with `; encoding:` comments of the right length, so pcs and branch targets are real.""" + return "".join(f"\t{code} ; encoding: [{','.join(['0x00'] * n)}]\n" for code, n in lines) + + +def test_typed_buffers_and_psv0(): + """§8.2 #16: PSV0 counter/typed-buffer bindings, MTBUF formats and where each MUBUF V# word 3 comes from.""" + with tempfile.TemporaryDirectory() as tmp: + sh = os.path.join(tmp, "shaders") + dx = os.path.join(sh, "dxbc") + dis = os.path.join(dx, "disasm") + os.makedirs(dis) + cs = listing([ + ("s_load_dwordx4 s[8:11], s[0:1], 0x0", 8), # pc 0 + ("s_mov_b32 s15, 0x38000", 8), # 8: format 56, 8_8_8_8_UNORM + ("s_mov_b32 s19, 0x24000", 8), # 16: format 36, 10_11_11_FLOAT + ("s_or_b32 s23, s23, 0x1000", 8), # 24: computed + ("s_cmp_eq_u32 s11, 0", 4), # 32: reads s11, writes nothing + ("buffer_load_format_xyzw v[0:3], v4, s[8:11], 0 idxen", 8), # 36: memory + ("buffer_load_format_x v5, v4, s[12:15], 0 idxen", 8), # 44: literal + ("buffer_store_format_x v5, v4, s[16:19], 0 idxen", 8), # 52: literal, not in the table + ("buffer_load_format_x v6, v4, s[20:23], 0 idxen", 8), # 60: computed + ("buffer_load_format_x v7, v4, s[24:27], 0 idxen", 8), # 68: never written: shader input + ("s_cbranch_scc0 1", 4), # 76: to 84; 80 and 84 lead blocks + ("s_nop 0", 4), # 80 + ("buffer_load_format_x v8, v4, s[8:11], 0 idxen", 8), # 84: loaded in an earlier block + ("buffer_load_format_x v9, v4, s[12:15], 0 idxen", 8), # 92: literal from an earlier block + ("tbuffer_load_format_xy v[0:1], v4, s[8:11], 0 format:[BUF_FMT_16_16_SNORM] idxen", 8), + ("tbuffer_load_format_x v2, v4, s[8:11], 0 idxen", 8), # no format: GFX10 default 8_UNORM + ("tbuffer_store_format_x v2, v4, s[8:11], 0 format:[BUF_FMT_10_11_11_FLOAT] idxen", 8), + ("s_endpgm", 4)]) + ps = listing([("s_mov_b32 s11, 0", 4), # word 3 0: FORMAT INVALID + ("buffer_load_format_x v0, v1, s[0:3], 0 idxen", 8), + ("buffer_load_format_x v2, v1, s[8:11], 0 idxen", 8), ("s_endpgm", 4)]) + vs = listing([("v_mov_b32_e32 v0, v1", 4), ("s_endpgm", 4)]) + synthetic = [ + ("tb_cs", "cs", cs, psv0([(9, 12), (3, 10), (6, 2)])), # counter UAV, typed buffer SRV, typed 2D UAV + ("tb_ps", "ps", ps, psv0([(6, 10), (6, 10)])), # two typed buffer UAVs + ("tb_vs", "vs", vs, psv0([(3, 10)], size=16)), # v0 records carry no kind + ("tb_gs", "gs", None, psv0([(9, 12)], truncate=True)), # records past the end of the part + ] + index = [] + for name, stage, text, psv in synthetic: + with open(os.path.join(dx, name + ".dxbc"), "wb") as f: + f.write(dxbc([("SFI0", struct.pack("I", first + len(sections) + 16) + b"\x12\x34\x56\x78") + return b"PSIN" + struct.pack(">I", first) + rows + data + sections + + def pragma_magic(pattern): """The bytes of `#pragma magic [ .. ] @ 0x00` in a pattern file.""" with open(os.path.join(PATTERNS, pattern), encoding="utf-8") as f: @@ -92,9 +119,20 @@ def test_synthetic_streams_parse(self): self.assertEqual(r["elements"], 2) self.assertEqual(r["descriptors"], 7) + def test_synthetic_psin_parses(self): + blob = psin_container() + r = psin_index.parse(blob, schema=True) + self.assertTrue(r["complete"], r["error"]) + self.assertEqual(r["schema"]["reason"], "") + self.assertEqual(r["lsns_blocks"], len(LSNS_BLOCKS)) + blocks, exact = psin_data.block_table(blob, r["first_section"]) + self.assertTrue(exact) + self.assertEqual([(t, n) for t, _at, n in blocks], [(t, len(d)) for t, d in PSIN_BLOCKS]) + def test_pattern_magics(self): self.assertEqual(pragma_magic("rbf0.hexpat"), rbf0_index.MAGIC) self.assertEqual(pragma_magic("rpf9.hexpat"), b"9FPR") # RPF9 stored little-endian (docs/rpf.md) + self.assertEqual(pragma_magic("psin.hexpat"), psin_index.MAGIC) @unittest.skipUnless(IMHEX, "ImHex is not installed (set LEONIDA_IMHEX to imhex.exe)") @@ -160,6 +198,54 @@ def test_rpf9_header_and_opaque_toc(self): self.assertEqual((got["header"]["u32_08"], got["header"]["u32_0c"]), (0x11, 0x22)) self.assertEqual(len(got["header_rest_and_toc"]), 0x100 - 0x10) + def test_psin_matches_psin_index_and_psin_data(self): + blob = psin_container() + ref = psin_index.parse(blob, schema=True) + table, _exact = psin_data.block_table(blob, ref["first_section"]) + got, log = self.run_pattern("psin.hexpat", blob) + self.assertIsNotNone(got, log) + self.assertEqual(got["header"]["first_section"], ref["first_section"]) + + # Block table: rows, the "pppppppp" end, and each block's data where psin_data places it. + self.assertEqual([(r["type"], r["size"]) for r in got["rows"]], [(t, n) for t, _at, n in table]) + self.assertEqual(got["table_end"], "pppppppp") + self.assertEqual([bytes(b["data"]) for b in got["blocks"]], [blob[at:at + n] for _t, at, n in table]) + + sections = {s["tag"]: s for s in got["sections"]} + self.assertEqual([(s["tag"], s["size"]) for s in got["sections"]], + [(s["tag"], s["size"]) for s in ref["sections"]]) + schema = ref["schema"] + self.assertEqual([s["name_hash"] for s in sections["LSCH"]["structs"]], + [int(s["hash"], 16) for s in schema["structs"]]) + self.assertEqual([(m["name_hash"], m["offset"], m["type"], m["index"], m["ref_hash"]) + for m in sections["LSCH"]["members"]], + [(int(m["hash"], 16), m["offset"], m["type"], m["index"], int(m["ref"], 16)) + for s in schema["structs"] for m in s["members"]]) + self.assertEqual([e["value_count"] for e in sections["LENM"]["enums"]], + [len(e["values"]) for e in schema["enums"]]) + self.assertEqual([v["value"] for v in sections["LENM"]["values"]], + [v["value"] for e in schema["enums"] for v in e["values"]]) + lsns = next(s for s in ref["sections"] if s["tag"] == "LSNS") + self.assertEqual([(d["kind"], d["bytes"]) for d in sections["LSNS"]["descs"]], + [(int(b["kind"], 16), b["bytes"]) for b in lsns["blocks"]]) + self.assertEqual([len(b["records"]) for b in sections["LSNS"]["lsns_blocks"]], [n // 16 for _k, n in LSNS_BLOCKS]) + self.assertEqual(sections["LRSC"]["rsc_version"], ref["rsc_version"]) + self.assertEqual(sections["LRSC"]["root_block"], 1) + self.assertEqual(sections["CHKS"]["checksum_size"], ref["checksum_size"]) + + def test_psin_truncated_keeps_the_whole_sections(self): + blob = psin_container(lsns=False) + first = struct.unpack_from(">I", blob, 4)[0] + lsch_size = struct.unpack_from(">I", blob, first + 4)[0] + cut = blob[:first + lsch_size + 20] # inside LENM + self.assertFalse(psin_index.parse(cut)["complete"]) + got, log = self.run_pattern("psin.hexpat", cut) + self.assertIsNotNone(got, log) + tags = [s["tag"] for s in got["sections"]] + self.assertEqual(tags, ["LSCH", "LENM"]) + self.assertIn("structs", got["sections"][0]) + self.assertEqual(len(got["sections"][1]["truncated"]), 12) # what is left after LENM's 8-byte header + def test_rpf9_rejects_a_data_offset_past_the_end(self): got, log = self.run_pattern("rpf9.hexpat", rpf9_archive(data_offset=0x100, size=0x140)[:0x20]) self.assertIsNone(got) diff --git a/tests/test_int_hw_probe.py b/tests/test_int_hw_probe.py index f2287f9a65..69336702b8 100644 --- a/tests/test_int_hw_probe.py +++ b/tests/test_int_hw_probe.py @@ -81,11 +81,18 @@ def test_known_divergence_vs_strict_and_json_output(self): with tempfile.TemporaryDirectory() as tmp: jpath = os.path.join(tmp, "out.json") out = io.StringIO() + # The table is empty since #1831/#1856 fixed the measured divergences, so give the reporting path one: the + # "hardware" returns other words for v_cvt_flr_edges, and the table lists them as a known divergence. + fake_hw[1][32]["v_cvt_flr_edges"] = fake_hw[1][64]["v_cvt_flr_edges"] = [1, 2, 3, 4] + known = {"v_cvt_flr_edges": ("synthetic", [1, 2, 3, 4], "test-only divergence")} + patch_known = unittest.mock.patch.dict(probe.KNOWN_DIVERGENCES, known) + patch_known.start() + self.addCleanup(patch_known.stop) with unittest.mock.patch.object(probe, "run_hw", return_value=fake_hw): with redirect_stdout(out): rc = probe.main(["--oracle", "both", "--group", "valu_cvt_flr_rpi", "--json", jpath]) self.assertEqual(rc, 0) - self.assertIn("2 match, 2 known divergence, 0 unexpected mismatch, 0 wave32/64 diff", out.getvalue()) + self.assertIn("3 match, 1 known divergence, 0 unexpected mismatch, 0 wave32/64 diff", out.getvalue()) data = json.loads(Path(jpath).read_text(encoding="utf-8")) self.assertEqual(data["device"], "device=mock arch=gfx1035") self.assertEqual(len(data["cases"]), 4) diff --git a/tests/test_lds_fuzz.py b/tests/test_lds_fuzz.py index e59020c2cb..3c286e45b8 100644 --- a/tests/test_lds_fuzz.py +++ b/tests/test_lds_fuzz.py @@ -85,6 +85,24 @@ def test_no_exec_keeps_the_rest_of_the_program(self): else: self.assertEqual(x, y) + def test_permute_is_generated_and_no_exec_clears_only_permute(self): + self.assertIn("permute", f.EXEC_KINDS) + found = 0 + for idx in range(40): + a = f.Program(1, idx, 64, permute=True) + b = f.Program(1, idx, 64, no_exec=("permute",), permute=True) + self.assertEqual(len(a.ops), len(b.ops)) + for x, y in zip(a.ops, b.ops): + if x["kind"] == "permute": + if x["exec"] is not None: + found += 1 + self.assertIsNone(y["exec"]) + self.assertEqual({k: v for k, v in x.items() if k not in ("exec", "hyp")}, + {k: v for k, v in y.items() if k not in ("exec", "hyp")}) + else: + self.assertEqual(x, y) + self.assertGreater(found, 0, "expected at least one permute op with non-None exec mask") + class Model(unittest.TestCase): def test_initial_lds_pattern(self): @@ -104,6 +122,48 @@ def test_bpermute_inactive_source_reads_zero(self): keep.ops = [] self.assertEqual(regs[9][21], keep.model()[0][9][21]) # lane 9 is off itself: keeps its value + def test_permute_collision_highest_active_wins_and_unaddressed_is_zero(self): + # All active lanes scatter to lane 5 in their own 32-lane half (mul=0, add=5, offset=0). + # EXEC: low half has lanes 0..7 active (highest active = 7); high half has lanes 32, 35, 40 active (highest = 40). + mask = 0xFF | (1 << 32) | (1 << 35) | (1 << 40) + p = f.Program(1, 0, 64) + p.ops = [{"kind": "permute", "mul": 0, "add": 5, "offset": 0, "src": 20, "dst": 21, "exec": mask}] + base = f.Program(1, 0, 64) + base.ops = [] + init_regs, _ = base.model() + regs, _ = p.model() + + # Low half: lane 5 is active and receives highest active source (lane 7). + self.assertEqual(regs[5][21], init_regs[7][20]) + # Low half: active lanes != 5 receive nobody -> 0. + for t in (0, 1, 2, 3, 4, 6, 7): + self.assertEqual(regs[t][21], 0) + # Low half: inactive lanes keep their original v21. + for t in (8, 15, 31): + self.assertEqual(regs[t][21], init_regs[t][21]) + # High half: target lane 32+5=37 is INACTIVE, so it keeps its original v21 even though 32,35,40 targeted it. + self.assertEqual(regs[37][21], init_regs[37][21]) + # High half: active lanes 32, 35, 40 receive nobody -> 0. + for t in (32, 35, 40): + self.assertEqual(regs[t][21], 0) + self.assertIn("ds_permute_b32 v21, v6, v20 offset:0", p.asm()) + + with f.perturbed("permute_lowest_wins"): + bad_regs, _ = p.model() + self.assertEqual(bad_regs[5][21], init_regs[0][20]) + + def test_permute_half_isolation_and_offset(self): + # Identity + offset:8 (+2 lanes) mod 32 within each 32-lane half, all lanes active. + p = f.Program(2, 1, 64) + p.ops = [{"kind": "permute", "mul": 1, "add": 0, "offset": 8, "src": 20, "dst": 22, "exec": None}] + base = f.Program(2, 1, 64) + base.ops = [] + init_regs, _ = base.model() + regs, _ = p.model() + for t in range(64): + src_lane = (t & ~31) | ((t - 2) & 31) + self.assertEqual(regs[t][22], init_regs[src_lane][20]) + def test_d16_hi_read_keeps_the_low_half(self): p = f.Program(1, 0, 64) p.ops = [{"kind": "read", "name": "ds_read_u16_d16_hi", "addr": (0, 0, 0), "dst": 20, "exec": None}] diff --git a/tests/test_lds_fuzz_hw.py b/tests/test_lds_fuzz_hw.py index 6041abfda9..986fddbb36 100644 --- a/tests/test_lds_fuzz_hw.py +++ b/tests/test_lds_fuzz_hw.py @@ -122,11 +122,13 @@ def test_permute_programs_carry_a_hypothesis(self): progs = f.programs(3, 40, (64, 32), permute=True) perm = [p for p in progs if any(op["kind"] == "permute" for op in p.ops)] self.assertTrue(perm) + parities = set() for p in perm: for i, op in enumerate(p.ops): self.assertEqual(i in p.hyp_ops, op["kind"] == "permute") if op["kind"] == "permute": - self.assertEqual(op["mul"] % 2, 1) # a bijection: no two lanes send to one lane + parities.add(op["mul"] % 2) + self.assertEqual(parities, {0, 1}) # generates both colliding and bijective multipliers def test_swizzle_exec_hypothesis_only_under_a_mask(self): progs = f.programs(3, 60, (32,), swizzle_exec=True) diff --git a/tests/test_make_game_preflight.py b/tests/test_make_game_preflight.py index f1950cd34d..540d0b0e35 100644 --- a/tests/test_make_game_preflight.py +++ b/tests/test_make_game_preflight.py @@ -654,16 +654,31 @@ def test_choose_game_multiple_found_non_interactive(self): self.assert_fails(make_game.choose_game, match="More than one copy found: choose one with --game.") - def default_out_in(self, platform, icloud_documents): - """default_out() with a temporary home folder; icloud_documents makes the folder macOS keeps in iCloud - Drive when Desktop & Documents sync is on (~/Library/Mobile Documents/com~apple~CloudDocs/Documents).""" + def default_out_in(self, platform, icloud_documents, earlier_build=False, call=None): + """default_out() (or `call`) with a temporary home folder; icloud_documents makes the folder macOS keeps in + iCloud Drive when Desktop & Documents sync is on (~/Library/Mobile Documents/com~apple~CloudDocs/Documents), + earlier_build a ~/Documents/Leonida from before the change.""" with tempfile.TemporaryDirectory() as home: if icloud_documents: os.makedirs(os.path.join(home, "Library", "Mobile Documents", "com~apple~CloudDocs", "Documents")) + if earlier_build: + os.makedirs(os.path.join(home, "Documents", "Leonida", "work")) with mock.patch.object(make_game.os.path, "expanduser", lambda p: home + p[1:] if p.startswith("~") else p), \ mock.patch.object(make_game.sys, "platform", platform): + if call: + return [note.replace(home, "~") for note in call()] return os.path.relpath(make_game.default_out(), home) + def test_icloud_note_names_an_earlier_build_in_documents(self): + # A Mac that built into ~/Documents/Leonida before the default moved: say where that resumable build is. + notes = self.default_out_in("darwin", True, earlier_build=True, call=make_game.icloud_default_notes) + self.assertEqual(len(notes), 2, notes) + self.assertIn("off iCloud", notes[0]) + self.assertIn(os.path.join("~", "Documents", "Leonida"), notes[1]) + self.assertIn(os.path.join("~", "Leonida") + " to resume", notes[1]) + self.assertIn("--out", notes[1]) + self.assertEqual(len(self.default_out_in("darwin", True, call=make_game.icloud_default_notes)), 1) + def test_default_out_matches_documents_folder(self): for platform in ("win32", "linux", "darwin"): self.assertEqual(self.default_out_in(platform, False), os.path.join("Documents", "Leonida"), platform) diff --git a/tests/test_mission_tables.py b/tests/test_mission_tables.py new file mode 100644 index 0000000000..738266023c --- /dev/null +++ b/tests/test_mission_tables.py @@ -0,0 +1,235 @@ +"""Synthetic tests for tools/mission_tables.py (no game data: every byte below is built here).""" +import json +import os +import struct +import subprocess +import sys +import tempfile +import unittest + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +TOOL = os.path.join(ROOT, "tools", "mission_tables.py") +sys.path.insert(0, os.path.join(ROOT, "tools")) + +import mission_tables as M # noqa: E402 + + +def record(key, kind, offset, count, col_b=1, band=0): + """One 32-byte record. The offset sits in the high half of the dword at +16.""" + word = (kind & 0xFFFF) | ((offset & 0xFFFF) << 16) + return struct.pack("<8I", key, 0, col_b, 0, word, band, (count << 16) | count, 0) + + +def element(archetype, pos, rot, link, hash_value=None, extra=0): + """One 64-byte pool element: hash, 3 zeros, pos(x,y,z,x), rot(x,y,z,x), hash, link, extra, 0.""" + head = struct.pack("<4I", archetype, 0, 0, 0) + pos_bytes = struct.pack("<4f", pos[0], pos[1], pos[2], pos[0]) + rot_bytes = struct.pack("<4f", rot[0], rot[1], rot[2], rot[0]) + tail = struct.pack("<4I", archetype if hash_value is None else hash_value, link, extra, 0) + return head + pos_bytes + rot_bytes + tail + + +def blob_with(records, elements): + """records: [(address, bytes)]; elements: [(address, bytes)]. Returns a zero-padded bytearray.""" + end = max([address + len(data) for address, data in records + elements] + [0]) + blob = bytearray(end) + for address, data in records + elements: + blob[address:address + len(data)] = data + return blob + + +def good_element(archetype=0x11223344, pos=(1.5, -2.25, 3.75), rot=(0.25, 0.5, -0.75), + link=0x55667788, extra=0): + return element(archetype, pos, rot, link, extra=extra) + + +class TestRecord(unittest.TestCase): + def test_big_endian_offset_half(self): + # The measured bytes of a real record: 03 00 80 07. kind is 3 and the offset is 0x780. + raw = struct.pack("<8I", 0x3B643C5E, 0, 1, 0, 0x07800003, 0, 0x00010001, 0) + self.assertEqual(raw[16:20], bytes((0x03, 0x00, 0x80, 0x07))) + decoded = M.decode_record(raw, 0) + self.assertIsNotNone(decoded) + self.assertEqual(decoded["key"], 0x3B643C5E) + self.assertEqual(decoded["kind"], 3) + self.assertEqual(decoded["poolOffset"], 0x780) # not 0x8007: the u16 is still little-endian + self.assertEqual(decoded["count"], 1) + self.assertEqual(decoded["band"], 0) + self.assertEqual(decoded["colB"], 1) + + def test_duplicated_count_and_zero_fields_are_required(self): + self.assertIsNone(M.decode_record(bytes(16), 0)) # shorter than a record + bad_count = bytearray(record(0x12345678, 1, 0x100, 1)) + struct.pack_into("> 6 + value = (value + (value << 3)) & 0xFFFFFFFF + value ^= value >> 11 + return (value + (value << 15)) & 0xFFFFFFFF + for name in ("", "StateOne", "RoadJob", "a_b-c.d"): + self.assertEqual(M.joaat(name), reference(name)) + + +class TestElement(unittest.TestCase): + def test_round_trip(self): + state_one = 0x11111111 + state_two = 0x22222222 + blob = blob_with( + [(0x100, record(state_one, 7, 0x1C0, 1)), + (0x120, record(state_two, 7, 0x200, 1))], + [(0x1C0, good_element(archetype=0xAABBCCDD, link=0x01020304)), + (0x200, good_element(archetype=0x99887766, link=0x05060708, + pos=(-10.0, 20.0, 30.0), rot=(0.0, 1.0, 2.0)))], + ) + result = M.parse_blob(bytes(blob), "round-trip.bin") + self.assertEqual(result["records"], 2) + self.assertEqual(result["chunks"], 1) + self.assertEqual(result["state_keys"], 2) + self.assertEqual(result["entities"], 2) + self.assertEqual(result["unresolved_records"], 0) + self.assertEqual(result["skipped_slots"], 0) + by_archetype = {entity["archetype"]: entity for entity in result["entity_list"]} + self.assertEqual(set(by_archetype), {0xAABBCCDD, 0x99887766}) + first = by_archetype[0xAABBCCDD] + self.assertEqual(first["link"], 0x01020304) + self.assertEqual([round(value, 4) for value in first["pos"]], [1.5, -2.25, 3.75]) + self.assertEqual([round(value, 4) for value in first["rot"]], [0.25, 0.5, -0.75]) + second = by_archetype[0x99887766] + self.assertEqual([round(value, 4) for value in second["pos"]], [-10.0, 20.0, 30.0]) + + def test_mismatched_duplicated_position_is_not_an_entity(self): + broken = bytearray(good_element(archetype=0xDEADBEEF, link=0x00000001)) + struct.pack_into(" bytes: + """Assemble a DXBC container from (fourcc, payload) pairs.""" + header = 32 + 4 * len(parts) + offsets, body, end = [], b"", header + for fourcc, payload in parts: + offsets.append(header + len(body)) + body += fourcc + struct.pack(" bytes: + """An XDAT directory whose payload offsets are relative to the DXIL part, as the package has it.""" + head = base + 12 + 12 * len(entries) + directory, payload = b"", b"" + for tag, value in entries: + directory += struct.pack(" bytes: + entries = [(0x12, bytes(16))] + if xbch: + entries.append((0x0D, b"XBCH" + bytes(20) + b"payload")) + if bitcode: + entries.append((0x07, b"BC\xc0\xde" + bytes(8))) + prefix = ( + b"e\x00\x05\x00" + + struct.pack(" bytes: + path = ( + "X:\\americas\\src\\dev\\rage\\3rdparty\\Microsoft\\XboxBvhBuilder\\Build\\Release\\Output\\" + f"XboxBvhBuilder\\{name}.pdb" + ).encode() + return b"\x00\x00" + struct.pack("= 4: + at = rng.randrange(0, size - 3) + data[at : at + 4] = b"DXBC" + try: + psc.parse_container(bytes(data), at) + except psc.ContainerError: + pass + except Exception as e: # noqa: BLE001 - any other type is the failure being asserted + self.fail(f"parse_container raised {type(e).__name__}: {e}") + try: + psc.inspect(bytes(data), "fuzz.dll") + except Exception as e: # noqa: BLE001 - any exception is the failure being asserted + self.fail(f"inspect raised {type(e).__name__}: {e}") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_psin_names.py b/tests/test_psin_names.py index d4f0d50ed5..7502db7b0c 100644 --- a/tests/test_psin_names.py +++ b/tests/test_psin_names.py @@ -137,6 +137,24 @@ def test_text_json_and_refs(self): self.assertEqual(r.returncode, 0, r.stderr) self.assertEqual(json.loads(r.stdout)["summary"]["u64 resolved"], 1) + def test_rejects_refs_aliasing_inputs(self): + with tempfile.TemporaryDirectory() as tmp: + source = os.path.join(tmp, "one.bin") + names = os.path.join(tmp, "names.txt") + for path, data in ((source, sample()), (names, b"prop_crate_01\n")): + with open(path, "wb") as f: + f.write(data) + for destination in (source, names): + with self.subTest(destination=destination): + with open(destination, "rb") as f: + original = f.read() + alias = os.path.join(tmp, ".", os.path.basename(destination)) + result = self.run_tool(source, "--names", names, "--refs", alias) + self.assertEqual(result.returncode, 2, result.stderr) + self.assertIn("--refs must not overwrite an input", result.stderr) + with open(destination, "rb") as f: + self.assertEqual(f.read(), original) + def test_missing_names_file_is_one_line(self): with tempfile.TemporaryDirectory() as d: r = self.run_tool(d, "--names", os.path.join(d, "none.txt")) diff --git a/tests/test_rdna2spirv_merge.py b/tests/test_rdna2spirv_merge.py new file mode 100644 index 0000000000..20bc22a7df --- /dev/null +++ b/tests/test_rdna2spirv_merge.py @@ -0,0 +1,180 @@ +"""tools/rdna2spirv.py --merge: an incomplete shard set is refused, not published as a partial index. + + python -I tests/test_rdna2spirv_merge.py +""" +import json +import subprocess +import sys +import tempfile +import unittest +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / "tools")) +import rdna2spirv as R # noqa: E402 + +TOOL = ROOT / "tools" / "rdna2spirv.py" + + +class MergeShardPartsTest(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.out = Path(self.tmp.name) + + def part(self, index, doc): + (self.out / f"index.part{index}.json").write_text(json.dumps(doc), encoding="utf-8") + + def marker(self, index, count): + (self.out / f"shard{index}.json").write_text(json.dumps({"index": index, "count": count}), encoding="utf-8") + + def plan(self, jobs): + (self.out / "shards.json").write_text(json.dumps({"jobs": jobs}), encoding="utf-8") + + def merge_error(self): + with self.assertRaises(R.ShardSetError) as cm: + R.merge_shard_parts(str(self.out)) + return str(cm.exception) + + def test_complete_set_merges(self): + self.part(0, {"a": {"r": 1}}) + self.part(1, {"b": {"r": 2}}) + self.marker(0, 2) + self.marker(1, 2) + self.assertEqual(R.merge_shard_parts(str(self.out)), {"a": {"r": 1}, "b": {"r": 2}}) + + def test_missing_part_is_refused(self): + self.part(0, {"a": {}}) + self.marker(0, 3) + self.marker(1, 3) + self.marker(2, 3) + message = self.merge_error() + self.assertIn("incomplete shard set", message) + self.assertIn("1 of 3", message) + self.assertIn("missing [1, 2]", message) + + def test_extra_part_is_refused(self): + for i in range(3): + self.part(i, {}) + self.marker(i, 2) + message = self.merge_error() + self.assertIn("incomplete shard set", message) + self.assertIn("unexpected [2]", message) + + def test_parts_and_markers_must_match(self): + self.part(0, {}) + self.part(1, {}) + self.marker(0, 2) + self.assertIn("index parts and shard markers disagree", self.merge_error()) + + def test_a_part_without_its_marker_is_refused(self): + # A part left by an older rdna2spirv.py that did not write markers mixed with a newer set. + for i in range(3): + self.part(i, {}) + self.marker(1, 3) + self.marker(2, 3) + message = self.merge_error() + self.assertIn("index parts and shard markers disagree", message) + self.assertIn("parts [0, 1, 2]", message) + self.assertIn("markers [1, 2]", message) + + def test_marker_counts_must_agree(self): + self.part(0, {}) + self.part(1, {}) + self.marker(0, 2) + self.marker(1, 3) + self.assertIn("disagree on the shard count", self.merge_error()) + + def test_plan_count_is_used_without_markers(self): + self.part(0, {}) + self.plan(2) + self.assertIn("incomplete shard set", self.merge_error()) + + def test_legacy_parts_without_metadata_still_merge(self): + self.part(0, {"a": {}}) + self.part(1, {"b": {}}) + self.assertEqual(sorted(R.merge_shard_parts(str(self.out))), ["a", "b"]) + + def test_unexpected_part_name_is_refused(self): + (self.out / "index.partx.json").write_text("{}", encoding="utf-8") + self.assertIn("not an index.part", self.merge_error()) + + +class MergeCliTest(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.out = Path(self.tmp.name) + + def part(self, index, doc): + (self.out / f"index.part{index}.json").write_text(json.dumps(doc), encoding="utf-8") + + def marker(self, index, count): + (self.out / f"shard{index}.json").write_text(json.dumps({"index": index, "count": count}), encoding="utf-8") + + def run_merge(self): + return subprocess.run([sys.executable, "-I", str(TOOL), str(self.out), "--out", str(self.out), "--merge"], + capture_output=True, text=True, timeout=120) + + def test_cli_refuses_a_partial_set_and_writes_no_index(self): + self.part(0, {"a": {}}) + self.marker(0, 2) + self.marker(1, 2) + result = self.run_merge() + self.assertEqual(result.returncode, 2, result.stdout + result.stderr) + self.assertIn("ERROR: incomplete shard set", result.stderr) + self.assertNotIn("Traceback", result.stderr) + self.assertFalse((self.out / "index.json").exists()) + + def test_cli_merges_a_complete_set(self): + self.part(0, {"a": {}}) + self.part(1, {"b": {}}) + self.marker(0, 2) + self.marker(1, 2) + result = self.run_merge() + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertIn("merged 2 entries", result.stdout) + merged = json.loads((self.out / "index.json").read_text(encoding="utf-8")) + self.assertEqual(sorted(merged), ["a", "b"]) + + +class ShardRoundTripTest(unittest.TestCase): + """The writer and the merge through the real CLI, on an empty input directory (no .s and no llvm-mc needed).""" + + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.src = Path(self.tmp.name) / "src" + self.out = Path(self.tmp.name) / "out" + self.src.mkdir() + self.out.mkdir() + + def run_tool(self, *args): + return subprocess.run([sys.executable, "-I", str(TOOL), str(self.src), "--out", str(self.out), *args], + capture_output=True, text=True, timeout=120) + + def test_a_shard_writes_its_marker_and_part_and_merge_needs_the_whole_set(self): + first = self.run_tool("--shard", "0/2") + self.assertEqual(first.returncode, 0, first.stdout + first.stderr) + self.assertTrue((self.out / "index.part0.json").is_file()) + marker = json.loads((self.out / "shard0.json").read_text(encoding="utf-8")) + self.assertEqual(marker, {"index": 0, "count": 2}) + + partial = self.run_tool("--merge") + self.assertEqual(partial.returncode, 2, partial.stdout + partial.stderr) + self.assertIn("incomplete shard set", partial.stderr) + self.assertFalse((self.out / "index.json").exists()) + + second = self.run_tool("--shard", "1/2") + self.assertEqual(second.returncode, 0, second.stdout + second.stderr) + self.assertTrue((self.out / "index.part1.json").is_file()) + self.assertTrue((self.out / "shard1.json").is_file()) + + full = self.run_tool("--merge") + self.assertEqual(full.returncode, 0, full.stdout + full.stderr) + self.assertIn("merged 0 entries", full.stdout) + self.assertEqual(json.loads((self.out / "index.json").read_text(encoding="utf-8")), {}) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_save_keys.py b/tests/test_save_keys.py index d50996fe98..906b7c6a0e 100644 --- a/tests/test_save_keys.py +++ b/tests/test_save_keys.py @@ -143,6 +143,11 @@ def test_out_in_a_missing_folder_is_one_error_line(self): self.assertNotIn("Traceback", r.stderr) self.assertEqual(r.stdout, "") # refused before the resolve ran + def test_rejects_negative_compose_count(self): + result = self.resolve_cli(self.dir, "--dict", self.dict, "--compose", "-1") + self.assertEqual(result.returncode, 2, result.stderr) + self.assertIn("--compose must be 0 or more", result.stderr) + def test_compose_finds_two_word_names(self): text = run(["resolve", self.jsav, "--dict", self.dict, "--compose", "50"]) self.assertIn("joaat, composed 1 more keys", text) # SprocketCount from Sprocket + Count diff --git a/tests/test_shader_build_fallbacks.py b/tests/test_shader_build_fallbacks.py new file mode 100644 index 0000000000..99c467b125 --- /dev/null +++ b/tests/test_shader_build_fallbacks.py @@ -0,0 +1,124 @@ +"""runtime/test/shaders/build.py under the PerVertexKHR fallbacks (LEONIDA_BARY_FALLBACK=1, LEONIDA_F16_INTERP_FALLBACK=1). + +The translator refuses a computed I/J pair (ps_ij_computed) without PerVertexKHR inputs, which both fallbacks take +away. build.py used to treat that as a failed batch: it exited before publishing anything, so check.py then reported +every test missing (0 of 147 on a Mac, where check.py needs LEONIDA_F16_INTERP_FALLBACK=1). check.py and +run_gpu_tests.py report ps_ij_computed as SKIP there; build.py now leaves it out and builds the rest. + +Standard library only; the translator is replaced by a stand-in that writes the index and modules and, like the real +one, refuses ps_ij_computed under a fallback. No llvm-mc, SPIR-V tools, GPU or game data. + + python -I tests/test_shader_build_fallbacks.py +""" +import contextlib +import importlib.util +import io +import json +import os +import sys +import tempfile +import types +import unittest +from pathlib import Path +from unittest import mock + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +BUILD = os.path.join(ROOT, "runtime", "test", "shaders", "build.py") +FALLBACKS = ("LEONIDA_BARY_FALLBACK", "LEONIDA_F16_INTERP_FALLBACK") + + +def load_build(): + spec = importlib.util.spec_from_file_location("shaders_build_under_test", BUILD) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +class BuildUnderFallbackTest(unittest.TestCase): + def setUp(self): + self.fresh() + + def fresh(self): + """A new build.py, output folder and record of what the translator was asked for (one per subtest).""" + self.build = load_build() + tmp = tempfile.TemporaryDirectory() + self.addCleanup(tmp.cleanup) + self.out = Path(tmp.name) / "out" + self.asked = [] + + def fake_translate(self, work, names): + """What rdna2spirv.py leaves in /spirv: a module and an index entry per shader it validated.""" + self.asked.append(list(names)) + fallback = any(os.environ.get(v) == "1" for v in FALLBACKS) + spirv = Path(work) / "spirv" + spirv.mkdir(parents=True) + index = {} + for n in names: + if n == "ps_ij_computed" and fallback: + continue # "computed I/J pair under --f16-interp-fallback: no PerVertexKHR inputs" + (spirv / (n + ".spv")).write_bytes(b"\x03\x02\x23\x07") + (spirv / (n + ".spvasm")).write_text("; SPIR-V\n", encoding="utf-8") + index[n] = {"stage": n[:2]} + (spirv / "index.json").write_text(json.dumps(index), encoding="utf-8") + return 0 + + def run_build(self, names, env): + stubs = {"spirv_stubs": types.SimpleNamespace(generate_for_index=lambda *a: None), + "bary_fallback_gs": types.SimpleNamespace(build_for_index=lambda *a: None)} + clean = {k: v for k, v in os.environ.items() if k not in FALLBACKS} + stdout = io.StringIO() + with mock.patch.dict(os.environ, {**clean, **env}, clear=True), \ + mock.patch.dict(sys.modules, stubs), \ + mock.patch.object(self.build, "translate_tests", self.fake_translate), \ + mock.patch.object(sys, "argv", ["build.py", str(self.out), *names]), \ + contextlib.redirect_stdout(stdout): + try: + status = self.build.main() + except SystemExit as e: + status = e.code + return status, stdout.getvalue() + + def test_each_fallback_builds_the_rest_without_ps_ij_computed(self): + for var in FALLBACKS: + with self.subTest(fallback=var): + self.fresh() + status, printed = self.run_build(["cs_store", "ps_ij_computed"], {var: "1"}) + self.assertEqual(status, 0, printed) + self.assertEqual(self.asked, [["cs_store"]]) + self.assertTrue((self.out / "spirv" / "cs_store.spv").is_file()) + self.assertFalse((self.out / "spirv" / "ps_ij_computed.spv").exists()) + self.assertIn("ps_ij_computed", printed) + self.assertIn("PerVertexKHR", printed) + + def test_the_whole_list_builds_under_a_fallback(self): + # Before: "Translation did not produce validated SPIR-V for: ps_ij_computed", and an empty /spirv. + status, printed = self.run_build([], {"LEONIDA_F16_INTERP_FALLBACK": "1"}) + self.assertEqual(status, 0, printed) + self.assertNotIn("ps_ij_computed", self.asked[0]) + published = {p.stem for p in (self.out / "spirv").glob("*.spv")} + self.assertEqual(published, set(self.asked[0])) + self.assertIn("ps_interp_f16_high", published) # the f16 halves still translate under this fallback + + def test_without_a_fallback_ps_ij_computed_is_still_built(self): + status, printed = self.run_build(["cs_store", "ps_ij_computed"], {}) + self.assertEqual(status, 0, printed) + self.assertEqual(self.asked, [["cs_store", "ps_ij_computed"]]) + self.assertTrue((self.out / "spirv" / "ps_ij_computed.spv").is_file()) + + def test_a_missing_module_without_a_fallback_still_fails_the_batch(self): + keep = self.fake_translate + + def refuse(work, names): + keep(work, names) + os.remove(os.path.join(work, "spirv", "cs_store.spv")) + return 0 + self.fake_translate = refuse + try: + status, _ = self.run_build(["cs_store"], {}) + finally: + self.fake_translate = keep + self.assertIn("did not produce validated SPIR-V for: cs_store", str(status)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_shader_carve.py b/tests/test_shader_carve.py index b7c875c744..24b0b7a787 100644 --- a/tests/test_shader_carve.py +++ b/tests/test_shader_carve.py @@ -449,11 +449,31 @@ def test_carve_rejects_unfinished_deflate_stream(self): f.write(make_rpf_entry("synthetic", 1, dxbc, compressed_override=compressed)) res = self.run_carve(self.archive, self.out) - self.assertEqual(res.returncode, 0, res.stderr) - self.assertIn("0 shaders carved, 1 candidates rejected", res.stdout) - with open(os.path.join(self.out, "index.json"), encoding="utf-8") as f: - self.assertEqual(json.load(f), []) - self.assertEqual(os.listdir(self.out), ["index.json"]) + self.assertEqual(res.returncode, 1, res.stderr) + self.assertIn("no shaders carved", res.stderr) + self.assertIn("rejected candidates: 1", res.stderr) + self.assertEqual(os.listdir(self.out), []) + + def test_empty_carve_preserves_an_existing_index(self): + dxbc = make_dxbc([(b"PRIV", bytes(range(32)))]) + with open(self.archive, "wb") as f: + f.write(make_rpf_entry("valid", 1, dxbc)) + initial = self.run_carve(self.archive, self.out) + self.assertEqual(initial.returncode, 0, initial.stderr) + index_path = os.path.join(self.out, "index.json") + with open(index_path, "rb") as f: + previous = f.read() + with open(self.archive, "wb") as f: + f.write(b"no shader entries") + + res = self.run_carve(self.archive, self.out) + + self.assertEqual(res.returncode, 1, res.stderr) + self.assertIn("no shaders carved", res.stderr) + self.assertIn("rejected candidates: 0", res.stderr) + with open(index_path, "rb") as f: + self.assertEqual(f.read(), previous) + self.assertEqual(sorted(os.listdir(self.out)), ["index.json", "valid.dxbc"]) def test_carve_rejects_incomplete_parts_and_continues(self): valid = make_dxbc([(b"PRIV", bytes(range(32)))]) diff --git a/tests/test_shader_checks.py b/tests/test_shader_checks.py index c4bd7c042b..a9f6453ecc 100644 --- a/tests/test_shader_checks.py +++ b/tests/test_shader_checks.py @@ -16,6 +16,7 @@ GOOD_FMT = struct.pack("<64I", *check.FMT_1010102_WORDS, *[0xEEEEEEEE] * 48) GOOD_XY_XYZ = struct.pack("<192I", *check.FMT_XY_XYZ_WORDS, *[0xEEEEEEEE] * 108) +GOOD_TBUFFER_STORE = struct.pack("<192I", *check.TBUFFER_STORE_WORDS, *[0xEEEEEEEE] * 140) FULL_WAVE = ((0, "compute subgroup size: 64\n0 mismatches\n"), (0, "compute subgroup size: 64\nout[0..7] = 32 16 24 40 8 48 4008636142 4008636142\n")) @@ -29,7 +30,7 @@ # All check.py cases, including the four vk_store_test shaders and the three mesh fixtures, and TEST-184's # vk_store_test "words" fixtures and image_get_lod draws. -TOTAL = (len(check.COMPUTE) + 4 + len(check.CS_DUMPS) + len(check.W64X_DUMPS) + len(check.W64X_PARTIAL) + 4 +TOTAL = (len(check.COMPUTE) + 5 + len(check.CS_DUMPS) + len(check.W64X_DUMPS) + len(check.W64X_PARTIAL) + 4 + len(check.PIXEL_TESTS) + len(check.CLIP_TESTS) + len(check.BOUNDS) + len(check.GLOBAL_OFFSET) + len(check.MIP_TEST_PASSES) + len(check.GRADIENT_TESTS) + len(check.STORE_WORDS) + len(check.GET_LOD_TESTS) @@ -70,9 +71,9 @@ def harness(_tool, shader, *args, env=None): self.assertEqual((args, env["VKC_OUT_WORDS"]), (("1", "dump"), "64")) Path(env["VKC_DUMP"]).write_bytes(struct.pack("<64I", *check.FMT_SINT32_WORDS)) return 0, "" - if name == "cs_fmt_xy_xyz": + if name in ("cs_fmt_xy_xyz", "cs_tbuffer_store"): self.assertEqual((args, env["VKC_OUT_WORDS"]), (("1", "dump"), "192")) - Path(env["VKC_DUMP"]).write_bytes(GOOD_XY_XYZ) + Path(env["VKC_DUMP"]).write_bytes(GOOD_XY_XYZ if name == "cs_fmt_xy_xyz" else GOOD_TBUFFER_STORE) return 0, "out[0..7] = 0 0 0 0 0 0 0 0\n" if name == "cs_user_sgprs": # The seeded words come back only if check.py passed them in VKC_SGPRS. @@ -257,6 +258,23 @@ def test_one_wrong_input_fails_and_is_named(self): self.assertIn("1 of 16 inputs wrong", problem) self.assertIn("0x4f000000", problem) + def test_a_device_that_cannot_pin_the_wave_size_skips_instead_of_failing(self): + # Before: on a 4..32 device (Apple under MoltenVK) every dispatch came back as unpinned_subgroup_skip's Skip, + # and the sweep reported it as "16 of 16 inputs wrong, first 0x00000000: SKIP (...)", a failure. + calls = [] + + def harness(_tool, _shader, *_args, env=None): + calls.append(env.get("VKC_SUBGROUP_SIZE")) + return 1, "compute subgroup size: 32 not available\n" + + with patch.object(check, "run", side_effect=harness), \ + patch.object(check, "subgroup_size", return_value=32): + problem = check.cvt_f32_sat_test("tools", "spirv") + self.assertIsInstance(problem, check.Skip) + self.assertIn("can't run this shader at 32 lanes", problem) + self.assertNotIn("inputs wrong", problem) + self.assertEqual(calls, ["32"]) # the first dispatch decides; the other 15 would say the same + def test_inputs_match_the_interpreter_test(self): # The GPU sweep and tests/semantic/test_float_to_int.py must judge the same inputs the same way. src = (Path(__file__).resolve().parent / "semantic" / "test_float_to_int.py").read_text(encoding="utf-8") diff --git a/tests/test_spirv_metal_set0_aliases.py b/tests/test_spirv_metal_set0_aliases.py new file mode 100644 index 0000000000..6399ac7f10 --- /dev/null +++ b/tests/test_spirv_metal_set0_aliases.py @@ -0,0 +1,386 @@ +"""Regression tests for tools/spirv_metal_set0.py file hygiene and aliased set-0 bindings. + +Standard library only; uses synthetic SPIR-V disassembly, no game data and no external SPIRV-Tools binaries. + + python -I -W error::ResourceWarning tests/test_spirv_metal_set0_aliases.py -v +""" +import ast +import contextlib +import gc +import io +import os +import re +import sys +import tempfile +import unittest +import warnings + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +TOOLS_DIR = os.path.join(ROOT, "tools") +TOOL_PATH = os.path.join(TOOLS_DIR, "spirv_metal_set0.py") +if TOOLS_DIR not in sys.path: + sys.path.insert(0, TOOLS_DIR) + +import spirv_metal_set0 as m # noqa: E402 + + +def _parse_defs_and_order(text): + """Parse SSA definitions, check for duplicates and declaration-before-use ordering.""" + defs = {} + def_line = {} + decs = [] + lines = text.splitlines() + for idx, ln in enumerate(lines): + m_dec = re.match(r"^\s*OpDecorate (%\S+) (\S+) (\d+)$", ln) + if m_dec: + decs.append((m_dec.group(1), m_dec.group(2), int(m_dec.group(3)))) + continue + m_def = re.match(r"^\s*(%\S+) = (.*)$", ln) + if not m_def: + continue + rid, rhs = m_def.group(1), m_def.group(2) + if rid in defs: + raise AssertionError(f"duplicate SSA definition for {rid} at line {idx + 1}: {ln}") + defs[rid] = rhs + def_line[rid] = idx + + # Verify declaration-before-use for constants, array types, pointers, and variables. + for rid, rhs in defs.items(): + cur = def_line[rid] + parts = rhs.split() + op = parts[0] + if op == "OpConstant": + ty = parts[1] + assert def_line[ty] < cur, f"{rid} uses {ty} before definition" + elif op == "OpTypeRuntimeArray": + elem = parts[1] + assert def_line[elem] < cur, f"{rid} uses {elem} before definition" + elif op == "OpTypeArray": + elem, length = parts[1], parts[2] + assert def_line[elem] < cur, f"{rid} uses {elem} before definition" + assert def_line[length] < cur, f"{rid} uses {length} before definition" + elif op == "OpTypePointer": + pointee = parts[2] + assert def_line[pointee] < cur, f"{rid} uses {pointee} before definition" + elif op == "OpVariable": + ptr = parts[1] + assert def_line[ptr] < cur, f"{rid} uses {ptr} before definition" + + return defs, def_line, decs + + +class TestFileHygiene(unittest.TestCase): + def test_capacities_and_print_layout_emit_no_resource_warning(self): + with tempfile.TemporaryDirectory() as tmp: + good_hdr = os.path.join(tmp, "good.h") + bad_hdr = os.path.join(tmp, "bad.h") + with open(good_hdr, "w", encoding="utf-8") as f: + f.write("std::array bindings = {{{VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 16}, " + "{VK_DESCRIPTOR_TYPE_SAMPLER, 8}}};\n") + with open(bad_hdr, "w", encoding="utf-8") as f: + f.write("// missing table\n") + + with warnings.catch_warnings(): + warnings.simplefilter("error", ResourceWarning) + counts = m.capacities() + self.assertEqual(len(counts), 26) + self.assertEqual(m.capacities(good_hdr), [16, 8]) + with self.assertRaises(SystemExit): + m.capacities(bad_hdr) + with contextlib.redirect_stdout(io.StringIO()): + self.assertEqual(m.main(["spirv_metal_set0.py", "--print-layout"]), 0) + gc.collect() + + def test_spirv_metal_set0_has_no_unmanaged_open_calls(self): + with open(TOOL_PATH, encoding="utf-8") as f: + src = f.read() + tree = ast.parse(src, filename=TOOL_PATH) + managed = set() + for node in ast.walk(tree): + if isinstance(node, (ast.With, ast.AsyncWith)): + for item in node.items: + if isinstance(item.context_expr, ast.Call): + managed.add(id(item.context_expr)) + bare = [ + node.lineno + for node in ast.walk(tree) + if isinstance(node, ast.Call) + and isinstance(node.func, ast.Name) + and node.func.id == "open" + and id(node) not in managed + ] + self.assertEqual(bare, []) + + +class TestSingleAndAliasedBindings(unittest.TestCase): + def test_single_variable_bindings_keep_canonical_msl_ids(self): + module = """\ + OpDecorate %images DescriptorSet 0 + OpDecorate %images Binding 0 + OpDecorate %samplers DescriptorSet 0 + OpDecorate %samplers Binding 1 + OpDecorate %desc_map DescriptorSet 0 + OpDecorate %desc_map Binding 2 + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %img2d = OpTypeImage %float 2D 0 0 0 1 Unknown + %smp = OpTypeSampler + %rt_img = OpTypeRuntimeArray %img2d + %rt_smp = OpTypeRuntimeArray %smp + %ptr_img = OpTypePointer UniformConstant %rt_img + %ptr_smp = OpTypePointer UniformConstant %rt_smp + %rt_map = OpTypeRuntimeArray %uint + %map = OpTypeStruct %rt_map + %ptr_map = OpTypePointer StorageBuffer %map + %images = OpVariable %ptr_img UniformConstant + %samplers = OpVariable %ptr_smp UniformConstant + %desc_map = OpVariable %ptr_map StorageBuffer +""" + counts = m.capacities() + out = m.rewrite(module, counts) + defs, _, decs = _parse_defs_and_order(out) + + self.assertEqual(defs["%msl_cap_b0"], f"OpConstant %uint {counts[0]}") + self.assertEqual(defs["%msl_arr_b0"], "OpTypeArray %img2d %msl_cap_b0") + self.assertEqual(defs["%msl_ptr_b0"], "OpTypePointer UniformConstant %msl_arr_b0") + self.assertEqual(defs["%images"], "OpVariable %msl_ptr_b0 UniformConstant") + + self.assertEqual(defs["%msl_cap_b1"], f"OpConstant %uint {counts[1]}") + self.assertEqual(defs["%msl_arr_b1"], "OpTypeArray %smp %msl_cap_b1") + self.assertEqual(defs["%msl_ptr_b1"], "OpTypePointer UniformConstant %msl_arr_b1") + self.assertEqual(defs["%samplers"], "OpVariable %msl_ptr_b1 UniformConstant") + self.assertEqual(defs["%desc_map"], "OpVariable %ptr_map StorageBuffer") + + bindings = {vid: val for vid, kind, val in decs if kind == "Binding"} + self.assertEqual(bindings, {"%images": 0, "%samplers": 4096, "%desc_map": 5120}) + + def test_distinct_element_type_aliases_at_same_binding(self): + # Mirrors tools/rdna2spirv.py emitting %images + typed %itx* aliases at binding 0 + # and %images_arr + %itx1_1 at binding 3, plus a 3D alias at binding 0. + module = """\ + OpDecorate %images DescriptorSet 0 + OpDecorate %images Binding 0 + OpDecorate %samplers DescriptorSet 0 + OpDecorate %samplers Binding 1 + OpDecorate %images_arr DescriptorSet 0 + OpDecorate %images_arr Binding 3 + OpDecorate %itx1_0 DescriptorSet 0 + OpDecorate %itx1_0 Binding 0 + OpDecorate %itx2_0 DescriptorSet 0 + OpDecorate %itx2_0 Binding 0 + OpDecorate %itx3d_0 DescriptorSet 0 + OpDecorate %itx3d_0 Binding 0 + OpDecorate %itx1_1 DescriptorSet 0 + OpDecorate %itx1_1 Binding 3 + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %float = OpTypeFloat 32 + %img2d = OpTypeImage %float 2D 0 0 0 1 Unknown + %smp = OpTypeSampler + %img2da = OpTypeImage %float 2D 0 1 0 1 Unknown + %itximg1_0 = OpTypeImage %uint 2D 0 0 0 1 Unknown + %itximg2_0 = OpTypeImage %int 2D 0 0 0 1 Unknown + %img_3d = OpTypeImage %float 3D 0 0 0 1 Unknown + %itximg1_1 = OpTypeImage %uint 2D 0 1 0 1 Unknown + %rt_img = OpTypeRuntimeArray %img2d + %ptr_img = OpTypePointer UniformConstant %rt_img + %rt_smp = OpTypeRuntimeArray %smp + %ptr_smp = OpTypePointer UniformConstant %rt_smp + %rt_imga = OpTypeRuntimeArray %img2da + %ptr_imga = OpTypePointer UniformConstant %rt_imga + %rt_itx10 = OpTypeRuntimeArray %itximg1_0 + %ptr_itx10 = OpTypePointer UniformConstant %rt_itx10 + %rt_itx20 = OpTypeRuntimeArray %itximg2_0 + %ptr_itx20 = OpTypePointer UniformConstant %rt_itx20 + %rt_3d0 = OpTypeRuntimeArray %img_3d + %ptr_3d0 = OpTypePointer UniformConstant %rt_3d0 + %rt_itx11 = OpTypeRuntimeArray %itximg1_1 + %ptr_itx11 = OpTypePointer UniformConstant %rt_itx11 + %images = OpVariable %ptr_img UniformConstant + %samplers = OpVariable %ptr_smp UniformConstant + %images_arr = OpVariable %ptr_imga UniformConstant + %itx1_0 = OpVariable %ptr_itx10 UniformConstant + %itx2_0 = OpVariable %ptr_itx20 UniformConstant + %itx3d_0 = OpVariable %ptr_3d0 UniformConstant + %itx1_1 = OpVariable %ptr_itx11 UniformConstant +""" + counts = m.capacities() + ids = m.metal_ids(counts) + out = m.rewrite(module, counts) + defs, _, decs = _parse_defs_and_order(out) + + # OpConstant is emitted once per binding that has UniformConstant runtime arrays. + b0_consts = [rid for rid, rhs in defs.items() if rhs == f"OpConstant %uint {counts[0]}"] + b1_b3_consts = [rid for rid, rhs in defs.items() if rhs == f"OpConstant %uint {counts[3]}"] + self.assertEqual(b0_consts, ["%msl_cap_b0"]) + self.assertEqual(counts[1], counts[3]) + self.assertEqual(b1_b3_consts, ["%msl_cap_b1", "%msl_cap_b3"]) + for b in (0, 1, 3): + self.assertEqual(out.count(f"%msl_cap_b{b} = "), 1) + + # Every variable keeps the exact element type of its original runtime array and binding capacity. + expected_vars = { + "%images": ("%img2d", "%msl_cap_b0", ids[0]), + "%samplers": ("%smp", "%msl_cap_b1", ids[1]), + "%images_arr": ("%img2da", "%msl_cap_b3", ids[3]), + "%itx1_0": ("%itximg1_0", "%msl_cap_b0", ids[0]), + "%itx2_0": ("%itximg2_0", "%msl_cap_b0", ids[0]), + "%itx3d_0": ("%img_3d", "%msl_cap_b0", ids[0]), + "%itx1_1": ("%itximg1_1", "%msl_cap_b3", ids[3]), + } + bindings = {vid: val for vid, kind, val in decs if kind == "Binding"} + seen_ptrs = set() + for var_id, (elem, cap, expected_bind) in expected_vars.items(): + self.assertEqual(bindings[var_id], expected_bind) + m_var = re.match(r"^OpVariable (%\S+) UniformConstant$", defs[var_id]) + self.assertIsNotNone(m_var, defs[var_id]) + ptr_id = m_var.group(1) + seen_ptrs.add(ptr_id) + m_ptr = re.match(r"^OpTypePointer UniformConstant (%\S+)$", defs[ptr_id]) + self.assertIsNotNone(m_ptr, defs[ptr_id]) + arr_id = m_ptr.group(1) + self.assertEqual(defs[arr_id], f"OpTypeArray {elem} {cap}") + + # Distinct element types get distinct pointer types. + self.assertEqual(len(seen_ptrs), len(expected_vars)) + + def test_reversed_decoration_order_still_declares_cap_before_first_array(self): + # %itx1_0 is decorated before %images, yet %ptr_img is declared before %ptr_itx. + module = """\ + OpDecorate %itx1_0 DescriptorSet 0 + OpDecorate %itx1_0 Binding 0 + OpDecorate %images DescriptorSet 0 + OpDecorate %images Binding 0 + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %float = OpTypeFloat 32 + %img2d = OpTypeImage %float 2D 0 0 0 1 Unknown + %itximg1_0 = OpTypeImage %int 2D 0 0 0 1 Unknown + %rt_img = OpTypeRuntimeArray %img2d + %ptr_img = OpTypePointer UniformConstant %rt_img + %rt_itx = OpTypeRuntimeArray %itximg1_0 + %ptr_itx = OpTypePointer UniformConstant %rt_itx + %images = OpVariable %ptr_img UniformConstant + %itx1_0 = OpVariable %ptr_itx UniformConstant +""" + out = m.rewrite(module, [4096]) + defs, def_line, decs = _parse_defs_and_order(out) + + self.assertLess(def_line["%msl_cap_b0"], def_line["%msl_arr_b0"]) + self.assertLess(def_line["%msl_cap_b0"], def_line["%msl_arr_b0_1"]) + self.assertEqual(defs["%images"], "OpVariable %msl_ptr_b0 UniformConstant") + self.assertEqual(defs["%itx1_0"], "OpVariable %msl_ptr_b0_1 UniformConstant") + self.assertEqual(defs["%msl_arr_b0"], "OpTypeArray %img2d %msl_cap_b0") + self.assertEqual(defs["%msl_arr_b0_1"], "OpTypeArray %itximg1_0 %msl_cap_b0") + self.assertEqual([(v, val) for v, k, val in decs if k == "Binding"], [("%itx1_0", 0), ("%images", 0)]) + + def test_same_binding_and_same_optypepointer_shares_sized_type_without_duplicates(self): + module = """\ + OpDecorate %images DescriptorSet 0 + OpDecorate %images Binding 0 + OpDecorate %alias DescriptorSet 0 + OpDecorate %alias Binding 0 + OpDecorate %single DescriptorSet 0 + OpDecorate %single Binding 0 + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %img2d = OpTypeImage %float 2D 0 0 0 1 Unknown + %rt_img = OpTypeRuntimeArray %img2d + %ptr_img = OpTypePointer UniformConstant %rt_img + %ptr_one = OpTypePointer UniformConstant %img2d + %images = OpVariable %ptr_img UniformConstant + %alias = OpVariable %ptr_img UniformConstant + %single = OpVariable %ptr_one UniformConstant +""" + out = m.rewrite(module, [128]) + defs, _, decs = _parse_defs_and_order(out) + + self.assertEqual(defs["%msl_cap_b0"], "OpConstant %uint 128") + self.assertEqual(defs["%msl_arr_b0"], "OpTypeArray %img2d %msl_cap_b0") + self.assertEqual(defs["%msl_ptr_b0"], "OpTypePointer UniformConstant %msl_arr_b0") + self.assertEqual(defs["%images"], "OpVariable %msl_ptr_b0 UniformConstant") + self.assertEqual(defs["%alias"], "OpVariable %msl_ptr_b0 UniformConstant") + self.assertEqual(defs["%single"], "OpVariable %ptr_one UniformConstant") + self.assertEqual(out.count("%msl_cap_b0 = "), 1) + self.assertEqual(out.count("%msl_arr_b0 = "), 1) + self.assertEqual(out.count("%msl_ptr_b0 = "), 1) + self.assertEqual({v: val for v, k, val in decs if k == "Binding"}, + {"%images": 0, "%alias": 0, "%single": 0}) + + def test_same_binding_and_same_element_via_distinct_pointers(self): + module = """\ + OpDecorate %v1 DescriptorSet 0 + OpDecorate %v1 Binding 0 + OpDecorate %v2 DescriptorSet 0 + OpDecorate %v2 Binding 0 + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %img2d = OpTypeImage %float 2D 0 0 0 1 Unknown + %rt_a = OpTypeRuntimeArray %img2d + %ptr_a = OpTypePointer UniformConstant %rt_a + %rt_b = OpTypeRuntimeArray %img2d + %ptr_b = OpTypePointer UniformConstant %rt_b + %v1 = OpVariable %ptr_a UniformConstant + %v2 = OpVariable %ptr_b UniformConstant +""" + out = m.rewrite(module, [64]) + defs, def_line, _ = _parse_defs_and_order(out) + + for var_id in ("%v1", "%v2"): + m_var = re.match(r"^OpVariable (%\S+) UniformConstant$", defs[var_id]) + self.assertIsNotNone(m_var) + ptr_id = m_var.group(1) + self.assertLess(def_line[ptr_id], def_line[var_id]) + m_ptr = re.match(r"^OpTypePointer UniformConstant (%\S+)$", defs[ptr_id]) + self.assertIsNotNone(m_ptr) + self.assertEqual(defs[m_ptr.group(1)], "OpTypeArray %img2d %msl_cap_b0") + + def test_preexisting_msl_ids_in_input_never_collide(self): + module = """\ + OpDecorate %images DescriptorSet 0 + OpDecorate %images Binding 0 + OpDecorate %itx1_0 DescriptorSet 0 + OpDecorate %itx1_0 Binding 0 + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %float = OpTypeFloat 32 +%msl_cap_b0 = OpConstant %uint 7 +%msl_arr_b0 = OpTypeFloat 16 +%msl_ptr_b0 = OpTypeStruct %float +%msl_arr_b0_1 = OpConstant %uint 9 + %img2d = OpTypeImage %float 2D 0 0 0 1 Unknown + %itximg1_0 = OpTypeImage %int 2D 0 0 0 1 Unknown + %rt_img = OpTypeRuntimeArray %img2d + %ptr_img = OpTypePointer UniformConstant %rt_img + %rt_itx = OpTypeRuntimeArray %itximg1_0 + %ptr_itx = OpTypePointer UniformConstant %rt_itx + %images = OpVariable %ptr_img UniformConstant + %itx1_0 = OpVariable %ptr_itx UniformConstant +""" + out = m.rewrite(module, [4096]) + defs, _, _ = _parse_defs_and_order(out) + + # Pre-existing IDs keep their original definitions untouched. + self.assertEqual(defs["%msl_cap_b0"], "OpConstant %uint 7") + self.assertEqual(defs["%msl_arr_b0"], "OpTypeFloat 16") + self.assertEqual(defs["%msl_ptr_b0"], "OpTypeStruct %float") + self.assertEqual(defs["%msl_arr_b0_1"], "OpConstant %uint 9") + + # Newly synthesized IDs avoid every existing definition and match each variable's element type. + m_img = re.match(r"^OpVariable (%\S+) UniformConstant$", defs["%images"]) + m_itx = re.match(r"^OpVariable (%\S+) UniformConstant$", defs["%itx1_0"]) + self.assertIsNotNone(m_img) + self.assertIsNotNone(m_itx) + ptr_img, ptr_itx = m_img.group(1), m_itx.group(1) + self.assertNotEqual(ptr_img, ptr_itx) + + arr_img = re.match(r"^OpTypePointer UniformConstant (%\S+)$", defs[ptr_img]).group(1) + arr_itx = re.match(r"^OpTypePointer UniformConstant (%\S+)$", defs[ptr_itx]).group(1) + cap_img = re.match(r"^OpTypeArray %img2d (%\S+)$", defs[arr_img]).group(1) + cap_itx = re.match(r"^OpTypeArray %itximg1_0 (%\S+)$", defs[arr_itx]).group(1) + self.assertEqual(cap_img, cap_itx) + self.assertEqual(defs[cap_img], "OpConstant %uint 4096") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_text_write_line_endings.py b/tests/test_text_write_line_endings.py new file mode 100644 index 0000000000..e8be2944b0 --- /dev/null +++ b/tests/test_text_write_line_endings.py @@ -0,0 +1,88 @@ +"""Every text-mode file write in the Python tools names its line ending (BUILD-468). + +`open(path, "w")` with no `newline=` turns each "\\n" into "\\r\\n" on Windows, so the same JSON report, manifest or +assembly listing is CRLF there and LF on Linux and macOS: the same input gives byte-different output per platform +(checksums and diffs differ). The CSV writers were fixed in #1573; this covers the other text writers. This test reads +the source with `ast` (standard library, no game data, no GPU) and fails for any `open` / `os.fdopen` in a text write +mode (`w`, `a`, `x`) or any `Path.write_text` under tools/, scripts/, make_game.py and runtime/test/shaders/ that has +no `newline=` argument. Pass `newline="\\n"` for LF output (or `newline=""` when the text carries its own line ends, +like a csv writer). +""" +import ast +import os +import sys +import unittest + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(HERE) +SCAN = ("tools", "scripts", "make_game.py", os.path.join("runtime", "test", "shaders")) + + +def python_files(): + for entry in SCAN: + path = os.path.join(ROOT, entry) + if os.path.isfile(path): + yield path + continue + for base, dirs, files in os.walk(path): + dirs[:] = [d for d in dirs if d not in ("__pycache__", "build") and not d.startswith(".")] + for name in sorted(files): + if name.endswith(".py"): + yield os.path.join(base, name) + + +def unpinned_text_writes(source: str): + """Line numbers of text-mode writes in `source` that pass no `newline=`.""" + found = [] + for node in ast.walk(ast.parse(source)): + if not isinstance(node, ast.Call): + continue + func = node.func + name = getattr(func, "attr", getattr(func, "id", None)) + if any(k.arg == "newline" for k in node.keywords): + continue + if name in ("open", "fdopen"): + mode = None + if len(node.args) >= 2 and isinstance(node.args[1], ast.Constant): + mode = node.args[1].value + for k in node.keywords: + if k.arg == "mode" and isinstance(k.value, ast.Constant): + mode = k.value.value + if isinstance(mode, str) and "b" not in mode and any(c in mode for c in "wax"): + found.append(node.lineno) + elif name == "write_text": + found.append(node.lineno) + return found + + +class TextWriteLineEndings(unittest.TestCase): + def test_detector_finds_the_unpinned_forms(self): + src = ( + "open('a', 'w')\n" # 1 + "open('a', 'w', encoding='utf-8')\n" # 2 + "open('a', mode='a')\n" # 3 + "os.fdopen(3, 'w', encoding='utf-8')\n" # 4 + "p.write_text('x', encoding='utf-8')\n" # 5 + "open('a', 'w', newline='\\n')\n" # pinned + "open('a', 'w', newline='')\n" # pinned + "open('a', 'wb')\n" # binary + "open('a')\n" # read + "open('a', 'r', encoding='utf-8')\n" # read + "p.write_text('x', newline='\\n')\n" # pinned + ) + self.assertEqual(unpinned_text_writes(src), [1, 2, 3, 4, 5]) + + def test_every_text_write_pins_its_newline(self): + bad = [] + count = 0 + for path in python_files(): + count += 1 + with open(path, encoding="utf-8") as f: + for line in unpinned_text_writes(f.read()): + bad.append(f"{os.path.relpath(path, ROOT)}:{line}") + self.assertGreater(count, 50, "the scan found almost no Python files; is the layout different?") + self.assertEqual(bad, [], "text writes without newline= (CRLF on Windows, LF elsewhere): " + ", ".join(bad)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_tool_startup.py b/tests/test_tool_startup.py new file mode 100644 index 0000000000..6933ad597e --- /dev/null +++ b/tests/test_tool_startup.py @@ -0,0 +1,72 @@ +"""Every tool that imports a sibling module starts under the project's own `python -I` convention. + +`-I` implies `-P`, so the script's directory is not put on `sys.path`; a tool that imports the module next to it +has to add that directory itself (the pattern in `tools/anim_clips.py:40`). Two tools did not and died with +`ModuleNotFoundError` before `main()` — `calibrated_texture.py` and `ttpf_assets.py` — which this test caught. + +The tool list is derived from the sources rather than written down, so a new tool with a sibling import is covered +without touching this file. `--help` is used because it reaches the argument parser without game files or a GPU; +the three module-only tools (`bcpack`, `calibrated_texture`, `cf_ref`) have no `__main__` and simply exit 0 on the +import. Tools that need numpy are skipped where it is not installed, as the texture tools are allowed to use it. +""" +import ast +import glob +import importlib.util +import os +import subprocess +import sys +import unittest + +HERE = os.path.dirname(os.path.abspath(__file__)) +ROOT = os.path.dirname(HERE) +TOOLS = os.path.join(ROOT, "tools") +TOOL_NAMES = {os.path.splitext(os.path.basename(path))[0] for path in glob.glob(os.path.join(TOOLS, "*.py"))} +NUMERIC = {"amd_swizzle", "calibrated_texture", "swizzle_search", "tex_export", "tex_mode_probe", "tile_probe"} + +# One process per tool is a few seconds in total; a hung import is a failure, not an infinite test. +TIMEOUT = 120 + + +def imports(path): + """The module names `path` imports at top level, relative imports excluded.""" + names = set() + for node in ast.walk(ast.parse(open(path, encoding="utf-8").read())): + if isinstance(node, ast.Import): + names |= {alias.name.split(".")[0] for alias in node.names} + elif isinstance(node, ast.ImportFrom) and node.level == 0 and node.module: + names.add(node.module.split(".")[0]) + return names + + +def sibling_importers(): + found = [] + for path in sorted(glob.glob(os.path.join(TOOLS, "*.py"))): + own = os.path.splitext(os.path.basename(path))[0] + if imports(path) & (TOOL_NAMES - {own}): + found.append(path) + return found + + +class ToolStartupTests(unittest.TestCase): + def test_each_sibling_importing_tool_starts(self): + paths = sibling_importers() + self.assertGreater(len(paths), 20, "the sibling-import scan found almost nothing") + have_numpy = importlib.util.find_spec("numpy") is not None + for path in paths: + name = os.path.splitext(os.path.basename(path))[0] + if name in NUMERIC and not have_numpy: + continue + with self.subTest(tool=name): + proc = subprocess.run([sys.executable, "-I", path, "--help"], capture_output=True, text=True, + timeout=TIMEOUT, errors="replace") + self.assertEqual(proc.returncode, 0, proc.stderr[-2000:]) + self.assertNotIn("Traceback", proc.stderr) + + def test_the_two_fixed_tools_are_in_the_scan(self): + names = {os.path.splitext(os.path.basename(path))[0] for path in sibling_importers()} + self.assertIn("calibrated_texture", names) + self.assertIn("ttpf_assets", names) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_user_sgpr_census.py b/tests/test_user_sgpr_census.py index 4a94ff372f..2c52fbe460 100644 --- a/tests/test_user_sgpr_census.py +++ b/tests/test_user_sgpr_census.py @@ -1,7 +1,12 @@ """tools/user_sgpr_census.py on hand-written index.json data (no game files, no GPU).""" import json import os +from pathlib import Path +import subprocess import sys +import tempfile + +import pytest ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.join(ROOT, "tools")) @@ -73,9 +78,62 @@ def test_the_two_packing_models_are_told_apart(): assert b["below_base"] == {"s1:const32": 1} +@pytest.mark.parametrize("output_kind", ["same-path", "relative-alias", "hard-link"]) +def test_json_report_refuses_to_overwrite_index(tmp_path, capsys, output_kind): + index = tmp_path / "index.json" + original = json.dumps(INDEX).encode("utf-8") + index.write_bytes(original) + output = index + if output_kind == "relative-alias": + subdir = tmp_path / "subdir" + subdir.mkdir() + output = subdir / ".." / index.name + elif output_kind == "hard-link": + output = tmp_path / "alias.json" + try: + output.hardlink_to(index) + except OSError as err: + pytest.skip(f"hard links unavailable: {err}") + + with pytest.raises(SystemExit) as exc: + usc.main([str(index), "--json", str(output)]) + + assert exc.value.code == 2 + assert "--json must not overwrite the input index" in capsys.readouterr().err + assert index.read_bytes() == original + + +def test_json_report_accepts_a_separate_output(tmp_path): + index = tmp_path / "index.json" + output = tmp_path / "summary.json" + index.write_text(json.dumps(INDEX), encoding="utf-8") + + assert usc.main([str(index), "--json", str(output)]) == 0 + assert json.loads(output.read_text(encoding="utf-8"))["ps"]["lowest_pointer_sgpr"] == {"s8": 2, "s9": 1} + assert json.loads(index.read_text(encoding="utf-8")) == INDEX + + def test_expect_passes_and_fails(tmp_path, capsys): p = tmp_path / "index.json" p.write_text(json.dumps(INDEX), encoding="utf-8") assert usc.main([str(p), "--expect", "ps=8", "cs=4"]) == 0 assert usc.main([str(p), "--expect", "ps=0"]) == 1 assert "expected s0, got s8" in capsys.readouterr().err + + +def test_cli_rejects_malformed_stage_assignment(): + with tempfile.TemporaryDirectory() as tmp: + index = Path(tmp, "index.json") + report = Path(tmp, "report.json") + index.write_text(json.dumps(INDEX), encoding="utf-8") + tool = os.path.join(ROOT, "tools", "user_sgpr_census.py") + for option in ("--base", "--expect"): + for assignment in ("ps", "ps=bad", "=8", "ps=-1"): + result = subprocess.run( + [sys.executable, "-I", tool, str(index), "--json", str(report), option, assignment], + capture_output=True, text=True, + ) + assert result.returncode == 2, result.stderr + assert "expected STAGE=SGPR" in result.stderr + assert "Traceback" not in result.stderr + assert not report.exists() diff --git a/tests/test_viewer_streaming.cjs b/tests/test_viewer_streaming.cjs index 596caaa199..666bd9ffc8 100644 --- a/tests/test_viewer_streaming.cjs +++ b/tests/test_viewer_streaming.cjs @@ -6,6 +6,7 @@ const { test } = require('node:test'); // Exercise the viewer's actual loading and streaming code without WebGL, a network or game data. const html = readFileSync(join(__dirname, '..', 'viewer', 'index.html'), 'utf8'); +const viewerModule = html.match(/