diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 19:04:24 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-25 19:04:24 -0500 |
| commit | 8d832fd10913064e1c8aec74191e3ba8f70211c8 (patch) | |
| tree | e365199d7d86ebf592a5a0dc2f07cda4b74b58a7 /runtime/src | |
| parent | 5da3b6be3cefc1499452ba8c8370a50092674d61 (diff) | |
| parent | c50ed94b35b37b697ab9c5fd176f3738480b4db5 (diff) | |
Merge main into rt-title-every-budget (#2122)
#2098 split the every-pass loop of refresh_title_textures by mode: with
LEONIDA_TEXTURE_REFRESH_ASYNC every persistent mapping is polled each
pass and only stale unmapped textures are visited, without it all mapped
or stale ones are. The async branch is kept as main has it.
LEONIDA_TITLE_EVERY_BUDGET_US applies to the synchronous pass, the one
before a submission on the submitting thread; under async the pass runs
on the refresh worker and the limit does not apply (README says so).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src')
42 files changed, 8674 insertions, 604 deletions
diff --git a/runtime/src/base_reservation.h b/runtime/src/base_reservation.h index b76c28c70..5ccfe1aaa 100644 --- a/runtime/src/base_reservation.h +++ b/runtime/src/base_reservation.h | |||
| @@ -63,7 +63,10 @@ inline void* commit_reserved(std::uint64_t base, std::uint64_t size) { | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | // The preferred range of `image` when it has no relocations and that range is not free in this process; nullopt | 65 | // The preferred range of `image` when it has no relocations and that range is not free in this process; nullopt |
| 66 | // when the image can be mapped as it is (or is not a readable PE32+, which the loader reports itself). | 66 | // when the image can be mapped as it is (or is not a readable PE32+, which the loader reports itself). Without a |
| 67 | // relocation directory the loader refuses to move an image that has IMAGE_FILE_RELOCS_STRIPPED, and moves one with | ||
| 68 | // the flag clear with nothing fixed up: that is right only for an image with no absolute addresses in it, so its | ||
| 69 | // range is kept free either way. An image with a relocation table is moved and fixed up whatever the flag says. | ||
| 67 | inline std::optional<Range> needed(const std::filesystem::path& image) { | 70 | inline std::optional<Range> needed(const std::filesystem::path& image) { |
| 68 | std::ifstream file(image, std::ios::binary); | 71 | std::ifstream file(image, std::ios::binary); |
| 69 | IMAGE_DOS_HEADER dos{}; | 72 | IMAGE_DOS_HEADER dos{}; |
diff --git a/runtime/src/buffer_va_index.h b/runtime/src/buffer_va_index.h index 6fbba5b05..3ab8edf82 100644 --- a/runtime/src/buffer_va_index.h +++ b/runtime/src/buffer_va_index.h | |||
| @@ -91,6 +91,11 @@ public: | |||
| 91 | 91 | ||
| 92 | std::size_t size() const { return ranges_.size(); } | 92 | std::size_t size() const { return ranges_.size(); } |
| 93 | std::uint64_t longest() const { return longest_; } | 93 | std::uint64_t longest() const { return longest_; } |
| 94 | // f(first VA, bytes) for every range, in VA order. | ||
| 95 | template <class F> | ||
| 96 | void for_each(F&& f) const { | ||
| 97 | for (const auto& [key, bytes] : ranges_) f(key.first, bytes); | ||
| 98 | } | ||
| 94 | 99 | ||
| 95 | private: | 100 | private: |
| 96 | static constexpr Id max_id() { return ~Id(0); } | 101 | static constexpr Id max_id() { return ~Id(0); } |
diff --git a/runtime/src/command_list.h b/runtime/src/command_list.h index b68b413fc..d7d739640 100644 --- a/runtime/src/command_list.h +++ b/runtime/src/command_list.h | |||
| @@ -462,6 +462,7 @@ struct Draw { | |||
| 462 | std::uint32_t first_instance = 0; | 462 | std::uint32_t first_instance = 0; |
| 463 | bool mesh = false; | 463 | bool mesh = false; |
| 464 | std::shared_ptr<const DrawViewports> viewports; // non-null when >1 viewport or >1 scissor was bound | 464 | std::shared_ptr<const DrawViewports> viewports; // non-null when >1 viewport or >1 scissor was bound |
| 465 | std::array<float, 2> depth_bounds{0, 1}; // OMSetDepthBounds (min, max); used by depth-bounds pipelines only | ||
| 465 | }; | 466 | }; |
| 466 | 467 | ||
| 467 | // Only indirect draws allocate this extra payload. Copies of the IR share both its | 468 | // Only indirect draws allocate this extra payload. Copies of the IR share both its |
diff --git a/runtime/src/console_heap_fix.comp b/runtime/src/console_heap_fix.comp new file mode 100644 index 000000000..85b5d1787 --- /dev/null +++ b/runtime/src/console_heap_fix.comp | |||
| @@ -0,0 +1,292 @@ | |||
| 1 | // Console descriptor heap translation on the GPU (LEONIDA_CONSOLE_HEAP_GPU=1, shims/d3d12_console_heap_gpu.h). | ||
| 2 | // The title writes 32-byte RDNA2 records into its console descriptor heap; shaders read a copy in which every buffer | ||
| 3 | // V# whose base is the title's own memory names the GPU copy of that memory instead (DeviceState::fix_vsharp). This | ||
| 4 | // pass makes that copy: for each listed slot it reads the title's bytes (a host mirror of the heap's pages), rewrites | ||
| 5 | // the V# halves, and writes the record where shaders read it. T#s and other words are copied as they are (T#s are | ||
| 6 | // found by their exact words in the bindless table; the CPU registers them). | ||
| 7 | // console_heap_fix_spv.h is this file compiled with `glslc --target-env=vulkan1.2 -O -mfmt=c` (see the header); | ||
| 8 | // keep them together. runtime/test/vk_console_heap_gpu_test.cpp checks it against the CPU reference | ||
| 9 | // (console_heap_gpu_reference in d3d12_console_heap_gpu.h). | ||
| 10 | // | ||
| 11 | // A V# half (dwords 0-3, and 4-7 when dword 3 says the slot is a buffer pair) is translated like fix_vsharp: | ||
| 12 | // - skipped when its TYPE bits (dword 3, bits 30-31) are set or it has no records (dword 2 zero); | ||
| 13 | // - base 0: written with no records; | ||
| 14 | // - base inside a range of the range table (the alias table: slot-133 buffers, title windows, pool extents), sorted | ||
| 15 | // by title VA: rebased to the range's shader VA when the range was checked backed on the CPU and holds the V#'s | ||
| 16 | // whole span; written with no records when it does not hold it (vsharp_address answers 0 there too). An | ||
| 17 | // unchecked range falls through; | ||
| 18 | // - the base as a shader VA (sign-extended from bit 47 with FLAG_SIGNED) with its whole span inside a span of the | ||
| 19 | // backed table (live allocations, geometry blocks): left as it is, as vsharp_address's backed() leaves it; | ||
| 20 | // - otherwise its exact 16 bytes are looked up in the key table (an open-addressed table the CPU fills with what | ||
| 21 | // vsharp_address answered for those words: a shader VA, or "no backing"); found: rebased, or written with no | ||
| 22 | // records; | ||
| 23 | // - not found: written with no records; when the base is in the ask table (the title's memory and GPU windows, with | ||
| 24 | // FLAG_ASK), or there is no ask table, the half is recorded in the miss list, which the CPU reads once the | ||
| 25 | // submission is done, resolves (making the copy if it can) and enters in the key table. | ||
| 26 | // "No records" is what fix_vsharp writes: dwords 0, 1 and 2 zero, so loads return 0 and stores are dropped, and no | ||
| 27 | // shader adds heap_base to a raw title address. | ||
| 28 | // | ||
| 29 | // MODE_UPDATE writes the key table entries the CPU changed (one thread each) before MODE_TRANSLATE runs, so the | ||
| 30 | // table only ever changes in GPU order, between passes. | ||
| 31 | // | ||
| 32 | // Addresses are 64-bit buffer device addresses passed as uvec2 (GL_EXT_buffer_reference_uvec2): only the | ||
| 33 | // bufferDeviceAddress feature is needed, no shaderInt64. | ||
| 34 | #version 460 | ||
| 35 | #extension GL_EXT_buffer_reference : require | ||
| 36 | #extension GL_EXT_buffer_reference_uvec2 : require | ||
| 37 | |||
| 38 | layout(local_size_x = 64) in; | ||
| 39 | |||
| 40 | layout(buffer_reference, std430, buffer_reference_align = 16) buffer Slots { | ||
| 41 | uvec4 v[]; | ||
| 42 | }; | ||
| 43 | layout(buffer_reference, std430, buffer_reference_align = 4) buffer Words { | ||
| 44 | uint w[]; | ||
| 45 | }; | ||
| 46 | |||
| 47 | const uint MODE_TRANSLATE = 0u; | ||
| 48 | const uint MODE_UPDATE = 1u; | ||
| 49 | |||
| 50 | const uint RANGE_WORDS = 8u; // title_va (2), end (2), shader_va (2), flags, pad | ||
| 51 | const uint RANGE_CHECKED = 1u; // the CPU found the whole range backed | ||
| 52 | const uint KEY_WORDS = 8u; // key (4), to.x, to.y | flags << 16, pad (2) | ||
| 53 | const uint KEY_USED = 1u; | ||
| 54 | const uint KEY_NONE = 2u; // vsharp_address answered 0: no records | ||
| 55 | const uint KEY_PROBES = 16u; | ||
| 56 | const uint UPDATE_WORDS = 12u; // index, pad (3), entry (8) | ||
| 57 | const uint MISS_HEADER = 4u; // count, capacity, overflowed, pad | ||
| 58 | const uint SPAN_WORDS = 4u; // start (2), end (2) | ||
| 59 | const uint FLAG_SIGNED = 1u; | ||
| 60 | const uint FLAG_ASK = 2u; | ||
| 61 | const uint FLAG_RANGE = 4u; // MODE_TRANSLATE over slots pc.work.x + i, not a list: a rescan, V# pairs only | ||
| 62 | const uint FLAG_FILTER = 8u; // with FLAG_RANGE: only slots whose metadata meets a change span (below) | ||
| 63 | |||
| 64 | layout(push_constant) uniform Params { | ||
| 65 | uvec2 input_slots; // the title's bytes of the heap (its host mirror) | ||
| 66 | uvec2 copy_slots; // the heap where shaders read it | ||
| 67 | uvec2 work; // slot indices (MODE_TRANSLATE) | ||
| 68 | uvec2 ranges; // range table | ||
| 69 | uvec2 keys; // key table | ||
| 70 | uvec2 misses; // miss list | ||
| 71 | uvec2 backed; // backed spans | ||
| 72 | uvec2 ask; // ask spans | ||
| 73 | uvec2 meta; // per slot and half, device-local: what the pass last made of it (meta_of); 0: none | ||
| 74 | uvec2 cshader; // a filtered rescan's change spans in shader VAs (backings and alias copies that went) | ||
| 75 | uvec2 ctitle; // and in title VAs (alias ranges that went, words answered since) | ||
| 76 | uint count; // work items or updates | ||
| 77 | uint range_count; | ||
| 78 | uint key_mask; // key table entries - 1 (a power of two) | ||
| 79 | uint mode; | ||
| 80 | uint heap; // the heap's index (< 8), kept in each miss | ||
| 81 | uint backed_count; | ||
| 82 | uint ask_count; | ||
| 83 | uint flags; | ||
| 84 | uint cshader_count; | ||
| 85 | uint ctitle_count; | ||
| 86 | } pc; | ||
| 87 | // MODE_UPDATE reads its records at pc.work (the push constants hold 128 bytes). | ||
| 88 | |||
| 89 | uvec2 add64(uvec2 a, uvec2 b) { | ||
| 90 | uint carry; | ||
| 91 | uint lo = uaddCarry(a.x, b.x, carry); | ||
| 92 | return uvec2(lo, a.y + b.y + carry); | ||
| 93 | } | ||
| 94 | uvec2 sub64(uvec2 a, uvec2 b) { | ||
| 95 | uint borrow; | ||
| 96 | uint lo = usubBorrow(a.x, b.x, borrow); | ||
| 97 | return uvec2(lo, a.y - b.y - borrow); | ||
| 98 | } | ||
| 99 | bool less64(uvec2 a, uvec2 b) { return a.y < b.y || (a.y == b.y && a.x < b.x); } | ||
| 100 | uvec2 offset(uvec2 base, uint word) { | ||
| 101 | uint carry; | ||
| 102 | uint lo = uaddCarry(base.x, word * 4u, carry); | ||
| 103 | return uvec2(lo, base.y + carry); | ||
| 104 | } | ||
| 105 | uint load(uvec2 base, uint word) { return Words(offset(base, word)).w[0]; } | ||
| 106 | uvec2 load2(uvec2 base, uint word) { return uvec2(load(base, word), load(base, word + 1u)); } | ||
| 107 | |||
| 108 | // FNV-1a over the four dwords, then MurmurHash3's fmix32: without the finalizer the low bits (the table index) depend | ||
| 109 | // only on the low bits of each dword, and V#s whose bases differ only above bit 20 all fell into one probe chain. | ||
| 110 | uint key_hash(uvec4 k) { | ||
| 111 | uint h = 2166136261u; | ||
| 112 | h = (h ^ k.x) * 16777619u; | ||
| 113 | h = (h ^ k.y) * 16777619u; | ||
| 114 | h = (h ^ k.z) * 16777619u; | ||
| 115 | h = (h ^ k.w) * 16777619u; | ||
| 116 | h ^= h >> 16; | ||
| 117 | h *= 0x85EBCA6Bu; | ||
| 118 | h ^= h >> 13; | ||
| 119 | h *= 0xC2B2AE35u; | ||
| 120 | h ^= h >> 16; | ||
| 121 | return h; | ||
| 122 | } | ||
| 123 | |||
| 124 | // [v, v + n) inside one of `count` sorted, disjoint spans at `spans`. | ||
| 125 | bool spans_hold(uvec2 spans, uint count, uvec2 v, uvec2 n) { | ||
| 126 | uint lo = 0u, hi = count; | ||
| 127 | while (lo < hi) { | ||
| 128 | const uint mid = (lo + hi) >> 1u; | ||
| 129 | if (less64(v, load2(spans, SPAN_WORDS * mid))) hi = mid; | ||
| 130 | else lo = mid + 1u; | ||
| 131 | } | ||
| 132 | if (lo == 0u) return false; | ||
| 133 | const uvec2 end = load2(spans, SPAN_WORDS * (lo - 1u) + 2u); | ||
| 134 | return less64(v, end) && !less64(sub64(end, v), n); | ||
| 135 | } | ||
| 136 | |||
| 137 | // Some span of `count` sorted, disjoint spans at `spans` overlaps [v, v + n). | ||
| 138 | bool spans_meet(uvec2 spans, uint count, uvec2 v, uvec2 n) { | ||
| 139 | const uvec2 last = add64(v, n); // spans starting below it | ||
| 140 | uint lo = 0u, hi = count; | ||
| 141 | while (lo < hi) { | ||
| 142 | const uint mid = (lo + hi) >> 1u; | ||
| 143 | if (less64(load2(spans, SPAN_WORDS * mid), last)) lo = mid + 1u; | ||
| 144 | else hi = mid; | ||
| 145 | } | ||
| 146 | if (lo == 0u) return false; | ||
| 147 | return less64(v, load2(spans, SPAN_WORDS * (lo - 1u) + 2u)); | ||
| 148 | } | ||
| 149 | |||
| 150 | // A 48-bit V# base as the shader VA it names: sign-extended from bit 47 with FLAG_SIGNED. | ||
| 151 | uvec2 shader_va(uvec2 base48) { | ||
| 152 | uvec2 v = uvec2(base48.x, base48.y & 0xffffu); | ||
| 153 | if ((pc.flags & FLAG_SIGNED) != 0u && (v.y & 0x8000u) != 0u) v.y |= 0xffff0000u; | ||
| 154 | return v; | ||
| 155 | } | ||
| 156 | |||
| 157 | // Metadata of one V# half: its title base and span before the pass, and the base it got (0: no records). | ||
| 158 | // x = title base low, y = title base bits 32-47 | result bits 32-47 << 16, z = result low, w = span (saturated). | ||
| 159 | uvec4 meta_of(uvec4 before, uvec4 after) { | ||
| 160 | if ((before.w >> 30) != 0u || before.z == 0u) return uvec4(0u); | ||
| 161 | const uint stride = (before.y >> 16) & 0x3fffu; | ||
| 162 | uvec2 span; | ||
| 163 | umulExtended(before.z, stride == 0u ? 1u : stride, span.y, span.x); | ||
| 164 | const uvec2 to = after.z == 0u ? uvec2(0u) : uvec2(after.x, after.y & 0xffffu); | ||
| 165 | return uvec4(before.x, (before.y & 0xffffu) | (to.y << 16), to.x, span.y != 0u ? 0xffffffffu : span.x); | ||
| 166 | } | ||
| 167 | |||
| 168 | // The half's metadata meets a change span: its title base in a title span, or its base or result (with its span) in | ||
| 169 | // a shader span. What DeviceState's CPU release filter asks of a slot (LEONIDA_CONSOLE_RELEASE_FILTER). | ||
| 170 | bool affected(uvec4 m) { | ||
| 171 | if (m.x == 0u && m.y == 0u && m.z == 0u) return false; | ||
| 172 | const uvec2 base = uvec2(m.x, m.y & 0xffffu); | ||
| 173 | const uvec2 span = uvec2(m.w, 0u); | ||
| 174 | if (pc.ctitle_count != 0u && spans_meet(pc.ctitle, pc.ctitle_count, base, uvec2(1u, 0u))) return true; | ||
| 175 | if (pc.cshader_count == 0u) return false; | ||
| 176 | if (spans_meet(pc.cshader, pc.cshader_count, shader_va(base), span)) return true; | ||
| 177 | const uvec2 to = uvec2(m.z, m.y >> 16); | ||
| 178 | return !(to.x == 0u && to.y == 0u) && spans_meet(pc.cshader, pc.cshader_count, shader_va(to), span); | ||
| 179 | } | ||
| 180 | |||
| 181 | void rebase(inout uvec4 k, uvec2 to) { | ||
| 182 | k.x = to.x; | ||
| 183 | k.y = (k.y & 0xffff0000u) | (to.y & 0xffffu); | ||
| 184 | } | ||
| 185 | void no_records(inout uvec4 k) { | ||
| 186 | k.x = 0u; | ||
| 187 | k.y = 0u; | ||
| 188 | k.z = 0u; | ||
| 189 | } | ||
| 190 | |||
| 191 | // 0: left as it is, 1: rebased or written with no records by a table, 2: missed (written with no records). | ||
| 192 | uint translate(inout uvec4 k) { | ||
| 193 | if ((k.w >> 30) != 0u || k.z == 0u) return 0u; | ||
| 194 | const uvec2 base = uvec2(k.x, k.y & 0xffffu); | ||
| 195 | if (base.x == 0u && base.y == 0u) { | ||
| 196 | no_records(k); | ||
| 197 | return 1u; | ||
| 198 | } | ||
| 199 | const uint stride = (k.y >> 16) & 0x3fffu; | ||
| 200 | uvec2 span; | ||
| 201 | umulExtended(k.z, stride == 0u ? 1u : stride, span.y, span.x); | ||
| 202 | // The last range that starts at or below base. | ||
| 203 | uint lo = 0u, hi = pc.range_count; | ||
| 204 | while (lo < hi) { | ||
| 205 | const uint mid = (lo + hi) >> 1u; | ||
| 206 | if (less64(base, load2(pc.ranges, RANGE_WORDS * mid))) hi = mid; | ||
| 207 | else lo = mid + 1u; | ||
| 208 | } | ||
| 209 | if (lo > 0u) { | ||
| 210 | const uint e = RANGE_WORDS * (lo - 1u); | ||
| 211 | const uvec2 end = load2(pc.ranges, e + 2u); | ||
| 212 | if (less64(base, end) && (load(pc.ranges, e + 6u) & RANGE_CHECKED) != 0u) { | ||
| 213 | if (less64(sub64(end, base), span)) { | ||
| 214 | no_records(k); | ||
| 215 | } else { | ||
| 216 | const uvec2 start = load2(pc.ranges, e); | ||
| 217 | rebase(k, add64(load2(pc.ranges, e + 4u), sub64(base, start))); | ||
| 218 | } | ||
| 219 | return 1u; | ||
| 220 | } | ||
| 221 | } | ||
| 222 | uvec2 shader = base; | ||
| 223 | if ((pc.flags & FLAG_SIGNED) != 0u && (base.y & 0x8000u) != 0u) shader.y |= 0xffff0000u; | ||
| 224 | if (pc.backed_count != 0u && spans_hold(pc.backed, pc.backed_count, shader, span.x == 0u && span.y == 0u ? uvec2(1u, 0u) : span)) | ||
| 225 | return 1u; | ||
| 226 | const uint h = key_hash(k); | ||
| 227 | for (uint p = 0u; p < KEY_PROBES; ++p) { | ||
| 228 | const uint at = KEY_WORDS * ((h + p) & pc.key_mask); | ||
| 229 | const uint flags = load(pc.keys, at + 5u) >> 16; | ||
| 230 | if ((flags & KEY_USED) == 0u) continue; | ||
| 231 | if (load(pc.keys, at) != k.x || load(pc.keys, at + 1u) != k.y || load(pc.keys, at + 2u) != k.z || | ||
| 232 | load(pc.keys, at + 3u) != k.w) | ||
| 233 | continue; | ||
| 234 | if ((flags & KEY_NONE) != 0u) no_records(k); | ||
| 235 | else rebase(k, uvec2(load(pc.keys, at + 4u), load(pc.keys, at + 5u) & 0xffffu)); | ||
| 236 | return 1u; | ||
| 237 | } | ||
| 238 | no_records(k); | ||
| 239 | if ((pc.flags & FLAG_ASK) != 0u && !spans_hold(pc.ask, pc.ask_count, base, uvec2(1u, 0u))) return 1u; | ||
| 240 | return 2u; | ||
| 241 | } | ||
| 242 | |||
| 243 | void miss(uint code) { | ||
| 244 | Words m = Words(pc.misses); | ||
| 245 | const uint at = atomicAdd(m.w[0], 1u); | ||
| 246 | if (at < m.w[1]) m.w[MISS_HEADER + at] = code; | ||
| 247 | else m.w[2] = 1u; | ||
| 248 | } | ||
| 249 | |||
| 250 | void main() { | ||
| 251 | const uint i = gl_GlobalInvocationID.x; | ||
| 252 | if (i >= pc.count) return; | ||
| 253 | if (pc.mode == MODE_UPDATE) { | ||
| 254 | const uvec2 record = offset(pc.work, UPDATE_WORDS * i); | ||
| 255 | const uint index = Words(record).w[0]; | ||
| 256 | Words table = Words(offset(pc.keys, KEY_WORDS * index)); | ||
| 257 | for (uint j = 0u; j < KEY_WORDS; ++j) table.w[j] = Words(record).w[4u + j]; | ||
| 258 | return; | ||
| 259 | } | ||
| 260 | // A work item is a slot index; bit 31: the CPU found the slot neither a buffer pair nor a T# it can decode, and | ||
| 261 | // dwords 0-3 are written as zeros (fix_console_slot's rule: such words must not reach a shader as a descriptor). | ||
| 262 | const bool range = (pc.flags & FLAG_RANGE) != 0u; | ||
| 263 | const uint item = range ? pc.work.x + i : Words(pc.work).w[i]; | ||
| 264 | const uint slot = item & 0x7fffffffu; | ||
| 265 | const bool has_meta = !(pc.meta.x == 0u && pc.meta.y == 0u); | ||
| 266 | // A filtered rescan reads only the device-local metadata of a slot it leaves alone, not the title's bytes. | ||
| 267 | if (range && (pc.flags & FLAG_FILTER) != 0u && has_meta) { | ||
| 268 | Slots m = Slots(pc.meta); | ||
| 269 | if (!affected(m.v[2u * slot]) && !affected(m.v[2u * slot + 1u])) return; | ||
| 270 | } | ||
| 271 | Slots source = Slots(pc.input_slots); | ||
| 272 | uvec4 a = source.v[2u * slot]; | ||
| 273 | uvec4 b = source.v[2u * slot + 1u]; | ||
| 274 | // A rescan rewrites buffer pairs only: every other slot keeps what its last listed pass wrote. | ||
| 275 | if (range && (a.w >> 30) != 0u) return; | ||
| 276 | if ((item >> 31) != 0u && (a.w >> 30) != 0u) a = uvec4(0u); | ||
| 277 | const uvec4 a0 = a, b0 = b; | ||
| 278 | if ((a.w >> 30) == 0u) { | ||
| 279 | // A miss is (heap << 29) | (slot << 1) | half: up to eight heaps of 2^28 slots. | ||
| 280 | if (translate(a) == 2u) miss((pc.heap << 29) | (slot << 1u)); | ||
| 281 | if (translate(b) == 2u) miss((pc.heap << 29) | (slot << 1u) | 1u); | ||
| 282 | } | ||
| 283 | Slots target = Slots(pc.copy_slots); | ||
| 284 | target.v[2u * slot] = a; | ||
| 285 | target.v[2u * slot + 1u] = b; | ||
| 286 | if (has_meta) { | ||
| 287 | Slots m = Slots(pc.meta); | ||
| 288 | const bool pair = (a0.w >> 30) == 0u; | ||
| 289 | m.v[2u * slot] = pair ? meta_of(a0, a) : uvec4(0u); | ||
| 290 | m.v[2u * slot + 1u] = pair ? meta_of(b0, b) : uvec4(0u); | ||
| 291 | } | ||
| 292 | } | ||
diff --git a/runtime/src/console_heap_fix.inc b/runtime/src/console_heap_fix.inc new file mode 100644 index 000000000..2e2882f6d --- /dev/null +++ b/runtime/src/console_heap_fix.inc | |||
| @@ -0,0 +1,3163 @@ | |||
| 1 | {0x07230203,0x00010500,0x000d000b,0x000021a5, | ||
| 2 | 0x00000000,0x00020011,0x00000001,0x00020011, | ||
| 3 | 0x000014e3,0x0006000b,0x00000001,0x4c534c47, | ||
| 4 | 0x6474732e,0x3035342e,0x00000000,0x0003000e, | ||
| 5 | 0x000014e4,0x00000001,0x0007000f,0x00000005, | ||
| 6 | 0x00000004,0x6e69616d,0x00000000,0x00000180, | ||
| 7 | 0x000003f8,0x00060010,0x00000004,0x00000011, | ||
| 8 | 0x00000040,0x00000001,0x00000001,0x00040047, | ||
| 9 | 0x000000b2,0x00000006,0x00000004,0x00030047, | ||
| 10 | 0x000000b3,0x00000002,0x00050048,0x000000b3, | ||
| 11 | 0x00000000,0x00000023,0x00000000,0x00030047, | ||
| 12 | 0x0000017e,0x00000002,0x00050048,0x0000017e, | ||
| 13 | 0x00000000,0x00000023,0x00000000,0x00050048, | ||
| 14 | 0x0000017e,0x00000001,0x00000023,0x00000008, | ||
| 15 | 0x00050048,0x0000017e,0x00000002,0x00000023, | ||
| 16 | 0x00000010,0x00050048,0x0000017e,0x00000003, | ||
| 17 | 0x00000023,0x00000018,0x00050048,0x0000017e, | ||
| 18 | 0x00000004,0x00000023,0x00000020,0x00050048, | ||
| 19 | 0x0000017e,0x00000005,0x00000023,0x00000028, | ||
| 20 | 0x00050048,0x0000017e,0x00000006,0x00000023, | ||
| 21 | 0x00000030,0x00050048,0x0000017e,0x00000007, | ||
| 22 | 0x00000023,0x00000038,0x00050048,0x0000017e, | ||
| 23 | 0x00000008,0x00000023,0x00000040,0x00050048, | ||
| 24 | 0x0000017e,0x00000009,0x00000023,0x00000048, | ||
| 25 | 0x00050048,0x0000017e,0x0000000a,0x00000023, | ||
| 26 | 0x00000050,0x00050048,0x0000017e,0x0000000b, | ||
| 27 | 0x00000023,0x00000058,0x00050048,0x0000017e, | ||
| 28 | 0x0000000c,0x00000023,0x0000005c,0x00050048, | ||
| 29 | 0x0000017e,0x0000000d,0x00000023,0x00000060, | ||
| 30 | 0x00050048,0x0000017e,0x0000000e,0x00000023, | ||
| 31 | 0x00000064,0x00050048,0x0000017e,0x0000000f, | ||
| 32 | 0x00000023,0x00000068,0x00050048,0x0000017e, | ||
| 33 | 0x00000010,0x00000023,0x0000006c,0x00050048, | ||
| 34 | 0x0000017e,0x00000011,0x00000023,0x00000070, | ||
| 35 | 0x00050048,0x0000017e,0x00000012,0x00000023, | ||
| 36 | 0x00000074,0x00050048,0x0000017e,0x00000013, | ||
| 37 | 0x00000023,0x00000078,0x00050048,0x0000017e, | ||
| 38 | 0x00000014,0x00000023,0x0000007c,0x00040047, | ||
| 39 | 0x000003f8,0x0000000b,0x0000001c,0x00040047, | ||
| 40 | 0x00000469,0x00000006,0x00000010,0x00030047, | ||
| 41 | 0x0000046a,0x00000002,0x00050048,0x0000046a, | ||
| 42 | 0x00000000,0x00000023,0x00000000,0x00040047, | ||
| 43 | 0x00000517,0x0000000b,0x00000019,0x00020013, | ||
| 44 | 0x00000002,0x00030021,0x00000003,0x00000002, | ||
| 45 | 0x00040015,0x00000006,0x00000020,0x00000000, | ||
| 46 | 0x00040017,0x00000007,0x00000006,0x00000002, | ||
| 47 | 0x00020014,0x00000012,0x00040017,0x00000027, | ||
| 48 | 0x00000006,0x00000004,0x0004002b,0x00000006, | ||
| 49 | 0x00000058,0x00000000,0x0004001e,0x0000005e, | ||
| 50 | 0x00000006,0x00000006,0x0004002b,0x00000006, | ||
| 51 | 0x00000063,0x00000001,0x0004002b,0x00000006, | ||
| 52 | 0x0000009e,0x00000004,0x00030027,0x000000b1, | ||
| 53 | 0x000014e5,0x0003001d,0x000000b2,0x00000006, | ||
| 54 | 0x0003001e,0x000000b3,0x000000b2,0x00040020, | ||
| 55 | 0x000000b1,0x000014e5,0x000000b3,0x00040015, | ||
| 56 | 0x000000b5,0x00000020,0x00000001,0x0004002b, | ||
| 57 | 0x000000b5,0x000000b6,0x00000000,0x00040020, | ||
| 58 | 0x000000b7,0x000014e5,0x00000006,0x0004002b, | ||
| 59 | 0x00000006,0x000000cb,0x811c9dc5,0x0004002b, | ||
| 60 | 0x00000006,0x000000d0,0x01000193,0x0004002b, | ||
| 61 | 0x00000006,0x000000d8,0x00000002,0x0004002b, | ||
| 62 | 0x00000006,0x000000de,0x00000003,0x0004002b, | ||
| 63 | 0x000000b5,0x000000e4,0x00000010,0x0004002b, | ||
| 64 | 0x00000006,0x000000e8,0x85ebca6b,0x0004002b, | ||
| 65 | 0x000000b5,0x000000ec,0x0000000d,0x0004002b, | ||
| 66 | 0x00000006,0x000000f0,0xc2b2ae35,0x0003002a, | ||
| 67 | 0x00000012,0x0000011e,0x0004002b,0x00000006, | ||
| 68 | 0x0000017b,0x0000ffff,0x0017001e,0x0000017e, | ||
| 69 | 0x00000007,0x00000007,0x00000007,0x00000007, | ||
| 70 | 0x00000007,0x00000007,0x00000007,0x00000007, | ||
| 71 | 0x00000007,0x00000007,0x00000007,0x00000006, | ||
| 72 | 0x00000006,0x00000006,0x00000006,0x00000006, | ||
| 73 | 0x00000006,0x00000006,0x00000006,0x00000006, | ||
| 74 | 0x00000006,0x00040020,0x0000017f,0x00000009, | ||
| 75 | 0x0000017e,0x0004003b,0x0000017f,0x00000180, | ||
| 76 | 0x00000009,0x0004002b,0x000000b5,0x00000181, | ||
| 77 | 0x00000012,0x00040020,0x00000182,0x00000009, | ||
| 78 | 0x00000006,0x0004002b,0x00000006,0x0000018b, | ||
| 79 | 0x00008000,0x0004002b,0x00000006,0x00000191, | ||
| 80 | 0xffff0000,0x0004002b,0x000000b5,0x0000019b, | ||
| 81 | 0x0000001e,0x0007002c,0x00000027,0x000001a7, | ||
| 82 | 0x00000058,0x00000058,0x00000058,0x00000058, | ||
| 83 | 0x0004002b,0x00000006,0x000001ad,0x00003fff, | ||
| 84 | 0x0005002c,0x00000007,0x000001c2,0x00000058, | ||
| 85 | 0x00000058,0x0004002b,0x00000006,0x000001dc, | ||
| 86 | 0xffffffff,0x0004002b,0x000000b5,0x00000201, | ||
| 87 | 0x00000014,0x0004002b,0x000000b5,0x00000207, | ||
| 88 | 0x0000000a,0x0005002c,0x00000007,0x00000208, | ||
| 89 | 0x00000063,0x00000058,0x00040020,0x0000020a, | ||
| 90 | 0x00000009,0x00000007,0x00030029,0x00000012, | ||
| 91 | 0x00000217,0x0004002b,0x000000b5,0x00000219, | ||
| 92 | 0x00000013,0x0004002b,0x000000b5,0x00000220, | ||
| 93 | 0x00000009,0x0004002b,0x000000b5,0x0000029a, | ||
| 94 | 0x0000000c,0x0004002b,0x000000b5,0x000002aa, | ||
| 95 | 0x00000003,0x0004002b,0x00000006,0x000002ab, | ||
| 96 | 0x00000008,0x0004002b,0x00000006,0x000002d5, | ||
| 97 | 0x00000006,0x0004002b,0x000000b5,0x00000325, | ||
| 98 | 0x00000006,0x0004002b,0x00000006,0x0000034a, | ||
| 99 | 0x00000010,0x0004002b,0x000000b5,0x00000355, | ||
| 100 | 0x00000004,0x0004002b,0x00000006,0x00000357, | ||
| 101 | 0x00000005,0x0004002b,0x000000b5,0x000003bc, | ||
| 102 | 0x00000001,0x0004002b,0x000000b5,0x000003c8, | ||
| 103 | 0x00000007,0x0004002b,0x000000b5,0x000003c9, | ||
| 104 | 0x00000011,0x0004002b,0x000000b5,0x000003dd, | ||
| 105 | 0x00000005,0x0004002b,0x000000b5,0x000003f3, | ||
| 106 | 0x00000002,0x00040017,0x000003f6,0x00000006, | ||
| 107 | 0x00000003,0x00040020,0x000003f7,0x00000001, | ||
| 108 | 0x000003f6,0x0004003b,0x000003f7,0x000003f8, | ||
| 109 | 0x00000001,0x00040020,0x000003f9,0x00000001, | ||
| 110 | 0x00000006,0x0004002b,0x000000b5,0x000003fd, | ||
| 111 | 0x0000000b,0x0004002b,0x000000b5,0x00000404, | ||
| 112 | 0x0000000e,0x0004002b,0x00000006,0x0000044e, | ||
| 113 | 0x7fffffff,0x0004002b,0x000000b5,0x00000451, | ||
| 114 | 0x00000008,0x00030027,0x00000468,0x000014e5, | ||
| 115 | 0x0003001d,0x00000469,0x00000027,0x0003001e, | ||
| 116 | 0x0000046a,0x00000469,0x00040020,0x00000468, | ||
| 117 | 0x000014e5,0x0000046a,0x00040020,0x00000474, | ||
| 118 | 0x000014e5,0x00000027,0x0004002b,0x000000b5, | ||
| 119 | 0x000004a5,0x0000001f,0x0004002b,0x000000b5, | ||
| 120 | 0x000004c2,0x0000000f,0x0004002b,0x000000b5, | ||
| 121 | 0x000004c5,0x0000001d,0x0004002b,0x00000006, | ||
| 122 | 0x00000516,0x00000040,0x0006002c,0x000003f6, | ||
| 123 | 0x00000517,0x00000516,0x00000063,0x00000063, | ||
| 124 | 0x00030001,0x00000006,0x00001da1,0x0004002b, | ||
| 125 | 0x00000006,0x0000218f,0x00000020,0x0004002b, | ||
| 126 | 0x00000006,0x00002193,0x00000030,0x00040017, | ||
| 127 | 0x0000219a,0x00000012,0x00000004,0x00050036, | ||
| 128 | 0x00000002,0x00000004,0x00000000,0x00000003, | ||
| 129 | 0x000200f8,0x00000005,0x000300f7,0x00000518, | ||
| 130 | 0x00000000,0x000300fb,0x00000058,0x00000519, | ||
| 131 | 0x000200f8,0x00000519,0x00050041,0x000003f9, | ||
| 132 | 0x000003fa,0x000003f8,0x00000058,0x0004003d, | ||
| 133 | 0x00000006,0x000003fb,0x000003fa,0x00050041, | ||
| 134 | 0x00000182,0x000003fe,0x00000180,0x000003fd, | ||
| 135 | 0x0004003d,0x00000006,0x000003ff,0x000003fe, | ||
| 136 | 0x000500ae,0x00000012,0x00000400,0x000003fb, | ||
| 137 | 0x000003ff,0x000300f7,0x00000402,0x00000000, | ||
| 138 | 0x000400fa,0x00000400,0x00000401,0x00000402, | ||
| 139 | 0x000200f8,0x00000401,0x000200f9,0x00000518, | ||
| 140 | 0x000200f8,0x00000402,0x00050041,0x00000182, | ||
| 141 | 0x00000405,0x00000180,0x00000404,0x0004003d, | ||
| 142 | 0x00000006,0x00000406,0x00000405,0x000500aa, | ||
| 143 | 0x00000012,0x00000407,0x00000406,0x00000063, | ||
| 144 | 0x000300f7,0x00000409,0x00000000,0x000400fa, | ||
| 145 | 0x00000407,0x00000408,0x00000409,0x000200f8, | ||
| 146 | 0x00000408,0x00050041,0x0000020a,0x0000040f, | ||
| 147 | 0x00000180,0x000003f3,0x0004003d,0x00000007, | ||
| 148 | 0x00000410,0x0000040f,0x00050051,0x00000006, | ||
| 149 | 0x0000053b,0x00000410,0x00000000,0x00050084, | ||
| 150 | 0x00000006,0x0000053d,0x000003fb,0x00002193, | ||
| 151 | 0x00050095,0x0000005e,0x0000053e,0x0000053b, | ||
| 152 | 0x0000053d,0x00050051,0x00000006,0x0000053f, | ||
| 153 | 0x0000053e,0x00000001,0x00050051,0x00000006, | ||
| 154 | 0x00000540,0x0000053e,0x00000000,0x00050051, | ||
| 155 | 0x00000006,0x00000543,0x00000410,0x00000001, | ||
| 156 | 0x00050080,0x00000006,0x00000545,0x00000543, | ||
| 157 | 0x0000053f,0x00050050,0x00000007,0x00000546, | ||
| 158 | 0x00000540,0x00000545,0x0004007c,0x000000b1, | ||
| 159 | 0x00000415,0x00000546,0x00060041,0x000000b7, | ||
| 160 | 0x00000416,0x00000415,0x000000b6,0x000000b6, | ||
| 161 | 0x0006003d,0x00000006,0x00000417,0x00000416, | ||
| 162 | 0x00000002,0x00000004,0x00050041,0x0000020a, | ||
| 163 | 0x0000041c,0x00000180,0x00000355,0x0004003d, | ||
| 164 | 0x00000007,0x0000041d,0x0000041c,0x00050051, | ||
| 165 | 0x00000006,0x0000054c,0x0000041d,0x00000000, | ||
| 166 | 0x00050084,0x00000006,0x0000054e,0x00000417, | ||
| 167 | 0x0000218f,0x00050095,0x0000005e,0x0000054f, | ||
| 168 | 0x0000054c,0x0000054e,0x00050051,0x00000006, | ||
| 169 | 0x00000550,0x0000054f,0x00000001,0x00050051, | ||
| 170 | 0x00000006,0x00000551,0x0000054f,0x00000000, | ||
| 171 | 0x00050051,0x00000006,0x00000554,0x0000041d, | ||
| 172 | 0x00000001,0x00050080,0x00000006,0x00000556, | ||
| 173 | 0x00000554,0x00000550,0x00050050,0x00000007, | ||
| 174 | 0x00000557,0x00000551,0x00000556,0x0004007c, | ||
| 175 | 0x000000b1,0x00000420,0x00000557,0x000200f9, | ||
| 176 | 0x00000422,0x000200f8,0x00000422,0x000700f5, | ||
| 177 | 0x00000006,0x00002123,0x00000058,0x00000408, | ||
| 178 | 0x00000433,0x00000423,0x000500b0,0x00000012, | ||
| 179 | 0x00000428,0x00002123,0x000002ab,0x000400f6, | ||
| 180 | 0x00000424,0x00000423,0x00000000,0x000400fa, | ||
| 181 | 0x00000428,0x00000423,0x00000424,0x000200f8, | ||
| 182 | 0x00000423,0x00050080,0x00000006,0x0000042e, | ||
| 183 | 0x0000009e,0x00002123,0x00060041,0x000000b7, | ||
| 184 | 0x0000042f,0x00000415,0x000000b6,0x0000042e, | ||
| 185 | 0x0006003d,0x00000006,0x00000430,0x0000042f, | ||
| 186 | 0x00000002,0x00000004,0x00060041,0x000000b7, | ||
| 187 | 0x00000431,0x00000420,0x000000b6,0x00002123, | ||
| 188 | 0x0005003e,0x00000431,0x00000430,0x00000002, | ||
| 189 | 0x00000004,0x00050080,0x00000006,0x00000433, | ||
| 190 | 0x00002123,0x000003bc,0x000200f9,0x00000422, | ||
| 191 | 0x000200f8,0x00000424,0x000200f9,0x00000518, | ||
| 192 | 0x000200f8,0x00000409,0x00050041,0x00000182, | ||
| 193 | 0x00000437,0x00000180,0x00000181,0x0004003d, | ||
| 194 | 0x00000006,0x00000438,0x00000437,0x000500c7, | ||
| 195 | 0x00000006,0x00000439,0x00000438,0x0000009e, | ||
| 196 | 0x000500ab,0x00000012,0x0000043a,0x00000439, | ||
| 197 | 0x00000058,0x000300f7,0x0000043f,0x00000000, | ||
| 198 | 0x000400fa,0x0000043a,0x0000043e,0x00000444, | ||
| 199 | 0x000200f8,0x00000444,0x00050041,0x0000020a, | ||
| 200 | 0x00000445,0x00000180,0x000003f3,0x0004003d, | ||
| 201 | 0x00000007,0x00000446,0x00000445,0x0004007c, | ||
| 202 | 0x000000b1,0x00000447,0x00000446,0x00060041, | ||
| 203 | 0x000000b7,0x00000449,0x00000447,0x000000b6, | ||
| 204 | 0x000003fb,0x0006003d,0x00000006,0x0000044a, | ||
| 205 | 0x00000449,0x00000002,0x00000004,0x000200f9, | ||
| 206 | 0x0000043f,0x000200f8,0x0000043e,0x00060041, | ||
| 207 | 0x00000182,0x00000440,0x00000180,0x000003f3, | ||
| 208 | 0x00000058,0x0004003d,0x00000006,0x00000441, | ||
| 209 | 0x00000440,0x00050080,0x00000006,0x00000443, | ||
| 210 | 0x00000441,0x000003fb,0x000200f9,0x0000043f, | ||
| 211 | 0x000200f8,0x0000043f,0x000700f5,0x00000006, | ||
| 212 | 0x00001ce6,0x00000443,0x0000043e,0x0000044a, | ||
| 213 | 0x00000444,0x000500c7,0x00000006,0x0000044f, | ||
| 214 | 0x00001ce6,0x0000044e,0x00060041,0x00000182, | ||
| 215 | 0x00000452,0x00000180,0x00000451,0x00000058, | ||
| 216 | 0x0004003d,0x00000006,0x00000453,0x00000452, | ||
| 217 | 0x000500aa,0x00000012,0x00000454,0x00000453, | ||
| 218 | 0x00000058,0x000300f7,0x00000456,0x00000000, | ||
| 219 | 0x000400fa,0x00000454,0x00000455,0x00000456, | ||
| 220 | 0x000200f8,0x00000455,0x00060041,0x00000182, | ||
| 221 | 0x00000457,0x00000180,0x00000451,0x00000063, | ||
| 222 | 0x0004003d,0x00000006,0x00000458,0x00000457, | ||
| 223 | 0x000500aa,0x00000012,0x00000459,0x00000458, | ||
| 224 | 0x00000058,0x000200f9,0x00000456,0x000200f8, | ||
| 225 | 0x00000456,0x000700f5,0x00000012,0x0000045a, | ||
| 226 | 0x00000454,0x0000043f,0x00000459,0x00000455, | ||
| 227 | 0x000400a8,0x00000012,0x0000045b,0x0000045a, | ||
| 228 | 0x000300f7,0x0000045e,0x00000000,0x000400fa, | ||
| 229 | 0x0000043a,0x0000045d,0x0000045e,0x000200f8, | ||
| 230 | 0x0000045d,0x000500c7,0x00000006,0x00000461, | ||
| 231 | 0x00000438,0x000002ab,0x000500ab,0x00000012, | ||
| 232 | 0x00000462,0x00000461,0x00000058,0x000200f9, | ||
| 233 | 0x0000045e,0x000200f8,0x0000045e,0x000700f5, | ||
| 234 | 0x00000012,0x00000463,0x0000043a,0x00000456, | ||
| 235 | 0x00000462,0x0000045d,0x000500a7,0x00000012, | ||
| 236 | 0x00000465,0x00000463,0x0000045b,0x000300f7, | ||
| 237 | 0x00000467,0x00000000,0x000400fa,0x00000465, | ||
| 238 | 0x00000466,0x00000467,0x000200f8,0x00000466, | ||
| 239 | 0x00050041,0x0000020a,0x0000046d,0x00000180, | ||
| 240 | 0x00000451,0x0004003d,0x00000007,0x0000046e, | ||
| 241 | 0x0000046d,0x0004007c,0x00000468,0x0000046f, | ||
| 242 | 0x0000046e,0x00050084,0x00000006,0x00000472, | ||
| 243 | 0x000000d8,0x0000044f,0x00060041,0x00000474, | ||
| 244 | 0x00000475,0x0000046f,0x000000b6,0x00000472, | ||
| 245 | 0x0006003d,0x00000027,0x00000476,0x00000475, | ||
| 246 | 0x00000002,0x00000010,0x000300f7,0x000005c0, | ||
| 247 | 0x00000000,0x000300fb,0x00000058,0x0000056d, | ||
| 248 | 0x000200f8,0x0000056d,0x00050051,0x00000006, | ||
| 249 | 0x0000056f,0x00000476,0x00000000,0x000500aa, | ||
| 250 | 0x00000012,0x00000570,0x0000056f,0x00000058, | ||
| 251 | 0x000300f7,0x00000575,0x00000000,0x000400fa, | ||
| 252 | 0x00000570,0x00000571,0x00000575,0x000200f8, | ||
| 253 | 0x00000571,0x00050051,0x00000006,0x00000573, | ||
| 254 | 0x00000476,0x00000001,0x000500aa,0x00000012, | ||
| 255 | 0x00000574,0x00000573,0x00000058,0x000200f9, | ||
| 256 | 0x00000575,0x000200f8,0x00000575,0x000700f5, | ||
| 257 | 0x00000012,0x00000576,0x00000570,0x0000056d, | ||
| 258 | 0x00000574,0x00000571,0x000300f7,0x0000057b, | ||
| 259 | 0x00000000,0x000400fa,0x00000576,0x00000577, | ||
| 260 | 0x0000057b,0x000200f8,0x00000577,0x00050051, | ||
| 261 | 0x00000006,0x00000579,0x00000476,0x00000002, | ||
| 262 | 0x000500aa,0x00000012,0x0000057a,0x00000579, | ||
| 263 | 0x00000058,0x000200f9,0x0000057b,0x000200f8, | ||
| 264 | 0x0000057b,0x000700f5,0x00000012,0x0000057c, | ||
| 265 | 0x00000576,0x00000575,0x0000057a,0x00000577, | ||
| 266 | 0x000300f7,0x0000057e,0x00000000,0x000400fa, | ||
| 267 | 0x0000057c,0x0000057d,0x0000057e,0x000200f8, | ||
| 268 | 0x0000057d,0x000200f9,0x000005c0,0x000200f8, | ||
| 269 | 0x0000057e,0x00050051,0x00000006,0x00000582, | ||
| 270 | 0x00000476,0x00000001,0x000500c7,0x00000006, | ||
| 271 | 0x00000583,0x00000582,0x0000017b,0x00050051, | ||
| 272 | 0x00000006,0x00000586,0x00000476,0x00000003, | ||
| 273 | 0x00050041,0x00000182,0x00000588,0x00000180, | ||
| 274 | 0x00000201,0x0004003d,0x00000006,0x00000589, | ||
| 275 | 0x00000588,0x000500ab,0x00000012,0x0000058a, | ||
| 276 | 0x00000589,0x00000058,0x000300f7,0x00000592, | ||
| 277 | 0x00000000,0x000400fa,0x0000058a,0x0000058b, | ||
| 278 | 0x00000592,0x000200f8,0x0000058b,0x00050041, | ||
| 279 | 0x0000020a,0x0000058c,0x00000180,0x00000207, | ||
| 280 | 0x0004003d,0x00000007,0x0000058d,0x0000058c, | ||
| 281 | 0x000300f7,0x000005fd,0x00000000,0x000300fb, | ||
| 282 | 0x00000058,0x000005d4,0x000200f8,0x000005d4, | ||
| 283 | 0x00050095,0x0000005e,0x00000607,0x0000056f, | ||
| 284 | 0x00000063,0x00050051,0x00000006,0x00000608, | ||
| 285 | 0x00000607,0x00000001,0x00050051,0x00000006, | ||
| 286 | 0x00000609,0x00000607,0x00000000,0x00050080, | ||
| 287 | 0x00000006,0x00000611,0x00000583,0x00000608, | ||
| 288 | 0x000200f9,0x000005d9,0x000200f8,0x000005d9, | ||
| 289 | 0x000700f5,0x00000006,0x00001ce8,0x00000589, | ||
| 290 | 0x000005d4,0x00002194,0x000005ef,0x000700f5, | ||
| 291 | 0x00000006,0x00001ce7,0x00000058,0x000005d4, | ||
| 292 | 0x00002124,0x000005ef,0x000500b0,0x00000012, | ||
| 293 | 0x000005dd,0x00001ce7,0x00001ce8,0x000400f6, | ||
| 294 | 0x000005f0,0x000005ef,0x00000000,0x000400fa, | ||
| 295 | 0x000005dd,0x000005de,0x000005f0,0x000200f8, | ||
| 296 | 0x000005de,0x00050080,0x00000006,0x000005e1, | ||
| 297 | 0x00001ce7,0x00001ce8,0x000500c2,0x00000006, | ||
| 298 | 0x000005e2,0x000005e1,0x00000063,0x00050084, | ||
| 299 | 0x00000006,0x000005e4,0x0000009e,0x000005e2, | ||
| 300 | 0x00050051,0x00000006,0x00000630,0x0000058d, | ||
| 301 | 0x00000000,0x00050084,0x00000006,0x00000632, | ||
| 302 | 0x000005e2,0x0000034a,0x00050095,0x0000005e, | ||
| 303 | 0x00000633,0x00000630,0x00000632,0x00050051, | ||
| 304 | 0x00000006,0x00000634,0x00000633,0x00000001, | ||
| 305 | 0x00050051,0x00000006,0x00000635,0x00000633, | ||
| 306 | 0x00000000,0x00050051,0x00000006,0x00000638, | ||
| 307 | 0x0000058d,0x00000001,0x00050080,0x00000006, | ||
| 308 | 0x0000063a,0x00000638,0x00000634,0x00050050, | ||
| 309 | 0x00000007,0x0000063b,0x00000635,0x0000063a, | ||
| 310 | 0x0004007c,0x000000b1,0x00000628,0x0000063b, | ||
| 311 | 0x00060041,0x000000b7,0x00000629,0x00000628, | ||
| 312 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 313 | 0x0000062a,0x00000629,0x00000002,0x00000004, | ||
| 314 | 0x00050080,0x00000006,0x0000061d,0x000005e4, | ||
| 315 | 0x00000063,0x00050084,0x00000006,0x0000064d, | ||
| 316 | 0x0000061d,0x0000009e,0x00050095,0x0000005e, | ||
| 317 | 0x0000064e,0x00000630,0x0000064d,0x00050051, | ||
| 318 | 0x00000006,0x0000064f,0x0000064e,0x00000001, | ||
| 319 | 0x00050051,0x00000006,0x00000650,0x0000064e, | ||
| 320 | 0x00000000,0x00050080,0x00000006,0x00000655, | ||
| 321 | 0x00000638,0x0000064f,0x00050050,0x00000007, | ||
| 322 | 0x00000656,0x00000650,0x00000655,0x0004007c, | ||
| 323 | 0x000000b1,0x00000643,0x00000656,0x00060041, | ||
| 324 | 0x000000b7,0x00000644,0x00000643,0x000000b6, | ||
| 325 | 0x000000b6,0x0006003d,0x00000006,0x00000645, | ||
| 326 | 0x00000644,0x00000002,0x00000004,0x000500b0, | ||
| 327 | 0x00000012,0x0000065d,0x00000645,0x00000611, | ||
| 328 | 0x000400a8,0x00000012,0x0000065e,0x0000065d, | ||
| 329 | 0x000300f7,0x0000066d,0x00000000,0x000400fa, | ||
| 330 | 0x0000065e,0x0000065f,0x0000066d,0x000200f8, | ||
| 331 | 0x0000065f,0x000500aa,0x00000012,0x00000664, | ||
| 332 | 0x00000645,0x00000611,0x000300f7,0x0000066b, | ||
| 333 | 0x00000000,0x000400fa,0x00000664,0x00000665, | ||
| 334 | 0x0000066b,0x000200f8,0x00000665,0x000500b0, | ||
| 335 | 0x00000012,0x0000066a,0x0000062a,0x00000609, | ||
| 336 | 0x000200f9,0x0000066b,0x000200f8,0x0000066b, | ||
| 337 | 0x000700f5,0x00000012,0x0000066c,0x00000664, | ||
| 338 | 0x0000065f,0x0000066a,0x00000665,0x000200f9, | ||
| 339 | 0x0000066d,0x000200f8,0x0000066d,0x000700f5, | ||
| 340 | 0x00000012,0x0000066e,0x0000065d,0x000005de, | ||
| 341 | 0x0000066c,0x0000066b,0x000300f7,0x000005ee, | ||
| 342 | 0x00000000,0x000400fa,0x0000066e,0x000005e9, | ||
| 343 | 0x000005ec,0x000200f8,0x000005ec,0x000200f9, | ||
| 344 | 0x000005ee,0x000200f8,0x000005e9,0x00050080, | ||
| 345 | 0x00000006,0x000005eb,0x000005e2,0x00000063, | ||
| 346 | 0x000200f9,0x000005ee,0x000200f8,0x000005ee, | ||
| 347 | 0x000700f5,0x00000006,0x00002124,0x000005eb, | ||
| 348 | 0x000005e9,0x00001ce7,0x000005ec,0x000600a9, | ||
| 349 | 0x00000006,0x00002194,0x0000066e,0x00001ce8, | ||
| 350 | 0x000005e2,0x000200f9,0x000005ef,0x000200f8, | ||
| 351 | 0x000005ef,0x000200f9,0x000005d9,0x000200f8, | ||
| 352 | 0x000005f0,0x000500aa,0x00000012,0x000005f2, | ||
| 353 | 0x00001ce7,0x00000058,0x000300f7,0x000005f4, | ||
| 354 | 0x00000000,0x000400fa,0x000005f2,0x000005f3, | ||
| 355 | 0x000005f4,0x000200f8,0x000005f3,0x000200f9, | ||
| 356 | 0x000005fd,0x000200f8,0x000005f4,0x00050082, | ||
| 357 | 0x00000006,0x000005f6,0x00001ce7,0x00000063, | ||
| 358 | 0x00050084,0x00000006,0x000005f7,0x0000009e, | ||
| 359 | 0x000005f6,0x00050080,0x00000006,0x000005f8, | ||
| 360 | 0x000005f7,0x000000d8,0x00050051,0x00000006, | ||
| 361 | 0x0000068c,0x0000058d,0x00000000,0x00050084, | ||
| 362 | 0x00000006,0x0000068e,0x000005f8,0x0000009e, | ||
| 363 | 0x00050095,0x0000005e,0x0000068f,0x0000068c, | ||
| 364 | 0x0000068e,0x00050051,0x00000006,0x00000690, | ||
| 365 | 0x0000068f,0x00000001,0x00050051,0x00000006, | ||
| 366 | 0x00000691,0x0000068f,0x00000000,0x00050051, | ||
| 367 | 0x00000006,0x00000694,0x0000058d,0x00000001, | ||
| 368 | 0x00050080,0x00000006,0x00000696,0x00000694, | ||
| 369 | 0x00000690,0x00050050,0x00000007,0x00000697, | ||
| 370 | 0x00000691,0x00000696,0x0004007c,0x000000b1, | ||
| 371 | 0x00000684,0x00000697,0x00060041,0x000000b7, | ||
| 372 | 0x00000685,0x00000684,0x000000b6,0x000000b6, | ||
| 373 | 0x0006003d,0x00000006,0x00000686,0x00000685, | ||
| 374 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 375 | 0x00000679,0x000005f7,0x000000de,0x00050084, | ||
| 376 | 0x00000006,0x000006a9,0x00000679,0x0000009e, | ||
| 377 | 0x00050095,0x0000005e,0x000006aa,0x0000068c, | ||
| 378 | 0x000006a9,0x00050051,0x00000006,0x000006ab, | ||
| 379 | 0x000006aa,0x00000001,0x00050051,0x00000006, | ||
| 380 | 0x000006ac,0x000006aa,0x00000000,0x00050080, | ||
| 381 | 0x00000006,0x000006b1,0x00000694,0x000006ab, | ||
| 382 | 0x00050050,0x00000007,0x000006b2,0x000006ac, | ||
| 383 | 0x000006b1,0x0004007c,0x000000b1,0x0000069f, | ||
| 384 | 0x000006b2,0x00060041,0x000000b7,0x000006a0, | ||
| 385 | 0x0000069f,0x000000b6,0x000000b6,0x0006003d, | ||
| 386 | 0x00000006,0x000006a1,0x000006a0,0x00000002, | ||
| 387 | 0x00000004,0x000500b0,0x00000012,0x000006b9, | ||
| 388 | 0x00000583,0x000006a1,0x000400a8,0x00000012, | ||
| 389 | 0x000006ba,0x000006b9,0x000300f7,0x000006c9, | ||
| 390 | 0x00000000,0x000400fa,0x000006ba,0x000006bb, | ||
| 391 | 0x000006c9,0x000200f8,0x000006bb,0x000500aa, | ||
| 392 | 0x00000012,0x000006c0,0x00000583,0x000006a1, | ||
| 393 | 0x000300f7,0x000006c7,0x00000000,0x000400fa, | ||
| 394 | 0x000006c0,0x000006c1,0x000006c7,0x000200f8, | ||
| 395 | 0x000006c1,0x000500b0,0x00000012,0x000006c6, | ||
| 396 | 0x0000056f,0x00000686,0x000200f9,0x000006c7, | ||
| 397 | 0x000200f8,0x000006c7,0x000700f5,0x00000012, | ||
| 398 | 0x000006c8,0x000006c0,0x000006bb,0x000006c6, | ||
| 399 | 0x000006c1,0x000200f9,0x000006c9,0x000200f8, | ||
| 400 | 0x000006c9,0x000700f5,0x00000012,0x000006ca, | ||
| 401 | 0x000006b9,0x000005f4,0x000006c8,0x000006c7, | ||
| 402 | 0x000200f9,0x000005fd,0x000200f8,0x000005fd, | ||
| 403 | 0x000700f5,0x00000012,0x00001ce9,0x0000011e, | ||
| 404 | 0x000005f3,0x000006ca,0x000006c9,0x000200f9, | ||
| 405 | 0x00000592,0x000200f8,0x00000592,0x000700f5, | ||
| 406 | 0x00000012,0x00000593,0x0000058a,0x0000057e, | ||
| 407 | 0x00001ce9,0x000005fd,0x000300f7,0x00000595, | ||
| 408 | 0x00000000,0x000400fa,0x00000593,0x00000594, | ||
| 409 | 0x00000595,0x000200f8,0x00000594,0x000200f9, | ||
| 410 | 0x000005c0,0x000200f8,0x00000595,0x00050041, | ||
| 411 | 0x00000182,0x00000596,0x00000180,0x00000219, | ||
| 412 | 0x0004003d,0x00000006,0x00000597,0x00000596, | ||
| 413 | 0x000500aa,0x00000012,0x00000598,0x00000597, | ||
| 414 | 0x00000058,0x000300f7,0x0000059a,0x00000000, | ||
| 415 | 0x000400fa,0x00000598,0x00000599,0x0000059a, | ||
| 416 | 0x000200f8,0x00000599,0x000200f9,0x000005c0, | ||
| 417 | 0x000200f8,0x0000059a,0x00050050,0x00000007, | ||
| 418 | 0x000006d3,0x0000056f,0x00000583,0x000500c7, | ||
| 419 | 0x00000006,0x000006d6,0x00000438,0x00000063, | ||
| 420 | 0x000500ab,0x00000012,0x000006d7,0x000006d6, | ||
| 421 | 0x00000058,0x000300f7,0x000006dd,0x00000000, | ||
| 422 | 0x000400fa,0x000006d7,0x000006d8,0x000006dd, | ||
| 423 | 0x000200f8,0x000006d8,0x000500c7,0x00000006, | ||
| 424 | 0x000006db,0x00000582,0x0000018b,0x000500ab, | ||
| 425 | 0x00000012,0x000006dc,0x000006db,0x00000058, | ||
| 426 | 0x000200f9,0x000006dd,0x000200f8,0x000006dd, | ||
| 427 | 0x000700f5,0x00000012,0x000006de,0x000006d7, | ||
| 428 | 0x0000059a,0x000006dc,0x000006d8,0x000300f7, | ||
| 429 | 0x000006e4,0x00000000,0x000400fa,0x000006de, | ||
| 430 | 0x000006df,0x000006e4,0x000200f8,0x000006df, | ||
| 431 | 0x000500c5,0x00000006,0x000006e2,0x00000583, | ||
| 432 | 0x00000191,0x00060052,0x00000007,0x00001ab3, | ||
| 433 | 0x000006e2,0x000006d3,0x00000001,0x000200f9, | ||
| 434 | 0x000006e4,0x000200f8,0x000006e4,0x000700f5, | ||
| 435 | 0x00000007,0x00001ceb,0x000006d3,0x000006dd, | ||
| 436 | 0x00001ab3,0x000006df,0x00050041,0x0000020a, | ||
| 437 | 0x0000059d,0x00000180,0x00000220,0x0004003d, | ||
| 438 | 0x00000007,0x0000059e,0x0000059d,0x000300f7, | ||
| 439 | 0x00000721,0x00000000,0x000300fb,0x00000058, | ||
| 440 | 0x000006f8,0x000200f8,0x000006f8,0x00050051, | ||
| 441 | 0x00000006,0x00000728,0x00001ceb,0x00000000, | ||
| 442 | 0x00050095,0x0000005e,0x0000072b,0x00000728, | ||
| 443 | 0x00000586,0x00050051,0x00000006,0x0000072c, | ||
| 444 | 0x0000072b,0x00000001,0x00050051,0x00000006, | ||
| 445 | 0x0000072d,0x0000072b,0x00000000,0x00050051, | ||
| 446 | 0x00000006,0x00000730,0x00001ceb,0x00000001, | ||
| 447 | 0x00050080,0x00000006,0x00000735,0x00000730, | ||
| 448 | 0x0000072c,0x000200f9,0x000006fd,0x000200f8, | ||
| 449 | 0x000006fd,0x000700f5,0x00000006,0x00001ced, | ||
| 450 | 0x00000597,0x000006f8,0x00002195,0x00000713, | ||
| 451 | 0x000700f5,0x00000006,0x00001cec,0x00000058, | ||
| 452 | 0x000006f8,0x0000212a,0x00000713,0x000500b0, | ||
| 453 | 0x00000012,0x00000701,0x00001cec,0x00001ced, | ||
| 454 | 0x000400f6,0x00000714,0x00000713,0x00000000, | ||
| 455 | 0x000400fa,0x00000701,0x00000702,0x00000714, | ||
| 456 | 0x000200f8,0x00000702,0x00050080,0x00000006, | ||
| 457 | 0x00000705,0x00001cec,0x00001ced,0x000500c2, | ||
| 458 | 0x00000006,0x00000706,0x00000705,0x00000063, | ||
| 459 | 0x00050084,0x00000006,0x00000708,0x0000009e, | ||
| 460 | 0x00000706,0x00050051,0x00000006,0x00000754, | ||
| 461 | 0x0000059e,0x00000000,0x00050084,0x00000006, | ||
| 462 | 0x00000756,0x00000706,0x0000034a,0x00050095, | ||
| 463 | 0x0000005e,0x00000757,0x00000754,0x00000756, | ||
| 464 | 0x00050051,0x00000006,0x00000758,0x00000757, | ||
| 465 | 0x00000001,0x00050051,0x00000006,0x00000759, | ||
| 466 | 0x00000757,0x00000000,0x00050051,0x00000006, | ||
| 467 | 0x0000075c,0x0000059e,0x00000001,0x00050080, | ||
| 468 | 0x00000006,0x0000075e,0x0000075c,0x00000758, | ||
| 469 | 0x00050050,0x00000007,0x0000075f,0x00000759, | ||
| 470 | 0x0000075e,0x0004007c,0x000000b1,0x0000074c, | ||
| 471 | 0x0000075f,0x00060041,0x000000b7,0x0000074d, | ||
| 472 | 0x0000074c,0x000000b6,0x000000b6,0x0006003d, | ||
| 473 | 0x00000006,0x0000074e,0x0000074d,0x00000002, | ||
| 474 | 0x00000004,0x00050080,0x00000006,0x00000741, | ||
| 475 | 0x00000708,0x00000063,0x00050084,0x00000006, | ||
| 476 | 0x00000771,0x00000741,0x0000009e,0x00050095, | ||
| 477 | 0x0000005e,0x00000772,0x00000754,0x00000771, | ||
| 478 | 0x00050051,0x00000006,0x00000773,0x00000772, | ||
| 479 | 0x00000001,0x00050051,0x00000006,0x00000774, | ||
| 480 | 0x00000772,0x00000000,0x00050080,0x00000006, | ||
| 481 | 0x00000779,0x0000075c,0x00000773,0x00050050, | ||
| 482 | 0x00000007,0x0000077a,0x00000774,0x00000779, | ||
| 483 | 0x0004007c,0x000000b1,0x00000767,0x0000077a, | ||
| 484 | 0x00060041,0x000000b7,0x00000768,0x00000767, | ||
| 485 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 486 | 0x00000769,0x00000768,0x00000002,0x00000004, | ||
| 487 | 0x000500b0,0x00000012,0x00000781,0x00000769, | ||
| 488 | 0x00000735,0x000400a8,0x00000012,0x00000782, | ||
| 489 | 0x00000781,0x000300f7,0x00000791,0x00000000, | ||
| 490 | 0x000400fa,0x00000782,0x00000783,0x00000791, | ||
| 491 | 0x000200f8,0x00000783,0x000500aa,0x00000012, | ||
| 492 | 0x00000788,0x00000769,0x00000735,0x000300f7, | ||
| 493 | 0x0000078f,0x00000000,0x000400fa,0x00000788, | ||
| 494 | 0x00000789,0x0000078f,0x000200f8,0x00000789, | ||
| 495 | 0x000500b0,0x00000012,0x0000078e,0x0000074e, | ||
| 496 | 0x0000072d,0x000200f9,0x0000078f,0x000200f8, | ||
| 497 | 0x0000078f,0x000700f5,0x00000012,0x00000790, | ||
| 498 | 0x00000788,0x00000783,0x0000078e,0x00000789, | ||
| 499 | 0x000200f9,0x00000791,0x000200f8,0x00000791, | ||
| 500 | 0x000700f5,0x00000012,0x00000792,0x00000781, | ||
| 501 | 0x00000702,0x00000790,0x0000078f,0x000300f7, | ||
| 502 | 0x00000712,0x00000000,0x000400fa,0x00000792, | ||
| 503 | 0x0000070d,0x00000710,0x000200f8,0x00000710, | ||
| 504 | 0x000200f9,0x00000712,0x000200f8,0x0000070d, | ||
| 505 | 0x00050080,0x00000006,0x0000070f,0x00000706, | ||
| 506 | 0x00000063,0x000200f9,0x00000712,0x000200f8, | ||
| 507 | 0x00000712,0x000700f5,0x00000006,0x0000212a, | ||
| 508 | 0x0000070f,0x0000070d,0x00001cec,0x00000710, | ||
| 509 | 0x000600a9,0x00000006,0x00002195,0x00000792, | ||
| 510 | 0x00001ced,0x00000706,0x000200f9,0x00000713, | ||
| 511 | 0x000200f8,0x00000713,0x000200f9,0x000006fd, | ||
| 512 | 0x000200f8,0x00000714,0x000500aa,0x00000012, | ||
| 513 | 0x00000716,0x00001cec,0x00000058,0x000300f7, | ||
| 514 | 0x00000718,0x00000000,0x000400fa,0x00000716, | ||
| 515 | 0x00000717,0x00000718,0x000200f8,0x00000717, | ||
| 516 | 0x000200f9,0x00000721,0x000200f8,0x00000718, | ||
| 517 | 0x00050082,0x00000006,0x0000071a,0x00001cec, | ||
| 518 | 0x00000063,0x00050084,0x00000006,0x0000071b, | ||
| 519 | 0x0000009e,0x0000071a,0x00050080,0x00000006, | ||
| 520 | 0x0000071c,0x0000071b,0x000000d8,0x00050051, | ||
| 521 | 0x00000006,0x000007b0,0x0000059e,0x00000000, | ||
| 522 | 0x00050084,0x00000006,0x000007b2,0x0000071c, | ||
| 523 | 0x0000009e,0x00050095,0x0000005e,0x000007b3, | ||
| 524 | 0x000007b0,0x000007b2,0x00050051,0x00000006, | ||
| 525 | 0x000007b4,0x000007b3,0x00000001,0x00050051, | ||
| 526 | 0x00000006,0x000007b5,0x000007b3,0x00000000, | ||
| 527 | 0x00050051,0x00000006,0x000007b8,0x0000059e, | ||
| 528 | 0x00000001,0x00050080,0x00000006,0x000007ba, | ||
| 529 | 0x000007b8,0x000007b4,0x00050050,0x00000007, | ||
| 530 | 0x000007bb,0x000007b5,0x000007ba,0x0004007c, | ||
| 531 | 0x000000b1,0x000007a8,0x000007bb,0x00060041, | ||
| 532 | 0x000000b7,0x000007a9,0x000007a8,0x000000b6, | ||
| 533 | 0x000000b6,0x0006003d,0x00000006,0x000007aa, | ||
| 534 | 0x000007a9,0x00000002,0x00000004,0x00050080, | ||
| 535 | 0x00000006,0x0000079d,0x0000071b,0x000000de, | ||
| 536 | 0x00050084,0x00000006,0x000007cd,0x0000079d, | ||
| 537 | 0x0000009e,0x00050095,0x0000005e,0x000007ce, | ||
| 538 | 0x000007b0,0x000007cd,0x00050051,0x00000006, | ||
| 539 | 0x000007cf,0x000007ce,0x00000001,0x00050051, | ||
| 540 | 0x00000006,0x000007d0,0x000007ce,0x00000000, | ||
| 541 | 0x00050080,0x00000006,0x000007d5,0x000007b8, | ||
| 542 | 0x000007cf,0x00050050,0x00000007,0x000007d6, | ||
| 543 | 0x000007d0,0x000007d5,0x0004007c,0x000000b1, | ||
| 544 | 0x000007c3,0x000007d6,0x00060041,0x000000b7, | ||
| 545 | 0x000007c4,0x000007c3,0x000000b6,0x000000b6, | ||
| 546 | 0x0006003d,0x00000006,0x000007c5,0x000007c4, | ||
| 547 | 0x00000002,0x00000004,0x000500b0,0x00000012, | ||
| 548 | 0x000007dd,0x00000730,0x000007c5,0x000400a8, | ||
| 549 | 0x00000012,0x000007de,0x000007dd,0x000300f7, | ||
| 550 | 0x000007ed,0x00000000,0x000400fa,0x000007de, | ||
| 551 | 0x000007df,0x000007ed,0x000200f8,0x000007df, | ||
| 552 | 0x000500aa,0x00000012,0x000007e4,0x00000730, | ||
| 553 | 0x000007c5,0x000300f7,0x000007eb,0x00000000, | ||
| 554 | 0x000400fa,0x000007e4,0x000007e5,0x000007eb, | ||
| 555 | 0x000200f8,0x000007e5,0x000500b0,0x00000012, | ||
| 556 | 0x000007ea,0x00000728,0x000007aa,0x000200f9, | ||
| 557 | 0x000007eb,0x000200f8,0x000007eb,0x000700f5, | ||
| 558 | 0x00000012,0x000007ec,0x000007e4,0x000007df, | ||
| 559 | 0x000007ea,0x000007e5,0x000200f9,0x000007ed, | ||
| 560 | 0x000200f8,0x000007ed,0x000700f5,0x00000012, | ||
| 561 | 0x000007ee,0x000007dd,0x00000718,0x000007ec, | ||
| 562 | 0x000007eb,0x000200f9,0x00000721,0x000200f8, | ||
| 563 | 0x00000721,0x000700f5,0x00000012,0x00001cee, | ||
| 564 | 0x0000011e,0x00000717,0x000007ee,0x000007ed, | ||
| 565 | 0x000300f7,0x000005a4,0x00000000,0x000400fa, | ||
| 566 | 0x00001cee,0x000005a3,0x000005a4,0x000200f8, | ||
| 567 | 0x000005a3,0x000200f9,0x000005c0,0x000200f8, | ||
| 568 | 0x000005a4,0x00050051,0x00000006,0x000005a6, | ||
| 569 | 0x00000476,0x00000002,0x000500c2,0x00000006, | ||
| 570 | 0x000005a9,0x00000582,0x000000e4,0x000500aa, | ||
| 571 | 0x00000012,0x000005ad,0x000005a6,0x00000058, | ||
| 572 | 0x000300f7,0x000005b2,0x00000000,0x000400fa, | ||
| 573 | 0x000005ad,0x000005ae,0x000005b2,0x000200f8, | ||
| 574 | 0x000005ae,0x000500aa,0x00000012,0x000005b1, | ||
| 575 | 0x000005a9,0x00000058,0x000200f9,0x000005b2, | ||
| 576 | 0x000200f8,0x000005b2,0x000700f5,0x00000012, | ||
| 577 | 0x000005b3,0x000005ad,0x000005a4,0x000005b1, | ||
| 578 | 0x000005ae,0x000400a8,0x00000012,0x000005b4, | ||
| 579 | 0x000005b3,0x000300f7,0x000005be,0x00000000, | ||
| 580 | 0x000400fa,0x000005b4,0x000005b5,0x000005be, | ||
| 581 | 0x000200f8,0x000005b5,0x000500c7,0x00000006, | ||
| 582 | 0x000007f6,0x000005a9,0x0000017b,0x00050050, | ||
| 583 | 0x00000007,0x000007f7,0x000005a6,0x000007f6, | ||
| 584 | 0x000300f7,0x00000801,0x00000000,0x000400fa, | ||
| 585 | 0x000006d7,0x000007fc,0x00000801,0x000200f8, | ||
| 586 | 0x000007fc,0x000500c7,0x00000006,0x000007ff, | ||
| 587 | 0x000005a9,0x0000018b,0x000500ab,0x00000012, | ||
| 588 | 0x00000800,0x000007ff,0x00000058,0x000200f9, | ||
| 589 | 0x00000801,0x000200f8,0x00000801,0x000700f5, | ||
| 590 | 0x00000012,0x00000802,0x000006d7,0x000005b5, | ||
| 591 | 0x00000800,0x000007fc,0x000300f7,0x00000808, | ||
| 592 | 0x00000000,0x000400fa,0x00000802,0x00000803, | ||
| 593 | 0x00000808,0x000200f8,0x00000803,0x000500c5, | ||
| 594 | 0x00000006,0x00000806,0x000007f6,0x00000191, | ||
| 595 | 0x00060052,0x00000007,0x00001ad5,0x00000806, | ||
| 596 | 0x000007f7,0x00000001,0x000200f9,0x00000808, | ||
| 597 | 0x000200f8,0x00000808,0x000700f5,0x00000007, | ||
| 598 | 0x00001cf0,0x000007f7,0x00000801,0x00001ad5, | ||
| 599 | 0x00000803,0x000300f7,0x00000845,0x00000000, | ||
| 600 | 0x000300fb,0x00000058,0x0000081c,0x000200f8, | ||
| 601 | 0x0000081c,0x00050051,0x00000006,0x0000084c, | ||
| 602 | 0x00001cf0,0x00000000,0x00050095,0x0000005e, | ||
| 603 | 0x0000084f,0x0000084c,0x00000586,0x00050051, | ||
| 604 | 0x00000006,0x00000850,0x0000084f,0x00000001, | ||
| 605 | 0x00050051,0x00000006,0x00000851,0x0000084f, | ||
| 606 | 0x00000000,0x00050051,0x00000006,0x00000854, | ||
| 607 | 0x00001cf0,0x00000001,0x00050080,0x00000006, | ||
| 608 | 0x00000859,0x00000854,0x00000850,0x000200f9, | ||
| 609 | 0x00000821,0x000200f8,0x00000821,0x000700f5, | ||
| 610 | 0x00000006,0x00001cf2,0x00000597,0x0000081c, | ||
| 611 | 0x00002196,0x00000837,0x000700f5,0x00000006, | ||
| 612 | 0x00001cf1,0x00000058,0x0000081c,0x00002130, | ||
| 613 | 0x00000837,0x000500b0,0x00000012,0x00000825, | ||
| 614 | 0x00001cf1,0x00001cf2,0x000400f6,0x00000838, | ||
| 615 | 0x00000837,0x00000000,0x000400fa,0x00000825, | ||
| 616 | 0x00000826,0x00000838,0x000200f8,0x00000826, | ||
| 617 | 0x00050080,0x00000006,0x00000829,0x00001cf1, | ||
| 618 | 0x00001cf2,0x000500c2,0x00000006,0x0000082a, | ||
| 619 | 0x00000829,0x00000063,0x00050084,0x00000006, | ||
| 620 | 0x0000082c,0x0000009e,0x0000082a,0x00050051, | ||
| 621 | 0x00000006,0x00000878,0x0000059e,0x00000000, | ||
| 622 | 0x00050084,0x00000006,0x0000087a,0x0000082a, | ||
| 623 | 0x0000034a,0x00050095,0x0000005e,0x0000087b, | ||
| 624 | 0x00000878,0x0000087a,0x00050051,0x00000006, | ||
| 625 | 0x0000087c,0x0000087b,0x00000001,0x00050051, | ||
| 626 | 0x00000006,0x0000087d,0x0000087b,0x00000000, | ||
| 627 | 0x00050051,0x00000006,0x00000880,0x0000059e, | ||
| 628 | 0x00000001,0x00050080,0x00000006,0x00000882, | ||
| 629 | 0x00000880,0x0000087c,0x00050050,0x00000007, | ||
| 630 | 0x00000883,0x0000087d,0x00000882,0x0004007c, | ||
| 631 | 0x000000b1,0x00000870,0x00000883,0x00060041, | ||
| 632 | 0x000000b7,0x00000871,0x00000870,0x000000b6, | ||
| 633 | 0x000000b6,0x0006003d,0x00000006,0x00000872, | ||
| 634 | 0x00000871,0x00000002,0x00000004,0x00050080, | ||
| 635 | 0x00000006,0x00000865,0x0000082c,0x00000063, | ||
| 636 | 0x00050084,0x00000006,0x00000895,0x00000865, | ||
| 637 | 0x0000009e,0x00050095,0x0000005e,0x00000896, | ||
| 638 | 0x00000878,0x00000895,0x00050051,0x00000006, | ||
| 639 | 0x00000897,0x00000896,0x00000001,0x00050051, | ||
| 640 | 0x00000006,0x00000898,0x00000896,0x00000000, | ||
| 641 | 0x00050080,0x00000006,0x0000089d,0x00000880, | ||
| 642 | 0x00000897,0x00050050,0x00000007,0x0000089e, | ||
| 643 | 0x00000898,0x0000089d,0x0004007c,0x000000b1, | ||
| 644 | 0x0000088b,0x0000089e,0x00060041,0x000000b7, | ||
| 645 | 0x0000088c,0x0000088b,0x000000b6,0x000000b6, | ||
| 646 | 0x0006003d,0x00000006,0x0000088d,0x0000088c, | ||
| 647 | 0x00000002,0x00000004,0x000500b0,0x00000012, | ||
| 648 | 0x000008a5,0x0000088d,0x00000859,0x000400a8, | ||
| 649 | 0x00000012,0x000008a6,0x000008a5,0x000300f7, | ||
| 650 | 0x000008b5,0x00000000,0x000400fa,0x000008a6, | ||
| 651 | 0x000008a7,0x000008b5,0x000200f8,0x000008a7, | ||
| 652 | 0x000500aa,0x00000012,0x000008ac,0x0000088d, | ||
| 653 | 0x00000859,0x000300f7,0x000008b3,0x00000000, | ||
| 654 | 0x000400fa,0x000008ac,0x000008ad,0x000008b3, | ||
| 655 | 0x000200f8,0x000008ad,0x000500b0,0x00000012, | ||
| 656 | 0x000008b2,0x00000872,0x00000851,0x000200f9, | ||
| 657 | 0x000008b3,0x000200f8,0x000008b3,0x000700f5, | ||
| 658 | 0x00000012,0x000008b4,0x000008ac,0x000008a7, | ||
| 659 | 0x000008b2,0x000008ad,0x000200f9,0x000008b5, | ||
| 660 | 0x000200f8,0x000008b5,0x000700f5,0x00000012, | ||
| 661 | 0x000008b6,0x000008a5,0x00000826,0x000008b4, | ||
| 662 | 0x000008b3,0x000300f7,0x00000836,0x00000000, | ||
| 663 | 0x000400fa,0x000008b6,0x00000831,0x00000834, | ||
| 664 | 0x000200f8,0x00000834,0x000200f9,0x00000836, | ||
| 665 | 0x000200f8,0x00000831,0x00050080,0x00000006, | ||
| 666 | 0x00000833,0x0000082a,0x00000063,0x000200f9, | ||
| 667 | 0x00000836,0x000200f8,0x00000836,0x000700f5, | ||
| 668 | 0x00000006,0x00002130,0x00000833,0x00000831, | ||
| 669 | 0x00001cf1,0x00000834,0x000600a9,0x00000006, | ||
| 670 | 0x00002196,0x000008b6,0x00001cf2,0x0000082a, | ||
| 671 | 0x000200f9,0x00000837,0x000200f8,0x00000837, | ||
| 672 | 0x000200f9,0x00000821,0x000200f8,0x00000838, | ||
| 673 | 0x000500aa,0x00000012,0x0000083a,0x00001cf1, | ||
| 674 | 0x00000058,0x000300f7,0x0000083c,0x00000000, | ||
| 675 | 0x000400fa,0x0000083a,0x0000083b,0x0000083c, | ||
| 676 | 0x000200f8,0x0000083b,0x000200f9,0x00000845, | ||
| 677 | 0x000200f8,0x0000083c,0x00050082,0x00000006, | ||
| 678 | 0x0000083e,0x00001cf1,0x00000063,0x00050084, | ||
| 679 | 0x00000006,0x0000083f,0x0000009e,0x0000083e, | ||
| 680 | 0x00050080,0x00000006,0x00000840,0x0000083f, | ||
| 681 | 0x000000d8,0x00050051,0x00000006,0x000008d4, | ||
| 682 | 0x0000059e,0x00000000,0x00050084,0x00000006, | ||
| 683 | 0x000008d6,0x00000840,0x0000009e,0x00050095, | ||
| 684 | 0x0000005e,0x000008d7,0x000008d4,0x000008d6, | ||
| 685 | 0x00050051,0x00000006,0x000008d8,0x000008d7, | ||
| 686 | 0x00000001,0x00050051,0x00000006,0x000008d9, | ||
| 687 | 0x000008d7,0x00000000,0x00050051,0x00000006, | ||
| 688 | 0x000008dc,0x0000059e,0x00000001,0x00050080, | ||
| 689 | 0x00000006,0x000008de,0x000008dc,0x000008d8, | ||
| 690 | 0x00050050,0x00000007,0x000008df,0x000008d9, | ||
| 691 | 0x000008de,0x0004007c,0x000000b1,0x000008cc, | ||
| 692 | 0x000008df,0x00060041,0x000000b7,0x000008cd, | ||
| 693 | 0x000008cc,0x000000b6,0x000000b6,0x0006003d, | ||
| 694 | 0x00000006,0x000008ce,0x000008cd,0x00000002, | ||
| 695 | 0x00000004,0x00050080,0x00000006,0x000008c1, | ||
| 696 | 0x0000083f,0x000000de,0x00050084,0x00000006, | ||
| 697 | 0x000008f1,0x000008c1,0x0000009e,0x00050095, | ||
| 698 | 0x0000005e,0x000008f2,0x000008d4,0x000008f1, | ||
| 699 | 0x00050051,0x00000006,0x000008f3,0x000008f2, | ||
| 700 | 0x00000001,0x00050051,0x00000006,0x000008f4, | ||
| 701 | 0x000008f2,0x00000000,0x00050080,0x00000006, | ||
| 702 | 0x000008f9,0x000008dc,0x000008f3,0x00050050, | ||
| 703 | 0x00000007,0x000008fa,0x000008f4,0x000008f9, | ||
| 704 | 0x0004007c,0x000000b1,0x000008e7,0x000008fa, | ||
| 705 | 0x00060041,0x000000b7,0x000008e8,0x000008e7, | ||
| 706 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 707 | 0x000008e9,0x000008e8,0x00000002,0x00000004, | ||
| 708 | 0x000500b0,0x00000012,0x00000901,0x00000854, | ||
| 709 | 0x000008e9,0x000400a8,0x00000012,0x00000902, | ||
| 710 | 0x00000901,0x000300f7,0x00000911,0x00000000, | ||
| 711 | 0x000400fa,0x00000902,0x00000903,0x00000911, | ||
| 712 | 0x000200f8,0x00000903,0x000500aa,0x00000012, | ||
| 713 | 0x00000908,0x00000854,0x000008e9,0x000300f7, | ||
| 714 | 0x0000090f,0x00000000,0x000400fa,0x00000908, | ||
| 715 | 0x00000909,0x0000090f,0x000200f8,0x00000909, | ||
| 716 | 0x000500b0,0x00000012,0x0000090e,0x0000084c, | ||
| 717 | 0x000008ce,0x000200f9,0x0000090f,0x000200f8, | ||
| 718 | 0x0000090f,0x000700f5,0x00000012,0x00000910, | ||
| 719 | 0x00000908,0x00000903,0x0000090e,0x00000909, | ||
| 720 | 0x000200f9,0x00000911,0x000200f8,0x00000911, | ||
| 721 | 0x000700f5,0x00000012,0x00000912,0x00000901, | ||
| 722 | 0x0000083c,0x00000910,0x0000090f,0x000200f9, | ||
| 723 | 0x00000845,0x000200f8,0x00000845,0x000700f5, | ||
| 724 | 0x00000012,0x00001cf3,0x0000011e,0x0000083b, | ||
| 725 | 0x00000912,0x00000911,0x000200f9,0x000005be, | ||
| 726 | 0x000200f8,0x000005be,0x000700f5,0x00000012, | ||
| 727 | 0x000005bf,0x000005b4,0x000005b2,0x00001cf3, | ||
| 728 | 0x00000845,0x000200f9,0x000005c0,0x000200f8, | ||
| 729 | 0x000005c0,0x000d00f5,0x00000012,0x00001cf4, | ||
| 730 | 0x0000011e,0x0000057d,0x00000217,0x00000594, | ||
| 731 | 0x0000011e,0x00000599,0x00000217,0x000005a3, | ||
| 732 | 0x000005bf,0x000005be,0x000400a8,0x00000012, | ||
| 733 | 0x00000478,0x00001cf4,0x000300f7,0x0000047a, | ||
| 734 | 0x00000000,0x000400fa,0x00000478,0x00000479, | ||
| 735 | 0x0000047a,0x000200f8,0x00000479,0x00050080, | ||
| 736 | 0x00000006,0x0000047e,0x00000472,0x00000063, | ||
| 737 | 0x00060041,0x00000474,0x00000480,0x0000046f, | ||
| 738 | 0x000000b6,0x0000047e,0x0006003d,0x00000027, | ||
| 739 | 0x00000481,0x00000480,0x00000002,0x00000010, | ||
| 740 | 0x000300f7,0x0000097b,0x00000000,0x000300fb, | ||
| 741 | 0x00000058,0x00000928,0x000200f8,0x00000928, | ||
| 742 | 0x00050051,0x00000006,0x0000092a,0x00000481, | ||
| 743 | 0x00000000,0x000500aa,0x00000012,0x0000092b, | ||
| 744 | 0x0000092a,0x00000058,0x000300f7,0x00000930, | ||
| 745 | 0x00000000,0x000400fa,0x0000092b,0x0000092c, | ||
| 746 | 0x00000930,0x000200f8,0x0000092c,0x00050051, | ||
| 747 | 0x00000006,0x0000092e,0x00000481,0x00000001, | ||
| 748 | 0x000500aa,0x00000012,0x0000092f,0x0000092e, | ||
| 749 | 0x00000058,0x000200f9,0x00000930,0x000200f8, | ||
| 750 | 0x00000930,0x000700f5,0x00000012,0x00000931, | ||
| 751 | 0x0000092b,0x00000928,0x0000092f,0x0000092c, | ||
| 752 | 0x000300f7,0x00000936,0x00000000,0x000400fa, | ||
| 753 | 0x00000931,0x00000932,0x00000936,0x000200f8, | ||
| 754 | 0x00000932,0x00050051,0x00000006,0x00000934, | ||
| 755 | 0x00000481,0x00000002,0x000500aa,0x00000012, | ||
| 756 | 0x00000935,0x00000934,0x00000058,0x000200f9, | ||
| 757 | 0x00000936,0x000200f8,0x00000936,0x000700f5, | ||
| 758 | 0x00000012,0x00000937,0x00000931,0x00000930, | ||
| 759 | 0x00000935,0x00000932,0x000300f7,0x00000939, | ||
| 760 | 0x00000000,0x000400fa,0x00000937,0x00000938, | ||
| 761 | 0x00000939,0x000200f8,0x00000938,0x000200f9, | ||
| 762 | 0x0000097b,0x000200f8,0x00000939,0x00050051, | ||
| 763 | 0x00000006,0x0000093d,0x00000481,0x00000001, | ||
| 764 | 0x000500c7,0x00000006,0x0000093e,0x0000093d, | ||
| 765 | 0x0000017b,0x00050051,0x00000006,0x00000941, | ||
| 766 | 0x00000481,0x00000003,0x00050041,0x00000182, | ||
| 767 | 0x00000943,0x00000180,0x00000201,0x0004003d, | ||
| 768 | 0x00000006,0x00000944,0x00000943,0x000500ab, | ||
| 769 | 0x00000012,0x00000945,0x00000944,0x00000058, | ||
| 770 | 0x000300f7,0x0000094d,0x00000000,0x000400fa, | ||
| 771 | 0x00000945,0x00000946,0x0000094d,0x000200f8, | ||
| 772 | 0x00000946,0x00050041,0x0000020a,0x00000947, | ||
| 773 | 0x00000180,0x00000207,0x0004003d,0x00000007, | ||
| 774 | 0x00000948,0x00000947,0x000300f7,0x000009b8, | ||
| 775 | 0x00000000,0x000300fb,0x00000058,0x0000098f, | ||
| 776 | 0x000200f8,0x0000098f,0x00050095,0x0000005e, | ||
| 777 | 0x000009c2,0x0000092a,0x00000063,0x00050051, | ||
| 778 | 0x00000006,0x000009c3,0x000009c2,0x00000001, | ||
| 779 | 0x00050051,0x00000006,0x000009c4,0x000009c2, | ||
| 780 | 0x00000000,0x00050080,0x00000006,0x000009cc, | ||
| 781 | 0x0000093e,0x000009c3,0x000200f9,0x00000994, | ||
| 782 | 0x000200f8,0x00000994,0x000700f5,0x00000006, | ||
| 783 | 0x00001cf6,0x00000944,0x0000098f,0x00002197, | ||
| 784 | 0x000009aa,0x000700f5,0x00000006,0x00001cf5, | ||
| 785 | 0x00000058,0x0000098f,0x00002136,0x000009aa, | ||
| 786 | 0x000500b0,0x00000012,0x00000998,0x00001cf5, | ||
| 787 | 0x00001cf6,0x000400f6,0x000009ab,0x000009aa, | ||
| 788 | 0x00000000,0x000400fa,0x00000998,0x00000999, | ||
| 789 | 0x000009ab,0x000200f8,0x00000999,0x00050080, | ||
| 790 | 0x00000006,0x0000099c,0x00001cf5,0x00001cf6, | ||
| 791 | 0x000500c2,0x00000006,0x0000099d,0x0000099c, | ||
| 792 | 0x00000063,0x00050084,0x00000006,0x0000099f, | ||
| 793 | 0x0000009e,0x0000099d,0x00050051,0x00000006, | ||
| 794 | 0x000009eb,0x00000948,0x00000000,0x00050084, | ||
| 795 | 0x00000006,0x000009ed,0x0000099d,0x0000034a, | ||
| 796 | 0x00050095,0x0000005e,0x000009ee,0x000009eb, | ||
| 797 | 0x000009ed,0x00050051,0x00000006,0x000009ef, | ||
| 798 | 0x000009ee,0x00000001,0x00050051,0x00000006, | ||
| 799 | 0x000009f0,0x000009ee,0x00000000,0x00050051, | ||
| 800 | 0x00000006,0x000009f3,0x00000948,0x00000001, | ||
| 801 | 0x00050080,0x00000006,0x000009f5,0x000009f3, | ||
| 802 | 0x000009ef,0x00050050,0x00000007,0x000009f6, | ||
| 803 | 0x000009f0,0x000009f5,0x0004007c,0x000000b1, | ||
| 804 | 0x000009e3,0x000009f6,0x00060041,0x000000b7, | ||
| 805 | 0x000009e4,0x000009e3,0x000000b6,0x000000b6, | ||
| 806 | 0x0006003d,0x00000006,0x000009e5,0x000009e4, | ||
| 807 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 808 | 0x000009d8,0x0000099f,0x00000063,0x00050084, | ||
| 809 | 0x00000006,0x00000a08,0x000009d8,0x0000009e, | ||
| 810 | 0x00050095,0x0000005e,0x00000a09,0x000009eb, | ||
| 811 | 0x00000a08,0x00050051,0x00000006,0x00000a0a, | ||
| 812 | 0x00000a09,0x00000001,0x00050051,0x00000006, | ||
| 813 | 0x00000a0b,0x00000a09,0x00000000,0x00050080, | ||
| 814 | 0x00000006,0x00000a10,0x000009f3,0x00000a0a, | ||
| 815 | 0x00050050,0x00000007,0x00000a11,0x00000a0b, | ||
| 816 | 0x00000a10,0x0004007c,0x000000b1,0x000009fe, | ||
| 817 | 0x00000a11,0x00060041,0x000000b7,0x000009ff, | ||
| 818 | 0x000009fe,0x000000b6,0x000000b6,0x0006003d, | ||
| 819 | 0x00000006,0x00000a00,0x000009ff,0x00000002, | ||
| 820 | 0x00000004,0x000500b0,0x00000012,0x00000a18, | ||
| 821 | 0x00000a00,0x000009cc,0x000400a8,0x00000012, | ||
| 822 | 0x00000a19,0x00000a18,0x000300f7,0x00000a28, | ||
| 823 | 0x00000000,0x000400fa,0x00000a19,0x00000a1a, | ||
| 824 | 0x00000a28,0x000200f8,0x00000a1a,0x000500aa, | ||
| 825 | 0x00000012,0x00000a1f,0x00000a00,0x000009cc, | ||
| 826 | 0x000300f7,0x00000a26,0x00000000,0x000400fa, | ||
| 827 | 0x00000a1f,0x00000a20,0x00000a26,0x000200f8, | ||
| 828 | 0x00000a20,0x000500b0,0x00000012,0x00000a25, | ||
| 829 | 0x000009e5,0x000009c4,0x000200f9,0x00000a26, | ||
| 830 | 0x000200f8,0x00000a26,0x000700f5,0x00000012, | ||
| 831 | 0x00000a27,0x00000a1f,0x00000a1a,0x00000a25, | ||
| 832 | 0x00000a20,0x000200f9,0x00000a28,0x000200f8, | ||
| 833 | 0x00000a28,0x000700f5,0x00000012,0x00000a29, | ||
| 834 | 0x00000a18,0x00000999,0x00000a27,0x00000a26, | ||
| 835 | 0x000300f7,0x000009a9,0x00000000,0x000400fa, | ||
| 836 | 0x00000a29,0x000009a4,0x000009a7,0x000200f8, | ||
| 837 | 0x000009a7,0x000200f9,0x000009a9,0x000200f8, | ||
| 838 | 0x000009a4,0x00050080,0x00000006,0x000009a6, | ||
| 839 | 0x0000099d,0x00000063,0x000200f9,0x000009a9, | ||
| 840 | 0x000200f8,0x000009a9,0x000700f5,0x00000006, | ||
| 841 | 0x00002136,0x000009a6,0x000009a4,0x00001cf5, | ||
| 842 | 0x000009a7,0x000600a9,0x00000006,0x00002197, | ||
| 843 | 0x00000a29,0x00001cf6,0x0000099d,0x000200f9, | ||
| 844 | 0x000009aa,0x000200f8,0x000009aa,0x000200f9, | ||
| 845 | 0x00000994,0x000200f8,0x000009ab,0x000500aa, | ||
| 846 | 0x00000012,0x000009ad,0x00001cf5,0x00000058, | ||
| 847 | 0x000300f7,0x000009af,0x00000000,0x000400fa, | ||
| 848 | 0x000009ad,0x000009ae,0x000009af,0x000200f8, | ||
| 849 | 0x000009ae,0x000200f9,0x000009b8,0x000200f8, | ||
| 850 | 0x000009af,0x00050082,0x00000006,0x000009b1, | ||
| 851 | 0x00001cf5,0x00000063,0x00050084,0x00000006, | ||
| 852 | 0x000009b2,0x0000009e,0x000009b1,0x00050080, | ||
| 853 | 0x00000006,0x000009b3,0x000009b2,0x000000d8, | ||
| 854 | 0x00050051,0x00000006,0x00000a47,0x00000948, | ||
| 855 | 0x00000000,0x00050084,0x00000006,0x00000a49, | ||
| 856 | 0x000009b3,0x0000009e,0x00050095,0x0000005e, | ||
| 857 | 0x00000a4a,0x00000a47,0x00000a49,0x00050051, | ||
| 858 | 0x00000006,0x00000a4b,0x00000a4a,0x00000001, | ||
| 859 | 0x00050051,0x00000006,0x00000a4c,0x00000a4a, | ||
| 860 | 0x00000000,0x00050051,0x00000006,0x00000a4f, | ||
| 861 | 0x00000948,0x00000001,0x00050080,0x00000006, | ||
| 862 | 0x00000a51,0x00000a4f,0x00000a4b,0x00050050, | ||
| 863 | 0x00000007,0x00000a52,0x00000a4c,0x00000a51, | ||
| 864 | 0x0004007c,0x000000b1,0x00000a3f,0x00000a52, | ||
| 865 | 0x00060041,0x000000b7,0x00000a40,0x00000a3f, | ||
| 866 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 867 | 0x00000a41,0x00000a40,0x00000002,0x00000004, | ||
| 868 | 0x00050080,0x00000006,0x00000a34,0x000009b2, | ||
| 869 | 0x000000de,0x00050084,0x00000006,0x00000a64, | ||
| 870 | 0x00000a34,0x0000009e,0x00050095,0x0000005e, | ||
| 871 | 0x00000a65,0x00000a47,0x00000a64,0x00050051, | ||
| 872 | 0x00000006,0x00000a66,0x00000a65,0x00000001, | ||
| 873 | 0x00050051,0x00000006,0x00000a67,0x00000a65, | ||
| 874 | 0x00000000,0x00050080,0x00000006,0x00000a6c, | ||
| 875 | 0x00000a4f,0x00000a66,0x00050050,0x00000007, | ||
| 876 | 0x00000a6d,0x00000a67,0x00000a6c,0x0004007c, | ||
| 877 | 0x000000b1,0x00000a5a,0x00000a6d,0x00060041, | ||
| 878 | 0x000000b7,0x00000a5b,0x00000a5a,0x000000b6, | ||
| 879 | 0x000000b6,0x0006003d,0x00000006,0x00000a5c, | ||
| 880 | 0x00000a5b,0x00000002,0x00000004,0x000500b0, | ||
| 881 | 0x00000012,0x00000a74,0x0000093e,0x00000a5c, | ||
| 882 | 0x000400a8,0x00000012,0x00000a75,0x00000a74, | ||
| 883 | 0x000300f7,0x00000a84,0x00000000,0x000400fa, | ||
| 884 | 0x00000a75,0x00000a76,0x00000a84,0x000200f8, | ||
| 885 | 0x00000a76,0x000500aa,0x00000012,0x00000a7b, | ||
| 886 | 0x0000093e,0x00000a5c,0x000300f7,0x00000a82, | ||
| 887 | 0x00000000,0x000400fa,0x00000a7b,0x00000a7c, | ||
| 888 | 0x00000a82,0x000200f8,0x00000a7c,0x000500b0, | ||
| 889 | 0x00000012,0x00000a81,0x0000092a,0x00000a41, | ||
| 890 | 0x000200f9,0x00000a82,0x000200f8,0x00000a82, | ||
| 891 | 0x000700f5,0x00000012,0x00000a83,0x00000a7b, | ||
| 892 | 0x00000a76,0x00000a81,0x00000a7c,0x000200f9, | ||
| 893 | 0x00000a84,0x000200f8,0x00000a84,0x000700f5, | ||
| 894 | 0x00000012,0x00000a85,0x00000a74,0x000009af, | ||
| 895 | 0x00000a83,0x00000a82,0x000200f9,0x000009b8, | ||
| 896 | 0x000200f8,0x000009b8,0x000700f5,0x00000012, | ||
| 897 | 0x00001cf7,0x0000011e,0x000009ae,0x00000a85, | ||
| 898 | 0x00000a84,0x000200f9,0x0000094d,0x000200f8, | ||
| 899 | 0x0000094d,0x000700f5,0x00000012,0x0000094e, | ||
| 900 | 0x00000945,0x00000939,0x00001cf7,0x000009b8, | ||
| 901 | 0x000300f7,0x00000950,0x00000000,0x000400fa, | ||
| 902 | 0x0000094e,0x0000094f,0x00000950,0x000200f8, | ||
| 903 | 0x0000094f,0x000200f9,0x0000097b,0x000200f8, | ||
| 904 | 0x00000950,0x00050041,0x00000182,0x00000951, | ||
| 905 | 0x00000180,0x00000219,0x0004003d,0x00000006, | ||
| 906 | 0x00000952,0x00000951,0x000500aa,0x00000012, | ||
| 907 | 0x00000953,0x00000952,0x00000058,0x000300f7, | ||
| 908 | 0x00000955,0x00000000,0x000400fa,0x00000953, | ||
| 909 | 0x00000954,0x00000955,0x000200f8,0x00000954, | ||
| 910 | 0x000200f9,0x0000097b,0x000200f8,0x00000955, | ||
| 911 | 0x00050050,0x00000007,0x00000a8e,0x0000092a, | ||
| 912 | 0x0000093e,0x000500c7,0x00000006,0x00000a91, | ||
| 913 | 0x00000438,0x00000063,0x000500ab,0x00000012, | ||
| 914 | 0x00000a92,0x00000a91,0x00000058,0x000300f7, | ||
| 915 | 0x00000a98,0x00000000,0x000400fa,0x00000a92, | ||
| 916 | 0x00000a93,0x00000a98,0x000200f8,0x00000a93, | ||
| 917 | 0x000500c7,0x00000006,0x00000a96,0x0000093d, | ||
| 918 | 0x0000018b,0x000500ab,0x00000012,0x00000a97, | ||
| 919 | 0x00000a96,0x00000058,0x000200f9,0x00000a98, | ||
| 920 | 0x000200f8,0x00000a98,0x000700f5,0x00000012, | ||
| 921 | 0x00000a99,0x00000a92,0x00000955,0x00000a97, | ||
| 922 | 0x00000a93,0x000300f7,0x00000a9f,0x00000000, | ||
| 923 | 0x000400fa,0x00000a99,0x00000a9a,0x00000a9f, | ||
| 924 | 0x000200f8,0x00000a9a,0x000500c5,0x00000006, | ||
| 925 | 0x00000a9d,0x0000093e,0x00000191,0x00060052, | ||
| 926 | 0x00000007,0x00001b11,0x00000a9d,0x00000a8e, | ||
| 927 | 0x00000001,0x000200f9,0x00000a9f,0x000200f8, | ||
| 928 | 0x00000a9f,0x000700f5,0x00000007,0x00001cf9, | ||
| 929 | 0x00000a8e,0x00000a98,0x00001b11,0x00000a9a, | ||
| 930 | 0x00050041,0x0000020a,0x00000958,0x00000180, | ||
| 931 | 0x00000220,0x0004003d,0x00000007,0x00000959, | ||
| 932 | 0x00000958,0x000300f7,0x00000adc,0x00000000, | ||
| 933 | 0x000300fb,0x00000058,0x00000ab3,0x000200f8, | ||
| 934 | 0x00000ab3,0x00050051,0x00000006,0x00000ae3, | ||
| 935 | 0x00001cf9,0x00000000,0x00050095,0x0000005e, | ||
| 936 | 0x00000ae6,0x00000ae3,0x00000941,0x00050051, | ||
| 937 | 0x00000006,0x00000ae7,0x00000ae6,0x00000001, | ||
| 938 | 0x00050051,0x00000006,0x00000ae8,0x00000ae6, | ||
| 939 | 0x00000000,0x00050051,0x00000006,0x00000aeb, | ||
| 940 | 0x00001cf9,0x00000001,0x00050080,0x00000006, | ||
| 941 | 0x00000af0,0x00000aeb,0x00000ae7,0x000200f9, | ||
| 942 | 0x00000ab8,0x000200f8,0x00000ab8,0x000700f5, | ||
| 943 | 0x00000006,0x00001cfb,0x00000952,0x00000ab3, | ||
| 944 | 0x00002198,0x00000ace,0x000700f5,0x00000006, | ||
| 945 | 0x00001cfa,0x00000058,0x00000ab3,0x0000213c, | ||
| 946 | 0x00000ace,0x000500b0,0x00000012,0x00000abc, | ||
| 947 | 0x00001cfa,0x00001cfb,0x000400f6,0x00000acf, | ||
| 948 | 0x00000ace,0x00000000,0x000400fa,0x00000abc, | ||
| 949 | 0x00000abd,0x00000acf,0x000200f8,0x00000abd, | ||
| 950 | 0x00050080,0x00000006,0x00000ac0,0x00001cfa, | ||
| 951 | 0x00001cfb,0x000500c2,0x00000006,0x00000ac1, | ||
| 952 | 0x00000ac0,0x00000063,0x00050084,0x00000006, | ||
| 953 | 0x00000ac3,0x0000009e,0x00000ac1,0x00050051, | ||
| 954 | 0x00000006,0x00000b0f,0x00000959,0x00000000, | ||
| 955 | 0x00050084,0x00000006,0x00000b11,0x00000ac1, | ||
| 956 | 0x0000034a,0x00050095,0x0000005e,0x00000b12, | ||
| 957 | 0x00000b0f,0x00000b11,0x00050051,0x00000006, | ||
| 958 | 0x00000b13,0x00000b12,0x00000001,0x00050051, | ||
| 959 | 0x00000006,0x00000b14,0x00000b12,0x00000000, | ||
| 960 | 0x00050051,0x00000006,0x00000b17,0x00000959, | ||
| 961 | 0x00000001,0x00050080,0x00000006,0x00000b19, | ||
| 962 | 0x00000b17,0x00000b13,0x00050050,0x00000007, | ||
| 963 | 0x00000b1a,0x00000b14,0x00000b19,0x0004007c, | ||
| 964 | 0x000000b1,0x00000b07,0x00000b1a,0x00060041, | ||
| 965 | 0x000000b7,0x00000b08,0x00000b07,0x000000b6, | ||
| 966 | 0x000000b6,0x0006003d,0x00000006,0x00000b09, | ||
| 967 | 0x00000b08,0x00000002,0x00000004,0x00050080, | ||
| 968 | 0x00000006,0x00000afc,0x00000ac3,0x00000063, | ||
| 969 | 0x00050084,0x00000006,0x00000b2c,0x00000afc, | ||
| 970 | 0x0000009e,0x00050095,0x0000005e,0x00000b2d, | ||
| 971 | 0x00000b0f,0x00000b2c,0x00050051,0x00000006, | ||
| 972 | 0x00000b2e,0x00000b2d,0x00000001,0x00050051, | ||
| 973 | 0x00000006,0x00000b2f,0x00000b2d,0x00000000, | ||
| 974 | 0x00050080,0x00000006,0x00000b34,0x00000b17, | ||
| 975 | 0x00000b2e,0x00050050,0x00000007,0x00000b35, | ||
| 976 | 0x00000b2f,0x00000b34,0x0004007c,0x000000b1, | ||
| 977 | 0x00000b22,0x00000b35,0x00060041,0x000000b7, | ||
| 978 | 0x00000b23,0x00000b22,0x000000b6,0x000000b6, | ||
| 979 | 0x0006003d,0x00000006,0x00000b24,0x00000b23, | ||
| 980 | 0x00000002,0x00000004,0x000500b0,0x00000012, | ||
| 981 | 0x00000b3c,0x00000b24,0x00000af0,0x000400a8, | ||
| 982 | 0x00000012,0x00000b3d,0x00000b3c,0x000300f7, | ||
| 983 | 0x00000b4c,0x00000000,0x000400fa,0x00000b3d, | ||
| 984 | 0x00000b3e,0x00000b4c,0x000200f8,0x00000b3e, | ||
| 985 | 0x000500aa,0x00000012,0x00000b43,0x00000b24, | ||
| 986 | 0x00000af0,0x000300f7,0x00000b4a,0x00000000, | ||
| 987 | 0x000400fa,0x00000b43,0x00000b44,0x00000b4a, | ||
| 988 | 0x000200f8,0x00000b44,0x000500b0,0x00000012, | ||
| 989 | 0x00000b49,0x00000b09,0x00000ae8,0x000200f9, | ||
| 990 | 0x00000b4a,0x000200f8,0x00000b4a,0x000700f5, | ||
| 991 | 0x00000012,0x00000b4b,0x00000b43,0x00000b3e, | ||
| 992 | 0x00000b49,0x00000b44,0x000200f9,0x00000b4c, | ||
| 993 | 0x000200f8,0x00000b4c,0x000700f5,0x00000012, | ||
| 994 | 0x00000b4d,0x00000b3c,0x00000abd,0x00000b4b, | ||
| 995 | 0x00000b4a,0x000300f7,0x00000acd,0x00000000, | ||
| 996 | 0x000400fa,0x00000b4d,0x00000ac8,0x00000acb, | ||
| 997 | 0x000200f8,0x00000acb,0x000200f9,0x00000acd, | ||
| 998 | 0x000200f8,0x00000ac8,0x00050080,0x00000006, | ||
| 999 | 0x00000aca,0x00000ac1,0x00000063,0x000200f9, | ||
| 1000 | 0x00000acd,0x000200f8,0x00000acd,0x000700f5, | ||
| 1001 | 0x00000006,0x0000213c,0x00000aca,0x00000ac8, | ||
| 1002 | 0x00001cfa,0x00000acb,0x000600a9,0x00000006, | ||
| 1003 | 0x00002198,0x00000b4d,0x00001cfb,0x00000ac1, | ||
| 1004 | 0x000200f9,0x00000ace,0x000200f8,0x00000ace, | ||
| 1005 | 0x000200f9,0x00000ab8,0x000200f8,0x00000acf, | ||
| 1006 | 0x000500aa,0x00000012,0x00000ad1,0x00001cfa, | ||
| 1007 | 0x00000058,0x000300f7,0x00000ad3,0x00000000, | ||
| 1008 | 0x000400fa,0x00000ad1,0x00000ad2,0x00000ad3, | ||
| 1009 | 0x000200f8,0x00000ad2,0x000200f9,0x00000adc, | ||
| 1010 | 0x000200f8,0x00000ad3,0x00050082,0x00000006, | ||
| 1011 | 0x00000ad5,0x00001cfa,0x00000063,0x00050084, | ||
| 1012 | 0x00000006,0x00000ad6,0x0000009e,0x00000ad5, | ||
| 1013 | 0x00050080,0x00000006,0x00000ad7,0x00000ad6, | ||
| 1014 | 0x000000d8,0x00050051,0x00000006,0x00000b6b, | ||
| 1015 | 0x00000959,0x00000000,0x00050084,0x00000006, | ||
| 1016 | 0x00000b6d,0x00000ad7,0x0000009e,0x00050095, | ||
| 1017 | 0x0000005e,0x00000b6e,0x00000b6b,0x00000b6d, | ||
| 1018 | 0x00050051,0x00000006,0x00000b6f,0x00000b6e, | ||
| 1019 | 0x00000001,0x00050051,0x00000006,0x00000b70, | ||
| 1020 | 0x00000b6e,0x00000000,0x00050051,0x00000006, | ||
| 1021 | 0x00000b73,0x00000959,0x00000001,0x00050080, | ||
| 1022 | 0x00000006,0x00000b75,0x00000b73,0x00000b6f, | ||
| 1023 | 0x00050050,0x00000007,0x00000b76,0x00000b70, | ||
| 1024 | 0x00000b75,0x0004007c,0x000000b1,0x00000b63, | ||
| 1025 | 0x00000b76,0x00060041,0x000000b7,0x00000b64, | ||
| 1026 | 0x00000b63,0x000000b6,0x000000b6,0x0006003d, | ||
| 1027 | 0x00000006,0x00000b65,0x00000b64,0x00000002, | ||
| 1028 | 0x00000004,0x00050080,0x00000006,0x00000b58, | ||
| 1029 | 0x00000ad6,0x000000de,0x00050084,0x00000006, | ||
| 1030 | 0x00000b88,0x00000b58,0x0000009e,0x00050095, | ||
| 1031 | 0x0000005e,0x00000b89,0x00000b6b,0x00000b88, | ||
| 1032 | 0x00050051,0x00000006,0x00000b8a,0x00000b89, | ||
| 1033 | 0x00000001,0x00050051,0x00000006,0x00000b8b, | ||
| 1034 | 0x00000b89,0x00000000,0x00050080,0x00000006, | ||
| 1035 | 0x00000b90,0x00000b73,0x00000b8a,0x00050050, | ||
| 1036 | 0x00000007,0x00000b91,0x00000b8b,0x00000b90, | ||
| 1037 | 0x0004007c,0x000000b1,0x00000b7e,0x00000b91, | ||
| 1038 | 0x00060041,0x000000b7,0x00000b7f,0x00000b7e, | ||
| 1039 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 1040 | 0x00000b80,0x00000b7f,0x00000002,0x00000004, | ||
| 1041 | 0x000500b0,0x00000012,0x00000b98,0x00000aeb, | ||
| 1042 | 0x00000b80,0x000400a8,0x00000012,0x00000b99, | ||
| 1043 | 0x00000b98,0x000300f7,0x00000ba8,0x00000000, | ||
| 1044 | 0x000400fa,0x00000b99,0x00000b9a,0x00000ba8, | ||
| 1045 | 0x000200f8,0x00000b9a,0x000500aa,0x00000012, | ||
| 1046 | 0x00000b9f,0x00000aeb,0x00000b80,0x000300f7, | ||
| 1047 | 0x00000ba6,0x00000000,0x000400fa,0x00000b9f, | ||
| 1048 | 0x00000ba0,0x00000ba6,0x000200f8,0x00000ba0, | ||
| 1049 | 0x000500b0,0x00000012,0x00000ba5,0x00000ae3, | ||
| 1050 | 0x00000b65,0x000200f9,0x00000ba6,0x000200f8, | ||
| 1051 | 0x00000ba6,0x000700f5,0x00000012,0x00000ba7, | ||
| 1052 | 0x00000b9f,0x00000b9a,0x00000ba5,0x00000ba0, | ||
| 1053 | 0x000200f9,0x00000ba8,0x000200f8,0x00000ba8, | ||
| 1054 | 0x000700f5,0x00000012,0x00000ba9,0x00000b98, | ||
| 1055 | 0x00000ad3,0x00000ba7,0x00000ba6,0x000200f9, | ||
| 1056 | 0x00000adc,0x000200f8,0x00000adc,0x000700f5, | ||
| 1057 | 0x00000012,0x00001cfc,0x0000011e,0x00000ad2, | ||
| 1058 | 0x00000ba9,0x00000ba8,0x000300f7,0x0000095f, | ||
| 1059 | 0x00000000,0x000400fa,0x00001cfc,0x0000095e, | ||
| 1060 | 0x0000095f,0x000200f8,0x0000095e,0x000200f9, | ||
| 1061 | 0x0000097b,0x000200f8,0x0000095f,0x00050051, | ||
| 1062 | 0x00000006,0x00000961,0x00000481,0x00000002, | ||
| 1063 | 0x000500c2,0x00000006,0x00000964,0x0000093d, | ||
| 1064 | 0x000000e4,0x000500aa,0x00000012,0x00000968, | ||
| 1065 | 0x00000961,0x00000058,0x000300f7,0x0000096d, | ||
| 1066 | 0x00000000,0x000400fa,0x00000968,0x00000969, | ||
| 1067 | 0x0000096d,0x000200f8,0x00000969,0x000500aa, | ||
| 1068 | 0x00000012,0x0000096c,0x00000964,0x00000058, | ||
| 1069 | 0x000200f9,0x0000096d,0x000200f8,0x0000096d, | ||
| 1070 | 0x000700f5,0x00000012,0x0000096e,0x00000968, | ||
| 1071 | 0x0000095f,0x0000096c,0x00000969,0x000400a8, | ||
| 1072 | 0x00000012,0x0000096f,0x0000096e,0x000300f7, | ||
| 1073 | 0x00000979,0x00000000,0x000400fa,0x0000096f, | ||
| 1074 | 0x00000970,0x00000979,0x000200f8,0x00000970, | ||
| 1075 | 0x000500c7,0x00000006,0x00000bb1,0x00000964, | ||
| 1076 | 0x0000017b,0x00050050,0x00000007,0x00000bb2, | ||
| 1077 | 0x00000961,0x00000bb1,0x000300f7,0x00000bbc, | ||
| 1078 | 0x00000000,0x000400fa,0x00000a92,0x00000bb7, | ||
| 1079 | 0x00000bbc,0x000200f8,0x00000bb7,0x000500c7, | ||
| 1080 | 0x00000006,0x00000bba,0x00000964,0x0000018b, | ||
| 1081 | 0x000500ab,0x00000012,0x00000bbb,0x00000bba, | ||
| 1082 | 0x00000058,0x000200f9,0x00000bbc,0x000200f8, | ||
| 1083 | 0x00000bbc,0x000700f5,0x00000012,0x00000bbd, | ||
| 1084 | 0x00000a92,0x00000970,0x00000bbb,0x00000bb7, | ||
| 1085 | 0x000300f7,0x00000bc3,0x00000000,0x000400fa, | ||
| 1086 | 0x00000bbd,0x00000bbe,0x00000bc3,0x000200f8, | ||
| 1087 | 0x00000bbe,0x000500c5,0x00000006,0x00000bc1, | ||
| 1088 | 0x00000bb1,0x00000191,0x00060052,0x00000007, | ||
| 1089 | 0x00001b33,0x00000bc1,0x00000bb2,0x00000001, | ||
| 1090 | 0x000200f9,0x00000bc3,0x000200f8,0x00000bc3, | ||
| 1091 | 0x000700f5,0x00000007,0x00001cfe,0x00000bb2, | ||
| 1092 | 0x00000bbc,0x00001b33,0x00000bbe,0x000300f7, | ||
| 1093 | 0x00000c00,0x00000000,0x000300fb,0x00000058, | ||
| 1094 | 0x00000bd7,0x000200f8,0x00000bd7,0x00050051, | ||
| 1095 | 0x00000006,0x00000c07,0x00001cfe,0x00000000, | ||
| 1096 | 0x00050095,0x0000005e,0x00000c0a,0x00000c07, | ||
| 1097 | 0x00000941,0x00050051,0x00000006,0x00000c0b, | ||
| 1098 | 0x00000c0a,0x00000001,0x00050051,0x00000006, | ||
| 1099 | 0x00000c0c,0x00000c0a,0x00000000,0x00050051, | ||
| 1100 | 0x00000006,0x00000c0f,0x00001cfe,0x00000001, | ||
| 1101 | 0x00050080,0x00000006,0x00000c14,0x00000c0f, | ||
| 1102 | 0x00000c0b,0x000200f9,0x00000bdc,0x000200f8, | ||
| 1103 | 0x00000bdc,0x000700f5,0x00000006,0x00001d00, | ||
| 1104 | 0x00000952,0x00000bd7,0x00002199,0x00000bf2, | ||
| 1105 | 0x000700f5,0x00000006,0x00001cff,0x00000058, | ||
| 1106 | 0x00000bd7,0x00002142,0x00000bf2,0x000500b0, | ||
| 1107 | 0x00000012,0x00000be0,0x00001cff,0x00001d00, | ||
| 1108 | 0x000400f6,0x00000bf3,0x00000bf2,0x00000000, | ||
| 1109 | 0x000400fa,0x00000be0,0x00000be1,0x00000bf3, | ||
| 1110 | 0x000200f8,0x00000be1,0x00050080,0x00000006, | ||
| 1111 | 0x00000be4,0x00001cff,0x00001d00,0x000500c2, | ||
| 1112 | 0x00000006,0x00000be5,0x00000be4,0x00000063, | ||
| 1113 | 0x00050084,0x00000006,0x00000be7,0x0000009e, | ||
| 1114 | 0x00000be5,0x00050051,0x00000006,0x00000c33, | ||
| 1115 | 0x00000959,0x00000000,0x00050084,0x00000006, | ||
| 1116 | 0x00000c35,0x00000be5,0x0000034a,0x00050095, | ||
| 1117 | 0x0000005e,0x00000c36,0x00000c33,0x00000c35, | ||
| 1118 | 0x00050051,0x00000006,0x00000c37,0x00000c36, | ||
| 1119 | 0x00000001,0x00050051,0x00000006,0x00000c38, | ||
| 1120 | 0x00000c36,0x00000000,0x00050051,0x00000006, | ||
| 1121 | 0x00000c3b,0x00000959,0x00000001,0x00050080, | ||
| 1122 | 0x00000006,0x00000c3d,0x00000c3b,0x00000c37, | ||
| 1123 | 0x00050050,0x00000007,0x00000c3e,0x00000c38, | ||
| 1124 | 0x00000c3d,0x0004007c,0x000000b1,0x00000c2b, | ||
| 1125 | 0x00000c3e,0x00060041,0x000000b7,0x00000c2c, | ||
| 1126 | 0x00000c2b,0x000000b6,0x000000b6,0x0006003d, | ||
| 1127 | 0x00000006,0x00000c2d,0x00000c2c,0x00000002, | ||
| 1128 | 0x00000004,0x00050080,0x00000006,0x00000c20, | ||
| 1129 | 0x00000be7,0x00000063,0x00050084,0x00000006, | ||
| 1130 | 0x00000c50,0x00000c20,0x0000009e,0x00050095, | ||
| 1131 | 0x0000005e,0x00000c51,0x00000c33,0x00000c50, | ||
| 1132 | 0x00050051,0x00000006,0x00000c52,0x00000c51, | ||
| 1133 | 0x00000001,0x00050051,0x00000006,0x00000c53, | ||
| 1134 | 0x00000c51,0x00000000,0x00050080,0x00000006, | ||
| 1135 | 0x00000c58,0x00000c3b,0x00000c52,0x00050050, | ||
| 1136 | 0x00000007,0x00000c59,0x00000c53,0x00000c58, | ||
| 1137 | 0x0004007c,0x000000b1,0x00000c46,0x00000c59, | ||
| 1138 | 0x00060041,0x000000b7,0x00000c47,0x00000c46, | ||
| 1139 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 1140 | 0x00000c48,0x00000c47,0x00000002,0x00000004, | ||
| 1141 | 0x000500b0,0x00000012,0x00000c60,0x00000c48, | ||
| 1142 | 0x00000c14,0x000400a8,0x00000012,0x00000c61, | ||
| 1143 | 0x00000c60,0x000300f7,0x00000c70,0x00000000, | ||
| 1144 | 0x000400fa,0x00000c61,0x00000c62,0x00000c70, | ||
| 1145 | 0x000200f8,0x00000c62,0x000500aa,0x00000012, | ||
| 1146 | 0x00000c67,0x00000c48,0x00000c14,0x000300f7, | ||
| 1147 | 0x00000c6e,0x00000000,0x000400fa,0x00000c67, | ||
| 1148 | 0x00000c68,0x00000c6e,0x000200f8,0x00000c68, | ||
| 1149 | 0x000500b0,0x00000012,0x00000c6d,0x00000c2d, | ||
| 1150 | 0x00000c0c,0x000200f9,0x00000c6e,0x000200f8, | ||
| 1151 | 0x00000c6e,0x000700f5,0x00000012,0x00000c6f, | ||
| 1152 | 0x00000c67,0x00000c62,0x00000c6d,0x00000c68, | ||
| 1153 | 0x000200f9,0x00000c70,0x000200f8,0x00000c70, | ||
| 1154 | 0x000700f5,0x00000012,0x00000c71,0x00000c60, | ||
| 1155 | 0x00000be1,0x00000c6f,0x00000c6e,0x000300f7, | ||
| 1156 | 0x00000bf1,0x00000000,0x000400fa,0x00000c71, | ||
| 1157 | 0x00000bec,0x00000bef,0x000200f8,0x00000bef, | ||
| 1158 | 0x000200f9,0x00000bf1,0x000200f8,0x00000bec, | ||
| 1159 | 0x00050080,0x00000006,0x00000bee,0x00000be5, | ||
| 1160 | 0x00000063,0x000200f9,0x00000bf1,0x000200f8, | ||
| 1161 | 0x00000bf1,0x000700f5,0x00000006,0x00002142, | ||
| 1162 | 0x00000bee,0x00000bec,0x00001cff,0x00000bef, | ||
| 1163 | 0x000600a9,0x00000006,0x00002199,0x00000c71, | ||
| 1164 | 0x00001d00,0x00000be5,0x000200f9,0x00000bf2, | ||
| 1165 | 0x000200f8,0x00000bf2,0x000200f9,0x00000bdc, | ||
| 1166 | 0x000200f8,0x00000bf3,0x000500aa,0x00000012, | ||
| 1167 | 0x00000bf5,0x00001cff,0x00000058,0x000300f7, | ||
| 1168 | 0x00000bf7,0x00000000,0x000400fa,0x00000bf5, | ||
| 1169 | 0x00000bf6,0x00000bf7,0x000200f8,0x00000bf6, | ||
| 1170 | 0x000200f9,0x00000c00,0x000200f8,0x00000bf7, | ||
| 1171 | 0x00050082,0x00000006,0x00000bf9,0x00001cff, | ||
| 1172 | 0x00000063,0x00050084,0x00000006,0x00000bfa, | ||
| 1173 | 0x0000009e,0x00000bf9,0x00050080,0x00000006, | ||
| 1174 | 0x00000bfb,0x00000bfa,0x000000d8,0x00050051, | ||
| 1175 | 0x00000006,0x00000c8f,0x00000959,0x00000000, | ||
| 1176 | 0x00050084,0x00000006,0x00000c91,0x00000bfb, | ||
| 1177 | 0x0000009e,0x00050095,0x0000005e,0x00000c92, | ||
| 1178 | 0x00000c8f,0x00000c91,0x00050051,0x00000006, | ||
| 1179 | 0x00000c93,0x00000c92,0x00000001,0x00050051, | ||
| 1180 | 0x00000006,0x00000c94,0x00000c92,0x00000000, | ||
| 1181 | 0x00050051,0x00000006,0x00000c97,0x00000959, | ||
| 1182 | 0x00000001,0x00050080,0x00000006,0x00000c99, | ||
| 1183 | 0x00000c97,0x00000c93,0x00050050,0x00000007, | ||
| 1184 | 0x00000c9a,0x00000c94,0x00000c99,0x0004007c, | ||
| 1185 | 0x000000b1,0x00000c87,0x00000c9a,0x00060041, | ||
| 1186 | 0x000000b7,0x00000c88,0x00000c87,0x000000b6, | ||
| 1187 | 0x000000b6,0x0006003d,0x00000006,0x00000c89, | ||
| 1188 | 0x00000c88,0x00000002,0x00000004,0x00050080, | ||
| 1189 | 0x00000006,0x00000c7c,0x00000bfa,0x000000de, | ||
| 1190 | 0x00050084,0x00000006,0x00000cac,0x00000c7c, | ||
| 1191 | 0x0000009e,0x00050095,0x0000005e,0x00000cad, | ||
| 1192 | 0x00000c8f,0x00000cac,0x00050051,0x00000006, | ||
| 1193 | 0x00000cae,0x00000cad,0x00000001,0x00050051, | ||
| 1194 | 0x00000006,0x00000caf,0x00000cad,0x00000000, | ||
| 1195 | 0x00050080,0x00000006,0x00000cb4,0x00000c97, | ||
| 1196 | 0x00000cae,0x00050050,0x00000007,0x00000cb5, | ||
| 1197 | 0x00000caf,0x00000cb4,0x0004007c,0x000000b1, | ||
| 1198 | 0x00000ca2,0x00000cb5,0x00060041,0x000000b7, | ||
| 1199 | 0x00000ca3,0x00000ca2,0x000000b6,0x000000b6, | ||
| 1200 | 0x0006003d,0x00000006,0x00000ca4,0x00000ca3, | ||
| 1201 | 0x00000002,0x00000004,0x000500b0,0x00000012, | ||
| 1202 | 0x00000cbc,0x00000c0f,0x00000ca4,0x000400a8, | ||
| 1203 | 0x00000012,0x00000cbd,0x00000cbc,0x000300f7, | ||
| 1204 | 0x00000ccc,0x00000000,0x000400fa,0x00000cbd, | ||
| 1205 | 0x00000cbe,0x00000ccc,0x000200f8,0x00000cbe, | ||
| 1206 | 0x000500aa,0x00000012,0x00000cc3,0x00000c0f, | ||
| 1207 | 0x00000ca4,0x000300f7,0x00000cca,0x00000000, | ||
| 1208 | 0x000400fa,0x00000cc3,0x00000cc4,0x00000cca, | ||
| 1209 | 0x000200f8,0x00000cc4,0x000500b0,0x00000012, | ||
| 1210 | 0x00000cc9,0x00000c07,0x00000c89,0x000200f9, | ||
| 1211 | 0x00000cca,0x000200f8,0x00000cca,0x000700f5, | ||
| 1212 | 0x00000012,0x00000ccb,0x00000cc3,0x00000cbe, | ||
| 1213 | 0x00000cc9,0x00000cc4,0x000200f9,0x00000ccc, | ||
| 1214 | 0x000200f8,0x00000ccc,0x000700f5,0x00000012, | ||
| 1215 | 0x00000ccd,0x00000cbc,0x00000bf7,0x00000ccb, | ||
| 1216 | 0x00000cca,0x000200f9,0x00000c00,0x000200f8, | ||
| 1217 | 0x00000c00,0x000700f5,0x00000012,0x00001d01, | ||
| 1218 | 0x0000011e,0x00000bf6,0x00000ccd,0x00000ccc, | ||
| 1219 | 0x000200f9,0x00000979,0x000200f8,0x00000979, | ||
| 1220 | 0x000700f5,0x00000012,0x0000097a,0x0000096f, | ||
| 1221 | 0x0000096d,0x00001d01,0x00000c00,0x000200f9, | ||
| 1222 | 0x0000097b,0x000200f8,0x0000097b,0x000d00f5, | ||
| 1223 | 0x00000012,0x00001d02,0x0000011e,0x00000938, | ||
| 1224 | 0x00000217,0x0000094f,0x0000011e,0x00000954, | ||
| 1225 | 0x00000217,0x0000095e,0x0000097a,0x00000979, | ||
| 1226 | 0x000400a8,0x00000012,0x00000483,0x00001d02, | ||
| 1227 | 0x000200f9,0x0000047a,0x000200f8,0x0000047a, | ||
| 1228 | 0x000700f5,0x00000012,0x00000484,0x00000478, | ||
| 1229 | 0x000005c0,0x00000483,0x0000097b,0x000300f7, | ||
| 1230 | 0x00000486,0x00000000,0x000400fa,0x00000484, | ||
| 1231 | 0x00000485,0x00000486,0x000200f8,0x00000485, | ||
| 1232 | 0x000200f9,0x00000518,0x000200f8,0x00000486, | ||
| 1233 | 0x000200f9,0x00000467,0x000200f8,0x00000467, | ||
| 1234 | 0x00050041,0x0000020a,0x00000489,0x00000180, | ||
| 1235 | 0x000000b6,0x0004003d,0x00000007,0x0000048a, | ||
| 1236 | 0x00000489,0x0004007c,0x00000468,0x0000048b, | ||
| 1237 | 0x0000048a,0x00050084,0x00000006,0x0000048f, | ||
| 1238 | 0x000000d8,0x0000044f,0x00060041,0x00000474, | ||
| 1239 | 0x00000490,0x0000048b,0x000000b6,0x0000048f, | ||
| 1240 | 0x0006003d,0x00000027,0x00000491,0x00000490, | ||
| 1241 | 0x00000002,0x00000010,0x00050080,0x00000006, | ||
| 1242 | 0x00000496,0x0000048f,0x00000063,0x00060041, | ||
| 1243 | 0x00000474,0x00000497,0x0000048b,0x000000b6, | ||
| 1244 | 0x00000496,0x0006003d,0x00000027,0x00000498, | ||
| 1245 | 0x00000497,0x00000002,0x00000010,0x000300f7, | ||
| 1246 | 0x0000049b,0x00000000,0x000400fa,0x0000043a, | ||
| 1247 | 0x0000049a,0x0000049b,0x000200f8,0x0000049a, | ||
| 1248 | 0x00050051,0x00000006,0x0000049d,0x00000491, | ||
| 1249 | 0x00000003,0x000500c2,0x00000006,0x0000049e, | ||
| 1250 | 0x0000049d,0x0000019b,0x000500ab,0x00000012, | ||
| 1251 | 0x0000049f,0x0000049e,0x00000058,0x000200f9, | ||
| 1252 | 0x0000049b,0x000200f8,0x0000049b,0x000700f5, | ||
| 1253 | 0x00000012,0x000004a0,0x0000043a,0x00000467, | ||
| 1254 | 0x0000049f,0x0000049a,0x000300f7,0x000004a2, | ||
| 1255 | 0x00000000,0x000400fa,0x000004a0,0x000004a1, | ||
| 1256 | 0x000004a2,0x000200f8,0x000004a1,0x000200f9, | ||
| 1257 | 0x00000518,0x000200f8,0x000004a2,0x000500c2, | ||
| 1258 | 0x00000006,0x000004a6,0x00001ce6,0x000004a5, | ||
| 1259 | 0x000500ab,0x00000012,0x000004a7,0x000004a6, | ||
| 1260 | 0x00000058,0x000300f7,0x000004a9,0x00000000, | ||
| 1261 | 0x000400fa,0x000004a7,0x000004a8,0x000004a9, | ||
| 1262 | 0x000200f8,0x000004a8,0x00050051,0x00000006, | ||
| 1263 | 0x000004ab,0x00000491,0x00000003,0x000500c2, | ||
| 1264 | 0x00000006,0x000004ac,0x000004ab,0x0000019b, | ||
| 1265 | 0x000500ab,0x00000012,0x000004ad,0x000004ac, | ||
| 1266 | 0x00000058,0x000200f9,0x000004a9,0x000200f8, | ||
| 1267 | 0x000004a9,0x000700f5,0x00000012,0x000004ae, | ||
| 1268 | 0x000004a7,0x000004a2,0x000004ad,0x000004a8, | ||
| 1269 | 0x00070050,0x0000219a,0x0000219b,0x000004ae, | ||
| 1270 | 0x000004ae,0x000004ae,0x000004ae,0x000600a9, | ||
| 1271 | 0x00000027,0x0000219c,0x0000219b,0x000001a7, | ||
| 1272 | 0x00000491,0x00050051,0x00000006,0x000004b6, | ||
| 1273 | 0x0000219c,0x00000003,0x000500c2,0x00000006, | ||
| 1274 | 0x000004b7,0x000004b6,0x0000019b,0x000500aa, | ||
| 1275 | 0x00000012,0x000004b8,0x000004b7,0x00000058, | ||
| 1276 | 0x000300f7,0x000004ba,0x00000000,0x000400fa, | ||
| 1277 | 0x000004b8,0x000004b9,0x000004ba,0x000200f8, | ||
| 1278 | 0x000004b9,0x000300f7,0x00000e39,0x00000000, | ||
| 1279 | 0x000300fb,0x00000058,0x00000d15,0x000200f8, | ||
| 1280 | 0x00000d15,0x000500ab,0x00000012,0x00000d19, | ||
| 1281 | 0x000004b7,0x00000058,0x000400a8,0x00000012, | ||
| 1282 | 0x00000d1a,0x00000d19,0x000300f7,0x00000d1f, | ||
| 1283 | 0x00000000,0x000400fa,0x00000d1a,0x00000d1b, | ||
| 1284 | 0x00000d1f,0x000200f8,0x00000d1b,0x00050051, | ||
| 1285 | 0x00000006,0x00000d1d,0x0000219c,0x00000002, | ||
| 1286 | 0x000500aa,0x00000012,0x00000d1e,0x00000d1d, | ||
| 1287 | 0x00000058,0x000200f9,0x00000d1f,0x000200f8, | ||
| 1288 | 0x00000d1f,0x000700f5,0x00000012,0x00000d20, | ||
| 1289 | 0x00000d19,0x00000d15,0x00000d1e,0x00000d1b, | ||
| 1290 | 0x000300f7,0x00000d22,0x00000000,0x000400fa, | ||
| 1291 | 0x00000d20,0x00000d21,0x00000d22,0x000200f8, | ||
| 1292 | 0x00000d21,0x000200f9,0x00000e39,0x000200f8, | ||
| 1293 | 0x00000d22,0x00050051,0x00000006,0x00000d24, | ||
| 1294 | 0x0000219c,0x00000000,0x00050051,0x00000006, | ||
| 1295 | 0x00000d26,0x0000219c,0x00000001,0x000500c7, | ||
| 1296 | 0x00000006,0x00000d27,0x00000d26,0x0000017b, | ||
| 1297 | 0x00050050,0x00000007,0x00000d28,0x00000d24, | ||
| 1298 | 0x00000d27,0x000500aa,0x00000012,0x00000d2b, | ||
| 1299 | 0x00000d24,0x00000058,0x000300f7,0x00000d30, | ||
| 1300 | 0x00000000,0x000400fa,0x00000d2b,0x00000d2c, | ||
| 1301 | 0x00000d30,0x000200f8,0x00000d2c,0x000500aa, | ||
| 1302 | 0x00000012,0x00000d2f,0x00000d27,0x00000058, | ||
| 1303 | 0x000200f9,0x00000d30,0x000200f8,0x00000d30, | ||
| 1304 | 0x000700f5,0x00000012,0x00000d31,0x00000d2b, | ||
| 1305 | 0x00000d22,0x00000d2f,0x00000d2c,0x000300f7, | ||
| 1306 | 0x00000d36,0x00000000,0x000400fa,0x00000d31, | ||
| 1307 | 0x00000d32,0x00000d36,0x000200f8,0x00000d32, | ||
| 1308 | 0x00060052,0x00000027,0x00001b56,0x00000058, | ||
| 1309 | 0x0000219c,0x00000000,0x00060052,0x00000027, | ||
| 1310 | 0x00001b58,0x00000058,0x00001b56,0x00000001, | ||
| 1311 | 0x00060052,0x00000027,0x00001b5a,0x00000058, | ||
| 1312 | 0x00001b58,0x00000002,0x000200f9,0x00000e39, | ||
| 1313 | 0x000200f8,0x00000d36,0x000500c2,0x00000006, | ||
| 1314 | 0x00000d39,0x00000d26,0x000000e4,0x000500c7, | ||
| 1315 | 0x00000006,0x00000d3a,0x00000d39,0x000001ad, | ||
| 1316 | 0x00050051,0x00000006,0x00000d3c,0x0000219c, | ||
| 1317 | 0x00000002,0x000500aa,0x00000012,0x00000d3e, | ||
| 1318 | 0x00000d3a,0x00000058,0x000600a9,0x00000006, | ||
| 1319 | 0x00000d40,0x00000d3e,0x00000063,0x00000d3a, | ||
| 1320 | 0x00050097,0x0000005e,0x00000d43,0x00000d3c, | ||
| 1321 | 0x00000d40,0x00050051,0x00000006,0x00000d44, | ||
| 1322 | 0x00000d43,0x00000000,0x00050051,0x00000006, | ||
| 1323 | 0x00000d45,0x00000d43,0x00000001,0x00050050, | ||
| 1324 | 0x00000007,0x0000218e,0x00000d44,0x00000d45, | ||
| 1325 | 0x00050041,0x00000182,0x00000d46,0x00000180, | ||
| 1326 | 0x0000029a,0x0004003d,0x00000006,0x00000d47, | ||
| 1327 | 0x00000d46,0x000200f9,0x00000d48,0x000200f8, | ||
| 1328 | 0x00000d48,0x000700f5,0x00000006,0x00001d55, | ||
| 1329 | 0x00000d47,0x00000d36,0x0000219d,0x00000d5f, | ||
| 1330 | 0x000700f5,0x00000006,0x00001d54,0x00000058, | ||
| 1331 | 0x00000d36,0x00002148,0x00000d5f,0x000500b0, | ||
| 1332 | 0x00000012,0x00000d4c,0x00001d54,0x00001d55, | ||
| 1333 | 0x000400f6,0x00000d60,0x00000d5f,0x00000000, | ||
| 1334 | 0x000400fa,0x00000d4c,0x00000d4d,0x00000d60, | ||
| 1335 | 0x000200f8,0x00000d4d,0x00050080,0x00000006, | ||
| 1336 | 0x00000d50,0x00001d54,0x00001d55,0x000500c2, | ||
| 1337 | 0x00000006,0x00000d51,0x00000d50,0x00000063, | ||
| 1338 | 0x00050084,0x00000006,0x00000d53,0x000002ab, | ||
| 1339 | 0x00000d51,0x00050041,0x0000020a,0x00000d54, | ||
| 1340 | 0x00000180,0x000002aa,0x0004003d,0x00000007, | ||
| 1341 | 0x00000d55,0x00000d54,0x00050051,0x00000006, | ||
| 1342 | 0x00000e5c,0x00000d55,0x00000000,0x00050084, | ||
| 1343 | 0x00000006,0x00000e5e,0x00000d51,0x0000218f, | ||
| 1344 | 0x00050095,0x0000005e,0x00000e5f,0x00000e5c, | ||
| 1345 | 0x00000e5e,0x00050051,0x00000006,0x00000e60, | ||
| 1346 | 0x00000e5f,0x00000001,0x00050051,0x00000006, | ||
| 1347 | 0x00000e61,0x00000e5f,0x00000000,0x00050051, | ||
| 1348 | 0x00000006,0x00000e64,0x00000d55,0x00000001, | ||
| 1349 | 0x00050080,0x00000006,0x00000e66,0x00000e64, | ||
| 1350 | 0x00000e60,0x00050050,0x00000007,0x00000e67, | ||
| 1351 | 0x00000e61,0x00000e66,0x0004007c,0x000000b1, | ||
| 1352 | 0x00000e54,0x00000e67,0x00060041,0x000000b7, | ||
| 1353 | 0x00000e55,0x00000e54,0x000000b6,0x000000b6, | ||
| 1354 | 0x0006003d,0x00000006,0x00000e56,0x00000e55, | ||
| 1355 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 1356 | 0x00000e49,0x00000d53,0x00000063,0x00050084, | ||
| 1357 | 0x00000006,0x00000e79,0x00000e49,0x0000009e, | ||
| 1358 | 0x00050095,0x0000005e,0x00000e7a,0x00000e5c, | ||
| 1359 | 0x00000e79,0x00050051,0x00000006,0x00000e7b, | ||
| 1360 | 0x00000e7a,0x00000001,0x00050051,0x00000006, | ||
| 1361 | 0x00000e7c,0x00000e7a,0x00000000,0x00050080, | ||
| 1362 | 0x00000006,0x00000e81,0x00000e64,0x00000e7b, | ||
| 1363 | 0x00050050,0x00000007,0x00000e82,0x00000e7c, | ||
| 1364 | 0x00000e81,0x0004007c,0x000000b1,0x00000e6f, | ||
| 1365 | 0x00000e82,0x00060041,0x000000b7,0x00000e70, | ||
| 1366 | 0x00000e6f,0x000000b6,0x000000b6,0x0006003d, | ||
| 1367 | 0x00000006,0x00000e71,0x00000e70,0x00000002, | ||
| 1368 | 0x00000004,0x000500b0,0x00000012,0x00000e89, | ||
| 1369 | 0x00000d27,0x00000e71,0x000400a8,0x00000012, | ||
| 1370 | 0x00000e8a,0x00000e89,0x000300f7,0x00000e99, | ||
| 1371 | 0x00000000,0x000400fa,0x00000e8a,0x00000e8b, | ||
| 1372 | 0x00000e99,0x000200f8,0x00000e8b,0x000500aa, | ||
| 1373 | 0x00000012,0x00000e90,0x00000d27,0x00000e71, | ||
| 1374 | 0x000300f7,0x00000e97,0x00000000,0x000400fa, | ||
| 1375 | 0x00000e90,0x00000e91,0x00000e97,0x000200f8, | ||
| 1376 | 0x00000e91,0x000500b0,0x00000012,0x00000e96, | ||
| 1377 | 0x00000d24,0x00000e56,0x000200f9,0x00000e97, | ||
| 1378 | 0x000200f8,0x00000e97,0x000700f5,0x00000012, | ||
| 1379 | 0x00000e98,0x00000e90,0x00000e8b,0x00000e96, | ||
| 1380 | 0x00000e91,0x000200f9,0x00000e99,0x000200f8, | ||
| 1381 | 0x00000e99,0x000700f5,0x00000012,0x00000e9a, | ||
| 1382 | 0x00000e89,0x00000d4d,0x00000e98,0x00000e97, | ||
| 1383 | 0x000300f7,0x00000d5e,0x00000000,0x000400fa, | ||
| 1384 | 0x00000e9a,0x00000d59,0x00000d5b,0x000200f8, | ||
| 1385 | 0x00000d5b,0x00050080,0x00000006,0x00000d5d, | ||
| 1386 | 0x00000d51,0x00000063,0x000200f9,0x00000d5e, | ||
| 1387 | 0x000200f8,0x00000d59,0x000200f9,0x00000d5e, | ||
| 1388 | 0x000200f8,0x00000d5e,0x000700f5,0x00000006, | ||
| 1389 | 0x00002148,0x00001d54,0x00000d59,0x00000d5d, | ||
| 1390 | 0x00000d5b,0x000600a9,0x00000006,0x0000219d, | ||
| 1391 | 0x00000e9a,0x00000d51,0x00001d55,0x000200f9, | ||
| 1392 | 0x00000d5f,0x000200f8,0x00000d5f,0x000200f9, | ||
| 1393 | 0x00000d48,0x000200f8,0x00000d60,0x000500ac, | ||
| 1394 | 0x00000012,0x00000d62,0x00001d54,0x00000058, | ||
| 1395 | 0x000300f7,0x00000d96,0x00000000,0x000400fa, | ||
| 1396 | 0x00000d62,0x00000d63,0x00000d96,0x000200f8, | ||
| 1397 | 0x00000d63,0x00050082,0x00000006,0x00000d65, | ||
| 1398 | 0x00001d54,0x00000063,0x00050084,0x00000006, | ||
| 1399 | 0x00000d66,0x000002ab,0x00000d65,0x00050080, | ||
| 1400 | 0x00000006,0x00000d68,0x00000d66,0x000000d8, | ||
| 1401 | 0x00050041,0x0000020a,0x00000d69,0x00000180, | ||
| 1402 | 0x000002aa,0x0004003d,0x00000007,0x00000d6a, | ||
| 1403 | 0x00000d69,0x00050051,0x00000006,0x00000eb8, | ||
| 1404 | 0x00000d6a,0x00000000,0x00050084,0x00000006, | ||
| 1405 | 0x00000eba,0x00000d68,0x0000009e,0x00050095, | ||
| 1406 | 0x0000005e,0x00000ebb,0x00000eb8,0x00000eba, | ||
| 1407 | 0x00050051,0x00000006,0x00000ebc,0x00000ebb, | ||
| 1408 | 0x00000001,0x00050051,0x00000006,0x00000ebd, | ||
| 1409 | 0x00000ebb,0x00000000,0x00050051,0x00000006, | ||
| 1410 | 0x00000ec0,0x00000d6a,0x00000001,0x00050080, | ||
| 1411 | 0x00000006,0x00000ec2,0x00000ec0,0x00000ebc, | ||
| 1412 | 0x00050050,0x00000007,0x00000ec3,0x00000ebd, | ||
| 1413 | 0x00000ec2,0x0004007c,0x000000b1,0x00000eb0, | ||
| 1414 | 0x00000ec3,0x00060041,0x000000b7,0x00000eb1, | ||
| 1415 | 0x00000eb0,0x000000b6,0x000000b6,0x0006003d, | ||
| 1416 | 0x00000006,0x00000eb2,0x00000eb1,0x00000002, | ||
| 1417 | 0x00000004,0x00050080,0x00000006,0x00000ea5, | ||
| 1418 | 0x00000d66,0x000000de,0x00050084,0x00000006, | ||
| 1419 | 0x00000ed5,0x00000ea5,0x0000009e,0x00050095, | ||
| 1420 | 0x0000005e,0x00000ed6,0x00000eb8,0x00000ed5, | ||
| 1421 | 0x00050051,0x00000006,0x00000ed7,0x00000ed6, | ||
| 1422 | 0x00000001,0x00050051,0x00000006,0x00000ed8, | ||
| 1423 | 0x00000ed6,0x00000000,0x00050080,0x00000006, | ||
| 1424 | 0x00000edd,0x00000ec0,0x00000ed7,0x00050050, | ||
| 1425 | 0x00000007,0x00000ede,0x00000ed8,0x00000edd, | ||
| 1426 | 0x0004007c,0x000000b1,0x00000ecb,0x00000ede, | ||
| 1427 | 0x00060041,0x000000b7,0x00000ecc,0x00000ecb, | ||
| 1428 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 1429 | 0x00000ecd,0x00000ecc,0x00000002,0x00000004, | ||
| 1430 | 0x000500b0,0x00000012,0x00000ee5,0x00000d27, | ||
| 1431 | 0x00000ecd,0x000400a8,0x00000012,0x00000ee6, | ||
| 1432 | 0x00000ee5,0x000300f7,0x00000ef5,0x00000000, | ||
| 1433 | 0x000400fa,0x00000ee6,0x00000ee7,0x00000ef5, | ||
| 1434 | 0x000200f8,0x00000ee7,0x000500aa,0x00000012, | ||
| 1435 | 0x00000eec,0x00000d27,0x00000ecd,0x000300f7, | ||
| 1436 | 0x00000ef3,0x00000000,0x000400fa,0x00000eec, | ||
| 1437 | 0x00000eed,0x00000ef3,0x000200f8,0x00000eed, | ||
| 1438 | 0x000500b0,0x00000012,0x00000ef2,0x00000d24, | ||
| 1439 | 0x00000eb2,0x000200f9,0x00000ef3,0x000200f8, | ||
| 1440 | 0x00000ef3,0x000700f5,0x00000012,0x00000ef4, | ||
| 1441 | 0x00000eec,0x00000ee7,0x00000ef2,0x00000eed, | ||
| 1442 | 0x000200f9,0x00000ef5,0x000200f8,0x00000ef5, | ||
| 1443 | 0x000700f5,0x00000012,0x00000ef6,0x00000ee5, | ||
| 1444 | 0x00000d63,0x00000ef4,0x00000ef3,0x000300f7, | ||
| 1445 | 0x00000d77,0x00000000,0x000400fa,0x00000ef6, | ||
| 1446 | 0x00000d6f,0x00000d77,0x000200f8,0x00000d6f, | ||
| 1447 | 0x00050080,0x00000006,0x00000d71,0x00000d66, | ||
| 1448 | 0x000002d5,0x00050084,0x00000006,0x00000f08, | ||
| 1449 | 0x00000d71,0x0000009e,0x00050095,0x0000005e, | ||
| 1450 | 0x00000f09,0x00000eb8,0x00000f08,0x00050051, | ||
| 1451 | 0x00000006,0x00000f0a,0x00000f09,0x00000001, | ||
| 1452 | 0x00050051,0x00000006,0x00000f0b,0x00000f09, | ||
| 1453 | 0x00000000,0x00050080,0x00000006,0x00000f10, | ||
| 1454 | 0x00000ec0,0x00000f0a,0x00050050,0x00000007, | ||
| 1455 | 0x00000f11,0x00000f0b,0x00000f10,0x0004007c, | ||
| 1456 | 0x000000b1,0x00000efe,0x00000f11,0x00060041, | ||
| 1457 | 0x000000b7,0x00000eff,0x00000efe,0x000000b6, | ||
| 1458 | 0x000000b6,0x0006003d,0x00000006,0x00000f00, | ||
| 1459 | 0x00000eff,0x00000002,0x00000004,0x000500c7, | ||
| 1460 | 0x00000006,0x00000d75,0x00000f00,0x00000063, | ||
| 1461 | 0x000500ab,0x00000012,0x00000d76,0x00000d75, | ||
| 1462 | 0x00000058,0x000200f9,0x00000d77,0x000200f8, | ||
| 1463 | 0x00000d77,0x000700f5,0x00000012,0x00000d78, | ||
| 1464 | 0x00000ef6,0x00000ef5,0x00000d76,0x00000d6f, | ||
| 1465 | 0x000300f7,0x00000d95,0x00000000,0x000400fa, | ||
| 1466 | 0x00000d78,0x00000d79,0x00000d95,0x000200f8, | ||
| 1467 | 0x00000d79,0x00050096,0x0000005e,0x00000f1a, | ||
| 1468 | 0x00000eb2,0x00000d24,0x00050051,0x00000006, | ||
| 1469 | 0x00000f1b,0x00000f1a,0x00000001,0x00050051, | ||
| 1470 | 0x00000006,0x00000f1c,0x00000f1a,0x00000000, | ||
| 1471 | 0x00050082,0x00000006,0x00000f22,0x00000ecd, | ||
| 1472 | 0x00000d27,0x00050082,0x00000006,0x00000f24, | ||
| 1473 | 0x00000f22,0x00000f1b,0x000500b0,0x00000012, | ||
| 1474 | 0x00000f2c,0x00000f24,0x00000d45,0x000400a8, | ||
| 1475 | 0x00000012,0x00000f2d,0x00000f2c,0x000300f7, | ||
| 1476 | 0x00000f3c,0x00000000,0x000400fa,0x00000f2d, | ||
| 1477 | 0x00000f2e,0x00000f3c,0x000200f8,0x00000f2e, | ||
| 1478 | 0x000500aa,0x00000012,0x00000f33,0x00000f24, | ||
| 1479 | 0x00000d45,0x000300f7,0x00000f3a,0x00000000, | ||
| 1480 | 0x000400fa,0x00000f33,0x00000f34,0x00000f3a, | ||
| 1481 | 0x000200f8,0x00000f34,0x000500b0,0x00000012, | ||
| 1482 | 0x00000f39,0x00000f1c,0x00000d44,0x000200f9, | ||
| 1483 | 0x00000f3a,0x000200f8,0x00000f3a,0x000700f5, | ||
| 1484 | 0x00000012,0x00000f3b,0x00000f33,0x00000f2e, | ||
| 1485 | 0x00000f39,0x00000f34,0x000200f9,0x00000f3c, | ||
| 1486 | 0x000200f8,0x00000f3c,0x000700f5,0x00000012, | ||
| 1487 | 0x00000f3d,0x00000f2c,0x00000d79,0x00000f3b, | ||
| 1488 | 0x00000f3a,0x000300f7,0x00000d94,0x00000000, | ||
| 1489 | 0x000400fa,0x00000f3d,0x00000d7f,0x00000d83, | ||
| 1490 | 0x000200f8,0x00000d83,0x00050084,0x00000006, | ||
| 1491 | 0x00000f61,0x00000d65,0x0000218f,0x00050095, | ||
| 1492 | 0x0000005e,0x00000f62,0x00000eb8,0x00000f61, | ||
| 1493 | 0x00050051,0x00000006,0x00000f63,0x00000f62, | ||
| 1494 | 0x00000001,0x00050051,0x00000006,0x00000f64, | ||
| 1495 | 0x00000f62,0x00000000,0x00050080,0x00000006, | ||
| 1496 | 0x00000f69,0x00000ec0,0x00000f63,0x00050050, | ||
| 1497 | 0x00000007,0x00000f6a,0x00000f64,0x00000f69, | ||
| 1498 | 0x0004007c,0x000000b1,0x00000f57,0x00000f6a, | ||
| 1499 | 0x00060041,0x000000b7,0x00000f58,0x00000f57, | ||
| 1500 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 1501 | 0x00000f59,0x00000f58,0x00000002,0x00000004, | ||
| 1502 | 0x00050080,0x00000006,0x00000f4c,0x00000d66, | ||
| 1503 | 0x00000063,0x00050084,0x00000006,0x00000f7c, | ||
| 1504 | 0x00000f4c,0x0000009e,0x00050095,0x0000005e, | ||
| 1505 | 0x00000f7d,0x00000eb8,0x00000f7c,0x00050051, | ||
| 1506 | 0x00000006,0x00000f7e,0x00000f7d,0x00000001, | ||
| 1507 | 0x00050051,0x00000006,0x00000f7f,0x00000f7d, | ||
| 1508 | 0x00000000,0x00050080,0x00000006,0x00000f84, | ||
| 1509 | 0x00000ec0,0x00000f7e,0x00050050,0x00000007, | ||
| 1510 | 0x00000f85,0x00000f7f,0x00000f84,0x0004007c, | ||
| 1511 | 0x000000b1,0x00000f72,0x00000f85,0x00060041, | ||
| 1512 | 0x000000b7,0x00000f73,0x00000f72,0x000000b6, | ||
| 1513 | 0x000000b6,0x0006003d,0x00000006,0x00000f74, | ||
| 1514 | 0x00000f73,0x00000002,0x00000004,0x00050080, | ||
| 1515 | 0x00000006,0x00000d89,0x00000d66,0x0000009e, | ||
| 1516 | 0x00050084,0x00000006,0x00000fa5,0x00000d89, | ||
| 1517 | 0x0000009e,0x00050095,0x0000005e,0x00000fa6, | ||
| 1518 | 0x00000eb8,0x00000fa5,0x00050051,0x00000006, | ||
| 1519 | 0x00000fa7,0x00000fa6,0x00000001,0x00050051, | ||
| 1520 | 0x00000006,0x00000fa8,0x00000fa6,0x00000000, | ||
| 1521 | 0x00050080,0x00000006,0x00000fad,0x00000ec0, | ||
| 1522 | 0x00000fa7,0x00050050,0x00000007,0x00000fae, | ||
| 1523 | 0x00000fa8,0x00000fad,0x0004007c,0x000000b1, | ||
| 1524 | 0x00000f9b,0x00000fae,0x00060041,0x000000b7, | ||
| 1525 | 0x00000f9c,0x00000f9b,0x000000b6,0x000000b6, | ||
| 1526 | 0x0006003d,0x00000006,0x00000f9d,0x00000f9c, | ||
| 1527 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 1528 | 0x00000f90,0x00000d66,0x00000357,0x00050084, | ||
| 1529 | 0x00000006,0x00000fc0,0x00000f90,0x0000009e, | ||
| 1530 | 0x00050095,0x0000005e,0x00000fc1,0x00000eb8, | ||
| 1531 | 0x00000fc0,0x00050051,0x00000006,0x00000fc2, | ||
| 1532 | 0x00000fc1,0x00000001,0x00050051,0x00000006, | ||
| 1533 | 0x00000fc3,0x00000fc1,0x00000000,0x00050080, | ||
| 1534 | 0x00000006,0x00000fc8,0x00000ec0,0x00000fc2, | ||
| 1535 | 0x00050050,0x00000007,0x00000fc9,0x00000fc3, | ||
| 1536 | 0x00000fc8,0x0004007c,0x000000b1,0x00000fb6, | ||
| 1537 | 0x00000fc9,0x00060041,0x000000b7,0x00000fb7, | ||
| 1538 | 0x00000fb6,0x000000b6,0x000000b6,0x0006003d, | ||
| 1539 | 0x00000006,0x00000fb8,0x00000fb7,0x00000002, | ||
| 1540 | 0x00000004,0x00050096,0x0000005e,0x00000fd2, | ||
| 1541 | 0x00000d24,0x00000f59,0x00050051,0x00000006, | ||
| 1542 | 0x00000fd3,0x00000fd2,0x00000001,0x00050051, | ||
| 1543 | 0x00000006,0x00000fd4,0x00000fd2,0x00000000, | ||
| 1544 | 0x00050082,0x00000006,0x00000fda,0x00000d27, | ||
| 1545 | 0x00000f74,0x00050082,0x00000006,0x00000fdc, | ||
| 1546 | 0x00000fda,0x00000fd3,0x00050095,0x0000005e, | ||
| 1547 | 0x00000fe6,0x00000f9d,0x00000fd4,0x00050051, | ||
| 1548 | 0x00000006,0x00000fe7,0x00000fe6,0x00000001, | ||
| 1549 | 0x00050051,0x00000006,0x00000fe8,0x00000fe6, | ||
| 1550 | 0x00000000,0x00050080,0x00000006,0x00000fee, | ||
| 1551 | 0x00000fb8,0x00000fdc,0x00050080,0x00000006, | ||
| 1552 | 0x00000ff0,0x00000fee,0x00000fe7,0x00060052, | ||
| 1553 | 0x00000027,0x00001b99,0x00000fe8,0x0000219c, | ||
| 1554 | 0x00000000,0x000500c7,0x00000006,0x00000ff8, | ||
| 1555 | 0x00000d26,0x00000191,0x000500c7,0x00000006, | ||
| 1556 | 0x00000ffb,0x00000ff0,0x0000017b,0x000500c5, | ||
| 1557 | 0x00000006,0x00000ffc,0x00000ff8,0x00000ffb, | ||
| 1558 | 0x00060052,0x00000027,0x00001b9d,0x00000ffc, | ||
| 1559 | 0x00001b99,0x00000001,0x000200f9,0x00000d94, | ||
| 1560 | 0x000200f8,0x00000d7f,0x00060052,0x00000027, | ||
| 1561 | 0x00001b82,0x00000058,0x0000219c,0x00000000, | ||
| 1562 | 0x00060052,0x00000027,0x00001b84,0x00000058, | ||
| 1563 | 0x00001b82,0x00000001,0x00060052,0x00000027, | ||
| 1564 | 0x00001b86,0x00000058,0x00001b84,0x00000002, | ||
| 1565 | 0x000200f9,0x00000d94,0x000200f8,0x00000d94, | ||
| 1566 | 0x000700f5,0x00000027,0x00001df7,0x00001b86, | ||
| 1567 | 0x00000d7f,0x00001b9d,0x00000d83,0x000200f9, | ||
| 1568 | 0x00000e39,0x000200f8,0x00000d95,0x000200f9, | ||
| 1569 | 0x00000d96,0x000200f8,0x00000d96,0x000500c7, | ||
| 1570 | 0x00000006,0x00000d9a,0x00000438,0x00000063, | ||
| 1571 | 0x000500ab,0x00000012,0x00000d9b,0x00000d9a, | ||
| 1572 | 0x00000058,0x000300f7,0x00000da1,0x00000000, | ||
| 1573 | 0x000400fa,0x00000d9b,0x00000d9c,0x00000da1, | ||
| 1574 | 0x000200f8,0x00000d9c,0x000500c7,0x00000006, | ||
| 1575 | 0x00000d9f,0x00000d26,0x0000018b,0x000500ab, | ||
| 1576 | 0x00000012,0x00000da0,0x00000d9f,0x00000058, | ||
| 1577 | 0x000200f9,0x00000da1,0x000200f8,0x00000da1, | ||
| 1578 | 0x000700f5,0x00000012,0x00000da2,0x00000d9b, | ||
| 1579 | 0x00000d96,0x00000da0,0x00000d9c,0x000300f7, | ||
| 1580 | 0x00000da8,0x00000000,0x000400fa,0x00000da2, | ||
| 1581 | 0x00000da3,0x00000da8,0x000200f8,0x00000da3, | ||
| 1582 | 0x000500c5,0x00000006,0x00000da6,0x00000d27, | ||
| 1583 | 0x00000191,0x00060052,0x00000007,0x00001ba1, | ||
| 1584 | 0x00000da6,0x00000d28,0x00000001,0x000200f9, | ||
| 1585 | 0x00000da8,0x000200f8,0x00000da8,0x000700f5, | ||
| 1586 | 0x00000007,0x00001d58,0x00000d28,0x00000da1, | ||
| 1587 | 0x00001ba1,0x00000da3,0x00050041,0x00000182, | ||
| 1588 | 0x00000da9,0x00000180,0x000000e4,0x0004003d, | ||
| 1589 | 0x00000006,0x00000daa,0x00000da9,0x000500ab, | ||
| 1590 | 0x00000012,0x00000dab,0x00000daa,0x00000058, | ||
| 1591 | 0x000300f7,0x00000dbe,0x00000000,0x000400fa, | ||
| 1592 | 0x00000dab,0x00000dac,0x00000dbe,0x000200f8, | ||
| 1593 | 0x00000dac,0x000500aa,0x00000012,0x00000daf, | ||
| 1594 | 0x00000d44,0x00000058,0x000300f7,0x00000db4, | ||
| 1595 | 0x00000000,0x000400fa,0x00000daf,0x00000db0, | ||
| 1596 | 0x00000db4,0x000200f8,0x00000db0,0x000500aa, | ||
| 1597 | 0x00000012,0x00000db3,0x00000d45,0x00000058, | ||
| 1598 | 0x000200f9,0x00000db4,0x000200f8,0x00000db4, | ||
| 1599 | 0x000700f5,0x00000012,0x00000db5,0x00000daf, | ||
| 1600 | 0x00000dac,0x00000db3,0x00000db0,0x000600a9, | ||
| 1601 | 0x00000007,0x00000db7,0x00000db5,0x00000208, | ||
| 1602 | 0x0000218e,0x00050041,0x0000020a,0x00000db8, | ||
| 1603 | 0x00000180,0x00000325,0x0004003d,0x00000007, | ||
| 1604 | 0x00000db9,0x00000db8,0x000300f7,0x00001042, | ||
| 1605 | 0x00000000,0x000300fb,0x00000058,0x00001012, | ||
| 1606 | 0x000200f8,0x00001012,0x000200f9,0x00001014, | ||
| 1607 | 0x000200f8,0x00001014,0x000700f5,0x00000006, | ||
| 1608 | 0x00001d5a,0x00000daa,0x00001012,0x0000219e, | ||
| 1609 | 0x0000102a,0x000700f5,0x00000006,0x00001d59, | ||
| 1610 | 0x00000058,0x00001012,0x0000214e,0x0000102a, | ||
| 1611 | 0x000500b0,0x00000012,0x00001018,0x00001d59, | ||
| 1612 | 0x00001d5a,0x000400f6,0x0000102b,0x0000102a, | ||
| 1613 | 0x00000000,0x000400fa,0x00001018,0x00001019, | ||
| 1614 | 0x0000102b,0x000200f8,0x00001019,0x00050080, | ||
| 1615 | 0x00000006,0x0000101c,0x00001d59,0x00001d5a, | ||
| 1616 | 0x000500c2,0x00000006,0x0000101d,0x0000101c, | ||
| 1617 | 0x00000063,0x00050084,0x00000006,0x0000101f, | ||
| 1618 | 0x0000009e,0x0000101d,0x00050051,0x00000006, | ||
| 1619 | 0x00001061,0x00000db9,0x00000000,0x00050084, | ||
| 1620 | 0x00000006,0x00001063,0x0000101d,0x0000034a, | ||
| 1621 | 0x00050095,0x0000005e,0x00001064,0x00001061, | ||
| 1622 | 0x00001063,0x00050051,0x00000006,0x00001065, | ||
| 1623 | 0x00001064,0x00000001,0x00050051,0x00000006, | ||
| 1624 | 0x00001066,0x00001064,0x00000000,0x00050051, | ||
| 1625 | 0x00000006,0x00001069,0x00000db9,0x00000001, | ||
| 1626 | 0x00050080,0x00000006,0x0000106b,0x00001069, | ||
| 1627 | 0x00001065,0x00050050,0x00000007,0x0000106c, | ||
| 1628 | 0x00001066,0x0000106b,0x0004007c,0x000000b1, | ||
| 1629 | 0x00001059,0x0000106c,0x00060041,0x000000b7, | ||
| 1630 | 0x0000105a,0x00001059,0x000000b6,0x000000b6, | ||
| 1631 | 0x0006003d,0x00000006,0x0000105b,0x0000105a, | ||
| 1632 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 1633 | 0x0000104e,0x0000101f,0x00000063,0x00050084, | ||
| 1634 | 0x00000006,0x0000107e,0x0000104e,0x0000009e, | ||
| 1635 | 0x00050095,0x0000005e,0x0000107f,0x00001061, | ||
| 1636 | 0x0000107e,0x00050051,0x00000006,0x00001080, | ||
| 1637 | 0x0000107f,0x00000001,0x00050051,0x00000006, | ||
| 1638 | 0x00001081,0x0000107f,0x00000000,0x00050080, | ||
| 1639 | 0x00000006,0x00001086,0x00001069,0x00001080, | ||
| 1640 | 0x00050050,0x00000007,0x00001087,0x00001081, | ||
| 1641 | 0x00001086,0x0004007c,0x000000b1,0x00001074, | ||
| 1642 | 0x00001087,0x00060041,0x000000b7,0x00001075, | ||
| 1643 | 0x00001074,0x000000b6,0x000000b6,0x0006003d, | ||
| 1644 | 0x00000006,0x00001076,0x00001075,0x00000002, | ||
| 1645 | 0x00000004,0x00050051,0x00000006,0x0000108b, | ||
| 1646 | 0x00001d58,0x00000001,0x000500b0,0x00000012, | ||
| 1647 | 0x0000108e,0x0000108b,0x00001076,0x000400a8, | ||
| 1648 | 0x00000012,0x0000108f,0x0000108e,0x000300f7, | ||
| 1649 | 0x0000109e,0x00000000,0x000400fa,0x0000108f, | ||
| 1650 | 0x00001090,0x0000109e,0x000200f8,0x00001090, | ||
| 1651 | 0x000500aa,0x00000012,0x00001095,0x0000108b, | ||
| 1652 | 0x00001076,0x000300f7,0x0000109c,0x00000000, | ||
| 1653 | 0x000400fa,0x00001095,0x00001096,0x0000109c, | ||
| 1654 | 0x000200f8,0x00001096,0x00050051,0x00000006, | ||
| 1655 | 0x00001098,0x00001d58,0x00000000,0x000500b0, | ||
| 1656 | 0x00000012,0x0000109b,0x00001098,0x0000105b, | ||
| 1657 | 0x000200f9,0x0000109c,0x000200f8,0x0000109c, | ||
| 1658 | 0x000700f5,0x00000012,0x0000109d,0x00001095, | ||
| 1659 | 0x00001090,0x0000109b,0x00001096,0x000200f9, | ||
| 1660 | 0x0000109e,0x000200f8,0x0000109e,0x000700f5, | ||
| 1661 | 0x00000012,0x0000109f,0x0000108e,0x00001019, | ||
| 1662 | 0x0000109d,0x0000109c,0x000300f7,0x00001029, | ||
| 1663 | 0x00000000,0x000400fa,0x0000109f,0x00001024, | ||
| 1664 | 0x00001026,0x000200f8,0x00001026,0x00050080, | ||
| 1665 | 0x00000006,0x00001028,0x0000101d,0x00000063, | ||
| 1666 | 0x000200f9,0x00001029,0x000200f8,0x00001024, | ||
| 1667 | 0x000200f9,0x00001029,0x000200f8,0x00001029, | ||
| 1668 | 0x000700f5,0x00000006,0x0000214e,0x00001d59, | ||
| 1669 | 0x00001024,0x00001028,0x00001026,0x000600a9, | ||
| 1670 | 0x00000006,0x0000219e,0x0000109f,0x0000101d, | ||
| 1671 | 0x00001d5a,0x000200f9,0x0000102a,0x000200f8, | ||
| 1672 | 0x0000102a,0x000200f9,0x00001014,0x000200f8, | ||
| 1673 | 0x0000102b,0x000500aa,0x00000012,0x0000102d, | ||
| 1674 | 0x00001d59,0x00000058,0x000300f7,0x0000102f, | ||
| 1675 | 0x00000000,0x000400fa,0x0000102d,0x0000102e, | ||
| 1676 | 0x0000102f,0x000200f8,0x0000102e,0x000200f9, | ||
| 1677 | 0x00001042,0x000200f8,0x0000102f,0x00050082, | ||
| 1678 | 0x00000006,0x00001031,0x00001d59,0x00000063, | ||
| 1679 | 0x00050084,0x00000006,0x00001032,0x0000009e, | ||
| 1680 | 0x00001031,0x00050080,0x00000006,0x00001033, | ||
| 1681 | 0x00001032,0x000000d8,0x00050051,0x00000006, | ||
| 1682 | 0x000010bd,0x00000db9,0x00000000,0x00050084, | ||
| 1683 | 0x00000006,0x000010bf,0x00001033,0x0000009e, | ||
| 1684 | 0x00050095,0x0000005e,0x000010c0,0x000010bd, | ||
| 1685 | 0x000010bf,0x00050051,0x00000006,0x000010c1, | ||
| 1686 | 0x000010c0,0x00000001,0x00050051,0x00000006, | ||
| 1687 | 0x000010c2,0x000010c0,0x00000000,0x00050051, | ||
| 1688 | 0x00000006,0x000010c5,0x00000db9,0x00000001, | ||
| 1689 | 0x00050080,0x00000006,0x000010c7,0x000010c5, | ||
| 1690 | 0x000010c1,0x00050050,0x00000007,0x000010c8, | ||
| 1691 | 0x000010c2,0x000010c7,0x0004007c,0x000000b1, | ||
| 1692 | 0x000010b5,0x000010c8,0x00060041,0x000000b7, | ||
| 1693 | 0x000010b6,0x000010b5,0x000000b6,0x000000b6, | ||
| 1694 | 0x0006003d,0x00000006,0x000010b7,0x000010b6, | ||
| 1695 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 1696 | 0x000010aa,0x00001032,0x000000de,0x00050084, | ||
| 1697 | 0x00000006,0x000010da,0x000010aa,0x0000009e, | ||
| 1698 | 0x00050095,0x0000005e,0x000010db,0x000010bd, | ||
| 1699 | 0x000010da,0x00050051,0x00000006,0x000010dc, | ||
| 1700 | 0x000010db,0x00000001,0x00050051,0x00000006, | ||
| 1701 | 0x000010dd,0x000010db,0x00000000,0x00050080, | ||
| 1702 | 0x00000006,0x000010e2,0x000010c5,0x000010dc, | ||
| 1703 | 0x00050050,0x00000007,0x000010e3,0x000010dd, | ||
| 1704 | 0x000010e2,0x0004007c,0x000000b1,0x000010d0, | ||
| 1705 | 0x000010e3,0x00060041,0x000000b7,0x000010d1, | ||
| 1706 | 0x000010d0,0x000000b6,0x000000b6,0x0006003d, | ||
| 1707 | 0x00000006,0x000010d2,0x000010d1,0x00000002, | ||
| 1708 | 0x00000004,0x00050051,0x00000006,0x000010e7, | ||
| 1709 | 0x00001d58,0x00000001,0x000500b0,0x00000012, | ||
| 1710 | 0x000010ea,0x000010e7,0x000010d2,0x000400a8, | ||
| 1711 | 0x00000012,0x000010eb,0x000010ea,0x000300f7, | ||
| 1712 | 0x000010fa,0x00000000,0x000400fa,0x000010eb, | ||
| 1713 | 0x000010ec,0x000010fa,0x000200f8,0x000010ec, | ||
| 1714 | 0x000500aa,0x00000012,0x000010f1,0x000010e7, | ||
| 1715 | 0x000010d2,0x000300f7,0x000010f8,0x00000000, | ||
| 1716 | 0x000400fa,0x000010f1,0x000010f2,0x000010f8, | ||
| 1717 | 0x000200f8,0x000010f2,0x00050051,0x00000006, | ||
| 1718 | 0x000010f4,0x00001d58,0x00000000,0x000500b0, | ||
| 1719 | 0x00000012,0x000010f7,0x000010f4,0x000010b7, | ||
| 1720 | 0x000200f9,0x000010f8,0x000200f8,0x000010f8, | ||
| 1721 | 0x000700f5,0x00000012,0x000010f9,0x000010f1, | ||
| 1722 | 0x000010ec,0x000010f7,0x000010f2,0x000200f9, | ||
| 1723 | 0x000010fa,0x000200f8,0x000010fa,0x000700f5, | ||
| 1724 | 0x00000012,0x000010fb,0x000010ea,0x0000102f, | ||
| 1725 | 0x000010f9,0x000010f8,0x000300f7,0x00001040, | ||
| 1726 | 0x00000000,0x000400fa,0x000010fb,0x00001039, | ||
| 1727 | 0x00001040,0x000200f8,0x00001039,0x00050051, | ||
| 1728 | 0x00000006,0x00001103,0x00001d58,0x00000000, | ||
| 1729 | 0x00050096,0x0000005e,0x00001104,0x000010b7, | ||
| 1730 | 0x00001103,0x00050051,0x00000006,0x00001105, | ||
| 1731 | 0x00001104,0x00000001,0x00050051,0x00000006, | ||
| 1732 | 0x00001106,0x00001104,0x00000000,0x00050082, | ||
| 1733 | 0x00000006,0x0000110c,0x000010d2,0x000010e7, | ||
| 1734 | 0x00050082,0x00000006,0x0000110e,0x0000110c, | ||
| 1735 | 0x00001105,0x00050051,0x00000006,0x00001115, | ||
| 1736 | 0x00000db7,0x00000001,0x000500b0,0x00000012, | ||
| 1737 | 0x00001116,0x0000110e,0x00001115,0x000400a8, | ||
| 1738 | 0x00000012,0x00001117,0x00001116,0x000300f7, | ||
| 1739 | 0x00001126,0x00000000,0x000400fa,0x00001117, | ||
| 1740 | 0x00001118,0x00001126,0x000200f8,0x00001118, | ||
| 1741 | 0x000500aa,0x00000012,0x0000111d,0x0000110e, | ||
| 1742 | 0x00001115,0x000300f7,0x00001124,0x00000000, | ||
| 1743 | 0x000400fa,0x0000111d,0x0000111e,0x00001124, | ||
| 1744 | 0x000200f8,0x0000111e,0x00050051,0x00000006, | ||
| 1745 | 0x00001122,0x00000db7,0x00000000,0x000500b0, | ||
| 1746 | 0x00000012,0x00001123,0x00001106,0x00001122, | ||
| 1747 | 0x000200f9,0x00001124,0x000200f8,0x00001124, | ||
| 1748 | 0x000700f5,0x00000012,0x00001125,0x0000111d, | ||
| 1749 | 0x00001118,0x00001123,0x0000111e,0x000200f9, | ||
| 1750 | 0x00001126,0x000200f8,0x00001126,0x000700f5, | ||
| 1751 | 0x00000012,0x00001127,0x00001116,0x00001039, | ||
| 1752 | 0x00001125,0x00001124,0x000400a8,0x00000012, | ||
| 1753 | 0x0000103f,0x00001127,0x000200f9,0x00001040, | ||
| 1754 | 0x000200f8,0x00001040,0x000700f5,0x00000012, | ||
| 1755 | 0x00001041,0x000010fb,0x000010fa,0x0000103f, | ||
| 1756 | 0x00001126,0x000200f9,0x00001042,0x000200f8, | ||
| 1757 | 0x00001042,0x000700f5,0x00000012,0x00001d5b, | ||
| 1758 | 0x0000011e,0x0000102e,0x00001041,0x00001040, | ||
| 1759 | 0x000200f9,0x00000dbe,0x000200f8,0x00000dbe, | ||
| 1760 | 0x000700f5,0x00000012,0x00000dbf,0x00000dab, | ||
| 1761 | 0x00000da8,0x00001d5b,0x00001042,0x000300f7, | ||
| 1762 | 0x00000dc1,0x00000000,0x000400fa,0x00000dbf, | ||
| 1763 | 0x00000dc0,0x00000dc1,0x000200f8,0x00000dc0, | ||
| 1764 | 0x000200f9,0x00000e39,0x000200f8,0x00000dc1, | ||
| 1765 | 0x000500c6,0x00000006,0x0000112e,0x000000cb, | ||
| 1766 | 0x00000d24,0x00050084,0x00000006,0x0000112f, | ||
| 1767 | 0x0000112e,0x000000d0,0x000500c6,0x00000006, | ||
| 1768 | 0x00001133,0x0000112f,0x00000d26,0x00050084, | ||
| 1769 | 0x00000006,0x00001134,0x00001133,0x000000d0, | ||
| 1770 | 0x000500c6,0x00000006,0x00001138,0x00001134, | ||
| 1771 | 0x00000d3c,0x00050084,0x00000006,0x00001139, | ||
| 1772 | 0x00001138,0x000000d0,0x000500c6,0x00000006, | ||
| 1773 | 0x0000113d,0x00001139,0x000004b6,0x00050084, | ||
| 1774 | 0x00000006,0x0000113e,0x0000113d,0x000000d0, | ||
| 1775 | 0x000500c2,0x00000006,0x00001140,0x0000113e, | ||
| 1776 | 0x000000e4,0x000500c6,0x00000006,0x00001142, | ||
| 1777 | 0x0000113e,0x00001140,0x00050084,0x00000006, | ||
| 1778 | 0x00001144,0x00001142,0x000000e8,0x000500c2, | ||
| 1779 | 0x00000006,0x00001146,0x00001144,0x000000ec, | ||
| 1780 | 0x000500c6,0x00000006,0x00001148,0x00001144, | ||
| 1781 | 0x00001146,0x00050084,0x00000006,0x0000114a, | ||
| 1782 | 0x00001148,0x000000f0,0x000500c2,0x00000006, | ||
| 1783 | 0x0000114c,0x0000114a,0x000000e4,0x000500c6, | ||
| 1784 | 0x00000006,0x0000114e,0x0000114a,0x0000114c, | ||
| 1785 | 0x000200f9,0x00000dc4,0x000200f8,0x00000dc4, | ||
| 1786 | 0x000700f5,0x00000006,0x00001d6c,0x00000058, | ||
| 1787 | 0x00000dc1,0x00000e22,0x00000e20,0x000500b0, | ||
| 1788 | 0x00000012,0x00000dc7,0x00001d6c,0x0000034a, | ||
| 1789 | 0x000400f6,0x00000e23,0x00000e20,0x00000000, | ||
| 1790 | 0x000400fa,0x00000dc7,0x00000dc8,0x00000e23, | ||
| 1791 | 0x000200f8,0x00000dc8,0x00050080,0x00000006, | ||
| 1792 | 0x00000dcb,0x0000114e,0x00001d6c,0x00050041, | ||
| 1793 | 0x00000182,0x00000dcc,0x00000180,0x000000ec, | ||
| 1794 | 0x0004003d,0x00000006,0x00000dcd,0x00000dcc, | ||
| 1795 | 0x000500c7,0x00000006,0x00000dce,0x00000dcb, | ||
| 1796 | 0x00000dcd,0x00050084,0x00000006,0x00000dcf, | ||
| 1797 | 0x000002ab,0x00000dce,0x00050080,0x00000006, | ||
| 1798 | 0x00000dd1,0x00000dcf,0x00000357,0x00050041, | ||
| 1799 | 0x0000020a,0x00000dd2,0x00000180,0x00000355, | ||
| 1800 | 0x0004003d,0x00000007,0x00000dd3,0x00000dd2, | ||
| 1801 | 0x00050051,0x00000006,0x0000115f,0x00000dd3, | ||
| 1802 | 0x00000000,0x00050084,0x00000006,0x00001161, | ||
| 1803 | 0x00000dd1,0x0000009e,0x00050095,0x0000005e, | ||
| 1804 | 0x00001162,0x0000115f,0x00001161,0x00050051, | ||
| 1805 | 0x00000006,0x00001163,0x00001162,0x00000001, | ||
| 1806 | 0x00050051,0x00000006,0x00001164,0x00001162, | ||
| 1807 | 0x00000000,0x00050051,0x00000006,0x00001167, | ||
| 1808 | 0x00000dd3,0x00000001,0x00050080,0x00000006, | ||
| 1809 | 0x00001169,0x00001167,0x00001163,0x00050050, | ||
| 1810 | 0x00000007,0x0000116a,0x00001164,0x00001169, | ||
| 1811 | 0x0004007c,0x000000b1,0x00001157,0x0000116a, | ||
| 1812 | 0x00060041,0x000000b7,0x00001158,0x00001157, | ||
| 1813 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 1814 | 0x00001159,0x00001158,0x00000002,0x00000004, | ||
| 1815 | 0x000500c2,0x00000006,0x00000dd5,0x00001159, | ||
| 1816 | 0x000000e4,0x000500c7,0x00000006,0x00000dd7, | ||
| 1817 | 0x00000dd5,0x00000063,0x000500aa,0x00000012, | ||
| 1818 | 0x00000dd8,0x00000dd7,0x00000058,0x000300f7, | ||
| 1819 | 0x00000dda,0x00000000,0x000400fa,0x00000dd8, | ||
| 1820 | 0x00000dd9,0x00000dda,0x000200f8,0x00000dd9, | ||
| 1821 | 0x000200f9,0x00000e20,0x000200f8,0x00000dda, | ||
| 1822 | 0x00050084,0x00000006,0x0000117c,0x00000dce, | ||
| 1823 | 0x0000218f,0x00050095,0x0000005e,0x0000117d, | ||
| 1824 | 0x0000115f,0x0000117c,0x00050051,0x00000006, | ||
| 1825 | 0x0000117e,0x0000117d,0x00000001,0x00050051, | ||
| 1826 | 0x00000006,0x0000117f,0x0000117d,0x00000000, | ||
| 1827 | 0x00050080,0x00000006,0x00001184,0x00001167, | ||
| 1828 | 0x0000117e,0x00050050,0x00000007,0x00001185, | ||
| 1829 | 0x0000117f,0x00001184,0x0004007c,0x000000b1, | ||
| 1830 | 0x00001172,0x00001185,0x00060041,0x000000b7, | ||
| 1831 | 0x00001173,0x00001172,0x000000b6,0x000000b6, | ||
| 1832 | 0x0006003d,0x00000006,0x00001174,0x00001173, | ||
| 1833 | 0x00000002,0x00000004,0x000500ab,0x00000012, | ||
| 1834 | 0x00000de1,0x00001174,0x00000d24,0x000400a8, | ||
| 1835 | 0x00000012,0x00000de2,0x00000de1,0x000300f7, | ||
| 1836 | 0x00000dec,0x00000000,0x000400fa,0x00000de2, | ||
| 1837 | 0x00000de3,0x00000dec,0x000200f8,0x00000de3, | ||
| 1838 | 0x00050080,0x00000006,0x00000de5,0x00000dcf, | ||
| 1839 | 0x00000063,0x00050084,0x00000006,0x00001197, | ||
| 1840 | 0x00000de5,0x0000009e,0x00050095,0x0000005e, | ||
| 1841 | 0x00001198,0x0000115f,0x00001197,0x00050051, | ||
| 1842 | 0x00000006,0x00001199,0x00001198,0x00000001, | ||
| 1843 | 0x00050051,0x00000006,0x0000119a,0x00001198, | ||
| 1844 | 0x00000000,0x00050080,0x00000006,0x0000119f, | ||
| 1845 | 0x00001167,0x00001199,0x00050050,0x00000007, | ||
| 1846 | 0x000011a0,0x0000119a,0x0000119f,0x0004007c, | ||
| 1847 | 0x000000b1,0x0000118d,0x000011a0,0x00060041, | ||
| 1848 | 0x000000b7,0x0000118e,0x0000118d,0x000000b6, | ||
| 1849 | 0x000000b6,0x0006003d,0x00000006,0x0000118f, | ||
| 1850 | 0x0000118e,0x00000002,0x00000004,0x000500ab, | ||
| 1851 | 0x00000012,0x00000deb,0x0000118f,0x00000d26, | ||
| 1852 | 0x000200f9,0x00000dec,0x000200f8,0x00000dec, | ||
| 1853 | 0x000700f5,0x00000012,0x00000ded,0x00000de1, | ||
| 1854 | 0x00000dda,0x00000deb,0x00000de3,0x000400a8, | ||
| 1855 | 0x00000012,0x00000dee,0x00000ded,0x000300f7, | ||
| 1856 | 0x00000df8,0x00000000,0x000400fa,0x00000dee, | ||
| 1857 | 0x00000def,0x00000df8,0x000200f8,0x00000def, | ||
| 1858 | 0x00050080,0x00000006,0x00000df1,0x00000dcf, | ||
| 1859 | 0x000000d8,0x00050084,0x00000006,0x000011b2, | ||
| 1860 | 0x00000df1,0x0000009e,0x00050095,0x0000005e, | ||
| 1861 | 0x000011b3,0x0000115f,0x000011b2,0x00050051, | ||
| 1862 | 0x00000006,0x000011b4,0x000011b3,0x00000001, | ||
| 1863 | 0x00050051,0x00000006,0x000011b5,0x000011b3, | ||
| 1864 | 0x00000000,0x00050080,0x00000006,0x000011ba, | ||
| 1865 | 0x00001167,0x000011b4,0x00050050,0x00000007, | ||
| 1866 | 0x000011bb,0x000011b5,0x000011ba,0x0004007c, | ||
| 1867 | 0x000000b1,0x000011a8,0x000011bb,0x00060041, | ||
| 1868 | 0x000000b7,0x000011a9,0x000011a8,0x000000b6, | ||
| 1869 | 0x000000b6,0x0006003d,0x00000006,0x000011aa, | ||
| 1870 | 0x000011a9,0x00000002,0x00000004,0x000500ab, | ||
| 1871 | 0x00000012,0x00000df7,0x000011aa,0x00000d3c, | ||
| 1872 | 0x000200f9,0x00000df8,0x000200f8,0x00000df8, | ||
| 1873 | 0x000700f5,0x00000012,0x00000df9,0x00000ded, | ||
| 1874 | 0x00000dec,0x00000df7,0x00000def,0x000400a8, | ||
| 1875 | 0x00000012,0x00000dfa,0x00000df9,0x000300f7, | ||
| 1876 | 0x00000e04,0x00000000,0x000400fa,0x00000dfa, | ||
| 1877 | 0x00000dfb,0x00000e04,0x000200f8,0x00000dfb, | ||
| 1878 | 0x00050080,0x00000006,0x00000dfd,0x00000dcf, | ||
| 1879 | 0x000000de,0x00050084,0x00000006,0x000011cd, | ||
| 1880 | 0x00000dfd,0x0000009e,0x00050095,0x0000005e, | ||
| 1881 | 0x000011ce,0x0000115f,0x000011cd,0x00050051, | ||
| 1882 | 0x00000006,0x000011cf,0x000011ce,0x00000001, | ||
| 1883 | 0x00050051,0x00000006,0x000011d0,0x000011ce, | ||
| 1884 | 0x00000000,0x00050080,0x00000006,0x000011d5, | ||
| 1885 | 0x00001167,0x000011cf,0x00050050,0x00000007, | ||
| 1886 | 0x000011d6,0x000011d0,0x000011d5,0x0004007c, | ||
| 1887 | 0x000000b1,0x000011c3,0x000011d6,0x00060041, | ||
| 1888 | 0x000000b7,0x000011c4,0x000011c3,0x000000b6, | ||
| 1889 | 0x000000b6,0x0006003d,0x00000006,0x000011c5, | ||
| 1890 | 0x000011c4,0x00000002,0x00000004,0x000500ab, | ||
| 1891 | 0x00000012,0x00000e03,0x000011c5,0x000004b6, | ||
| 1892 | 0x000200f9,0x00000e04,0x000200f8,0x00000e04, | ||
| 1893 | 0x000700f5,0x00000012,0x00000e05,0x00000df9, | ||
| 1894 | 0x00000df8,0x00000e03,0x00000dfb,0x000300f7, | ||
| 1895 | 0x00000e07,0x00000000,0x000400fa,0x00000e05, | ||
| 1896 | 0x00000e06,0x00000e07,0x000200f8,0x00000e06, | ||
| 1897 | 0x000200f9,0x00000e20,0x000200f8,0x00000e07, | ||
| 1898 | 0x000500c7,0x00000006,0x00000e09,0x00000dd5, | ||
| 1899 | 0x000000d8,0x000500ab,0x00000012,0x00000e0a, | ||
| 1900 | 0x00000e09,0x00000058,0x000300f7,0x00000e1f, | ||
| 1901 | 0x00000000,0x000400fa,0x00000e0a,0x00000e0b, | ||
| 1902 | 0x00000e0f,0x000200f8,0x00000e0f,0x00050080, | ||
| 1903 | 0x00000006,0x00000e11,0x00000dcf,0x0000009e, | ||
| 1904 | 0x00050084,0x00000006,0x000011ec,0x00000e11, | ||
| 1905 | 0x0000009e,0x00050095,0x0000005e,0x000011ed, | ||
| 1906 | 0x0000115f,0x000011ec,0x00050051,0x00000006, | ||
| 1907 | 0x000011ee,0x000011ed,0x00000001,0x00050051, | ||
| 1908 | 0x00000006,0x000011ef,0x000011ed,0x00000000, | ||
| 1909 | 0x00050080,0x00000006,0x000011f4,0x00001167, | ||
| 1910 | 0x000011ee,0x00050050,0x00000007,0x000011f5, | ||
| 1911 | 0x000011ef,0x000011f4,0x0004007c,0x000000b1, | ||
| 1912 | 0x000011e2,0x000011f5,0x00060041,0x000000b7, | ||
| 1913 | 0x000011e3,0x000011e2,0x000000b6,0x000000b6, | ||
| 1914 | 0x0006003d,0x00000006,0x000011e4,0x000011e3, | ||
| 1915 | 0x00000002,0x00000004,0x0006003d,0x00000006, | ||
| 1916 | 0x000011ff,0x00001158,0x00000002,0x00000004, | ||
| 1917 | 0x00060052,0x00000027,0x00001be0,0x000011e4, | ||
| 1918 | 0x0000219c,0x00000000,0x000500c7,0x00000006, | ||
| 1919 | 0x00001217,0x00000d26,0x00000191,0x000500c7, | ||
| 1920 | 0x00000006,0x0000121a,0x000011ff,0x0000017b, | ||
| 1921 | 0x000500c5,0x00000006,0x0000121b,0x00001217, | ||
| 1922 | 0x0000121a,0x00060052,0x00000027,0x00001be4, | ||
| 1923 | 0x0000121b,0x00001be0,0x00000001,0x000200f9, | ||
| 1924 | 0x00000e1f,0x000200f8,0x00000e0b,0x00060052, | ||
| 1925 | 0x00000027,0x00001bd5,0x00000058,0x0000219c, | ||
| 1926 | 0x00000000,0x00060052,0x00000027,0x00001bd7, | ||
| 1927 | 0x00000058,0x00001bd5,0x00000001,0x00060052, | ||
| 1928 | 0x00000027,0x00001bd9,0x00000058,0x00001bd7, | ||
| 1929 | 0x00000002,0x000200f9,0x00000e1f,0x000200f8, | ||
| 1930 | 0x00000e1f,0x000700f5,0x00000027,0x00001d86, | ||
| 1931 | 0x00001bd9,0x00000e0b,0x00001be4,0x00000e0f, | ||
| 1932 | 0x000200f9,0x00000e23,0x000200f8,0x00000e20, | ||
| 1933 | 0x00050080,0x00000006,0x00000e22,0x00001d6c, | ||
| 1934 | 0x000003bc,0x000200f9,0x00000dc4,0x000200f8, | ||
| 1935 | 0x00000e23,0x000700f5,0x00000006,0x00001d91, | ||
| 1936 | 0x00001da1,0x00000dc4,0x00000063,0x00000e1f, | ||
| 1937 | 0x000700f5,0x00000027,0x00001d85,0x0000219c, | ||
| 1938 | 0x00000dc4,0x00001d86,0x00000e1f,0x000700f5, | ||
| 1939 | 0x00000012,0x00001d71,0x0000011e,0x00000dc4, | ||
| 1940 | 0x00000217,0x00000e1f,0x000300f7,0x00000e25, | ||
| 1941 | 0x00000000,0x000400fa,0x00001d71,0x00000e39, | ||
| 1942 | 0x00000e25,0x000200f8,0x00000e25,0x00060052, | ||
| 1943 | 0x00000027,0x00001be6,0x00000058,0x00001d85, | ||
| 1944 | 0x00000000,0x00060052,0x00000027,0x00001be8, | ||
| 1945 | 0x00000058,0x00001be6,0x00000001,0x00060052, | ||
| 1946 | 0x00000027,0x00001bea,0x00000058,0x00001be8, | ||
| 1947 | 0x00000002,0x000500c7,0x00000006,0x00000e2b, | ||
| 1948 | 0x00000438,0x000000d8,0x000500ab,0x00000012, | ||
| 1949 | 0x00000e2c,0x00000e2b,0x00000058,0x000300f7, | ||
| 1950 | 0x00000e35,0x00000000,0x000400fa,0x00000e2c, | ||
| 1951 | 0x00000e2d,0x00000e35,0x000200f8,0x00000e2d, | ||
| 1952 | 0x00050041,0x0000020a,0x00000e2e,0x00000180, | ||
| 1953 | 0x000003c8,0x0004003d,0x00000007,0x00000e2f, | ||
| 1954 | 0x00000e2e,0x00050041,0x00000182,0x00000e30, | ||
| 1955 | 0x00000180,0x000003c9,0x0004003d,0x00000006, | ||
| 1956 | 0x00000e31,0x00000e30,0x000300f7,0x00001265, | ||
| 1957 | 0x00000000,0x000300fb,0x00000058,0x00001235, | ||
| 1958 | 0x000200f8,0x00001235,0x000200f9,0x00001237, | ||
| 1959 | 0x000200f8,0x00001237,0x000700f5,0x00000006, | ||
| 1960 | 0x00001d88,0x00000e31,0x00001235,0x0000219f, | ||
| 1961 | 0x0000124d,0x000700f5,0x00000006,0x00001d87, | ||
| 1962 | 0x00000058,0x00001235,0x00002165,0x0000124d, | ||
| 1963 | 0x000500b0,0x00000012,0x0000123b,0x00001d87, | ||
| 1964 | 0x00001d88,0x000400f6,0x0000124e,0x0000124d, | ||
| 1965 | 0x00000000,0x000400fa,0x0000123b,0x0000123c, | ||
| 1966 | 0x0000124e,0x000200f8,0x0000123c,0x00050080, | ||
| 1967 | 0x00000006,0x0000123f,0x00001d87,0x00001d88, | ||
| 1968 | 0x000500c2,0x00000006,0x00001240,0x0000123f, | ||
| 1969 | 0x00000063,0x00050084,0x00000006,0x00001242, | ||
| 1970 | 0x0000009e,0x00001240,0x00050051,0x00000006, | ||
| 1971 | 0x00001284,0x00000e2f,0x00000000,0x00050084, | ||
| 1972 | 0x00000006,0x00001286,0x00001240,0x0000034a, | ||
| 1973 | 0x00050095,0x0000005e,0x00001287,0x00001284, | ||
| 1974 | 0x00001286,0x00050051,0x00000006,0x00001288, | ||
| 1975 | 0x00001287,0x00000001,0x00050051,0x00000006, | ||
| 1976 | 0x00001289,0x00001287,0x00000000,0x00050051, | ||
| 1977 | 0x00000006,0x0000128c,0x00000e2f,0x00000001, | ||
| 1978 | 0x00050080,0x00000006,0x0000128e,0x0000128c, | ||
| 1979 | 0x00001288,0x00050050,0x00000007,0x0000128f, | ||
| 1980 | 0x00001289,0x0000128e,0x0004007c,0x000000b1, | ||
| 1981 | 0x0000127c,0x0000128f,0x00060041,0x000000b7, | ||
| 1982 | 0x0000127d,0x0000127c,0x000000b6,0x000000b6, | ||
| 1983 | 0x0006003d,0x00000006,0x0000127e,0x0000127d, | ||
| 1984 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 1985 | 0x00001271,0x00001242,0x00000063,0x00050084, | ||
| 1986 | 0x00000006,0x000012a1,0x00001271,0x0000009e, | ||
| 1987 | 0x00050095,0x0000005e,0x000012a2,0x00001284, | ||
| 1988 | 0x000012a1,0x00050051,0x00000006,0x000012a3, | ||
| 1989 | 0x000012a2,0x00000001,0x00050051,0x00000006, | ||
| 1990 | 0x000012a4,0x000012a2,0x00000000,0x00050080, | ||
| 1991 | 0x00000006,0x000012a9,0x0000128c,0x000012a3, | ||
| 1992 | 0x00050050,0x00000007,0x000012aa,0x000012a4, | ||
| 1993 | 0x000012a9,0x0004007c,0x000000b1,0x00001297, | ||
| 1994 | 0x000012aa,0x00060041,0x000000b7,0x00001298, | ||
| 1995 | 0x00001297,0x000000b6,0x000000b6,0x0006003d, | ||
| 1996 | 0x00000006,0x00001299,0x00001298,0x00000002, | ||
| 1997 | 0x00000004,0x000500b0,0x00000012,0x000012b1, | ||
| 1998 | 0x00000d27,0x00001299,0x000400a8,0x00000012, | ||
| 1999 | 0x000012b2,0x000012b1,0x000300f7,0x000012c1, | ||
| 2000 | 0x00000000,0x000400fa,0x000012b2,0x000012b3, | ||
| 2001 | 0x000012c1,0x000200f8,0x000012b3,0x000500aa, | ||
| 2002 | 0x00000012,0x000012b8,0x00000d27,0x00001299, | ||
| 2003 | 0x000300f7,0x000012bf,0x00000000,0x000400fa, | ||
| 2004 | 0x000012b8,0x000012b9,0x000012bf,0x000200f8, | ||
| 2005 | 0x000012b9,0x000500b0,0x00000012,0x000012be, | ||
| 2006 | 0x00000d24,0x0000127e,0x000200f9,0x000012bf, | ||
| 2007 | 0x000200f8,0x000012bf,0x000700f5,0x00000012, | ||
| 2008 | 0x000012c0,0x000012b8,0x000012b3,0x000012be, | ||
| 2009 | 0x000012b9,0x000200f9,0x000012c1,0x000200f8, | ||
| 2010 | 0x000012c1,0x000700f5,0x00000012,0x000012c2, | ||
| 2011 | 0x000012b1,0x0000123c,0x000012c0,0x000012bf, | ||
| 2012 | 0x000300f7,0x0000124c,0x00000000,0x000400fa, | ||
| 2013 | 0x000012c2,0x00001247,0x00001249,0x000200f8, | ||
| 2014 | 0x00001249,0x00050080,0x00000006,0x0000124b, | ||
| 2015 | 0x00001240,0x00000063,0x000200f9,0x0000124c, | ||
| 2016 | 0x000200f8,0x00001247,0x000200f9,0x0000124c, | ||
| 2017 | 0x000200f8,0x0000124c,0x000700f5,0x00000006, | ||
| 2018 | 0x00002165,0x00001d87,0x00001247,0x0000124b, | ||
| 2019 | 0x00001249,0x000600a9,0x00000006,0x0000219f, | ||
| 2020 | 0x000012c2,0x00001240,0x00001d88,0x000200f9, | ||
| 2021 | 0x0000124d,0x000200f8,0x0000124d,0x000200f9, | ||
| 2022 | 0x00001237,0x000200f8,0x0000124e,0x000500aa, | ||
| 2023 | 0x00000012,0x00001250,0x00001d87,0x00000058, | ||
| 2024 | 0x000300f7,0x00001252,0x00000000,0x000400fa, | ||
| 2025 | 0x00001250,0x00001251,0x00001252,0x000200f8, | ||
| 2026 | 0x00001251,0x000200f9,0x00001265,0x000200f8, | ||
| 2027 | 0x00001252,0x00050082,0x00000006,0x00001254, | ||
| 2028 | 0x00001d87,0x00000063,0x00050084,0x00000006, | ||
| 2029 | 0x00001255,0x0000009e,0x00001254,0x00050080, | ||
| 2030 | 0x00000006,0x00001256,0x00001255,0x000000d8, | ||
| 2031 | 0x00050051,0x00000006,0x000012e0,0x00000e2f, | ||
| 2032 | 0x00000000,0x00050084,0x00000006,0x000012e2, | ||
| 2033 | 0x00001256,0x0000009e,0x00050095,0x0000005e, | ||
| 2034 | 0x000012e3,0x000012e0,0x000012e2,0x00050051, | ||
| 2035 | 0x00000006,0x000012e4,0x000012e3,0x00000001, | ||
| 2036 | 0x00050051,0x00000006,0x000012e5,0x000012e3, | ||
| 2037 | 0x00000000,0x00050051,0x00000006,0x000012e8, | ||
| 2038 | 0x00000e2f,0x00000001,0x00050080,0x00000006, | ||
| 2039 | 0x000012ea,0x000012e8,0x000012e4,0x00050050, | ||
| 2040 | 0x00000007,0x000012eb,0x000012e5,0x000012ea, | ||
| 2041 | 0x0004007c,0x000000b1,0x000012d8,0x000012eb, | ||
| 2042 | 0x00060041,0x000000b7,0x000012d9,0x000012d8, | ||
| 2043 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 2044 | 0x000012da,0x000012d9,0x00000002,0x00000004, | ||
| 2045 | 0x00050080,0x00000006,0x000012cd,0x00001255, | ||
| 2046 | 0x000000de,0x00050084,0x00000006,0x000012fd, | ||
| 2047 | 0x000012cd,0x0000009e,0x00050095,0x0000005e, | ||
| 2048 | 0x000012fe,0x000012e0,0x000012fd,0x00050051, | ||
| 2049 | 0x00000006,0x000012ff,0x000012fe,0x00000001, | ||
| 2050 | 0x00050051,0x00000006,0x00001300,0x000012fe, | ||
| 2051 | 0x00000000,0x00050080,0x00000006,0x00001305, | ||
| 2052 | 0x000012e8,0x000012ff,0x00050050,0x00000007, | ||
| 2053 | 0x00001306,0x00001300,0x00001305,0x0004007c, | ||
| 2054 | 0x000000b1,0x000012f3,0x00001306,0x00060041, | ||
| 2055 | 0x000000b7,0x000012f4,0x000012f3,0x000000b6, | ||
| 2056 | 0x000000b6,0x0006003d,0x00000006,0x000012f5, | ||
| 2057 | 0x000012f4,0x00000002,0x00000004,0x000500b0, | ||
| 2058 | 0x00000012,0x0000130d,0x00000d27,0x000012f5, | ||
| 2059 | 0x000400a8,0x00000012,0x0000130e,0x0000130d, | ||
| 2060 | 0x000300f7,0x0000131d,0x00000000,0x000400fa, | ||
| 2061 | 0x0000130e,0x0000130f,0x0000131d,0x000200f8, | ||
| 2062 | 0x0000130f,0x000500aa,0x00000012,0x00001314, | ||
| 2063 | 0x00000d27,0x000012f5,0x000300f7,0x0000131b, | ||
| 2064 | 0x00000000,0x000400fa,0x00001314,0x00001315, | ||
| 2065 | 0x0000131b,0x000200f8,0x00001315,0x000500b0, | ||
| 2066 | 0x00000012,0x0000131a,0x00000d24,0x000012da, | ||
| 2067 | 0x000200f9,0x0000131b,0x000200f8,0x0000131b, | ||
| 2068 | 0x000700f5,0x00000012,0x0000131c,0x00001314, | ||
| 2069 | 0x0000130f,0x0000131a,0x00001315,0x000200f9, | ||
| 2070 | 0x0000131d,0x000200f8,0x0000131d,0x000700f5, | ||
| 2071 | 0x00000012,0x0000131e,0x0000130d,0x00001252, | ||
| 2072 | 0x0000131c,0x0000131b,0x000300f7,0x00001263, | ||
| 2073 | 0x00000000,0x000400fa,0x0000131e,0x0000125c, | ||
| 2074 | 0x00001263,0x000200f8,0x0000125c,0x00050096, | ||
| 2075 | 0x0000005e,0x00001327,0x000012da,0x00000d24, | ||
| 2076 | 0x00050051,0x00000006,0x00001328,0x00001327, | ||
| 2077 | 0x00000001,0x00050051,0x00000006,0x00001329, | ||
| 2078 | 0x00001327,0x00000000,0x00050082,0x00000006, | ||
| 2079 | 0x0000132f,0x000012f5,0x00000d27,0x00050082, | ||
| 2080 | 0x00000006,0x00001331,0x0000132f,0x00001328, | ||
| 2081 | 0x000500aa,0x00000012,0x00001340,0x00001331, | ||
| 2082 | 0x00000058,0x000300f7,0x00001347,0x00000000, | ||
| 2083 | 0x000400fa,0x00001340,0x00001341,0x00001347, | ||
| 2084 | 0x000200f8,0x00001341,0x000500b0,0x00000012, | ||
| 2085 | 0x00001346,0x00001329,0x00000063,0x000200f9, | ||
| 2086 | 0x00001347,0x000200f8,0x00001347,0x000700f5, | ||
| 2087 | 0x00000012,0x00001348,0x00001340,0x0000125c, | ||
| 2088 | 0x00001346,0x00001341,0x000400a8,0x00000012, | ||
| 2089 | 0x00001262,0x00001348,0x000200f9,0x00001263, | ||
| 2090 | 0x000200f8,0x00001263,0x000700f5,0x00000012, | ||
| 2091 | 0x00001264,0x0000131e,0x0000131d,0x00001262, | ||
| 2092 | 0x00001347,0x000200f9,0x00001265,0x000200f8, | ||
| 2093 | 0x00001265,0x000700f5,0x00000012,0x00001d89, | ||
| 2094 | 0x0000011e,0x00001251,0x00001264,0x00001263, | ||
| 2095 | 0x000400a8,0x00000012,0x00000e34,0x00001d89, | ||
| 2096 | 0x000200f9,0x00000e35,0x000200f8,0x00000e35, | ||
| 2097 | 0x000700f5,0x00000012,0x00000e36,0x00000e2c, | ||
| 2098 | 0x00000e25,0x00000e34,0x00001265,0x000300f7, | ||
| 2099 | 0x00000e38,0x00000000,0x000400fa,0x00000e36, | ||
| 2100 | 0x00000e37,0x00000e38,0x000200f8,0x00000e37, | ||
| 2101 | 0x000200f9,0x00000e39,0x000200f8,0x00000e38, | ||
| 2102 | 0x000200f9,0x00000e39,0x000200f8,0x00000e39, | ||
| 2103 | 0x001100f5,0x00000027,0x00001df6,0x0000219c, | ||
| 2104 | 0x00000d21,0x00001b5a,0x00000d32,0x00001df7, | ||
| 2105 | 0x00000d94,0x0000219c,0x00000dc0,0x00001d85, | ||
| 2106 | 0x00000e23,0x00001bea,0x00000e37,0x00001bea, | ||
| 2107 | 0x00000e38,0x001100f5,0x00000006,0x00001d90, | ||
| 2108 | 0x00000058,0x00000d21,0x00000063,0x00000d32, | ||
| 2109 | 0x00000063,0x00000d94,0x00000063,0x00000dc0, | ||
| 2110 | 0x00001d91,0x00000e23,0x00000063,0x00000e37, | ||
| 2111 | 0x000000d8,0x00000e38,0x000500aa,0x00000012, | ||
| 2112 | 0x000004bf,0x00001d90,0x000000d8,0x000300f7, | ||
| 2113 | 0x000004c1,0x00000000,0x000400fa,0x000004bf, | ||
| 2114 | 0x000004c0,0x000004c1,0x000200f8,0x000004c0, | ||
| 2115 | 0x00050041,0x00000182,0x000004c3,0x00000180, | ||
| 2116 | 0x000004c2,0x0004003d,0x00000006,0x000004c4, | ||
| 2117 | 0x000004c3,0x000500c4,0x00000006,0x000004c6, | ||
| 2118 | 0x000004c4,0x000004c5,0x000500c4,0x00000006, | ||
| 2119 | 0x000004c8,0x0000044f,0x00000063,0x000500c5, | ||
| 2120 | 0x00000006,0x000004c9,0x000004c6,0x000004c8, | ||
| 2121 | 0x00050041,0x0000020a,0x0000134e,0x00000180, | ||
| 2122 | 0x000003dd,0x0004003d,0x00000007,0x0000134f, | ||
| 2123 | 0x0000134e,0x0004007c,0x000000b1,0x00001350, | ||
| 2124 | 0x0000134f,0x00060041,0x000000b7,0x00001352, | ||
| 2125 | 0x00001350,0x000000b6,0x000000b6,0x000700ea, | ||
| 2126 | 0x00000006,0x00001353,0x00001352,0x00000063, | ||
| 2127 | 0x00000058,0x00000063,0x00060041,0x000000b7, | ||
| 2128 | 0x00001356,0x00001350,0x000000b6,0x000003bc, | ||
| 2129 | 0x0006003d,0x00000006,0x00001357,0x00001356, | ||
| 2130 | 0x00000002,0x00000004,0x000500b0,0x00000012, | ||
| 2131 | 0x00001358,0x00001353,0x00001357,0x000300f7, | ||
| 2132 | 0x00001362,0x00000000,0x000400fa,0x00001358, | ||
| 2133 | 0x00001359,0x0000135f,0x000200f8,0x0000135f, | ||
| 2134 | 0x00060041,0x000000b7,0x00001361,0x00001350, | ||
| 2135 | 0x000000b6,0x000003f3,0x0005003e,0x00001361, | ||
| 2136 | 0x00000063,0x00000002,0x00000004,0x000200f9, | ||
| 2137 | 0x00001362,0x000200f8,0x00001359,0x00050080, | ||
| 2138 | 0x00000006,0x0000135c,0x0000009e,0x00001353, | ||
| 2139 | 0x00060041,0x000000b7,0x0000135e,0x00001350, | ||
| 2140 | 0x000000b6,0x0000135c,0x0005003e,0x0000135e, | ||
| 2141 | 0x000004c9,0x00000002,0x00000004,0x000200f9, | ||
| 2142 | 0x00001362,0x000200f8,0x00001362,0x000200f9, | ||
| 2143 | 0x000004c1,0x000200f8,0x000004c1,0x000300f7, | ||
| 2144 | 0x000014ce,0x00000000,0x000300fb,0x00000058, | ||
| 2145 | 0x000013aa,0x000200f8,0x000013aa,0x00050051, | ||
| 2146 | 0x00000006,0x000013ac,0x00000498,0x00000003, | ||
| 2147 | 0x000500c2,0x00000006,0x000013ad,0x000013ac, | ||
| 2148 | 0x0000019b,0x000500ab,0x00000012,0x000013ae, | ||
| 2149 | 0x000013ad,0x00000058,0x000400a8,0x00000012, | ||
| 2150 | 0x000013af,0x000013ae,0x000300f7,0x000013b4, | ||
| 2151 | 0x00000000,0x000400fa,0x000013af,0x000013b0, | ||
| 2152 | 0x000013b4,0x000200f8,0x000013b0,0x00050051, | ||
| 2153 | 0x00000006,0x000013b2,0x00000498,0x00000002, | ||
| 2154 | 0x000500aa,0x00000012,0x000013b3,0x000013b2, | ||
| 2155 | 0x00000058,0x000200f9,0x000013b4,0x000200f8, | ||
| 2156 | 0x000013b4,0x000700f5,0x00000012,0x000013b5, | ||
| 2157 | 0x000013ae,0x000013aa,0x000013b3,0x000013b0, | ||
| 2158 | 0x000300f7,0x000013b7,0x00000000,0x000400fa, | ||
| 2159 | 0x000013b5,0x000013b6,0x000013b7,0x000200f8, | ||
| 2160 | 0x000013b6,0x000200f9,0x000014ce,0x000200f8, | ||
| 2161 | 0x000013b7,0x00050051,0x00000006,0x000013b9, | ||
| 2162 | 0x00000498,0x00000000,0x00050051,0x00000006, | ||
| 2163 | 0x000013bb,0x00000498,0x00000001,0x000500c7, | ||
| 2164 | 0x00000006,0x000013bc,0x000013bb,0x0000017b, | ||
| 2165 | 0x00050050,0x00000007,0x000013bd,0x000013b9, | ||
| 2166 | 0x000013bc,0x000500aa,0x00000012,0x000013c0, | ||
| 2167 | 0x000013b9,0x00000058,0x000300f7,0x000013c5, | ||
| 2168 | 0x00000000,0x000400fa,0x000013c0,0x000013c1, | ||
| 2169 | 0x000013c5,0x000200f8,0x000013c1,0x000500aa, | ||
| 2170 | 0x00000012,0x000013c4,0x000013bc,0x00000058, | ||
| 2171 | 0x000200f9,0x000013c5,0x000200f8,0x000013c5, | ||
| 2172 | 0x000700f5,0x00000012,0x000013c6,0x000013c0, | ||
| 2173 | 0x000013b7,0x000013c4,0x000013c1,0x000300f7, | ||
| 2174 | 0x000013cb,0x00000000,0x000400fa,0x000013c6, | ||
| 2175 | 0x000013c7,0x000013cb,0x000200f8,0x000013c7, | ||
| 2176 | 0x00060052,0x00000027,0x00001c10,0x00000058, | ||
| 2177 | 0x00000498,0x00000000,0x00060052,0x00000027, | ||
| 2178 | 0x00001c12,0x00000058,0x00001c10,0x00000001, | ||
| 2179 | 0x00060052,0x00000027,0x00001c14,0x00000058, | ||
| 2180 | 0x00001c12,0x00000002,0x000200f9,0x000014ce, | ||
| 2181 | 0x000200f8,0x000013cb,0x000500c2,0x00000006, | ||
| 2182 | 0x000013ce,0x000013bb,0x000000e4,0x000500c7, | ||
| 2183 | 0x00000006,0x000013cf,0x000013ce,0x000001ad, | ||
| 2184 | 0x00050051,0x00000006,0x000013d1,0x00000498, | ||
| 2185 | 0x00000002,0x000500aa,0x00000012,0x000013d3, | ||
| 2186 | 0x000013cf,0x00000058,0x000600a9,0x00000006, | ||
| 2187 | 0x000013d5,0x000013d3,0x00000063,0x000013cf, | ||
| 2188 | 0x00050097,0x0000005e,0x000013d8,0x000013d1, | ||
| 2189 | 0x000013d5,0x00050051,0x00000006,0x000013d9, | ||
| 2190 | 0x000013d8,0x00000000,0x00050051,0x00000006, | ||
| 2191 | 0x000013da,0x000013d8,0x00000001,0x00050050, | ||
| 2192 | 0x00000007,0x00002190,0x000013d9,0x000013da, | ||
| 2193 | 0x00050041,0x00000182,0x000013db,0x00000180, | ||
| 2194 | 0x0000029a,0x0004003d,0x00000006,0x000013dc, | ||
| 2195 | 0x000013db,0x000200f9,0x000013dd,0x000200f8, | ||
| 2196 | 0x000013dd,0x000700f5,0x00000006,0x00001eae, | ||
| 2197 | 0x000013dc,0x000013cb,0x000021a0,0x000013f4, | ||
| 2198 | 0x000700f5,0x00000006,0x00001ead,0x00000058, | ||
| 2199 | 0x000013cb,0x0000216b,0x000013f4,0x000500b0, | ||
| 2200 | 0x00000012,0x000013e1,0x00001ead,0x00001eae, | ||
| 2201 | 0x000400f6,0x000013f5,0x000013f4,0x00000000, | ||
| 2202 | 0x000400fa,0x000013e1,0x000013e2,0x000013f5, | ||
| 2203 | 0x000200f8,0x000013e2,0x00050080,0x00000006, | ||
| 2204 | 0x000013e5,0x00001ead,0x00001eae,0x000500c2, | ||
| 2205 | 0x00000006,0x000013e6,0x000013e5,0x00000063, | ||
| 2206 | 0x00050084,0x00000006,0x000013e8,0x000002ab, | ||
| 2207 | 0x000013e6,0x00050041,0x0000020a,0x000013e9, | ||
| 2208 | 0x00000180,0x000002aa,0x0004003d,0x00000007, | ||
| 2209 | 0x000013ea,0x000013e9,0x00050051,0x00000006, | ||
| 2210 | 0x000014f1,0x000013ea,0x00000000,0x00050084, | ||
| 2211 | 0x00000006,0x000014f3,0x000013e6,0x0000218f, | ||
| 2212 | 0x00050095,0x0000005e,0x000014f4,0x000014f1, | ||
| 2213 | 0x000014f3,0x00050051,0x00000006,0x000014f5, | ||
| 2214 | 0x000014f4,0x00000001,0x00050051,0x00000006, | ||
| 2215 | 0x000014f6,0x000014f4,0x00000000,0x00050051, | ||
| 2216 | 0x00000006,0x000014f9,0x000013ea,0x00000001, | ||
| 2217 | 0x00050080,0x00000006,0x000014fb,0x000014f9, | ||
| 2218 | 0x000014f5,0x00050050,0x00000007,0x000014fc, | ||
| 2219 | 0x000014f6,0x000014fb,0x0004007c,0x000000b1, | ||
| 2220 | 0x000014e9,0x000014fc,0x00060041,0x000000b7, | ||
| 2221 | 0x000014ea,0x000014e9,0x000000b6,0x000000b6, | ||
| 2222 | 0x0006003d,0x00000006,0x000014eb,0x000014ea, | ||
| 2223 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 2224 | 0x000014de,0x000013e8,0x00000063,0x00050084, | ||
| 2225 | 0x00000006,0x0000150e,0x000014de,0x0000009e, | ||
| 2226 | 0x00050095,0x0000005e,0x0000150f,0x000014f1, | ||
| 2227 | 0x0000150e,0x00050051,0x00000006,0x00001510, | ||
| 2228 | 0x0000150f,0x00000001,0x00050051,0x00000006, | ||
| 2229 | 0x00001511,0x0000150f,0x00000000,0x00050080, | ||
| 2230 | 0x00000006,0x00001516,0x000014f9,0x00001510, | ||
| 2231 | 0x00050050,0x00000007,0x00001517,0x00001511, | ||
| 2232 | 0x00001516,0x0004007c,0x000000b1,0x00001504, | ||
| 2233 | 0x00001517,0x00060041,0x000000b7,0x00001505, | ||
| 2234 | 0x00001504,0x000000b6,0x000000b6,0x0006003d, | ||
| 2235 | 0x00000006,0x00001506,0x00001505,0x00000002, | ||
| 2236 | 0x00000004,0x000500b0,0x00000012,0x0000151e, | ||
| 2237 | 0x000013bc,0x00001506,0x000400a8,0x00000012, | ||
| 2238 | 0x0000151f,0x0000151e,0x000300f7,0x0000152e, | ||
| 2239 | 0x00000000,0x000400fa,0x0000151f,0x00001520, | ||
| 2240 | 0x0000152e,0x000200f8,0x00001520,0x000500aa, | ||
| 2241 | 0x00000012,0x00001525,0x000013bc,0x00001506, | ||
| 2242 | 0x000300f7,0x0000152c,0x00000000,0x000400fa, | ||
| 2243 | 0x00001525,0x00001526,0x0000152c,0x000200f8, | ||
| 2244 | 0x00001526,0x000500b0,0x00000012,0x0000152b, | ||
| 2245 | 0x000013b9,0x000014eb,0x000200f9,0x0000152c, | ||
| 2246 | 0x000200f8,0x0000152c,0x000700f5,0x00000012, | ||
| 2247 | 0x0000152d,0x00001525,0x00001520,0x0000152b, | ||
| 2248 | 0x00001526,0x000200f9,0x0000152e,0x000200f8, | ||
| 2249 | 0x0000152e,0x000700f5,0x00000012,0x0000152f, | ||
| 2250 | 0x0000151e,0x000013e2,0x0000152d,0x0000152c, | ||
| 2251 | 0x000300f7,0x000013f3,0x00000000,0x000400fa, | ||
| 2252 | 0x0000152f,0x000013ee,0x000013f0,0x000200f8, | ||
| 2253 | 0x000013f0,0x00050080,0x00000006,0x000013f2, | ||
| 2254 | 0x000013e6,0x00000063,0x000200f9,0x000013f3, | ||
| 2255 | 0x000200f8,0x000013ee,0x000200f9,0x000013f3, | ||
| 2256 | 0x000200f8,0x000013f3,0x000700f5,0x00000006, | ||
| 2257 | 0x0000216b,0x00001ead,0x000013ee,0x000013f2, | ||
| 2258 | 0x000013f0,0x000600a9,0x00000006,0x000021a0, | ||
| 2259 | 0x0000152f,0x000013e6,0x00001eae,0x000200f9, | ||
| 2260 | 0x000013f4,0x000200f8,0x000013f4,0x000200f9, | ||
| 2261 | 0x000013dd,0x000200f8,0x000013f5,0x000500ac, | ||
| 2262 | 0x00000012,0x000013f7,0x00001ead,0x00000058, | ||
| 2263 | 0x000300f7,0x0000142b,0x00000000,0x000400fa, | ||
| 2264 | 0x000013f7,0x000013f8,0x0000142b,0x000200f8, | ||
| 2265 | 0x000013f8,0x00050082,0x00000006,0x000013fa, | ||
| 2266 | 0x00001ead,0x00000063,0x00050084,0x00000006, | ||
| 2267 | 0x000013fb,0x000002ab,0x000013fa,0x00050080, | ||
| 2268 | 0x00000006,0x000013fd,0x000013fb,0x000000d8, | ||
| 2269 | 0x00050041,0x0000020a,0x000013fe,0x00000180, | ||
| 2270 | 0x000002aa,0x0004003d,0x00000007,0x000013ff, | ||
| 2271 | 0x000013fe,0x00050051,0x00000006,0x0000154d, | ||
| 2272 | 0x000013ff,0x00000000,0x00050084,0x00000006, | ||
| 2273 | 0x0000154f,0x000013fd,0x0000009e,0x00050095, | ||
| 2274 | 0x0000005e,0x00001550,0x0000154d,0x0000154f, | ||
| 2275 | 0x00050051,0x00000006,0x00001551,0x00001550, | ||
| 2276 | 0x00000001,0x00050051,0x00000006,0x00001552, | ||
| 2277 | 0x00001550,0x00000000,0x00050051,0x00000006, | ||
| 2278 | 0x00001555,0x000013ff,0x00000001,0x00050080, | ||
| 2279 | 0x00000006,0x00001557,0x00001555,0x00001551, | ||
| 2280 | 0x00050050,0x00000007,0x00001558,0x00001552, | ||
| 2281 | 0x00001557,0x0004007c,0x000000b1,0x00001545, | ||
| 2282 | 0x00001558,0x00060041,0x000000b7,0x00001546, | ||
| 2283 | 0x00001545,0x000000b6,0x000000b6,0x0006003d, | ||
| 2284 | 0x00000006,0x00001547,0x00001546,0x00000002, | ||
| 2285 | 0x00000004,0x00050080,0x00000006,0x0000153a, | ||
| 2286 | 0x000013fb,0x000000de,0x00050084,0x00000006, | ||
| 2287 | 0x0000156a,0x0000153a,0x0000009e,0x00050095, | ||
| 2288 | 0x0000005e,0x0000156b,0x0000154d,0x0000156a, | ||
| 2289 | 0x00050051,0x00000006,0x0000156c,0x0000156b, | ||
| 2290 | 0x00000001,0x00050051,0x00000006,0x0000156d, | ||
| 2291 | 0x0000156b,0x00000000,0x00050080,0x00000006, | ||
| 2292 | 0x00001572,0x00001555,0x0000156c,0x00050050, | ||
| 2293 | 0x00000007,0x00001573,0x0000156d,0x00001572, | ||
| 2294 | 0x0004007c,0x000000b1,0x00001560,0x00001573, | ||
| 2295 | 0x00060041,0x000000b7,0x00001561,0x00001560, | ||
| 2296 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 2297 | 0x00001562,0x00001561,0x00000002,0x00000004, | ||
| 2298 | 0x000500b0,0x00000012,0x0000157a,0x000013bc, | ||
| 2299 | 0x00001562,0x000400a8,0x00000012,0x0000157b, | ||
| 2300 | 0x0000157a,0x000300f7,0x0000158a,0x00000000, | ||
| 2301 | 0x000400fa,0x0000157b,0x0000157c,0x0000158a, | ||
| 2302 | 0x000200f8,0x0000157c,0x000500aa,0x00000012, | ||
| 2303 | 0x00001581,0x000013bc,0x00001562,0x000300f7, | ||
| 2304 | 0x00001588,0x00000000,0x000400fa,0x00001581, | ||
| 2305 | 0x00001582,0x00001588,0x000200f8,0x00001582, | ||
| 2306 | 0x000500b0,0x00000012,0x00001587,0x000013b9, | ||
| 2307 | 0x00001547,0x000200f9,0x00001588,0x000200f8, | ||
| 2308 | 0x00001588,0x000700f5,0x00000012,0x00001589, | ||
| 2309 | 0x00001581,0x0000157c,0x00001587,0x00001582, | ||
| 2310 | 0x000200f9,0x0000158a,0x000200f8,0x0000158a, | ||
| 2311 | 0x000700f5,0x00000012,0x0000158b,0x0000157a, | ||
| 2312 | 0x000013f8,0x00001589,0x00001588,0x000300f7, | ||
| 2313 | 0x0000140c,0x00000000,0x000400fa,0x0000158b, | ||
| 2314 | 0x00001404,0x0000140c,0x000200f8,0x00001404, | ||
| 2315 | 0x00050080,0x00000006,0x00001406,0x000013fb, | ||
| 2316 | 0x000002d5,0x00050084,0x00000006,0x0000159d, | ||
| 2317 | 0x00001406,0x0000009e,0x00050095,0x0000005e, | ||
| 2318 | 0x0000159e,0x0000154d,0x0000159d,0x00050051, | ||
| 2319 | 0x00000006,0x0000159f,0x0000159e,0x00000001, | ||
| 2320 | 0x00050051,0x00000006,0x000015a0,0x0000159e, | ||
| 2321 | 0x00000000,0x00050080,0x00000006,0x000015a5, | ||
| 2322 | 0x00001555,0x0000159f,0x00050050,0x00000007, | ||
| 2323 | 0x000015a6,0x000015a0,0x000015a5,0x0004007c, | ||
| 2324 | 0x000000b1,0x00001593,0x000015a6,0x00060041, | ||
| 2325 | 0x000000b7,0x00001594,0x00001593,0x000000b6, | ||
| 2326 | 0x000000b6,0x0006003d,0x00000006,0x00001595, | ||
| 2327 | 0x00001594,0x00000002,0x00000004,0x000500c7, | ||
| 2328 | 0x00000006,0x0000140a,0x00001595,0x00000063, | ||
| 2329 | 0x000500ab,0x00000012,0x0000140b,0x0000140a, | ||
| 2330 | 0x00000058,0x000200f9,0x0000140c,0x000200f8, | ||
| 2331 | 0x0000140c,0x000700f5,0x00000012,0x0000140d, | ||
| 2332 | 0x0000158b,0x0000158a,0x0000140b,0x00001404, | ||
| 2333 | 0x000300f7,0x0000142a,0x00000000,0x000400fa, | ||
| 2334 | 0x0000140d,0x0000140e,0x0000142a,0x000200f8, | ||
| 2335 | 0x0000140e,0x00050096,0x0000005e,0x000015af, | ||
| 2336 | 0x00001547,0x000013b9,0x00050051,0x00000006, | ||
| 2337 | 0x000015b0,0x000015af,0x00000001,0x00050051, | ||
| 2338 | 0x00000006,0x000015b1,0x000015af,0x00000000, | ||
| 2339 | 0x00050082,0x00000006,0x000015b7,0x00001562, | ||
| 2340 | 0x000013bc,0x00050082,0x00000006,0x000015b9, | ||
| 2341 | 0x000015b7,0x000015b0,0x000500b0,0x00000012, | ||
| 2342 | 0x000015c1,0x000015b9,0x000013da,0x000400a8, | ||
| 2343 | 0x00000012,0x000015c2,0x000015c1,0x000300f7, | ||
| 2344 | 0x000015d1,0x00000000,0x000400fa,0x000015c2, | ||
| 2345 | 0x000015c3,0x000015d1,0x000200f8,0x000015c3, | ||
| 2346 | 0x000500aa,0x00000012,0x000015c8,0x000015b9, | ||
| 2347 | 0x000013da,0x000300f7,0x000015cf,0x00000000, | ||
| 2348 | 0x000400fa,0x000015c8,0x000015c9,0x000015cf, | ||
| 2349 | 0x000200f8,0x000015c9,0x000500b0,0x00000012, | ||
| 2350 | 0x000015ce,0x000015b1,0x000013d9,0x000200f9, | ||
| 2351 | 0x000015cf,0x000200f8,0x000015cf,0x000700f5, | ||
| 2352 | 0x00000012,0x000015d0,0x000015c8,0x000015c3, | ||
| 2353 | 0x000015ce,0x000015c9,0x000200f9,0x000015d1, | ||
| 2354 | 0x000200f8,0x000015d1,0x000700f5,0x00000012, | ||
| 2355 | 0x000015d2,0x000015c1,0x0000140e,0x000015d0, | ||
| 2356 | 0x000015cf,0x000300f7,0x00001429,0x00000000, | ||
| 2357 | 0x000400fa,0x000015d2,0x00001414,0x00001418, | ||
| 2358 | 0x000200f8,0x00001418,0x00050084,0x00000006, | ||
| 2359 | 0x000015f6,0x000013fa,0x0000218f,0x00050095, | ||
| 2360 | 0x0000005e,0x000015f7,0x0000154d,0x000015f6, | ||
| 2361 | 0x00050051,0x00000006,0x000015f8,0x000015f7, | ||
| 2362 | 0x00000001,0x00050051,0x00000006,0x000015f9, | ||
| 2363 | 0x000015f7,0x00000000,0x00050080,0x00000006, | ||
| 2364 | 0x000015fe,0x00001555,0x000015f8,0x00050050, | ||
| 2365 | 0x00000007,0x000015ff,0x000015f9,0x000015fe, | ||
| 2366 | 0x0004007c,0x000000b1,0x000015ec,0x000015ff, | ||
| 2367 | 0x00060041,0x000000b7,0x000015ed,0x000015ec, | ||
| 2368 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 2369 | 0x000015ee,0x000015ed,0x00000002,0x00000004, | ||
| 2370 | 0x00050080,0x00000006,0x000015e1,0x000013fb, | ||
| 2371 | 0x00000063,0x00050084,0x00000006,0x00001611, | ||
| 2372 | 0x000015e1,0x0000009e,0x00050095,0x0000005e, | ||
| 2373 | 0x00001612,0x0000154d,0x00001611,0x00050051, | ||
| 2374 | 0x00000006,0x00001613,0x00001612,0x00000001, | ||
| 2375 | 0x00050051,0x00000006,0x00001614,0x00001612, | ||
| 2376 | 0x00000000,0x00050080,0x00000006,0x00001619, | ||
| 2377 | 0x00001555,0x00001613,0x00050050,0x00000007, | ||
| 2378 | 0x0000161a,0x00001614,0x00001619,0x0004007c, | ||
| 2379 | 0x000000b1,0x00001607,0x0000161a,0x00060041, | ||
| 2380 | 0x000000b7,0x00001608,0x00001607,0x000000b6, | ||
| 2381 | 0x000000b6,0x0006003d,0x00000006,0x00001609, | ||
| 2382 | 0x00001608,0x00000002,0x00000004,0x00050080, | ||
| 2383 | 0x00000006,0x0000141e,0x000013fb,0x0000009e, | ||
| 2384 | 0x00050084,0x00000006,0x0000163a,0x0000141e, | ||
| 2385 | 0x0000009e,0x00050095,0x0000005e,0x0000163b, | ||
| 2386 | 0x0000154d,0x0000163a,0x00050051,0x00000006, | ||
| 2387 | 0x0000163c,0x0000163b,0x00000001,0x00050051, | ||
| 2388 | 0x00000006,0x0000163d,0x0000163b,0x00000000, | ||
| 2389 | 0x00050080,0x00000006,0x00001642,0x00001555, | ||
| 2390 | 0x0000163c,0x00050050,0x00000007,0x00001643, | ||
| 2391 | 0x0000163d,0x00001642,0x0004007c,0x000000b1, | ||
| 2392 | 0x00001630,0x00001643,0x00060041,0x000000b7, | ||
| 2393 | 0x00001631,0x00001630,0x000000b6,0x000000b6, | ||
| 2394 | 0x0006003d,0x00000006,0x00001632,0x00001631, | ||
| 2395 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 2396 | 0x00001625,0x000013fb,0x00000357,0x00050084, | ||
| 2397 | 0x00000006,0x00001655,0x00001625,0x0000009e, | ||
| 2398 | 0x00050095,0x0000005e,0x00001656,0x0000154d, | ||
| 2399 | 0x00001655,0x00050051,0x00000006,0x00001657, | ||
| 2400 | 0x00001656,0x00000001,0x00050051,0x00000006, | ||
| 2401 | 0x00001658,0x00001656,0x00000000,0x00050080, | ||
| 2402 | 0x00000006,0x0000165d,0x00001555,0x00001657, | ||
| 2403 | 0x00050050,0x00000007,0x0000165e,0x00001658, | ||
| 2404 | 0x0000165d,0x0004007c,0x000000b1,0x0000164b, | ||
| 2405 | 0x0000165e,0x00060041,0x000000b7,0x0000164c, | ||
| 2406 | 0x0000164b,0x000000b6,0x000000b6,0x0006003d, | ||
| 2407 | 0x00000006,0x0000164d,0x0000164c,0x00000002, | ||
| 2408 | 0x00000004,0x00050096,0x0000005e,0x00001667, | ||
| 2409 | 0x000013b9,0x000015ee,0x00050051,0x00000006, | ||
| 2410 | 0x00001668,0x00001667,0x00000001,0x00050051, | ||
| 2411 | 0x00000006,0x00001669,0x00001667,0x00000000, | ||
| 2412 | 0x00050082,0x00000006,0x0000166f,0x000013bc, | ||
| 2413 | 0x00001609,0x00050082,0x00000006,0x00001671, | ||
| 2414 | 0x0000166f,0x00001668,0x00050095,0x0000005e, | ||
| 2415 | 0x0000167b,0x00001632,0x00001669,0x00050051, | ||
| 2416 | 0x00000006,0x0000167c,0x0000167b,0x00000001, | ||
| 2417 | 0x00050051,0x00000006,0x0000167d,0x0000167b, | ||
| 2418 | 0x00000000,0x00050080,0x00000006,0x00001683, | ||
| 2419 | 0x0000164d,0x00001671,0x00050080,0x00000006, | ||
| 2420 | 0x00001685,0x00001683,0x0000167c,0x00060052, | ||
| 2421 | 0x00000027,0x00001c53,0x0000167d,0x00000498, | ||
| 2422 | 0x00000000,0x000500c7,0x00000006,0x0000168d, | ||
| 2423 | 0x000013bb,0x00000191,0x000500c7,0x00000006, | ||
| 2424 | 0x00001690,0x00001685,0x0000017b,0x000500c5, | ||
| 2425 | 0x00000006,0x00001691,0x0000168d,0x00001690, | ||
| 2426 | 0x00060052,0x00000027,0x00001c57,0x00001691, | ||
| 2427 | 0x00001c53,0x00000001,0x000200f9,0x00001429, | ||
| 2428 | 0x000200f8,0x00001414,0x00060052,0x00000027, | ||
| 2429 | 0x00001c3c,0x00000058,0x00000498,0x00000000, | ||
| 2430 | 0x00060052,0x00000027,0x00001c3e,0x00000058, | ||
| 2431 | 0x00001c3c,0x00000001,0x00060052,0x00000027, | ||
| 2432 | 0x00001c40,0x00000058,0x00001c3e,0x00000002, | ||
| 2433 | 0x000200f9,0x00001429,0x000200f8,0x00001429, | ||
| 2434 | 0x000700f5,0x00000027,0x00001f7f,0x00001c40, | ||
| 2435 | 0x00001414,0x00001c57,0x00001418,0x000200f9, | ||
| 2436 | 0x000014ce,0x000200f8,0x0000142a,0x000200f9, | ||
| 2437 | 0x0000142b,0x000200f8,0x0000142b,0x000500c7, | ||
| 2438 | 0x00000006,0x0000142f,0x00000438,0x00000063, | ||
| 2439 | 0x000500ab,0x00000012,0x00001430,0x0000142f, | ||
| 2440 | 0x00000058,0x000300f7,0x00001436,0x00000000, | ||
| 2441 | 0x000400fa,0x00001430,0x00001431,0x00001436, | ||
| 2442 | 0x000200f8,0x00001431,0x000500c7,0x00000006, | ||
| 2443 | 0x00001434,0x000013bb,0x0000018b,0x000500ab, | ||
| 2444 | 0x00000012,0x00001435,0x00001434,0x00000058, | ||
| 2445 | 0x000200f9,0x00001436,0x000200f8,0x00001436, | ||
| 2446 | 0x000700f5,0x00000012,0x00001437,0x00001430, | ||
| 2447 | 0x0000142b,0x00001435,0x00001431,0x000300f7, | ||
| 2448 | 0x0000143d,0x00000000,0x000400fa,0x00001437, | ||
| 2449 | 0x00001438,0x0000143d,0x000200f8,0x00001438, | ||
| 2450 | 0x000500c5,0x00000006,0x0000143b,0x000013bc, | ||
| 2451 | 0x00000191,0x00060052,0x00000007,0x00001c5b, | ||
| 2452 | 0x0000143b,0x000013bd,0x00000001,0x000200f9, | ||
| 2453 | 0x0000143d,0x000200f8,0x0000143d,0x000700f5, | ||
| 2454 | 0x00000007,0x00001eb1,0x000013bd,0x00001436, | ||
| 2455 | 0x00001c5b,0x00001438,0x00050041,0x00000182, | ||
| 2456 | 0x0000143e,0x00000180,0x000000e4,0x0004003d, | ||
| 2457 | 0x00000006,0x0000143f,0x0000143e,0x000500ab, | ||
| 2458 | 0x00000012,0x00001440,0x0000143f,0x00000058, | ||
| 2459 | 0x000300f7,0x00001453,0x00000000,0x000400fa, | ||
| 2460 | 0x00001440,0x00001441,0x00001453,0x000200f8, | ||
| 2461 | 0x00001441,0x000500aa,0x00000012,0x00001444, | ||
| 2462 | 0x000013d9,0x00000058,0x000300f7,0x00001449, | ||
| 2463 | 0x00000000,0x000400fa,0x00001444,0x00001445, | ||
| 2464 | 0x00001449,0x000200f8,0x00001445,0x000500aa, | ||
| 2465 | 0x00000012,0x00001448,0x000013da,0x00000058, | ||
| 2466 | 0x000200f9,0x00001449,0x000200f8,0x00001449, | ||
| 2467 | 0x000700f5,0x00000012,0x0000144a,0x00001444, | ||
| 2468 | 0x00001441,0x00001448,0x00001445,0x000600a9, | ||
| 2469 | 0x00000007,0x0000144c,0x0000144a,0x00000208, | ||
| 2470 | 0x00002190,0x00050041,0x0000020a,0x0000144d, | ||
| 2471 | 0x00000180,0x00000325,0x0004003d,0x00000007, | ||
| 2472 | 0x0000144e,0x0000144d,0x000300f7,0x000016d7, | ||
| 2473 | 0x00000000,0x000300fb,0x00000058,0x000016a7, | ||
| 2474 | 0x000200f8,0x000016a7,0x000200f9,0x000016a9, | ||
| 2475 | 0x000200f8,0x000016a9,0x000700f5,0x00000006, | ||
| 2476 | 0x00001eb3,0x0000143f,0x000016a7,0x000021a1, | ||
| 2477 | 0x000016bf,0x000700f5,0x00000006,0x00001eb2, | ||
| 2478 | 0x00000058,0x000016a7,0x00002171,0x000016bf, | ||
| 2479 | 0x000500b0,0x00000012,0x000016ad,0x00001eb2, | ||
| 2480 | 0x00001eb3,0x000400f6,0x000016c0,0x000016bf, | ||
| 2481 | 0x00000000,0x000400fa,0x000016ad,0x000016ae, | ||
| 2482 | 0x000016c0,0x000200f8,0x000016ae,0x00050080, | ||
| 2483 | 0x00000006,0x000016b1,0x00001eb2,0x00001eb3, | ||
| 2484 | 0x000500c2,0x00000006,0x000016b2,0x000016b1, | ||
| 2485 | 0x00000063,0x00050084,0x00000006,0x000016b4, | ||
| 2486 | 0x0000009e,0x000016b2,0x00050051,0x00000006, | ||
| 2487 | 0x000016f6,0x0000144e,0x00000000,0x00050084, | ||
| 2488 | 0x00000006,0x000016f8,0x000016b2,0x0000034a, | ||
| 2489 | 0x00050095,0x0000005e,0x000016f9,0x000016f6, | ||
| 2490 | 0x000016f8,0x00050051,0x00000006,0x000016fa, | ||
| 2491 | 0x000016f9,0x00000001,0x00050051,0x00000006, | ||
| 2492 | 0x000016fb,0x000016f9,0x00000000,0x00050051, | ||
| 2493 | 0x00000006,0x000016fe,0x0000144e,0x00000001, | ||
| 2494 | 0x00050080,0x00000006,0x00001700,0x000016fe, | ||
| 2495 | 0x000016fa,0x00050050,0x00000007,0x00001701, | ||
| 2496 | 0x000016fb,0x00001700,0x0004007c,0x000000b1, | ||
| 2497 | 0x000016ee,0x00001701,0x00060041,0x000000b7, | ||
| 2498 | 0x000016ef,0x000016ee,0x000000b6,0x000000b6, | ||
| 2499 | 0x0006003d,0x00000006,0x000016f0,0x000016ef, | ||
| 2500 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 2501 | 0x000016e3,0x000016b4,0x00000063,0x00050084, | ||
| 2502 | 0x00000006,0x00001713,0x000016e3,0x0000009e, | ||
| 2503 | 0x00050095,0x0000005e,0x00001714,0x000016f6, | ||
| 2504 | 0x00001713,0x00050051,0x00000006,0x00001715, | ||
| 2505 | 0x00001714,0x00000001,0x00050051,0x00000006, | ||
| 2506 | 0x00001716,0x00001714,0x00000000,0x00050080, | ||
| 2507 | 0x00000006,0x0000171b,0x000016fe,0x00001715, | ||
| 2508 | 0x00050050,0x00000007,0x0000171c,0x00001716, | ||
| 2509 | 0x0000171b,0x0004007c,0x000000b1,0x00001709, | ||
| 2510 | 0x0000171c,0x00060041,0x000000b7,0x0000170a, | ||
| 2511 | 0x00001709,0x000000b6,0x000000b6,0x0006003d, | ||
| 2512 | 0x00000006,0x0000170b,0x0000170a,0x00000002, | ||
| 2513 | 0x00000004,0x00050051,0x00000006,0x00001720, | ||
| 2514 | 0x00001eb1,0x00000001,0x000500b0,0x00000012, | ||
| 2515 | 0x00001723,0x00001720,0x0000170b,0x000400a8, | ||
| 2516 | 0x00000012,0x00001724,0x00001723,0x000300f7, | ||
| 2517 | 0x00001733,0x00000000,0x000400fa,0x00001724, | ||
| 2518 | 0x00001725,0x00001733,0x000200f8,0x00001725, | ||
| 2519 | 0x000500aa,0x00000012,0x0000172a,0x00001720, | ||
| 2520 | 0x0000170b,0x000300f7,0x00001731,0x00000000, | ||
| 2521 | 0x000400fa,0x0000172a,0x0000172b,0x00001731, | ||
| 2522 | 0x000200f8,0x0000172b,0x00050051,0x00000006, | ||
| 2523 | 0x0000172d,0x00001eb1,0x00000000,0x000500b0, | ||
| 2524 | 0x00000012,0x00001730,0x0000172d,0x000016f0, | ||
| 2525 | 0x000200f9,0x00001731,0x000200f8,0x00001731, | ||
| 2526 | 0x000700f5,0x00000012,0x00001732,0x0000172a, | ||
| 2527 | 0x00001725,0x00001730,0x0000172b,0x000200f9, | ||
| 2528 | 0x00001733,0x000200f8,0x00001733,0x000700f5, | ||
| 2529 | 0x00000012,0x00001734,0x00001723,0x000016ae, | ||
| 2530 | 0x00001732,0x00001731,0x000300f7,0x000016be, | ||
| 2531 | 0x00000000,0x000400fa,0x00001734,0x000016b9, | ||
| 2532 | 0x000016bb,0x000200f8,0x000016bb,0x00050080, | ||
| 2533 | 0x00000006,0x000016bd,0x000016b2,0x00000063, | ||
| 2534 | 0x000200f9,0x000016be,0x000200f8,0x000016b9, | ||
| 2535 | 0x000200f9,0x000016be,0x000200f8,0x000016be, | ||
| 2536 | 0x000700f5,0x00000006,0x00002171,0x00001eb2, | ||
| 2537 | 0x000016b9,0x000016bd,0x000016bb,0x000600a9, | ||
| 2538 | 0x00000006,0x000021a1,0x00001734,0x000016b2, | ||
| 2539 | 0x00001eb3,0x000200f9,0x000016bf,0x000200f8, | ||
| 2540 | 0x000016bf,0x000200f9,0x000016a9,0x000200f8, | ||
| 2541 | 0x000016c0,0x000500aa,0x00000012,0x000016c2, | ||
| 2542 | 0x00001eb2,0x00000058,0x000300f7,0x000016c4, | ||
| 2543 | 0x00000000,0x000400fa,0x000016c2,0x000016c3, | ||
| 2544 | 0x000016c4,0x000200f8,0x000016c3,0x000200f9, | ||
| 2545 | 0x000016d7,0x000200f8,0x000016c4,0x00050082, | ||
| 2546 | 0x00000006,0x000016c6,0x00001eb2,0x00000063, | ||
| 2547 | 0x00050084,0x00000006,0x000016c7,0x0000009e, | ||
| 2548 | 0x000016c6,0x00050080,0x00000006,0x000016c8, | ||
| 2549 | 0x000016c7,0x000000d8,0x00050051,0x00000006, | ||
| 2550 | 0x00001752,0x0000144e,0x00000000,0x00050084, | ||
| 2551 | 0x00000006,0x00001754,0x000016c8,0x0000009e, | ||
| 2552 | 0x00050095,0x0000005e,0x00001755,0x00001752, | ||
| 2553 | 0x00001754,0x00050051,0x00000006,0x00001756, | ||
| 2554 | 0x00001755,0x00000001,0x00050051,0x00000006, | ||
| 2555 | 0x00001757,0x00001755,0x00000000,0x00050051, | ||
| 2556 | 0x00000006,0x0000175a,0x0000144e,0x00000001, | ||
| 2557 | 0x00050080,0x00000006,0x0000175c,0x0000175a, | ||
| 2558 | 0x00001756,0x00050050,0x00000007,0x0000175d, | ||
| 2559 | 0x00001757,0x0000175c,0x0004007c,0x000000b1, | ||
| 2560 | 0x0000174a,0x0000175d,0x00060041,0x000000b7, | ||
| 2561 | 0x0000174b,0x0000174a,0x000000b6,0x000000b6, | ||
| 2562 | 0x0006003d,0x00000006,0x0000174c,0x0000174b, | ||
| 2563 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 2564 | 0x0000173f,0x000016c7,0x000000de,0x00050084, | ||
| 2565 | 0x00000006,0x0000176f,0x0000173f,0x0000009e, | ||
| 2566 | 0x00050095,0x0000005e,0x00001770,0x00001752, | ||
| 2567 | 0x0000176f,0x00050051,0x00000006,0x00001771, | ||
| 2568 | 0x00001770,0x00000001,0x00050051,0x00000006, | ||
| 2569 | 0x00001772,0x00001770,0x00000000,0x00050080, | ||
| 2570 | 0x00000006,0x00001777,0x0000175a,0x00001771, | ||
| 2571 | 0x00050050,0x00000007,0x00001778,0x00001772, | ||
| 2572 | 0x00001777,0x0004007c,0x000000b1,0x00001765, | ||
| 2573 | 0x00001778,0x00060041,0x000000b7,0x00001766, | ||
| 2574 | 0x00001765,0x000000b6,0x000000b6,0x0006003d, | ||
| 2575 | 0x00000006,0x00001767,0x00001766,0x00000002, | ||
| 2576 | 0x00000004,0x00050051,0x00000006,0x0000177c, | ||
| 2577 | 0x00001eb1,0x00000001,0x000500b0,0x00000012, | ||
| 2578 | 0x0000177f,0x0000177c,0x00001767,0x000400a8, | ||
| 2579 | 0x00000012,0x00001780,0x0000177f,0x000300f7, | ||
| 2580 | 0x0000178f,0x00000000,0x000400fa,0x00001780, | ||
| 2581 | 0x00001781,0x0000178f,0x000200f8,0x00001781, | ||
| 2582 | 0x000500aa,0x00000012,0x00001786,0x0000177c, | ||
| 2583 | 0x00001767,0x000300f7,0x0000178d,0x00000000, | ||
| 2584 | 0x000400fa,0x00001786,0x00001787,0x0000178d, | ||
| 2585 | 0x000200f8,0x00001787,0x00050051,0x00000006, | ||
| 2586 | 0x00001789,0x00001eb1,0x00000000,0x000500b0, | ||
| 2587 | 0x00000012,0x0000178c,0x00001789,0x0000174c, | ||
| 2588 | 0x000200f9,0x0000178d,0x000200f8,0x0000178d, | ||
| 2589 | 0x000700f5,0x00000012,0x0000178e,0x00001786, | ||
| 2590 | 0x00001781,0x0000178c,0x00001787,0x000200f9, | ||
| 2591 | 0x0000178f,0x000200f8,0x0000178f,0x000700f5, | ||
| 2592 | 0x00000012,0x00001790,0x0000177f,0x000016c4, | ||
| 2593 | 0x0000178e,0x0000178d,0x000300f7,0x000016d5, | ||
| 2594 | 0x00000000,0x000400fa,0x00001790,0x000016ce, | ||
| 2595 | 0x000016d5,0x000200f8,0x000016ce,0x00050051, | ||
| 2596 | 0x00000006,0x00001798,0x00001eb1,0x00000000, | ||
| 2597 | 0x00050096,0x0000005e,0x00001799,0x0000174c, | ||
| 2598 | 0x00001798,0x00050051,0x00000006,0x0000179a, | ||
| 2599 | 0x00001799,0x00000001,0x00050051,0x00000006, | ||
| 2600 | 0x0000179b,0x00001799,0x00000000,0x00050082, | ||
| 2601 | 0x00000006,0x000017a1,0x00001767,0x0000177c, | ||
| 2602 | 0x00050082,0x00000006,0x000017a3,0x000017a1, | ||
| 2603 | 0x0000179a,0x00050051,0x00000006,0x000017aa, | ||
| 2604 | 0x0000144c,0x00000001,0x000500b0,0x00000012, | ||
| 2605 | 0x000017ab,0x000017a3,0x000017aa,0x000400a8, | ||
| 2606 | 0x00000012,0x000017ac,0x000017ab,0x000300f7, | ||
| 2607 | 0x000017bb,0x00000000,0x000400fa,0x000017ac, | ||
| 2608 | 0x000017ad,0x000017bb,0x000200f8,0x000017ad, | ||
| 2609 | 0x000500aa,0x00000012,0x000017b2,0x000017a3, | ||
| 2610 | 0x000017aa,0x000300f7,0x000017b9,0x00000000, | ||
| 2611 | 0x000400fa,0x000017b2,0x000017b3,0x000017b9, | ||
| 2612 | 0x000200f8,0x000017b3,0x00050051,0x00000006, | ||
| 2613 | 0x000017b7,0x0000144c,0x00000000,0x000500b0, | ||
| 2614 | 0x00000012,0x000017b8,0x0000179b,0x000017b7, | ||
| 2615 | 0x000200f9,0x000017b9,0x000200f8,0x000017b9, | ||
| 2616 | 0x000700f5,0x00000012,0x000017ba,0x000017b2, | ||
| 2617 | 0x000017ad,0x000017b8,0x000017b3,0x000200f9, | ||
| 2618 | 0x000017bb,0x000200f8,0x000017bb,0x000700f5, | ||
| 2619 | 0x00000012,0x000017bc,0x000017ab,0x000016ce, | ||
| 2620 | 0x000017ba,0x000017b9,0x000400a8,0x00000012, | ||
| 2621 | 0x000016d4,0x000017bc,0x000200f9,0x000016d5, | ||
| 2622 | 0x000200f8,0x000016d5,0x000700f5,0x00000012, | ||
| 2623 | 0x000016d6,0x00001790,0x0000178f,0x000016d4, | ||
| 2624 | 0x000017bb,0x000200f9,0x000016d7,0x000200f8, | ||
| 2625 | 0x000016d7,0x000700f5,0x00000012,0x00001eb4, | ||
| 2626 | 0x0000011e,0x000016c3,0x000016d6,0x000016d5, | ||
| 2627 | 0x000200f9,0x00001453,0x000200f8,0x00001453, | ||
| 2628 | 0x000700f5,0x00000012,0x00001454,0x00001440, | ||
| 2629 | 0x0000143d,0x00001eb4,0x000016d7,0x000300f7, | ||
| 2630 | 0x00001456,0x00000000,0x000400fa,0x00001454, | ||
| 2631 | 0x00001455,0x00001456,0x000200f8,0x00001455, | ||
| 2632 | 0x000200f9,0x000014ce,0x000200f8,0x00001456, | ||
| 2633 | 0x000500c6,0x00000006,0x000017c3,0x000000cb, | ||
| 2634 | 0x000013b9,0x00050084,0x00000006,0x000017c4, | ||
| 2635 | 0x000017c3,0x000000d0,0x000500c6,0x00000006, | ||
| 2636 | 0x000017c8,0x000017c4,0x000013bb,0x00050084, | ||
| 2637 | 0x00000006,0x000017c9,0x000017c8,0x000000d0, | ||
| 2638 | 0x000500c6,0x00000006,0x000017cd,0x000017c9, | ||
| 2639 | 0x000013d1,0x00050084,0x00000006,0x000017ce, | ||
| 2640 | 0x000017cd,0x000000d0,0x000500c6,0x00000006, | ||
| 2641 | 0x000017d2,0x000017ce,0x000013ac,0x00050084, | ||
| 2642 | 0x00000006,0x000017d3,0x000017d2,0x000000d0, | ||
| 2643 | 0x000500c2,0x00000006,0x000017d5,0x000017d3, | ||
| 2644 | 0x000000e4,0x000500c6,0x00000006,0x000017d7, | ||
| 2645 | 0x000017d3,0x000017d5,0x00050084,0x00000006, | ||
| 2646 | 0x000017d9,0x000017d7,0x000000e8,0x000500c2, | ||
| 2647 | 0x00000006,0x000017db,0x000017d9,0x000000ec, | ||
| 2648 | 0x000500c6,0x00000006,0x000017dd,0x000017d9, | ||
| 2649 | 0x000017db,0x00050084,0x00000006,0x000017df, | ||
| 2650 | 0x000017dd,0x000000f0,0x000500c2,0x00000006, | ||
| 2651 | 0x000017e1,0x000017df,0x000000e4,0x000500c6, | ||
| 2652 | 0x00000006,0x000017e3,0x000017df,0x000017e1, | ||
| 2653 | 0x000200f9,0x00001459,0x000200f8,0x00001459, | ||
| 2654 | 0x000700f5,0x00000006,0x00001ec5,0x00000058, | ||
| 2655 | 0x00001456,0x000014b7,0x000014b5,0x000500b0, | ||
| 2656 | 0x00000012,0x0000145c,0x00001ec5,0x0000034a, | ||
| 2657 | 0x000400f6,0x000014b8,0x000014b5,0x00000000, | ||
| 2658 | 0x000400fa,0x0000145c,0x0000145d,0x000014b8, | ||
| 2659 | 0x000200f8,0x0000145d,0x00050080,0x00000006, | ||
| 2660 | 0x00001460,0x000017e3,0x00001ec5,0x00050041, | ||
| 2661 | 0x00000182,0x00001461,0x00000180,0x000000ec, | ||
| 2662 | 0x0004003d,0x00000006,0x00001462,0x00001461, | ||
| 2663 | 0x000500c7,0x00000006,0x00001463,0x00001460, | ||
| 2664 | 0x00001462,0x00050084,0x00000006,0x00001464, | ||
| 2665 | 0x000002ab,0x00001463,0x00050080,0x00000006, | ||
| 2666 | 0x00001466,0x00001464,0x00000357,0x00050041, | ||
| 2667 | 0x0000020a,0x00001467,0x00000180,0x00000355, | ||
| 2668 | 0x0004003d,0x00000007,0x00001468,0x00001467, | ||
| 2669 | 0x00050051,0x00000006,0x000017f4,0x00001468, | ||
| 2670 | 0x00000000,0x00050084,0x00000006,0x000017f6, | ||
| 2671 | 0x00001466,0x0000009e,0x00050095,0x0000005e, | ||
| 2672 | 0x000017f7,0x000017f4,0x000017f6,0x00050051, | ||
| 2673 | 0x00000006,0x000017f8,0x000017f7,0x00000001, | ||
| 2674 | 0x00050051,0x00000006,0x000017f9,0x000017f7, | ||
| 2675 | 0x00000000,0x00050051,0x00000006,0x000017fc, | ||
| 2676 | 0x00001468,0x00000001,0x00050080,0x00000006, | ||
| 2677 | 0x000017fe,0x000017fc,0x000017f8,0x00050050, | ||
| 2678 | 0x00000007,0x000017ff,0x000017f9,0x000017fe, | ||
| 2679 | 0x0004007c,0x000000b1,0x000017ec,0x000017ff, | ||
| 2680 | 0x00060041,0x000000b7,0x000017ed,0x000017ec, | ||
| 2681 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 2682 | 0x000017ee,0x000017ed,0x00000002,0x00000004, | ||
| 2683 | 0x000500c2,0x00000006,0x0000146a,0x000017ee, | ||
| 2684 | 0x000000e4,0x000500c7,0x00000006,0x0000146c, | ||
| 2685 | 0x0000146a,0x00000063,0x000500aa,0x00000012, | ||
| 2686 | 0x0000146d,0x0000146c,0x00000058,0x000300f7, | ||
| 2687 | 0x0000146f,0x00000000,0x000400fa,0x0000146d, | ||
| 2688 | 0x0000146e,0x0000146f,0x000200f8,0x0000146e, | ||
| 2689 | 0x000200f9,0x000014b5,0x000200f8,0x0000146f, | ||
| 2690 | 0x00050084,0x00000006,0x00001811,0x00001463, | ||
| 2691 | 0x0000218f,0x00050095,0x0000005e,0x00001812, | ||
| 2692 | 0x000017f4,0x00001811,0x00050051,0x00000006, | ||
| 2693 | 0x00001813,0x00001812,0x00000001,0x00050051, | ||
| 2694 | 0x00000006,0x00001814,0x00001812,0x00000000, | ||
| 2695 | 0x00050080,0x00000006,0x00001819,0x000017fc, | ||
| 2696 | 0x00001813,0x00050050,0x00000007,0x0000181a, | ||
| 2697 | 0x00001814,0x00001819,0x0004007c,0x000000b1, | ||
| 2698 | 0x00001807,0x0000181a,0x00060041,0x000000b7, | ||
| 2699 | 0x00001808,0x00001807,0x000000b6,0x000000b6, | ||
| 2700 | 0x0006003d,0x00000006,0x00001809,0x00001808, | ||
| 2701 | 0x00000002,0x00000004,0x000500ab,0x00000012, | ||
| 2702 | 0x00001476,0x00001809,0x000013b9,0x000400a8, | ||
| 2703 | 0x00000012,0x00001477,0x00001476,0x000300f7, | ||
| 2704 | 0x00001481,0x00000000,0x000400fa,0x00001477, | ||
| 2705 | 0x00001478,0x00001481,0x000200f8,0x00001478, | ||
| 2706 | 0x00050080,0x00000006,0x0000147a,0x00001464, | ||
| 2707 | 0x00000063,0x00050084,0x00000006,0x0000182c, | ||
| 2708 | 0x0000147a,0x0000009e,0x00050095,0x0000005e, | ||
| 2709 | 0x0000182d,0x000017f4,0x0000182c,0x00050051, | ||
| 2710 | 0x00000006,0x0000182e,0x0000182d,0x00000001, | ||
| 2711 | 0x00050051,0x00000006,0x0000182f,0x0000182d, | ||
| 2712 | 0x00000000,0x00050080,0x00000006,0x00001834, | ||
| 2713 | 0x000017fc,0x0000182e,0x00050050,0x00000007, | ||
| 2714 | 0x00001835,0x0000182f,0x00001834,0x0004007c, | ||
| 2715 | 0x000000b1,0x00001822,0x00001835,0x00060041, | ||
| 2716 | 0x000000b7,0x00001823,0x00001822,0x000000b6, | ||
| 2717 | 0x000000b6,0x0006003d,0x00000006,0x00001824, | ||
| 2718 | 0x00001823,0x00000002,0x00000004,0x000500ab, | ||
| 2719 | 0x00000012,0x00001480,0x00001824,0x000013bb, | ||
| 2720 | 0x000200f9,0x00001481,0x000200f8,0x00001481, | ||
| 2721 | 0x000700f5,0x00000012,0x00001482,0x00001476, | ||
| 2722 | 0x0000146f,0x00001480,0x00001478,0x000400a8, | ||
| 2723 | 0x00000012,0x00001483,0x00001482,0x000300f7, | ||
| 2724 | 0x0000148d,0x00000000,0x000400fa,0x00001483, | ||
| 2725 | 0x00001484,0x0000148d,0x000200f8,0x00001484, | ||
| 2726 | 0x00050080,0x00000006,0x00001486,0x00001464, | ||
| 2727 | 0x000000d8,0x00050084,0x00000006,0x00001847, | ||
| 2728 | 0x00001486,0x0000009e,0x00050095,0x0000005e, | ||
| 2729 | 0x00001848,0x000017f4,0x00001847,0x00050051, | ||
| 2730 | 0x00000006,0x00001849,0x00001848,0x00000001, | ||
| 2731 | 0x00050051,0x00000006,0x0000184a,0x00001848, | ||
| 2732 | 0x00000000,0x00050080,0x00000006,0x0000184f, | ||
| 2733 | 0x000017fc,0x00001849,0x00050050,0x00000007, | ||
| 2734 | 0x00001850,0x0000184a,0x0000184f,0x0004007c, | ||
| 2735 | 0x000000b1,0x0000183d,0x00001850,0x00060041, | ||
| 2736 | 0x000000b7,0x0000183e,0x0000183d,0x000000b6, | ||
| 2737 | 0x000000b6,0x0006003d,0x00000006,0x0000183f, | ||
| 2738 | 0x0000183e,0x00000002,0x00000004,0x000500ab, | ||
| 2739 | 0x00000012,0x0000148c,0x0000183f,0x000013d1, | ||
| 2740 | 0x000200f9,0x0000148d,0x000200f8,0x0000148d, | ||
| 2741 | 0x000700f5,0x00000012,0x0000148e,0x00001482, | ||
| 2742 | 0x00001481,0x0000148c,0x00001484,0x000400a8, | ||
| 2743 | 0x00000012,0x0000148f,0x0000148e,0x000300f7, | ||
| 2744 | 0x00001499,0x00000000,0x000400fa,0x0000148f, | ||
| 2745 | 0x00001490,0x00001499,0x000200f8,0x00001490, | ||
| 2746 | 0x00050080,0x00000006,0x00001492,0x00001464, | ||
| 2747 | 0x000000de,0x00050084,0x00000006,0x00001862, | ||
| 2748 | 0x00001492,0x0000009e,0x00050095,0x0000005e, | ||
| 2749 | 0x00001863,0x000017f4,0x00001862,0x00050051, | ||
| 2750 | 0x00000006,0x00001864,0x00001863,0x00000001, | ||
| 2751 | 0x00050051,0x00000006,0x00001865,0x00001863, | ||
| 2752 | 0x00000000,0x00050080,0x00000006,0x0000186a, | ||
| 2753 | 0x000017fc,0x00001864,0x00050050,0x00000007, | ||
| 2754 | 0x0000186b,0x00001865,0x0000186a,0x0004007c, | ||
| 2755 | 0x000000b1,0x00001858,0x0000186b,0x00060041, | ||
| 2756 | 0x000000b7,0x00001859,0x00001858,0x000000b6, | ||
| 2757 | 0x000000b6,0x0006003d,0x00000006,0x0000185a, | ||
| 2758 | 0x00001859,0x00000002,0x00000004,0x000500ab, | ||
| 2759 | 0x00000012,0x00001498,0x0000185a,0x000013ac, | ||
| 2760 | 0x000200f9,0x00001499,0x000200f8,0x00001499, | ||
| 2761 | 0x000700f5,0x00000012,0x0000149a,0x0000148e, | ||
| 2762 | 0x0000148d,0x00001498,0x00001490,0x000300f7, | ||
| 2763 | 0x0000149c,0x00000000,0x000400fa,0x0000149a, | ||
| 2764 | 0x0000149b,0x0000149c,0x000200f8,0x0000149b, | ||
| 2765 | 0x000200f9,0x000014b5,0x000200f8,0x0000149c, | ||
| 2766 | 0x000500c7,0x00000006,0x0000149e,0x0000146a, | ||
| 2767 | 0x000000d8,0x000500ab,0x00000012,0x0000149f, | ||
| 2768 | 0x0000149e,0x00000058,0x000300f7,0x000014b4, | ||
| 2769 | 0x00000000,0x000400fa,0x0000149f,0x000014a0, | ||
| 2770 | 0x000014a4,0x000200f8,0x000014a4,0x00050080, | ||
| 2771 | 0x00000006,0x000014a6,0x00001464,0x0000009e, | ||
| 2772 | 0x00050084,0x00000006,0x00001881,0x000014a6, | ||
| 2773 | 0x0000009e,0x00050095,0x0000005e,0x00001882, | ||
| 2774 | 0x000017f4,0x00001881,0x00050051,0x00000006, | ||
| 2775 | 0x00001883,0x00001882,0x00000001,0x00050051, | ||
| 2776 | 0x00000006,0x00001884,0x00001882,0x00000000, | ||
| 2777 | 0x00050080,0x00000006,0x00001889,0x000017fc, | ||
| 2778 | 0x00001883,0x00050050,0x00000007,0x0000188a, | ||
| 2779 | 0x00001884,0x00001889,0x0004007c,0x000000b1, | ||
| 2780 | 0x00001877,0x0000188a,0x00060041,0x000000b7, | ||
| 2781 | 0x00001878,0x00001877,0x000000b6,0x000000b6, | ||
| 2782 | 0x0006003d,0x00000006,0x00001879,0x00001878, | ||
| 2783 | 0x00000002,0x00000004,0x0006003d,0x00000006, | ||
| 2784 | 0x00001894,0x000017ed,0x00000002,0x00000004, | ||
| 2785 | 0x00060052,0x00000027,0x00001c9a,0x00001879, | ||
| 2786 | 0x00000498,0x00000000,0x000500c7,0x00000006, | ||
| 2787 | 0x000018ac,0x000013bb,0x00000191,0x000500c7, | ||
| 2788 | 0x00000006,0x000018af,0x00001894,0x0000017b, | ||
| 2789 | 0x000500c5,0x00000006,0x000018b0,0x000018ac, | ||
| 2790 | 0x000018af,0x00060052,0x00000027,0x00001c9e, | ||
| 2791 | 0x000018b0,0x00001c9a,0x00000001,0x000200f9, | ||
| 2792 | 0x000014b4,0x000200f8,0x000014a0,0x00060052, | ||
| 2793 | 0x00000027,0x00001c8f,0x00000058,0x00000498, | ||
| 2794 | 0x00000000,0x00060052,0x00000027,0x00001c91, | ||
| 2795 | 0x00000058,0x00001c8f,0x00000001,0x00060052, | ||
| 2796 | 0x00000027,0x00001c93,0x00000058,0x00001c91, | ||
| 2797 | 0x00000002,0x000200f9,0x000014b4,0x000200f8, | ||
| 2798 | 0x000014b4,0x000700f5,0x00000027,0x00001edf, | ||
| 2799 | 0x00001c93,0x000014a0,0x00001c9e,0x000014a4, | ||
| 2800 | 0x000200f9,0x000014b8,0x000200f8,0x000014b5, | ||
| 2801 | 0x00050080,0x00000006,0x000014b7,0x00001ec5, | ||
| 2802 | 0x000003bc,0x000200f9,0x00001459,0x000200f8, | ||
| 2803 | 0x000014b8,0x000700f5,0x00000006,0x00001eea, | ||
| 2804 | 0x00001da1,0x00001459,0x00000063,0x000014b4, | ||
| 2805 | 0x000700f5,0x00000027,0x00001ede,0x00000498, | ||
| 2806 | 0x00001459,0x00001edf,0x000014b4,0x000700f5, | ||
| 2807 | 0x00000012,0x00001eca,0x0000011e,0x00001459, | ||
| 2808 | 0x00000217,0x000014b4,0x000300f7,0x000014ba, | ||
| 2809 | 0x00000000,0x000400fa,0x00001eca,0x000014ce, | ||
| 2810 | 0x000014ba,0x000200f8,0x000014ba,0x00060052, | ||
| 2811 | 0x00000027,0x00001ca0,0x00000058,0x00001ede, | ||
| 2812 | 0x00000000,0x00060052,0x00000027,0x00001ca2, | ||
| 2813 | 0x00000058,0x00001ca0,0x00000001,0x00060052, | ||
| 2814 | 0x00000027,0x00001ca4,0x00000058,0x00001ca2, | ||
| 2815 | 0x00000002,0x000500c7,0x00000006,0x000014c0, | ||
| 2816 | 0x00000438,0x000000d8,0x000500ab,0x00000012, | ||
| 2817 | 0x000014c1,0x000014c0,0x00000058,0x000300f7, | ||
| 2818 | 0x000014ca,0x00000000,0x000400fa,0x000014c1, | ||
| 2819 | 0x000014c2,0x000014ca,0x000200f8,0x000014c2, | ||
| 2820 | 0x00050041,0x0000020a,0x000014c3,0x00000180, | ||
| 2821 | 0x000003c8,0x0004003d,0x00000007,0x000014c4, | ||
| 2822 | 0x000014c3,0x00050041,0x00000182,0x000014c5, | ||
| 2823 | 0x00000180,0x000003c9,0x0004003d,0x00000006, | ||
| 2824 | 0x000014c6,0x000014c5,0x000300f7,0x000018fa, | ||
| 2825 | 0x00000000,0x000300fb,0x00000058,0x000018ca, | ||
| 2826 | 0x000200f8,0x000018ca,0x000200f9,0x000018cc, | ||
| 2827 | 0x000200f8,0x000018cc,0x000700f5,0x00000006, | ||
| 2828 | 0x00001ee1,0x000014c6,0x000018ca,0x000021a2, | ||
| 2829 | 0x000018e2,0x000700f5,0x00000006,0x00001ee0, | ||
| 2830 | 0x00000058,0x000018ca,0x00002188,0x000018e2, | ||
| 2831 | 0x000500b0,0x00000012,0x000018d0,0x00001ee0, | ||
| 2832 | 0x00001ee1,0x000400f6,0x000018e3,0x000018e2, | ||
| 2833 | 0x00000000,0x000400fa,0x000018d0,0x000018d1, | ||
| 2834 | 0x000018e3,0x000200f8,0x000018d1,0x00050080, | ||
| 2835 | 0x00000006,0x000018d4,0x00001ee0,0x00001ee1, | ||
| 2836 | 0x000500c2,0x00000006,0x000018d5,0x000018d4, | ||
| 2837 | 0x00000063,0x00050084,0x00000006,0x000018d7, | ||
| 2838 | 0x0000009e,0x000018d5,0x00050051,0x00000006, | ||
| 2839 | 0x00001919,0x000014c4,0x00000000,0x00050084, | ||
| 2840 | 0x00000006,0x0000191b,0x000018d5,0x0000034a, | ||
| 2841 | 0x00050095,0x0000005e,0x0000191c,0x00001919, | ||
| 2842 | 0x0000191b,0x00050051,0x00000006,0x0000191d, | ||
| 2843 | 0x0000191c,0x00000001,0x00050051,0x00000006, | ||
| 2844 | 0x0000191e,0x0000191c,0x00000000,0x00050051, | ||
| 2845 | 0x00000006,0x00001921,0x000014c4,0x00000001, | ||
| 2846 | 0x00050080,0x00000006,0x00001923,0x00001921, | ||
| 2847 | 0x0000191d,0x00050050,0x00000007,0x00001924, | ||
| 2848 | 0x0000191e,0x00001923,0x0004007c,0x000000b1, | ||
| 2849 | 0x00001911,0x00001924,0x00060041,0x000000b7, | ||
| 2850 | 0x00001912,0x00001911,0x000000b6,0x000000b6, | ||
| 2851 | 0x0006003d,0x00000006,0x00001913,0x00001912, | ||
| 2852 | 0x00000002,0x00000004,0x00050080,0x00000006, | ||
| 2853 | 0x00001906,0x000018d7,0x00000063,0x00050084, | ||
| 2854 | 0x00000006,0x00001936,0x00001906,0x0000009e, | ||
| 2855 | 0x00050095,0x0000005e,0x00001937,0x00001919, | ||
| 2856 | 0x00001936,0x00050051,0x00000006,0x00001938, | ||
| 2857 | 0x00001937,0x00000001,0x00050051,0x00000006, | ||
| 2858 | 0x00001939,0x00001937,0x00000000,0x00050080, | ||
| 2859 | 0x00000006,0x0000193e,0x00001921,0x00001938, | ||
| 2860 | 0x00050050,0x00000007,0x0000193f,0x00001939, | ||
| 2861 | 0x0000193e,0x0004007c,0x000000b1,0x0000192c, | ||
| 2862 | 0x0000193f,0x00060041,0x000000b7,0x0000192d, | ||
| 2863 | 0x0000192c,0x000000b6,0x000000b6,0x0006003d, | ||
| 2864 | 0x00000006,0x0000192e,0x0000192d,0x00000002, | ||
| 2865 | 0x00000004,0x000500b0,0x00000012,0x00001946, | ||
| 2866 | 0x000013bc,0x0000192e,0x000400a8,0x00000012, | ||
| 2867 | 0x00001947,0x00001946,0x000300f7,0x00001956, | ||
| 2868 | 0x00000000,0x000400fa,0x00001947,0x00001948, | ||
| 2869 | 0x00001956,0x000200f8,0x00001948,0x000500aa, | ||
| 2870 | 0x00000012,0x0000194d,0x000013bc,0x0000192e, | ||
| 2871 | 0x000300f7,0x00001954,0x00000000,0x000400fa, | ||
| 2872 | 0x0000194d,0x0000194e,0x00001954,0x000200f8, | ||
| 2873 | 0x0000194e,0x000500b0,0x00000012,0x00001953, | ||
| 2874 | 0x000013b9,0x00001913,0x000200f9,0x00001954, | ||
| 2875 | 0x000200f8,0x00001954,0x000700f5,0x00000012, | ||
| 2876 | 0x00001955,0x0000194d,0x00001948,0x00001953, | ||
| 2877 | 0x0000194e,0x000200f9,0x00001956,0x000200f8, | ||
| 2878 | 0x00001956,0x000700f5,0x00000012,0x00001957, | ||
| 2879 | 0x00001946,0x000018d1,0x00001955,0x00001954, | ||
| 2880 | 0x000300f7,0x000018e1,0x00000000,0x000400fa, | ||
| 2881 | 0x00001957,0x000018dc,0x000018de,0x000200f8, | ||
| 2882 | 0x000018de,0x00050080,0x00000006,0x000018e0, | ||
| 2883 | 0x000018d5,0x00000063,0x000200f9,0x000018e1, | ||
| 2884 | 0x000200f8,0x000018dc,0x000200f9,0x000018e1, | ||
| 2885 | 0x000200f8,0x000018e1,0x000700f5,0x00000006, | ||
| 2886 | 0x00002188,0x00001ee0,0x000018dc,0x000018e0, | ||
| 2887 | 0x000018de,0x000600a9,0x00000006,0x000021a2, | ||
| 2888 | 0x00001957,0x000018d5,0x00001ee1,0x000200f9, | ||
| 2889 | 0x000018e2,0x000200f8,0x000018e2,0x000200f9, | ||
| 2890 | 0x000018cc,0x000200f8,0x000018e3,0x000500aa, | ||
| 2891 | 0x00000012,0x000018e5,0x00001ee0,0x00000058, | ||
| 2892 | 0x000300f7,0x000018e7,0x00000000,0x000400fa, | ||
| 2893 | 0x000018e5,0x000018e6,0x000018e7,0x000200f8, | ||
| 2894 | 0x000018e6,0x000200f9,0x000018fa,0x000200f8, | ||
| 2895 | 0x000018e7,0x00050082,0x00000006,0x000018e9, | ||
| 2896 | 0x00001ee0,0x00000063,0x00050084,0x00000006, | ||
| 2897 | 0x000018ea,0x0000009e,0x000018e9,0x00050080, | ||
| 2898 | 0x00000006,0x000018eb,0x000018ea,0x000000d8, | ||
| 2899 | 0x00050051,0x00000006,0x00001975,0x000014c4, | ||
| 2900 | 0x00000000,0x00050084,0x00000006,0x00001977, | ||
| 2901 | 0x000018eb,0x0000009e,0x00050095,0x0000005e, | ||
| 2902 | 0x00001978,0x00001975,0x00001977,0x00050051, | ||
| 2903 | 0x00000006,0x00001979,0x00001978,0x00000001, | ||
| 2904 | 0x00050051,0x00000006,0x0000197a,0x00001978, | ||
| 2905 | 0x00000000,0x00050051,0x00000006,0x0000197d, | ||
| 2906 | 0x000014c4,0x00000001,0x00050080,0x00000006, | ||
| 2907 | 0x0000197f,0x0000197d,0x00001979,0x00050050, | ||
| 2908 | 0x00000007,0x00001980,0x0000197a,0x0000197f, | ||
| 2909 | 0x0004007c,0x000000b1,0x0000196d,0x00001980, | ||
| 2910 | 0x00060041,0x000000b7,0x0000196e,0x0000196d, | ||
| 2911 | 0x000000b6,0x000000b6,0x0006003d,0x00000006, | ||
| 2912 | 0x0000196f,0x0000196e,0x00000002,0x00000004, | ||
| 2913 | 0x00050080,0x00000006,0x00001962,0x000018ea, | ||
| 2914 | 0x000000de,0x00050084,0x00000006,0x00001992, | ||
| 2915 | 0x00001962,0x0000009e,0x00050095,0x0000005e, | ||
| 2916 | 0x00001993,0x00001975,0x00001992,0x00050051, | ||
| 2917 | 0x00000006,0x00001994,0x00001993,0x00000001, | ||
| 2918 | 0x00050051,0x00000006,0x00001995,0x00001993, | ||
| 2919 | 0x00000000,0x00050080,0x00000006,0x0000199a, | ||
| 2920 | 0x0000197d,0x00001994,0x00050050,0x00000007, | ||
| 2921 | 0x0000199b,0x00001995,0x0000199a,0x0004007c, | ||
| 2922 | 0x000000b1,0x00001988,0x0000199b,0x00060041, | ||
| 2923 | 0x000000b7,0x00001989,0x00001988,0x000000b6, | ||
| 2924 | 0x000000b6,0x0006003d,0x00000006,0x0000198a, | ||
| 2925 | 0x00001989,0x00000002,0x00000004,0x000500b0, | ||
| 2926 | 0x00000012,0x000019a2,0x000013bc,0x0000198a, | ||
| 2927 | 0x000400a8,0x00000012,0x000019a3,0x000019a2, | ||
| 2928 | 0x000300f7,0x000019b2,0x00000000,0x000400fa, | ||
| 2929 | 0x000019a3,0x000019a4,0x000019b2,0x000200f8, | ||
| 2930 | 0x000019a4,0x000500aa,0x00000012,0x000019a9, | ||
| 2931 | 0x000013bc,0x0000198a,0x000300f7,0x000019b0, | ||
| 2932 | 0x00000000,0x000400fa,0x000019a9,0x000019aa, | ||
| 2933 | 0x000019b0,0x000200f8,0x000019aa,0x000500b0, | ||
| 2934 | 0x00000012,0x000019af,0x000013b9,0x0000196f, | ||
| 2935 | 0x000200f9,0x000019b0,0x000200f8,0x000019b0, | ||
| 2936 | 0x000700f5,0x00000012,0x000019b1,0x000019a9, | ||
| 2937 | 0x000019a4,0x000019af,0x000019aa,0x000200f9, | ||
| 2938 | 0x000019b2,0x000200f8,0x000019b2,0x000700f5, | ||
| 2939 | 0x00000012,0x000019b3,0x000019a2,0x000018e7, | ||
| 2940 | 0x000019b1,0x000019b0,0x000300f7,0x000018f8, | ||
| 2941 | 0x00000000,0x000400fa,0x000019b3,0x000018f1, | ||
| 2942 | 0x000018f8,0x000200f8,0x000018f1,0x00050096, | ||
| 2943 | 0x0000005e,0x000019bc,0x0000196f,0x000013b9, | ||
| 2944 | 0x00050051,0x00000006,0x000019bd,0x000019bc, | ||
| 2945 | 0x00000001,0x00050051,0x00000006,0x000019be, | ||
| 2946 | 0x000019bc,0x00000000,0x00050082,0x00000006, | ||
| 2947 | 0x000019c4,0x0000198a,0x000013bc,0x00050082, | ||
| 2948 | 0x00000006,0x000019c6,0x000019c4,0x000019bd, | ||
| 2949 | 0x000500aa,0x00000012,0x000019d5,0x000019c6, | ||
| 2950 | 0x00000058,0x000300f7,0x000019dc,0x00000000, | ||
| 2951 | 0x000400fa,0x000019d5,0x000019d6,0x000019dc, | ||
| 2952 | 0x000200f8,0x000019d6,0x000500b0,0x00000012, | ||
| 2953 | 0x000019db,0x000019be,0x00000063,0x000200f9, | ||
| 2954 | 0x000019dc,0x000200f8,0x000019dc,0x000700f5, | ||
| 2955 | 0x00000012,0x000019dd,0x000019d5,0x000018f1, | ||
| 2956 | 0x000019db,0x000019d6,0x000400a8,0x00000012, | ||
| 2957 | 0x000018f7,0x000019dd,0x000200f9,0x000018f8, | ||
| 2958 | 0x000200f8,0x000018f8,0x000700f5,0x00000012, | ||
| 2959 | 0x000018f9,0x000019b3,0x000019b2,0x000018f7, | ||
| 2960 | 0x000019dc,0x000200f9,0x000018fa,0x000200f8, | ||
| 2961 | 0x000018fa,0x000700f5,0x00000012,0x00001ee2, | ||
| 2962 | 0x0000011e,0x000018e6,0x000018f9,0x000018f8, | ||
| 2963 | 0x000400a8,0x00000012,0x000014c9,0x00001ee2, | ||
| 2964 | 0x000200f9,0x000014ca,0x000200f8,0x000014ca, | ||
| 2965 | 0x000700f5,0x00000012,0x000014cb,0x000014c1, | ||
| 2966 | 0x000014ba,0x000014c9,0x000018fa,0x000300f7, | ||
| 2967 | 0x000014cd,0x00000000,0x000400fa,0x000014cb, | ||
| 2968 | 0x000014cc,0x000014cd,0x000200f8,0x000014cc, | ||
| 2969 | 0x000200f9,0x000014ce,0x000200f8,0x000014cd, | ||
| 2970 | 0x000200f9,0x000014ce,0x000200f8,0x000014ce, | ||
| 2971 | 0x001100f5,0x00000027,0x00001f7e,0x00000498, | ||
| 2972 | 0x000013b6,0x00001c14,0x000013c7,0x00001f7f, | ||
| 2973 | 0x00001429,0x00000498,0x00001455,0x00001ede, | ||
| 2974 | 0x000014b8,0x00001ca4,0x000014cc,0x00001ca4, | ||
| 2975 | 0x000014cd,0x001100f5,0x00000006,0x00001ee9, | ||
| 2976 | 0x00000058,0x000013b6,0x00000063,0x000013c7, | ||
| 2977 | 0x00000063,0x00001429,0x00000063,0x00001455, | ||
| 2978 | 0x00001eea,0x000014b8,0x00000063,0x000014cc, | ||
| 2979 | 0x000000d8,0x000014cd,0x000500aa,0x00000012, | ||
| 2980 | 0x000004d0,0x00001ee9,0x000000d8,0x000300f7, | ||
| 2981 | 0x000004d2,0x00000000,0x000400fa,0x000004d0, | ||
| 2982 | 0x000004d1,0x000004d2,0x000200f8,0x000004d1, | ||
| 2983 | 0x00050041,0x00000182,0x000004d3,0x00000180, | ||
| 2984 | 0x000004c2,0x0004003d,0x00000006,0x000004d4, | ||
| 2985 | 0x000004d3,0x000500c4,0x00000006,0x000004d5, | ||
| 2986 | 0x000004d4,0x000004c5,0x000500c4,0x00000006, | ||
| 2987 | 0x000004d7,0x0000044f,0x00000063,0x000500c5, | ||
| 2988 | 0x00000006,0x000004d8,0x000004d5,0x000004d7, | ||
| 2989 | 0x000500c5,0x00000006,0x000004d9,0x000004d8, | ||
| 2990 | 0x00000063,0x00050041,0x0000020a,0x000019e3, | ||
| 2991 | 0x00000180,0x000003dd,0x0004003d,0x00000007, | ||
| 2992 | 0x000019e4,0x000019e3,0x0004007c,0x000000b1, | ||
| 2993 | 0x000019e5,0x000019e4,0x00060041,0x000000b7, | ||
| 2994 | 0x000019e7,0x000019e5,0x000000b6,0x000000b6, | ||
| 2995 | 0x000700ea,0x00000006,0x000019e8,0x000019e7, | ||
| 2996 | 0x00000063,0x00000058,0x00000063,0x00060041, | ||
| 2997 | 0x000000b7,0x000019eb,0x000019e5,0x000000b6, | ||
| 2998 | 0x000003bc,0x0006003d,0x00000006,0x000019ec, | ||
| 2999 | 0x000019eb,0x00000002,0x00000004,0x000500b0, | ||
| 3000 | 0x00000012,0x000019ed,0x000019e8,0x000019ec, | ||
| 3001 | 0x000300f7,0x000019f7,0x00000000,0x000400fa, | ||
| 3002 | 0x000019ed,0x000019ee,0x000019f4,0x000200f8, | ||
| 3003 | 0x000019f4,0x00060041,0x000000b7,0x000019f6, | ||
| 3004 | 0x000019e5,0x000000b6,0x000003f3,0x0005003e, | ||
| 3005 | 0x000019f6,0x00000063,0x00000002,0x00000004, | ||
| 3006 | 0x000200f9,0x000019f7,0x000200f8,0x000019ee, | ||
| 3007 | 0x00050080,0x00000006,0x000019f1,0x0000009e, | ||
| 3008 | 0x000019e8,0x00060041,0x000000b7,0x000019f3, | ||
| 3009 | 0x000019e5,0x000000b6,0x000019f1,0x0005003e, | ||
| 3010 | 0x000019f3,0x000004d9,0x00000002,0x00000004, | ||
| 3011 | 0x000200f9,0x000019f7,0x000200f8,0x000019f7, | ||
| 3012 | 0x000200f9,0x000004d2,0x000200f8,0x000004d2, | ||
| 3013 | 0x000200f9,0x000004ba,0x000200f8,0x000004ba, | ||
| 3014 | 0x000700f5,0x00000027,0x00001fbe,0x00000498, | ||
| 3015 | 0x000004a9,0x00001f7e,0x000004d2,0x000700f5, | ||
| 3016 | 0x00000027,0x00001f8b,0x0000219c,0x000004a9, | ||
| 3017 | 0x00001df6,0x000004d2,0x00050041,0x0000020a, | ||
| 3018 | 0x000004dd,0x00000180,0x000003bc,0x0004003d, | ||
| 3019 | 0x00000007,0x000004de,0x000004dd,0x0004007c, | ||
| 3020 | 0x00000468,0x000004df,0x000004de,0x00060041, | ||
| 3021 | 0x00000474,0x000004e4,0x000004df,0x000000b6, | ||
| 3022 | 0x0000048f,0x0005003e,0x000004e4,0x00001f8b, | ||
| 3023 | 0x00000002,0x00000010,0x00060041,0x00000474, | ||
| 3024 | 0x000004ea,0x000004df,0x000000b6,0x00000496, | ||
| 3025 | 0x0005003e,0x000004ea,0x00001fbe,0x00000002, | ||
| 3026 | 0x00000010,0x000300f7,0x000004ed,0x00000000, | ||
| 3027 | 0x000400fa,0x0000045b,0x000004ec,0x000004ed, | ||
| 3028 | 0x000200f8,0x000004ec,0x00050041,0x0000020a, | ||
| 3029 | 0x000004ef,0x00000180,0x00000451,0x0004003d, | ||
| 3030 | 0x00000007,0x000004f0,0x000004ef,0x0004007c, | ||
| 3031 | 0x00000468,0x000004f1,0x000004f0,0x000300f7, | ||
| 3032 | 0x000004fd,0x00000000,0x000400fa,0x000004b8, | ||
| 3033 | 0x000004fc,0x00000503,0x000200f8,0x00000503, | ||
| 3034 | 0x000200f9,0x000004fd,0x000200f8,0x000004fc, | ||
| 3035 | 0x000300f7,0x00001a40,0x00000000,0x000300fb, | ||
| 3036 | 0x00000058,0x00001a01,0x000200f8,0x00001a01, | ||
| 3037 | 0x000500ab,0x00000012,0x00001a05,0x000004b7, | ||
| 3038 | 0x00000058,0x000400a8,0x00000012,0x00001a06, | ||
| 3039 | 0x00001a05,0x000300f7,0x00001a0b,0x00000000, | ||
| 3040 | 0x000400fa,0x00001a06,0x00001a07,0x00001a0b, | ||
| 3041 | 0x000200f8,0x00001a07,0x00050051,0x00000006, | ||
| 3042 | 0x00001a09,0x0000219c,0x00000002,0x000500aa, | ||
| 3043 | 0x00000012,0x00001a0a,0x00001a09,0x00000058, | ||
| 3044 | 0x000200f9,0x00001a0b,0x000200f8,0x00001a0b, | ||
| 3045 | 0x000700f5,0x00000012,0x00001a0c,0x00001a05, | ||
| 3046 | 0x00001a01,0x00001a0a,0x00001a07,0x000300f7, | ||
| 3047 | 0x00001a0e,0x00000000,0x000400fa,0x00001a0c, | ||
| 3048 | 0x00001a0d,0x00001a0e,0x000200f8,0x00001a0d, | ||
| 3049 | 0x000200f9,0x00001a40,0x000200f8,0x00001a0e, | ||
| 3050 | 0x00050051,0x00000006,0x00001a10,0x0000219c, | ||
| 3051 | 0x00000001,0x000500c2,0x00000006,0x00001a11, | ||
| 3052 | 0x00001a10,0x000000e4,0x000500c7,0x00000006, | ||
| 3053 | 0x00001a12,0x00001a11,0x000001ad,0x00050051, | ||
| 3054 | 0x00000006,0x00001a14,0x0000219c,0x00000002, | ||
| 3055 | 0x000500aa,0x00000012,0x00001a16,0x00001a12, | ||
| 3056 | 0x00000058,0x000600a9,0x00000006,0x00001a18, | ||
| 3057 | 0x00001a16,0x00000063,0x00001a12,0x00050097, | ||
| 3058 | 0x0000005e,0x00001a1b,0x00001a14,0x00001a18, | ||
| 3059 | 0x00050051,0x00000006,0x00001a1c,0x00001a1b, | ||
| 3060 | 0x00000000,0x00050051,0x00000006,0x00001a1d, | ||
| 3061 | 0x00001a1b,0x00000001,0x00050051,0x00000006, | ||
| 3062 | 0x00001a1f,0x00001f8b,0x00000002,0x000500aa, | ||
| 3063 | 0x00000012,0x00001a20,0x00001a1f,0x00000058, | ||
| 3064 | 0x000300f7,0x00001a29,0x00000000,0x000400fa, | ||
| 3065 | 0x00001a20,0x00001a21,0x00001a22,0x000200f8, | ||
| 3066 | 0x00001a22,0x00050051,0x00000006,0x00001a24, | ||
| 3067 | 0x00001f8b,0x00000000,0x00050051,0x00000006, | ||
| 3068 | 0x00001a26,0x00001f8b,0x00000001,0x000500c7, | ||
| 3069 | 0x00000006,0x00001a27,0x00001a26,0x0000017b, | ||
| 3070 | 0x00050050,0x00000007,0x00001a28,0x00001a24, | ||
| 3071 | 0x00001a27,0x000200f9,0x00001a29,0x000200f8, | ||
| 3072 | 0x00001a21,0x000200f9,0x00001a29,0x000200f8, | ||
| 3073 | 0x00001a29,0x000700f5,0x00000007,0x00002069, | ||
| 3074 | 0x000001c2,0x00001a21,0x00001a28,0x00001a22, | ||
| 3075 | 0x00050051,0x00000006,0x00001a2c,0x0000219c, | ||
| 3076 | 0x00000000,0x000500c7,0x00000006,0x00001a2f, | ||
| 3077 | 0x00001a10,0x0000017b,0x00050051,0x00000006, | ||
| 3078 | 0x00001a31,0x00002069,0x00000001,0x000500c4, | ||
| 3079 | 0x00000006,0x00001a32,0x00001a31,0x000000e4, | ||
| 3080 | 0x000500c5,0x00000006,0x00001a33,0x00001a2f, | ||
| 3081 | 0x00001a32,0x00050051,0x00000006,0x00001a35, | ||
| 3082 | 0x00002069,0x00000000,0x000500ab,0x00000012, | ||
| 3083 | 0x00001a38,0x00001a1d,0x00000058,0x000600a9, | ||
| 3084 | 0x00000006,0x000021a3,0x00001a38,0x000001dc, | ||
| 3085 | 0x00001a1c,0x00070050,0x00000027,0x00001a3f, | ||
| 3086 | 0x00001a2c,0x00001a33,0x00001a35,0x000021a3, | ||
| 3087 | 0x000200f9,0x00001a40,0x000200f8,0x00001a40, | ||
| 3088 | 0x000700f5,0x00000027,0x0000206b,0x000001a7, | ||
| 3089 | 0x00001a0d,0x00001a3f,0x00001a29,0x000200f9, | ||
| 3090 | 0x000004fd,0x000200f8,0x000004fd,0x000700f5, | ||
| 3091 | 0x00000027,0x0000206c,0x0000206b,0x00001a40, | ||
| 3092 | 0x000001a7,0x00000503,0x00060041,0x00000474, | ||
| 3093 | 0x00000505,0x000004f1,0x000000b6,0x0000048f, | ||
| 3094 | 0x0005003e,0x00000505,0x0000206c,0x00000002, | ||
| 3095 | 0x00000010,0x000300f7,0x0000050d,0x00000000, | ||
| 3096 | 0x000400fa,0x000004b8,0x0000050c,0x00000513, | ||
| 3097 | 0x000200f8,0x00000513,0x000200f9,0x0000050d, | ||
| 3098 | 0x000200f8,0x0000050c,0x000300f7,0x00001a8a, | ||
| 3099 | 0x00000000,0x000300fb,0x00000058,0x00001a4b, | ||
| 3100 | 0x000200f8,0x00001a4b,0x00050051,0x00000006, | ||
| 3101 | 0x00001a4d,0x00000498,0x00000003,0x000500c2, | ||
| 3102 | 0x00000006,0x00001a4e,0x00001a4d,0x0000019b, | ||
| 3103 | 0x000500ab,0x00000012,0x00001a4f,0x00001a4e, | ||
| 3104 | 0x00000058,0x000400a8,0x00000012,0x00001a50, | ||
| 3105 | 0x00001a4f,0x000300f7,0x00001a55,0x00000000, | ||
| 3106 | 0x000400fa,0x00001a50,0x00001a51,0x00001a55, | ||
| 3107 | 0x000200f8,0x00001a51,0x00050051,0x00000006, | ||
| 3108 | 0x00001a53,0x00000498,0x00000002,0x000500aa, | ||
| 3109 | 0x00000012,0x00001a54,0x00001a53,0x00000058, | ||
| 3110 | 0x000200f9,0x00001a55,0x000200f8,0x00001a55, | ||
| 3111 | 0x000700f5,0x00000012,0x00001a56,0x00001a4f, | ||
| 3112 | 0x00001a4b,0x00001a54,0x00001a51,0x000300f7, | ||
| 3113 | 0x00001a58,0x00000000,0x000400fa,0x00001a56, | ||
| 3114 | 0x00001a57,0x00001a58,0x000200f8,0x00001a57, | ||
| 3115 | 0x000200f9,0x00001a8a,0x000200f8,0x00001a58, | ||
| 3116 | 0x00050051,0x00000006,0x00001a5a,0x00000498, | ||
| 3117 | 0x00000001,0x000500c2,0x00000006,0x00001a5b, | ||
| 3118 | 0x00001a5a,0x000000e4,0x000500c7,0x00000006, | ||
| 3119 | 0x00001a5c,0x00001a5b,0x000001ad,0x00050051, | ||
| 3120 | 0x00000006,0x00001a5e,0x00000498,0x00000002, | ||
| 3121 | 0x000500aa,0x00000012,0x00001a60,0x00001a5c, | ||
| 3122 | 0x00000058,0x000600a9,0x00000006,0x00001a62, | ||
| 3123 | 0x00001a60,0x00000063,0x00001a5c,0x00050097, | ||
| 3124 | 0x0000005e,0x00001a65,0x00001a5e,0x00001a62, | ||
| 3125 | 0x00050051,0x00000006,0x00001a66,0x00001a65, | ||
| 3126 | 0x00000000,0x00050051,0x00000006,0x00001a67, | ||
| 3127 | 0x00001a65,0x00000001,0x00050051,0x00000006, | ||
| 3128 | 0x00001a69,0x00001fbe,0x00000002,0x000500aa, | ||
| 3129 | 0x00000012,0x00001a6a,0x00001a69,0x00000058, | ||
| 3130 | 0x000300f7,0x00001a73,0x00000000,0x000400fa, | ||
| 3131 | 0x00001a6a,0x00001a6b,0x00001a6c,0x000200f8, | ||
| 3132 | 0x00001a6c,0x00050051,0x00000006,0x00001a6e, | ||
| 3133 | 0x00001fbe,0x00000000,0x00050051,0x00000006, | ||
| 3134 | 0x00001a70,0x00001fbe,0x00000001,0x000500c7, | ||
| 3135 | 0x00000006,0x00001a71,0x00001a70,0x0000017b, | ||
| 3136 | 0x00050050,0x00000007,0x00001a72,0x00001a6e, | ||
| 3137 | 0x00001a71,0x000200f9,0x00001a73,0x000200f8, | ||
| 3138 | 0x00001a6b,0x000200f9,0x00001a73,0x000200f8, | ||
| 3139 | 0x00001a73,0x000700f5,0x00000007,0x0000211f, | ||
| 3140 | 0x000001c2,0x00001a6b,0x00001a72,0x00001a6c, | ||
| 3141 | 0x00050051,0x00000006,0x00001a76,0x00000498, | ||
| 3142 | 0x00000000,0x000500c7,0x00000006,0x00001a79, | ||
| 3143 | 0x00001a5a,0x0000017b,0x00050051,0x00000006, | ||
| 3144 | 0x00001a7b,0x0000211f,0x00000001,0x000500c4, | ||
| 3145 | 0x00000006,0x00001a7c,0x00001a7b,0x000000e4, | ||
| 3146 | 0x000500c5,0x00000006,0x00001a7d,0x00001a79, | ||
| 3147 | 0x00001a7c,0x00050051,0x00000006,0x00001a7f, | ||
| 3148 | 0x0000211f,0x00000000,0x000500ab,0x00000012, | ||
| 3149 | 0x00001a82,0x00001a67,0x00000058,0x000600a9, | ||
| 3150 | 0x00000006,0x000021a4,0x00001a82,0x000001dc, | ||
| 3151 | 0x00001a66,0x00070050,0x00000027,0x00001a89, | ||
| 3152 | 0x00001a76,0x00001a7d,0x00001a7f,0x000021a4, | ||
| 3153 | 0x000200f9,0x00001a8a,0x000200f8,0x00001a8a, | ||
| 3154 | 0x000700f5,0x00000027,0x00002121,0x000001a7, | ||
| 3155 | 0x00001a57,0x00001a89,0x00001a73,0x000200f9, | ||
| 3156 | 0x0000050d,0x000200f8,0x0000050d,0x000700f5, | ||
| 3157 | 0x00000027,0x00002122,0x00002121,0x00001a8a, | ||
| 3158 | 0x000001a7,0x00000513,0x00060041,0x00000474, | ||
| 3159 | 0x00000515,0x000004f1,0x000000b6,0x00000496, | ||
| 3160 | 0x0005003e,0x00000515,0x00002122,0x00000002, | ||
| 3161 | 0x00000010,0x000200f9,0x000004ed,0x000200f8, | ||
| 3162 | 0x000004ed,0x000200f9,0x00000518,0x000200f8, | ||
| 3163 | 0x00000518,0x000100fd,0x00010038} | ||
diff --git a/runtime/src/console_heap_fix_spv.h b/runtime/src/console_heap_fix_spv.h new file mode 100644 index 000000000..026f1c794 --- /dev/null +++ b/runtime/src/console_heap_fix_spv.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #pragma once | ||
| 2 | #include <cstdint> | ||
| 3 | |||
| 4 | namespace leonida { | ||
| 5 | |||
| 6 | // console_heap_fix.comp compiled with: glslc --target-env=vulkan1.2 -O -mfmt=c console_heap_fix.comp -o console_heap_fix.inc | ||
| 7 | inline constexpr std::uint32_t console_heap_fix_spirv[] = | ||
| 8 | #include "console_heap_fix.inc" | ||
| 9 | ; | ||
| 10 | |||
| 11 | } // namespace leonida | ||
diff --git a/runtime/src/console_heap_gpu.h b/runtime/src/console_heap_gpu.h new file mode 100644 index 000000000..b3a4c0ba4 --- /dev/null +++ b/runtime/src/console_heap_gpu.h | |||
| @@ -0,0 +1,1058 @@ | |||
| 1 | // Console descriptor heap translation on the GPU (LEONIDA_CONSOLE_HEAP_GPU=1): the buffer V#s the title writes into | ||
| 2 | // its console descriptor heaps are rebased by a compute pass (console_heap_fix.comp) at the start of the submission | ||
| 3 | // that reads them, instead of one by one on the submitting thread (DeviceState::fix_console_slot). | ||
| 4 | // | ||
| 5 | // What stays on the CPU (shims/d3d12_vulkan_device.cpp): finding the changed slots (the heap's ShadowPages and a | ||
| 6 | // compare against the bytes each slot was last made from), registering the T#s (they are copied as they are; shaders | ||
| 7 | // find them by their words), and every lookup that can make something: a V# the pass cannot answer is written with no | ||
| 8 | // records and recorded in the pass's miss list; once the submission is done the CPU resolves its words with | ||
| 9 | // vsharp_address (which may make a geometry copy), enters the answer in the key table, and queues the slot again. | ||
| 10 | // | ||
| 11 | // The pass answers a V# half from four tables, in vsharp_address's order: | ||
| 12 | // - the range table: the title-VA ranges of the alias table (src/title_va_alias.h), sorted, each with the shader VA | ||
| 13 | // of its copy and whether the CPU found that copy backed. Rebuilt when the alias table or the backings change; | ||
| 14 | // - the backed table: the shader-VA spans of the live GPU allocations (DeviceState's gpu_backings, merged) and of | ||
| 15 | // the geometry copies' blocks. A base already inside one (a V# our API wrote, or the title copied) is left as it | ||
| 16 | // is, as vsharp_address's backed() leaves it. Merged neighbours make it a superset of what backed() accepts, but | ||
| 17 | // never of memory that is not there; | ||
| 18 | // - the key table: the exact 16 bytes of a V# half and what vsharp_address answered for them (a shader VA, or no | ||
| 19 | // backing), open addressed with up to kProbes slots per key (FNV-1a and fmix32). The CPU keeps the | ||
| 20 | // mirror below; its changes reach the GPU as updates the pass applies first, so the table changes in GPU order; | ||
| 21 | // - the ask table: the title's memory and its GPU windows. A base outside them that nothing above answered gets no | ||
| 22 | // records (vsharp_address could only answer 0); one inside them is a miss, for the CPU. | ||
| 23 | // When a backing or an alias range goes, every key entry whose answer falls in its shader VAs is dropped and every V# | ||
| 24 | // slot of the heap is translated again. | ||
| 25 | // | ||
| 26 | // ConsoleHeapKeys and console_heap_translate_slot are the CPU reference of the pass (vk_console_heap_gpu_test checks | ||
| 27 | // the GPU against them); ConsoleHeapGpu records the pass. | ||
| 28 | #pragma once | ||
| 29 | #ifndef VK_NO_PROTOTYPES | ||
| 30 | #define VK_NO_PROTOTYPES | ||
| 31 | #endif | ||
| 32 | #include <vulkan/vulkan.h> | ||
| 33 | |||
| 34 | #include <algorithm> | ||
| 35 | #include <array> | ||
| 36 | #include <cstdint> | ||
| 37 | #include <cstring> | ||
| 38 | #include <map> | ||
| 39 | #include <memory> | ||
| 40 | #include <mutex> | ||
| 41 | #include <utility> | ||
| 42 | #include <vector> | ||
| 43 | |||
| 44 | #include "console_heap_fix_spv.h" | ||
| 45 | #include "vulkan_aftermath.h" | ||
| 46 | #include "vulkan_memory.h" | ||
| 47 | |||
| 48 | namespace leonida { | ||
| 49 | |||
| 50 | struct ConsoleHeapRange { | ||
| 51 | std::uint64_t title_va = 0, end = 0, shader_va = 0; | ||
| 52 | bool checked = false; // the whole [shader_va, shader_va + end - title_va) is backed | ||
| 53 | }; | ||
| 54 | |||
| 55 | // Sorted, disjoint [start, end) spans: the backed and ask tables. | ||
| 56 | using ConsoleHeapSpans = std::vector<std::pair<std::uint64_t, std::uint64_t>>; | ||
| 57 | |||
| 58 | // Sorts and merges spans (overlapping or touching ones become one); empty and wrapping ones are dropped. | ||
| 59 | inline void merge_console_heap_spans(ConsoleHeapSpans& spans) { | ||
| 60 | std::erase_if(spans, [](const auto& s) { return s.second <= s.first; }); | ||
| 61 | std::sort(spans.begin(), spans.end()); | ||
| 62 | std::size_t out = 0; | ||
| 63 | for (std::size_t i = 0; i < spans.size(); ++i) { | ||
| 64 | if (out && spans[i].first <= spans[out - 1].second) spans[out - 1].second = std::max(spans[out - 1].second, spans[i].second); | ||
| 65 | else spans[out++] = spans[i]; | ||
| 66 | } | ||
| 67 | spans.resize(out); | ||
| 68 | } | ||
| 69 | |||
| 70 | // [v, v + bytes) inside one span (bytes 0 counts as 1). | ||
| 71 | inline bool console_heap_spans_hold(const ConsoleHeapSpans& spans, std::uint64_t v, std::uint64_t bytes) { | ||
| 72 | auto it = std::upper_bound(spans.begin(), spans.end(), v, | ||
| 73 | [](std::uint64_t x, const auto& s) { return x < s.first; }); | ||
| 74 | if (it == spans.begin()) return false; | ||
| 75 | --it; | ||
| 76 | const std::uint64_t n = std::max<std::uint64_t>(bytes, 1); | ||
| 77 | return v < it->second && n <= it->second - v; | ||
| 78 | } | ||
| 79 | |||
| 80 | // What the reference (and the pass) answers from, besides the key table. | ||
| 81 | struct ConsoleHeapTables { | ||
| 82 | std::vector<ConsoleHeapRange> ranges; | ||
| 83 | ConsoleHeapSpans backed; | ||
| 84 | ConsoleHeapSpans ask; | ||
| 85 | bool use_ask = false; // without it every unanswered half is a miss | ||
| 86 | bool signed_offsets = false; // LEONIDA_IMPORT_BELOW_ARENA: a base with bit 47 set is a negative offset | ||
| 87 | }; | ||
| 88 | |||
| 89 | // The key table's CPU mirror. An entry's GPU form is 8 dwords: the key, the answer's low 32 bits, its bits 32-47 and | ||
| 90 | // the flags in bits 16-31 of the sixth, two pad dwords. | ||
| 91 | class ConsoleHeapKeys { | ||
| 92 | public: | ||
| 93 | using Key = std::array<std::uint32_t, 4>; | ||
| 94 | static constexpr std::uint32_t kProbes = 16; | ||
| 95 | static constexpr std::uint32_t kUsed = 1, kNone = 2; | ||
| 96 | static constexpr std::uint32_t kEntryWords = 8, kUpdateWords = 12; | ||
| 97 | |||
| 98 | explicit ConsoleHeapKeys(std::uint32_t log2_entries = 20) | ||
| 99 | : mask_((1u << std::min<std::uint32_t>(log2_entries, 26)) - 1), entries_(std::size_t(mask_) + 1), | ||
| 100 | dirty_flag_(std::size_t(mask_) + 1, 0) {} | ||
| 101 | |||
| 102 | // FNV-1a over the four dwords, then MurmurHash3's fmix32 (console_heap_fix.comp key_hash): the finalizer makes | ||
| 103 | // the low bits, which index the table, depend on every bit of the key. Bare FNV-1a put every V# whose base | ||
| 104 | // differed only above bit 20 into one probe chain, and the 17th of them found no slot. | ||
| 105 | static std::uint32_t hash(const Key& k) { | ||
| 106 | std::uint32_t h = 2166136261u; | ||
| 107 | for (const std::uint32_t w : k) h = (h ^ w) * 16777619u; | ||
| 108 | h ^= h >> 16; | ||
| 109 | h *= 0x85EBCA6Bu; | ||
| 110 | h ^= h >> 13; | ||
| 111 | h *= 0xC2B2AE35u; | ||
| 112 | h ^= h >> 16; | ||
| 113 | return h; | ||
| 114 | } | ||
| 115 | |||
| 116 | std::uint32_t mask() const { return mask_; } | ||
| 117 | std::size_t size() const { return used_; } | ||
| 118 | std::size_t capacity() const { return entries_.size(); } | ||
| 119 | |||
| 120 | // The entry's index, or -1. | ||
| 121 | std::int64_t find(const Key& k) const { | ||
| 122 | const std::uint32_t h = hash(k); | ||
| 123 | for (std::uint32_t p = 0; p < kProbes; ++p) { | ||
| 124 | const std::uint32_t at = (h + p) & mask_; | ||
| 125 | if (entries_[at].flags & kUsed && entries_[at].key == k) return at; | ||
| 126 | } | ||
| 127 | return -1; | ||
| 128 | } | ||
| 129 | // True with the answer when the key is entered: `none` for no backing. | ||
| 130 | bool lookup(const Key& k, std::uint64_t& to, bool& none) const { | ||
| 131 | const std::int64_t at = find(k); | ||
| 132 | if (at < 0) return false; | ||
| 133 | to = entries_[std::size_t(at)].to; | ||
| 134 | none = entries_[std::size_t(at)].flags & kNone; | ||
| 135 | return true; | ||
| 136 | } | ||
| 137 | |||
| 138 | // Enters (or replaces) the answer for `k`: the shader VA `to` reaching `span` bytes, or no backing. False when all | ||
| 139 | // of the key's probe slots hold other keys. | ||
| 140 | bool put(const Key& k, std::uint64_t to, std::uint64_t span, bool none) { | ||
| 141 | std::int64_t at = find(k); | ||
| 142 | if (at < 0) { | ||
| 143 | const std::uint32_t h = hash(k); | ||
| 144 | for (std::uint32_t p = 0; p < kProbes && at < 0; ++p) | ||
| 145 | if (!(entries_[(h + p) & mask_].flags & kUsed)) at = (h + p) & mask_; | ||
| 146 | if (at < 0) return false; | ||
| 147 | ++used_; | ||
| 148 | } else { | ||
| 149 | unindex(std::uint32_t(at)); | ||
| 150 | } | ||
| 151 | Entry& e = entries_[std::size_t(at)]; | ||
| 152 | e.key = k; | ||
| 153 | e.to = to; | ||
| 154 | e.span = span; | ||
| 155 | e.flags = kUsed | (none ? kNone : 0); | ||
| 156 | if (!none) { | ||
| 157 | by_to_.emplace(to, std::uint32_t(at)); | ||
| 158 | longest_ = std::max(longest_, span); | ||
| 159 | } | ||
| 160 | touch(std::uint32_t(at)); | ||
| 161 | return true; | ||
| 162 | } | ||
| 163 | |||
| 164 | bool erase(const Key& k) { | ||
| 165 | const std::int64_t at = find(k); | ||
| 166 | if (at < 0) return false; | ||
| 167 | erase_at(std::uint32_t(at)); | ||
| 168 | return true; | ||
| 169 | } | ||
| 170 | |||
| 171 | // Every answer reaching into [start, end) of the shader VAs: dropped. Returns how many. | ||
| 172 | std::size_t erase_overlapping(std::uint64_t start, std::uint64_t end) { | ||
| 173 | if (end <= start || by_to_.empty()) return 0; | ||
| 174 | const std::uint64_t from = start > longest_ ? start - longest_ : 0; | ||
| 175 | std::vector<std::uint32_t> gone; | ||
| 176 | for (auto it = by_to_.lower_bound(from); it != by_to_.end() && it->first < end; ++it) { | ||
| 177 | const Entry& e = entries_[it->second]; | ||
| 178 | if (e.to + std::max<std::uint64_t>(e.span, 1) > start) gone.push_back(it->second); | ||
| 179 | } | ||
| 180 | for (const std::uint32_t at : gone) erase_at(at); | ||
| 181 | return gone.size(); | ||
| 182 | } | ||
| 183 | |||
| 184 | // Every "no backing" answer, for a caller that asks again after something changed: their keys. | ||
| 185 | void take_none(std::vector<Key>& out, std::size_t at_most) { | ||
| 186 | out.clear(); | ||
| 187 | for (std::uint32_t at = 0; at < entries_.size() && out.size() < at_most; ++at) { | ||
| 188 | if ((entries_[at].flags & (kUsed | kNone)) != (kUsed | kNone)) continue; | ||
| 189 | out.push_back(entries_[at].key); | ||
| 190 | erase_at(at); | ||
| 191 | } | ||
| 192 | } | ||
| 193 | |||
| 194 | void clear() { | ||
| 195 | for (std::uint32_t at = 0; at < entries_.size(); ++at) | ||
| 196 | if (entries_[at].flags & kUsed) erase_at(at); | ||
| 197 | by_to_.clear(); | ||
| 198 | longest_ = 0; | ||
| 199 | } | ||
| 200 | // Everything gone with no updates: for a GPU table that is cleared as a whole (ConsoleHeapGpu::reset_keys). | ||
| 201 | void clear_silent() { | ||
| 202 | std::fill(entries_.begin(), entries_.end(), Entry{}); | ||
| 203 | for (const std::uint32_t at : dirty_) dirty_flag_[at] = 0; | ||
| 204 | dirty_.clear(); | ||
| 205 | by_to_.clear(); | ||
| 206 | used_ = 0; | ||
| 207 | longest_ = 0; | ||
| 208 | } | ||
| 209 | |||
| 210 | void gpu_words(std::uint32_t at, std::uint32_t out[kEntryWords]) const { | ||
| 211 | const Entry& e = entries_[at]; | ||
| 212 | std::memset(out, 0, kEntryWords * 4); | ||
| 213 | if (!(e.flags & kUsed)) return; | ||
| 214 | for (int i = 0; i < 4; ++i) out[i] = e.key[i]; | ||
| 215 | out[4] = std::uint32_t(e.to); | ||
| 216 | out[5] = std::uint32_t((e.to >> 32) & 0xffffu) | (std::uint32_t(e.flags) << 16); | ||
| 217 | } | ||
| 218 | |||
| 219 | // The entries changed since the last take, as update records (index, 3 pad dwords, the entry's 8 dwords). | ||
| 220 | void take_updates(std::vector<std::uint32_t>& out) { | ||
| 221 | out.clear(); | ||
| 222 | out.reserve(dirty_.size() * kUpdateWords); | ||
| 223 | for (const std::uint32_t at : dirty_) { | ||
| 224 | dirty_flag_[at] = 0; | ||
| 225 | const std::size_t base = out.size(); | ||
| 226 | out.resize(base + kUpdateWords, 0); | ||
| 227 | out[base] = at; | ||
| 228 | gpu_words(at, out.data() + base + 4); | ||
| 229 | } | ||
| 230 | dirty_.clear(); | ||
| 231 | } | ||
| 232 | bool has_updates() const { return !dirty_.empty(); } | ||
| 233 | // Every entry again (a new GPU table, or updates that never reached the GPU). | ||
| 234 | void touch_all() { | ||
| 235 | for (std::uint32_t at = 0; at < entries_.size(); ++at) | ||
| 236 | if (entries_[at].flags & kUsed) touch(at); | ||
| 237 | } | ||
| 238 | void touch(std::uint32_t at) { | ||
| 239 | if (!dirty_flag_[at]) { | ||
| 240 | dirty_flag_[at] = 1; | ||
| 241 | dirty_.push_back(at); | ||
| 242 | } | ||
| 243 | } | ||
| 244 | |||
| 245 | private: | ||
| 246 | struct Entry { | ||
| 247 | Key key{}; | ||
| 248 | std::uint64_t to = 0; | ||
| 249 | std::uint64_t span = 0; | ||
| 250 | std::uint32_t flags = 0; | ||
| 251 | }; | ||
| 252 | void unindex(std::uint32_t at) { | ||
| 253 | const Entry& e = entries_[at]; | ||
| 254 | if (!(e.flags & kUsed) || (e.flags & kNone)) return; | ||
| 255 | auto [lo, hi] = by_to_.equal_range(e.to); | ||
| 256 | for (auto it = lo; it != hi; ++it) | ||
| 257 | if (it->second == at) { | ||
| 258 | by_to_.erase(it); | ||
| 259 | break; | ||
| 260 | } | ||
| 261 | } | ||
| 262 | void erase_at(std::uint32_t at) { | ||
| 263 | if (!(entries_[at].flags & kUsed)) return; | ||
| 264 | unindex(at); | ||
| 265 | entries_[at] = Entry{}; | ||
| 266 | --used_; | ||
| 267 | touch(at); | ||
| 268 | } | ||
| 269 | |||
| 270 | std::uint32_t mask_; | ||
| 271 | std::vector<Entry> entries_; | ||
| 272 | std::size_t used_ = 0; | ||
| 273 | std::multimap<std::uint64_t, std::uint32_t> by_to_; // positive answers by shader VA | ||
| 274 | std::uint64_t longest_ = 0; | ||
| 275 | std::vector<std::uint32_t> dirty_; | ||
| 276 | std::vector<std::uint8_t> dirty_flag_; | ||
| 277 | }; | ||
| 278 | |||
| 279 | // What the pass does to one V# half (console_heap_fix.comp translate()): 0 left as it is, 1 answered by a table | ||
| 280 | // (rebased, written with no records, or left as it is), 2 missed (written with no records). | ||
| 281 | inline unsigned console_heap_translate_half(std::uint32_t k[4], const ConsoleHeapTables& t, | ||
| 282 | const ConsoleHeapKeys& keys) { | ||
| 283 | if ((k[3] >> 30) || !k[2]) return 0; | ||
| 284 | const auto no_records = [k] { k[0] = k[1] = k[2] = 0; }; | ||
| 285 | const auto rebase = [k](std::uint64_t to) { | ||
| 286 | k[0] = std::uint32_t(to); | ||
| 287 | k[1] = (k[1] & 0xffff0000u) | std::uint32_t((to >> 32) & 0xffffu); | ||
| 288 | }; | ||
| 289 | const std::uint64_t base = std::uint64_t(k[0]) | (std::uint64_t(k[1] & 0xffffu) << 32); | ||
| 290 | if (!base) return no_records(), 1; | ||
| 291 | const std::uint32_t stride = (k[1] >> 16) & 0x3fffu; | ||
| 292 | const std::uint64_t span = std::uint64_t(k[2]) * (stride ? stride : 1); | ||
| 293 | auto it = std::upper_bound(t.ranges.begin(), t.ranges.end(), base, | ||
| 294 | [](std::uint64_t va, const ConsoleHeapRange& r) { return va < r.title_va; }); | ||
| 295 | if (it != t.ranges.begin()) { | ||
| 296 | const ConsoleHeapRange& r = *std::prev(it); | ||
| 297 | if (base < r.end && r.checked) { | ||
| 298 | if (r.end - base < span) no_records(); | ||
| 299 | else rebase(r.shader_va + (base - r.title_va)); | ||
| 300 | return 1; | ||
| 301 | } | ||
| 302 | } | ||
| 303 | std::uint64_t offset = base; | ||
| 304 | if (t.signed_offsets && (base & (1ull << 47))) offset |= ~((1ull << 48) - 1); | ||
| 305 | if (console_heap_spans_hold(t.backed, offset, span)) return 1; | ||
| 306 | const ConsoleHeapKeys::Key key{k[0], k[1], k[2], k[3]}; | ||
| 307 | std::uint64_t to = 0; | ||
| 308 | bool none = false; | ||
| 309 | if (keys.lookup(key, to, none)) { | ||
| 310 | if (none) no_records(); | ||
| 311 | else rebase(to); | ||
| 312 | return 1; | ||
| 313 | } | ||
| 314 | no_records(); | ||
| 315 | if (t.use_ask && !console_heap_spans_hold(t.ask, base, 1)) return 1; | ||
| 316 | return 2; | ||
| 317 | } | ||
| 318 | |||
| 319 | // One 32-byte slot as the pass writes it; the bit of each half that missed (1: dwords 0-3, 2: dwords 4-7). | ||
| 320 | // `zero_first`: the work item's bit 31 (ConsoleHeapGpu::kZeroFirst). | ||
| 321 | inline unsigned console_heap_translate_slot(std::uint32_t w[8], const ConsoleHeapTables& t, | ||
| 322 | const ConsoleHeapKeys& keys, bool zero_first = false) { | ||
| 323 | if (w[3] >> 30) { | ||
| 324 | if (zero_first) w[0] = w[1] = w[2] = w[3] = 0; | ||
| 325 | else return 0; | ||
| 326 | } | ||
| 327 | unsigned missed = 0; | ||
| 328 | if (console_heap_translate_half(w, t, keys) == 2) missed |= 1; | ||
| 329 | if (console_heap_translate_half(w + 4, t, keys) == 2) missed |= 2; | ||
| 330 | return missed; | ||
| 331 | } | ||
| 332 | |||
| 333 | // The pass itself: the key table on the GPU, the range table's versions, the slots to translate per heap, and the | ||
| 334 | // passes in flight with their miss lists. Every method takes the object's own lock (a leaf: it takes no other). | ||
| 335 | class ConsoleHeapGpu { | ||
| 336 | public: | ||
| 337 | static constexpr unsigned kMaxHeaps = 8; | ||
| 338 | // A queued slot's bit 31: the slot is neither a buffer pair nor a T# the CPU could decode, and the pass writes its | ||
| 339 | // dwords 0-3 as zeros. The last queue() of a slot before a pass decides it. | ||
| 340 | static constexpr std::uint32_t kZeroFirst = 0x80000000u; | ||
| 341 | static constexpr std::uint32_t kMissCapacity = 1u << 16; | ||
| 342 | static constexpr std::uint32_t kMissHeader = 4; | ||
| 343 | |||
| 344 | struct Stats { | ||
| 345 | std::uint64_t passes = 0, slots = 0, updates = 0, misses = 0, overflows = 0, tables = 0, resets = 0; | ||
| 346 | std::uint64_t rescanned = 0; // slots of rescan() dispatches | ||
| 347 | std::uint64_t filtered = 0; // slots of rescan_filtered() dispatches | ||
| 348 | std::uint64_t copies = 0, copy_bytes = 0; // queue_copy() | ||
| 349 | std::uint64_t failed = 0; // passes whose submission did not reach the queue (their work went back) | ||
| 350 | }; | ||
| 351 | enum TableKind : unsigned { range_table, backed_table, ask_table, change_shader_table, change_title_table, table_count }; | ||
| 352 | |||
| 353 | ConsoleHeapGpu(PFN_vkGetDeviceProcAddr get, VkDevice device, const VkPhysicalDeviceMemoryProperties& memory, | ||
| 354 | std::uint32_t log2_keys = 20) | ||
| 355 | : get_(get), device_(device), memory_(memory), keys_(log2_keys) {} | ||
| 356 | ~ConsoleHeapGpu() { | ||
| 357 | std::lock_guard lock(mutex_); | ||
| 358 | for (auto& pass : in_flight_) free_buffer(pass.buffer); | ||
| 359 | for (Heap& h : heaps_) free_buffer(h.meta); | ||
| 360 | for (auto& b : retired_) free_buffer(b); | ||
| 361 | for (auto& buffer : pool_) free_buffer(buffer); | ||
| 362 | for (Table& t : tables_) { | ||
| 363 | for (auto& [version, buffer] : t.old) free_buffer(buffer); | ||
| 364 | for (auto& buffer : t.pool) free_buffer(buffer); | ||
| 365 | if (t.current) free_buffer(*t.current); | ||
| 366 | } | ||
| 367 | free_buffer(key_table_); | ||
| 368 | if (pipeline_) fn<PFN_vkDestroyPipeline>("vkDestroyPipeline")(device_, pipeline_, nullptr); | ||
| 369 | if (layout_) fn<PFN_vkDestroyPipelineLayout>("vkDestroyPipelineLayout")(device_, layout_, nullptr); | ||
| 370 | } | ||
| 371 | ConsoleHeapGpu(const ConsoleHeapGpu&) = delete; | ||
| 372 | ConsoleHeapGpu& operator=(const ConsoleHeapGpu&) = delete; | ||
| 373 | |||
| 374 | // The pipeline and the GPU key table (device-local, zeroed by the first pass). False: the pass cannot run. | ||
| 375 | bool init() { | ||
| 376 | std::lock_guard lock(mutex_); | ||
| 377 | if (pipeline_) return true; | ||
| 378 | if (!make_pipeline()) return false; | ||
| 379 | const VkDeviceSize bytes = VkDeviceSize(keys_.capacity()) * ConsoleHeapKeys::kEntryWords * 4; | ||
| 380 | if (!make_buffer(bytes, false, key_table_)) return false; | ||
| 381 | clear_keys_ = true; | ||
| 382 | return true; | ||
| 383 | } | ||
| 384 | |||
| 385 | // A heap the pass writes: its title bytes (`input`) and the copy shaders read (`copy`), `slots` 32-byte slots. | ||
| 386 | // -1 when there is no room. | ||
| 387 | // Each heap also gets device-local metadata, 32 bytes a slot (what the pass last made of each V# half), which | ||
| 388 | // lets a filtered rescan pass over the slots no change touches without reading their words (rescan_filtered). | ||
| 389 | int add_heap(VkDeviceAddress input, VkDeviceAddress copy, std::uint32_t slots) { | ||
| 390 | std::lock_guard lock(mutex_); | ||
| 391 | for (unsigned i = 0; i < kMaxHeaps; ++i) { | ||
| 392 | if (heaps_[i].slots) continue; | ||
| 393 | Heap& h = heaps_[i]; | ||
| 394 | h = Heap{}; | ||
| 395 | h.input = input; | ||
| 396 | h.copy = copy; | ||
| 397 | h.slots = slots; | ||
| 398 | h.queued.assign(slots, 0); | ||
| 399 | if (make_buffer(VkDeviceSize(slots) * 32, false, h.meta)) h.meta_clear = true; | ||
| 400 | return int(i); | ||
| 401 | } | ||
| 402 | return -1; | ||
| 403 | } | ||
| 404 | void remove_heap(int heap) { | ||
| 405 | std::lock_guard lock(mutex_); | ||
| 406 | if (heap < 0 || unsigned(heap) >= kMaxHeaps) return; | ||
| 407 | if (heaps_[heap].meta.buffer) retired_.push_back(heaps_[heap].meta); // a pass in flight may still write it | ||
| 408 | heaps_[heap] = Heap{}; | ||
| 409 | } | ||
| 410 | |||
| 411 | void queue(int heap, std::uint32_t slot) { | ||
| 412 | std::lock_guard lock(mutex_); | ||
| 413 | queue_locked(heap, slot); | ||
| 414 | } | ||
| 415 | // A buffer copy for the start of the next pass, before the heap translation (LEONIDA_SHADOW_GPU: a slot-133 shadow's | ||
| 416 | // pages copied from an import of the title's pages). `keep` (the source import) lives until that pass retires. | ||
| 417 | void queue_copy(VkBuffer src, VkDeviceSize src_offset, VkBuffer dst, VkDeviceSize dst_offset, VkDeviceSize bytes, | ||
| 418 | std::shared_ptr<void> keep) { | ||
| 419 | std::lock_guard lock(mutex_); | ||
| 420 | copies_.push_back({src, dst, {src_offset, dst_offset, bytes}}); | ||
| 421 | if (keep) keeps_.push_back(std::move(keep)); | ||
| 422 | } | ||
| 423 | |||
| 424 | // Queued copies into `dst` dropped (its buffer is about to go); copies already recorded stay with their pass. | ||
| 425 | void drop_copies_to(VkBuffer dst) { | ||
| 426 | std::lock_guard lock(mutex_); | ||
| 427 | std::erase_if(copies_, [dst](const Copy& c) { return c.dst == dst; }); | ||
| 428 | } | ||
| 429 | |||
| 430 | // Every buffer pair of slots [0, slots) translated again by the next pass: one dispatch over the range, no list | ||
| 431 | // (the pass reads each slot's words and leaves the slots that hold no pair as they are). | ||
| 432 | void rescan(int heap, std::uint32_t slots) { | ||
| 433 | std::lock_guard lock(mutex_); | ||
| 434 | if (heap < 0 || unsigned(heap) >= kMaxHeaps) return; | ||
| 435 | heaps_[heap].rescan = std::max(heaps_[heap].rescan, std::min(slots, heaps_[heap].slots)); | ||
| 436 | } | ||
| 437 | // Like rescan(), but only the slots whose metadata meets a change span: `shader` spans of shader VAs (backings and | ||
| 438 | // alias copies that went: a half whose title base or result reaches into one) and `title` spans of title VAs | ||
| 439 | // (alias ranges that went, words answered since: a half whose title base is in one). Without metadata, every | ||
| 440 | // slot of the range, as rescan(). | ||
| 441 | void rescan_filtered(int heap, std::uint32_t slots, const ConsoleHeapSpans& shader, const ConsoleHeapSpans& title) { | ||
| 442 | std::lock_guard lock(mutex_); | ||
| 443 | if (heap < 0 || unsigned(heap) >= kMaxHeaps) return; | ||
| 444 | heaps_[heap].rescan_filtered = std::max(heaps_[heap].rescan_filtered, std::min(slots, heaps_[heap].slots)); | ||
| 445 | change_shader_.insert(change_shader_.end(), shader.begin(), shader.end()); | ||
| 446 | change_title_.insert(change_title_.end(), title.begin(), title.end()); | ||
| 447 | } | ||
| 448 | template <class It> | ||
| 449 | void queue(int heap, It first, It last) { | ||
| 450 | std::lock_guard lock(mutex_); | ||
| 451 | for (; first != last; ++first) queue_locked(heap, *first); | ||
| 452 | } | ||
| 453 | |||
| 454 | // A new range table for the next pass (sorted by title VA, not overlapping). | ||
| 455 | void set_ranges(const std::vector<ConsoleHeapRange>& ranges) { | ||
| 456 | std::lock_guard lock(mutex_); | ||
| 457 | Table& t = tables_[range_table]; | ||
| 458 | t.words.clear(); | ||
| 459 | for (const ConsoleHeapRange& r : ranges) | ||
| 460 | t.words.insert(t.words.end(), {std::uint32_t(r.title_va), std::uint32_t(r.title_va >> 32), | ||
| 461 | std::uint32_t(r.end), std::uint32_t(r.end >> 32), | ||
| 462 | std::uint32_t(r.shader_va), std::uint32_t(r.shader_va >> 32), | ||
| 463 | r.checked ? 1u : 0u, 0u}); | ||
| 464 | t.count = std::uint32_t(ranges.size()); | ||
| 465 | t.dirty = true; | ||
| 466 | } | ||
| 467 | // New backed or ask spans (merged) for the next pass. | ||
| 468 | void set_spans(TableKind kind, const ConsoleHeapSpans& spans) { | ||
| 469 | std::lock_guard lock(mutex_); | ||
| 470 | spans_locked(kind, spans); | ||
| 471 | } | ||
| 472 | void spans_locked(TableKind kind, const ConsoleHeapSpans& spans) { | ||
| 473 | Table& t = tables_[kind]; | ||
| 474 | t.words.clear(); | ||
| 475 | for (const auto& [start, end] : spans) | ||
| 476 | t.words.insert(t.words.end(), {std::uint32_t(start), std::uint32_t(start >> 32), std::uint32_t(end), | ||
| 477 | std::uint32_t(end >> 32)}); | ||
| 478 | t.count = std::uint32_t(spans.size()); | ||
| 479 | t.dirty = true; | ||
| 480 | if (kind == ask_table) use_ask_ = true; | ||
| 481 | } | ||
| 482 | void set_signed_offsets(bool on) { | ||
| 483 | std::lock_guard lock(mutex_); | ||
| 484 | signed_offsets_ = on; | ||
| 485 | } | ||
| 486 | // Every key entry gone at once (the GPU table is cleared by the next pass), for a table filling up. | ||
| 487 | void reset_keys() { | ||
| 488 | std::lock_guard lock(mutex_); | ||
| 489 | keys_.clear_silent(); | ||
| 490 | clear_keys_ = true; | ||
| 491 | ++stats_.resets; | ||
| 492 | } | ||
| 493 | |||
| 494 | template <class F> | ||
| 495 | auto with_keys(F&& f) { | ||
| 496 | std::lock_guard lock(mutex_); | ||
| 497 | return f(keys_); | ||
| 498 | } | ||
| 499 | |||
| 500 | bool pending() { | ||
| 501 | std::lock_guard lock(mutex_); | ||
| 502 | return pending_locked(); | ||
| 503 | } | ||
| 504 | |||
| 505 | // Records the pass into `cb`, ahead of the submission's lists: the key table updates, then each heap's queued | ||
| 506 | // slots, between barriers that order it after earlier work on the queue and before everything after it (and the | ||
| 507 | // host's read of the miss list). True when something was recorded; commit() must follow the submit. | ||
| 508 | bool record(VkCommandBuffer cb) { | ||
| 509 | std::lock_guard lock(mutex_); | ||
| 510 | if (!pipeline_ || !pending_locked() || in_flight_.size() >= 64) return false; | ||
| 511 | if (clear_keys_) keys_.touch_all(); | ||
| 512 | std::vector<std::uint32_t> updates; | ||
| 513 | keys_.take_updates(updates); | ||
| 514 | const std::uint32_t update_count = std::uint32_t(updates.size() / ConsoleHeapKeys::kUpdateWords); | ||
| 515 | std::size_t work = 0; | ||
| 516 | for (const Heap& h : heaps_) work += h.work.size(); | ||
| 517 | const VkDeviceSize bytes = VkDeviceSize(kMissHeader + kMissCapacity) * 4 + VkDeviceSize(work) * 4 + | ||
| 518 | VkDeviceSize(updates.size()) * 4 + 64; | ||
| 519 | Pass pass{}; | ||
| 520 | if (!acquire_buffer(bytes, pass.buffer)) { | ||
| 521 | for (std::size_t i = 0; i < updates.size(); i += ConsoleHeapKeys::kUpdateWords) keys_.touch(updates[i]); | ||
| 522 | return false; | ||
| 523 | } | ||
| 524 | // A filtered rescan's change spans, merged, as this pass's change tables. | ||
| 525 | bool filtered = false; | ||
| 526 | for (const Heap& h : heaps_) filtered |= h.rescan_filtered && !h.rescan; | ||
| 527 | ConsoleHeapSpans change_shader, change_title; | ||
| 528 | if (filtered) { | ||
| 529 | change_shader = change_shader_; | ||
| 530 | change_title = change_title_; | ||
| 531 | merge_console_heap_spans(change_shader); | ||
| 532 | merge_console_heap_spans(change_title); | ||
| 533 | spans_locked(change_shader_table, change_shader); | ||
| 534 | spans_locked(change_title_table, change_title); | ||
| 535 | } | ||
| 536 | for (unsigned kind = 0; kind < table_count; ++kind) { | ||
| 537 | if (tables_[kind].dirty && !publish(tables_[kind], kind == range_table ? 32 : 16)) { | ||
| 538 | pool_.push_back(pass.buffer); | ||
| 539 | for (std::size_t i = 0; i < updates.size(); i += ConsoleHeapKeys::kUpdateWords) keys_.touch(updates[i]); | ||
| 540 | return false; | ||
| 541 | } | ||
| 542 | pass.versions[kind] = tables_[kind].version; | ||
| 543 | } | ||
| 544 | auto* words = static_cast<std::uint32_t*>(pass.buffer.mapped); | ||
| 545 | words[0] = 0; | ||
| 546 | words[1] = kMissCapacity; | ||
| 547 | words[2] = 0; | ||
| 548 | words[3] = 0; | ||
| 549 | std::size_t at = kMissHeader + kMissCapacity; | ||
| 550 | const VkDeviceAddress base = pass.buffer.address; | ||
| 551 | const VkDeviceAddress update_address = base + at * 4; | ||
| 552 | if (!updates.empty()) std::memcpy(words + at, updates.data(), updates.size() * 4); | ||
| 553 | at += updates.size(); | ||
| 554 | const auto barrier = fn<PFN_vkCmdPipelineBarrier>("vkCmdPipelineBarrier"); | ||
| 555 | const auto dispatch = fn<PFN_vkCmdDispatch>("vkCmdDispatch"); | ||
| 556 | const auto push = fn<PFN_vkCmdPushConstants>("vkCmdPushConstants"); | ||
| 557 | // The copies first (another kind of work in the same prelude), then what reads their destinations may run. | ||
| 558 | if (!copies_.empty()) { | ||
| 559 | std::sort(copies_.begin(), copies_.end(), [](const Copy& a, const Copy& b) { | ||
| 560 | return a.src != b.src ? a.src < b.src : a.dst < b.dst; | ||
| 561 | }); | ||
| 562 | std::vector<VkBufferCopy> regions; | ||
| 563 | const auto copy = fn<PFN_vkCmdCopyBuffer>("vkCmdCopyBuffer"); | ||
| 564 | for (std::size_t i = 0; i < copies_.size();) { | ||
| 565 | std::size_t j = i; | ||
| 566 | regions.clear(); | ||
| 567 | while (j < copies_.size() && copies_[j].src == copies_[i].src && copies_[j].dst == copies_[i].dst) { | ||
| 568 | regions.push_back(copies_[j].region); | ||
| 569 | stats_.copy_bytes += copies_[j].region.size; | ||
| 570 | ++j; | ||
| 571 | } | ||
| 572 | copy(cb, copies_[i].src, copies_[i].dst, std::uint32_t(regions.size()), regions.data()); | ||
| 573 | stats_.copies += regions.size(); | ||
| 574 | i = j; | ||
| 575 | } | ||
| 576 | VkMemoryBarrier copied{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; | ||
| 577 | copied.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; | ||
| 578 | copied.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT; | ||
| 579 | barrier(cb, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, 1, &copied, 0, nullptr, 0, | ||
| 580 | nullptr); | ||
| 581 | pass.copies = std::move(copies_); | ||
| 582 | pass.keeps = std::move(keeps_); | ||
| 583 | copies_.clear(); | ||
| 584 | keeps_.clear(); | ||
| 585 | } | ||
| 586 | // No barrier against the queue's earlier work: one from ALL_COMMANDS made every submission wait for the one | ||
| 587 | // before it to finish. | ||
| 588 | // The pass may then rewrite a slot an earlier submission still reads, as the CPU path's memcpy into the copy | ||
| 589 | // always could. | ||
| 590 | fn<PFN_vkCmdBindPipeline>("vkCmdBindPipeline")(cb, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_); | ||
| 591 | Push p{}; | ||
| 592 | const auto address = [&](TableKind kind) { return tables_[kind].current ? tables_[kind].current->address : 0; }; | ||
| 593 | p.ranges = address(range_table); | ||
| 594 | p.backed = address(backed_table); | ||
| 595 | p.ask = address(ask_table); | ||
| 596 | p.keys = key_table_.address; | ||
| 597 | p.misses = base; | ||
| 598 | p.range_count = tables_[range_table].current ? tables_[range_table].count : 0; | ||
| 599 | p.backed_count = tables_[backed_table].current ? tables_[backed_table].count : 0; | ||
| 600 | p.ask_count = tables_[ask_table].current ? tables_[ask_table].count : 0; | ||
| 601 | p.flags = (signed_offsets_ ? 1u : 0u) | (use_ask_ ? 2u : 0u); | ||
| 602 | p.key_mask = keys_.mask(); | ||
| 603 | if (clear_keys_) { | ||
| 604 | fn<PFN_vkCmdFillBuffer>("vkCmdFillBuffer")(cb, key_table_.buffer, 0, VK_WHOLE_SIZE, 0); | ||
| 605 | VkMemoryBarrier filled{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; | ||
| 606 | filled.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; | ||
| 607 | filled.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; | ||
| 608 | barrier(cb, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 1, &filled, 0, | ||
| 609 | nullptr, 0, nullptr); | ||
| 610 | } | ||
| 611 | // New heaps' metadata starts at zero (no half known). | ||
| 612 | bool meta_filled = false; | ||
| 613 | for (Heap& h : heaps_) | ||
| 614 | if (h.meta_clear && h.meta.buffer) { | ||
| 615 | fn<PFN_vkCmdFillBuffer>("vkCmdFillBuffer")(cb, h.meta.buffer, 0, VK_WHOLE_SIZE, 0); | ||
| 616 | h.meta_clear = false; | ||
| 617 | meta_filled = true; | ||
| 618 | pass.filled.push_back(int(&h - heaps_.data())); | ||
| 619 | } | ||
| 620 | if (meta_filled) { | ||
| 621 | VkMemoryBarrier filled{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; | ||
| 622 | filled.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; | ||
| 623 | filled.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; | ||
| 624 | barrier(cb, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 1, &filled, 0, | ||
| 625 | nullptr, 0, nullptr); | ||
| 626 | } | ||
| 627 | if (update_count) { | ||
| 628 | p.work = update_address; // MODE_UPDATE's records | ||
| 629 | p.count = update_count; | ||
| 630 | p.mode = 1; | ||
| 631 | push(cb, layout_, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(p), &p); | ||
| 632 | dispatch(cb, (update_count + 63) / 64, 1, 1); | ||
| 633 | VkMemoryBarrier written{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; | ||
| 634 | written.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; | ||
| 635 | written.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; | ||
| 636 | barrier(cb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 1, &written, 0, | ||
| 637 | nullptr, 0, nullptr); | ||
| 638 | } | ||
| 639 | p.mode = 0; | ||
| 640 | p.cshader = filtered ? address(change_shader_table) : 0; | ||
| 641 | p.ctitle = filtered ? address(change_title_table) : 0; | ||
| 642 | p.cshader_count = filtered && tables_[change_shader_table].current ? tables_[change_shader_table].count : 0; | ||
| 643 | p.ctitle_count = filtered && tables_[change_title_table].current ? tables_[change_title_table].count : 0; | ||
| 644 | for (unsigned i = 0; i < kMaxHeaps; ++i) { | ||
| 645 | Heap& h = heaps_[i]; | ||
| 646 | const bool full = h.rescan != 0; | ||
| 647 | const std::uint32_t slots = full ? std::max(h.rescan, h.rescan_filtered) : h.rescan_filtered; | ||
| 648 | if (!slots) continue; | ||
| 649 | // Before the listed slots, so a slot both rewritten and rescanned ends with its listed (newer) form. | ||
| 650 | p.input_slots = h.input; | ||
| 651 | p.copy_slots = h.copy; | ||
| 652 | p.meta = h.meta.address; | ||
| 653 | p.heap = i; | ||
| 654 | const std::uint32_t flags = p.flags; | ||
| 655 | p.flags |= 4u; // FLAG_RANGE | ||
| 656 | if (!full) p.flags |= 8u; // FLAG_FILTER | ||
| 657 | for (std::uint32_t first = 0; first < slots; first += 65535u * 64u) { | ||
| 658 | const std::uint32_t n = std::min<std::uint32_t>(slots - first, 65535u * 64u); | ||
| 659 | p.work = first; | ||
| 660 | p.count = n; | ||
| 661 | push(cb, layout_, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(p), &p); | ||
| 662 | dispatch(cb, (n + 63) / 64, 1, 1); | ||
| 663 | (full ? stats_.rescanned : stats_.filtered) += n; | ||
| 664 | } | ||
| 665 | p.flags = flags; | ||
| 666 | pass.rescans.push_back({int(i), slots, !full}); | ||
| 667 | h.rescan = h.rescan_filtered = 0; | ||
| 668 | } | ||
| 669 | if (filtered) { | ||
| 670 | pass.change_shader = std::move(change_shader); | ||
| 671 | pass.change_title = std::move(change_title); | ||
| 672 | } | ||
| 673 | change_shader_.clear(); | ||
| 674 | change_title_.clear(); | ||
| 675 | if (!pass.rescans.empty()) { // the listed slots' writes land after the rescan's | ||
| 676 | VkMemoryBarrier rescanned{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; | ||
| 677 | rescanned.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; | ||
| 678 | rescanned.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; | ||
| 679 | barrier(cb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 1, &rescanned, | ||
| 680 | 0, nullptr, 0, nullptr); | ||
| 681 | } | ||
| 682 | for (unsigned i = 0; i < kMaxHeaps; ++i) { | ||
| 683 | Heap& h = heaps_[i]; | ||
| 684 | if (h.work.empty()) continue; | ||
| 685 | std::memcpy(words + at, h.work.data(), h.work.size() * 4); | ||
| 686 | pass.work.push_back({int(i), std::move(h.work)}); | ||
| 687 | const auto& list = pass.work.back().second; | ||
| 688 | for (const std::uint32_t item : list) h.queued[item & ~kZeroFirst] = 0; | ||
| 689 | h.work.clear(); | ||
| 690 | p.input_slots = h.input; | ||
| 691 | p.copy_slots = h.copy; | ||
| 692 | p.meta = h.meta.address; | ||
| 693 | p.heap = i; | ||
| 694 | // At most 65535 groups a dispatch (the guaranteed limit). | ||
| 695 | for (std::size_t first = 0; first < list.size(); first += 65535ull * 64) { | ||
| 696 | const std::uint32_t n = std::uint32_t(std::min<std::size_t>(list.size() - first, 65535ull * 64)); | ||
| 697 | p.work = base + (at + first) * 4; | ||
| 698 | p.count = n; | ||
| 699 | push(cb, layout_, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(p), &p); | ||
| 700 | dispatch(cb, (n + 63) / 64, 1, 1); | ||
| 701 | stats_.slots += n; | ||
| 702 | } | ||
| 703 | at += list.size(); | ||
| 704 | } | ||
| 705 | VkMemoryBarrier after{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; | ||
| 706 | after.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; | ||
| 707 | after.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT | VK_ACCESS_HOST_READ_BIT; | ||
| 708 | barrier(cb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_HOST_BIT, | ||
| 709 | 0, 1, &after, 0, nullptr, 0, nullptr); | ||
| 710 | pass.updates = std::move(updates); | ||
| 711 | pass.cleared = clear_keys_; | ||
| 712 | clear_keys_ = false; | ||
| 713 | stats_.updates += update_count; | ||
| 714 | ++stats_.passes; | ||
| 715 | in_flight_.push_back(std::move(pass)); | ||
| 716 | return true; | ||
| 717 | } | ||
| 718 | |||
| 719 | // After the submit of the command buffer record() wrote into: `ticket` is a retire ticket at or after that | ||
| 720 | // submission. Not submitted: its slots and updates are queued again. | ||
| 721 | void commit(bool submitted, std::uint64_t ticket) { | ||
| 722 | std::lock_guard lock(mutex_); | ||
| 723 | for (auto it = in_flight_.rbegin(); it != in_flight_.rend(); ++it) { | ||
| 724 | if (it->committed) continue; | ||
| 725 | if (submitted) { | ||
| 726 | it->committed = true; | ||
| 727 | it->ticket = ticket; | ||
| 728 | return; | ||
| 729 | } | ||
| 730 | ++stats_.failed; | ||
| 731 | for (const auto& [heap, list] : it->work) | ||
| 732 | if (heaps_[heap].slots) | ||
| 733 | for (const std::uint32_t item : list) queue_locked(heap, item); | ||
| 734 | for (const auto& r : it->rescans) { | ||
| 735 | if (!heaps_[r.heap].slots) continue; | ||
| 736 | auto& to = r.filtered ? heaps_[r.heap].rescan_filtered : heaps_[r.heap].rescan; | ||
| 737 | to = std::max(to, r.slots); | ||
| 738 | } | ||
| 739 | change_shader_.insert(change_shader_.end(), it->change_shader.begin(), it->change_shader.end()); | ||
| 740 | change_title_.insert(change_title_.end(), it->change_title.begin(), it->change_title.end()); | ||
| 741 | for (const int heap : it->filled) | ||
| 742 | if (heaps_[heap].slots) heaps_[heap].meta_clear = true; | ||
| 743 | copies_.insert(copies_.end(), it->copies.begin(), it->copies.end()); | ||
| 744 | keeps_.insert(keeps_.end(), it->keeps.begin(), it->keeps.end()); | ||
| 745 | for (std::size_t i = 0; i < it->updates.size(); i += ConsoleHeapKeys::kUpdateWords) | ||
| 746 | keys_.touch(it->updates[i]); | ||
| 747 | if (it->cleared) clear_keys_ = true; | ||
| 748 | pool_.push_back(it->buffer); | ||
| 749 | in_flight_.erase(std::next(it).base()); | ||
| 750 | return; | ||
| 751 | } | ||
| 752 | } | ||
| 753 | |||
| 754 | // The passes done by `completed` (a completed retire ticket): `miss(heap, slot, half)` for each V# half they | ||
| 755 | // could not answer, `overflow(heap)` for a heap whose misses ran past the list (-1: every heap). | ||
| 756 | template <class Miss, class Overflow> | ||
| 757 | void drain(std::uint64_t completed, Miss&& miss, Overflow&& overflow) { | ||
| 758 | std::vector<Pass> done; | ||
| 759 | { | ||
| 760 | std::lock_guard lock(mutex_); | ||
| 761 | for (auto it = in_flight_.begin(); it != in_flight_.end();) { | ||
| 762 | if (!it->committed || it->ticket > completed) { | ||
| 763 | ++it; | ||
| 764 | continue; | ||
| 765 | } | ||
| 766 | done.push_back(std::move(*it)); | ||
| 767 | it = in_flight_.erase(it); | ||
| 768 | } | ||
| 769 | // Tables no pass in flight still reads go back to their pool. | ||
| 770 | for (unsigned kind = 0; kind < table_count; ++kind) { | ||
| 771 | Table& t = tables_[kind]; | ||
| 772 | std::uint64_t oldest = t.version; | ||
| 773 | for (const Pass& pass : in_flight_) oldest = std::min(oldest, pass.versions[kind]); | ||
| 774 | for (auto it = t.old.begin(); it != t.old.end();) { | ||
| 775 | if (it->first < oldest) { | ||
| 776 | if (t.pool.size() < 8) t.pool.push_back(it->second); | ||
| 777 | else free_buffer(it->second); | ||
| 778 | it = t.old.erase(it); | ||
| 779 | } else { | ||
| 780 | ++it; | ||
| 781 | } | ||
| 782 | } | ||
| 783 | } | ||
| 784 | } | ||
| 785 | for (Pass& pass : done) { | ||
| 786 | const auto* words = static_cast<const std::uint32_t*>(pass.buffer.mapped); | ||
| 787 | const std::uint32_t count = std::min(words[0], kMissCapacity); | ||
| 788 | for (std::uint32_t i = 0; i < count; ++i) { | ||
| 789 | const std::uint32_t code = words[kMissHeader + i]; | ||
| 790 | miss(int(code >> 29), (code >> 1) & ((1u << 28) - 1), code & 1u); | ||
| 791 | } | ||
| 792 | if (words[2]) overflow(-1); | ||
| 793 | std::lock_guard lock(mutex_); | ||
| 794 | stats_.misses += count; | ||
| 795 | stats_.overflows += words[2] ? 1 : 0; | ||
| 796 | pool_.push_back(pass.buffer); | ||
| 797 | } | ||
| 798 | } | ||
| 799 | |||
| 800 | std::size_t in_flight() { | ||
| 801 | std::lock_guard lock(mutex_); | ||
| 802 | return in_flight_.size(); | ||
| 803 | } | ||
| 804 | // A pass recorded and not yet committed: its command buffer is on its way to the queue. | ||
| 805 | bool uncommitted() { | ||
| 806 | std::lock_guard lock(mutex_); | ||
| 807 | return std::any_of(in_flight_.begin(), in_flight_.end(), [](const Pass& p) { return !p.committed; }); | ||
| 808 | } | ||
| 809 | Stats take_stats() { | ||
| 810 | std::lock_guard lock(mutex_); | ||
| 811 | return std::exchange(stats_, Stats{}); | ||
| 812 | } | ||
| 813 | |||
| 814 | private: | ||
| 815 | struct Buffer { | ||
| 816 | VkBuffer buffer = VK_NULL_HANDLE; | ||
| 817 | VkDeviceMemory memory = VK_NULL_HANDLE; | ||
| 818 | VkDeviceAddress address = 0; | ||
| 819 | VkDeviceSize size = 0; | ||
| 820 | void* mapped = nullptr; | ||
| 821 | }; | ||
| 822 | struct Heap { | ||
| 823 | VkDeviceAddress input = 0, copy = 0; | ||
| 824 | std::uint32_t slots = 0; | ||
| 825 | std::vector<std::uint32_t> work; | ||
| 826 | std::vector<std::uint32_t> queued; // per slot: its position in `work` + 1, 0 when not queued | ||
| 827 | std::uint32_t rescan = 0; // slots [0, rescan) to translate again (rescan()) | ||
| 828 | std::uint32_t rescan_filtered = 0; // the same, filtered by the change spans (rescan_filtered()) | ||
| 829 | Buffer meta; // device-local, 32 bytes a slot (console_heap_fix.comp meta_of) | ||
| 830 | bool meta_clear = false; | ||
| 831 | }; | ||
| 832 | struct Copy { | ||
| 833 | VkBuffer src, dst; | ||
| 834 | VkBufferCopy region; | ||
| 835 | }; | ||
| 836 | struct Pass { | ||
| 837 | Buffer buffer; | ||
| 838 | std::array<std::uint64_t, table_count> versions{}; | ||
| 839 | struct Rescan { | ||
| 840 | int heap; | ||
| 841 | std::uint32_t slots; | ||
| 842 | bool filtered; | ||
| 843 | }; | ||
| 844 | std::vector<Rescan> rescans; | ||
| 845 | ConsoleHeapSpans change_shader, change_title; | ||
| 846 | std::vector<int> filled; // heaps whose metadata this pass zeroed | ||
| 847 | std::vector<Copy> copies; | ||
| 848 | std::vector<std::shared_ptr<void>> keeps; | ||
| 849 | std::vector<std::pair<int, std::vector<std::uint32_t>>> work; | ||
| 850 | std::vector<std::uint32_t> updates; | ||
| 851 | bool cleared = false, committed = false; | ||
| 852 | std::uint64_t ticket = 0; | ||
| 853 | }; | ||
| 854 | struct Push { | ||
| 855 | VkDeviceAddress input_slots, copy_slots, work, ranges, keys, misses, backed, ask, meta, cshader, ctitle; | ||
| 856 | std::uint32_t count, range_count, key_mask, mode, heap, backed_count, ask_count, flags, cshader_count, | ||
| 857 | ctitle_count; | ||
| 858 | }; | ||
| 859 | static_assert(sizeof(Push) == 128); // the guaranteed maxPushConstantsSize | ||
| 860 | // A table the CPU rebuilds whole (range, backed, ask): each version is its own buffer, kept until no pass in | ||
| 861 | // flight reads it, then reused. | ||
| 862 | struct Table { | ||
| 863 | std::vector<std::uint32_t> words; | ||
| 864 | std::uint32_t count = 0; | ||
| 865 | bool dirty = false; | ||
| 866 | std::unique_ptr<Buffer> current; | ||
| 867 | std::uint64_t version = 0; | ||
| 868 | std::vector<std::pair<std::uint64_t, Buffer>> old; | ||
| 869 | std::vector<Buffer> pool; | ||
| 870 | }; | ||
| 871 | |||
| 872 | template <typename T> | ||
| 873 | T fn(const char* name) const { | ||
| 874 | return reinterpret_cast<T>(get_(device_, name)); | ||
| 875 | } | ||
| 876 | |||
| 877 | void queue_locked(int heap, std::uint32_t item) { | ||
| 878 | if (heap < 0 || unsigned(heap) >= kMaxHeaps) return; | ||
| 879 | Heap& h = heaps_[heap]; | ||
| 880 | const std::uint32_t slot = item & ~kZeroFirst; | ||
| 881 | if (slot >= h.slots) return; | ||
| 882 | if (const std::uint32_t at = h.queued[slot]) { | ||
| 883 | h.work[at - 1] = item; | ||
| 884 | return; | ||
| 885 | } | ||
| 886 | h.work.push_back(item); | ||
| 887 | h.queued[slot] = std::uint32_t(h.work.size()); | ||
| 888 | } | ||
| 889 | bool pending_locked() const { | ||
| 890 | if (keys_.has_updates() || clear_keys_ || !copies_.empty()) return true; | ||
| 891 | for (const Heap& h : heaps_) | ||
| 892 | if (!h.work.empty() || h.rescan || h.rescan_filtered) return true; | ||
| 893 | return false; | ||
| 894 | } | ||
| 895 | |||
| 896 | bool publish(Table& t, std::size_t entry_bytes) { | ||
| 897 | Buffer table{}; | ||
| 898 | if (t.count) { | ||
| 899 | // A version no pass reads any more, when one is big enough: the tables change at most submissions. | ||
| 900 | const VkDeviceSize bytes = VkDeviceSize(t.count) * entry_bytes; | ||
| 901 | for (auto it = t.pool.begin(); it != t.pool.end(); ++it) | ||
| 902 | if (it->size >= bytes) { | ||
| 903 | table = *it; | ||
| 904 | t.pool.erase(it); | ||
| 905 | break; | ||
| 906 | } | ||
| 907 | // Device-local and host-visible where there is such memory: the pass's binary searches read it a few | ||
| 908 | // dozen times per slot, and from system memory each step was a trip over the bus. | ||
| 909 | if (!table.buffer && !make_buffer(std::max<VkDeviceSize>(bytes + bytes / 2, 64 * 1024), true, table, true)) | ||
| 910 | return false; | ||
| 911 | std::memcpy(table.mapped, t.words.data(), t.words.size() * 4); | ||
| 912 | } | ||
| 913 | if (t.current) t.old.emplace_back(t.version, *t.current); | ||
| 914 | t.current.reset(); | ||
| 915 | if (table.buffer) t.current = std::make_unique<Buffer>(table); | ||
| 916 | ++t.version; | ||
| 917 | t.dirty = false; | ||
| 918 | ++stats_.tables; | ||
| 919 | return true; | ||
| 920 | } | ||
| 921 | |||
| 922 | bool acquire_buffer(VkDeviceSize bytes, Buffer& out) { | ||
| 923 | for (auto it = pool_.begin(); it != pool_.end(); ++it) { | ||
| 924 | if (it->size < bytes) continue; | ||
| 925 | out = *it; | ||
| 926 | pool_.erase(it); | ||
| 927 | return true; | ||
| 928 | } | ||
| 929 | // Room to grow: the next pass of about this size reuses it. | ||
| 930 | return make_buffer(std::max<VkDeviceSize>(bytes + bytes / 2, 1 << 20), true, out); | ||
| 931 | } | ||
| 932 | |||
| 933 | bool make_buffer(VkDeviceSize bytes, bool host, Buffer& out, bool host_device_local = false) { | ||
| 934 | out = {}; | ||
| 935 | VkBufferCreateInfo info{VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO}; | ||
| 936 | info.size = bytes; | ||
| 937 | info.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | | ||
| 938 | VK_BUFFER_USAGE_TRANSFER_DST_BIT; | ||
| 939 | if (fn<PFN_vkCreateBuffer>("vkCreateBuffer")(device_, &info, nullptr, &out.buffer) != VK_SUCCESS) return false; | ||
| 940 | VkMemoryRequirements requirements{}; | ||
| 941 | fn<PFN_vkGetBufferMemoryRequirements>("vkGetBufferMemoryRequirements")(device_, out.buffer, &requirements); | ||
| 942 | const VkMemoryPropertyFlags required = | ||
| 943 | host ? VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT : 0; | ||
| 944 | const VkMemoryPropertyFlags preferred = host ? 0 : VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; | ||
| 945 | VkMemoryAllocateFlagsInfo flags{VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO}; | ||
| 946 | flags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT; | ||
| 947 | VkMemoryAllocateInfo allocate{VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, &flags}; | ||
| 948 | allocate.allocationSize = requirements.size; | ||
| 949 | // Host-visible: system memory first (not the ReBAR heap the title's windows need). | ||
| 950 | std::vector<std::uint32_t> order; | ||
| 951 | if (host && host_device_local) { | ||
| 952 | order = memory_type_order(memory_, requirements.memoryTypeBits, required | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, | ||
| 953 | 0, requirements.size); | ||
| 954 | for (const std::uint32_t t : memory_type_order(memory_, requirements.memoryTypeBits, required, 0, | ||
| 955 | requirements.size)) | ||
| 956 | if (std::find(order.begin(), order.end(), t) == order.end()) order.push_back(t); | ||
| 957 | } else if (host) { | ||
| 958 | order = memory_type_order(memory_, requirements.memoryTypeBits, required | VK_MEMORY_PROPERTY_HOST_CACHED_BIT, | ||
| 959 | 0, requirements.size); | ||
| 960 | for (const std::uint32_t t : memory_type_order(memory_, requirements.memoryTypeBits, required, 0, | ||
| 961 | requirements.size)) | ||
| 962 | if (std::find(order.begin(), order.end(), t) == order.end()) order.push_back(t); | ||
| 963 | } else { | ||
| 964 | order = memory_type_order(memory_, requirements.memoryTypeBits, required, preferred, requirements.size); | ||
| 965 | } | ||
| 966 | const auto allocate_memory = fn<PFN_vkAllocateMemory>("vkAllocateMemory"); | ||
| 967 | for (const std::uint32_t type : order) { | ||
| 968 | allocate.memoryTypeIndex = type; | ||
| 969 | if (allocate_memory(device_, &allocate, nullptr, &out.memory) == VK_SUCCESS) break; | ||
| 970 | out.memory = VK_NULL_HANDLE; | ||
| 971 | } | ||
| 972 | if (!out.memory || | ||
| 973 | fn<PFN_vkBindBufferMemory>("vkBindBufferMemory")(device_, out.buffer, out.memory, 0) != VK_SUCCESS || | ||
| 974 | (host && fn<PFN_vkMapMemory>("vkMapMemory")(device_, out.memory, 0, VK_WHOLE_SIZE, 0, &out.mapped) != | ||
| 975 | VK_SUCCESS)) { | ||
| 976 | free_buffer(out); | ||
| 977 | return false; | ||
| 978 | } | ||
| 979 | VkBufferDeviceAddressInfo address{VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO}; | ||
| 980 | address.buffer = out.buffer; | ||
| 981 | out.address = fn<PFN_vkGetBufferDeviceAddress>("vkGetBufferDeviceAddress")(device_, &address); | ||
| 982 | out.size = bytes; | ||
| 983 | if (!out.address) { | ||
| 984 | free_buffer(out); | ||
| 985 | return false; | ||
| 986 | } | ||
| 987 | return true; | ||
| 988 | } | ||
| 989 | void free_buffer(Buffer& b) { | ||
| 990 | if (b.buffer) fn<PFN_vkDestroyBuffer>("vkDestroyBuffer")(device_, b.buffer, nullptr); | ||
| 991 | if (b.memory) fn<PFN_vkFreeMemory>("vkFreeMemory")(device_, b.memory, nullptr); // unmaps | ||
| 992 | b = {}; | ||
| 993 | } | ||
| 994 | |||
| 995 | bool make_pipeline() { | ||
| 996 | for (const char* name : | ||
| 997 | {"vkCreateBuffer", "vkDestroyBuffer", "vkGetBufferMemoryRequirements", "vkAllocateMemory", "vkFreeMemory", | ||
| 998 | "vkBindBufferMemory", "vkMapMemory", "vkGetBufferDeviceAddress", "vkCreateShaderModule", | ||
| 999 | "vkDestroyShaderModule", "vkCreatePipelineLayout", "vkDestroyPipelineLayout", "vkCreateComputePipelines", | ||
| 1000 | "vkDestroyPipeline", "vkCmdPipelineBarrier", "vkCmdBindPipeline", "vkCmdPushConstants", "vkCmdDispatch", | ||
| 1001 | "vkCmdFillBuffer", "vkCmdCopyBuffer"}) | ||
| 1002 | if (!get_(device_, name)) return false; | ||
| 1003 | VkShaderModule module = VK_NULL_HANDLE; | ||
| 1004 | VkShaderModuleCreateInfo shader{VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO}; | ||
| 1005 | shader.codeSize = sizeof(console_heap_fix_spirv); | ||
| 1006 | shader.pCode = console_heap_fix_spirv; | ||
| 1007 | const aftermath::ShaderName aftermath_name("(runtime) console_heap_fix"); | ||
| 1008 | bool ok = | ||
| 1009 | fn<PFN_vkCreateShaderModule>("vkCreateShaderModule")(device_, &shader, nullptr, &module) == VK_SUCCESS; | ||
| 1010 | const VkPushConstantRange range{VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(Push)}; | ||
| 1011 | VkPipelineLayoutCreateInfo layout_info{VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO}; | ||
| 1012 | layout_info.pushConstantRangeCount = 1; | ||
| 1013 | layout_info.pPushConstantRanges = ⦥ | ||
| 1014 | VkPipelineLayout layout = VK_NULL_HANDLE; | ||
| 1015 | VkPipeline pipeline = VK_NULL_HANDLE; | ||
| 1016 | ok = ok && fn<PFN_vkCreatePipelineLayout>("vkCreatePipelineLayout")(device_, &layout_info, nullptr, &layout) == | ||
| 1017 | VK_SUCCESS; | ||
| 1018 | VkComputePipelineCreateInfo info{VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO}; | ||
| 1019 | info.stage = {VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO}; | ||
| 1020 | info.stage.stage = VK_SHADER_STAGE_COMPUTE_BIT; | ||
| 1021 | info.stage.module = module; | ||
| 1022 | info.stage.pName = "main"; | ||
| 1023 | info.layout = layout; | ||
| 1024 | ok = ok && fn<PFN_vkCreateComputePipelines>("vkCreateComputePipelines")(device_, VK_NULL_HANDLE, 1, &info, | ||
| 1025 | nullptr, &pipeline) == VK_SUCCESS; | ||
| 1026 | if (module) fn<PFN_vkDestroyShaderModule>("vkDestroyShaderModule")(device_, module, nullptr); | ||
| 1027 | if (!ok) { | ||
| 1028 | if (pipeline) fn<PFN_vkDestroyPipeline>("vkDestroyPipeline")(device_, pipeline, nullptr); | ||
| 1029 | if (layout) fn<PFN_vkDestroyPipelineLayout>("vkDestroyPipelineLayout")(device_, layout, nullptr); | ||
| 1030 | return false; | ||
| 1031 | } | ||
| 1032 | layout_ = layout; | ||
| 1033 | pipeline_ = pipeline; | ||
| 1034 | return true; | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | PFN_vkGetDeviceProcAddr get_; | ||
| 1038 | VkDevice device_; | ||
| 1039 | VkPhysicalDeviceMemoryProperties memory_; | ||
| 1040 | std::mutex mutex_; | ||
| 1041 | VkPipelineLayout layout_ = VK_NULL_HANDLE; | ||
| 1042 | VkPipeline pipeline_ = VK_NULL_HANDLE; | ||
| 1043 | ConsoleHeapKeys keys_; | ||
| 1044 | Buffer key_table_; | ||
| 1045 | bool clear_keys_ = false; | ||
| 1046 | std::array<Heap, kMaxHeaps> heaps_{}; | ||
| 1047 | std::array<Table, table_count> tables_{}; | ||
| 1048 | bool use_ask_ = false, signed_offsets_ = false; | ||
| 1049 | std::vector<Pass> in_flight_; | ||
| 1050 | std::vector<Buffer> pool_; | ||
| 1051 | std::vector<Copy> copies_; | ||
| 1052 | std::vector<std::shared_ptr<void>> keeps_; | ||
| 1053 | ConsoleHeapSpans change_shader_, change_title_; // pending rescan_filtered() spans | ||
| 1054 | std::vector<Buffer> retired_; // removed heaps' metadata | ||
| 1055 | Stats stats_; | ||
| 1056 | }; | ||
| 1057 | |||
| 1058 | } // namespace leonida | ||
diff --git a/runtime/src/descriptor_range_changes.h b/runtime/src/descriptor_range_changes.h new file mode 100644 index 000000000..5a4d7717f --- /dev/null +++ b/runtime/src/descriptor_range_changes.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #pragma once | ||
| 2 | #include <algorithm> | ||
| 3 | #include <array> | ||
| 4 | #include <cstdint> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | namespace leonida { | ||
| 8 | // A separate cursor per console heap. The owning backing/alias registry locks record() and read(). | ||
| 9 | struct DescriptorRanges { | ||
| 10 | struct Range { uint64_t first, last; }; // inclusive, including UINT64_MAX | ||
| 11 | std::vector<Range> ranges; | ||
| 12 | void merge() { | ||
| 13 | std::sort(ranges.begin(), ranges.end(), [](auto a, auto b) { return a.first < b.first; }); | ||
| 14 | size_t n = 0; | ||
| 15 | for (auto r : ranges) { | ||
| 16 | if (n && r.first <= ranges[n-1].last) | ||
| 17 | ranges[n-1].last = (std::max)(ranges[n-1].last, r.last); | ||
| 18 | else ranges[n++] = r; | ||
| 19 | } | ||
| 20 | ranges.resize(n); | ||
| 21 | } | ||
| 22 | bool overlaps(uint64_t base, uint64_t bytes) const { | ||
| 23 | if (!bytes) return false; | ||
| 24 | auto it = std::lower_bound(ranges.begin(), ranges.end(), base, | ||
| 25 | [](auto r, uint64_t v) { return r.last < v; }); | ||
| 26 | return it != ranges.end() && (it->first <= base || it->first - base < bytes); | ||
| 27 | } | ||
| 28 | }; | ||
| 29 | class DescriptorRangeChanges { | ||
| 30 | std::array<DescriptorRanges::Range, 4096> ring_{}; | ||
| 31 | uint64_t serial_{}; | ||
| 32 | public: | ||
| 33 | void record(uint64_t start, uint64_t bytes) { | ||
| 34 | if (bytes) { | ||
| 35 | ring_[serial_++ % ring_.size()] = {start, start + (std::min)(UINT64_MAX-start, bytes-1)}; | ||
| 36 | } | ||
| 37 | } | ||
| 38 | bool read(uint64_t& cursor, DescriptorRanges& out) const { | ||
| 39 | const auto previous = cursor; | ||
| 40 | cursor = serial_; | ||
| 41 | if (serial_ - previous > ring_.size()) return false; | ||
| 42 | for (auto i = previous; i != serial_; ++i) out.ranges.push_back(ring_[i % ring_.size()]); | ||
| 43 | return true; | ||
| 44 | } | ||
| 45 | }; | ||
| 46 | } | ||
diff --git a/runtime/src/descriptor_table.h b/runtime/src/descriptor_table.h index a0d80968a..82fa19dbf 100644 --- a/runtime/src/descriptor_table.h +++ b/runtime/src/descriptor_table.h | |||
| @@ -19,7 +19,21 @@ namespace leonida { | |||
| 19 | inline constexpr std::uint32_t kFnvOffsetBasis = 2166136261u; | 19 | inline constexpr std::uint32_t kFnvOffsetBasis = 2166136261u; |
| 20 | inline constexpr std::uint32_t kFnvPrime = 16777619u; | 20 | inline constexpr std::uint32_t kFnvPrime = 16777619u; |
| 21 | inline constexpr std::uint32_t kDescriptorProbes = 8; | 21 | inline constexpr std::uint32_t kDescriptorProbes = 8; |
| 22 | inline constexpr std::uint32_t kSlotOccupiedMarker = 0xA11CA7EDu; | 22 | // An entry's last dword is 0 while the slot is empty. This bit marks it occupied, and the low bits (kKindMask) say |
| 23 | // what the index is good for: one bit per array the image is bound in, sampled and storage. | ||
| 24 | inline constexpr std::uint32_t kSlotOccupiedMarker = 0x80000000u; | ||
| 25 | inline constexpr std::uint32_t kKindMask = 0x1FFFu; // bits 0..6 sampled, 8..12 storage | ||
| 26 | |||
| 27 | // What an index is bound in, for the library whose modules read it (`descriptor_table` tagged in their index.json | ||
| 28 | // meta; tools/rdna2spirv.py reads the same bits with OpBitFieldUExtract). Bit `dimension` is that dimension's | ||
| 29 | // sampled array (dimensions 0..6, ImageDimension in vulkan_bindless.h); bit 8 + dimension its storage arrays | ||
| 30 | // (dimensions 0..4 have them). A table for a plain library leaves every kind bit zero. | ||
| 31 | inline constexpr std::uint32_t kind_sampled_bit(std::uint32_t dimension) { | ||
| 32 | return dimension < 7 ? (1u << dimension) : 0u; | ||
| 33 | } | ||
| 34 | inline constexpr std::uint32_t kind_storage_bit(std::uint32_t dimension) { | ||
| 35 | return dimension < 5 ? (1u << (8 + dimension)) : 0u; | ||
| 36 | } | ||
| 23 | 37 | ||
| 24 | // Key types: | 38 | // Key types: |
| 25 | // T# key is 8 dwords. | 39 | // T# key is 8 dwords. |
| @@ -93,14 +107,20 @@ inline DescriptorKey make_ssharp_key(const std::uint32_t ssharp[4]) { | |||
| 93 | return k; | 107 | return k; |
| 94 | } | 108 | } |
| 95 | 109 | ||
| 96 | // Memory layout of each entry in the table: 10 uint32s = 40 bytes. | 110 | // Memory layout of each entry in the table: 10 uint32s = 40 bytes. The last word is the kind a translated shader |
| 111 | // reads next to the index, and its occupied bit; a module that does not read it never looks at it. | ||
| 97 | struct DescriptorEntry { | 112 | struct DescriptorEntry { |
| 98 | std::uint32_t key[8] = {}; | 113 | std::uint32_t key[8] = {}; |
| 99 | std::uint32_t index = 0; | 114 | std::uint32_t index = 0; |
| 100 | std::uint32_t pad = 0; // 0 when empty, kSlotOccupiedMarker when occupied | 115 | std::uint32_t kind = 0; // 0 when empty, kSlotOccupiedMarker | (kKindMask bits) when occupied |
| 101 | }; | 116 | }; |
| 102 | static_assert(sizeof(DescriptorEntry) == 40); | 117 | static_assert(sizeof(DescriptorEntry) == 40); |
| 103 | 118 | ||
| 119 | inline constexpr bool slot_occupied(const DescriptorEntry& entry) { | ||
| 120 | return (entry.kind & kSlotOccupiedMarker) != 0; | ||
| 121 | } | ||
| 122 | inline constexpr std::uint32_t slot_kind(const DescriptorEntry& entry) { return entry.kind & kKindMask; } | ||
| 123 | |||
| 104 | class DescriptorTable { | 124 | class DescriptorTable { |
| 105 | public: | 125 | public: |
| 106 | enum class InsertResult { added, unchanged, replaced, added_with_relocation }; | 126 | enum class InsertResult { added, unchanged, replaced, added_with_relocation }; |
| @@ -122,22 +142,23 @@ public: | |||
| 122 | // The kind this table places and finds keys with (immutable after construction). | 142 | // The kind this table places and finds keys with (immutable after construction). |
| 123 | DescriptorHashKind hash_kind() const { return hash_kind_; } | 143 | DescriptorHashKind hash_kind() const { return hash_kind_; } |
| 124 | 144 | ||
| 125 | // Inserts or updates a key -> index mapping. | 145 | // Inserts or updates a key -> (index, kind) mapping. If the key already exists in one of the 8 probe slots, |
| 126 | // If the key already exists in one of the 8 probe slots, its index is updated. | 146 | // its entry is updated. Try one bounded relocation before growing. Load never exceeds 50%. `kind` is what a |
| 127 | // Try one bounded relocation before growing. Load never exceeds 50%. | 147 | // shader that reads it (a `descriptor_table` tagged module) uses to tell which array the index is bound in; a |
| 128 | bool insert(const std::uint32_t key[8], std::uint32_t index) { | 148 | // sampler's entry has none. |
| 129 | insert_or_update(key, index); | 149 | bool insert(const std::uint32_t key[8], std::uint32_t index, std::uint32_t kind = 0) { |
| 150 | insert_or_update(key, index, kind); | ||
| 130 | return true; | 151 | return true; |
| 131 | } | 152 | } |
| 132 | 153 | ||
| 133 | // Report the change under the same lock so the GPU caller can synchronize writes to live slots. | 154 | // Report the change under the same lock so the GPU caller can synchronize writes to live slots. |
| 134 | InsertResult insert_or_update(const std::uint32_t key[8], std::uint32_t index) { | 155 | InsertResult insert_or_update(const std::uint32_t key[8], std::uint32_t index, std::uint32_t kind = 0) { |
| 135 | std::lock_guard lock(mutex_); | 156 | std::lock_guard lock(mutex_); |
| 136 | return insert_locked(key, index); | 157 | return insert_locked(key, index, kind); |
| 137 | } | 158 | } |
| 138 | 159 | ||
| 139 | bool insert(const DescriptorKey& key, std::uint32_t index) { | 160 | bool insert(const DescriptorKey& key, std::uint32_t index, std::uint32_t kind = 0) { |
| 140 | return insert(key.data(), index); | 161 | return insert(key.data(), index, kind); |
| 141 | } | 162 | } |
| 142 | 163 | ||
| 143 | // Queries the index associated with key. Returns 0 if not found. | 164 | // Queries the index associated with key. Returns 0 if not found. |
| @@ -147,7 +168,7 @@ public: | |||
| 147 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { | 168 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { |
| 148 | const std::uint32_t slot = (h + k) & mask_; | 169 | const std::uint32_t slot = (h + k) & mask_; |
| 149 | const auto& entry = entries_[slot]; | 170 | const auto& entry = entries_[slot]; |
| 150 | if (entry.pad == kSlotOccupiedMarker && std::memcmp(entry.key, key, sizeof(entry.key)) == 0) { | 171 | if (slot_occupied(entry) && std::memcmp(entry.key, key, sizeof(entry.key)) == 0) { |
| 151 | return entry.index; | 172 | return entry.index; |
| 152 | } | 173 | } |
| 153 | } | 174 | } |
| @@ -164,7 +185,7 @@ public: | |||
| 164 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { | 185 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { |
| 165 | const std::uint32_t slot = (h + k) & mask_; | 186 | const std::uint32_t slot = (h + k) & mask_; |
| 166 | const auto& entry = entries_[slot]; | 187 | const auto& entry = entries_[slot]; |
| 167 | if (entry.pad == kSlotOccupiedMarker && std::memcmp(entry.key, key, sizeof(entry.key)) == 0) { | 188 | if (slot_occupied(entry) && std::memcmp(entry.key, key, sizeof(entry.key)) == 0) { |
| 168 | return true; | 189 | return true; |
| 169 | } | 190 | } |
| 170 | } | 191 | } |
| @@ -222,8 +243,8 @@ public: | |||
| 222 | } | 243 | } |
| 223 | 244 | ||
| 224 | // Exports the table buffer format consumed by SPIR-V set 0, binding 2. | 245 | // Exports the table buffer format consumed by SPIR-V set 0, binding 2. |
| 225 | // Word 0 is mask; followed by entries[mask + 1] of 10 dwords: key[8], index, pad. | 246 | // Word 0 is mask; followed by entries[mask + 1] of 10 dwords: key[8], index, kind. |
| 226 | std::vector<std::uint32_t> build_gpu_buffer(bool clear_pad = false) const { | 247 | std::vector<std::uint32_t> build_gpu_buffer(bool clear_occupied = false) const { |
| 227 | std::lock_guard lock(mutex_); | 248 | std::lock_guard lock(mutex_); |
| 228 | std::vector<std::uint32_t> out(1 + entries_.size() * 10, 0); | 249 | std::vector<std::uint32_t> out(1 + entries_.size() * 10, 0); |
| 229 | out[0] = mask_; | 250 | out[0] = mask_; |
| @@ -231,7 +252,7 @@ public: | |||
| 231 | const std::size_t base = 1 + s * 10; | 252 | const std::size_t base = 1 + s * 10; |
| 232 | std::memcpy(&out[base], entries_[s].key, sizeof(entries_[s].key)); | 253 | std::memcpy(&out[base], entries_[s].key, sizeof(entries_[s].key)); |
| 233 | out[base + 8] = entries_[s].index; | 254 | out[base + 8] = entries_[s].index; |
| 234 | out[base + 9] = clear_pad ? 0 : entries_[s].pad; | 255 | out[base + 9] = clear_occupied ? slot_kind(entries_[s]) : entries_[s].kind; |
| 235 | } | 256 | } |
| 236 | return out; | 257 | return out; |
| 237 | } | 258 | } |
| @@ -252,7 +273,7 @@ public: | |||
| 252 | return changes; | 273 | return changes; |
| 253 | } | 274 | } |
| 254 | 275 | ||
| 255 | // One slot's 10 dwords (key[8], index, pad) to `dest`; false when the slot is out of range. | 276 | // One slot's 10 dwords (key[8], index, kind) to `dest`; false when the slot is out of range. |
| 256 | bool read_slot(std::uint32_t slot, std::uint32_t* dest) const { return read_slots(slot, 1, dest); } | 277 | bool read_slot(std::uint32_t slot, std::uint32_t* dest) const { return read_slots(slot, 1, dest); } |
| 257 | 278 | ||
| 258 | // `count` consecutive slots' 10 dwords each to `dest`, under one lock; false when any is out of range. | 279 | // `count` consecutive slots' 10 dwords each to `dest`, under one lock; false when any is out of range. |
| @@ -264,13 +285,13 @@ public: | |||
| 264 | const DescriptorEntry& entry = entries_[first + i]; | 285 | const DescriptorEntry& entry = entries_[first + i]; |
| 265 | std::memcpy(dest + i * 10, entry.key, sizeof(entry.key)); | 286 | std::memcpy(dest + i * 10, entry.key, sizeof(entry.key)); |
| 266 | dest[i * 10 + 8] = entry.index; | 287 | dest[i * 10 + 8] = entry.index; |
| 267 | dest[i * 10 + 9] = entry.pad; | 288 | dest[i * 10 + 9] = entry.kind; |
| 268 | } | 289 | } |
| 269 | return true; | 290 | return true; |
| 270 | } | 291 | } |
| 271 | 292 | ||
| 272 | // Serializes directly into `dest` (must hold at least size_bytes()) without allocating a temporary vector. | 293 | // Serializes directly into `dest` (must hold at least size_bytes()) without allocating a temporary vector. |
| 273 | void write_to_buffer(void* dest, bool clear_pad = false) const { | 294 | void write_to_buffer(void* dest, bool clear_occupied = false) const { |
| 274 | if (!dest) return; | 295 | if (!dest) return; |
| 275 | std::lock_guard lock(mutex_); | 296 | std::lock_guard lock(mutex_); |
| 276 | auto* out = static_cast<std::uint8_t*>(dest); | 297 | auto* out = static_cast<std::uint8_t*>(dest); |
| @@ -280,7 +301,7 @@ public: | |||
| 280 | std::uint32_t slot[10]; | 301 | std::uint32_t slot[10]; |
| 281 | std::memcpy(slot, entry.key, sizeof(entry.key)); | 302 | std::memcpy(slot, entry.key, sizeof(entry.key)); |
| 282 | slot[8] = entry.index; | 303 | slot[8] = entry.index; |
| 283 | slot[9] = clear_pad ? 0 : entry.pad; | 304 | slot[9] = clear_occupied ? slot_kind(entry) : entry.kind; |
| 284 | std::memcpy(out, slot, sizeof(slot)); | 305 | std::memcpy(out, slot, sizeof(slot)); |
| 285 | out += sizeof(slot); | 306 | out += sizeof(slot); |
| 286 | } | 307 | } |
| @@ -298,7 +319,7 @@ private: | |||
| 298 | const auto mask = static_cast<std::uint32_t>(entries.size() - 1); | 319 | const auto mask = static_cast<std::uint32_t>(entries.size() - 1); |
| 299 | for (auto offset = kDescriptorProbes; offset < 2 * kDescriptorProbes - 1; ++offset) { | 320 | for (auto offset = kDescriptorProbes; offset < 2 * kDescriptorProbes - 1; ++offset) { |
| 300 | const auto hole = (hash + offset) & mask; | 321 | const auto hole = (hash + offset) & mask; |
| 301 | if (entries[hole].pad == kSlotOccupiedMarker) continue; | 322 | if (slot_occupied(entries[hole])) continue; |
| 302 | for (auto k = kDescriptorProbes; k > 0; --k) { | 323 | for (auto k = kDescriptorProbes; k > 0; --k) { |
| 303 | const auto slot = (hash + k - 1) & mask; | 324 | const auto slot = (hash + k - 1) & mask; |
| 304 | const auto home = hash_descriptor_key(entries[slot].key, kind); | 325 | const auto home = hash_descriptor_key(entries[slot].key, kind); |
| @@ -313,7 +334,7 @@ private: | |||
| 313 | return -1; | 334 | return -1; |
| 314 | } | 335 | } |
| 315 | 336 | ||
| 316 | InsertResult insert_locked(const std::uint32_t key[8], std::uint32_t index) { | 337 | InsertResult insert_locked(const std::uint32_t key[8], std::uint32_t index, std::uint32_t kind) { |
| 317 | while (true) { | 338 | while (true) { |
| 318 | const std::uint32_t h = hash_descriptor_key(key, hash_kind_); | 339 | const std::uint32_t h = hash_descriptor_key(key, hash_kind_); |
| 319 | int empty_slot = -1; | 340 | int empty_slot = -1; |
| @@ -321,10 +342,12 @@ private: | |||
| 321 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { | 342 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { |
| 322 | const std::uint32_t slot = (h + k) & mask_; | 343 | const std::uint32_t slot = (h + k) & mask_; |
| 323 | auto& entry = entries_[slot]; | 344 | auto& entry = entries_[slot]; |
| 324 | if (entry.pad == kSlotOccupiedMarker) { | 345 | if (slot_occupied(entry)) { |
| 325 | if (std::memcmp(entry.key, key, sizeof(entry.key)) == 0) { | 346 | if (std::memcmp(entry.key, key, sizeof(entry.key)) == 0) { |
| 326 | if (entry.index == index) return InsertResult::unchanged; | 347 | if (entry.index == index && slot_kind(entry) == kind) return InsertResult::unchanged; |
| 348 | // A new index or a new kind: either way the slot's copy of the entry must reach the GPU. | ||
| 327 | entry.index = index; | 349 | entry.index = index; |
| 350 | entry.kind = kSlotOccupiedMarker | (kind & kKindMask); | ||
| 328 | mark(slot); | 351 | mark(slot); |
| 329 | return InsertResult::replaced; | 352 | return InsertResult::replaced; |
| 330 | } | 353 | } |
| @@ -356,7 +379,7 @@ private: | |||
| 356 | auto& entry = entries_[empty_slot]; | 379 | auto& entry = entries_[empty_slot]; |
| 357 | std::memcpy(entry.key, key, sizeof(entry.key)); | 380 | std::memcpy(entry.key, key, sizeof(entry.key)); |
| 358 | entry.index = index; | 381 | entry.index = index; |
| 359 | entry.pad = kSlotOccupiedMarker; | 382 | entry.kind = kSlotOccupiedMarker | (kind & kKindMask); |
| 360 | ++occupied_count_; | 383 | ++occupied_count_; |
| 361 | if (relocate) mark(moved_to); | 384 | if (relocate) mark(moved_to); |
| 362 | mark(std::uint32_t(empty_slot)); | 385 | mark(std::uint32_t(empty_slot)); |
| @@ -374,7 +397,7 @@ private: | |||
| 374 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { | 397 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { |
| 375 | const std::uint32_t slot = (h + k) & mask_; | 398 | const std::uint32_t slot = (h + k) & mask_; |
| 376 | const auto& entry = entries_[slot]; | 399 | const auto& entry = entries_[slot]; |
| 377 | if (entry.pad == kSlotOccupiedMarker && std::memcmp(entry.key, key, sizeof(entry.key)) == 0) { | 400 | if (slot_occupied(entry) && std::memcmp(entry.key, key, sizeof(entry.key)) == 0) { |
| 378 | found_slot = slot; | 401 | found_slot = slot; |
| 379 | found = true; | 402 | found = true; |
| 380 | break; | 403 | break; |
| @@ -398,12 +421,12 @@ private: | |||
| 398 | bool rehash_ok = true; | 421 | bool rehash_ok = true; |
| 399 | 422 | ||
| 400 | for (const auto& old : entries_) { | 423 | for (const auto& old : entries_) { |
| 401 | if (old.pad != kSlotOccupiedMarker) continue; | 424 | if (!slot_occupied(old)) continue; |
| 402 | const std::uint32_t h = hash_descriptor_key(old.key, hash_kind_); | 425 | const std::uint32_t h = hash_descriptor_key(old.key, hash_kind_); |
| 403 | int slot = -1; | 426 | int slot = -1; |
| 404 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { | 427 | for (std::uint32_t k = 0; k < kDescriptorProbes; ++k) { |
| 405 | const std::uint32_t s = (h + k) & new_mask; | 428 | const std::uint32_t s = (h + k) & new_mask; |
| 406 | if (new_entries[s].pad != kSlotOccupiedMarker) { | 429 | if (!slot_occupied(new_entries[s])) { |
| 407 | slot = static_cast<int>(s); | 430 | slot = static_cast<int>(s); |
| 408 | break; | 431 | break; |
| 409 | } | 432 | } |
diff --git a/runtime/src/dev_overlay.h b/runtime/src/dev_overlay.h new file mode 100644 index 000000000..1eecfc366 --- /dev/null +++ b/runtime/src/dev_overlay.h | |||
| @@ -0,0 +1,282 @@ | |||
| 1 | #pragma once | ||
| 2 | // LEONIDA_DEV_OVERLAY=1 (off by default, Windows): a small click-through window over the top left corner of the title's | ||
| 3 | // window that says how the boot is doing: frames and submissions a second, where a submission's CPU time goes and which | ||
| 4 | // phase runs now, pipeline builds, indirect draws, CPU, memory. It is its own window with its own thread and GDI text, | ||
| 5 | // so it keeps counting while the title shows no frames for seconds (pipeline builds, a stalled submission), it is in no | ||
| 6 | // captured frame, and it changes nothing the GPU does. It only reads counters: submit_phases.h, indirect_draw_stats.h, | ||
| 7 | // dev_status.h, and memory_figures.h for the private memory and the device's GPU memory, which LEONIDA_TITLE_HUD | ||
| 8 | // (shims/title_hud.h) shows with the same text. The HUD is the other view: frame times, memory and compile time in the | ||
| 9 | // window's title bar. | ||
| 10 | #include "dev_status.h" | ||
| 11 | #include "indirect_draw_stats.h" | ||
| 12 | #include "memory_figures.h" | ||
| 13 | #include "submit_phases.h" | ||
| 14 | |||
| 15 | #ifdef _WIN32 | ||
| 16 | #ifndef NOMINMAX | ||
| 17 | #define NOMINMAX | ||
| 18 | #endif | ||
| 19 | #include <windows.h> | ||
| 20 | #include <psapi.h> | ||
| 21 | #ifdef _MSC_VER | ||
| 22 | #pragma comment(lib, "user32.lib") | ||
| 23 | #pragma comment(lib, "gdi32.lib") | ||
| 24 | #pragma comment(lib, "psapi.lib") | ||
| 25 | #endif | ||
| 26 | #endif | ||
| 27 | |||
| 28 | #include <algorithm> | ||
| 29 | #include <cstdint> | ||
| 30 | #include <cstdio> | ||
| 31 | #include <cstdlib> | ||
| 32 | #include <string> | ||
| 33 | #include <thread> | ||
| 34 | #include <vector> | ||
| 35 | |||
| 36 | namespace leonida::dev_overlay { | ||
| 37 | |||
| 38 | // The counters between two looks. A total that went down was reset by its own log line: what it holds is the new part. | ||
| 39 | inline std::uint64_t grown(std::uint64_t now, std::uint64_t& before) { | ||
| 40 | const std::uint64_t by = now >= before ? now - before : now; | ||
| 41 | before = now; | ||
| 42 | return by; | ||
| 43 | } | ||
| 44 | |||
| 45 | struct Sample { | ||
| 46 | double seconds = 0; | ||
| 47 | double frames = 0, submissions = 0; // a second | ||
| 48 | double phase_ms[submit_phases::kCount]{}; // a submission | ||
| 49 | int phase = -1; // running now | ||
| 50 | double phase_for = 0; // seconds it has been | ||
| 51 | unsigned building = 0; | ||
| 52 | std::uint64_t built = 0; | ||
| 53 | std::string build; // the last one started | ||
| 54 | unsigned long long drawn = 0, skipped = 0; // indirect draws so far | ||
| 55 | double cores = 0, free_gb = 0; | ||
| 56 | memory_figures::ProcessMemory ram; // private memory and working set | ||
| 57 | VramBudget vram; // the device's VK_EXT_memory_budget; "n/a" without it | ||
| 58 | }; | ||
| 59 | |||
| 60 | // The text of one sample: pure, for the test. | ||
| 61 | inline std::vector<std::string> lines(const Sample& s, double age) { | ||
| 62 | char text[160]; | ||
| 63 | std::vector<std::string> out; | ||
| 64 | std::snprintf(text, sizeof text, "Leonida dev %.0f s %.1f fps %.1f submissions/s", age, s.frames, s.submissions); | ||
| 65 | out.emplace_back(text); | ||
| 66 | double total = 0; | ||
| 67 | for (const double ms : s.phase_ms) total += ms; | ||
| 68 | std::snprintf(text, sizeof text, "CPU/submission %.1f ms: descriptors %.1f, textures %.1f, copies %.1f, replay %.1f", total, | ||
| 69 | s.phase_ms[submit_phases::heaps], s.phase_ms[submit_phases::textures], | ||
| 70 | s.phase_ms[submit_phases::shadows] + s.phase_ms[submit_phases::geometry], | ||
| 71 | s.phase_ms[submit_phases::replay]); | ||
| 72 | out.emplace_back(text); | ||
| 73 | static const char* const now[submit_phases::kCount] = {"waiting for the GPU", "fixing descriptors", "copying title memory", | ||
| 74 | "copying geometry", "refreshing textures", "recording and submitting"}; | ||
| 75 | if (s.phase >= 0 && s.phase < int(submit_phases::kCount)) | ||
| 76 | std::snprintf(text, sizeof text, "now: %s%s", now[s.phase], | ||
| 77 | s.phase_for >= 1 ? (" for " + std::to_string(int(s.phase_for)) + " s").c_str() : ""); | ||
| 78 | else | ||
| 79 | std::snprintf(text, sizeof text, "now: the title's own code"); | ||
| 80 | out.emplace_back(text); | ||
| 81 | if (s.building) | ||
| 82 | std::snprintf(text, sizeof text, "pipelines: %llu built, %u building (%.50s)", | ||
| 83 | static_cast<unsigned long long>(s.built), s.building, s.build.c_str()); | ||
| 84 | else | ||
| 85 | std::snprintf(text, sizeof text, "pipelines: %llu built", static_cast<unsigned long long>(s.built)); | ||
| 86 | out.emplace_back(text); | ||
| 87 | std::snprintf(text, sizeof text, "indirect draws: %llu drawn, %llu skipped", s.drawn, s.skipped); | ||
| 88 | out.emplace_back(text); | ||
| 89 | std::snprintf(text, sizeof text, "%.1f cores, %.1f GB RAM free", s.cores, s.free_gb); | ||
| 90 | out.emplace_back(text); | ||
| 91 | out.emplace_back(memory_figures::ram_text(s.ram) + " " + memory_figures::vram_text(s.vram)); | ||
| 92 | return out; | ||
| 93 | } | ||
| 94 | |||
| 95 | inline bool enabled() { | ||
| 96 | static const bool on = [] { | ||
| 97 | #ifdef _WIN32 | ||
| 98 | char value[3]{}; | ||
| 99 | std::size_t length = 0; | ||
| 100 | return getenv_s(&length, value, sizeof value, "LEONIDA_DEV_OVERLAY") == 0 && length == 2 && value[0] == '1'; | ||
| 101 | #else | ||
| 102 | const char* value = std::getenv("LEONIDA_DEV_OVERLAY"); | ||
| 103 | return value && value[0] == '1' && !value[1]; | ||
| 104 | #endif | ||
| 105 | }(); | ||
| 106 | return on; | ||
| 107 | } | ||
| 108 | |||
| 109 | #ifdef _WIN32 | ||
| 110 | class Overlay { | ||
| 111 | public: | ||
| 112 | void run() { | ||
| 113 | WNDCLASSW type{}; | ||
| 114 | type.lpfnWndProc = &Overlay::procedure; | ||
| 115 | type.hInstance = GetModuleHandleW(nullptr); | ||
| 116 | type.lpszClassName = L"LeonidaDevOverlay"; | ||
| 117 | if (!RegisterClassW(&type)) return; | ||
| 118 | window_ = CreateWindowExW(WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_NOACTIVATE | WS_EX_TOPMOST | WS_EX_TOOLWINDOW, | ||
| 119 | type.lpszClassName, L"", WS_POPUP, 0, 0, 10, 10, nullptr, nullptr, type.hInstance, this); | ||
| 120 | if (!window_) return; | ||
| 121 | SetWindowLongPtrW(window_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); | ||
| 122 | SetLayeredWindowAttributes(window_, 0, 205, LWA_ALPHA); | ||
| 123 | font_ = CreateFontW(-14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, | ||
| 124 | CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY, FIXED_PITCH | FF_MODERN, L"Consolas"); | ||
| 125 | look(); | ||
| 126 | SetTimer(window_, 1, 500, nullptr); | ||
| 127 | MSG message; | ||
| 128 | while (GetMessageW(&message, nullptr, 0, 0) > 0) DispatchMessageW(&message); | ||
| 129 | } | ||
| 130 | |||
| 131 | private: | ||
| 132 | static LRESULT CALLBACK procedure(HWND window, UINT message, WPARAM w, LPARAM l) { | ||
| 133 | auto* self = reinterpret_cast<Overlay*>(GetWindowLongPtrW(window, GWLP_USERDATA)); | ||
| 134 | if (self && message == WM_TIMER) { | ||
| 135 | self->look(); | ||
| 136 | return 0; | ||
| 137 | } | ||
| 138 | if (self && message == WM_PAINT) { | ||
| 139 | self->paint(); | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | if (message == WM_NCHITTEST) return HTTRANSPARENT; | ||
| 143 | return DefWindowProcW(window, message, w, l); | ||
| 144 | } | ||
| 145 | |||
| 146 | // The process's largest visible top-level window is the title's. | ||
| 147 | struct Search { | ||
| 148 | HWND own, found; | ||
| 149 | std::int64_t area; | ||
| 150 | }; | ||
| 151 | static BOOL CALLBACK consider(HWND window, LPARAM parameter) { | ||
| 152 | auto& search = *reinterpret_cast<Search*>(parameter); | ||
| 153 | DWORD process = 0; | ||
| 154 | GetWindowThreadProcessId(window, &process); | ||
| 155 | RECT r{}; | ||
| 156 | if (process != GetCurrentProcessId() || window == search.own || !IsWindowVisible(window) || IsIconic(window) || | ||
| 157 | !GetClientRect(window, &r)) | ||
| 158 | return TRUE; | ||
| 159 | const std::int64_t area = std::int64_t(r.right) * r.bottom; | ||
| 160 | if (area > search.area) search = {search.own, window, area}; | ||
| 161 | return TRUE; | ||
| 162 | } | ||
| 163 | |||
| 164 | void look() { | ||
| 165 | namespace sp = submit_phases; | ||
| 166 | sp::Totals& totals = sp::totals(); | ||
| 167 | const std::int64_t now = sp::now_ns(); | ||
| 168 | Sample s; | ||
| 169 | s.seconds = before_ ? double(now - before_) * 1e-9 : 0; | ||
| 170 | const std::uint64_t frames = grown(totals.present_serial.load(std::memory_order_relaxed), frames_); | ||
| 171 | const std::uint64_t submissions = grown(totals.all_submissions.load(std::memory_order_relaxed), submissions_); | ||
| 172 | std::uint64_t ns[sp::kCount]; | ||
| 173 | for (unsigned p = 0; p < sp::kCount; ++p) ns[p] = grown(totals.ns[p].load(std::memory_order_relaxed), ns_[p]); | ||
| 174 | // A stall longer than a look leaves nothing to divide by: the figures then cover the last two seconds. | ||
| 175 | window_frames_ += frames; | ||
| 176 | window_submissions_ += submissions; | ||
| 177 | window_seconds_ += s.seconds; | ||
| 178 | for (unsigned p = 0; p < sp::kCount; ++p) window_ns_[p] += ns[p]; | ||
| 179 | if (window_seconds_ >= 2 || !before_) { | ||
| 180 | shown_ = {}; | ||
| 181 | if (window_seconds_ > 0) { | ||
| 182 | shown_.frames = double(window_frames_) / window_seconds_; | ||
| 183 | shown_.submissions = double(window_submissions_) / window_seconds_; | ||
| 184 | } | ||
| 185 | for (unsigned p = 0; p < sp::kCount; ++p) { | ||
| 186 | if (window_submissions_) shown_.phase_ms[p] = double(window_ns_[p]) * 1e-6 / double(window_submissions_); | ||
| 187 | window_ns_[p] = 0; | ||
| 188 | } | ||
| 189 | window_frames_ = window_submissions_ = 0; | ||
| 190 | window_seconds_ = 0; | ||
| 191 | } | ||
| 192 | s.frames = shown_.frames; | ||
| 193 | s.submissions = shown_.submissions; | ||
| 194 | std::copy(std::begin(shown_.phase_ms), std::end(shown_.phase_ms), std::begin(s.phase_ms)); | ||
| 195 | before_ = now; | ||
| 196 | |||
| 197 | const sp::Running running = sp::running(); | ||
| 198 | s.phase = running.phase; | ||
| 199 | if (s.phase >= 0) s.phase_for = std::max(0.0, double(now - running.since) * 1e-9); | ||
| 200 | dev_status::Builds& builds = dev_status::builds(); | ||
| 201 | s.building = builds.active.load(std::memory_order_relaxed); | ||
| 202 | s.built = builds.done.load(std::memory_order_relaxed); | ||
| 203 | s.build = builds.last(); | ||
| 204 | const auto& draws = indirect_stats::counts().values; | ||
| 205 | s.drawn = draws[std::size_t(indirect_stats::Event::emitted)].load(std::memory_order_relaxed); | ||
| 206 | s.skipped = draws[std::size_t(indirect_stats::Event::record_skip)].load(std::memory_order_relaxed) + | ||
| 207 | draws[std::size_t(indirect_stats::Event::replay_skip)].load(std::memory_order_relaxed); | ||
| 208 | FILETIME created{}, exited{}, kernel{}, user{}; | ||
| 209 | if (GetProcessTimes(GetCurrentProcess(), &created, &exited, &kernel, &user)) { | ||
| 210 | const auto ticks = [](const FILETIME& f) { return (std::uint64_t(f.dwHighDateTime) << 32) | f.dwLowDateTime; }; | ||
| 211 | const std::uint64_t used = grown(ticks(kernel) + ticks(user), cpu_); | ||
| 212 | if (s.seconds > 0) s.cores = double(used) * 1e-7 / s.seconds; | ||
| 213 | } | ||
| 214 | s.ram = memory_figures::process_memory(); | ||
| 215 | s.vram = memory_figures::latest_vram(); // reads the device at most once per 500 ms | ||
| 216 | MEMORYSTATUSEX status{sizeof status}; | ||
| 217 | if (GlobalMemoryStatusEx(&status)) s.free_gb = double(status.ullAvailPhys) / double(1u << 30); | ||
| 218 | lines_ = lines(s, sp::process_age()); | ||
| 219 | place(); | ||
| 220 | } | ||
| 221 | |||
| 222 | void place() { | ||
| 223 | Search search{window_, nullptr, 0}; | ||
| 224 | EnumWindows(&Overlay::consider, reinterpret_cast<LPARAM>(&search)); | ||
| 225 | // Shown only over the title while it is the window in front, so the topmost text is never over anything else. | ||
| 226 | if (!search.found || GetForegroundWindow() != search.found) { | ||
| 227 | ShowWindow(window_, SW_HIDE); | ||
| 228 | return; | ||
| 229 | } | ||
| 230 | POINT corner{8, 8}; | ||
| 231 | ClientToScreen(search.found, &corner); | ||
| 232 | std::size_t longest = 0; | ||
| 233 | for (const auto& line : lines_) longest = std::max(longest, line.size()); | ||
| 234 | SetWindowPos(window_, HWND_TOPMOST, corner.x, corner.y, int(longest) * 8 + 12, int(lines_.size()) * 17 + 8, | ||
| 235 | SWP_NOACTIVATE | SWP_SHOWWINDOW); | ||
| 236 | InvalidateRect(window_, nullptr, FALSE); | ||
| 237 | } | ||
| 238 | |||
| 239 | void paint() { | ||
| 240 | PAINTSTRUCT ps; | ||
| 241 | HDC dc = BeginPaint(window_, &ps); | ||
| 242 | RECT area; | ||
| 243 | GetClientRect(window_, &area); | ||
| 244 | HDC memory = CreateCompatibleDC(dc); | ||
| 245 | HBITMAP bitmap = CreateCompatibleBitmap(dc, area.right, area.bottom); | ||
| 246 | HGDIOBJ old_bitmap = SelectObject(memory, bitmap), old_font = SelectObject(memory, font_); | ||
| 247 | FillRect(memory, &area, static_cast<HBRUSH>(GetStockObject(BLACK_BRUSH))); | ||
| 248 | SetBkMode(memory, TRANSPARENT); | ||
| 249 | int y = 4; | ||
| 250 | for (std::size_t i = 0; i < lines_.size(); ++i, y += 17) { | ||
| 251 | SetTextColor(memory, i == 0 ? RGB(120, 255, 140) : RGB(235, 235, 235)); | ||
| 252 | TextOutA(memory, 6, y, lines_[i].data(), int(lines_[i].size())); | ||
| 253 | } | ||
| 254 | BitBlt(dc, 0, 0, area.right, area.bottom, memory, 0, 0, SRCCOPY); | ||
| 255 | SelectObject(memory, old_bitmap); | ||
| 256 | SelectObject(memory, old_font); | ||
| 257 | DeleteObject(bitmap); | ||
| 258 | DeleteDC(memory); | ||
| 259 | EndPaint(window_, &ps); | ||
| 260 | } | ||
| 261 | |||
| 262 | HWND window_ = nullptr; | ||
| 263 | HFONT font_ = nullptr; | ||
| 264 | std::vector<std::string> lines_; | ||
| 265 | std::int64_t before_ = 0; | ||
| 266 | std::uint64_t frames_ = 0, submissions_ = 0, cpu_ = 0, ns_[submit_phases::kCount]{}; | ||
| 267 | std::uint64_t window_frames_ = 0, window_submissions_ = 0, window_ns_[submit_phases::kCount]{}; | ||
| 268 | double window_seconds_ = 0; | ||
| 269 | Sample shown_; | ||
| 270 | }; | ||
| 271 | #endif | ||
| 272 | |||
| 273 | // Once per process; nothing without LEONIDA_DEV_OVERLAY=1. | ||
| 274 | inline void start() { | ||
| 275 | #ifdef _WIN32 | ||
| 276 | if (!enabled()) return; | ||
| 277 | std::fprintf(stderr, "[rt] dev overlay on (LEONIDA_DEV_OVERLAY=1)\n"); | ||
| 278 | std::thread([] { static Overlay overlay; overlay.run(); }).detach(); | ||
| 279 | #endif | ||
| 280 | } | ||
| 281 | |||
| 282 | } // namespace leonida::dev_overlay | ||
diff --git a/runtime/src/dev_status.h b/runtime/src/dev_status.h new file mode 100644 index 000000000..3efc9bf4f --- /dev/null +++ b/runtime/src/dev_status.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | #pragma once | ||
| 2 | // What the runtime is building now, for the dev overlay (dev_overlay.h). Always on: two relaxed atomics a build, and a | ||
| 3 | // short copy under a lock for the name. | ||
| 4 | #include <algorithm> | ||
| 5 | #include <atomic> | ||
| 6 | #include <cstdint> | ||
| 7 | #include <cstring> | ||
| 8 | #include <mutex> | ||
| 9 | #include <string> | ||
| 10 | |||
| 11 | namespace leonida::dev_status { | ||
| 12 | |||
| 13 | struct Builds { | ||
| 14 | std::atomic<unsigned> active{0}; | ||
| 15 | std::atomic<std::uint64_t> done{0}; | ||
| 16 | |||
| 17 | std::string last() { | ||
| 18 | std::lock_guard lock(mutex_); | ||
| 19 | return name_; | ||
| 20 | } | ||
| 21 | void name(const char* text) { | ||
| 22 | std::lock_guard lock(mutex_); | ||
| 23 | const std::size_t n = std::min(std::strlen(text), sizeof name_ - 1); | ||
| 24 | std::memcpy(name_, text, n); | ||
| 25 | name_[n] = 0; | ||
| 26 | } | ||
| 27 | |||
| 28 | private: | ||
| 29 | std::mutex mutex_; | ||
| 30 | char name_[96]{}; | ||
| 31 | }; | ||
| 32 | inline Builds& builds() { | ||
| 33 | static Builds instance; | ||
| 34 | return instance; | ||
| 35 | } | ||
| 36 | |||
| 37 | // One pipeline build, from construction to destruction. | ||
| 38 | struct Build { | ||
| 39 | explicit Build(const char* name) { | ||
| 40 | builds().name(name); | ||
| 41 | builds().active.fetch_add(1, std::memory_order_relaxed); | ||
| 42 | } | ||
| 43 | ~Build() { | ||
| 44 | builds().active.fetch_sub(1, std::memory_order_relaxed); | ||
| 45 | builds().done.fetch_add(1, std::memory_order_relaxed); | ||
| 46 | } | ||
| 47 | Build(const Build&) = delete; | ||
| 48 | Build& operator=(const Build&) = delete; | ||
| 49 | }; | ||
| 50 | |||
| 51 | } // namespace leonida::dev_status | ||
diff --git a/runtime/src/frame_pacer.h b/runtime/src/frame_pacer.h index 2c9f1fd7e..5588d73ea 100644 --- a/runtime/src/frame_pacer.h +++ b/runtime/src/frame_pacer.h | |||
| @@ -19,6 +19,10 @@ | |||
| 19 | // * A frame is "in flight" from PresentX until the vblank that shows it. Frames show one per vblank, in order. | 19 | // * A frame is "in flight" from PresentX until the vblank that shows it. Frames show one per vblank, in order. |
| 20 | // WaitFrameEventX does not return while `latency` frames are in flight. A frame presented while the origin event | 20 | // WaitFrameEventX does not return while `latency` frames are in flight. A frame presented while the origin event |
| 21 | // is not armed is not paced (PresentX does not hold it for a vblank): it shows at once and is never in flight. | 21 | // is not armed is not paced (PresentX does not hold it for a vblank): it shows at once and is never in flight. |
| 22 | // * At most `latency` frames are in flight. A present into a full queue (several presents with no wait between | ||
| 23 | // them) replaces the newest queued frame and takes its vblank, like a mailbox: the replaced frame is never shown, | ||
| 24 | // and the older ones keep their vblanks. So the queue, and the next wait, never reach further than `latency` | ||
| 25 | // vblanks ahead, however many presents came in between. | ||
| 22 | // * A wait that comes late (after the next origin already passed) returns at once with the newest passed origin; | 26 | // * A wait that comes late (after the next origin already passed) returns at once with the newest passed origin; |
| 23 | // the missed origins are skipped, not queued. | 27 | // the missed origins are skipped, not queued. |
| 24 | // * Tokens are 1, 2, 3, ... (0 is the null token), one per successful wait, never reused, across suspend/resume. | 28 | // * Tokens are 1, 2, 3, ... (0 is the null token), one per successful wait, never reused, across suspend/resume. |
| @@ -266,8 +270,9 @@ public: | |||
| 266 | 270 | ||
| 267 | // GetFrameStatisticsX(token, type_mask, &count, array). `count` is the room in `out` on entry and the number of | 271 | // GetFrameStatisticsX(token, type_mask, &count, array). `count` is the room in `out` on entry and the number of |
| 268 | // entries written on return. S_OK when every producible requested type was written (event, present, display), | 272 | // entries written on return. S_OK when every producible requested type was written (event, present, display), |
| 269 | // S_FALSE with count 0 or fewer when they are not (there yet, or the token is unknown or has aged out of the | 273 | // S_FALSE with count 0 or fewer when they are not (there yet, the frame was replaced in a full queue and never |
| 270 | // last 64). With a null `out`, count only receives how many entries are available. | 274 | // shown, or the token is unknown or has aged out of the last 64). With a null `out`, count only receives how many |
| 275 | // entries are available. | ||
| 271 | std::int32_t get_frame_statistics(std::uint64_t token, std::uint32_t type_mask, std::uint32_t* count, | 276 | std::int32_t get_frame_statistics(std::uint64_t token, std::uint32_t type_mask, std::uint32_t* count, |
| 272 | FrameStatistic* out) { | 277 | FrameStatistic* out) { |
| 273 | if (!count) return pacer_hr::invalid_arg; | 278 | if (!count) return pacer_hr::invalid_arg; |
| @@ -359,12 +364,10 @@ public: | |||
| 359 | if (r.token == token) { r.presented = r.displayed = true; r.present_us = r.display_us = now; } | 364 | if (r.token == token) { r.presented = r.displayed = true; r.present_us = r.display_us = now; } |
| 360 | return; | 365 | return; |
| 361 | } | 366 | } |
| 362 | // The vblank after now, and not before the one after the previous queued frame. | 367 | const bool queued_before = !pending_.empty(); |
| 363 | const std::uint64_t since = now > epoch_us_ ? now - epoch_us_ : 0; | 368 | std::uint64_t flip = queue_flip_locked(now); |
| 364 | std::uint64_t flip = epoch_us_ + (since / period_us_ + 1) * period_us_; | ||
| 365 | if (!pending_.empty()) flip = std::max(flip, pending_.back().flip_us + period_us_); | ||
| 366 | float percent = 0.0f; | 369 | float percent = 0.0f; |
| 367 | if (sync == PresentSync::immediate && pending_.empty()) { | 370 | if (sync == PresentSync::immediate && !queued_before) { |
| 368 | flip = now; | 371 | flip = now; |
| 369 | std::uint64_t late_us = 0; | 372 | std::uint64_t late_us = 0; |
| 370 | for (const Record& r : records_) | 373 | for (const Record& r : records_) |
| @@ -386,9 +389,7 @@ public: | |||
| 386 | record_present_timing_locked(now, 0); | 389 | record_present_timing_locked(now, 0); |
| 387 | if (!interval_set_ || !any_armed_locked() || uncapped_) return; | 390 | if (!interval_set_ || !any_armed_locked() || uncapped_) return; |
| 388 | retire_locked(now); | 391 | retire_locked(now); |
| 389 | const std::uint64_t since = now > epoch_us_ ? now - epoch_us_ : 0; | 392 | const std::uint64_t flip = queue_flip_locked(now); |
| 390 | std::uint64_t flip = epoch_us_ + (since / period_us_ + 1) * period_us_; | ||
| 391 | if (!pending_.empty()) flip = std::max(flip, pending_.back().flip_us + period_us_); | ||
| 392 | pending_.push_back(Pending{0, flip, 0.0f}); | 393 | pending_.push_back(Pending{0, flip, 0.0f}); |
| 393 | cv_.notify_all(); | 394 | cv_.notify_all(); |
| 394 | } | 395 | } |
| @@ -484,6 +485,25 @@ private: | |||
| 484 | bool presented = false, displayed = false; | 485 | bool presented = false, displayed = false; |
| 485 | }; | 486 | }; |
| 486 | 487 | ||
| 488 | // The vblank a frame presented now is queued for: the vblank after now, and not before the one after the previous | ||
| 489 | // queued frame. At most `latency_` frames are in flight, so with the queue full the newest queued frame is | ||
| 490 | // replaced (dropped: never shown) and the new one takes its vblank; the older ones keep theirs. A queue longer | ||
| 491 | // than the latency (after SetFrameIntervalX lowered it) is cut back the same way, from the newest end. | ||
| 492 | std::uint64_t queue_flip_locked(std::uint64_t now) { | ||
| 493 | if (pending_.size() >= latency_) { // latency_ is at least 1, so the queue is not empty | ||
| 494 | std::uint64_t flip = 0; | ||
| 495 | while (pending_.size() >= latency_) { | ||
| 496 | flip = pending_.back().flip_us; | ||
| 497 | pending_.pop_back(); | ||
| 498 | } | ||
| 499 | return flip; | ||
| 500 | } | ||
| 501 | const std::uint64_t since = now > epoch_us_ ? now - epoch_us_ : 0; | ||
| 502 | std::uint64_t flip = epoch_us_ + (since / period_us_ + 1) * period_us_; | ||
| 503 | if (!pending_.empty()) flip = std::max(flip, pending_.back().flip_us + period_us_); | ||
| 504 | return flip; | ||
| 505 | } | ||
| 506 | |||
| 487 | void record_present_timing_locked(std::uint64_t now, std::uint64_t token) { | 507 | void record_present_timing_locked(std::uint64_t now, std::uint64_t token) { |
| 488 | ++presents_recorded_; | 508 | ++presents_recorded_; |
| 489 | if (has_last_present_ && now >= last_present_us_) { | 509 | if (has_last_present_ && now >= last_present_us_) { |
diff --git a/runtime/src/fsdraw_probe.h b/runtime/src/fsdraw_probe.h index 180b02b36..367f793cb 100644 --- a/runtime/src/fsdraw_probe.h +++ b/runtime/src/fsdraw_probe.h | |||
| @@ -38,7 +38,26 @@ inline State& state() { | |||
| 38 | return s; | 38 | return s; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | // What backs a title VA on the GPU side (set by the device: "slot-133 shadow", ...), for the CB comparison below. | ||
| 42 | inline std::atomic<const char* (*)(std::uint64_t)>& backing_hook() { | ||
| 43 | static std::atomic<const char* (*)(std::uint64_t)> hook{nullptr}; | ||
| 44 | return hook; | ||
| 45 | } | ||
| 46 | |||
| 47 | // LEONIDA_FSDRAW_PROBE=1 turns the records and lines on (so does LEONIDA_COMPUTE_INPUTS, whose probe reads the T# | ||
| 48 | // and CBV records). Off by default: they take this mutex at every T# registered, CBV made, pipeline created and | ||
| 49 | // table submitted. The arena mapping (note_arena) is kept either way. | ||
| 50 | inline bool enabled() { | ||
| 51 | static const bool on = [] { | ||
| 52 | const char* v = std::getenv("LEONIDA_FSDRAW_PROBE"); | ||
| 53 | const char* inputs = std::getenv("LEONIDA_COMPUTE_INPUTS"); | ||
| 54 | return (v && *v == '1') || (inputs && *inputs); | ||
| 55 | }(); | ||
| 56 | return on; | ||
| 57 | } | ||
| 58 | |||
| 41 | inline void note_pipeline(std::uintptr_t id, std::string text) { | 59 | inline void note_pipeline(std::uintptr_t id, std::string text) { |
| 60 | if (!enabled()) return; | ||
| 42 | std::lock_guard lock(state().mutex); | 61 | std::lock_guard lock(state().mutex); |
| 43 | state().pipelines[id] = std::move(text); | 62 | state().pipelines[id] = std::move(text); |
| 44 | } | 63 | } |
| @@ -55,6 +74,7 @@ inline std::string pipeline(std::uintptr_t id) { | |||
| 55 | } | 74 | } |
| 56 | 75 | ||
| 57 | inline void note_tsharp(const std::uint32_t* words) { | 76 | inline void note_tsharp(const std::uint32_t* words) { |
| 77 | if (!enabled()) return; | ||
| 58 | std::array<std::uint32_t, 8> key{}; | 78 | std::array<std::uint32_t, 8> key{}; |
| 59 | std::memcpy(key.data(), words, sizeof(key)); | 79 | std::memcpy(key.data(), words, sizeof(key)); |
| 60 | std::lock_guard lock(state().mutex); | 80 | std::lock_guard lock(state().mutex); |
| @@ -62,6 +82,7 @@ inline void note_tsharp(const std::uint32_t* words) { | |||
| 62 | } | 82 | } |
| 63 | 83 | ||
| 64 | inline bool has_tsharp(const std::uint32_t* words) { | 84 | inline bool has_tsharp(const std::uint32_t* words) { |
| 85 | if (!enabled()) return false; | ||
| 65 | std::array<std::uint32_t, 8> key{}; | 86 | std::array<std::uint32_t, 8> key{}; |
| 66 | std::memcpy(key.data(), words, sizeof(key)); | 87 | std::memcpy(key.data(), words, sizeof(key)); |
| 67 | std::lock_guard lock(state().mutex); | 88 | std::lock_guard lock(state().mutex); |
| @@ -84,22 +105,25 @@ inline void forget_arena(const std::uint8_t* mapped) { | |||
| 84 | } | 105 | } |
| 85 | } | 106 | } |
| 86 | 107 | ||
| 87 | // A render target a fullscreen draw wrote: the present-probe reads it back with the source (at most 4 kept). | 108 | // A render target a fullscreen draw wrote, or a traced texture (LEONIDA_TRACE_TEXTURE): the present-probe reads it back |
| 109 | // with the source (at most 24 kept). | ||
| 88 | inline void note_target(std::uint64_t id) { | 110 | inline void note_target(std::uint64_t id) { |
| 89 | if (!id) return; | 111 | if (!id || !enabled()) return; |
| 90 | std::lock_guard lock(state().mutex); | 112 | std::lock_guard lock(state().mutex); |
| 91 | auto& r = state().readback; | 113 | auto& r = state().readback; |
| 92 | for (const std::uint64_t x : r) | 114 | for (const std::uint64_t x : r) |
| 93 | if (x == id) return; | 115 | if (x == id) return; |
| 94 | if (r.size() < 4) r.push_back(id); | 116 | if (r.size() < 24) r.push_back(id); |
| 95 | } | 117 | } |
| 96 | 118 | ||
| 97 | inline std::vector<std::uint64_t> targets() { | 119 | inline std::vector<std::uint64_t> targets() { |
| 120 | if (!enabled()) return {}; | ||
| 98 | std::lock_guard lock(state().mutex); | 121 | std::lock_guard lock(state().mutex); |
| 99 | return state().readback; | 122 | return state().readback; |
| 100 | } | 123 | } |
| 101 | 124 | ||
| 102 | inline void note_table(std::uint64_t translated, std::uint64_t original) { | 125 | inline void note_table(std::uint64_t translated, std::uint64_t original) { |
| 126 | if (!enabled()) return; | ||
| 103 | std::lock_guard lock(state().mutex); | 127 | std::lock_guard lock(state().mutex); |
| 104 | auto& m = state().table_origin; | 128 | auto& m = state().table_origin; |
| 105 | if (m.size() > 8192) m.clear(); | 129 | if (m.size() > 8192) m.clear(); |
| @@ -107,12 +131,14 @@ inline void note_table(std::uint64_t translated, std::uint64_t original) { | |||
| 107 | } | 131 | } |
| 108 | 132 | ||
| 109 | inline std::uint64_t table_origin(std::uint64_t va) { | 133 | inline std::uint64_t table_origin(std::uint64_t va) { |
| 134 | if (!enabled()) return va; | ||
| 110 | std::lock_guard lock(state().mutex); | 135 | std::lock_guard lock(state().mutex); |
| 111 | const auto it = state().table_origin.find(va); | 136 | const auto it = state().table_origin.find(va); |
| 112 | return it == state().table_origin.end() ? va : it->second; | 137 | return it == state().table_origin.end() ? va : it->second; |
| 113 | } | 138 | } |
| 114 | 139 | ||
| 115 | inline void note_cbv(std::uint64_t base, std::uint64_t location, std::uint32_t size) { | 140 | inline void note_cbv(std::uint64_t base, std::uint64_t location, std::uint32_t size) { |
| 141 | if (!enabled()) return; | ||
| 116 | std::lock_guard lock(state().mutex); | 142 | std::lock_guard lock(state().mutex); |
| 117 | auto& m = state().cbv_origin; | 143 | auto& m = state().cbv_origin; |
| 118 | if (m.size() > 8192) m.clear(); | 144 | if (m.size() > 8192) m.clear(); |
| @@ -120,6 +146,7 @@ inline void note_cbv(std::uint64_t base, std::uint64_t location, std::uint32_t s | |||
| 120 | } | 146 | } |
| 121 | 147 | ||
| 122 | inline bool cbv_origin(std::uint64_t base, std::uint64_t& location) { | 148 | inline bool cbv_origin(std::uint64_t base, std::uint64_t& location) { |
| 149 | if (!enabled()) return false; | ||
| 123 | std::lock_guard lock(state().mutex); | 150 | std::lock_guard lock(state().mutex); |
| 124 | const auto it = state().cbv_origin.find(base); | 151 | const auto it = state().cbv_origin.find(base); |
| 125 | if (it == state().cbv_origin.end()) return false; | 152 | if (it == state().cbv_origin.end()) return false; |
| @@ -157,7 +184,13 @@ inline std::uint64_t arena_size() { | |||
| 157 | // arena has its first 16 dwords printed from the arena. | 184 | // arena has its first 16 dwords printed from the arena. |
| 158 | inline void describe_table(const char* tag, std::uint64_t va, std::uint32_t slots, const std::uint8_t* cpu, | 185 | inline void describe_table(const char* tag, std::uint64_t va, std::uint32_t slots, const std::uint8_t* cpu, |
| 159 | const char* heap_kind) { | 186 | const char* heap_kind) { |
| 160 | const std::uint32_t shown = slots < 4 ? slots : 4; | 187 | // LEONIDA_FSDRAW_SLOTS=<n>: how many of a table's slots are shown (4 by default; a composite's textures sit later). |
| 188 | static const std::uint32_t limit = [] { | ||
| 189 | const char* v = std::getenv("LEONIDA_FSDRAW_SLOTS"); | ||
| 190 | const unsigned long n = v ? std::strtoul(v, nullptr, 10) : 0; | ||
| 191 | return n ? std::uint32_t(n < 64 ? n : 64) : 4u; | ||
| 192 | }(); | ||
| 193 | const std::uint32_t shown = slots < limit ? slots : limit; | ||
| 161 | std::fprintf(stderr, "[rt] fsdraw: %s table va 0x%llx slots %u heap %s (arena size 0x%llx)\n", tag, | 194 | std::fprintf(stderr, "[rt] fsdraw: %s table va 0x%llx slots %u heap %s (arena size 0x%llx)\n", tag, |
| 162 | static_cast<unsigned long long>(va), slots, heap_kind, static_cast<unsigned long long>(arena_size())); | 195 | static_cast<unsigned long long>(va), slots, heap_kind, static_cast<unsigned long long>(arena_size())); |
| 163 | for (std::uint32_t i = 0; i < shown; ++i) { | 196 | for (std::uint32_t i = 0; i < shown; ++i) { |
| @@ -187,6 +220,32 @@ inline void describe_table(const char* tag, std::uint64_t va, std::uint32_t slot | |||
| 187 | if (!all.empty() && arena_words(base, all.data(), all.size())) | 220 | if (!all.empty() && arena_words(base, all.data(), all.size())) |
| 188 | for (const std::uint32_t x : all) nonzero += x != 0; | 221 | for (const std::uint32_t x : all) nonzero += x != 0; |
| 189 | } | 222 | } |
| 223 | // A V# in the arena: the title bytes it was copied from, beside the arena copy the GPU reads, and what | ||
| 224 | // keeps that copy (a coherence gap shows as title nonzero / arena zero, repeatedly). | ||
| 225 | std::uint64_t source = 0, range_va = 0, range_bytes = 0; | ||
| 226 | if (in_arena && title_va_aliases().title_of_shader(base, source, range_va, range_bytes)) { | ||
| 227 | std::uint64_t lo = 0, hi = 0; | ||
| 228 | std::uint32_t title_words[16]{}; | ||
| 229 | const bool title_readable = | ||
| 230 | title_va_aliases().title_memory(source, lo, hi) && hi - source >= sizeof title_words; | ||
| 231 | if (title_readable) | ||
| 232 | std::memcpy(title_words, reinterpret_cast<const void*>(static_cast<std::uintptr_t>(source)), | ||
| 233 | sizeof title_words); | ||
| 234 | const auto hook = backing_hook().load(std::memory_order_acquire); | ||
| 235 | std::fprintf(stderr, "[rt] fsdraw: %s slot %u arena 0x%llx comes from title 0x%llx (alias range 0x%llx, " | ||
| 236 | "%llu bytes; backing %s): title [%s]%s\n", | ||
| 237 | tag, i, static_cast<unsigned long long>(base), static_cast<unsigned long long>(source), | ||
| 238 | static_cast<unsigned long long>(range_va), static_cast<unsigned long long>(range_bytes), | ||
| 239 | hook ? hook(source) : "unknown", | ||
| 240 | title_readable ? hex_words(title_words, 16).c_str() : "not readable", | ||
| 241 | !title_readable ? "" | ||
| 242 | // Only the alias range's own bytes (at most the 64 shown): the rest is another object's. | ||
| 243 | : std::memcmp(title_words, data, std::size_t(std::min<std::uint64_t>( | ||
| 244 | sizeof data, range_va + range_bytes - source))) ? " DIFFER" : " SAME"); | ||
| 245 | } else if (in_arena) { | ||
| 246 | std::fprintf(stderr, "[rt] fsdraw: %s slot %u arena 0x%llx: no title range maps to it (the layer's own memory)\n", | ||
| 247 | tag, i, static_cast<unsigned long long>(base)); | ||
| 248 | } | ||
| 190 | std::uint64_t location = 0; | 249 | std::uint64_t location = 0; |
| 191 | const bool made = cbv_origin(base, location); | 250 | const bool made = cbv_origin(base, location); |
| 192 | std::fprintf(stderr, "[rt] fsdraw: %s slot %u V# base 0x%llx stride %u records %u -> %s [%s] nonzero dwords " | 251 | std::fprintf(stderr, "[rt] fsdraw: %s slot %u V# base 0x%llx stride %u records %u -> %s [%s] nonzero dwords " |
diff --git a/runtime/src/gfx10_descriptors.h b/runtime/src/gfx10_descriptors.h index 219e0a8c5..acfa590f8 100644 --- a/runtime/src/gfx10_descriptors.h +++ b/runtime/src/gfx10_descriptors.h | |||
| @@ -236,6 +236,16 @@ inline constexpr VkImageViewType vulkan_view_type(ImageType type) { | |||
| 236 | } | 236 | } |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | inline constexpr VkImageSubresourceRange vulkan_subresource_range(const Image& image, VkImageAspectFlags aspects) { | ||
| 240 | const bool volume = image.type == ImageType::image_3d; | ||
| 241 | return {aspects, image.first_mip, image.mip_count, volume ? 0u : image.first_layer, | ||
| 242 | volume ? 1u : image.layer_count}; | ||
| 243 | } | ||
| 244 | |||
| 245 | inline constexpr bool has_hardware_volume_uav_slice_offset(const ImageWords& words, const Image& image) { | ||
| 246 | return image.type == ImageType::image_3d && image.first_layer != 0 && detail::get(words[5], 0, 4) == 1; | ||
| 247 | } | ||
| 248 | |||
| 239 | // ---- formats ---- | 249 | // ---- formats ---- |
| 240 | 250 | ||
| 241 | // One row for each Vulkan format: its GFX10_FORMAT code, and the DST_SEL that reads its channels as R, G, B, A | 251 | // One row for each Vulkan format: its GFX10_FORMAT code, and the DST_SEL that reads its channels as R, G, B, A |
diff --git a/runtime/src/indirect_clamp.comp b/runtime/src/indirect_clamp.comp index 565a19463..3b99da59a 100644 --- a/runtime/src/indirect_clamp.comp +++ b/runtime/src/indirect_clamp.comp | |||
| @@ -117,6 +117,16 @@ void main() { | |||
| 117 | const uint asked_x = p.arguments.data[src]; | 117 | const uint asked_x = p.arguments.data[src]; |
| 118 | const uint asked_y = p.arguments.data[src + 1u]; | 118 | const uint asked_y = p.arguments.data[src + 1u]; |
| 119 | const uint asked_z = p.arguments.data[src + 2u]; | 119 | const uint asked_z = p.arguments.data[src + 2u]; |
| 120 | if (p.kind == 3u) { | ||
| 121 | // Before the clamp: how many mesh records ask for more than one group in y or z, and the largest y and z | ||
| 122 | // asked (stats words 8-11), which y = z = 1 below would cut. | ||
| 123 | atomicAdd(p.stats.data[8], 1u); | ||
| 124 | if (asked_y > 1u || asked_z > 1u) { | ||
| 125 | atomicAdd(p.stats.data[9], 1u); | ||
| 126 | atomicMax(p.stats.data[10], asked_y); | ||
| 127 | atomicMax(p.stats.data[11], asked_z); | ||
| 128 | } | ||
| 129 | } | ||
| 120 | uint x = min(asked_x, max_group_dimension); | 130 | uint x = min(asked_x, max_group_dimension); |
| 121 | uint y = min(asked_y, max_group_dimension); | 131 | uint y = min(asked_y, max_group_dimension); |
| 122 | uint z = min(asked_z, max_group_dimension); | 132 | uint z = min(asked_z, max_group_dimension); |
diff --git a/runtime/src/indirect_clamp_spv.h b/runtime/src/indirect_clamp_spv.h index 50253df78..653e0543f 100644 --- a/runtime/src/indirect_clamp_spv.h +++ b/runtime/src/indirect_clamp_spv.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #include <cstdint> | 3 | #include <cstdint> |
| 4 | namespace leonida { | 4 | namespace leonida { |
| 5 | inline constexpr std::uint32_t indirect_clamp_spirv[] = { | 5 | inline constexpr std::uint32_t indirect_clamp_spirv[] = { |
| 6 | 0x07230203u, 0x00010500u, 0x0008000bu, 0x000002d0u, 0x00000000u, 0x00020011u, 0x00000001u, 0x00020011u, | 6 | 0x07230203u, 0x00010500u, 0x0008000bu, 0x000002fau, 0x00000000u, 0x00020011u, 0x00000001u, 0x00020011u, |
| 7 | 0x000014e3u, 0x0006000bu, 0x00000001u, 0x4c534c47u, 0x6474732eu, 0x3035342eu, 0x00000000u, 0x0003000eu, | 7 | 0x000014e3u, 0x0006000bu, 0x00000001u, 0x4c534c47u, 0x6474732eu, 0x3035342eu, 0x00000000u, 0x0003000eu, |
| 8 | 0x000014e4u, 0x00000001u, 0x0007000fu, 0x00000005u, 0x00000004u, 0x6e69616du, 0x00000000u, 0x00000026u, | 8 | 0x000014e4u, 0x00000001u, 0x0007000fu, 0x00000005u, 0x00000004u, 0x6e69616du, 0x00000000u, 0x00000026u, |
| 9 | 0x0000005au, 0x00060010u, 0x00000004u, 0x00000011u, 0x00000040u, 0x00000001u, 0x00000001u, 0x00030003u, | 9 | 0x0000005au, 0x00060010u, 0x00000004u, 0x00000011u, 0x00000040u, 0x00000001u, 0x00000001u, 0x00030003u, |
| @@ -42,7 +42,7 @@ inline constexpr std::uint32_t indirect_clamp_spirv[] = { | |||
| 42 | 0x00000006u, 0x00000004u, 0x00030047u, 0x00000022u, 0x00000002u, 0x00050048u, 0x00000022u, 0x00000000u, | 42 | 0x00000006u, 0x00000004u, 0x00030047u, 0x00000022u, 0x00000002u, 0x00050048u, 0x00000022u, 0x00000000u, |
| 43 | 0x00000023u, 0x00000000u, 0x00040047u, 0x00000023u, 0x00000006u, 0x00000004u, 0x00030047u, 0x00000024u, | 43 | 0x00000023u, 0x00000000u, 0x00040047u, 0x00000023u, 0x00000006u, 0x00000004u, 0x00030047u, 0x00000024u, |
| 44 | 0x00000002u, 0x00050048u, 0x00000024u, 0x00000000u, 0x00000023u, 0x00000000u, 0x00040047u, 0x0000005au, | 44 | 0x00000002u, 0x00050048u, 0x00000024u, 0x00000000u, 0x00000023u, 0x00000000u, 0x00040047u, 0x0000005au, |
| 45 | 0x0000000bu, 0x0000001cu, 0x00040047u, 0x00000209u, 0x0000000bu, 0x00000019u, 0x00020013u, 0x00000002u, | 45 | 0x0000000bu, 0x0000001cu, 0x00040047u, 0x00000227u, 0x0000000bu, 0x00000019u, 0x00020013u, 0x00000002u, |
| 46 | 0x00030021u, 0x00000003u, 0x00000002u, 0x00040015u, 0x00000006u, 0x00000020u, 0x00000000u, 0x00040020u, | 46 | 0x00030021u, 0x00000003u, 0x00000002u, 0x00040015u, 0x00000006u, 0x00000020u, 0x00000000u, 0x00040020u, |
| 47 | 0x00000007u, 0x00000007u, 0x00000006u, 0x00020014u, 0x00000008u, 0x0004002bu, 0x00000006u, 0x0000000eu, | 47 | 0x00000007u, 0x00000007u, 0x00000006u, 0x00020014u, 0x00000008u, 0x0004002bu, 0x00000006u, 0x0000000eu, |
| 48 | 0x00000000u, 0x00030029u, 0x00000008u, 0x00000012u, 0x00030027u, 0x00000015u, 0x000014e5u, 0x00030027u, | 48 | 0x00000000u, 0x00030029u, 0x00000008u, 0x00000012u, 0x00030027u, 0x00000015u, 0x000014e5u, 0x00030027u, |
| @@ -75,16 +75,16 @@ inline constexpr std::uint32_t indirect_clamp_spirv[] = { | |||
| 75 | 0x00000006u, 0x00000079u, 0x00040020u, 0x00000115u, 0x00000007u, 0x00000114u, 0x0008002cu, 0x00000114u, | 75 | 0x00000006u, 0x00000079u, 0x00040020u, 0x00000115u, 0x00000007u, 0x00000114u, 0x0008002cu, 0x00000114u, |
| 76 | 0x00000117u, 0x0000000eu, 0x0000000eu, 0x0000000eu, 0x0000000eu, 0x0000000eu, 0x0004002bu, 0x00000006u, | 76 | 0x00000117u, 0x0000000eu, 0x0000000eu, 0x0000000eu, 0x0000000eu, 0x0000000eu, 0x0004002bu, 0x00000006u, |
| 77 | 0x0000012eu, 0x01000000u, 0x0004002bu, 0x00000006u, 0x00000132u, 0x04000000u, 0x0004002bu, 0x00000006u, | 77 | 0x0000012eu, 0x01000000u, 0x0004002bu, 0x00000006u, 0x00000132u, 0x04000000u, 0x0004002bu, 0x00000006u, |
| 78 | 0x0000014du, 0x00000002u, 0x0004002bu, 0x00000006u, 0x0000017cu, 0x0000ffffu, 0x0004002bu, 0x00000006u, | 78 | 0x0000014du, 0x00000002u, 0x0004002bu, 0x00000006u, 0x0000019au, 0x0000ffffu, 0x0004002bu, 0x00000006u, |
| 79 | 0x000001b0u, 0x00100000u, 0x0004002bu, 0x00000006u, 0x000001cbu, 0x00000080u, 0x0004002bu, 0x00000006u, | 79 | 0x000001ceu, 0x00100000u, 0x0004002bu, 0x00000006u, 0x000001e9u, 0x00000080u, 0x0004002bu, 0x00000006u, |
| 80 | 0x000001ccu, 0x00000040u, 0x0006002cu, 0x00000058u, 0x00000209u, 0x000001ccu, 0x0000002fu, 0x0000002fu, | 80 | 0x000001eau, 0x00000040u, 0x0006002cu, 0x00000058u, 0x00000227u, 0x000001eau, 0x0000002fu, 0x0000002fu, |
| 81 | 0x00030001u, 0x00000008u, 0x00000288u, 0x00050036u, 0x00000002u, 0x00000004u, 0x00000000u, 0x00000003u, | 81 | 0x00030001u, 0x00000008u, 0x000002acu, 0x00050036u, 0x00000002u, 0x00000004u, 0x00000000u, 0x00000003u, |
| 82 | 0x000200f8u, 0x00000005u, 0x0004003bu, 0x00000115u, 0x00000116u, 0x00000007u, 0x000300f7u, 0x0000020au, | 82 | 0x000200f8u, 0x00000005u, 0x0004003bu, 0x00000115u, 0x00000116u, 0x00000007u, 0x000300f7u, 0x00000228u, |
| 83 | 0x00000000u, 0x000300fbu, 0x0000000eu, 0x0000020bu, 0x000200f8u, 0x0000020bu, 0x00050041u, 0x0000005bu, | 83 | 0x00000000u, 0x000300fbu, 0x0000000eu, 0x00000229u, 0x000200f8u, 0x00000229u, 0x00050041u, 0x0000005bu, |
| 84 | 0x0000005cu, 0x0000005au, 0x0000000eu, 0x0004003du, 0x00000006u, 0x0000005du, 0x0000005cu, 0x00050041u, | 84 | 0x0000005cu, 0x0000005au, 0x0000000eu, 0x0004003du, 0x00000006u, 0x0000005du, 0x0000005cu, 0x00050041u, |
| 85 | 0x00000060u, 0x00000061u, 0x00000026u, 0x0000005fu, 0x0004003du, 0x00000006u, 0x00000062u, 0x00000061u, | 85 | 0x00000060u, 0x00000061u, 0x00000026u, 0x0000005fu, 0x0004003du, 0x00000006u, 0x00000062u, 0x00000061u, |
| 86 | 0x000500aeu, 0x00000008u, 0x00000063u, 0x0000005du, 0x00000062u, 0x000300f7u, 0x00000065u, 0x00000000u, | 86 | 0x000500aeu, 0x00000008u, 0x00000063u, 0x0000005du, 0x00000062u, 0x000300f7u, 0x00000065u, 0x00000000u, |
| 87 | 0x000400fau, 0x00000063u, 0x00000064u, 0x00000065u, 0x000200f8u, 0x00000064u, 0x000200f9u, 0x0000020au, | 87 | 0x000400fau, 0x00000063u, 0x00000064u, 0x00000065u, 0x000200f8u, 0x00000064u, 0x000200f9u, 0x00000228u, |
| 88 | 0x000200f8u, 0x00000065u, 0x00050041u, 0x00000060u, 0x00000069u, 0x00000026u, 0x00000068u, 0x0004003du, | 88 | 0x000200f8u, 0x00000065u, 0x00050041u, 0x00000060u, 0x00000069u, 0x00000026u, 0x00000068u, 0x0004003du, |
| 89 | 0x00000006u, 0x0000006au, 0x00000069u, 0x00050080u, 0x00000006u, 0x0000006cu, 0x0000006au, 0x0000005du, | 89 | 0x00000006u, 0x0000006au, 0x00000069u, 0x00050080u, 0x00000006u, 0x0000006cu, 0x0000006au, 0x0000005du, |
| 90 | 0x00050041u, 0x00000060u, 0x0000006fu, 0x00000026u, 0x0000006eu, 0x0004003du, 0x00000006u, 0x00000070u, | 90 | 0x00050041u, 0x00000060u, 0x0000006fu, 0x00000026u, 0x0000006eu, 0x0004003du, 0x00000006u, 0x00000070u, |
| @@ -92,8 +92,8 @@ inline constexpr std::uint32_t indirect_clamp_spirv[] = { | |||
| 92 | 0x00000000u, 0x000400fau, 0x00000071u, 0x00000073u, 0x0000007bu, 0x000200f8u, 0x00000073u, 0x000500aau, | 92 | 0x00000000u, 0x000400fau, 0x00000071u, 0x00000073u, 0x0000007bu, 0x000200f8u, 0x00000073u, 0x000500aau, |
| 93 | 0x00000008u, 0x00000077u, 0x00000070u, 0x0000000eu, 0x000600a9u, 0x00000006u, 0x0000007au, 0x00000077u, | 93 | 0x00000008u, 0x00000077u, 0x00000070u, 0x0000000eu, 0x000600a9u, 0x00000006u, 0x0000007au, 0x00000077u, |
| 94 | 0x00000078u, 0x00000079u, 0x000200f9u, 0x00000074u, 0x000200f8u, 0x0000007bu, 0x000200f9u, 0x00000074u, | 94 | 0x00000078u, 0x00000079u, 0x000200f9u, 0x00000074u, 0x000200f8u, 0x0000007bu, 0x000200f9u, 0x00000074u, |
| 95 | 0x000200f8u, 0x00000074u, 0x000700f5u, 0x00000006u, 0x00000246u, 0x0000007au, 0x00000073u, 0x0000007cu, | 95 | 0x000200f8u, 0x00000074u, 0x000700f5u, 0x00000006u, 0x00000264u, 0x0000007au, 0x00000073u, 0x0000007cu, |
| 96 | 0x0000007bu, 0x00050084u, 0x00000006u, 0x00000081u, 0x0000005du, 0x00000246u, 0x00050041u, 0x00000060u, | 96 | 0x0000007bu, 0x00050084u, 0x00000006u, 0x00000081u, 0x0000005du, 0x00000264u, 0x00050041u, 0x00000060u, |
| 97 | 0x00000085u, 0x00000026u, 0x00000084u, 0x0004003du, 0x00000006u, 0x00000086u, 0x00000085u, 0x000500c7u, | 97 | 0x00000085u, 0x00000026u, 0x00000084u, 0x0004003du, 0x00000006u, 0x00000086u, 0x00000085u, 0x000500c7u, |
| 98 | 0x00000006u, 0x00000087u, 0x00000086u, 0x0000002fu, 0x000500abu, 0x00000008u, 0x00000088u, 0x00000087u, | 98 | 0x00000006u, 0x00000087u, 0x00000086u, 0x0000002fu, 0x000500abu, 0x00000008u, 0x00000088u, 0x00000087u, |
| 99 | 0x0000000eu, 0x00050041u, 0x00000060u, 0x0000008bu, 0x00000026u, 0x0000008au, 0x0004003du, 0x00000006u, | 99 | 0x0000000eu, 0x00050041u, 0x00000060u, 0x0000008bu, 0x00000026u, 0x0000008au, 0x0004003du, 0x00000006u, |
| @@ -112,32 +112,32 @@ inline constexpr std::uint32_t indirect_clamp_spirv[] = { | |||
| 112 | 0x00060041u, 0x0000002du, 0x000000acu, 0x000000abu, 0x0000002cu, 0x00000091u, 0x000700eau, 0x00000006u, | 112 | 0x00060041u, 0x0000002du, 0x000000acu, 0x000000abu, 0x0000002cu, 0x00000091u, 0x000700eau, 0x00000006u, |
| 113 | 0x000000adu, 0x000000acu, 0x0000002fu, 0x0000000eu, 0x0000002fu, 0x000200f9u, 0x000000a8u, 0x000200f8u, | 113 | 0x000000adu, 0x000000acu, 0x0000002fu, 0x0000000eu, 0x0000002fu, 0x000200f9u, 0x000000a8u, 0x000200f8u, |
| 114 | 0x000000a8u, 0x000200f9u, 0x0000009du, 0x000200f8u, 0x0000009du, 0x000200f9u, 0x0000008fu, 0x000200f8u, | 114 | 0x000000a8u, 0x000200f9u, 0x0000009du, 0x000200f8u, 0x0000009du, 0x000200f9u, 0x0000008fu, 0x000200f8u, |
| 115 | 0x0000008fu, 0x000700f5u, 0x00000006u, 0x0000024cu, 0x0000008cu, 0x00000074u, 0x00000099u, 0x0000009du, | 115 | 0x0000008fu, 0x000700f5u, 0x00000006u, 0x0000026au, 0x0000008cu, 0x00000074u, 0x00000099u, 0x0000009du, |
| 116 | 0x000500aeu, 0x00000008u, 0x000000b0u, 0x0000006cu, 0x0000024cu, 0x000300f7u, 0x000000b2u, 0x00000000u, | 116 | 0x000500aeu, 0x00000008u, 0x000000b0u, 0x0000006cu, 0x0000026au, 0x000300f7u, 0x000000b2u, 0x00000000u, |
| 117 | 0x000400fau, 0x000000b0u, 0x000000b1u, 0x000000b2u, 0x000200f8u, 0x000000b1u, 0x000200f9u, 0x000000b4u, | 117 | 0x000400fau, 0x000000b0u, 0x000000b1u, 0x000000b2u, 0x000200f8u, 0x000000b1u, 0x000200f9u, 0x000000b4u, |
| 118 | 0x000200f8u, 0x000000b4u, 0x000700f5u, 0x00000006u, 0x000002c2u, 0x0000000eu, 0x000000b1u, 0x000000c5u, | 118 | 0x000200f8u, 0x000000b4u, 0x000700f5u, 0x00000006u, 0x000002ecu, 0x0000000eu, 0x000000b1u, 0x000000c5u, |
| 119 | 0x000000b5u, 0x000500b0u, 0x00000008u, 0x000000bbu, 0x000002c2u, 0x00000246u, 0x000400f6u, 0x000000b6u, | 119 | 0x000000b5u, 0x000500b0u, 0x00000008u, 0x000000bbu, 0x000002ecu, 0x00000264u, 0x000400f6u, 0x000000b6u, |
| 120 | 0x000000b5u, 0x00000000u, 0x000400fau, 0x000000bbu, 0x000000b5u, 0x000000b6u, 0x000200f8u, 0x000000b5u, | 120 | 0x000000b5u, 0x00000000u, 0x000400fau, 0x000000bbu, 0x000000b5u, 0x000000b6u, 0x000200f8u, 0x000000b5u, |
| 121 | 0x00050041u, 0x000000bdu, 0x000000beu, 0x00000026u, 0x000000bcu, 0x0004003du, 0x00000017u, 0x000000bfu, | 121 | 0x00050041u, 0x000000bdu, 0x000000beu, 0x00000026u, 0x000000bcu, 0x0004003du, 0x00000017u, 0x000000bfu, |
| 122 | 0x000000beu, 0x00050080u, 0x00000006u, 0x000000c2u, 0x00000081u, 0x000002c2u, 0x00060041u, 0x0000002du, | 122 | 0x000000beu, 0x00050080u, 0x00000006u, 0x000000c2u, 0x00000081u, 0x000002ecu, 0x00060041u, 0x0000002du, |
| 123 | 0x000000c3u, 0x000000bfu, 0x0000002cu, 0x000000c2u, 0x0005003eu, 0x000000c3u, 0x0000000eu, 0x00000002u, | 123 | 0x000000c3u, 0x000000bfu, 0x0000002cu, 0x000000c2u, 0x0005003eu, 0x000000c3u, 0x0000000eu, 0x00000002u, |
| 124 | 0x00000004u, 0x00050080u, 0x00000006u, 0x000000c5u, 0x000002c2u, 0x00000091u, 0x000200f9u, 0x000000b4u, | 124 | 0x00000004u, 0x00050080u, 0x00000006u, 0x000000c5u, 0x000002ecu, 0x00000091u, 0x000200f9u, 0x000000b4u, |
| 125 | 0x000200f8u, 0x000000b6u, 0x000200f9u, 0x0000020au, 0x000200f8u, 0x000000b2u, 0x00050041u, 0x00000060u, | 125 | 0x000200f8u, 0x000000b6u, 0x000200f9u, 0x00000228u, 0x000200f8u, 0x000000b2u, 0x00050041u, 0x00000060u, |
| 126 | 0x000000cau, 0x00000026u, 0x000000c9u, 0x0004003du, 0x00000006u, 0x000000cbu, 0x000000cau, 0x00050084u, | 126 | 0x000000cau, 0x00000026u, 0x000000c9u, 0x0004003du, 0x00000006u, 0x000000cbu, 0x000000cau, 0x00050084u, |
| 127 | 0x00000006u, 0x000000ccu, 0x0000005du, 0x000000cbu, 0x000200f9u, 0x000000cfu, 0x000200f8u, 0x000000cfu, | 127 | 0x00000006u, 0x000000ccu, 0x0000005du, 0x000000cbu, 0x000200f9u, 0x000000cfu, 0x000200f8u, 0x000000cfu, |
| 128 | 0x000700f5u, 0x00000008u, 0x00000257u, 0x00000012u, 0x000000b2u, 0x000000e4u, 0x000000d2u, 0x000700f5u, | 128 | 0x000700f5u, 0x00000008u, 0x00000275u, 0x00000012u, 0x000000b2u, 0x000000e4u, 0x000000d2u, 0x000700f5u, |
| 129 | 0x00000006u, 0x00000252u, 0x0000000eu, 0x000000b2u, 0x000000e6u, 0x000000d2u, 0x000500b0u, 0x00000008u, | 129 | 0x00000006u, 0x00000270u, 0x0000000eu, 0x000000b2u, 0x000000e6u, 0x000000d2u, 0x000500b0u, 0x00000008u, |
| 130 | 0x000000d6u, 0x00000252u, 0x00000246u, 0x000400f6u, 0x000000d1u, 0x000000d2u, 0x00000000u, 0x000400fau, | 130 | 0x000000d6u, 0x00000270u, 0x00000264u, 0x000400f6u, 0x000000d1u, 0x000000d2u, 0x00000000u, 0x000400fau, |
| 131 | 0x000000d6u, 0x000000d0u, 0x000000d1u, 0x000200f8u, 0x000000d0u, 0x000300f7u, 0x000000d9u, 0x00000000u, | 131 | 0x000000d6u, 0x000000d0u, 0x000000d1u, 0x000200f8u, 0x000000d0u, 0x000300f7u, 0x000000d9u, 0x00000000u, |
| 132 | 0x000400fau, 0x00000257u, 0x000000d8u, 0x000000d9u, 0x000200f8u, 0x000000d8u, 0x00050041u, 0x000000dau, | 132 | 0x000400fau, 0x00000275u, 0x000000d8u, 0x000000d9u, 0x000200f8u, 0x000000d8u, 0x00050041u, 0x000000dau, |
| 133 | 0x000000dbu, 0x00000026u, 0x0000002cu, 0x0004003du, 0x00000015u, 0x000000dcu, 0x000000dbu, 0x00050080u, | 133 | 0x000000dbu, 0x00000026u, 0x0000002cu, 0x0004003du, 0x00000015u, 0x000000dcu, 0x000000dbu, 0x00050080u, |
| 134 | 0x00000006u, 0x000000dfu, 0x000000ccu, 0x00000252u, 0x00060041u, 0x0000002du, 0x000000e0u, 0x000000dcu, | 134 | 0x00000006u, 0x000000dfu, 0x000000ccu, 0x00000270u, 0x00060041u, 0x0000002du, 0x000000e0u, 0x000000dcu, |
| 135 | 0x0000002cu, 0x000000dfu, 0x0006003du, 0x00000006u, 0x000000e1u, 0x000000e0u, 0x00000002u, 0x00000004u, | 135 | 0x0000002cu, 0x000000dfu, 0x0006003du, 0x00000006u, 0x000000e1u, 0x000000e0u, 0x00000002u, 0x00000004u, |
| 136 | 0x000500aau, 0x00000008u, 0x000000e3u, 0x000000e1u, 0x000000e2u, 0x000200f9u, 0x000000d9u, 0x000200f8u, | 136 | 0x000500aau, 0x00000008u, 0x000000e3u, 0x000000e1u, 0x000000e2u, 0x000200f9u, 0x000000d9u, 0x000200f8u, |
| 137 | 0x000000d9u, 0x000700f5u, 0x00000008u, 0x000000e4u, 0x00000257u, 0x000000d0u, 0x000000e3u, 0x000000d8u, | 137 | 0x000000d9u, 0x000700f5u, 0x00000008u, 0x000000e4u, 0x00000275u, 0x000000d0u, 0x000000e3u, 0x000000d8u, |
| 138 | 0x000200f9u, 0x000000d2u, 0x000200f8u, 0x000000d2u, 0x00050080u, 0x00000006u, 0x000000e6u, 0x00000252u, | 138 | 0x000200f9u, 0x000000d2u, 0x000200f8u, 0x000000d2u, 0x00050080u, 0x00000006u, 0x000000e6u, 0x00000270u, |
| 139 | 0x00000091u, 0x000200f9u, 0x000000cfu, 0x000200f8u, 0x000000d1u, 0x000400a8u, 0x00000008u, 0x000000e8u, | 139 | 0x00000091u, 0x000200f9u, 0x000000cfu, 0x000200f8u, 0x000000d1u, 0x000400a8u, 0x00000008u, 0x000000e8u, |
| 140 | 0x00000257u, 0x000300f7u, 0x000000eau, 0x00000000u, 0x000400fau, 0x000000e8u, 0x000000e9u, 0x000000eau, | 140 | 0x00000275u, 0x000300f7u, 0x000000eau, 0x00000000u, 0x000400fau, 0x000000e8u, 0x000000e9u, 0x000000eau, |
| 141 | 0x000200f8u, 0x000000e9u, 0x000500aau, 0x00000008u, 0x000000edu, 0x00000070u, 0x0000007cu, 0x000300f7u, | 141 | 0x000200f8u, 0x000000e9u, 0x000500aau, 0x00000008u, 0x000000edu, 0x00000070u, 0x0000007cu, 0x000300f7u, |
| 142 | 0x000000efu, 0x00000000u, 0x000400fau, 0x000000edu, 0x000000eeu, 0x000000efu, 0x000200f8u, 0x000000eeu, | 142 | 0x000000efu, 0x00000000u, 0x000400fau, 0x000000edu, 0x000000eeu, 0x000000efu, 0x000200f8u, 0x000000eeu, |
| 143 | 0x00050041u, 0x000000dau, 0x000000f0u, 0x00000026u, 0x0000002cu, 0x0004003du, 0x00000015u, 0x000000f1u, | 143 | 0x00050041u, 0x000000dau, 0x000000f0u, 0x00000026u, 0x0000002cu, 0x0004003du, 0x00000015u, 0x000000f1u, |
| @@ -145,21 +145,21 @@ inline constexpr std::uint32_t indirect_clamp_spirv[] = { | |||
| 145 | 0x00000006u, 0x000000f4u, 0x000000f3u, 0x00000002u, 0x00000004u, 0x000500aau, 0x00000008u, 0x000000f5u, | 145 | 0x00000006u, 0x000000f4u, 0x000000f3u, 0x00000002u, 0x00000004u, 0x000500aau, 0x00000008u, 0x000000f5u, |
| 146 | 0x000000f4u, 0x000000e2u, 0x000200f9u, 0x000000efu, 0x000200f8u, 0x000000efu, 0x000700f5u, 0x00000008u, | 146 | 0x000000f4u, 0x000000e2u, 0x000200f9u, 0x000000efu, 0x000200f8u, 0x000000efu, 0x000700f5u, 0x00000008u, |
| 147 | 0x000000f6u, 0x000000edu, 0x000000e9u, 0x000000f5u, 0x000000eeu, 0x000200f9u, 0x000000eau, 0x000200f8u, | 147 | 0x000000f6u, 0x000000edu, 0x000000e9u, 0x000000f5u, 0x000000eeu, 0x000200f9u, 0x000000eau, 0x000200f8u, |
| 148 | 0x000000eau, 0x000700f5u, 0x00000008u, 0x000000f7u, 0x00000257u, 0x000000d1u, 0x000000f6u, 0x000000efu, | 148 | 0x000000eau, 0x000700f5u, 0x00000008u, 0x000000f7u, 0x00000275u, 0x000000d1u, 0x000000f6u, 0x000000efu, |
| 149 | 0x000300f7u, 0x000000f9u, 0x00000000u, 0x000400fau, 0x000000f7u, 0x000000f8u, 0x000000f9u, 0x000200f8u, | 149 | 0x000300f7u, 0x000000f9u, 0x00000000u, 0x000400fau, 0x000000f7u, 0x000000f8u, 0x000000f9u, 0x000200f8u, |
| 150 | 0x000000f8u, 0x000200f9u, 0x000000fbu, 0x000200f8u, 0x000000fbu, 0x000700f5u, 0x00000006u, 0x000002beu, | 150 | 0x000000f8u, 0x000200f9u, 0x000000fbu, 0x000200f8u, 0x000000fbu, 0x000700f5u, 0x00000006u, 0x000002e8u, |
| 151 | 0x0000000eu, 0x000000f8u, 0x0000010au, 0x000000fcu, 0x000500b0u, 0x00000008u, 0x00000102u, 0x000002beu, | 151 | 0x0000000eu, 0x000000f8u, 0x0000010au, 0x000000fcu, 0x000500b0u, 0x00000008u, 0x00000102u, 0x000002e8u, |
| 152 | 0x00000246u, 0x000400f6u, 0x000000fdu, 0x000000fcu, 0x00000000u, 0x000400fau, 0x00000102u, 0x000000fcu, | 152 | 0x00000264u, 0x000400f6u, 0x000000fdu, 0x000000fcu, 0x00000000u, 0x000400fau, 0x00000102u, 0x000000fcu, |
| 153 | 0x000000fdu, 0x000200f8u, 0x000000fcu, 0x00050041u, 0x000000bdu, 0x00000103u, 0x00000026u, 0x000000bcu, | 153 | 0x000000fdu, 0x000200f8u, 0x000000fcu, 0x00050041u, 0x000000bdu, 0x00000103u, 0x00000026u, 0x000000bcu, |
| 154 | 0x0004003du, 0x00000017u, 0x00000104u, 0x00000103u, 0x00050080u, 0x00000006u, 0x00000107u, 0x00000081u, | 154 | 0x0004003du, 0x00000017u, 0x00000104u, 0x00000103u, 0x00050080u, 0x00000006u, 0x00000107u, 0x00000081u, |
| 155 | 0x000002beu, 0x00060041u, 0x0000002du, 0x00000108u, 0x00000104u, 0x0000002cu, 0x00000107u, 0x0005003eu, | 155 | 0x000002e8u, 0x00060041u, 0x0000002du, 0x00000108u, 0x00000104u, 0x0000002cu, 0x00000107u, 0x0005003eu, |
| 156 | 0x00000108u, 0x0000000eu, 0x00000002u, 0x00000004u, 0x00050080u, 0x00000006u, 0x0000010au, 0x000002beu, | 156 | 0x00000108u, 0x0000000eu, 0x00000002u, 0x00000004u, 0x00050080u, 0x00000006u, 0x0000010au, 0x000002e8u, |
| 157 | 0x00000091u, 0x000200f9u, 0x000000fbu, 0x000200f8u, 0x000000fdu, 0x00050041u, 0x00000029u, 0x0000010bu, | 157 | 0x00000091u, 0x000200f9u, 0x000000fbu, 0x000200f8u, 0x000000fdu, 0x00050041u, 0x00000029u, 0x0000010bu, |
| 158 | 0x00000026u, 0x000000a9u, 0x0004003du, 0x00000019u, 0x0000010cu, 0x0000010bu, 0x00060041u, 0x0000002du, | 158 | 0x00000026u, 0x000000a9u, 0x0004003du, 0x00000019u, 0x0000010cu, 0x0000010bu, 0x00060041u, 0x0000002du, |
| 159 | 0x0000010du, 0x0000010cu, 0x0000002cu, 0x0000002cu, 0x000700eau, 0x00000006u, 0x0000010eu, 0x0000010du, | 159 | 0x0000010du, 0x0000010cu, 0x0000002cu, 0x0000002cu, 0x000700eau, 0x00000006u, 0x0000010eu, 0x0000010du, |
| 160 | 0x0000002fu, 0x0000000eu, 0x0000002fu, 0x00060041u, 0x0000002du, 0x00000111u, 0x0000010cu, 0x0000002cu, | 160 | 0x0000002fu, 0x0000000eu, 0x0000002fu, 0x00060041u, 0x0000002du, 0x00000111u, 0x0000010cu, 0x0000002cu, |
| 161 | 0x0000009eu, 0x000700eau, 0x00000006u, 0x00000112u, 0x00000111u, 0x0000002fu, 0x0000000eu, 0x0000002fu, | 161 | 0x0000009eu, 0x000700eau, 0x00000006u, 0x00000112u, 0x00000111u, 0x0000002fu, 0x0000000eu, 0x0000002fu, |
| 162 | 0x000200f9u, 0x0000020au, 0x000200f8u, 0x000000f9u, 0x0003003eu, 0x00000116u, 0x00000117u, 0x000300f7u, | 162 | 0x000200f9u, 0x00000228u, 0x000200f8u, 0x000000f9u, 0x0003003eu, 0x00000116u, 0x00000117u, 0x000300f7u, |
| 163 | 0x0000011eu, 0x00000000u, 0x000400fau, 0x00000071u, 0x0000011du, 0x00000165u, 0x000200f8u, 0x0000011du, | 163 | 0x0000011eu, 0x00000000u, 0x000400fau, 0x00000071u, 0x0000011du, 0x00000165u, 0x000200f8u, 0x0000011du, |
| 164 | 0x00050041u, 0x000000dau, 0x00000120u, 0x00000026u, 0x0000002cu, 0x0004003du, 0x00000015u, 0x00000121u, | 164 | 0x00050041u, 0x000000dau, 0x00000120u, 0x00000026u, 0x0000002cu, 0x0004003du, 0x00000015u, 0x00000121u, |
| 165 | 0x00000120u, 0x00060041u, 0x0000002du, 0x00000123u, 0x00000121u, 0x0000002cu, 0x000000ccu, 0x0006003du, | 165 | 0x00000120u, 0x00060041u, 0x0000002du, 0x00000123u, 0x00000121u, 0x0000002cu, 0x000000ccu, 0x0006003du, |
| @@ -169,13 +169,13 @@ inline constexpr std::uint32_t indirect_clamp_spirv[] = { | |||
| 169 | 0x0000012fu, 0x00000001u, 0x00000026u, 0x00000124u, 0x0000012eu, 0x0007000cu, 0x00000006u, 0x00000134u, | 169 | 0x0000012fu, 0x00000001u, 0x00000026u, 0x00000124u, 0x0000012eu, 0x0007000cu, 0x00000006u, 0x00000134u, |
| 170 | 0x00000001u, 0x00000029u, 0x0000012fu, 0x0000002fu, 0x00050086u, 0x00000006u, 0x00000135u, 0x00000132u, | 170 | 0x00000001u, 0x00000029u, 0x0000012fu, 0x0000002fu, 0x00050086u, 0x00000006u, 0x00000135u, 0x00000132u, |
| 171 | 0x00000134u, 0x0007000cu, 0x00000006u, 0x00000136u, 0x00000001u, 0x00000026u, 0x0000012bu, 0x00000135u, | 171 | 0x00000134u, 0x0007000cu, 0x00000006u, 0x00000136u, 0x00000001u, 0x00000026u, 0x0000012bu, 0x00000135u, |
| 172 | 0x000500aau, 0x00000008u, 0x00000138u, 0x0000012fu, 0x0000000eu, 0x000600a9u, 0x00000006u, 0x000002c9u, | 172 | 0x000500aau, 0x00000008u, 0x00000138u, 0x0000012fu, 0x0000000eu, 0x000600a9u, 0x00000006u, 0x000002f3u, |
| 173 | 0x00000138u, 0x0000000eu, 0x00000136u, 0x000500abu, 0x00000008u, 0x0000013du, 0x0000012fu, 0x00000124u, | 173 | 0x00000138u, 0x0000000eu, 0x00000136u, 0x000500abu, 0x00000008u, 0x0000013du, 0x0000012fu, 0x00000124u, |
| 174 | 0x000500abu, 0x00000008u, 0x00000140u, 0x000002c9u, 0x0000012bu, 0x000500a6u, 0x00000008u, 0x00000141u, | 174 | 0x000500abu, 0x00000008u, 0x00000140u, 0x000002f3u, 0x0000012bu, 0x000500a6u, 0x00000008u, 0x00000141u, |
| 175 | 0x0000013du, 0x00000140u, 0x000600a9u, 0x00000006u, 0x00000142u, 0x00000141u, 0x0000002fu, 0x0000000eu, | 175 | 0x0000013du, 0x00000140u, 0x000600a9u, 0x00000006u, 0x00000142u, 0x00000141u, 0x0000002fu, 0x0000000eu, |
| 176 | 0x00050084u, 0x00000006u, 0x00000145u, 0x0000012fu, 0x000002c9u, 0x00050041u, 0x00000007u, 0x00000147u, | 176 | 0x00050084u, 0x00000006u, 0x00000145u, 0x0000012fu, 0x000002f3u, 0x00050041u, 0x00000007u, 0x00000147u, |
| 177 | 0x00000116u, 0x0000002cu, 0x0003003eu, 0x00000147u, 0x0000012fu, 0x00050041u, 0x00000007u, 0x00000149u, | 177 | 0x00000116u, 0x0000002cu, 0x0003003eu, 0x00000147u, 0x0000012fu, 0x00050041u, 0x00000007u, 0x00000149u, |
| 178 | 0x00000116u, 0x00000091u, 0x0003003eu, 0x00000149u, 0x000002c9u, 0x00050080u, 0x00000006u, 0x0000014eu, | 178 | 0x00000116u, 0x00000091u, 0x0003003eu, 0x00000149u, 0x000002f3u, 0x00050080u, 0x00000006u, 0x0000014eu, |
| 179 | 0x000000ccu, 0x0000014du, 0x00060041u, 0x0000002du, 0x0000014fu, 0x00000121u, 0x0000002cu, 0x0000014eu, | 179 | 0x000000ccu, 0x0000014du, 0x00060041u, 0x0000002du, 0x0000014fu, 0x00000121u, 0x0000002cu, 0x0000014eu, |
| 180 | 0x0006003du, 0x00000006u, 0x00000150u, 0x0000014fu, 0x00000002u, 0x00000004u, 0x00050041u, 0x00000007u, | 180 | 0x0006003du, 0x00000006u, 0x00000150u, 0x0000014fu, 0x00000002u, 0x00000004u, 0x00050041u, 0x00000007u, |
| 181 | 0x00000151u, 0x00000116u, 0x000000bcu, 0x0003003eu, 0x00000151u, 0x00000150u, 0x00050080u, 0x00000006u, | 181 | 0x00000151u, 0x00000116u, 0x000000bcu, 0x0003003eu, 0x00000151u, 0x00000150u, 0x00050080u, 0x00000006u, |
| @@ -194,94 +194,106 @@ inline constexpr std::uint32_t indirect_clamp_spirv[] = { | |||
| 194 | 0x00060041u, 0x0000002du, 0x00000171u, 0x00000168u, 0x0000002cu, 0x00000170u, 0x0006003du, 0x00000006u, | 194 | 0x00060041u, 0x0000002du, 0x00000171u, 0x00000168u, 0x0000002cu, 0x00000170u, 0x0006003du, 0x00000006u, |
| 195 | 0x00000172u, 0x00000171u, 0x00000002u, 0x00000004u, 0x00050080u, 0x00000006u, 0x00000177u, 0x000000ccu, | 195 | 0x00000172u, 0x00000171u, 0x00000002u, 0x00000004u, 0x00050080u, 0x00000006u, 0x00000177u, 0x000000ccu, |
| 196 | 0x0000014du, 0x00060041u, 0x0000002du, 0x00000178u, 0x00000168u, 0x0000002cu, 0x00000177u, 0x0006003du, | 196 | 0x0000014du, 0x00060041u, 0x0000002du, 0x00000178u, 0x00000168u, 0x0000002cu, 0x00000177u, 0x0006003du, |
| 197 | 0x00000006u, 0x00000179u, 0x00000178u, 0x00000002u, 0x00000004u, 0x0007000cu, 0x00000006u, 0x0000017du, | 197 | 0x00000006u, 0x00000179u, 0x00000178u, 0x00000002u, 0x00000004u, 0x000500aau, 0x00000008u, 0x0000017cu, |
| 198 | 0x00000001u, 0x00000026u, 0x0000016bu, 0x0000017cu, 0x0007000cu, 0x00000006u, 0x00000180u, 0x00000001u, | 198 | 0x00000070u, 0x0000007cu, 0x000300f7u, 0x0000017eu, 0x00000000u, 0x000400fau, 0x0000017cu, 0x0000017du, |
| 199 | 0x00000026u, 0x00000172u, 0x0000017cu, 0x0007000cu, 0x00000006u, 0x00000183u, 0x00000001u, 0x00000026u, | 199 | 0x0000017eu, 0x000200f8u, 0x0000017du, 0x00050041u, 0x00000029u, 0x0000017fu, 0x00000026u, 0x000000a9u, |
| 200 | 0x00000179u, 0x0000017cu, 0x000500aau, 0x00000008u, 0x00000186u, 0x00000070u, 0x0000007cu, 0x000600a9u, | 200 | 0x0004003du, 0x00000019u, 0x00000180u, 0x0000017fu, 0x00060041u, 0x0000002du, 0x00000181u, 0x00000180u, |
| 201 | 0x00000006u, 0x000002cau, 0x00000186u, 0x0000002fu, 0x00000183u, 0x000600a9u, 0x00000006u, 0x000002cbu, | 201 | 0x0000002cu, 0x0000005fu, 0x000700eau, 0x00000006u, 0x00000182u, 0x00000181u, 0x0000002fu, 0x0000000eu, |
| 202 | 0x00000186u, 0x0000002fu, 0x00000180u, 0x000500c2u, 0x00000006u, 0x0000018cu, 0x00000086u, 0x0000002fu, | 202 | 0x0000002fu, 0x000500acu, 0x00000008u, 0x00000184u, 0x00000172u, 0x0000002fu, 0x000500acu, 0x00000008u, |
| 203 | 0x000500abu, 0x00000008u, 0x0000018eu, 0x0000018cu, 0x0000000eu, 0x000500abu, 0x00000008u, 0x00000190u, | 203 | 0x00000186u, 0x00000179u, 0x0000002fu, 0x000500a6u, 0x00000008u, 0x00000187u, 0x00000184u, 0x00000186u, |
| 204 | 0x0000017du, 0x0000000eu, 0x000500a7u, 0x00000008u, 0x00000191u, 0x0000018eu, 0x00000190u, 0x000500abu, | 204 | 0x000300f7u, 0x00000189u, 0x00000000u, 0x000400fau, 0x00000187u, 0x00000188u, 0x00000189u, 0x000200f8u, |
| 205 | 0x00000008u, 0x00000193u, 0x000002cbu, 0x0000000eu, 0x000500a7u, 0x00000008u, 0x00000194u, 0x00000191u, | 205 | 0x00000188u, 0x00060041u, 0x0000002du, 0x0000018cu, 0x00000180u, 0x0000002cu, 0x00000068u, 0x000700eau, |
| 206 | 0x00000193u, 0x000500abu, 0x00000008u, 0x00000196u, 0x000002cau, 0x0000000eu, 0x000500a7u, 0x00000008u, | 206 | 0x00000006u, 0x0000018du, 0x0000018cu, 0x0000002fu, 0x0000000eu, 0x0000002fu, 0x00060041u, 0x0000002du, |
| 207 | 0x00000197u, 0x00000194u, 0x00000196u, 0x000300f7u, 0x00000199u, 0x00000000u, 0x000400fau, 0x00000197u, | 207 | 0x00000190u, 0x00000180u, 0x0000002cu, 0x0000008au, 0x000700efu, 0x00000006u, 0x00000192u, 0x00000190u, |
| 208 | 0x00000198u, 0x00000199u, 0x000200f8u, 0x00000198u, 0x0007000cu, 0x00000006u, 0x0000019cu, 0x00000001u, | 208 | 0x0000002fu, 0x0000000eu, 0x00000172u, 0x00060041u, 0x0000002du, 0x00000195u, 0x00000180u, 0x0000002cu, |
| 209 | 0x00000026u, 0x0000017du, 0x0000018cu, 0x00050086u, 0x00000006u, 0x000001a0u, 0x0000018cu, 0x0000019cu, | 209 | 0x00000084u, 0x000700efu, 0x00000006u, 0x00000197u, 0x00000195u, 0x0000002fu, 0x0000000eu, 0x00000179u, |
| 210 | 0x0007000cu, 0x00000006u, 0x000001a1u, 0x00000001u, 0x00000026u, 0x000002cbu, 0x000001a0u, 0x00050086u, | 210 | 0x000200f9u, 0x00000189u, 0x000200f8u, 0x00000189u, 0x000200f9u, 0x0000017eu, 0x000200f8u, 0x0000017eu, |
| 211 | 0x00000006u, 0x000001a7u, 0x000001a0u, 0x000001a1u, 0x0007000cu, 0x00000006u, 0x000001a8u, 0x00000001u, | 211 | 0x0007000cu, 0x00000006u, 0x0000019bu, 0x00000001u, 0x00000026u, 0x0000016bu, 0x0000019au, 0x0007000cu, |
| 212 | 0x00000026u, 0x000002cau, 0x000001a7u, 0x000200f9u, 0x00000199u, 0x000200f8u, 0x00000199u, 0x000700f5u, | 212 | 0x00000006u, 0x0000019eu, 0x00000001u, 0x00000026u, 0x00000172u, 0x0000019au, 0x0007000cu, 0x00000006u, |
| 213 | 0x00000006u, 0x00000260u, 0x000002cbu, 0x00000165u, 0x000001a1u, 0x00000198u, 0x000700f5u, 0x00000006u, | 213 | 0x000001a1u, 0x00000001u, 0x00000026u, 0x00000179u, 0x0000019au, 0x000600a9u, 0x00000006u, 0x000002f4u, |
| 214 | 0x0000025fu, 0x0000017du, 0x00000165u, 0x0000019cu, 0x00000198u, 0x000700f5u, 0x00000006u, 0x0000025eu, | 214 | 0x0000017cu, 0x0000002fu, 0x000001a1u, 0x000600a9u, 0x00000006u, 0x000002f5u, 0x0000017cu, 0x0000002fu, |
| 215 | 0x000002cau, 0x00000165u, 0x000001a8u, 0x00000198u, 0x000500abu, 0x00000008u, 0x000001aau, 0x0000025eu, | 215 | 0x0000019eu, 0x000500c2u, 0x00000006u, 0x000001aau, 0x00000086u, 0x0000002fu, 0x000500abu, 0x00000008u, |
| 216 | 0x0000000eu, 0x000300f7u, 0x000001acu, 0x00000000u, 0x000400fau, 0x000001aau, 0x000001abu, 0x000001acu, | 216 | 0x000001acu, 0x000001aau, 0x0000000eu, 0x000500abu, 0x00000008u, 0x000001aeu, 0x0000019bu, 0x0000000eu, |
| 217 | 0x000200f8u, 0x000001abu, 0x00050084u, 0x00000006u, 0x000001afu, 0x0000025fu, 0x00000260u, 0x00050086u, | 217 | 0x000500a7u, 0x00000008u, 0x000001afu, 0x000001acu, 0x000001aeu, 0x000500abu, 0x00000008u, 0x000001b1u, |
| 218 | 0x00000006u, 0x000001b2u, 0x000001b0u, 0x0000025eu, 0x000500acu, 0x00000008u, 0x000001b3u, 0x000001afu, | 218 | 0x000002f5u, 0x0000000eu, 0x000500a7u, 0x00000008u, 0x000001b2u, 0x000001afu, 0x000001b1u, 0x000500abu, |
| 219 | 0x000001b2u, 0x000200f9u, 0x000001acu, 0x000200f8u, 0x000001acu, 0x000700f5u, 0x00000008u, 0x000001b4u, | 219 | 0x00000008u, 0x000001b4u, 0x000002f4u, 0x0000000eu, 0x000500a7u, 0x00000008u, 0x000001b5u, 0x000001b2u, |
| 220 | 0x000001aau, 0x00000199u, 0x000001b3u, 0x000001abu, 0x000600a9u, 0x00000006u, 0x000002ccu, 0x000001b4u, | 220 | 0x000001b4u, 0x000300f7u, 0x000001b7u, 0x00000000u, 0x000400fau, 0x000001b5u, 0x000001b6u, 0x000001b7u, |
| 221 | 0x0000000eu, 0x0000025eu, 0x000600a9u, 0x00000006u, 0x000002cdu, 0x000001b4u, 0x0000000eu, 0x00000260u, | 221 | 0x000200f8u, 0x000001b6u, 0x0007000cu, 0x00000006u, 0x000001bau, 0x00000001u, 0x00000026u, 0x0000019bu, |
| 222 | 0x000600a9u, 0x00000006u, 0x000002ceu, 0x000001b4u, 0x0000000eu, 0x0000025fu, 0x000500abu, 0x00000008u, | 222 | 0x000001aau, 0x00050086u, 0x00000006u, 0x000001beu, 0x000001aau, 0x000001bau, 0x0007000cu, 0x00000006u, |
| 223 | 0x000001b9u, 0x000002ceu, 0x0000016bu, 0x000500abu, 0x00000008u, 0x000001bcu, 0x000002cdu, 0x00000172u, | 223 | 0x000001bfu, 0x00000001u, 0x00000026u, 0x000002f5u, 0x000001beu, 0x00050086u, 0x00000006u, 0x000001c5u, |
| 224 | 0x000500a6u, 0x00000008u, 0x000001bdu, 0x000001b9u, 0x000001bcu, 0x000500abu, 0x00000008u, 0x000001c0u, | 224 | 0x000001beu, 0x000001bfu, 0x0007000cu, 0x00000006u, 0x000001c6u, 0x00000001u, 0x00000026u, 0x000002f4u, |
| 225 | 0x000002ccu, 0x00000179u, 0x000500a6u, 0x00000008u, 0x000001c1u, 0x000001bdu, 0x000001c0u, 0x000600a9u, | 225 | 0x000001c5u, 0x000200f9u, 0x000001b7u, 0x000200f8u, 0x000001b7u, 0x000700f5u, 0x00000006u, 0x00000284u, |
| 226 | 0x00000006u, 0x000001c2u, 0x000001c1u, 0x0000002fu, 0x0000000eu, 0x00050084u, 0x00000006u, 0x000001c5u, | 226 | 0x000002f5u, 0x0000017eu, 0x000001bfu, 0x000001b6u, 0x000700f5u, 0x00000006u, 0x00000283u, 0x0000019bu, |
| 227 | 0x000002ceu, 0x000002cdu, 0x00050084u, 0x00000006u, 0x000001c7u, 0x000001c5u, 0x000002ccu, 0x000600a9u, | 227 | 0x0000017eu, 0x000001bau, 0x000001b6u, 0x000700f5u, 0x00000006u, 0x00000282u, 0x000002f4u, 0x0000017eu, |
| 228 | 0x00000006u, 0x000001cdu, 0x00000186u, 0x000001cbu, 0x000001ccu, 0x00050084u, 0x00000006u, 0x000001ceu, | 228 | 0x000001c6u, 0x000001b6u, 0x000500abu, 0x00000008u, 0x000001c8u, 0x00000282u, 0x0000000eu, 0x000300f7u, |
| 229 | 0x000001c7u, 0x000001cdu, 0x00050041u, 0x00000007u, 0x000001d0u, 0x00000116u, 0x0000002cu, 0x0003003eu, | 229 | 0x000001cau, 0x00000000u, 0x000400fau, 0x000001c8u, 0x000001c9u, 0x000001cau, 0x000200f8u, 0x000001c9u, |
| 230 | 0x000001d0u, 0x000002ceu, 0x00050041u, 0x00000007u, 0x000001d2u, 0x00000116u, 0x00000091u, 0x0003003eu, | 230 | 0x00050084u, 0x00000006u, 0x000001cdu, 0x00000283u, 0x00000284u, 0x00050086u, 0x00000006u, 0x000001d0u, |
| 231 | 0x000001d2u, 0x000002cdu, 0x00050041u, 0x00000007u, 0x000001d4u, 0x00000116u, 0x000000bcu, 0x0003003eu, | 231 | 0x000001ceu, 0x00000282u, 0x000500acu, 0x00000008u, 0x000001d1u, 0x000001cdu, 0x000001d0u, 0x000200f9u, |
| 232 | 0x000001d4u, 0x000002ccu, 0x000200f9u, 0x0000011eu, 0x000200f8u, 0x0000011eu, 0x000700f5u, 0x00000006u, | 232 | 0x000001cau, 0x000200f8u, 0x000001cau, 0x000700f5u, 0x00000008u, 0x000001d2u, 0x000001c8u, 0x000001b7u, |
| 233 | 0x00000292u, 0x00000142u, 0x0000015du, 0x000001c2u, 0x000001acu, 0x000700f5u, 0x00000006u, 0x00000278u, | 233 | 0x000001d1u, 0x000001c9u, 0x000600a9u, 0x00000006u, 0x000002f6u, 0x000001d2u, 0x0000000eu, 0x00000282u, |
| 234 | 0x00000145u, 0x0000015du, 0x000001ceu, 0x000001acu, 0x000500abu, 0x00000008u, 0x000001d6u, 0x00000278u, | 234 | 0x000600a9u, 0x00000006u, 0x000002f7u, 0x000001d2u, 0x0000000eu, 0x00000284u, 0x000600a9u, 0x00000006u, |
| 235 | 0x0000000eu, 0x000300f7u, 0x000001d8u, 0x00000000u, 0x000400fau, 0x000001d6u, 0x000001d7u, 0x000001d8u, | 235 | 0x000002f8u, 0x000001d2u, 0x0000000eu, 0x00000283u, 0x000500abu, 0x00000008u, 0x000001d7u, 0x000002f8u, |
| 236 | 0x000200f8u, 0x000001d7u, 0x000300f7u, 0x00000244u, 0x00000000u, 0x000300fbu, 0x0000000eu, 0x0000021cu, | 236 | 0x0000016bu, 0x000500abu, 0x00000008u, 0x000001dau, 0x000002f7u, 0x00000172u, 0x000500a6u, 0x00000008u, |
| 237 | 0x000200f8u, 0x0000021cu, 0x000500aau, 0x00000008u, 0x0000021eu, 0x00000278u, 0x0000000eu, 0x000300f7u, | 237 | 0x000001dbu, 0x000001d7u, 0x000001dau, 0x000500abu, 0x00000008u, 0x000001deu, 0x000002f6u, 0x00000179u, |
| 238 | 0x00000220u, 0x00000000u, 0x000400fau, 0x0000021eu, 0x0000021fu, 0x00000220u, 0x000200f8u, 0x0000021fu, | 238 | 0x000500a6u, 0x00000008u, 0x000001dfu, 0x000001dbu, 0x000001deu, 0x000600a9u, 0x00000006u, 0x000001e0u, |
| 239 | 0x000200f9u, 0x00000244u, 0x000200f8u, 0x00000220u, 0x00050041u, 0x00000029u, 0x00000221u, 0x00000026u, | 239 | 0x000001dfu, 0x0000002fu, 0x0000000eu, 0x00050084u, 0x00000006u, 0x000001e3u, 0x000002f8u, 0x000002f7u, |
| 240 | 0x00000028u, 0x0004003du, 0x00000019u, 0x00000222u, 0x00000221u, 0x00060041u, 0x0000002du, 0x00000223u, | 240 | 0x00050084u, 0x00000006u, 0x000001e5u, 0x000001e3u, 0x000002f6u, 0x000600a9u, 0x00000006u, 0x000001ebu, |
| 241 | 0x00000222u, 0x0000002cu, 0x0000002cu, 0x000700eau, 0x00000006u, 0x00000224u, 0x00000223u, 0x0000002fu, | 241 | 0x0000017cu, 0x000001e9u, 0x000001eau, 0x00050084u, 0x00000006u, 0x000001ecu, 0x000001e5u, 0x000001ebu, |
| 242 | 0x0000000eu, 0x0000000eu, 0x000200f9u, 0x00000225u, 0x000200f8u, 0x00000225u, 0x000700f5u, 0x00000006u, | 242 | 0x00050041u, 0x00000007u, 0x000001eeu, 0x00000116u, 0x0000002cu, 0x0003003eu, 0x000001eeu, 0x000002f8u, |
| 243 | 0x0000027au, 0x00000224u, 0x00000220u, 0x00000239u, 0x00000240u, 0x000500b0u, 0x00000008u, 0x00000228u, | 243 | 0x00050041u, 0x00000007u, 0x000001f0u, 0x00000116u, 0x00000091u, 0x0003003eu, 0x000001f0u, 0x000002f7u, |
| 244 | 0x0000027au, 0x00000037u, 0x000400f6u, 0x00000241u, 0x00000240u, 0x00000000u, 0x000400fau, 0x00000228u, | 244 | 0x00050041u, 0x00000007u, 0x000001f2u, 0x00000116u, 0x000000bcu, 0x0003003eu, 0x000001f2u, 0x000002f6u, |
| 245 | 0x00000229u, 0x00000241u, 0x000200f8u, 0x00000229u, 0x00050082u, 0x00000006u, 0x0000022bu, 0x00000037u, | 245 | 0x000200f9u, 0x0000011eu, 0x000200f8u, 0x0000011eu, 0x000700f5u, 0x00000006u, 0x000002b8u, 0x00000142u, |
| 246 | 0x0000027au, 0x000500acu, 0x00000008u, 0x0000022eu, 0x00000278u, 0x0000022bu, 0x000300f7u, 0x00000230u, | 246 | 0x0000015du, 0x000001e0u, 0x000001cau, 0x000700f5u, 0x00000006u, 0x0000029cu, 0x00000145u, 0x0000015du, |
| 247 | 0x00000000u, 0x000400fau, 0x0000022eu, 0x0000022fu, 0x00000230u, 0x000200f8u, 0x0000022fu, 0x000200f9u, | 247 | 0x000001ecu, 0x000001cau, 0x000500abu, 0x00000008u, 0x000001f4u, 0x0000029cu, 0x0000000eu, 0x000300f7u, |
| 248 | 0x00000241u, 0x000200f8u, 0x00000230u, 0x00050080u, 0x00000006u, 0x00000233u, 0x0000027au, 0x00000278u, | 248 | 0x000001f6u, 0x00000000u, 0x000400fau, 0x000001f4u, 0x000001f5u, 0x000001f6u, 0x000200f8u, 0x000001f5u, |
| 249 | 0x000900e6u, 0x00000006u, 0x00000239u, 0x00000223u, 0x0000002fu, 0x0000000eu, 0x0000000eu, 0x00000233u, | 249 | 0x000300f7u, 0x00000262u, 0x00000000u, 0x000300fbu, 0x0000000eu, 0x0000023au, 0x000200f8u, 0x0000023au, |
| 250 | 0x0000027au, 0x000500aau, 0x00000008u, 0x0000023cu, 0x00000239u, 0x0000027au, 0x000300f7u, 0x0000023eu, | 250 | 0x000500aau, 0x00000008u, 0x0000023cu, 0x0000029cu, 0x0000000eu, 0x000300f7u, 0x0000023eu, 0x00000000u, |
| 251 | 0x00000000u, 0x000400fau, 0x0000023cu, 0x0000023du, 0x0000023eu, 0x000200f8u, 0x0000023du, 0x000200f9u, | 251 | 0x000400fau, 0x0000023cu, 0x0000023du, 0x0000023eu, 0x000200f8u, 0x0000023du, 0x000200f9u, 0x00000262u, |
| 252 | 0x00000241u, 0x000200f8u, 0x0000023eu, 0x000200f9u, 0x00000240u, 0x000200f8u, 0x00000240u, 0x000200f9u, | 252 | 0x000200f8u, 0x0000023eu, 0x00050041u, 0x00000029u, 0x0000023fu, 0x00000026u, 0x00000028u, 0x0004003du, |
| 253 | 0x00000225u, 0x000200f8u, 0x00000241u, 0x000900f5u, 0x00000008u, 0x0000027fu, 0x00000288u, 0x00000225u, | 253 | 0x00000019u, 0x00000240u, 0x0000023fu, 0x00060041u, 0x0000002du, 0x00000241u, 0x00000240u, 0x0000002cu, |
| 254 | 0x00000041u, 0x0000022fu, 0x00000012u, 0x0000023du, 0x000900f5u, 0x00000008u, 0x0000027cu, 0x00000041u, | 254 | 0x0000002cu, 0x000700eau, 0x00000006u, 0x00000242u, 0x00000241u, 0x0000002fu, 0x0000000eu, 0x0000000eu, |
| 255 | 0x00000225u, 0x00000012u, 0x0000022fu, 0x00000012u, 0x0000023du, 0x000300f7u, 0x00000243u, 0x00000000u, | 255 | 0x000200f9u, 0x00000243u, 0x000200f8u, 0x00000243u, 0x000700f5u, 0x00000006u, 0x0000029eu, 0x00000242u, |
| 256 | 0x000400fau, 0x0000027cu, 0x00000244u, 0x00000243u, 0x000200f8u, 0x00000243u, 0x000200f9u, 0x00000244u, | 256 | 0x0000023eu, 0x00000257u, 0x0000025eu, 0x000500b0u, 0x00000008u, 0x00000246u, 0x0000029eu, 0x00000037u, |
| 257 | 0x000200f8u, 0x00000244u, 0x000900f5u, 0x00000008u, 0x0000027eu, 0x00000012u, 0x0000021fu, 0x0000027fu, | 257 | 0x000400f6u, 0x0000025fu, 0x0000025eu, 0x00000000u, 0x000400fau, 0x00000246u, 0x00000247u, 0x0000025fu, |
| 258 | 0x00000241u, 0x00000041u, 0x00000243u, 0x000400a8u, 0x00000008u, 0x000001dcu, 0x0000027eu, 0x000200f9u, | 258 | 0x000200f8u, 0x00000247u, 0x00050082u, 0x00000006u, 0x00000249u, 0x00000037u, 0x0000029eu, 0x000500acu, |
| 259 | 0x000001d8u, 0x000200f8u, 0x000001d8u, 0x000700f5u, 0x00000008u, 0x000001ddu, 0x000001d6u, 0x0000011eu, | 259 | 0x00000008u, 0x0000024cu, 0x0000029cu, 0x00000249u, 0x000300f7u, 0x0000024eu, 0x00000000u, 0x000400fau, |
| 260 | 0x000001dcu, 0x00000244u, 0x000300f7u, 0x000001dfu, 0x00000000u, 0x000400fau, 0x000001ddu, 0x000001deu, | 260 | 0x0000024cu, 0x0000024du, 0x0000024eu, 0x000200f8u, 0x0000024du, 0x000200f9u, 0x0000025fu, 0x000200f8u, |
| 261 | 0x000001dfu, 0x000200f8u, 0x000001deu, 0x00050041u, 0x00000029u, 0x000001e0u, 0x00000026u, 0x000000a9u, | 261 | 0x0000024eu, 0x00050080u, 0x00000006u, 0x00000251u, 0x0000029eu, 0x0000029cu, 0x000900e6u, 0x00000006u, |
| 262 | 0x0004003du, 0x00000019u, 0x000001e1u, 0x000001e0u, 0x00060041u, 0x0000002du, 0x000001e2u, 0x000001e1u, | 262 | 0x00000257u, 0x00000241u, 0x0000002fu, 0x0000000eu, 0x0000000eu, 0x00000251u, 0x0000029eu, 0x000500aau, |
| 263 | 0x0000002cu, 0x000000bcu, 0x000700eau, 0x00000006u, 0x000001e3u, 0x000001e2u, 0x0000002fu, 0x0000000eu, | 263 | 0x00000008u, 0x0000025au, 0x00000257u, 0x0000029eu, 0x000300f7u, 0x0000025cu, 0x00000000u, 0x000400fau, |
| 264 | 0x0000002fu, 0x0003003eu, 0x00000116u, 0x00000117u, 0x000200f9u, 0x000001dfu, 0x000200f8u, 0x000001dfu, | 264 | 0x0000025au, 0x0000025bu, 0x0000025cu, 0x000200f8u, 0x0000025bu, 0x000200f9u, 0x0000025fu, 0x000200f8u, |
| 265 | 0x000600a9u, 0x00000006u, 0x000002cfu, 0x000001ddu, 0x0000002fu, 0x00000292u, 0x000500abu, 0x00000008u, | 265 | 0x0000025cu, 0x000200f9u, 0x0000025eu, 0x000200f8u, 0x0000025eu, 0x000200f9u, 0x00000243u, 0x000200f8u, |
| 266 | 0x000001e5u, 0x000002cfu, 0x0000000eu, 0x000300f7u, 0x000001e7u, 0x00000000u, 0x000400fau, 0x000001e5u, | 266 | 0x0000025fu, 0x000900f5u, 0x00000008u, 0x000002a3u, 0x000002acu, 0x00000243u, 0x00000041u, 0x0000024du, |
| 267 | 0x000001e6u, 0x000001e7u, 0x000200f8u, 0x000001e6u, 0x00050041u, 0x00000029u, 0x000001e8u, 0x00000026u, | 267 | 0x00000012u, 0x0000025bu, 0x000900f5u, 0x00000008u, 0x000002a0u, 0x00000041u, 0x00000243u, 0x00000012u, |
| 268 | 0x000000a9u, 0x0004003du, 0x00000019u, 0x000001e9u, 0x000001e8u, 0x00060041u, 0x0000002du, 0x000001eau, | 268 | 0x0000024du, 0x00000012u, 0x0000025bu, 0x000300f7u, 0x00000261u, 0x00000000u, 0x000400fau, 0x000002a0u, |
| 269 | 0x000001e9u, 0x0000002cu, 0x0000002cu, 0x000700eau, 0x00000006u, 0x000001ebu, 0x000001eau, 0x0000002fu, | 269 | 0x00000262u, 0x00000261u, 0x000200f8u, 0x00000261u, 0x000200f9u, 0x00000262u, 0x000200f8u, 0x00000262u, |
| 270 | 0x0000000eu, 0x0000002fu, 0x00050041u, 0x00000007u, 0x000001ecu, 0x00000116u, 0x0000002cu, 0x0004003du, | 270 | 0x000900f5u, 0x00000008u, 0x000002a2u, 0x00000012u, 0x0000023du, 0x000002a3u, 0x0000025fu, 0x00000041u, |
| 271 | 0x00000006u, 0x000001edu, 0x000001ecu, 0x000500aau, 0x00000008u, 0x000001eeu, 0x000001edu, 0x0000000eu, | 271 | 0x00000261u, 0x000400a8u, 0x00000008u, 0x000001fau, 0x000002a2u, 0x000200f9u, 0x000001f6u, 0x000200f8u, |
| 272 | 0x000300f7u, 0x000001f0u, 0x00000000u, 0x000400fau, 0x000001eeu, 0x000001efu, 0x000001f0u, 0x000200f8u, | 272 | 0x000001f6u, 0x000700f5u, 0x00000008u, 0x000001fbu, 0x000001f4u, 0x0000011eu, 0x000001fau, 0x00000262u, |
| 273 | 0x000001efu, 0x00060041u, 0x0000002du, 0x000001f3u, 0x000001e9u, 0x0000002cu, 0x0000009eu, 0x000700eau, | 273 | 0x000300f7u, 0x000001fdu, 0x00000000u, 0x000400fau, 0x000001fbu, 0x000001fcu, 0x000001fdu, 0x000200f8u, |
| 274 | 0x00000006u, 0x000001f4u, 0x000001f3u, 0x0000002fu, 0x0000000eu, 0x0000002fu, 0x000200f9u, 0x000001f0u, | 274 | 0x000001fcu, 0x00050041u, 0x00000029u, 0x000001feu, 0x00000026u, 0x000000a9u, 0x0004003du, 0x00000019u, |
| 275 | 0x000200f8u, 0x000001f0u, 0x000200f9u, 0x000001e7u, 0x000200f8u, 0x000001e7u, 0x000200f9u, 0x000001f6u, | 275 | 0x000001ffu, 0x000001feu, 0x00060041u, 0x0000002du, 0x00000200u, 0x000001ffu, 0x0000002cu, 0x000000bcu, |
| 276 | 0x000200f8u, 0x000001f6u, 0x000700f5u, 0x00000006u, 0x00000297u, 0x0000000eu, 0x000001e7u, 0x00000208u, | 276 | 0x000700eau, 0x00000006u, 0x00000201u, 0x00000200u, 0x0000002fu, 0x0000000eu, 0x0000002fu, 0x0003003eu, |
| 277 | 0x000001f7u, 0x000500b0u, 0x00000008u, 0x000001fdu, 0x00000297u, 0x00000246u, 0x000400f6u, 0x000001f8u, | 277 | 0x00000116u, 0x00000117u, 0x000200f9u, 0x000001fdu, 0x000200f8u, 0x000001fdu, 0x000600a9u, 0x00000006u, |
| 278 | 0x000001f7u, 0x00000000u, 0x000400fau, 0x000001fdu, 0x000001f7u, 0x000001f8u, 0x000200f8u, 0x000001f7u, | 278 | 0x000002f9u, 0x000001fbu, 0x0000002fu, 0x000002b8u, 0x000500abu, 0x00000008u, 0x00000203u, 0x000002f9u, |
| 279 | 0x00050041u, 0x000000bdu, 0x000001feu, 0x00000026u, 0x000000bcu, 0x0004003du, 0x00000017u, 0x000001ffu, | 279 | 0x0000000eu, 0x000300f7u, 0x00000205u, 0x00000000u, 0x000400fau, 0x00000203u, 0x00000204u, 0x00000205u, |
| 280 | 0x000001feu, 0x00050080u, 0x00000006u, 0x00000202u, 0x00000081u, 0x00000297u, 0x00050041u, 0x00000007u, | 280 | 0x000200f8u, 0x00000204u, 0x00050041u, 0x00000029u, 0x00000206u, 0x00000026u, 0x000000a9u, 0x0004003du, |
| 281 | 0x00000204u, 0x00000116u, 0x00000297u, 0x0004003du, 0x00000006u, 0x00000205u, 0x00000204u, 0x00060041u, | 281 | 0x00000019u, 0x00000207u, 0x00000206u, 0x00060041u, 0x0000002du, 0x00000208u, 0x00000207u, 0x0000002cu, |
| 282 | 0x0000002du, 0x00000206u, 0x000001ffu, 0x0000002cu, 0x00000202u, 0x0005003eu, 0x00000206u, 0x00000205u, | 282 | 0x0000002cu, 0x000700eau, 0x00000006u, 0x00000209u, 0x00000208u, 0x0000002fu, 0x0000000eu, 0x0000002fu, |
| 283 | 0x00000002u, 0x00000004u, 0x00050080u, 0x00000006u, 0x00000208u, 0x00000297u, 0x00000091u, 0x000200f9u, | 283 | 0x00050041u, 0x00000007u, 0x0000020au, 0x00000116u, 0x0000002cu, 0x0004003du, 0x00000006u, 0x0000020bu, |
| 284 | 0x000001f6u, 0x000200f8u, 0x000001f8u, 0x000200f9u, 0x0000020au, 0x000200f8u, 0x0000020au, 0x000100fdu, | 284 | 0x0000020au, 0x000500aau, 0x00000008u, 0x0000020cu, 0x0000020bu, 0x0000000eu, 0x000300f7u, 0x0000020eu, |
| 285 | 0x00010038u, | 285 | 0x00000000u, 0x000400fau, 0x0000020cu, 0x0000020du, 0x0000020eu, 0x000200f8u, 0x0000020du, 0x00060041u, |
| 286 | 0x0000002du, 0x00000211u, 0x00000207u, 0x0000002cu, 0x0000009eu, 0x000700eau, 0x00000006u, 0x00000212u, | ||
| 287 | 0x00000211u, 0x0000002fu, 0x0000000eu, 0x0000002fu, 0x000200f9u, 0x0000020eu, 0x000200f8u, 0x0000020eu, | ||
| 288 | 0x000200f9u, 0x00000205u, 0x000200f8u, 0x00000205u, 0x000200f9u, 0x00000214u, 0x000200f8u, 0x00000214u, | ||
| 289 | 0x000700f5u, 0x00000006u, 0x000002bdu, 0x0000000eu, 0x00000205u, 0x00000226u, 0x00000215u, 0x000500b0u, | ||
| 290 | 0x00000008u, 0x0000021bu, 0x000002bdu, 0x00000264u, 0x000400f6u, 0x00000216u, 0x00000215u, 0x00000000u, | ||
| 291 | 0x000400fau, 0x0000021bu, 0x00000215u, 0x00000216u, 0x000200f8u, 0x00000215u, 0x00050041u, 0x000000bdu, | ||
| 292 | 0x0000021cu, 0x00000026u, 0x000000bcu, 0x0004003du, 0x00000017u, 0x0000021du, 0x0000021cu, 0x00050080u, | ||
| 293 | 0x00000006u, 0x00000220u, 0x00000081u, 0x000002bdu, 0x00050041u, 0x00000007u, 0x00000222u, 0x00000116u, | ||
| 294 | 0x000002bdu, 0x0004003du, 0x00000006u, 0x00000223u, 0x00000222u, 0x00060041u, 0x0000002du, 0x00000224u, | ||
| 295 | 0x0000021du, 0x0000002cu, 0x00000220u, 0x0005003eu, 0x00000224u, 0x00000223u, 0x00000002u, 0x00000004u, | ||
| 296 | 0x00050080u, 0x00000006u, 0x00000226u, 0x000002bdu, 0x00000091u, 0x000200f9u, 0x00000214u, 0x000200f8u, | ||
| 297 | 0x00000216u, 0x000200f9u, 0x00000228u, 0x000200f8u, 0x00000228u, 0x000100fdu, 0x00010038u, | ||
| 286 | }; | 298 | }; |
| 287 | } // namespace leonida | 299 | } // namespace leonida |
diff --git a/runtime/src/large_module_gate.h b/runtime/src/large_module_gate.h new file mode 100644 index 000000000..f66420bc2 --- /dev/null +++ b/runtime/src/large_module_gate.h | |||
| @@ -0,0 +1,293 @@ | |||
| 1 | // How many large SPIR-V modules vk_pipeline_check and the runtime let into the driver at once, by a memory budget. | ||
| 2 | // | ||
| 3 | // Measured on RADV GFX1201 (Mesa 25.3.6) with the Mesa shader cache off: a 5.7 MB translated ray-tracing compute | ||
| 4 | // module peaks at 1.96 GB of process memory compiling alone (~330 bytes per SPIR-V byte), a 0.36 MB one at 94 MB. | ||
| 5 | // Compiling the large ones strictly one at a time left the other threads idle: 40 modules (27 over 4 MiB) on 6 | ||
| 6 | // threads took 308 s exclusively and 75 s in parallel, 7.0 GB and 8.7 GB peak. kBytesPerSpirvByte keeps a margin | ||
| 7 | // over the measurement. The NVIDIA 621.24 driver (RTX 3080) took 85 to 131 bytes per SPIR-V byte for synthetic compute | ||
| 8 | // modules of 128 KiB to 4 MiB (docs/d3d12_vulkan.md, "Large pipelines"). | ||
| 9 | // | ||
| 10 | // The process grew past one module's peak even one at a time because glibc keeps freed memory in per-thread arenas | ||
| 11 | // (6 threads: 6.2 GB; MALLOC_ARENA_MAX=1: 2.1 GB, same modules). release_free_memory() hands it back after each | ||
| 12 | // large module. | ||
| 13 | #pragma once | ||
| 14 | |||
| 15 | #include <algorithm> | ||
| 16 | #include <condition_variable> | ||
| 17 | #include <cstddef> | ||
| 18 | #include <cstdint> | ||
| 19 | #include <cstdio> | ||
| 20 | #include <functional> | ||
| 21 | #include <list> | ||
| 22 | #include <mutex> | ||
| 23 | #include <optional> | ||
| 24 | #include <string> | ||
| 25 | #include <utility> | ||
| 26 | |||
| 27 | #ifdef _WIN32 | ||
| 28 | #ifndef NOMINMAX | ||
| 29 | #define NOMINMAX | ||
| 30 | #endif | ||
| 31 | #include <windows.h> | ||
| 32 | #endif | ||
| 33 | #if defined(__GLIBC__) | ||
| 34 | #include <malloc.h> | ||
| 35 | #endif | ||
| 36 | |||
| 37 | namespace leonida { | ||
| 38 | |||
| 39 | inline constexpr uint64_t kBytesPerSpirvByte = 512; | ||
| 40 | |||
| 41 | inline uint64_t large_module_estimate(uint64_t spirv_bytes) { return spirv_bytes * kBytesPerSpirvByte; } | ||
| 42 | |||
| 43 | #if defined(__linux__) | ||
| 44 | // The first unsigned number in a file ("max" and unreadable files give no value). | ||
| 45 | inline bool read_u64_file(const std::string& path, uint64_t& value) { | ||
| 46 | std::FILE* f = std::fopen(path.c_str(), "r"); | ||
| 47 | if (!f) return false; | ||
| 48 | unsigned long long v = 0; | ||
| 49 | const bool ok = std::fscanf(f, "%llu", &v) == 1; | ||
| 50 | std::fclose(f); | ||
| 51 | value = v; | ||
| 52 | return ok; | ||
| 53 | } | ||
| 54 | |||
| 55 | // The room left under the cgroup v2 memory.max of this process and of every cgroup above it (a container or | ||
| 56 | // systemd-run -p MemoryMax=...), or UINT64_MAX when none sets a limit. cgroup_root is a parameter for the tests. | ||
| 57 | inline uint64_t cgroup_memory_room(const std::string& self_cgroup_file = "/proc/self/cgroup", | ||
| 58 | const std::string& cgroup_root = "/sys/fs/cgroup") { | ||
| 59 | std::FILE* f = std::fopen(self_cgroup_file.c_str(), "r"); | ||
| 60 | if (!f) return UINT64_MAX; | ||
| 61 | char line[4096]; | ||
| 62 | std::string rel; | ||
| 63 | while (std::fgets(line, sizeof(line), f)) { | ||
| 64 | std::string l(line); | ||
| 65 | if (l.rfind("0::", 0) == 0) { // the cgroup v2 line | ||
| 66 | rel = l.substr(3); | ||
| 67 | while (!rel.empty() && (rel.back() == '\n' || rel.back() == '\r')) rel.pop_back(); | ||
| 68 | break; | ||
| 69 | } | ||
| 70 | } | ||
| 71 | std::fclose(f); | ||
| 72 | uint64_t room = UINT64_MAX; | ||
| 73 | for (std::string dir = rel; !dir.empty();) { | ||
| 74 | // In a cgroup namespace, "/" can be a constrained cgroup mounted as the visible root. | ||
| 75 | const std::string base = dir == "/" ? cgroup_root : cgroup_root + dir; | ||
| 76 | uint64_t max = 0, current = 0; | ||
| 77 | if (read_u64_file(base + "/memory.max", max) && read_u64_file(base + "/memory.current", current)) | ||
| 78 | room = std::min(room, max > current ? max - current : 0); | ||
| 79 | const auto slash = dir.find_last_of('/'); | ||
| 80 | if (dir == "/" || slash == std::string::npos) break; | ||
| 81 | dir.resize(slash == 0 ? 1 : slash); | ||
| 82 | } | ||
| 83 | return room; | ||
| 84 | } | ||
| 85 | #endif | ||
| 86 | |||
| 87 | // Memory the OS could give this process now, or 0 when it can't tell (then the caller keeps the old exclusive gate). | ||
| 88 | inline uint64_t available_memory_bytes() { | ||
| 89 | #ifdef _WIN32 | ||
| 90 | MEMORYSTATUSEX status{}; | ||
| 91 | status.dwLength = sizeof(status); | ||
| 92 | return GlobalMemoryStatusEx(&status) ? uint64_t(status.ullAvailPhys) : 0; | ||
| 93 | #elif defined(__linux__) | ||
| 94 | std::FILE* f = std::fopen("/proc/meminfo", "r"); | ||
| 95 | if (!f) return 0; | ||
| 96 | char line[256]; | ||
| 97 | unsigned long long kb = 0; | ||
| 98 | bool found = false; | ||
| 99 | while (std::fgets(line, sizeof(line), f)) | ||
| 100 | if (std::sscanf(line, "MemAvailable: %llu kB", &kb) == 1) { found = true; break; } | ||
| 101 | std::fclose(f); | ||
| 102 | if (!found) return 0; | ||
| 103 | const uint64_t room = cgroup_memory_room(); | ||
| 104 | return std::max<uint64_t>(1, std::min(uint64_t(kb) * 1024, room)); // 0 would mean "unknown" | ||
| 105 | #else | ||
| 106 | return 0; | ||
| 107 | #endif | ||
| 108 | } | ||
| 109 | |||
| 110 | // What large compiles may use of the free RAM and of the room under the commit limit: three quarters of the smaller. (On | ||
| 111 | // Windows an allocation that the limit has no room for fails, whatever RAM is free.) | ||
| 112 | inline uint64_t large_compile_share(uint64_t free_ram, uint64_t commit_room) { | ||
| 113 | return std::min(free_ram, commit_room) / 4 * 3; | ||
| 114 | } | ||
| 115 | |||
| 116 | // The same of the memory that is free at this moment. 0 when it is unknown: then they compile one at a time. | ||
| 117 | inline uint64_t large_compile_budget_bytes() { | ||
| 118 | #ifdef _WIN32 | ||
| 119 | MEMORYSTATUSEX status{}; | ||
| 120 | status.dwLength = sizeof(status); | ||
| 121 | if (!GlobalMemoryStatusEx(&status)) return 0; | ||
| 122 | return large_compile_share(status.ullAvailPhys, status.ullAvailPageFile); | ||
| 123 | #else | ||
| 124 | return large_compile_share(available_memory_bytes(), UINT64_MAX); | ||
| 125 | #endif | ||
| 126 | } | ||
| 127 | |||
| 128 | // LEONIDA_BIG_COMPILE_BUDGET_MB: a fixed budget in MiB instead of the share of the free memory (0: one at a time). Unset | ||
| 129 | // or empty, and text that is not a number: none. `valid` is false for the latter. | ||
| 130 | struct LargeCompileBudget { | ||
| 131 | std::optional<uint64_t> fixed{}; | ||
| 132 | bool valid = true; | ||
| 133 | }; | ||
| 134 | |||
| 135 | inline LargeCompileBudget large_compile_budget(const char* text) { | ||
| 136 | if (!text || !*text) return {}; | ||
| 137 | uint64_t mib = 0; | ||
| 138 | for (const char* c = text; *c; ++c) { | ||
| 139 | if (*c < '0' || *c > '9') return {std::nullopt, false}; | ||
| 140 | mib = std::min<uint64_t>(mib * 10 + uint64_t(*c - '0'), UINT64_MAX >> 20); | ||
| 141 | } | ||
| 142 | return {mib << 20, true}; | ||
| 143 | } | ||
| 144 | |||
| 145 | // Return memory freed by the driver's compiler to the OS (glibc keeps it in the arena of the thread that freed it). | ||
| 146 | inline void release_free_memory() { | ||
| 147 | #if defined(__GLIBC__) | ||
| 148 | malloc_trim(0); | ||
| 149 | #endif | ||
| 150 | } | ||
| 151 | |||
| 152 | // Lets large modules in while their estimates fit the budget and fewer than max_inflight are in. One always gets in | ||
| 153 | // when none is, so a module bigger than the whole budget still compiles (alone among the large ones). | ||
| 154 | // | ||
| 155 | // The second constructor is the runtime's: the budget is read again whenever a place is given or returned, and the | ||
| 156 | // modules get in in the order they came, those a submission waits for (demand) before the others (speculative). While the | ||
| 157 | // first in line does not fit, the next behind it that does may pass, as long as all that have passed it would fit the | ||
| 158 | // budget together with it. So, with the budget as it is, it waits at most for those that were in when it became the first, | ||
| 159 | // however many come after it, and one larger than the budget is not passed. A speculative one gets in only while no demand | ||
| 160 | // waits and no submission has a Demand, and only within a quarter of the budget, so that a demand finds the rest free. An | ||
| 161 | // estimate counts in full until its module leaves, although the driver has allocated part of it by then and the budget is | ||
| 162 | // that much smaller: what is in has not taken all it is going to. | ||
| 163 | class LargeModuleGate { | ||
| 164 | public: | ||
| 165 | enum class Work { demand, speculative }; | ||
| 166 | |||
| 167 | LargeModuleGate(uint64_t budget, unsigned max_inflight) | ||
| 168 | : budget_(budget), max_inflight_(max_inflight ? max_inflight : 1) {} | ||
| 169 | explicit LargeModuleGate(std::function<uint64_t()> budget) | ||
| 170 | : budget_(0), max_inflight_(UINT32_MAX), read_budget_(std::move(budget)) {} | ||
| 171 | |||
| 172 | bool admits(uint64_t estimate) const { | ||
| 173 | std::lock_guard<std::mutex> g(mu_); | ||
| 174 | return admits_locked(estimate, budget()); | ||
| 175 | } | ||
| 176 | void enter(uint64_t estimate, Work work = Work::demand) { | ||
| 177 | std::unique_lock<std::mutex> l(mu_); | ||
| 178 | if (!read_budget_) { | ||
| 179 | cv_.wait(l, [&] { return admits_locked(estimate, limit_for(work)); }); | ||
| 180 | } else { | ||
| 181 | auto& queue = waiting_[work == Work::demand ? 0 : 1]; | ||
| 182 | const auto me = queue.insert(queue.end(), Waiter{estimate}); | ||
| 183 | cv_.wait(l, [&] { | ||
| 184 | return (work == Work::demand || (waiting_[0].empty() && !demanded_)) && next_locked(work) == &*me; | ||
| 185 | }); | ||
| 186 | if (me != queue.begin()) queue.front().passed += estimate; | ||
| 187 | queue.erase(me); | ||
| 188 | } | ||
| 189 | used_ += estimate; | ||
| 190 | ++inflight_; | ||
| 191 | if (!waiting_[0].empty() || !waiting_[1].empty()) cv_.notify_all(); // the next in the queue may fit as well | ||
| 192 | } | ||
| 193 | void leave(uint64_t estimate) { | ||
| 194 | { | ||
| 195 | std::lock_guard<std::mutex> g(mu_); | ||
| 196 | used_ -= estimate; | ||
| 197 | --inflight_; | ||
| 198 | } | ||
| 199 | cv_.notify_all(); | ||
| 200 | } | ||
| 201 | unsigned inflight() const { | ||
| 202 | std::lock_guard<std::mutex> g(mu_); | ||
| 203 | return inflight_; | ||
| 204 | } | ||
| 205 | size_t waiting(Work work) const { // in order: the threads in enter(), with a budget that is read | ||
| 206 | std::lock_guard<std::mutex> g(mu_); | ||
| 207 | return waiting_[work == Work::demand ? 0 : 1].size(); | ||
| 208 | } | ||
| 209 | uint64_t budget() const { return read_budget_ ? read_budget_() : budget_; } | ||
| 210 | unsigned max_inflight() const { return max_inflight_; } | ||
| 211 | |||
| 212 | // A submission that has large modules to build: until it ends, the places that its modules leave between one and the | ||
| 213 | // next are not taken by speculative ones. | ||
| 214 | class Demand { | ||
| 215 | public: | ||
| 216 | explicit Demand(LargeModuleGate& gate) : gate_(gate) { | ||
| 217 | std::lock_guard<std::mutex> g(gate_.mu_); | ||
| 218 | ++gate_.demanded_; | ||
| 219 | } | ||
| 220 | ~Demand() { | ||
| 221 | { | ||
| 222 | std::lock_guard<std::mutex> g(gate_.mu_); | ||
| 223 | --gate_.demanded_; | ||
| 224 | } | ||
| 225 | gate_.cv_.notify_all(); | ||
| 226 | } | ||
| 227 | Demand(const Demand&) = delete; | ||
| 228 | Demand& operator=(const Demand&) = delete; | ||
| 229 | |||
| 230 | private: | ||
| 231 | LargeModuleGate& gate_; | ||
| 232 | }; | ||
| 233 | |||
| 234 | // Holds a place from construction until destruction (or release()), then hands freed memory back. | ||
| 235 | class Ticket { | ||
| 236 | public: | ||
| 237 | Ticket() = default; | ||
| 238 | Ticket(LargeModuleGate& gate, uint64_t estimate, Work work = Work::demand) : gate_(&gate), estimate_(estimate) { | ||
| 239 | gate.enter(estimate, work); | ||
| 240 | } | ||
| 241 | Ticket(Ticket&& o) noexcept : gate_(o.gate_), estimate_(o.estimate_) { o.gate_ = nullptr; } | ||
| 242 | Ticket& operator=(Ticket&& o) noexcept { | ||
| 243 | if (this != &o) { release(); gate_ = o.gate_; estimate_ = o.estimate_; o.gate_ = nullptr; } | ||
| 244 | return *this; | ||
| 245 | } | ||
| 246 | Ticket(const Ticket&) = delete; | ||
| 247 | Ticket& operator=(const Ticket&) = delete; | ||
| 248 | ~Ticket() { release(); } | ||
| 249 | void release() { | ||
| 250 | if (!gate_) return; | ||
| 251 | gate_->leave(estimate_); | ||
| 252 | gate_ = nullptr; | ||
| 253 | release_free_memory(); | ||
| 254 | } | ||
| 255 | private: | ||
| 256 | LargeModuleGate* gate_ = nullptr; | ||
| 257 | uint64_t estimate_ = 0; | ||
| 258 | }; | ||
| 259 | |||
| 260 | private: | ||
| 261 | struct Waiter { | ||
| 262 | uint64_t estimate; | ||
| 263 | uint64_t passed = 0; // the estimates of those that have passed it while it was the first in line | ||
| 264 | }; | ||
| 265 | |||
| 266 | uint64_t limit_for(Work work) const { return work == Work::demand ? budget() : budget() / 4; } | ||
| 267 | bool admits_locked(uint64_t estimate, uint64_t limit) const { | ||
| 268 | return inflight_ == 0 || (inflight_ < max_inflight_ && used_ + estimate <= limit); | ||
| 269 | } | ||
| 270 | // The one in line that gets in now, if any: the first, or else the first that fits and may pass it. | ||
| 271 | const Waiter* next_locked(Work work) const { | ||
| 272 | const auto& queue = waiting_[work == Work::demand ? 0 : 1]; | ||
| 273 | const uint64_t limit = limit_for(work); | ||
| 274 | for (const Waiter& w : queue) { | ||
| 275 | const Waiter& first = queue.front(); | ||
| 276 | if (&w != &first && first.passed + w.estimate + first.estimate > limit) continue; | ||
| 277 | if (admits_locked(w.estimate, limit)) return &w; | ||
| 278 | } | ||
| 279 | return nullptr; | ||
| 280 | } | ||
| 281 | |||
| 282 | const uint64_t budget_; | ||
| 283 | const unsigned max_inflight_; | ||
| 284 | const std::function<uint64_t()> read_budget_; | ||
| 285 | mutable std::mutex mu_; | ||
| 286 | std::condition_variable cv_; | ||
| 287 | std::list<Waiter> waiting_[2]; // demand, speculative: one for each thread in enter(), in the order they came | ||
| 288 | uint64_t used_ = 0; | ||
| 289 | unsigned inflight_ = 0; | ||
| 290 | unsigned demanded_ = 0; // the Demands | ||
| 291 | }; | ||
| 292 | |||
| 293 | } // namespace leonida | ||
diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index 094aaa321..4d483ed59 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp | |||
| @@ -9,6 +9,13 @@ | |||
| 9 | // gta6rt --init <image> [--game-dir DIR] [--overlay DIR] | 9 | // gta6rt --init <image> [--game-dir DIR] [--overlay DIR] |
| 10 | // The same mapping, then each loaded DLL's TLS callbacks and DllMain(DLL_PROCESS_ATTACH) are run. | 10 | // The same mapping, then each loaded DLL's TLS callbacks and DllMain(DLL_PROCESS_ATTACH) are run. |
| 11 | // | 11 | // |
| 12 | // gta6rt --precompile-pipelines [--threads N] [--big-threads N] [--big-bytes N] [--all] [--smallest-first] | ||
| 13 | // [--limit N] [--min-bytes N] [--max-bytes N] [--filter PART]... [--list] | ||
| 14 | // No game: creates the Vulkan device as --run does and builds every compute pipeline of the shader library | ||
| 15 | // (LEONIDA_SHADERS) into the pipeline journal and the driver's cache, so a title's first dispatch of a large one | ||
| 16 | // does not stall it. Resumable: entries already journaled are skipped (--all: built anyway). See | ||
| 17 | // shims/d3d12_precompile.h. | ||
| 18 | // | ||
| 12 | // gta6rt --run <exe> [--game-dir DIR] [--overlay DIR] [--trace-d3d12] [--trace FILE] [-- game arguments...] | 19 | // gta6rt --run <exe> [--game-dir DIR] [--overlay DIR] [--trace-d3d12] [--trace FILE] [-- game arguments...] |
| 13 | // The same, then the EXE's own TLS callbacks and its entry point, on a game thread. The game's argv and | 20 | // The same, then the EXE's own TLS callbacks and its entry point, on a game thread. The game's argv and |
| 14 | // command line are <exe name> plus the arguments after "--"; exit/ExitProcess from the game end the run | 21 | // command line are <exe name> plus the arguments after "--"; exit/ExitProcess from the game end the run |
| @@ -149,6 +156,7 @@ void start_title_peek(std::uint8_t* base) { | |||
| 149 | #include "mods.h" | 156 | #include "mods.h" |
| 150 | #include "pe_loader.h" | 157 | #include "pe_loader.h" |
| 151 | #include "thread_stacks.h" | 158 | #include "thread_stacks.h" |
| 159 | #include "dev_overlay.h" | ||
| 152 | #include "thread_sampler.h" | 160 | #include "thread_sampler.h" |
| 153 | #include "title_page_watch.h" | 161 | #include "title_page_watch.h" |
| 154 | #include "title_geometry_watch.h" | 162 | #include "title_geometry_watch.h" |
| @@ -156,7 +164,9 @@ void start_title_peek(std::uint8_t* base) { | |||
| 156 | #include "../shims/d3d12_xs_device.h" | 164 | #include "../shims/d3d12_xs_device.h" |
| 157 | #include "../shims/file_system.h" | 165 | #include "../shims/file_system.h" |
| 158 | #ifdef LEONIDA_VULKAN_DEVICE | 166 | #ifdef LEONIDA_VULKAN_DEVICE |
| 167 | #include "vulkan_device_fault.h" | ||
| 159 | #include "../shims/d3d12_compile_exit.h" | 168 | #include "../shims/d3d12_compile_exit.h" |
| 169 | #include "../shims/d3d12_precompile.h" | ||
| 160 | #include "../shims/package_splash.h" | 170 | #include "../shims/package_splash.h" |
| 161 | #endif | 171 | #endif |
| 162 | #include "../shims/process_shim.h" | 172 | #include "../shims/process_shim.h" |
| @@ -224,10 +234,66 @@ int usage() { | |||
| 224 | "usage: gta6rt --dry-run <image> [--game-dir DIR] [--overlay DIR] [--mods DIR] [--archetype-lookup RVA[,ARG]] [--view-mode-getter RVA] [--trace FILE]\n" | 234 | "usage: gta6rt --dry-run <image> [--game-dir DIR] [--overlay DIR] [--mods DIR] [--archetype-lookup RVA[,ARG]] [--view-mode-getter RVA] [--trace FILE]\n" |
| 225 | " gta6rt --init <image> [--game-dir DIR] [--overlay DIR] [--mods DIR] [--archetype-lookup RVA[,ARG]] [--view-mode-getter RVA] [--trace-d3d12] [--trace FILE]\n" | 235 | " gta6rt --init <image> [--game-dir DIR] [--overlay DIR] [--mods DIR] [--archetype-lookup RVA[,ARG]] [--view-mode-getter RVA] [--trace-d3d12] [--trace FILE]\n" |
| 226 | " gta6rt --first-run-ui <exe> [--game-dir DIR] [--overlay DIR] [--trace FILE]\n" | 236 | " gta6rt --first-run-ui <exe> [--game-dir DIR] [--overlay DIR] [--trace FILE]\n" |
| 227 | " gta6rt --run <exe> [--game-dir DIR] [--overlay DIR] [--mods DIR] [--archetype-lookup RVA[,ARG]] [--view-mode-getter RVA] [--trace-d3d12] [--trace FILE] [-- game arguments...]\n"); | 237 | " gta6rt --run <exe> [--game-dir DIR] [--overlay DIR] [--mods DIR] [--archetype-lookup RVA[,ARG]] [--view-mode-getter RVA] [--trace-d3d12] [--trace FILE] [-- game arguments...]\n" |
| 238 | " gta6rt --precompile-pipelines [--threads N] [--big-threads N] [--big-bytes N] [--all] [--smallest-first] [--limit N] [--min-bytes N] [--max-bytes N] [--filter PART]... [--list] [--via-helper]\n" | ||
| 239 | " gta6rt --compile-server [--parent PID] [--threads N] [--idle-threads N] [--idle-exit SECONDS]\n"); | ||
| 228 | return 2; | 240 | return 2; |
| 229 | } | 241 | } |
| 230 | 242 | ||
| 243 | #ifdef LEONIDA_VULKAN_DEVICE | ||
| 244 | // gta6rt --precompile-pipelines ...: argv[1] is the mode. | ||
| 245 | int precompile_main(int argc, wchar_t** argv) { | ||
| 246 | rt::d3d12::PrecompileOptions options; | ||
| 247 | const auto number = [&](int& i, auto& out) { | ||
| 248 | if (i + 1 >= argc) return false; | ||
| 249 | wchar_t* end = nullptr; | ||
| 250 | const unsigned long long v = std::wcstoull(argv[++i], &end, 10); | ||
| 251 | if (!end || *end) return false; | ||
| 252 | out = static_cast<std::remove_reference_t<decltype(out)>>(v); | ||
| 253 | return true; | ||
| 254 | }; | ||
| 255 | for (int i = 2; i < argc; ++i) { | ||
| 256 | const std::wstring a = argv[i]; | ||
| 257 | bool ok = true; | ||
| 258 | if (a == L"--threads") ok = number(i, options.threads); | ||
| 259 | else if (a == L"--big-threads") ok = number(i, options.big_threads); | ||
| 260 | else if (a == L"--big-bytes") ok = number(i, options.big_bytes); | ||
| 261 | else if (a == L"--limit") ok = number(i, options.limit); | ||
| 262 | else if (a == L"--min-bytes") ok = number(i, options.min_bytes); | ||
| 263 | else if (a == L"--max-bytes") ok = number(i, options.max_bytes); | ||
| 264 | else if (a == L"--all") options.rebuild = true; | ||
| 265 | else if (a == L"--smallest-first") options.smallest_first = true; | ||
| 266 | else if (a == L"--list") options.dry_run = true; | ||
| 267 | else if (a == L"--via-helper") options.via_helper = true; | ||
| 268 | else if (a == L"--filter" && i + 1 < argc) { | ||
| 269 | const std::wstring part = argv[++i]; | ||
| 270 | options.filters.emplace_back(part.begin(), part.end()); // library names are ASCII | ||
| 271 | } else ok = false; | ||
| 272 | if (!ok) return usage(); | ||
| 273 | } | ||
| 274 | return rt::d3d12::precompile_compute_pipelines(options); | ||
| 275 | } | ||
| 276 | |||
| 277 | // gta6rt --compile-server [--parent PID] [--threads N] [--idle-threads N] [--idle-exit SECONDS] | ||
| 278 | // (shims/d3d12_compile_helper.h). | ||
| 279 | int compile_server_main(int argc, wchar_t** argv) { | ||
| 280 | rt::d3d12::CompileServerOptions options; | ||
| 281 | for (int i = 2; i < argc; ++i) { | ||
| 282 | const std::wstring a = argv[i]; | ||
| 283 | if (i + 1 >= argc) return usage(); | ||
| 284 | wchar_t* end = nullptr; | ||
| 285 | const unsigned long long v = std::wcstoull(argv[++i], &end, 10); | ||
| 286 | if (!end || *end) return usage(); | ||
| 287 | if (a == L"--parent") options.parent_pid = static_cast<unsigned long>(v); | ||
| 288 | else if (a == L"--threads") options.threads = static_cast<unsigned>(v); | ||
| 289 | else if (a == L"--idle-threads") options.idle_threads = static_cast<unsigned>(v); | ||
| 290 | else if (a == L"--idle-exit") options.idle_exit_s = static_cast<unsigned>(v); | ||
| 291 | else return usage(); | ||
| 292 | } | ||
| 293 | return rt::d3d12::compile_server(options); | ||
| 294 | } | ||
| 295 | #endif | ||
| 296 | |||
| 231 | } // namespace | 297 | } // namespace |
| 232 | 298 | ||
| 233 | #ifdef LEONIDA_VULKAN_DEVICE | 299 | #ifdef LEONIDA_VULKAN_DEVICE |
| @@ -292,6 +358,10 @@ static BOOL WINAPI show_package_window(HWND window, int command) { | |||
| 292 | #endif | 358 | #endif |
| 293 | 359 | ||
| 294 | int wmain(int argc, wchar_t** argv) { | 360 | int wmain(int argc, wchar_t** argv) { |
| 361 | #ifdef LEONIDA_VULKAN_DEVICE | ||
| 362 | if (argc > 1 && std::wstring(argv[1]) == L"--precompile-pipelines") return precompile_main(argc, argv); | ||
| 363 | if (argc > 1 && std::wstring(argv[1]) == L"--compile-server") return compile_server_main(argc, argv); | ||
| 364 | #endif | ||
| 295 | std::filesystem::path image, game_dir, overlay_dir, mods_dir; | 365 | std::filesystem::path image, game_dir, overlay_dir, mods_dir; |
| 296 | uint32_t archetype_lookup_rva = 0; // --archetype-lookup RVA[,ARG]: the game's archetype lookup by hash | 366 | uint32_t archetype_lookup_rva = 0; // --archetype-lookup RVA[,ARG]: the game's archetype lookup by hash |
| 297 | int archetype_lookup_arg = 0; | 367 | int archetype_lookup_arg = 0; |
| @@ -436,6 +506,8 @@ int wmain(int argc, wchar_t** argv) { | |||
| 436 | rt::d3d12_trace::set_enabled(trace_d3d12); | 506 | rt::d3d12_trace::set_enabled(trace_d3d12); |
| 437 | // Slot 133 imports the title's pages; xmem commits them on first touch, so they are committed first. | 507 | // Slot 133 imports the title's pages; xmem commits them on first touch, so they are committed first. |
| 438 | rt::d3d12_xs::set_placed_at_va_pages_hook(&rt::xmem::commit_physical_range); | 508 | rt::d3d12_xs::set_placed_at_va_pages_hook(&rt::xmem::commit_physical_range); |
| 509 | if (rt::xmem::slot31_runs() && rt::xmem::queue_page_mappings_enabled()) | ||
| 510 | rt::d3d12_xs::set_copy_page_mappings_hook(&rt::xmem::copy_page_mappings); | ||
| 439 | // So do the file shims' reads, whose kernel writes do not fault them in: on ERROR_NOACCESS (title_page_watch.h). | 511 | // So do the file shims' reads, whose kernel writes do not fault them in: on ERROR_NOACCESS (title_page_watch.h). |
| 440 | leonida::geometry_writes::aliases.store(&rt::xmem::geometry_aliases); | 512 | leonida::geometry_writes::aliases.store(&rt::xmem::geometry_aliases); |
| 441 | leonida::kernel_writes::set_committer(&rt::xmem::commit_physical_range); | 513 | leonida::kernel_writes::set_committer(&rt::xmem::commit_physical_range); |
| @@ -541,7 +613,9 @@ int wmain(int argc, wchar_t** argv) { | |||
| 541 | std::fprintf(stderr, "error: %s has no entry point\n", main_module.name.c_str()); | 613 | std::fprintf(stderr, "error: %s has no entry point\n", main_module.name.c_str()); |
| 542 | return 1; | 614 | return 1; |
| 543 | } | 615 | } |
| 544 | const std::wstring paths = L"console paths: GAME: -> " + game_dir.native() + L", writes -> " + overlay_dir.native(); | 616 | const std::filesystem::path scratch_dir = rt::fs::scratch_dir(); |
| 617 | const std::wstring paths = L"console paths: GAME: -> " + game_dir.native() + L", writes -> " + | ||
| 618 | overlay_dir.native() + L", T: -> " + scratch_dir.native(); | ||
| 545 | const HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); | 619 | const HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); |
| 546 | DWORD mode; | 620 | DWORD mode; |
| 547 | bool printed = false; | 621 | bool printed = false; |
| @@ -554,19 +628,25 @@ int wmain(int argc, wchar_t** argv) { | |||
| 554 | if (!printed) { | 628 | if (!printed) { |
| 555 | const auto game = game_dir.u8string(); | 629 | const auto game = game_dir.u8string(); |
| 556 | const auto overlay = overlay_dir.u8string(); | 630 | const auto overlay = overlay_dir.u8string(); |
| 557 | std::printf("console paths: GAME: -> %s, writes -> %s\n", | 631 | const auto scratch = scratch_dir.u8string(); |
| 558 | reinterpret_cast<const char*>(game.c_str()), reinterpret_cast<const char*>(overlay.c_str())); | 632 | std::printf("console paths: GAME: -> %s, writes -> %s, T: -> %s\n", |
| 633 | reinterpret_cast<const char*>(game.c_str()), reinterpret_cast<const char*>(overlay.c_str()), | ||
| 634 | reinterpret_cast<const char*>(scratch.c_str())); | ||
| 559 | } | 635 | } |
| 560 | std::printf("running %s\n", main_module.name.c_str()); | 636 | std::printf("running %s\n", main_module.name.c_str()); |
| 561 | std::fflush(stdout); | 637 | std::fflush(stdout); |
| 562 | keep_title_watchdog_kicked(main_module.base); | 638 | keep_title_watchdog_kicked(main_module.base); |
| 563 | start_title_peek(main_module.base); | 639 | start_title_peek(main_module.base); |
| 640 | leonida::dev_overlay::start(); // LEONIDA_DEV_OVERLAY=1 | ||
| 564 | leonida::thread_sampler::start(main_module.base, main_module.size); // LEONIDA_SAMPLE_MS (diagnostic) | 641 | leonida::thread_sampler::start(main_module.base, main_module.size); // LEONIDA_SAMPLE_MS (diagnostic) |
| 565 | #ifdef LEONIDA_VULKAN_DEVICE | 642 | #ifdef LEONIDA_VULKAN_DEVICE |
| 566 | SetConsoleCtrlHandler(&stop_compiles_on_console_exit, TRUE); | 643 | SetConsoleCtrlHandler(&stop_compiles_on_console_exit, TRUE); |
| 567 | previous_fatal_filter = SetUnhandledExceptionFilter(&save_caches_on_fatal_exception); | 644 | previous_fatal_filter = SetUnhandledExceptionFilter(&save_caches_on_fatal_exception); |
| 568 | #endif | 645 | #endif |
| 569 | int code; | 646 | int code; |
| 647 | #ifdef LEONIDA_VULKAN_DEVICE | ||
| 648 | leonida::thread_stack_hook.store(&rt::print_thread_stacks_now, std::memory_order_release); | ||
| 649 | #endif | ||
| 570 | { | 650 | { |
| 571 | auto stacks = rt::start_thread_stacks(); | 651 | auto stacks = rt::start_thread_stacks(); |
| 572 | code = rt::process::run_entry(main_module.base + main_module.entry_rva); | 652 | code = rt::process::run_entry(main_module.base + main_module.entry_rva); |
diff --git a/runtime/src/memory_figures.h b/runtime/src/memory_figures.h new file mode 100644 index 000000000..8bf611553 --- /dev/null +++ b/runtime/src/memory_figures.h | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | #pragma once | ||
| 2 | // The memory figures that the title HUD (shims/title_hud.h, LEONIDA_TITLE_HUD) and the dev overlay (dev_overlay.h, | ||
| 3 | // LEONIDA_DEV_OVERLAY) both show, and the text for each. Both views use this header, so they show the same figures | ||
| 4 | // and the same "n/a" where there is no figure, never a false 0: | ||
| 5 | // GPU memory: in use and the budget over the device-local heaps, and in use in the other heaps, from the device's | ||
| 6 | // VK_EXT_memory_budget (vulkan_memory_budget.h reads it). The device publishes a reader here (publish_vram_reader) | ||
| 7 | // because the overlay runs outside the device, and latest_vram() calls it at most once per refresh_ms. | ||
| 8 | // Private memory: the process's commit charge. Wine fills only PagefileUsage, which on Windows 8 and later is the | ||
| 9 | // same figure as PrivateUsage. | ||
| 10 | // No Vulkan here, and Win32 only under _WIN32, so the overlay's test builds on every host. | ||
| 11 | #ifdef _WIN32 | ||
| 12 | #ifndef NOMINMAX | ||
| 13 | #define NOMINMAX | ||
| 14 | #endif | ||
| 15 | #include <windows.h> | ||
| 16 | #include <psapi.h> | ||
| 17 | #ifdef _MSC_VER | ||
| 18 | #pragma comment(lib, "psapi.lib") | ||
| 19 | #endif | ||
| 20 | #endif | ||
| 21 | |||
| 22 | #include <algorithm> | ||
| 23 | #include <chrono> | ||
| 24 | #include <cstdint> | ||
| 25 | #include <cstdio> | ||
| 26 | #include <mutex> | ||
| 27 | #include <string> | ||
| 28 | |||
| 29 | namespace leonida { | ||
| 30 | |||
| 31 | struct VramBudget { | ||
| 32 | // False when there is nothing to show: no VK_EXT_memory_budget on the device, no device, or a device that | ||
| 33 | // reports no budget for any DEVICE_LOCAL heap. The views show "n/a" then, not a 0. | ||
| 34 | bool available = false; | ||
| 35 | std::uint64_t local_usage = 0; // heapUsage summed over the DEVICE_LOCAL heaps | ||
| 36 | std::uint64_t local_budget = 0; // heapBudget summed over the DEVICE_LOCAL heaps | ||
| 37 | std::uint64_t shared_usage = 0; // heapUsage summed over the other heaps: system memory the GPU uses | ||
| 38 | }; | ||
| 39 | |||
| 40 | namespace memory_figures { | ||
| 41 | |||
| 42 | inline double gb(std::uint64_t bytes) { return double(bytes) / double(1ull << 30); } | ||
| 43 | |||
| 44 | // "VRAM 3.5/16.0 GB +0.5 shared", or "VRAM n/a". | ||
| 45 | inline std::string vram_text(const VramBudget& vram) { | ||
| 46 | if (!vram.available) return "VRAM n/a"; | ||
| 47 | char text[96]; | ||
| 48 | std::snprintf(text, sizeof text, "VRAM %.1f/%.1f GB +%.1f shared", gb(vram.local_usage), gb(vram.local_budget), | ||
| 49 | gb(vram.shared_usage)); | ||
| 50 | return text; | ||
| 51 | } | ||
| 52 | |||
| 53 | struct ProcessMemory { | ||
| 54 | bool read = false; // GetProcessMemoryInfo answered | ||
| 55 | std::uint64_t private_usage = 0, pagefile_usage = 0, working_set = 0; | ||
| 56 | }; | ||
| 57 | |||
| 58 | // The commit charge. PrivateUsage and PagefileUsage are the same figure on Windows 8 and later. Wine's | ||
| 59 | // GetProcessMemoryInfo writes only the PROCESS_MEMORY_COUNTERS part, so PrivateUsage reads 0 there. | ||
| 60 | inline std::uint64_t private_bytes(const ProcessMemory& memory) { | ||
| 61 | return (std::max)(memory.private_usage, memory.pagefile_usage); // parenthesised: windows.h may define max | ||
| 62 | } | ||
| 63 | |||
| 64 | // "RAM 2.5 GB (ws 1.0)". "RAM n/a (ws 1.0)" when the private bytes read 0, "RAM n/a" when nothing could be read. | ||
| 65 | inline std::string ram_text(const ProcessMemory& memory) { | ||
| 66 | char text[96]; | ||
| 67 | if (!memory.read) | ||
| 68 | std::snprintf(text, sizeof text, "RAM n/a"); | ||
| 69 | else if (const std::uint64_t bytes = private_bytes(memory); !bytes) | ||
| 70 | std::snprintf(text, sizeof text, "RAM n/a (ws %.1f)", gb(memory.working_set)); | ||
| 71 | else | ||
| 72 | std::snprintf(text, sizeof text, "RAM %.1f GB (ws %.1f)", gb(bytes), gb(memory.working_set)); | ||
| 73 | return text; | ||
| 74 | } | ||
| 75 | |||
| 76 | #ifdef _WIN32 | ||
| 77 | // This process's figures now. | ||
| 78 | inline ProcessMemory process_memory() { | ||
| 79 | PROCESS_MEMORY_COUNTERS_EX counters{}; | ||
| 80 | counters.cb = sizeof counters; | ||
| 81 | ProcessMemory out; | ||
| 82 | if (!GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast<PROCESS_MEMORY_COUNTERS*>(&counters), | ||
| 83 | sizeof counters)) | ||
| 84 | return out; | ||
| 85 | out.read = true; | ||
| 86 | out.private_usage = counters.PrivateUsage; | ||
| 87 | out.pagefile_usage = counters.PagefileUsage; | ||
| 88 | out.working_set = counters.WorkingSetSize; | ||
| 89 | return out; | ||
| 90 | } | ||
| 91 | #endif | ||
| 92 | |||
| 93 | // The device's figure, published for views outside the device. A device with VK_EXT_memory_budget publishes a reader | ||
| 94 | // when it is created and withdraws it first thing when it goes. The views call latest_vram(), which calls the reader at | ||
| 95 | // most once per refresh_ms and returns the last figure in between. The lock is held during a read, so withdrawing | ||
| 96 | // waits for a read that is in progress, and a reader is never called after its device is gone. | ||
| 97 | using VramReader = VramBudget (*)(const void* context); | ||
| 98 | inline constexpr std::chrono::milliseconds refresh_ms{500}; | ||
| 99 | |||
| 100 | class VramPublisher { | ||
| 101 | public: | ||
| 102 | void publish(VramReader reader, const void* context) { | ||
| 103 | std::lock_guard lock(mutex_); | ||
| 104 | reader_ = reader; | ||
| 105 | context_ = context; | ||
| 106 | last_ = {}; | ||
| 107 | read_ = false; | ||
| 108 | } | ||
| 109 | // Only the device that published the current reader withdraws it. Another device may have published since. | ||
| 110 | void withdraw(const void* context) { | ||
| 111 | std::lock_guard lock(mutex_); | ||
| 112 | if (context_ != context) return; | ||
| 113 | reader_ = nullptr; | ||
| 114 | context_ = nullptr; | ||
| 115 | last_ = {}; | ||
| 116 | read_ = false; | ||
| 117 | } | ||
| 118 | VramBudget latest(std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now()) { | ||
| 119 | std::lock_guard lock(mutex_); | ||
| 120 | if (!reader_) return {}; | ||
| 121 | if (!read_ || now - at_ >= refresh_ms) { | ||
| 122 | last_ = reader_(context_); | ||
| 123 | at_ = now; | ||
| 124 | read_ = true; | ||
| 125 | } | ||
| 126 | return last_; | ||
| 127 | } | ||
| 128 | |||
| 129 | private: | ||
| 130 | std::mutex mutex_; | ||
| 131 | VramReader reader_ = nullptr; | ||
| 132 | const void* context_ = nullptr; | ||
| 133 | VramBudget last_; | ||
| 134 | std::chrono::steady_clock::time_point at_{}; | ||
| 135 | bool read_ = false; | ||
| 136 | }; | ||
| 137 | |||
| 138 | inline VramPublisher& vram_publisher() { | ||
| 139 | static VramPublisher instance; | ||
| 140 | return instance; | ||
| 141 | } | ||
| 142 | inline void publish_vram_reader(VramReader reader, const void* context) { vram_publisher().publish(reader, context); } | ||
| 143 | inline void withdraw_vram_reader(const void* context) { vram_publisher().withdraw(context); } | ||
| 144 | inline VramBudget latest_vram() { return vram_publisher().latest(); } | ||
| 145 | |||
| 146 | } // namespace memory_figures | ||
| 147 | } // namespace leonida | ||
diff --git a/runtime/src/pe_loader.cpp b/runtime/src/pe_loader.cpp index 3558cffb5..fc73f37f5 100644 --- a/runtime/src/pe_loader.cpp +++ b/runtime/src/pe_loader.cpp | |||
| @@ -1721,10 +1721,7 @@ Module& Loader::map_image(const std::filesystem::path& path, const std::string& | |||
| 1721 | if (!m->base) | 1721 | if (!m->base) |
| 1722 | m->base = static_cast<uint8_t*>(VirtualAlloc(reinterpret_cast<void*>(oh.ImageBase), oh.SizeOfImage, | 1722 | m->base = static_cast<uint8_t*>(VirtualAlloc(reinterpret_cast<void*>(oh.ImageBase), oh.SizeOfImage, |
| 1723 | MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)); | 1723 | MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)); |
| 1724 | if (!m->base) { | 1724 | if (!m->base) { // whether the image may move is decided at the relocation step below |
| 1725 | const auto relocs = directory(nt, IMAGE_DIRECTORY_ENTRY_BASERELOC); | ||
| 1726 | if (!relocs.Size) | ||
| 1727 | throw std::runtime_error(m->name + ": preferred base is taken and the image has no relocations"); | ||
| 1728 | m->base = static_cast<uint8_t*>(VirtualAlloc(nullptr, oh.SizeOfImage, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)); | 1725 | m->base = static_cast<uint8_t*>(VirtualAlloc(nullptr, oh.SizeOfImage, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE)); |
| 1729 | if (!m->base) throw std::runtime_error(m->name + ": VirtualAlloc failed"); | 1726 | if (!m->base) throw std::runtime_error(m->name + ": VirtualAlloc failed"); |
| 1730 | } | 1727 | } |
| @@ -1749,10 +1746,19 @@ Module& Loader::map_image(const std::filesystem::path& path, const std::string& | |||
| 1749 | } | 1746 | } |
| 1750 | 1747 | ||
| 1751 | int64_t delta = reinterpret_cast<int64_t>(m->base) - static_cast<int64_t>(oh.ImageBase); | 1748 | int64_t delta = reinterpret_cast<int64_t>(m->base) - static_cast<int64_t>(oh.ImageBase); |
| 1752 | if (delta) { | 1749 | // A moved image with a relocation table is fixed up, whatever IMAGE_FILE_RELOCS_STRIPPED says. Without a table, |
| 1753 | m->relocated = true; | 1750 | // the flag refuses the move; with the flag clear the image is moved and nothing is fixed up, so it is trusted to |
| 1754 | const auto dir = directory(nt, IMAGE_DIRECTORY_ENTRY_BASERELOC); | 1751 | // hold no absolute addresses. The Windows 11 loader does all three (runtime/README.md); that move is logged so |
| 1755 | if (!dir.Size) throw std::runtime_error(m->name + ": the image has no relocations and isn't at its base"); | 1752 | // it shows in traces. base_reservation::needed still keeps the main image's range free when it has no |
| 1753 | // relocation directory, so a main image is moved this way only where the range could not be had. | ||
| 1754 | const auto dir = directory(nt, IMAGE_DIRECTORY_ENTRY_BASERELOC); | ||
| 1755 | if (delta) m->relocated = true; | ||
| 1756 | if (delta && !dir.Size && (nt->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED)) | ||
| 1757 | throw std::runtime_error(m->name + ": preferred base is taken and the image's relocations are stripped"); | ||
| 1758 | if (delta && !dir.Size) | ||
| 1759 | std::fprintf(stderr, "[rt] loader: %s: preferred base %#llx is taken, moved to %p with no relocations\n", | ||
| 1760 | m->name.c_str(), static_cast<unsigned long long>(oh.ImageBase), static_cast<void*>(m->base)); | ||
| 1761 | if (delta && dir.Size) { | ||
| 1756 | require_range(m->name, dir.VirtualAddress, dir.Size, m->size, "the relocation table"); | 1762 | require_range(m->name, dir.VirtualAddress, dir.Size, m->size, "the relocation table"); |
| 1757 | auto* block = at<IMAGE_BASE_RELOCATION>(m->base, dir.VirtualAddress); | 1763 | auto* block = at<IMAGE_BASE_RELOCATION>(m->base, dir.VirtualAddress); |
| 1758 | auto* end = reinterpret_cast<uint8_t*>(block) + dir.Size; | 1764 | auto* end = reinterpret_cast<uint8_t*>(block) + dir.Size; |
| @@ -2123,7 +2129,10 @@ void Loader::bind_imports(Module& m) { | |||
| 2123 | const uint64_t headers_end = nt->OptionalHeader.SizeOfHeaders; | 2129 | const uint64_t headers_end = nt->OptionalHeader.SizeOfHeaders; |
| 2124 | 2130 | ||
| 2125 | // Thunk tables have no length field: they end at a zero entry, so each step is checked against the image. | 2131 | // Thunk tables have no length field: they end at a zero entry, so each step is checked against the image. |
| 2126 | auto bind_thunks = [&](const std::string& dll, uint64_t lookup_rva, uint64_t iat_rva) { | 2132 | // `delayed`: a delay import that binds to an unimplemented thunk is traced. Windows' delay-load helper would raise |
| 2133 | // 0xC06D007E (module) or 0xC06D007F (procedure) at its first call, which a title can catch for a fallback; the | ||
| 2134 | // thunk returns 0 instead, so the trace names each such import before any image code runs. | ||
| 2135 | auto bind_thunks = [&](const std::string& dll, uint64_t lookup_rva, uint64_t iat_rva, bool delayed) { | ||
| 2127 | for (;; lookup_rva += sizeof(IMAGE_THUNK_DATA64), iat_rva += sizeof(IMAGE_THUNK_DATA64)) { | 2136 | for (;; lookup_rva += sizeof(IMAGE_THUNK_DATA64), iat_rva += sizeof(IMAGE_THUNK_DATA64)) { |
| 2128 | require_range(m.name, lookup_rva, sizeof(IMAGE_THUNK_DATA64), m.size, "an import lookup table"); | 2137 | require_range(m.name, lookup_rva, sizeof(IMAGE_THUNK_DATA64), m.size, "an import lookup table"); |
| 2129 | require_range(m.name, iat_rva, sizeof(IMAGE_THUNK_DATA64), m.size, "an import address table"); | 2138 | require_range(m.name, iat_rva, sizeof(IMAGE_THUNK_DATA64), m.size, "an import address table"); |
| @@ -2141,6 +2150,10 @@ void Loader::bind_imports(Module& m) { | |||
| 2141 | throw std::runtime_error(m.name + ": an import address table lands in the headers"); | 2150 | throw std::runtime_error(m.name + ": an import address table lands in the headers"); |
| 2142 | at<IMAGE_THUNK_DATA64>(m.base, static_cast<uint32_t>(iat_rva))->u1.Function = | 2151 | at<IMAGE_THUNK_DATA64>(m.base, static_cast<uint32_t>(iat_rva))->u1.Function = |
| 2143 | reinterpret_cast<uint64_t>(resolve(m, dll, name, ord, by_ord)); | 2152 | reinterpret_cast<uint64_t>(resolve(m, dll, name, ord, by_ord)); |
| 2153 | if (delayed && startup_trace::enabled() && m.imports.back().binding == Binding::Unimplemented) | ||
| 2154 | startup_trace::event("delay_import_unimplemented", | ||
| 2155 | "\"module\":" + startup_trace::quote(m.name) + ",\"import\":" + | ||
| 2156 | startup_trace::quote(dll + "!" + m.imports.back().name)); | ||
| 2144 | } | 2157 | } |
| 2145 | }; | 2158 | }; |
| 2146 | 2159 | ||
| @@ -2153,7 +2166,7 @@ void Loader::bind_imports(Module& m) { | |||
| 2153 | if (!d->Name) break; | 2166 | if (!d->Name) break; |
| 2154 | std::string dll = read_string(m.name, m.base, m.size, d->Name, "an imported DLL name"); | 2167 | std::string dll = read_string(m.name, m.base, m.size, d->Name, "an imported DLL name"); |
| 2155 | uint32_t lookup = d->OriginalFirstThunk ? d->OriginalFirstThunk : d->FirstThunk; | 2168 | uint32_t lookup = d->OriginalFirstThunk ? d->OriginalFirstThunk : d->FirstThunk; |
| 2156 | bind_thunks(dll, lookup, d->FirstThunk); | 2169 | bind_thunks(dll, lookup, d->FirstThunk, false); |
| 2157 | } | 2170 | } |
| 2158 | } | 2171 | } |
| 2159 | // Delay imports are bound eagerly: simpler, and the full import surface shows up in --dry-run. | 2172 | // Delay imports are bound eagerly: simpler, and the full import surface shows up in --dry-run. |
| @@ -2176,7 +2189,7 @@ void Loader::bind_imports(Module& m) { | |||
| 2176 | // thunk addresses as name RVAs. | 2189 | // thunk addresses as name RVAs. |
| 2177 | if (!d->ImportNameTableRVA) | 2190 | if (!d->ImportNameTableRVA) |
| 2178 | throw std::runtime_error(m.name + ": a delay-import descriptor has no name table"); | 2191 | throw std::runtime_error(m.name + ": a delay-import descriptor has no name table"); |
| 2179 | bind_thunks(dll, d->ImportNameTableRVA, d->ImportAddressTableRVA); | 2192 | bind_thunks(dll, d->ImportNameTableRVA, d->ImportAddressTableRVA, true); |
| 2180 | } | 2193 | } |
| 2181 | } | 2194 | } |
| 2182 | } | 2195 | } |
diff --git a/runtime/src/pipeline_cache_journal.h b/runtime/src/pipeline_cache_journal.h new file mode 100644 index 000000000..6a72d07f0 --- /dev/null +++ b/runtime/src/pipeline_cache_journal.h | |||
| @@ -0,0 +1,356 @@ | |||
| 1 | // One Vulkan pipeline cache file per compiled compute pipeline: the "pipeline journal". | ||
| 2 | // | ||
| 3 | // The session cache (pipeline_cache_store.h) is one blob written at device teardown or at an idle checkpoint. A boot | ||
| 4 | // that ends by a crash, a device loss or `timeout` never tears the device down, and while the compute warm-up thread | ||
| 5 | // has builds queued the idle checkpoint never runs, so the hundreds of large compute pipelines a boot compiles were | ||
| 6 | // compiled again on every boot. The journal keeps each one in its own small cache file the moment it is built: | ||
| 7 | // | ||
| 8 | // <cache dir>/pipeline_cache.d/cs-<16 hex digits>.bin | ||
| 9 | // | ||
| 10 | // The name is a hash of what the pipeline is made of (the SPIR-V words, the stage's subgroup request and the layout). | ||
| 11 | // Each file is a complete VkPipelineCache blob holding one pipeline. A build reads the file, if any, into a | ||
| 12 | // VkPipelineCache of its own and creates the pipeline against it: the driver finds the pipeline there (a hit, a few | ||
| 13 | // milliseconds where the compile took seconds) or compiles it and the file is written again. Files are published | ||
| 14 | // whole (write_pipeline_cache_file: a closed staging file renamed over the target), so a process killed mid-write | ||
| 15 | // leaves the previous file or none, and a boot that dies keeps everything it built before. | ||
| 16 | // | ||
| 17 | // The hash only picks the file. Whether the pipeline in it may be used is the driver's decision: it checks the blob | ||
| 18 | // header (vendor, device, pipeline-cache UUID; checked here first too, so a driver update starts over) and its own key. | ||
| 19 | // | ||
| 20 | // Upkeep (tidy, at the first pipeline of a device): staging files a killed writer left behind are removed once they are | ||
| 21 | // ten minutes old, and past LEONIDA_PIPELINE_JOURNAL_BYTES the least recently used files go until three quarters of | ||
| 22 | // it is left. A file's modification time is its last use: written, or touched when a build found its pipeline there. | ||
| 23 | // | ||
| 24 | // Pure stdlib apart from pipeline_cache_file.h's Windows rename retry; tested by pipeline_cache_journal_test. | ||
| 25 | #pragma once | ||
| 26 | |||
| 27 | #include <algorithm> | ||
| 28 | #include <chrono> | ||
| 29 | #include <cstddef> | ||
| 30 | #include <cstdint> | ||
| 31 | #include <cstdio> | ||
| 32 | #include <filesystem> | ||
| 33 | #include <fstream> | ||
| 34 | #include <string> | ||
| 35 | #include <string_view> | ||
| 36 | #include <system_error> | ||
| 37 | #include <type_traits> | ||
| 38 | #include <vector> | ||
| 39 | |||
| 40 | #include "cached_pso.h" | ||
| 41 | #include "pipeline_cache_store.h" // before pipeline_cache_file.h, whose <windows.h> may define max | ||
| 42 | #include "pipeline_cache_file.h" | ||
| 43 | |||
| 44 | namespace leonida::pipeline_journal { | ||
| 45 | |||
| 46 | // Bumped when what goes into a key changes, so files named under the old scheme are no longer looked up. | ||
| 47 | inline constexpr std::uint32_t key_version = 1; | ||
| 48 | |||
| 49 | // A file larger than this is not read (a corrupt or foreign file; one pipeline's cache is a few MiB at most). | ||
| 50 | inline constexpr std::size_t entry_read_limit = std::size_t{256} << 20; | ||
| 51 | |||
| 52 | // 64-bit FNV-1a. Not cryptographic: it names a file, and a collision costs one compile, not a wrong pipeline. | ||
| 53 | class Hasher { | ||
| 54 | public: | ||
| 55 | Hasher() { value(key_version); } | ||
| 56 | |||
| 57 | void bytes(const void* data, std::size_t size) { | ||
| 58 | const auto* p = static_cast<const std::uint8_t*>(data); | ||
| 59 | std::uint64_t h = hash_; | ||
| 60 | for (std::size_t i = 0; i < size; ++i) { | ||
| 61 | h ^= p[i]; | ||
| 62 | h *= 0x100000001b3ull; | ||
| 63 | } | ||
| 64 | hash_ = h; | ||
| 65 | } | ||
| 66 | |||
| 67 | template<class T> void value(const T& v) { | ||
| 68 | static_assert(std::is_trivially_copyable_v<T>); | ||
| 69 | bytes(&v, sizeof(v)); | ||
| 70 | } | ||
| 71 | |||
| 72 | void text(const char* s) { | ||
| 73 | const std::string_view view(s ? s : ""); | ||
| 74 | value(std::uint64_t(view.size())); | ||
| 75 | bytes(view.data(), view.size()); | ||
| 76 | } | ||
| 77 | |||
| 78 | std::uint64_t digest() const { return hash_; } | ||
| 79 | |||
| 80 | private: | ||
| 81 | std::uint64_t hash_ = 0xcbf29ce484222325ull; | ||
| 82 | }; | ||
| 83 | |||
| 84 | // <dir>/<kind>-<key as 16 lowercase hex digits>.bin | ||
| 85 | inline std::filesystem::path entry_path(const std::filesystem::path& dir, const char* kind, std::uint64_t key) { | ||
| 86 | char name[64]; | ||
| 87 | std::snprintf(name, sizeof(name), "%s-%016llx.bin", kind, static_cast<unsigned long long>(key)); | ||
| 88 | return dir / name; | ||
| 89 | } | ||
| 90 | |||
| 91 | // Resolve the two roots once, not on the compile path. With no seed keep the original single-root behavior. | ||
| 92 | // An explicit bad/overlapping pair disables the journal rather than accidentally publishing into the seed. | ||
| 93 | // This is a configuration check, not a substitute for a read-only mount/ACL and stable parent directories. | ||
| 94 | struct Roots { | ||
| 95 | std::filesystem::path writable; | ||
| 96 | std::filesystem::path seed; | ||
| 97 | }; | ||
| 98 | |||
| 99 | inline Roots resolve_roots(const std::filesystem::path& local, const std::filesystem::path& seed) { | ||
| 100 | namespace fs = std::filesystem; | ||
| 101 | if (seed.empty() || local.empty()) return {local, {}}; | ||
| 102 | std::error_code ec; | ||
| 103 | if (!seed.is_absolute() || !fs::is_directory(seed, ec) || ec) return {}; | ||
| 104 | const auto source = fs::canonical(seed, ec); | ||
| 105 | if (ec) return {}; | ||
| 106 | const auto abs_local = fs::absolute(local, ec); | ||
| 107 | if (ec) return {}; | ||
| 108 | const auto dest = fs::weakly_canonical(abs_local, ec); // The writable leaf need not exist yet. | ||
| 109 | if (ec) return {}; | ||
| 110 | const bool dest_exists = fs::exists(dest, ec); | ||
| 111 | if (ec || (dest_exists && !fs::is_directory(dest, ec))) return {}; | ||
| 112 | // Use directory identity, not string prefixes: NTFS aliases and case differences still identify one directory. | ||
| 113 | auto overlaps = [&](const fs::path& existing, fs::path path) { | ||
| 114 | for (;;) { | ||
| 115 | if (fs::exists(path, ec) && fs::equivalent(existing, path, ec)) return true; | ||
| 116 | if (ec) return true; | ||
| 117 | const auto parent = path.parent_path(); | ||
| 118 | if (parent == path || parent.empty()) return false; | ||
| 119 | path = parent; | ||
| 120 | } | ||
| 121 | }; | ||
| 122 | if (overlaps(source, dest) || (dest_exists && overlaps(dest, source))) return {}; | ||
| 123 | return {dest, source}; | ||
| 124 | } | ||
| 125 | |||
| 126 | // The selected compatible bytes plus metadata for the *writable* leaf as the build found it. | ||
| 127 | struct EntryFile { | ||
| 128 | std::vector<char> data; // compatible local bytes, else compatible seed bytes; empty when neither is usable | ||
| 129 | bool from_seed = false; // an external hit must not refresh either the immutable seed or a stale local file | ||
| 130 | std::uint64_t bytes = 0; // its size on disk, whatever its contents (0: none): what a rewrite replaces | ||
| 131 | std::filesystem::file_time_type used{}; // its modification time: its last use | ||
| 132 | }; | ||
| 133 | |||
| 134 | inline EntryFile read_entry_file(const std::filesystem::path& path, const cached_pso::Identity& identity, | ||
| 135 | std::size_t limit = entry_read_limit) { | ||
| 136 | EntryFile entry; | ||
| 137 | std::error_code ec; | ||
| 138 | const auto size = std::filesystem::file_size(path, ec); | ||
| 139 | if (ec) return entry; | ||
| 140 | entry.bytes = size; | ||
| 141 | entry.used = std::filesystem::last_write_time(path, ec); | ||
| 142 | if (ec || size < pipeline_cache_store::header_bytes || size > limit) return entry; | ||
| 143 | std::ifstream file(path, std::ios::binary); | ||
| 144 | if (!file) return entry; | ||
| 145 | entry.data.resize(static_cast<std::size_t>(size)); | ||
| 146 | if (!file.read(entry.data.data(), static_cast<std::streamsize>(entry.data.size())) || | ||
| 147 | !pipeline_cache_store::header_matches(entry.data.data(), entry.data.size(), identity)) | ||
| 148 | entry.data.clear(); | ||
| 149 | return entry; | ||
| 150 | } | ||
| 151 | |||
| 152 | // The file's bytes, or empty when it is missing, unreadable, over `limit`, or its header does not name `identity`. | ||
| 153 | inline std::vector<char> read_entry(const std::filesystem::path& path, const cached_pso::Identity& identity, | ||
| 154 | std::size_t limit = entry_read_limit) { | ||
| 155 | return read_entry_file(path, identity, limit).data; | ||
| 156 | } | ||
| 157 | |||
| 158 | // Whether the file is there with a header naming this device and driver: only the header is read (gta6rt | ||
| 159 | // --precompile-pipelines asks this of thousands of files of a few MiB). | ||
| 160 | inline bool entry_usable(const std::filesystem::path& path, const cached_pso::Identity& identity, | ||
| 161 | std::size_t limit = entry_read_limit) { | ||
| 162 | // A helper-ready file must also fit the consumer's bounded read. Check metadata, not the full payload. | ||
| 163 | std::error_code ec; | ||
| 164 | const auto size = std::filesystem::file_size(path, ec); | ||
| 165 | if (ec || size < pipeline_cache_store::header_bytes || size > limit) return false; | ||
| 166 | std::ifstream file(path, std::ios::binary); | ||
| 167 | char header[pipeline_cache_store::header_bytes]; | ||
| 168 | return file && file.read(header, sizeof(header)) && | ||
| 169 | pipeline_cache_store::header_matches(header, sizeof(header), identity); | ||
| 170 | } | ||
| 171 | |||
| 172 | enum class ReadRole { runtime, materialize_local }; | ||
| 173 | |||
| 174 | // A write always replaces the local file, not the seed. Keep its size and timestamp even if its | ||
| 175 | // data is unusable. A seed miss adds no writable bytes; the seed directory is never scanned. | ||
| 176 | inline EntryFile read_with_seed(const std::filesystem::path& local_entry, const std::filesystem::path& seed, | ||
| 177 | const cached_pso::Identity& identity, ReadRole role, std::size_t limit = entry_read_limit) { | ||
| 178 | auto local = read_entry_file(local_entry, identity, limit); | ||
| 179 | // Build hosts promise a file in the writable journal. External data must not satisfy such a request. | ||
| 180 | if (role == ReadRole::runtime && local.data.empty() && !seed.empty()) { | ||
| 181 | local.data = read_entry_file(seed / local_entry.filename(), identity, limit).data; | ||
| 182 | local.from_seed = !local.data.empty(); | ||
| 183 | } | ||
| 184 | return local; | ||
| 185 | } | ||
| 186 | |||
| 187 | // A create this long, with no feedback to say, was a compile. | ||
| 188 | inline constexpr std::uint64_t unreported_compile_ms = 1000; | ||
| 189 | // NVIDIA 630.20 answers FAIL_ON_PIPELINE_COMPILE_REQUIRED with a compiled pipeline (seconds) instead of | ||
| 190 | // VK_PIPELINE_COMPILE_REQUIRED. A pipeline from its own disk cache comes back fast and without the application-cache | ||
| 191 | // hit bit too, and is no sign of that. | ||
| 192 | inline constexpr std::uint64_t probe_compile_ms = 250; | ||
| 193 | |||
| 194 | // Whether a build writes its journal file. `seeded`: its cache was made from the file; `hit`: the creation feedback | ||
| 195 | // (1 found in that cache, 0 not, -1 not reported); `driver_ms`: the vkCreateComputePipelines call alone. | ||
| 196 | inline bool should_write(bool seeded, int hit, std::uint64_t driver_ms) { | ||
| 197 | if (!seeded) return true; // the pipeline is in no file yet | ||
| 198 | if (hit >= 0) return hit == 0; | ||
| 199 | return driver_ms >= unreported_compile_ms; | ||
| 200 | } | ||
| 201 | |||
| 202 | // Whether a pipeline the shared cache gave for FAIL_ON_PIPELINE_COMPILE_REQUIRED was compiled after all. | ||
| 203 | inline bool probe_compiled(int hit, std::uint64_t driver_ms) { return hit == 0 && driver_ms >= probe_compile_ms; } | ||
| 204 | |||
| 205 | // The journal's size after a file of `old_bytes` (0: none) is replaced by one of `new_bytes`. | ||
| 206 | inline std::uint64_t replace_bytes(std::uint64_t total, std::uint64_t old_bytes, std::uint64_t new_bytes) { | ||
| 207 | return total - (std::min)(total, old_bytes) + new_bytes; | ||
| 208 | } | ||
| 209 | |||
| 210 | // A file's last use is refreshed when it is more than this old, not at every hit. | ||
| 211 | inline constexpr std::chrono::hours touch_after{1}; | ||
| 212 | |||
| 213 | inline void touch(const std::filesystem::path& path, std::filesystem::file_time_type now) { | ||
| 214 | std::error_code ec; | ||
| 215 | std::filesystem::last_write_time(path, now, ec); | ||
| 216 | } | ||
| 217 | |||
| 218 | // Called only after a journal cache hit. Only the local entry that supplied the hit is eligible for LRU. | ||
| 219 | inline void touch_local_hit(const std::filesystem::path& local_entry, const EntryFile& file, | ||
| 220 | std::filesystem::file_time_type now) { | ||
| 221 | if (!file.from_seed && file.bytes && now - file.used >= touch_after) | ||
| 222 | touch(local_entry, now); | ||
| 223 | } | ||
| 224 | |||
| 225 | namespace detail { | ||
| 226 | inline bool digits(std::string_view s) { | ||
| 227 | return !s.empty() && s.find_first_not_of("0123456789") == std::string_view::npos; | ||
| 228 | } | ||
| 229 | inline bool hex(std::string_view s) { | ||
| 230 | return !s.empty() && s.find_first_not_of("0123456789abcdef") == std::string_view::npos; | ||
| 231 | } | ||
| 232 | } // namespace detail | ||
| 233 | |||
| 234 | // <kind>-<16 hex digits>.bin, as entry_path names them. | ||
| 235 | inline bool entry_name(std::string_view name) { | ||
| 236 | constexpr std::string_view ext = ".bin"; | ||
| 237 | const auto dash = name.find('-'); | ||
| 238 | if (dash == std::string_view::npos || dash == 0 || name.size() != dash + 1 + 16 + ext.size() || | ||
| 239 | name.substr(name.size() - ext.size()) != ext) | ||
| 240 | return false; | ||
| 241 | return detail::hex(name.substr(dash + 1, 16)); | ||
| 242 | } | ||
| 243 | |||
| 244 | // What write_pipeline_cache_file stages an entry in: <entry>.tmp.<digits>.<digits>. | ||
| 245 | inline bool staging_name(std::string_view name) { | ||
| 246 | constexpr std::string_view mark = ".tmp."; | ||
| 247 | const auto at = name.rfind(mark); | ||
| 248 | if (at == std::string_view::npos || !entry_name(name.substr(0, at))) return false; | ||
| 249 | const auto suffix = name.substr(at + mark.size()); | ||
| 250 | const auto dot = suffix.find('.'); | ||
| 251 | return dot != std::string_view::npos && detail::digits(suffix.substr(0, dot)) && | ||
| 252 | detail::digits(suffix.substr(dot + 1)); | ||
| 253 | } | ||
| 254 | |||
| 255 | struct EntryInfo { | ||
| 256 | std::filesystem::path path; | ||
| 257 | std::uint64_t bytes = 0; | ||
| 258 | std::filesystem::file_time_type used{}; | ||
| 259 | }; | ||
| 260 | |||
| 261 | // Which entries go, least recently used first, when they hold more than `budget`: as many as leave at most `target`. | ||
| 262 | inline std::vector<std::size_t> plan_eviction(const std::vector<EntryInfo>& entries, std::uint64_t budget, | ||
| 263 | std::uint64_t target) { | ||
| 264 | std::uint64_t total = 0; | ||
| 265 | for (const EntryInfo& entry : entries) total += entry.bytes; | ||
| 266 | std::vector<std::size_t> out; | ||
| 267 | if (total <= budget) return out; | ||
| 268 | std::vector<std::size_t> order(entries.size()); | ||
| 269 | for (std::size_t i = 0; i < order.size(); ++i) order[i] = i; | ||
| 270 | std::sort(order.begin(), order.end(), [&](std::size_t a, std::size_t b) { | ||
| 271 | if (entries[a].used != entries[b].used) return entries[a].used < entries[b].used; | ||
| 272 | return entries[a].path < entries[b].path; | ||
| 273 | }); | ||
| 274 | for (const std::size_t i : order) { | ||
| 275 | if (total <= target) break; | ||
| 276 | out.push_back(i); | ||
| 277 | total -= entries[i].bytes; | ||
| 278 | } | ||
| 279 | return out; | ||
| 280 | } | ||
| 281 | |||
| 282 | struct TidyResult { | ||
| 283 | std::uint64_t bytes = 0; // what the entries left take | ||
| 284 | std::size_t entries = 0; // how many are left | ||
| 285 | std::size_t evicted = 0; // entries removed for the budget | ||
| 286 | std::size_t swept = 0; // staging files removed | ||
| 287 | }; | ||
| 288 | |||
| 289 | // Removes staging files older than `staging_age` (a writer still holding one keeps it: Windows refuses to delete an | ||
| 290 | // open file not shared for deletion), then, past `budget`, the least recently used entries until three quarters of | ||
| 291 | // it is left. Other files in `dir` are left alone and not counted. | ||
| 292 | inline TidyResult tidy(const std::filesystem::path& dir, std::uint64_t budget, | ||
| 293 | std::chrono::seconds staging_age = std::chrono::minutes(10), | ||
| 294 | std::filesystem::file_time_type now = std::filesystem::file_time_type::clock::now()) { | ||
| 295 | TidyResult result; | ||
| 296 | std::vector<EntryInfo> entries; | ||
| 297 | std::error_code ec; | ||
| 298 | for (std::filesystem::directory_iterator it(dir, ec), end; !ec && it != end; it.increment(ec)) { | ||
| 299 | std::error_code stat; | ||
| 300 | if (!it->is_regular_file(stat) || stat) continue; | ||
| 301 | const std::string name = it->path().filename().string(); | ||
| 302 | const auto used = it->last_write_time(stat); | ||
| 303 | if (stat) continue; | ||
| 304 | if (staging_name(name)) { | ||
| 305 | std::error_code removed; | ||
| 306 | if (now - used >= staging_age && std::filesystem::remove(it->path(), removed) && !removed) ++result.swept; | ||
| 307 | continue; | ||
| 308 | } | ||
| 309 | if (!entry_name(name)) continue; | ||
| 310 | const auto size = it->file_size(stat); | ||
| 311 | if (!stat) entries.push_back({it->path(), size, used}); | ||
| 312 | } | ||
| 313 | std::vector<bool> gone(entries.size()); | ||
| 314 | for (const std::size_t i : plan_eviction(entries, budget, budget / 4 * 3)) { | ||
| 315 | std::error_code removed; | ||
| 316 | if (std::filesystem::remove(entries[i].path, removed) && !removed) { | ||
| 317 | gone[i] = true; | ||
| 318 | ++result.evicted; | ||
| 319 | } | ||
| 320 | } | ||
| 321 | for (std::size_t i = 0; i < entries.size(); ++i) { | ||
| 322 | if (gone[i]) continue; | ||
| 323 | result.bytes += entries[i].bytes; | ||
| 324 | ++result.entries; | ||
| 325 | } | ||
| 326 | return result; | ||
| 327 | } | ||
| 328 | |||
| 329 | // What the journal's files take on disk now: the sizes of the regular files in `dir` (0 when it does not exist). | ||
| 330 | inline std::uint64_t directory_bytes(const std::filesystem::path& dir) { | ||
| 331 | std::uint64_t total = 0; | ||
| 332 | std::error_code ec; | ||
| 333 | for (std::filesystem::directory_iterator it(dir, ec), end; !ec && it != end; it.increment(ec)) { | ||
| 334 | std::error_code stat; | ||
| 335 | if (it->is_regular_file(stat) && !stat) { | ||
| 336 | const auto size = it->file_size(stat); | ||
| 337 | if (!stat) total += size; | ||
| 338 | } | ||
| 339 | } | ||
| 340 | return total; | ||
| 341 | } | ||
| 342 | |||
| 343 | // LEONIDA_PIPELINE_JOURNAL_BYTES: how much the journal may hold. A compute pipeline's file is 2-5 MiB on NVIDIA: the | ||
| 344 | // ~1700 a boot builds take ~4 GiB, the whole library's ~5400 (gta6rt --precompile-pipelines) about 15. A boot writes | ||
| 345 | // nothing past it; the next one's tidy makes room. | ||
| 346 | inline constexpr std::uint64_t default_budget = std::uint64_t{32} << 30; | ||
| 347 | |||
| 348 | // Publishes `data` as the file at `path`, creating its directory. The previous file stays until the rename. | ||
| 349 | inline std::error_code write_entry(const std::filesystem::path& path, const void* data, std::size_t size) { | ||
| 350 | std::error_code ec; | ||
| 351 | std::filesystem::create_directories(path.parent_path(), ec); | ||
| 352 | if (ec) return ec; | ||
| 353 | return write_pipeline_cache_file(path, static_cast<const char*>(data), size); | ||
| 354 | } | ||
| 355 | |||
| 356 | } // namespace leonida::pipeline_journal | ||
diff --git a/runtime/src/pipeline_wait.h b/runtime/src/pipeline_wait.h new file mode 100644 index 000000000..2d74d8581 --- /dev/null +++ b/runtime/src/pipeline_wait.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #pragma once | ||
| 2 | // When the title last submitted, for the compute warm-ups (runtime/shims/d3d12_vulkan_device.cpp, | ||
| 3 | // LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES, opt-in): while the title submits, a warm-up of a big module is left to the | ||
| 4 | // pipeline's first use, since a create holds the compile gate for its whole length and every submission waits behind it. | ||
| 5 | // No windows.h here: vulkan_backend.h includes this, and translation units without NOMINMAX include that. | ||
| 6 | #include <atomic> | ||
| 7 | #include <chrono> | ||
| 8 | #include <cstdint> | ||
| 9 | |||
| 10 | namespace leonida::pipeline_wait { | ||
| 11 | |||
| 12 | // Steady-clock nanoseconds (the clock of submit_phases::now_ns). | ||
| 13 | inline std::int64_t now_ns() { | ||
| 14 | return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()) | ||
| 15 | .count(); | ||
| 16 | } | ||
| 17 | |||
| 18 | // The last submission (VulkanQueue::execute). | ||
| 19 | inline std::atomic<std::int64_t>& last_submission() { | ||
| 20 | static std::atomic<std::int64_t> value{0}; | ||
| 21 | return value; | ||
| 22 | } | ||
| 23 | inline void note_submission() { last_submission().store(now_ns(), std::memory_order_relaxed); } | ||
| 24 | inline bool title_submitting(std::int64_t within_ns = 1000000000) { | ||
| 25 | const std::int64_t last = last_submission().load(std::memory_order_relaxed); | ||
| 26 | return last && now_ns() - last < within_ns; | ||
| 27 | } | ||
| 28 | |||
| 29 | // Big warm-ups left to their first use while the title submits. | ||
| 30 | inline std::atomic<std::uint64_t>& warmups_left() { | ||
| 31 | static std::atomic<std::uint64_t> value{0}; | ||
| 32 | return value; | ||
| 33 | } | ||
| 34 | |||
| 35 | } // namespace leonida::pipeline_wait | ||
diff --git a/runtime/src/queue_holds.h b/runtime/src/queue_holds.h index 2839d4210..40cc33117 100644 --- a/runtime/src/queue_holds.h +++ b/runtime/src/queue_holds.h | |||
| @@ -93,6 +93,13 @@ public: | |||
| 93 | return it == fences_.end() || it->second < value; | 93 | return it == fences_.end() || it->second < value; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | // The highest Signal submitted for the fence (or set by the CPU); 0 for an unknown semaphore. | ||
| 97 | std::uint64_t submitted_value(Semaphore semaphore) const { | ||
| 98 | std::lock_guard lock(mutex_); | ||
| 99 | const auto it = fences_.find(semaphore); | ||
| 100 | return it == fences_.end() ? 0 : it->second; | ||
| 101 | } | ||
| 102 | |||
| 96 | // true when no submitted Signal reaches `value` yet. Unknown semaphores are satisfied. | 103 | // true when no submitted Signal reaches `value` yet. Unknown semaphores are satisfied. |
| 97 | bool pending(Semaphore semaphore, std::uint64_t value) const { | 104 | bool pending(Semaphore semaphore, std::uint64_t value) const { |
| 98 | std::lock_guard lock(mutex_); | 105 | std::lock_guard lock(mutex_); |
diff --git a/runtime/src/root_signature.cpp b/runtime/src/root_signature.cpp index 10dd1e02c..41d3f6c5a 100644 --- a/runtime/src/root_signature.cpp +++ b/runtime/src/root_signature.cpp | |||
| @@ -17,10 +17,8 @@ PackResult pack(const RootSignature& sig) { | |||
| 17 | out.error = "unknown root parameter type"; | 17 | out.error = "unknown root parameter type"; |
| 18 | return out; | 18 | return out; |
| 19 | } | 19 | } |
| 20 | if (p.type == ParamType::Constants && p.num_values == 0) { | 20 | // A constant parameter of 0 values is valid (the host serializer warns, CreateRootSignature answers S_OK): |
| 21 | out.error = "root constant parameter needs at least 1 dword"; | 21 | // it takes no dwords, so it gets no provenance entry and the parameters after it pack as if it were absent. |
| 22 | return out; | ||
| 23 | } | ||
| 24 | const uint32_t dwords = p.type == ParamType::Table ? 2 | 22 | const uint32_t dwords = p.type == ParamType::Table ? 2 |
| 25 | : p.type == ParamType::Descriptor ? 2 | 23 | : p.type == ParamType::Descriptor ? 2 |
| 26 | : p.num_values; | 24 | : p.num_values; |
| @@ -71,15 +69,12 @@ StagePackResult pack_stage(const RootSignature& sig, Stage stage) { | |||
| 71 | out.error = "unknown root parameter type"; | 69 | out.error = "unknown root parameter type"; |
| 72 | return out; | 70 | return out; |
| 73 | } | 71 | } |
| 74 | if (p.type == ParamType::Constants && p.num_values == 0) { | ||
| 75 | out.error = "root constant parameter needs at least 1 dword"; | ||
| 76 | return out; | ||
| 77 | } | ||
| 78 | cost += param_cost(p.type, p.num_values); | 72 | cost += param_cost(p.type, p.num_values); |
| 79 | if (cost > kMaxD3d12Cost) { | 73 | if (cost > kMaxD3d12Cost) { |
| 80 | out.error = "root signature exceeds the 64-dword D3D12 cost limit"; | 74 | out.error = "root signature exceeds the 64-dword D3D12 cost limit"; |
| 81 | return out; | 75 | return out; |
| 82 | } | 76 | } |
| 77 | // 0 for a constant parameter of 0 values, which then shares its first SGPR with the next parameter. | ||
| 83 | const uint64_t dwords = stage_dwords(p.type, p.num_values); | 78 | const uint64_t dwords = stage_dwords(p.type, p.num_values); |
| 84 | if (!spilling && next + dwords <= kMaxUserSgprs) { | 79 | if (!spilling && next + dwords <= kMaxUserSgprs) { |
| 85 | first.push_back(static_cast<uint32_t>(next)); | 80 | first.push_back(static_cast<uint32_t>(next)); |
diff --git a/runtime/src/root_signature.h b/runtime/src/root_signature.h index e7976fc73..559f4c54d 100644 --- a/runtime/src/root_signature.h +++ b/runtime/src/root_signature.h | |||
| @@ -114,7 +114,8 @@ constexpr uint32_t kMaxD3d12Cost = 64; | |||
| 114 | // Packs root parameters in order. Static samplers consume no dwords. | 114 | // Packs root parameters in order. Static samplers consume no dwords. |
| 115 | // Fails (ok == false) when the signature needs more than 32 user SGPRs | 115 | // Fails (ok == false) when the signature needs more than 32 user SGPRs |
| 116 | // (spill layout unknown: refuse, do not guess) or exceeds the 64-dword | 116 | // (spill layout unknown: refuse, do not guess) or exceeds the 64-dword |
| 117 | // D3D12 cost limit, or holds more than 64 root parameters. | 117 | // D3D12 cost limit, or holds more than 64 root parameters. A constant |
| 118 | // parameter of 0 values takes no dwords, as on the host. | ||
| 118 | [[nodiscard]] PackResult pack(const RootSignature& sig); | 119 | [[nodiscard]] PackResult pack(const RootSignature& sig); |
| 119 | 120 | ||
| 120 | // The console layout of root arguments in a stage's user SGPRs (docs/d3d12_vulkan.md section 3.5, D3D-448). | 121 | // The console layout of root arguments in a stage's user SGPRs (docs/d3d12_vulkan.md section 3.5, D3D-448). |
| @@ -183,8 +184,9 @@ struct StagePackResult { | |||
| 183 | }; | 184 | }; |
| 184 | 185 | ||
| 185 | // Lays the parameters out for `stage` in the console layout. Fails like pack() on more than 64 parameters, an | 186 | // Lays the parameters out for `stage` in the console layout. Fails like pack() on more than 64 parameters, an |
| 186 | // unknown parameter type, a constant parameter of 0 values, or the 64-dword cost limit. Compute spills any trailing | 187 | // unknown parameter type or the 64-dword cost limit. Compute spills any trailing parameters from the first one |
| 187 | // parameters from the first one that does not fit whole into spill_dword; non-compute stages refuse any spill. | 188 | // that does not fit whole into spill_dword; non-compute stages refuse any spill. A constant parameter of 0 values |
| 189 | // takes no SGPRs and no spill dwords. | ||
| 188 | [[nodiscard]] StagePackResult pack_stage(const RootSignature& sig, Stage stage); | 190 | [[nodiscard]] StagePackResult pack_stage(const RootSignature& sig, Stage stage); |
| 189 | 191 | ||
| 190 | // D3D12 cost of one parameter against the 64-dword limit. | 192 | // D3D12 cost of one parameter against the 64-dword limit. |
diff --git a/runtime/src/shader_library.h b/runtime/src/shader_library.h index a359287cb..7699dfbb0 100644 --- a/runtime/src/shader_library.h +++ b/runtime/src/shader_library.h | |||
| @@ -897,6 +897,47 @@ inline DescriptorHashKind majority_descriptor_hash_kind(const DescriptorHashCens | |||
| 897 | return census.fnv1a_fmix32 > census.fnv1a ? DescriptorHashKind::fnv1a_fmix32 : DescriptorHashKind::fnv1a; | 897 | return census.fnv1a_fmix32 > census.fnv1a ? DescriptorHashKind::fnv1a_fmix32 : DescriptorHashKind::fnv1a; |
| 898 | } | 898 | } |
| 899 | 899 | ||
| 900 | // Which descriptor-table entry layout the loaded modules read (descriptor_table.h, tools/rdna2spirv.py | ||
| 901 | // --descriptor-table). A module whose meta carries `"descriptor_table": "tagged"` also reads the kind word next to | ||
| 902 | // each index and uses it to tell which array an index belongs to; an absent key is the old plain layout, which reads | ||
| 903 | // only the index. The runtime fills the kind word for a tagged table and leaves it alone for a plain one, so a | ||
| 904 | // library translated before the marker (or with --descriptor-table plain) behaves exactly as it did. | ||
| 905 | enum class DescriptorTableLayout : std::uint8_t { plain = 0, tagged = 1 }; | ||
| 906 | |||
| 907 | inline constexpr const char* descriptor_table_layout_name(DescriptorTableLayout layout) { | ||
| 908 | return layout == DescriptorTableLayout::tagged ? "tagged" : "plain"; | ||
| 909 | } | ||
| 910 | |||
| 911 | struct DescriptorTableCensus { | ||
| 912 | std::size_t plain = 0; | ||
| 913 | std::size_t tagged = 0; | ||
| 914 | std::size_t total() const { return plain + tagged; } | ||
| 915 | }; | ||
| 916 | |||
| 917 | // The tagged layout when any module reads it. The kind word is additive: a tagged module reads it and a plain | ||
| 918 | // module ignores it (it reads the index at the same place), so one tagged module in the corpus needs the tagged | ||
| 919 | // layout, however many plain ones there are. Counting entries would let a merged or partial index whose plain | ||
| 920 | // modules outnumber the tagged ones hand every tagged module an all-zero kind, and every image of another | ||
| 921 | // dimension would then fall back. No tagged module is the old plain layout. | ||
| 922 | inline DescriptorTableLayout majority_descriptor_table_layout(const DescriptorTableCensus& census) { | ||
| 923 | return census.tagged > 0 ? DescriptorTableLayout::tagged : DescriptorTableLayout::plain; | ||
| 924 | } | ||
| 925 | |||
| 926 | // LEONIDA_DESCRIPTOR_TABLE=plain|tagged overrides the modules' vote. False when `value` is null, empty or not one | ||
| 927 | // of the two layouts (an unrecognised value is ignored rather than failing startup). | ||
| 928 | inline bool descriptor_table_layout_from_env(const char* value, DescriptorTableLayout* layout) { | ||
| 929 | if (!value || !*value) return false; | ||
| 930 | if (std::strcmp(value, "tagged") == 0) { | ||
| 931 | if (layout) *layout = DescriptorTableLayout::tagged; | ||
| 932 | return true; | ||
| 933 | } | ||
| 934 | if (std::strcmp(value, "plain") == 0) { | ||
| 935 | if (layout) *layout = DescriptorTableLayout::plain; | ||
| 936 | return true; | ||
| 937 | } | ||
| 938 | return false; | ||
| 939 | } | ||
| 940 | |||
| 900 | // LEONIDA_DESCRIPTOR_HASH=fnv1a|fnv1a_fmix32 overrides the modules' majority. False when `value` is null, empty or not | 941 | // LEONIDA_DESCRIPTOR_HASH=fnv1a|fnv1a_fmix32 overrides the modules' majority. False when `value` is null, empty or not |
| 901 | // one of the two kinds (an unrecognised value is ignored rather than failing startup). | 942 | // one of the two kinds (an unrecognised value is ignored rather than failing startup). |
| 902 | inline bool descriptor_hash_kind_from_env(const char* value, DescriptorHashKind* kind) { | 943 | inline bool descriptor_hash_kind_from_env(const char* value, DescriptorHashKind* kind) { |
| @@ -973,6 +1014,7 @@ public: | |||
| 973 | bvh_count_ = 0; | 1014 | bvh_count_ = 0; |
| 974 | exe_count_ = 0; | 1015 | exe_count_ = 0; |
| 975 | descriptor_hash_census_ = {}; | 1016 | descriptor_hash_census_ = {}; |
| 1017 | descriptor_table_census_ = {}; | ||
| 976 | for (const char* folder : {"fspx", "fspx_gfx"}) { | 1018 | for (const char* folder : {"fspx", "fspx_gfx"}) { |
| 977 | try { | 1019 | try { |
| 978 | const auto ignore = [](const std::string&) { return false; }; | 1020 | const auto ignore = [](const std::string&) { return false; }; |
| @@ -994,6 +1036,13 @@ public: | |||
| 994 | // LEONIDA_DESCRIPTOR_HASH names a kind. | 1036 | // LEONIDA_DESCRIPTOR_HASH names a kind. |
| 995 | const DescriptorHashCensus& descriptor_hash_census() const { return descriptor_hash_census_; } | 1037 | const DescriptorHashCensus& descriptor_hash_census() const { return descriptor_hash_census_; } |
| 996 | DescriptorHashKind descriptor_hash_kind() const { return majority_descriptor_hash_kind(descriptor_hash_census_); } | 1038 | DescriptorHashKind descriptor_hash_kind() const { return majority_descriptor_hash_kind(descriptor_hash_census_); } |
| 1039 | // The entry layouts the loaded modules read, and the layout to use: tagged as soon as one module reads the kind | ||
| 1040 | // word (it is additive, see majority_descriptor_table_layout), plain when none does. The device takes this once, | ||
| 1041 | // before its descriptor table's first insert, unless LEONIDA_DESCRIPTOR_TABLE names a layout. | ||
| 1042 | const DescriptorTableCensus& descriptor_table_census() const { return descriptor_table_census_; } | ||
| 1043 | DescriptorTableLayout descriptor_table_layout() const { | ||
| 1044 | return majority_descriptor_table_layout(descriptor_table_census_); | ||
| 1045 | } | ||
| 997 | // Entries loaded from <dir>/fspx/index.json and <dir>/library/index.json. A corpus of RPF containers never | 1046 | // Entries loaded from <dir>/fspx/index.json and <dir>/library/index.json. A corpus of RPF containers never |
| 998 | // reaches these: their programs come from FidelityFX DLLs and the pipeline library, so callers comparing reached | 1047 | // reaches these: their programs come from FidelityFX DLLs and the pipeline library, so callers comparing reached |
| 999 | // entries with size() must leave them out. | 1048 | // entries with size() must leave them out. |
| @@ -1069,6 +1118,19 @@ public: | |||
| 1069 | return all; | 1118 | return all; |
| 1070 | } | 1119 | } |
| 1071 | 1120 | ||
| 1121 | // The module's file: <dir>/<name>.spv, or the index's spv file name when that one is missing. | ||
| 1122 | std::filesystem::path spirv_file(const ShaderEntry& entry) const { | ||
| 1123 | std::error_code ec; | ||
| 1124 | auto path = dir_; | ||
| 1125 | path += "/" + entry.name + ".spv"; | ||
| 1126 | if (!std::filesystem::exists(path, ec) && !entry.spv_file.empty()) { | ||
| 1127 | auto alt = dir_; | ||
| 1128 | alt += "/" + entry.spv_file; | ||
| 1129 | return alt; | ||
| 1130 | } | ||
| 1131 | return path; | ||
| 1132 | } | ||
| 1133 | |||
| 1072 | // The size of the module's file in bytes, or 0 when it is missing: what spirv() would read, without reading it. | 1134 | // The size of the module's file in bytes, or 0 when it is missing: what spirv() would read, without reading it. |
| 1073 | std::size_t spirv_bytes(const ShaderEntry& entry) const { | 1135 | std::size_t spirv_bytes(const ShaderEntry& entry) const { |
| 1074 | std::error_code ec; | 1136 | std::error_code ec; |
| @@ -1083,6 +1145,20 @@ public: | |||
| 1083 | return ec ? 0 : static_cast<std::size_t>(size); | 1145 | return ec ? 0 : static_cast<std::size_t>(size); |
| 1084 | } | 1146 | } |
| 1085 | 1147 | ||
| 1148 | // Every entry of `stage` once, in name order, from every index (an entry reachable both by its FSSM and its FSPX | ||
| 1149 | // hash is one entry). gta6rt --precompile-pipelines builds them all. | ||
| 1150 | std::vector<const ShaderEntry*> stage_entries(std::string_view stage) const { | ||
| 1151 | std::map<std::pair<std::string_view, std::string_view>, const ShaderEntry*> unique; | ||
| 1152 | for (const Entries* map : {&entries_, &fspx_entries_}) | ||
| 1153 | for (const auto& [key, list] : *map) | ||
| 1154 | for (const ShaderEntry& e : list) | ||
| 1155 | if (e.stage == stage) unique.emplace(std::pair<std::string_view, std::string_view>{e.name, e.spv_file}, &e); | ||
| 1156 | std::vector<const ShaderEntry*> out; | ||
| 1157 | out.reserve(unique.size()); | ||
| 1158 | for (const auto& [key, e] : unique) out.push_back(e); | ||
| 1159 | return out; | ||
| 1160 | } | ||
| 1161 | |||
| 1086 | // The module's words, or empty when <dir>/<name>.spv is missing or not SPIR-V. | 1162 | // The module's words, or empty when <dir>/<name>.spv is missing or not SPIR-V. |
| 1087 | std::vector<std::uint32_t> spirv(const ShaderEntry& entry) const { | 1163 | std::vector<std::uint32_t> spirv(const ShaderEntry& entry) const { |
| 1088 | auto path = dir_; | 1164 | auto path = dir_; |
| @@ -1146,6 +1222,7 @@ private: | |||
| 1146 | bvh_count_ = 0; | 1222 | bvh_count_ = 0; |
| 1147 | exe_count_ = 0; | 1223 | exe_count_ = 0; |
| 1148 | descriptor_hash_census_ = {}; | 1224 | descriptor_hash_census_ = {}; |
| 1225 | descriptor_table_census_ = {}; | ||
| 1149 | } | 1226 | } |
| 1150 | for (const auto& [name, meta] : root.object) { | 1227 | for (const auto& [name, meta] : root.object) { |
| 1151 | const Json* hash = meta.find("fssm_sha256"); | 1228 | const Json* hash = meta.find("fssm_sha256"); |
| @@ -1241,6 +1318,13 @@ private: | |||
| 1241 | ++descriptor_hash_census_.fnv1a_fmix32; | 1318 | ++descriptor_hash_census_.fnv1a_fmix32; |
| 1242 | else | 1319 | else |
| 1243 | ++descriptor_hash_census_.fnv1a; | 1320 | ++descriptor_hash_census_.fnv1a; |
| 1321 | // Which entry layout this module reads (descriptor_table.h). Absent, or not a layout this runtime knows, | ||
| 1322 | // is the old plain one. | ||
| 1323 | if (const Json* dt = meta.find("descriptor_table"); | ||
| 1324 | dt && dt->kind == Json::Kind::string && dt->string == "tagged") | ||
| 1325 | ++descriptor_table_census_.tagged; | ||
| 1326 | else | ||
| 1327 | ++descriptor_table_census_.plain; | ||
| 1244 | if (by_fspx) fspx_entries_[{e.stage, e.fspx_code_sha256}].push_back(e); | 1328 | if (by_fspx) fspx_entries_[{e.stage, e.fspx_code_sha256}].push_back(e); |
| 1245 | if (by_fssm) entries_[{e.stage, e.fssm_sha256}].push_back(std::move(e)); | 1329 | if (by_fssm) entries_[{e.stage, e.fssm_sha256}].push_back(std::move(e)); |
| 1246 | if (by_fspx && (prefix == "fspx/" || prefix == "library/")) ++fspx_count_; | 1330 | if (by_fspx && (prefix == "fspx/" || prefix == "library/")) ++fspx_count_; |
| @@ -1264,6 +1348,7 @@ private: | |||
| 1264 | Entries entries_; | 1348 | Entries entries_; |
| 1265 | Entries fspx_entries_; | 1349 | Entries fspx_entries_; |
| 1266 | DescriptorHashCensus descriptor_hash_census_; | 1350 | DescriptorHashCensus descriptor_hash_census_; |
| 1351 | DescriptorTableCensus descriptor_table_census_; | ||
| 1267 | }; | 1352 | }; |
| 1268 | 1353 | ||
| 1269 | } // namespace leonida | 1354 | } // namespace leonida |
diff --git a/runtime/src/submit_phases.h b/runtime/src/submit_phases.h index 84ea77b02..dfaf8ce95 100644 --- a/runtime/src/submit_phases.h +++ b/runtime/src/submit_phases.h | |||
| @@ -24,12 +24,14 @@ enum Phase : unsigned { | |||
| 24 | shadows, // slot-133 shadow buffers and title windows (ShadowPages::refresh) | 24 | shadows, // slot-133 shadow buffers and title windows (ShadowPages::refresh) |
| 25 | geometry, // GeometryViews::refresh | 25 | geometry, // GeometryViews::refresh |
| 26 | textures, // Device::refresh_title_textures | 26 | textures, // Device::refresh_title_textures |
| 27 | pipelines, // no longer timed (the pre-pass that waited for pipelines is gone); kept for the column order | ||
| 27 | replay, // the rest of execute_now: preparing, recording and submitting the lists | 28 | replay, // the rest of execute_now: preparing, recording and submitting the lists |
| 28 | kCount | 29 | kCount |
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | inline const char* name(unsigned p) { | 32 | inline const char* name(unsigned p) { |
| 32 | static const char* const names[kCount] = {"wait", "heaps", "shadows", "geometry", "textures", "replay"}; | 33 | static const char* const names[kCount] = {"wait", "heaps", "shadows", "geometry", "textures", "pipes", |
| 34 | "replay"}; | ||
| 33 | return p < kCount ? names[p] : "?"; | 35 | return p < kCount ? names[p] : "?"; |
| 34 | } | 36 | } |
| 35 | 37 | ||
| @@ -40,6 +42,10 @@ struct Totals { | |||
| 40 | std::atomic<std::int64_t> last_log{0}; | 42 | std::atomic<std::int64_t> last_log{0}; |
| 41 | std::atomic<std::uint64_t> presents{0}; // frames the presenter showed (VulkanPresenter), since the last line | 43 | std::atomic<std::uint64_t> presents{0}; // frames the presenter showed (VulkanPresenter), since the last line |
| 42 | std::atomic<std::uint64_t> present_serial{0}; // the same, never reset (LEONIDA_REFRESH_PER_FRAME) | 44 | std::atomic<std::uint64_t> present_serial{0}; // the same, never reset (LEONIDA_REFRESH_PER_FRAME) |
| 45 | // Threads whose innermost Scope is this phase now, and when the first of them entered it (steady_clock). Counted | ||
| 46 | // per phase, since queues submit from several threads: one value would go stale when their scopes overlap. | ||
| 47 | std::atomic<unsigned> active[kCount]{}; | ||
| 48 | std::atomic<std::int64_t> active_since[kCount]{}; | ||
| 43 | std::atomic<std::uint32_t> thread{0}; // the thread of the last submission (the thread sampler reports it apart) | 49 | std::atomic<std::uint32_t> thread{0}; // the thread of the last submission (the thread sampler reports it apart) |
| 44 | }; | 50 | }; |
| 45 | inline Totals& totals() { | 51 | inline Totals& totals() { |
| @@ -86,12 +92,48 @@ inline void add(Phase p, std::uint64_t ns) { | |||
| 86 | struct Scope { | 92 | struct Scope { |
| 87 | Phase phase; | 93 | Phase phase; |
| 88 | std::int64_t start = now_ns(); | 94 | std::int64_t start = now_ns(); |
| 89 | explicit Scope(Phase p) : phase(p) {} | 95 | int outer; // the phase of this thread's Scope around this one, -1 for none |
| 90 | ~Scope() { add(phase, std::uint64_t(now_ns() - start)); } | 96 | explicit Scope(Phase p) : phase(p), outer(innermost()) { |
| 97 | if (outer >= 0) leave(outer); | ||
| 98 | enter(int(p), start); | ||
| 99 | innermost() = int(p); | ||
| 100 | } | ||
| 101 | ~Scope() { | ||
| 102 | const std::int64_t end = now_ns(); | ||
| 103 | add(phase, std::uint64_t(end - start)); | ||
| 104 | leave(int(phase)); | ||
| 105 | if (outer >= 0) enter(outer, end); | ||
| 106 | innermost() = outer; | ||
| 107 | } | ||
| 108 | static int& innermost() { | ||
| 109 | thread_local int phase_of_this_thread = -1; | ||
| 110 | return phase_of_this_thread; | ||
| 111 | } | ||
| 112 | static void enter(int p, std::int64_t at) { | ||
| 113 | Totals& t = totals(); | ||
| 114 | if (t.active[p].fetch_add(1, std::memory_order_relaxed) == 0) t.active_since[p].store(at, std::memory_order_relaxed); | ||
| 115 | } | ||
| 116 | static void leave(int p) { totals().active[p].fetch_sub(1, std::memory_order_relaxed); } | ||
| 91 | Scope(const Scope&) = delete; | 117 | Scope(const Scope&) = delete; |
| 92 | Scope& operator=(const Scope&) = delete; | 118 | Scope& operator=(const Scope&) = delete; |
| 93 | }; | 119 | }; |
| 94 | 120 | ||
| 121 | // The phase that some thread has been in longest, -1 when none is in one. | ||
| 122 | struct Running { | ||
| 123 | int phase = -1; | ||
| 124 | std::int64_t since = 0; | ||
| 125 | }; | ||
| 126 | inline Running running() { | ||
| 127 | Totals& t = totals(); | ||
| 128 | Running r; | ||
| 129 | for (unsigned p = 0; p < kCount; ++p) { | ||
| 130 | if (!t.active[p].load(std::memory_order_relaxed)) continue; | ||
| 131 | const std::int64_t since = t.active_since[p].load(std::memory_order_relaxed); | ||
| 132 | if (r.phase < 0 || since < r.since) r = {int(p), since}; | ||
| 133 | } | ||
| 134 | return r; | ||
| 135 | } | ||
| 136 | |||
| 95 | // After each submission: counts it, and prints the line when the period has passed. One thread wins the line. | 137 | // After each submission: counts it, and prints the line when the period has passed. One thread wins the line. |
| 96 | inline void submitted() { | 138 | inline void submitted() { |
| 97 | Totals& t = totals(); | 139 | Totals& t = totals(); |
| @@ -120,14 +162,15 @@ inline void submitted() { | |||
| 120 | all += total; | 162 | all += total; |
| 121 | } | 163 | } |
| 122 | std::fprintf(stderr, | 164 | std::fprintf(stderr, |
| 123 | "[rt] submit phases t=%.0fs: %llu submissions in %.1f s (%.2f/s, %llu in all), %.2f frames/s; ms per submission " | 165 | "[rt] submit phases t=%.0fs: %llu submissions in %.1f s (%.2f/s, %llu in all), %.2f frames/s; ms per " |
| 124 | "(max): %s %.2f (%.0f) %s %.2f (%.0f) %s %.2f (%.0f) %s %.2f (%.0f) %s %.2f (%.0f) %s %.2f (%.0f); " | 166 | "submission (max): %s %.2f (%.0f) %s %.2f (%.0f) %s %.2f (%.0f) %s %.2f (%.0f) %s %.2f (%.0f) %s %.2f " |
| 167 | "(%.0f) %s %.2f (%.0f); " | ||
| 125 | "%.0f%% of the wall time\n", | 168 | "%.0f%% of the wall time\n", |
| 126 | process_age(), static_cast<unsigned long long>(n), seconds, double(n) / seconds, | 169 | process_age(), static_cast<unsigned long long>(n), seconds, double(n) / seconds, |
| 127 | static_cast<unsigned long long>(t.all_submissions.load(std::memory_order_relaxed)), | 170 | static_cast<unsigned long long>(t.all_submissions.load(std::memory_order_relaxed)), |
| 128 | double(frames) / seconds, name(0), ms[0], | 171 | double(frames) / seconds, name(0), ms[0], |
| 129 | max_ms[0], name(1), ms[1], max_ms[1], name(2), ms[2], max_ms[2], name(3), ms[3], max_ms[3], name(4), | 172 | max_ms[0], name(1), ms[1], max_ms[1], name(2), ms[2], max_ms[2], name(3), ms[3], max_ms[3], name(4), |
| 130 | ms[4], max_ms[4], name(5), ms[5], max_ms[5], 100.0 * all * 1e-3 / seconds); | 173 | ms[4], max_ms[4], name(5), ms[5], max_ms[5], name(6), ms[6], max_ms[6], 100.0 * all * 1e-3 / seconds); |
| 131 | } | 174 | } |
| 132 | 175 | ||
| 133 | } // namespace leonida::submit_phases | 176 | } // namespace leonida::submit_phases |
diff --git a/runtime/src/thread_sampler.h b/runtime/src/thread_sampler.h index 282eb20dd..0c18949ce 100644 --- a/runtime/src/thread_sampler.h +++ b/runtime/src/thread_sampler.h | |||
| @@ -44,6 +44,9 @@ struct Sampler { | |||
| 44 | // LEONIDA_SAMPLE_DETAIL=<id>[,<id>...]: for these threads, the 10 most frequent chains, 16 frames deep, each as a | 44 | // LEONIDA_SAMPLE_DETAIL=<id>[,<id>...]: for these threads, the 10 most frequent chains, 16 frames deep, each as a |
| 45 | // share of that thread's samples (thread ids are stable from boot to boot: the title's main, render and submit). | 45 | // share of that thread's samples (thread ids are stable from boot to boot: the title's main, render and submit). |
| 46 | std::vector<DWORD> detail; | 46 | std::vector<DWORD> detail; |
| 47 | // LEONIDA_SAMPLE_FIND=<rva>[,<rva>...] (title function starts): which threads have the function on their stack | ||
| 48 | // (48 frames deep), how often, and their most frequent chain under it, every report. | ||
| 49 | std::vector<std::uint64_t> find; | ||
| 47 | }; | 50 | }; |
| 48 | 51 | ||
| 49 | // Per title thread (one with a title frame in its chain): how many samples were inside our runtime, and through which | 52 | // Per title thread (one with a title frame in its chain): how many samples were inside our runtime, and through which |
| @@ -151,6 +154,7 @@ inline DWORD WINAPI run(LPVOID parameter) { | |||
| 151 | constexpr int kDetailFrames = 16; | 154 | constexpr int kDetailFrames = 16; |
| 152 | using DetailChain = std::array<std::uint64_t, kDetailFrames>; | 155 | using DetailChain = std::array<std::uint64_t, kDetailFrames>; |
| 153 | std::map<std::pair<DWORD, DetailChain>, std::uint64_t> detail_chains; | 156 | std::map<std::pair<DWORD, DetailChain>, std::uint64_t> detail_chains; |
| 157 | std::map<std::pair<std::uint64_t, DWORD>, std::map<DetailChain, std::uint64_t>> found; // (rva, thread) -> chains | ||
| 154 | std::uint64_t total = 0; | 158 | std::uint64_t total = 0; |
| 155 | ULONGLONG listed = 0, reported = GetTickCount64(); | 159 | ULONGLONG listed = 0, reported = GetTickCount64(); |
| 156 | const auto cpu_of = [](HANDLE h) { | 160 | const auto cpu_of = [](HANDLE h) { |
| @@ -205,11 +209,20 @@ inline DWORD WINAPI run(LPVOID parameter) { | |||
| 205 | unwind(context, deep); | 209 | unwind(context, deep); |
| 206 | ++detail_chains[{it->first, deep}]; | 210 | ++detail_chains[{it->first, deep}]; |
| 207 | } | 211 | } |
| 208 | if (s.shims) { | 212 | if (s.shims || !s.find.empty()) { |
| 209 | DeepChain deep{}; | 213 | DeepChain deep{}; |
| 210 | const int n = unwind(context, deep); | 214 | const int n = unwind(context, deep); |
| 211 | std::copy_n(deep.begin(), kFrames, chain.begin()); | 215 | std::copy_n(deep.begin(), kFrames, chain.begin()); |
| 212 | count_shims(s, deep, n, moved, shim_counts[it->first]); | 216 | if (s.shims) count_shims(s, deep, n, moved, shim_counts[it->first]); |
| 217 | const auto title = reinterpret_cast<std::uint64_t>(s.title); | ||
| 218 | for (const std::uint64_t rva : s.find) | ||
| 219 | for (int f = 0; f < n; ++f) | ||
| 220 | if (deep[f] == title + rva) { | ||
| 221 | DetailChain inner{}; | ||
| 222 | std::copy_n(deep.begin(), (std::min)(kDetailFrames, n), inner.begin()); | ||
| 223 | ++found[{rva, it->first}][inner]; | ||
| 224 | break; | ||
| 225 | } | ||
| 213 | } else { | 226 | } else { |
| 214 | unwind(context, chain); | 227 | unwind(context, chain); |
| 215 | } | 228 | } |
| @@ -299,6 +312,23 @@ inline DWORD WINAPI run(LPVOID parameter) { | |||
| 299 | } | 312 | } |
| 300 | } | 313 | } |
| 301 | detail_chains.clear(); | 314 | detail_chains.clear(); |
| 315 | for (const auto& [key, chains_of] : found) { | ||
| 316 | std::uint64_t all = 0; | ||
| 317 | const DetailChain* top = nullptr; | ||
| 318 | std::uint64_t top_n = 0; | ||
| 319 | for (const auto& [c, n] : chains_of) { | ||
| 320 | all += n; | ||
| 321 | if (n > top_n) top_n = n, top = &c; | ||
| 322 | } | ||
| 323 | std::string frames; | ||
| 324 | for (int f = 0; top && f < kDetailFrames && (*top)[f]; ++f) frames += (f ? " < " : "") + name_of(s, (*top)[f]); | ||
| 325 | const auto t = threads.find(key.second); | ||
| 326 | std::fprintf(stderr, "[rt] sampler: find t+%llx: thread %lu %llu samples of %llu; top chain (%llu): %s\n", | ||
| 327 | static_cast<unsigned long long>(key.first), key.second, static_cast<unsigned long long>(all), | ||
| 328 | static_cast<unsigned long long>(t == threads.end() ? 0 : t->second.samples), | ||
| 329 | static_cast<unsigned long long>(top_n), frames.c_str()); | ||
| 330 | } | ||
| 331 | found.clear(); | ||
| 302 | if (s.shims) { | 332 | if (s.shims) { |
| 303 | // Title threads by their samples inside our runtime: where the title's own threads (its main, render and | 333 | // Title threads by their samples inside our runtime: where the title's own threads (its main, render and |
| 304 | // Subrender workers, streaming) spend time in our shims, waiting or running. | 334 | // Subrender workers, streaming) spend time in our shims, waiting or running. |
| @@ -386,6 +416,15 @@ inline void start(std::uint8_t* title, std::uint64_t title_size) { | |||
| 386 | if (id) s.detail.push_back(DWORD(id)); | 416 | if (id) s.detail.push_back(DWORD(id)); |
| 387 | at = *end == ',' ? end + 1 : end; | 417 | at = *end == ',' ? end + 1 : end; |
| 388 | } | 418 | } |
| 419 | char finds[256] = {}; | ||
| 420 | if (const DWORD n = GetEnvironmentVariableA("LEONIDA_SAMPLE_FIND", finds, sizeof(finds)); n && n < sizeof(finds)) | ||
| 421 | for (char* at = finds; *at;) { | ||
| 422 | char* end = nullptr; | ||
| 423 | const std::uint64_t rva = std::strtoull(at, &end, 16); | ||
| 424 | if (end == at) break; | ||
| 425 | if (rva) s.find.push_back(rva); | ||
| 426 | at = *end == ',' ? end + 1 : end; | ||
| 427 | } | ||
| 389 | char shims[4] = {}; | 428 | char shims[4] = {}; |
| 390 | s.shims = GetEnvironmentVariableA("LEONIDA_SAMPLE_SHIMS", shims, sizeof(shims)) == 1 && shims[0] == '1'; | 429 | s.shims = GetEnvironmentVariableA("LEONIDA_SAMPLE_SHIMS", shims, sizeof(shims)) == 1 && shims[0] == '1'; |
| 391 | if (const auto self = reinterpret_cast<const std::uint8_t*>(GetModuleHandleW(nullptr))) { | 430 | if (const auto self = reinterpret_cast<const std::uint8_t*>(GetModuleHandleW(nullptr))) { |
diff --git a/runtime/src/thread_stacks.cpp b/runtime/src/thread_stacks.cpp index 67188d908..38d7cc2a4 100644 --- a/runtime/src/thread_stacks.cpp +++ b/runtime/src/thread_stacks.cpp | |||
| @@ -121,10 +121,10 @@ struct ThreadTrace { | |||
| 121 | size_t count = 0; | 121 | size_t count = 0; |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | void print_traces(unsigned at, const std::vector<ThreadTrace>& traces) { | 124 | void print_traces(const std::string& tag, const std::vector<ThreadTrace>& traces) { |
| 125 | std::string out = "[rt] stacks t=" + std::to_string(at) + ": " + std::to_string(traces.size()) + " threads\n"; | 125 | std::string out = "[rt] stacks " + tag + ": " + std::to_string(traces.size()) + " threads\n"; |
| 126 | for (auto it = traces.begin(); it != traces.end(); ++it) { | 126 | for (auto it = traces.begin(); it != traces.end(); ++it) { |
| 127 | out += "[rt] stacks t=" + std::to_string(at) + " thread " + std::to_string(it->tid) + " (" + it->label + "):\n"; | 127 | out += "[rt] stacks " + tag + " thread " + std::to_string(it->tid) + " (" + it->label + "):\n"; |
| 128 | const auto same = std::find_if(traces.begin(), it, [&](const ThreadTrace& earlier) { | 128 | const auto same = std::find_if(traces.begin(), it, [&](const ThreadTrace& earlier) { |
| 129 | return it->count && it->count == earlier.count && | 129 | return it->count && it->count == earlier.count && |
| 130 | std::equal(it->frames.begin(), it->frames.begin() + it->count, earlier.frames.begin()); | 130 | std::equal(it->frames.begin(), it->frames.begin() + it->count, earlier.frames.begin()); |
| @@ -142,10 +142,11 @@ void print_traces(unsigned at, const std::vector<ThreadTrace>& traces) { | |||
| 142 | std::fflush(stderr); | 142 | std::fflush(stderr); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | void snapshot_threads(unsigned at, StackSampler& sampler, GetDescription describe, QueryThread query) { | 145 | void snapshot_threads(const std::string& tag, StackSampler& sampler, GetDescription describe, QueryThread query, |
| 146 | DWORD only = 0) { | ||
| 146 | const HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); | 147 | const HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); |
| 147 | if (snapshot == INVALID_HANDLE_VALUE) { | 148 | if (snapshot == INVALID_HANDLE_VALUE) { |
| 148 | std::fprintf(stderr, "[rt] stacks t=%u: thread list failed (error %lu)\n", at, GetLastError()); | 149 | std::fprintf(stderr, "[rt] stacks %s: thread list failed (error %lu)\n", tag.c_str(), GetLastError()); |
| 149 | return; | 150 | return; |
| 150 | } | 151 | } |
| 151 | std::vector<ThreadTrace> traces; | 152 | std::vector<ThreadTrace> traces; |
| @@ -157,6 +158,7 @@ void snapshot_threads(unsigned at, StackSampler& sampler, GetDescription describ | |||
| 157 | for (BOOL ok = Thread32First(snapshot, &entry); ok; ok = Thread32Next(snapshot, &entry)) { | 158 | for (BOOL ok = Thread32First(snapshot, &entry); ok; ok = Thread32Next(snapshot, &entry)) { |
| 158 | entry.dwSize = sizeof(entry); | 159 | entry.dwSize = sizeof(entry); |
| 159 | if (entry.th32OwnerProcessID != pid || entry.th32ThreadID == self) continue; | 160 | if (entry.th32OwnerProcessID != pid || entry.th32ThreadID == self) continue; |
| 161 | if (only && entry.th32ThreadID != only) continue; | ||
| 160 | const HANDLE thread = OpenThread(THREAD_SUSPEND_RESUME | THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION, | 162 | const HANDLE thread = OpenThread(THREAD_SUSPEND_RESUME | THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION, |
| 161 | FALSE, entry.th32ThreadID); | 163 | FALSE, entry.th32ThreadID); |
| 162 | if (!thread) continue; | 164 | if (!thread) continue; |
| @@ -169,7 +171,7 @@ void snapshot_threads(unsigned at, StackSampler& sampler, GetDescription describ | |||
| 169 | CloseHandle(thread); | 171 | CloseHandle(thread); |
| 170 | } | 172 | } |
| 171 | CloseHandle(snapshot); | 173 | CloseHandle(snapshot); |
| 172 | print_traces(at, traces); | 174 | print_traces(tag, traces); |
| 173 | } | 175 | } |
| 174 | 176 | ||
| 175 | } // namespace | 177 | } // namespace |
| @@ -207,6 +209,20 @@ bool parse_stack_times(std::string_view text, std::vector<unsigned>& seconds) { | |||
| 207 | return true; | 209 | return true; |
| 208 | } | 210 | } |
| 209 | 211 | ||
| 212 | void print_thread_stacks_now(std::uint32_t tid, const char* why) noexcept { | ||
| 213 | static std::mutex mutex; | ||
| 214 | try { | ||
| 215 | std::lock_guard lock(mutex); | ||
| 216 | static StackSampler sampler; | ||
| 217 | const auto describe = reinterpret_cast<GetDescription>(reinterpret_cast<void*>( | ||
| 218 | GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "GetThreadDescription"))); | ||
| 219 | const auto query = reinterpret_cast<QueryThread>(reinterpret_cast<void*>( | ||
| 220 | GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "NtQueryInformationThread"))); | ||
| 221 | snapshot_threads(why ? why : "now", sampler, describe, query, tid); | ||
| 222 | } catch (...) { | ||
| 223 | } | ||
| 224 | } | ||
| 225 | |||
| 210 | std::jthread start_thread_stacks() { | 226 | std::jthread start_thread_stacks() { |
| 211 | const auto start = Clock::now(); | 227 | const auto start = Clock::now(); |
| 212 | char spec[1024]; | 228 | char spec[1024]; |
| @@ -229,7 +245,7 @@ std::jthread start_thread_stacks() { | |||
| 229 | for (const unsigned at : times) { | 245 | for (const unsigned at : times) { |
| 230 | wake.wait_until(lock, stop, start + std::chrono::seconds(at), [] { return false; }); | 246 | wake.wait_until(lock, stop, start + std::chrono::seconds(at), [] { return false; }); |
| 231 | if (stop.stop_requested()) break; | 247 | if (stop.stop_requested()) break; |
| 232 | snapshot_threads(at, sampler, describe, query); | 248 | snapshot_threads("t=" + std::to_string(at), sampler, describe, query); |
| 233 | } | 249 | } |
| 234 | }); | 250 | }); |
| 235 | } | 251 | } |
diff --git a/runtime/src/thread_stacks.h b/runtime/src/thread_stacks.h index 523c7b266..1edc1b350 100644 --- a/runtime/src/thread_stacks.h +++ b/runtime/src/thread_stacks.h | |||
| @@ -35,4 +35,8 @@ bool parse_stack_times(std::string_view text, std::vector<unsigned>& seconds); | |||
| 35 | // sampler before unmapping the title image. | 35 | // sampler before unmapping the title image. |
| 36 | std::jthread start_thread_stacks(); | 36 | std::jthread start_thread_stacks(); |
| 37 | 37 | ||
| 38 | // The call chain of thread `tid` now, or of every other thread when `tid` is 0, printed as LEONIDA_STACKS does under | ||
| 39 | // the tag `why`. One call at a time; the device-loss diagnostics call it (vulkan_device_fault.h thread_stack_hook). | ||
| 40 | void print_thread_stacks_now(std::uint32_t tid, const char* why) noexcept; | ||
| 41 | |||
| 38 | } // namespace rt | 42 | } // namespace rt |
diff --git a/runtime/src/title_page_watch.h b/runtime/src/title_page_watch.h index ccc085466..9d0a2ccfc 100644 --- a/runtime/src/title_page_watch.h +++ b/runtime/src/title_page_watch.h | |||
| @@ -204,6 +204,18 @@ inline void set(std::uintptr_t va, bool aliased) { | |||
| 204 | // Bumped by every change of set(). | 204 | // Bumped by every change of set(). |
| 205 | inline std::uint64_t generation() { return state().generation.load(std::memory_order_acquire); } | 205 | inline std::uint64_t generation() { return state().generation.load(std::memory_order_acquire); } |
| 206 | 206 | ||
| 207 | // Up to `n` aliased pages, and how many there are (a probe's sample; no order). | ||
| 208 | inline std::size_t sample(std::vector<std::uintptr_t>& out, std::size_t n) { | ||
| 209 | State& s = state(); | ||
| 210 | out.clear(); | ||
| 211 | std::shared_lock lock(s.mutex); | ||
| 212 | for (const std::uintptr_t va : s.aliased) { | ||
| 213 | if (out.size() >= n) break; | ||
| 214 | out.push_back(va); | ||
| 215 | } | ||
| 216 | return s.aliased.size(); | ||
| 217 | } | ||
| 218 | |||
| 207 | // Calls `f(va)` for each aliased 64 KiB page overlapping [begin, end). | 219 | // Calls `f(va)` for each aliased 64 KiB page overlapping [begin, end). |
| 208 | template<class F> | 220 | template<class F> |
| 209 | void for_each_in(std::uintptr_t begin, std::uintptr_t end, F&& f) { | 221 | void for_each_in(std::uintptr_t begin, std::uintptr_t end, F&& f) { |
| @@ -258,6 +270,19 @@ inline bool note_reservation(std::uintptr_t base, std::uintptr_t size, bool gpu_ | |||
| 258 | return true; | 270 | return true; |
| 259 | } | 271 | } |
| 260 | 272 | ||
| 273 | // Both addresses of every pair, as [start, end) ranges (LEONIDA_CONSOLE_HEAP_GPU's ask table); `count()` changes | ||
| 274 | // with them. | ||
| 275 | inline void spans(std::vector<std::pair<std::uint64_t, std::uint64_t>>& out) { | ||
| 276 | State& s = state(); | ||
| 277 | out.clear(); | ||
| 278 | if (!s.count.load(std::memory_order_acquire)) return; | ||
| 279 | std::shared_lock lock(s.mutex); | ||
| 280 | for (const View& v : s.views) { | ||
| 281 | out.emplace_back(v.gpu, v.gpu + v.size); | ||
| 282 | out.emplace_back(v.cpu, v.cpu + v.size); | ||
| 283 | } | ||
| 284 | } | ||
| 285 | inline std::size_t count() { return state().count.load(std::memory_order_acquire); } | ||
| 261 | // Marks the pair whose GPU-only range starts at `gpu` as one whose GPU-only range has pages of its own (queue slot 31 | 286 | // Marks the pair whose GPU-only range starts at `gpu` as one whose GPU-only range has pages of its own (queue slot 31 |
| 262 | // or XMemMapPhysicalPages map them at that address, not through the CPU view): the host reads it there (to_cpu) and | 287 | // or XMemMapPhysicalPages map them at that address, not through the CPU view): the host reads it there (to_cpu) and |
| 263 | // a slot-133 buffer over it is a shadow, not an import (independently_mapped). False when no pair starts at `gpu`. | 288 | // a slot-133 buffer over it is a shadow, not an import (independently_mapped). False when no pair starts at `gpu`. |
diff --git a/runtime/src/title_texture_refresh.h b/runtime/src/title_texture_refresh.h index c3102aff7..feb8a0cc2 100644 --- a/runtime/src/title_texture_refresh.h +++ b/runtime/src/title_texture_refresh.h | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | #include <algorithm> | 2 | #include <algorithm> |
| 3 | #include <bit> | ||
| 4 | #include <map> | ||
| 3 | #include <cstdint> | 5 | #include <cstdint> |
| 4 | #include <utility> | 6 | #include <utility> |
| 5 | #include <vector> | 7 | #include <vector> |
| @@ -8,6 +10,48 @@ namespace leonida { | |||
| 8 | 10 | ||
| 9 | using TitleWriteRanges = std::vector<std::pair<std::uintptr_t, std::uintptr_t>>; | 11 | using TitleWriteRanges = std::vector<std::pair<std::uintptr_t, std::uintptr_t>>; |
| 10 | 12 | ||
| 13 | // Store each texture once, in the smallest aligned power-of-two page containing its CPU range. | ||
| 14 | // A journal interval needs only the overlapping pages at each occupied size. Aliases keep distinct keys. | ||
| 15 | class TitleTextureRangeIndex { | ||
| 16 | using Address = std::uint64_t; | ||
| 17 | struct Range { Address first, last; }; | ||
| 18 | using PageKey = std::pair<Address, Address>; // page, registry key | ||
| 19 | std::map<unsigned, std::map<PageKey, Range>> pages_; | ||
| 20 | std::map<Address, std::pair<unsigned, Address>> location_; | ||
| 21 | static Address page(Address at, unsigned shift) { return shift == 64 ? 0 : at >> shift; } | ||
| 22 | |||
| 23 | public: | ||
| 24 | void erase(Address key) { | ||
| 25 | const auto where = location_.find(key); | ||
| 26 | if (where == location_.end()) return; | ||
| 27 | const auto [shift, number] = where->second; | ||
| 28 | auto level = pages_.find(shift); | ||
| 29 | level->second.erase({number, key}); | ||
| 30 | if (level->second.empty()) pages_.erase(level); | ||
| 31 | location_.erase(where); | ||
| 32 | } | ||
| 33 | void set(Address key, Address first, Address bytes) { | ||
| 34 | erase(key); | ||
| 35 | if (!bytes) return; | ||
| 36 | const Address last = first + std::min(bytes - 1, UINT64_MAX - first); | ||
| 37 | const unsigned shift = unsigned(std::bit_width(first ^ last)); | ||
| 38 | const Address number = page(first, shift); | ||
| 39 | pages_[shift][{number, key}] = {first, last}; | ||
| 40 | location_[key] = {shift, number}; | ||
| 41 | } | ||
| 42 | template<class Visit> | ||
| 43 | void overlapping(Address from, Address to, Visit visit) const { | ||
| 44 | if (from >= to) return; | ||
| 45 | for (const auto& [shift, entries] : pages_) { | ||
| 46 | const Address last = page(to - 1, shift); | ||
| 47 | for (auto it = entries.lower_bound({page(from, shift), 0}); | ||
| 48 | it != entries.end() && it->first.first <= last; ++it) { | ||
| 49 | if (it->second.first < to && from <= it->second.last) visit(it->first.second); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | } | ||
| 53 | }; | ||
| 54 | |||
| 11 | // Sorted, disjoint half-open intervals let each texture find its first possible writer by end address. | 55 | // Sorted, disjoint half-open intervals let each texture find its first possible writer by end address. |
| 12 | inline void merge_title_writes(TitleWriteRanges& writes) { | 56 | inline void merge_title_writes(TitleWriteRanges& writes) { |
| 13 | std::sort(writes.begin(), writes.end()); | 57 | std::sort(writes.begin(), writes.end()); |
| @@ -34,10 +78,13 @@ inline bool title_write_overlaps(const TitleWriteRanges& writes, std::uintptr_t | |||
| 34 | // the walk would step through a freed node. The list holds a reference to each entry, so an entry erased during the | 78 | // the walk would step through a freed node. The list holds a reference to each entry, so an entry erased during the |
| 35 | // pass is still alive when its turn comes. | 79 | // pass is still alive when its turn comes. |
| 36 | template<class Registry> | 80 | template<class Registry> |
| 37 | std::vector<std::pair<std::uint64_t, typename Registry::mapped_type>> title_texture_snapshot(const Registry& textures) { | 81 | std::vector<std::pair<std::uint64_t, typename Registry::mapped_type>> title_texture_snapshot( |
| 82 | const Registry& textures, std::uint64_t start = 0, std::size_t limit = SIZE_MAX) { | ||
| 38 | std::vector<std::pair<std::uint64_t, typename Registry::mapped_type>> entries; | 83 | std::vector<std::pair<std::uint64_t, typename Registry::mapped_type>> entries; |
| 39 | entries.reserve(textures.size()); | 84 | const auto count = std::min(textures.size(), limit); |
| 40 | for (const auto& [address, texture] : textures) entries.emplace_back(address, texture); | 85 | entries.reserve(count); |
| 86 | for (auto it = textures.lower_bound(start); it != textures.end() && entries.size() < count; ++it) | ||
| 87 | entries.emplace_back(it->first, it->second); | ||
| 41 | return entries; | 88 | return entries; |
| 42 | } | 89 | } |
| 43 | 90 | ||
diff --git a/runtime/src/title_va_alias.h b/runtime/src/title_va_alias.h index b3de5ce70..8d97764d5 100644 --- a/runtime/src/title_va_alias.h +++ b/runtime/src/title_va_alias.h | |||
| @@ -16,7 +16,10 @@ | |||
| 16 | // that makes a GPU copy for an address in the title's memory that has none yet, and a scanner that rewrites the | 16 | // that makes a GPU copy for an address in the title's memory that has none yet, and a scanner that rewrites the |
| 17 | // buffer V#s of a bound descriptor table before a submission. Without hooks the table only translates what was | 17 | // buffer V#s of a bound descriptor table before a submission. Without hooks the table only translates what was |
| 18 | // added to it, so it is tested without a GPU (title_va_alias_test). | 18 | // added to it, so it is tested without a GPU (title_va_alias_test). |
| 19 | #include "descriptor_range_changes.h" | ||
| 19 | #include <algorithm> | 20 | #include <algorithm> |
| 21 | #include "buffer_va_index.h" | ||
| 22 | |||
| 20 | #include <array> | 23 | #include <array> |
| 21 | #include <atomic> | 24 | #include <atomic> |
| 22 | #include <cstddef> | 25 | #include <cstddef> |
| @@ -49,8 +52,11 @@ public: | |||
| 49 | if (!bytes || title_va > UINT64_MAX - bytes) return false; | 52 | if (!bytes || title_va > UINT64_MAX - bytes) return false; |
| 50 | std::unique_lock lock(mutex_); | 53 | std::unique_lock lock(mutex_); |
| 51 | erase_overlapping(title_va, title_va + bytes); | 54 | erase_overlapping(title_va, title_va + bytes); |
| 55 | changes_.record(title_va, bytes); | ||
| 52 | ranges_[title_va] = {title_va + bytes, shader_va}; | 56 | ranges_[title_va] = {title_va + bytes, shader_va}; |
| 57 | by_shader_.insert(shader_va, bytes, title_va); | ||
| 53 | count_.store(ranges_.size(), std::memory_order_release); | 58 | count_.store(ranges_.size(), std::memory_order_release); |
| 59 | generation_.fetch_add(1, std::memory_order_release); | ||
| 54 | return true; | 60 | return true; |
| 55 | } | 61 | } |
| 56 | 62 | ||
| @@ -68,8 +74,12 @@ public: | |||
| 68 | std::unique_lock lock(mutex_); | 74 | std::unique_lock lock(mutex_); |
| 69 | const auto it = ranges_.find(title_va); | 75 | const auto it = ranges_.find(title_va); |
| 70 | if (it != ranges_.end() && it->second.shader_va == shader_va) { | 76 | if (it != ranges_.end() && it->second.shader_va == shader_va) { |
| 77 | changes_.record(it->first, it->second.end - it->first); | ||
| 78 | by_shader_.erase(shader_va, title_va); | ||
| 79 | note_removed(it->second.shader_va, it->second.end - it->first); | ||
| 71 | ranges_.erase(it); | 80 | ranges_.erase(it); |
| 72 | invalidations_.fetch_add(1, std::memory_order_release); | 81 | invalidations_.fetch_add(1, std::memory_order_release); |
| 82 | generation_.fetch_add(1, std::memory_order_release); | ||
| 73 | } | 83 | } |
| 74 | count_.store(ranges_.size(), std::memory_order_release); | 84 | count_.store(ranges_.size(), std::memory_order_release); |
| 75 | } | 85 | } |
| @@ -113,6 +123,16 @@ public: | |||
| 113 | for (const auto& [start, range] : ranges_) out.push_back({start, range.end, range.shader_va}); | 123 | for (const auto& [start, range] : ranges_) out.push_back({start, range.end, range.shader_va}); |
| 114 | } | 124 | } |
| 115 | 125 | ||
| 126 | // Whether `shader_va` lies in the copy of a range added so far: an address the layer itself wrote for the title | ||
| 127 | // (a window, a geometry copy, a slot-133 shadow or import), which a later scan of the same descriptor sees again. | ||
| 128 | // A binary search over the copies' addresses (source_of_vsharp walks every range). | ||
| 129 | bool shader_side(std::uint64_t shader_va) const { | ||
| 130 | if (!count_.load(std::memory_order_acquire)) return false; | ||
| 131 | std::shared_lock lock(mutex_); | ||
| 132 | BufferVaIndex<std::uint64_t>::Hit hit{}; | ||
| 133 | return by_shader_.find(shader_va, hit); | ||
| 134 | } | ||
| 135 | |||
| 116 | // Debug-only inverse lookup. V#s retain 48 bits, so an import below heap_base wraps. | 136 | // Debug-only inverse lookup. V#s retain 48 bits, so an import below heap_base wraps. |
| 117 | bool source_of_vsharp(std::uint64_t base, std::uint64_t& title, std::uint64_t& available) const { | 137 | bool source_of_vsharp(std::uint64_t base, std::uint64_t& title, std::uint64_t& available) const { |
| 118 | constexpr std::uint64_t mask = (1ull << 48) - 1; | 138 | constexpr std::uint64_t mask = (1ull << 48) - 1; |
| @@ -208,11 +228,15 @@ public: | |||
| 208 | it = memory_.erase(it); | 228 | it = memory_.erase(it); |
| 209 | } | 229 | } |
| 210 | memory_[begin] = end; | 230 | memory_[begin] = end; |
| 231 | memory_generation_.fetch_add(1, std::memory_order_release); | ||
| 211 | } | 232 | } |
| 212 | void remove_title_memory(std::uint64_t base) { | 233 | void remove_title_memory(std::uint64_t base) { |
| 213 | std::unique_lock lock(memory_mutex_); | 234 | std::unique_lock lock(memory_mutex_); |
| 214 | memory_.erase(base); | 235 | memory_.erase(base); |
| 236 | memory_generation_.fetch_add(1, std::memory_order_release); | ||
| 215 | } | 237 | } |
| 238 | // Bumped whenever title_memory_ranges() changes. | ||
| 239 | std::uint64_t memory_generation() const { return memory_generation_.load(std::memory_order_acquire); } | ||
| 216 | // LOCAL DIAGNOSTIC (mem probe): every title range, [begin, end), in address order. | 240 | // LOCAL DIAGNOSTIC (mem probe): every title range, [begin, end), in address order. |
| 217 | std::vector<std::pair<std::uint64_t, std::uint64_t>> title_memory_ranges() const { | 241 | std::vector<std::pair<std::uint64_t, std::uint64_t>> title_memory_ranges() const { |
| 218 | std::shared_lock lock(memory_mutex_); | 242 | std::shared_lock lock(memory_mutex_); |
| @@ -314,6 +338,34 @@ public: | |||
| 314 | 338 | ||
| 315 | std::size_t size() const { return count_.load(std::memory_order_acquire); } | 339 | std::size_t size() const { return count_.load(std::memory_order_acquire); } |
| 316 | std::uint64_t invalidations() const { return invalidations_.load(std::memory_order_acquire); } | 340 | std::uint64_t invalidations() const { return invalidations_.load(std::memory_order_acquire); } |
| 341 | bool changed_ranges(uint64_t& cursor, DescriptorRanges& ranges) const { | ||
| 342 | std::shared_lock lock(mutex_); | ||
| 343 | return changes_.read(cursor, ranges); | ||
| 344 | } | ||
| 345 | // Bumped by every add and every removal: a copy of mappings() is current while it has not moved. | ||
| 346 | std::uint64_t generation() const { return generation_.load(std::memory_order_acquire); } | ||
| 347 | // Diagnostics (fsdraw): the title VA a shader VA was made from, the reverse of translate; a linear scan. | ||
| 348 | bool title_of_shader(std::uint64_t shader_va, std::uint64_t& title_va, std::uint64_t& range_va, | ||
| 349 | std::uint64_t& range_bytes) const { | ||
| 350 | std::shared_lock lock(mutex_); | ||
| 351 | for (const auto& [va, r] : ranges_) | ||
| 352 | if (shader_va >= r.shader_va && shader_va - r.shader_va < r.end - va) { | ||
| 353 | title_va = va + (shader_va - r.shader_va); | ||
| 354 | range_va = va; | ||
| 355 | range_bytes = r.end - va; | ||
| 356 | return true; | ||
| 357 | } | ||
| 358 | return false; | ||
| 359 | } | ||
| 360 | // LEONIDA_CONSOLE_HEAP_GPU: the shader-VA ranges of the ranges removed (or replaced) since the last take, so a | ||
| 361 | // GPU table translated through them can drop what it derived. Nothing is kept until recording is turned on. | ||
| 362 | void record_removals(bool on) { record_removals_.store(on, std::memory_order_relaxed); } | ||
| 363 | void take_removed(std::vector<std::pair<std::uint64_t, std::uint64_t>>& out) { | ||
| 364 | out.clear(); | ||
| 365 | if (!record_removals_.load(std::memory_order_relaxed)) return; | ||
| 366 | std::unique_lock lock(mutex_); | ||
| 367 | out.swap(removed_); | ||
| 368 | } | ||
| 317 | void note_translation(Kind kind) { translated_[kind].fetch_add(1, std::memory_order_relaxed); } | 369 | void note_translation(Kind kind) { translated_[kind].fetch_add(1, std::memory_order_relaxed); } |
| 318 | std::uint64_t translated(Kind kind) const { return translated_[kind].load(std::memory_order_relaxed); } | 370 | std::uint64_t translated(Kind kind) const { return translated_[kind].load(std::memory_order_relaxed); } |
| 319 | std::uint64_t untranslated(Kind kind) const { return untranslated_[kind].load(std::memory_order_relaxed); } | 371 | std::uint64_t untranslated(Kind kind) const { return untranslated_[kind].load(std::memory_order_relaxed); } |
| @@ -331,13 +383,28 @@ private: | |||
| 331 | if (previous->second.end > begin) it = previous; | 383 | if (previous->second.end > begin) it = previous; |
| 332 | } | 384 | } |
| 333 | if (it != ranges_.end() && it->first < end) invalidations_.fetch_add(1, std::memory_order_release); | 385 | if (it != ranges_.end() && it->first < end) invalidations_.fetch_add(1, std::memory_order_release); |
| 334 | while (it != ranges_.end() && it->first < end) it = ranges_.erase(it); | 386 | while (it != ranges_.end() && it->first < end) { |
| 387 | changes_.record(it->first, it->second.end - it->first); | ||
| 388 | by_shader_.erase(it->second.shader_va, it->first); | ||
| 389 | note_removed(it->second.shader_va, it->second.end - it->first); | ||
| 390 | it = ranges_.erase(it); | ||
| 391 | } | ||
| 392 | } | ||
| 393 | |||
| 394 | // mutex_ held exclusively. | ||
| 395 | void note_removed(std::uint64_t shader_va, std::uint64_t bytes) { | ||
| 396 | if (record_removals_.load(std::memory_order_relaxed)) removed_.push_back({shader_va, bytes}); | ||
| 335 | } | 397 | } |
| 336 | 398 | ||
| 399 | DescriptorRangeChanges changes_; | ||
| 337 | mutable std::shared_mutex mutex_; | 400 | mutable std::shared_mutex mutex_; |
| 338 | std::map<std::uint64_t, Range> ranges_; // by title VA | 401 | std::map<std::uint64_t, Range> ranges_; // by title VA |
| 402 | BufferVaIndex<std::uint64_t> by_shader_; // the same ranges by shader VA (id: the title VA); copies may overlap | ||
| 339 | std::atomic<std::size_t> count_{0}; | 403 | std::atomic<std::size_t> count_{0}; |
| 340 | std::atomic<std::uint64_t> invalidations_{}; | 404 | std::atomic<std::uint64_t> invalidations_{}; |
| 405 | std::atomic<std::uint64_t> generation_{}; | ||
| 406 | std::atomic<bool> record_removals_{false}; | ||
| 407 | std::vector<std::pair<std::uint64_t, std::uint64_t>> removed_; // (shader VA, bytes), when recorded | ||
| 341 | std::mutex hook_mutex_; | 408 | std::mutex hook_mutex_; |
| 342 | void* hook_context_ = nullptr; | 409 | void* hook_context_ = nullptr; |
| 343 | void* maker_context_ = nullptr; | 410 | void* maker_context_ = nullptr; |
| @@ -352,6 +419,7 @@ private: | |||
| 352 | std::atomic<std::uint64_t> scans_{0}, scan_ns_{0}, scan_max_ns_{0}; | 419 | std::atomic<std::uint64_t> scans_{0}, scan_ns_{0}, scan_max_ns_{0}; |
| 353 | mutable std::shared_mutex memory_mutex_; | 420 | mutable std::shared_mutex memory_mutex_; |
| 354 | std::map<std::uint64_t, std::uint64_t> memory_; // the title's memory: base -> end | 421 | std::map<std::uint64_t, std::uint64_t> memory_; // the title's memory: base -> end |
| 422 | std::atomic<std::uint64_t> memory_generation_{}; | ||
| 355 | }; | 423 | }; |
| 356 | 424 | ||
| 357 | // The process's table: the device's title ranges and hooks, read by the command lists and descriptor writers. | 425 | // The process's table: the device's title ranges and hooks, read by the command lists and descriptor writers. |
| @@ -360,12 +428,25 @@ inline TitleVaAliases& title_va_aliases() { | |||
| 360 | return aliases; | 428 | return aliases; |
| 361 | } | 429 | } |
| 362 | 430 | ||
| 363 | // One diagnostic per descriptor-writing path. | 431 | // One diagnostic per descriptor-writing path. Called per descriptor write on the unbacked path, so the sites already |
| 432 | // told (string literals: their addresses) are looked up without the lock first. | ||
| 364 | inline void note_unbacked_view(const char* site, std::uint64_t va, std::uint64_t bytes) { | 433 | inline void note_unbacked_view(const char* site, std::uint64_t va, std::uint64_t bytes) { |
| 434 | static std::atomic<const char*> told[8] = {}; | ||
| 435 | for (const auto& t : told) | ||
| 436 | if (t.load(std::memory_order_relaxed) == site) return; | ||
| 365 | static std::mutex mutex; | 437 | static std::mutex mutex; |
| 366 | static std::map<std::string, bool> sites; | 438 | static std::map<std::string, bool> sites; |
| 367 | { | 439 | { |
| 368 | std::lock_guard lock(mutex); | 440 | std::lock_guard lock(mutex); |
| 441 | for (auto& t : told) { | ||
| 442 | const char* none = nullptr; | ||
| 443 | if (t.load(std::memory_order_relaxed) == site || | ||
| 444 | t.compare_exchange_strong(none, site, std::memory_order_relaxed)) | ||
| 445 | break; | ||
| 446 | } | ||
| 447 | } | ||
| 448 | { | ||
| 449 | std::lock_guard lock(mutex); | ||
| 369 | if (!sites.emplace(site, true).second) return; | 450 | if (!sites.emplace(site, true).second) return; |
| 370 | } | 451 | } |
| 371 | std::fprintf(stderr, "[rt] d3d12: %s: address 0x%llx (%llu bytes) has no GPU copy; zero records\n", | 452 | std::fprintf(stderr, "[rt] d3d12: %s: address 0x%llx (%llu bytes) has no GPU copy; zero records\n", |
diff --git a/runtime/src/vulkan13_features.h b/runtime/src/vulkan13_features.h index 8f2dd61f8..0cb843cef 100644 --- a/runtime/src/vulkan13_features.h +++ b/runtime/src/vulkan13_features.h | |||
| @@ -40,6 +40,9 @@ public: | |||
| 40 | bool subgroup_size_control = false; | 40 | bool subgroup_size_control = false; |
| 41 | bool compute_full_subgroups = false; | 41 | bool compute_full_subgroups = false; |
| 42 | bool extended_dynamic_state = false; // core on 1.3; on 1.2 both VK_EXT_extended_dynamic_state(2) extensions | 42 | bool extended_dynamic_state = false; // core on 1.3; on 1.2 both VK_EXT_extended_dynamic_state(2) extensions |
| 43 | // VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT, asking a pipeline cache "do you have it?" without a | ||
| 44 | // compile (pipeline_cache_journal.h). Core 1.3 only; a 1.2 device goes without. | ||
| 45 | bool pipeline_creation_cache_control = false; | ||
| 43 | 46 | ||
| 44 | bool usable() const { return dynamic_rendering && synchronization2; } | 47 | bool usable() const { return dynamic_rendering && synchronization2; } |
| 45 | 48 | ||
| @@ -49,7 +52,7 @@ public: | |||
| 49 | core = api_version >= VK_API_VERSION_1_3; | 52 | core = api_version >= VK_API_VERSION_1_3; |
| 50 | pipeline_cache_control=false;enable_pipeline_cache_control=false; | 53 | pipeline_cache_control=false;enable_pipeline_cache_control=false; |
| 51 | dynamic_rendering = synchronization2 = subgroup_size_control = compute_full_subgroups = false; | 54 | dynamic_rendering = synchronization2 = subgroup_size_control = compute_full_subgroups = false; |
| 52 | extended_dynamic_state = false; | 55 | extended_dynamic_state = pipeline_creation_cache_control = false; |
| 53 | if (!features2) return; | 56 | if (!features2) return; |
| 54 | if (core) { | 57 | if (core) { |
| 55 | VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; | 58 | VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; |
| @@ -60,6 +63,7 @@ public: | |||
| 60 | synchronization2 = f13.synchronization2 == VK_TRUE; | 63 | synchronization2 = f13.synchronization2 == VK_TRUE; |
| 61 | subgroup_size_control = f13.subgroupSizeControl == VK_TRUE; | 64 | subgroup_size_control = f13.subgroupSizeControl == VK_TRUE; |
| 62 | compute_full_subgroups = f13.computeFullSubgroups == VK_TRUE; | 65 | compute_full_subgroups = f13.computeFullSubgroups == VK_TRUE; |
| 66 | pipeline_creation_cache_control = f13.pipelineCreationCacheControl == VK_TRUE; | ||
| 63 | extended_dynamic_state = true; // core in 1.3, no feature bit | 67 | extended_dynamic_state = true; // core in 1.3, no feature bit |
| 64 | return; | 68 | return; |
| 65 | } | 69 | } |
| @@ -108,6 +112,7 @@ public: | |||
| 108 | subgroup_size_control = from.subgroup_size_control; | 112 | subgroup_size_control = from.subgroup_size_control; |
| 109 | compute_full_subgroups = from.compute_full_subgroups; | 113 | compute_full_subgroups = from.compute_full_subgroups; |
| 110 | extended_dynamic_state = from.extended_dynamic_state; | 114 | extended_dynamic_state = from.extended_dynamic_state; |
| 115 | pipeline_creation_cache_control = from.pipeline_creation_cache_control; | ||
| 111 | } | 116 | } |
| 112 | 117 | ||
| 113 | // The structs that enable both features, ahead of `chain`; returns their head for VkPhysicalDeviceVulkan12Features' | 118 | // The structs that enable both features, ahead of `chain`; returns their head for VkPhysicalDeviceVulkan12Features' |
| @@ -120,6 +125,7 @@ public: | |||
| 120 | enable13_.synchronization2 = VK_TRUE; | 125 | enable13_.synchronization2 = VK_TRUE; |
| 121 | enable13_.subgroupSizeControl = subgroup_size_control ? VK_TRUE : VK_FALSE; | 126 | enable13_.subgroupSizeControl = subgroup_size_control ? VK_TRUE : VK_FALSE; |
| 122 | enable13_.computeFullSubgroups = compute_full_subgroups ? VK_TRUE : VK_FALSE; | 127 | enable13_.computeFullSubgroups = compute_full_subgroups ? VK_TRUE : VK_FALSE; |
| 128 | enable13_.pipelineCreationCacheControl = pipeline_creation_cache_control ? VK_TRUE : VK_FALSE; | ||
| 123 | return &enable13_; | 129 | return &enable13_; |
| 124 | } | 130 | } |
| 125 | if (subgroup_size_control) { | 131 | if (subgroup_size_control) { |
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h index ac84df7a4..4a4d9d485 100644 --- a/runtime/src/vulkan_backend.h +++ b/runtime/src/vulkan_backend.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include "resource_tiling.h" | 30 | #include "resource_tiling.h" |
| 31 | #include "pipeline_profile.h" | 31 | #include "pipeline_profile.h" |
| 32 | #include "submit_phases.h" | 32 | #include "submit_phases.h" |
| 33 | #include "pipeline_wait.h" | ||
| 33 | #include "title_va_alias.h" | 34 | #include "title_va_alias.h" |
| 34 | #include "xdxr_build.h" | 35 | #include "xdxr_build.h" |
| 35 | 36 | ||
| @@ -124,13 +125,14 @@ struct VulkanDeviceFunctions { | |||
| 124 | X(vkCmdPushConstants) X(vkCmdDispatch) \ | 125 | X(vkCmdPushConstants) X(vkCmdDispatch) \ |
| 125 | X(vkCmdBindVertexBuffers2) X(vkCmdBindIndexBuffer) X(vkCmdSetViewport) X(vkCmdSetScissor) \ | 126 | X(vkCmdBindVertexBuffers2) X(vkCmdBindIndexBuffer) X(vkCmdSetViewport) X(vkCmdSetScissor) \ |
| 126 | X(vkCmdSetViewportWithCount) X(vkCmdSetScissorWithCount) \ | 127 | X(vkCmdSetViewportWithCount) X(vkCmdSetScissorWithCount) \ |
| 127 | X(vkCmdSetPrimitiveTopology) X(vkCmdSetPrimitiveRestartEnable) X(vkCmdSetStencilReference) \ | 128 | X(vkCmdSetPrimitiveTopology) X(vkCmdSetPrimitiveRestartEnable) X(vkCmdSetStencilReference) X(vkCmdSetDepthBounds) \ |
| 128 | X(vkCmdSetBlendConstants) X(vkCmdDraw) \ | 129 | X(vkCmdSetBlendConstants) X(vkCmdDraw) \ |
| 129 | X(vkCmdDrawIndexed) X(vkCreateGraphicsPipelines) X(vkQueueBindSparse) X(vkGetImageSparseMemoryRequirements) \ | 130 | X(vkCmdDrawIndexed) X(vkCreateGraphicsPipelines) X(vkQueueBindSparse) X(vkGetImageSparseMemoryRequirements) \ |
| 130 | X(vkCreatePipelineCache) X(vkDestroyPipelineCache) X(vkGetPipelineCacheData) X(vkMergePipelineCaches) \ | 131 | X(vkCreatePipelineCache) X(vkDestroyPipelineCache) X(vkGetPipelineCacheData) X(vkMergePipelineCaches) \ |
| 131 | X(vkCreateEvent) X(vkDestroyEvent) X(vkResetEvent) X(vkCmdSetEvent) X(vkCmdWaitEvents) X(vkCmdDrawMeshTasksEXT) \ | 132 | X(vkCreateEvent) X(vkDestroyEvent) X(vkResetEvent) X(vkCmdSetEvent) X(vkCmdWaitEvents) X(vkCmdDrawMeshTasksEXT) X(vkCmdDrawMeshTasksIndirectEXT) X(vkCmdDrawMeshTasksIndirectCountEXT) \ |
| 132 | X(vkCreateRenderPass2) X(vkDestroyRenderPass) X(vkCreateFramebuffer) X(vkDestroyFramebuffer) \ | 133 | X(vkCreateRenderPass2) X(vkDestroyRenderPass) X(vkCreateFramebuffer) X(vkDestroyFramebuffer) \ |
| 133 | X(vkCmdBeginRenderPass) X(vkCmdEndRenderPass) | 134 | X(vkCmdBeginRenderPass) X(vkCmdEndRenderPass) \ |
| 135 | X(vkCmdBeginQueryIndexedEXT) X(vkCmdEndQueryIndexedEXT) | ||
| 134 | #define LEONIDA_VK_MEMBER(name) PFN_##name name = nullptr; | 136 | #define LEONIDA_VK_MEMBER(name) PFN_##name name = nullptr; |
| 135 | LEONIDA_VK_DEVICE_FUNCTIONS(LEONIDA_VK_MEMBER) | 137 | LEONIDA_VK_DEVICE_FUNCTIONS(LEONIDA_VK_MEMBER) |
| 136 | #undef LEONIDA_VK_MEMBER | 138 | #undef LEONIDA_VK_MEMBER |
| @@ -165,6 +167,9 @@ struct VulkanDeviceFunctions { | |||
| 165 | return vkCmdBeginRendering && vkCmdEndRendering && vkCmdBindVertexBuffers2 && vkCmdSetPrimitiveTopology && | 167 | return vkCmdBeginRendering && vkCmdEndRendering && vkCmdBindVertexBuffers2 && vkCmdSetPrimitiveTopology && |
| 166 | vkCmdSetPrimitiveRestartEnable; | 168 | vkCmdSetPrimitiveRestartEnable; |
| 167 | } | 169 | } |
| 170 | // VK_EXT_transform_feedback is enabled on the device: the indexed-query entry points are loaded, so an | ||
| 171 | // SO_STATISTICS heap can be a real transform-feedback pool (D3D-302). | ||
| 172 | bool transform_feedback = false; | ||
| 168 | }; | 173 | }; |
| 169 | 174 | ||
| 170 | // Both kinds of compute resolve use the same storage buffer, descriptor set and pipeline layout. | 175 | // Both kinds of compute resolve use the same storage buffer, descriptor set and pipeline layout. |
| @@ -618,6 +623,8 @@ inline Stats& stats(int kind) { | |||
| 618 | static Stats s[3]; | 623 | static Stats s[3]; |
| 619 | return s[kind < 0 || kind > 2 ? 0 : kind]; | 624 | return s[kind < 0 || kind > 2 ? 0 : kind]; |
| 620 | } | 625 | } |
| 626 | inline void held_tick(int kind); // below: the held-operations line, due on the same 10 s | ||
| 627 | |||
| 621 | inline void done(int kind, std::chrono::steady_clock::time_point submitted) { | 628 | inline void done(int kind, std::chrono::steady_clock::time_point submitted) { |
| 622 | using clock = std::chrono::steady_clock; | 629 | using clock = std::chrono::steady_clock; |
| 623 | const auto now = clock::now(); | 630 | const auto now = clock::now(); |
| @@ -641,36 +648,66 @@ inline void done(int kind, std::chrono::steady_clock::time_point submitted) { | |||
| 641 | s.sum_ms = s.max_ms = s.busy_ms = 0; | 648 | s.sum_ms = s.max_ms = s.busy_ms = 0; |
| 642 | s.since = now; | 649 | s.since = now; |
| 643 | } | 650 | } |
| 651 | held_tick(kind); | ||
| 644 | } | 652 | } |
| 645 | // A held queue operation (Wait before Signal), released: how long it waited on the CPU before it could run. | 653 | // A held queue operation (Wait before Signal), released: how long it waited on the CPU before it could run. |
| 646 | inline void held(int kind, int op, std::chrono::steady_clock::time_point at) { | 654 | // A held queue operation (Wait before Signal), released: how long it waited on the CPU before it could run, and for |
| 655 | // the longest one of the window the fence (semaphore handle) and value it waited for, so the slow signaller can be | ||
| 656 | // named. The line is due every 10 s: held() prints it, and so does done() (held_tick), so a window with nothing | ||
| 657 | // released still reports. | ||
| 658 | struct HeldStats { | ||
| 659 | std::mutex mutex; | ||
| 660 | std::uint64_t count[3] = {}; | ||
| 661 | double sum_ms = 0, max_ms = 0; | ||
| 662 | std::uint64_t max_fence = 0, max_value = 0; | ||
| 663 | int max_op = 0; | ||
| 664 | std::chrono::steady_clock::time_point since = std::chrono::steady_clock::now(); | ||
| 665 | }; | ||
| 666 | inline HeldStats& held_stats(int kind) { | ||
| 667 | static HeldStats h[3]; | ||
| 668 | return h[kind < 0 || kind > 2 ? 0 : kind]; | ||
| 669 | } | ||
| 670 | // held_stats(kind).mutex held. | ||
| 671 | inline void held_report_locked(int kind, HeldStats& s, std::chrono::steady_clock::time_point now) { | ||
| 672 | if (now - s.since < std::chrono::seconds(10)) return; | ||
| 673 | const std::uint64_t all = s.count[0] + s.count[1] + s.count[2]; | ||
| 674 | std::fprintf(stderr, "[rt] gpu latency (%s): %llu held operations released in %.0f s (%llu batches, %llu " | ||
| 675 | "signals, %llu markers), held %.2f ms on average, %.1f ms the longest", | ||
| 676 | kind == 0 ? "direct" : kind == 1 ? "compute" : "copy", static_cast<unsigned long long>(all), | ||
| 677 | std::chrono::duration<double>(now - s.since).count(), static_cast<unsigned long long>(s.count[0]), | ||
| 678 | static_cast<unsigned long long>(s.count[1]), static_cast<unsigned long long>(s.count[2]), | ||
| 679 | all ? s.sum_ms / double(all) : 0.0, s.max_ms); | ||
| 680 | if (all && s.max_fence) | ||
| 681 | std::fprintf(stderr, " (a %s waiting for fence 0x%llx value %llu)", | ||
| 682 | s.max_op == 0 ? "batch" : s.max_op == 1 ? "Signal" : "marker", | ||
| 683 | static_cast<unsigned long long>(s.max_fence), static_cast<unsigned long long>(s.max_value)); | ||
| 684 | std::fputc('\n', stderr); | ||
| 685 | s.count[0] = s.count[1] = s.count[2] = 0; | ||
| 686 | s.sum_ms = s.max_ms = 0; | ||
| 687 | s.max_fence = s.max_value = 0; | ||
| 688 | s.since = now; | ||
| 689 | } | ||
| 690 | inline void held(int kind, int op, std::chrono::steady_clock::time_point at, std::uint64_t fence = 0, | ||
| 691 | std::uint64_t value = 0) { | ||
| 647 | using clock = std::chrono::steady_clock; | 692 | using clock = std::chrono::steady_clock; |
| 648 | struct Held { | 693 | HeldStats& s = held_stats(kind); |
| 649 | std::mutex mutex; | ||
| 650 | std::uint64_t count[3] = {}; | ||
| 651 | double sum_ms = 0, max_ms = 0; | ||
| 652 | clock::time_point since = clock::now(); | ||
| 653 | }; | ||
| 654 | static Held h[3]; | ||
| 655 | Held& s = h[kind < 0 || kind > 2 ? 0 : kind]; | ||
| 656 | const auto now = clock::now(); | 694 | const auto now = clock::now(); |
| 657 | const double ms = std::chrono::duration<double, std::milli>(now - at).count(); | 695 | const double ms = std::chrono::duration<double, std::milli>(now - at).count(); |
| 658 | std::lock_guard lock(s.mutex); | 696 | std::lock_guard lock(s.mutex); |
| 659 | ++s.count[op < 0 || op > 2 ? 0 : op]; | 697 | ++s.count[op < 0 || op > 2 ? 0 : op]; |
| 660 | s.sum_ms += ms; | 698 | s.sum_ms += ms; |
| 661 | s.max_ms = (std::max)(s.max_ms, ms); | 699 | if (ms > s.max_ms) { |
| 662 | if (now - s.since >= std::chrono::seconds(10)) { | 700 | s.max_ms = ms; |
| 663 | const std::uint64_t all = s.count[0] + s.count[1] + s.count[2]; | 701 | s.max_fence = fence; |
| 664 | std::fprintf(stderr, "[rt] gpu latency (%s): %llu held operations released in %.0f s (%llu batches, %llu " | 702 | s.max_value = value; |
| 665 | "signals, %llu markers), held %.2f ms on average, %.1f ms the longest\n", | 703 | s.max_op = op; |
| 666 | kind == 0 ? "direct" : kind == 1 ? "compute" : "copy", static_cast<unsigned long long>(all), | ||
| 667 | std::chrono::duration<double>(now - s.since).count(), static_cast<unsigned long long>(s.count[0]), | ||
| 668 | static_cast<unsigned long long>(s.count[1]), static_cast<unsigned long long>(s.count[2]), | ||
| 669 | all ? s.sum_ms / double(all) : 0.0, s.max_ms); | ||
| 670 | s.count[0] = s.count[1] = s.count[2] = 0; | ||
| 671 | s.sum_ms = s.max_ms = 0; | ||
| 672 | s.since = now; | ||
| 673 | } | 704 | } |
| 705 | held_report_locked(kind, s, now); | ||
| 706 | } | ||
| 707 | inline void held_tick(int kind) { | ||
| 708 | HeldStats& s = held_stats(kind); | ||
| 709 | std::lock_guard lock(s.mutex); | ||
| 710 | held_report_locked(kind, s, std::chrono::steady_clock::now()); | ||
| 674 | } | 711 | } |
| 675 | } // namespace gpu_latency | 712 | } // namespace gpu_latency |
| 676 | 713 | ||
| @@ -1090,6 +1127,8 @@ public: | |||
| 1090 | GraphicsIndirectCapabilities indirect = {}) | 1127 | GraphicsIndirectCapabilities indirect = {}) |
| 1091 | : device_(device), tracker_(separate_depth_stencil_layouts), ray_tracing_(ray_tracing) { | 1128 | : device_(device), tracker_(separate_depth_stencil_layouts), ray_tracing_(ray_tracing) { |
| 1092 | loaded_ = vk.load(get, device); | 1129 | loaded_ = vk.load(get, device); |
| 1130 | // VK_EXT_transform_feedback: enabled on the device when its indexed-query entry points resolved (D3D-302). | ||
| 1131 | vk.transform_feedback = vk.vkCmdBeginQueryIndexedEXT && vk.vkCmdEndQueryIndexedEXT; | ||
| 1093 | if (loaded_ && gpu_labels_.initialize(device, get)) { | 1132 | if (loaded_ && gpu_labels_.initialize(device, get)) { |
| 1094 | replay_.gpu_label = [this](VkCommandBuffer cb, const label::Write& write) { gpu_labels_.record(cb, write); }; | 1133 | replay_.gpu_label = [this](VkCommandBuffer cb, const label::Write& write) { gpu_labels_.record(cb, write); }; |
| 1095 | } | 1134 | } |
| @@ -1125,6 +1164,11 @@ public: | |||
| 1125 | replay_.reset_query_pool = vk.vkCmdResetQueryPool; | 1164 | replay_.reset_query_pool = vk.vkCmdResetQueryPool; |
| 1126 | replay_.begin_query = vk.vkCmdBeginQuery; | 1165 | replay_.begin_query = vk.vkCmdBeginQuery; |
| 1127 | replay_.end_query = vk.vkCmdEndQuery; | 1166 | replay_.end_query = vk.vkCmdEndQuery; |
| 1167 | // VK_EXT_transform_feedback (D3D-302), loaded when the device enabled it: indexed SO_STATISTICS queries. | ||
| 1168 | if (vk.transform_feedback) { | ||
| 1169 | replay_.begin_query_indexed = vk.vkCmdBeginQueryIndexedEXT; | ||
| 1170 | replay_.end_query_indexed = vk.vkCmdEndQueryIndexedEXT; | ||
| 1171 | } | ||
| 1128 | replay_.write_timestamp = vk.vkCmdWriteTimestamp; | 1172 | replay_.write_timestamp = vk.vkCmdWriteTimestamp; |
| 1129 | replay_.copy_query_pool_results = vk.vkCmdCopyQueryPoolResults; | 1173 | replay_.copy_query_pool_results = vk.vkCmdCopyQueryPoolResults; |
| 1130 | replay_.bind_pipeline = vk.vkCmdBindPipeline; | 1174 | replay_.bind_pipeline = vk.vkCmdBindPipeline; |
| @@ -1148,8 +1192,11 @@ public: | |||
| 1148 | replay_.set_primitive_restart_enable = vk.vkCmdSetPrimitiveRestartEnable; | 1192 | replay_.set_primitive_restart_enable = vk.vkCmdSetPrimitiveRestartEnable; |
| 1149 | replay_.set_stencil_reference = vk.vkCmdSetStencilReference; | 1193 | replay_.set_stencil_reference = vk.vkCmdSetStencilReference; |
| 1150 | replay_.set_blend_constants = vk.vkCmdSetBlendConstants; | 1194 | replay_.set_blend_constants = vk.vkCmdSetBlendConstants; |
| 1195 | replay_.set_depth_bounds = vk.vkCmdSetDepthBounds; | ||
| 1151 | replay_.draw = vk.vkCmdDraw; | 1196 | replay_.draw = vk.vkCmdDraw; |
| 1152 | replay_.draw_mesh_tasks = vk.vkCmdDrawMeshTasksEXT; // null unless VK_EXT_mesh_shader is enabled | 1197 | replay_.draw_mesh_tasks = vk.vkCmdDrawMeshTasksEXT; // null unless VK_EXT_mesh_shader is enabled |
| 1198 | replay_.draw_mesh_tasks_indirect = vk.vkCmdDrawMeshTasksIndirectEXT; | ||
| 1199 | replay_.draw_mesh_tasks_indirect_count = vk.vkCmdDrawMeshTasksIndirectCountEXT; | ||
| 1153 | replay_.draw_indexed = vk.vkCmdDrawIndexed; | 1200 | replay_.draw_indexed = vk.vkCmdDrawIndexed; |
| 1154 | replay_.graphics_pipeline = [this](std::uintptr_t id) -> const GraphicsPipeline* { | 1201 | replay_.graphics_pipeline = [this](std::uintptr_t id) -> const GraphicsPipeline* { |
| 1155 | const auto it = graphics_pipelines_.find(id); | 1202 | const auto it = graphics_pipelines_.find(id); |
| @@ -1280,6 +1327,7 @@ public: | |||
| 1280 | 1327 | ||
| 1281 | void configure_device_fault(PFN_vkGetDeviceProcAddr get, DeviceFaultExtensions enabled) { | 1328 | void configure_device_fault(PFN_vkGetDeviceProcAddr get, DeviceFaultExtensions enabled) { |
| 1282 | device_fault_ = std::make_unique<DeviceFaultDiagnostics>(get, device_, enabled); | 1329 | device_fault_ = std::make_unique<DeviceFaultDiagnostics>(get, device_, enabled); |
| 1330 | device_fault_->set_submit_lock(&submit_mutex_); | ||
| 1283 | if (fence_dispatcher_) fence_dispatcher_->set_device_fault(device_fault_.get()); | 1331 | if (fence_dispatcher_) fence_dispatcher_->set_device_fault(device_fault_.get()); |
| 1284 | if (loaded_) progress_watch_ = std::jthread([this](std::stop_token stop) { watch_queue_progress(stop); }); | 1332 | if (loaded_) progress_watch_ = std::jthread([this](std::stop_token stop) { watch_queue_progress(stop); }); |
| 1285 | } | 1333 | } |
| @@ -1329,12 +1377,16 @@ public: | |||
| 1329 | const VkPhysicalDeviceLimits& limits, ScratchBuffers::Allocate allocate, | 1377 | const VkPhysicalDeviceLimits& limits, ScratchBuffers::Allocate allocate, |
| 1330 | std::vector<std::uint32_t> families = {}) { | 1378 | std::vector<std::uint32_t> families = {}) { |
| 1331 | std::unique_lock lock(resource_mutex_); | 1379 | std::unique_lock lock(resource_mutex_); |
| 1380 | // An enabled clamp is required: a call whose scratch preparation fails is refused (unsupported) instead of | ||
| 1381 | // reading the application's argument buffer, which may hold a record no compute pass wrote. Off, or on a | ||
| 1382 | // device the pass cannot run on, the replay keeps the application's buffer as before. | ||
| 1332 | replay_.require_indirect_clamp = indirect_clamp_enabled(); | 1383 | replay_.require_indirect_clamp = indirect_clamp_enabled(); |
| 1333 | if (!replay_.require_indirect_clamp) return; | 1384 | if (!replay_.require_indirect_clamp) return; |
| 1334 | indirect_clamp_ = std::make_unique<IndirectArgumentClamp>(get, device_, memory, limits, std::move(allocate), | 1385 | indirect_clamp_ = std::make_unique<IndirectArgumentClamp>(get, device_, memory, limits, std::move(allocate), |
| 1335 | device_fault_.get(), std::move(families)); | 1386 | device_fault_.get(), std::move(families)); |
| 1336 | if (!indirect_clamp_->loaded()) { | 1387 | if (!indirect_clamp_->loaded()) { |
| 1337 | indirect_clamp_.reset(); | 1388 | indirect_clamp_.reset(); |
| 1389 | replay_.require_indirect_clamp = false; | ||
| 1338 | return; | 1390 | return; |
| 1339 | } | 1391 | } |
| 1340 | // The preparation callback needs this submission's counter-slot batch, so it is set per ExecuteCommandLists | 1392 | // The preparation callback needs this submission's counter-slot batch, so it is set per ExecuteCommandLists |
| @@ -1546,32 +1598,42 @@ public: | |||
| 1546 | } | 1598 | } |
| 1547 | 1599 | ||
| 1548 | // Pipelines are registered by an opaque id (the PSO object) for as long as the PSO lives. | 1600 | // Pipelines are registered by an opaque id (the PSO object) for as long as the PSO lives. |
| 1601 | // Guarded by pipeline_mutex_ (separate from resource_mutex_) so shader compilation on one queue does not block | ||
| 1602 | // resource registration or destruction on the render thread. | ||
| 1549 | void add_pipeline(std::uintptr_t id, const ComputePipeline& pipeline, const char* shader = nullptr) { | 1603 | void add_pipeline(std::uintptr_t id, const ComputePipeline& pipeline, const char* shader = nullptr) { |
| 1550 | std::unique_lock lock(resource_mutex_); | 1604 | std::unique_lock lock(pipeline_mutex_); |
| 1551 | pipelines_[id] = pipeline; | 1605 | pipelines_[id] = pipeline; |
| 1552 | if (shader && device_fault_) device_fault_->pipeline_names[id] = {shader}; | 1606 | if (shader && device_fault_) device_fault_->pipeline_names[id] = {shader}; |
| 1553 | } | 1607 | } |
| 1554 | void remove_pipeline(std::uintptr_t id) { | 1608 | void remove_pipeline(std::uintptr_t id) { |
| 1555 | std::unique_lock lock(resource_mutex_); | 1609 | std::unique_lock lock(pipeline_mutex_); |
| 1556 | pipelines_.erase(id); | 1610 | pipelines_.erase(id); |
| 1557 | graphics_pipelines_.erase(id); | 1611 | graphics_pipelines_.erase(id); |
| 1558 | if (device_fault_) device_fault_->pipeline_names.erase(id); | 1612 | if (device_fault_) device_fault_->pipeline_names.erase(id); |
| 1559 | } | 1613 | } |
| 1560 | void add_graphics_pipeline(std::uintptr_t id, const GraphicsPipeline& pipeline, | 1614 | void add_graphics_pipeline(std::uintptr_t id, const GraphicsPipeline& pipeline, |
| 1561 | const CheckpointShaders* shaders = nullptr) { | 1615 | const CheckpointShaders* shaders = nullptr) { |
| 1562 | std::unique_lock lock(resource_mutex_); | 1616 | std::unique_lock lock(pipeline_mutex_); |
| 1563 | graphics_pipelines_[id] = pipeline; | 1617 | graphics_pipelines_[id] = pipeline; |
| 1564 | if (shaders && device_fault_) device_fault_->pipeline_names[id] = *shaders; | 1618 | if (shaders && device_fault_) device_fault_->pipeline_names[id] = *shaders; |
| 1565 | } | 1619 | } |
| 1566 | // Workers for the pipelines a submission needs and that are not built yet. Null (the default): each is built where | 1620 | // Workers for the pipelines a submission needs and that are not built yet. Null (the default): compiled serially on |
| 1567 | // prepare() meets it, on the submitting thread. Replacing it waits for submissions that are compiling, and ends the | 1621 | // the submitting thread once resource_mutex_ is released. Replacing it waits for submissions that are compiling, and |
| 1568 | // workers it had. | 1622 | // ends the workers it had. |
| 1569 | void set_pipeline_workers(std::unique_ptr<PipelineWorkers> workers) { | 1623 | void set_pipeline_workers(std::unique_ptr<PipelineWorkers> workers) { |
| 1570 | std::unique_lock lock(resource_mutex_); | 1624 | std::unique_lock lock(pipeline_mutex_); |
| 1571 | pipeline_workers_.swap(workers); | 1625 | pipeline_workers_.swap(workers); |
| 1572 | } | 1626 | } |
| 1627 | // For the large pipelines of a submission: the memory they may use while they compile together | ||
| 1628 | // (PipelineCompiles::build), and what is kept while they do (LargeModuleGate::Demand). None (the default): they compile | ||
| 1629 | // one after another. | ||
| 1630 | void set_large_compiles(std::function<std::uint64_t()> budget, std::function<std::shared_ptr<void>()> demand) { | ||
| 1631 | std::unique_lock lock(pipeline_mutex_); | ||
| 1632 | large_compile_budget_ = std::move(budget); | ||
| 1633 | large_compile_demand_ = std::move(demand); | ||
| 1634 | } | ||
| 1573 | PipelineWorkers::Stats pipeline_worker_stats() { | 1635 | PipelineWorkers::Stats pipeline_worker_stats() { |
| 1574 | std::shared_lock lock(resource_mutex_); | 1636 | std::shared_lock lock(pipeline_mutex_); |
| 1575 | return pipeline_workers_ ? pipeline_workers_->stats() : PipelineWorkers::Stats{}; | 1637 | return pipeline_workers_ ? pipeline_workers_->stats() : PipelineWorkers::Stats{}; |
| 1576 | } | 1638 | } |
| 1577 | // Configure before queue creation, when the selected queue family supports compute. | 1639 | // Configure before queue creation, when the selected queue family supports compute. |
| @@ -1585,6 +1647,44 @@ public: | |||
| 1585 | return host_texture_stats_; | 1647 | return host_texture_stats_; |
| 1586 | } | 1648 | } |
| 1587 | 1649 | ||
| 1650 | // LOCAL FIX (deadlock on the first-run pages): the texture writes below used vkDeviceWaitIdle with the submit | ||
| 1651 | // lock held. The device is idle only once every queue has run all it was given, and a queue whose submitted | ||
| 1652 | // work waits on a value a later submission signals never gets there while this thread keeps the lock: a native | ||
| 1653 | // boot sat 270 s in vkDeviceWaitIdle (title staging), then lost the device. Instead: wait for the queue | ||
| 1654 | // timelines to pass what was submitted so far, at most `timeout`; on VK_TIMEOUT the caller skips this write (the | ||
| 1655 | // title-texture pass tries it again) rather than freeze the title. Not covered, unlike the device wait: present | ||
| 1656 | // and probe submissions, which have their own fences outside the retirement timelines (a present reading the | ||
| 1657 | // image). The staged write is ordered behind them anyway (same queue, an ALL_COMMANDS barrier); the host copy | ||
| 1658 | // is not, so a presented title texture can be written while a present still reads it (a torn frame, no fault). | ||
| 1659 | // With submit_mutex_ held. | ||
| 1660 | VkResult wait_submitted_locked(std::uint64_t timeout_ns, const char* what) { | ||
| 1661 | if (is_device_lost()) return VK_ERROR_DEVICE_LOST; // a queue's timeline may be gone already | ||
| 1662 | const auto pending = retire_tickets_.pending_through(submitted_ticket_.load(std::memory_order_acquire)); | ||
| 1663 | if (pending.empty()) return VK_SUCCESS; | ||
| 1664 | std::vector<VkSemaphore> semaphores; | ||
| 1665 | std::vector<std::uint64_t> values; | ||
| 1666 | for (const auto& [semaphore, value] : pending) { | ||
| 1667 | semaphores.push_back(semaphore); | ||
| 1668 | values.push_back(value); | ||
| 1669 | } | ||
| 1670 | VkSemaphoreWaitInfo wait{VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO}; | ||
| 1671 | wait.semaphoreCount = std::uint32_t(semaphores.size()); | ||
| 1672 | wait.pSemaphores = semaphores.data(); | ||
| 1673 | wait.pValues = values.data(); | ||
| 1674 | const VkResult r = observe_result(vk.vkWaitSemaphores(device_, &wait, timeout_ns), what); | ||
| 1675 | if (r == VK_TIMEOUT) { | ||
| 1676 | static std::atomic<std::uint64_t> timeouts{0}; | ||
| 1677 | const std::uint64_t n = timeouts.fetch_add(1, std::memory_order_relaxed) + 1; | ||
| 1678 | if (!(n & (n - 1))) | ||
| 1679 | std::fprintf(stderr, "[rt] vulkan: %s: submitted work not done within %llu ms (%llu time(s)); the " | ||
| 1680 | "write is skipped this time\n", what, | ||
| 1681 | static_cast<unsigned long long>(timeout_ns / 1000000), static_cast<unsigned long long>(n)); | ||
| 1682 | } | ||
| 1683 | return r; | ||
| 1684 | } | ||
| 1685 | // Short: a timeout is certain when the awaited work needs this thread's lock, and the write is only skipped. | ||
| 1686 | static constexpr std::uint64_t kTitleWriteWaitNs = 250'000'000; // 250 ms | ||
| 1687 | |||
| 1588 | // CPU writes to a title texture have no application fence. Prevent another queue from | 1688 | // CPU writes to a title texture have no application fence. Prevent another queue from |
| 1589 | // claiming a new layout or submitting work between the completion check and the host copy. | 1689 | // claiming a new layout or submitting work between the completion check and the host copy. |
| 1590 | // An unsatisfied console Wait lives in QueueHolds, outside the Vulkan queues. | 1690 | // An unsatisfied console Wait lives in QueueHolds, outside the Vulkan queues. |
| @@ -1595,7 +1695,13 @@ public: | |||
| 1595 | if (tracker_.layout(id, subresource) != VK_IMAGE_LAYOUT_GENERAL) return VK_NOT_READY; | 1695 | if (tracker_.layout(id, subresource) != VK_IMAGE_LAYOUT_GENERAL) return VK_NOT_READY; |
| 1596 | if (image_work_pending_) { | 1696 | if (image_work_pending_) { |
| 1597 | ++host_texture_stats_.waits; | 1697 | ++host_texture_stats_.waits; |
| 1598 | const auto result = observe_result(vk.vkDeviceWaitIdle(device_), "vkDeviceWaitIdle (title texture upload)"); | 1698 | // A device wait is a queue operation: it passes the compile gate, so it never waits in the driver behind a |
| 1699 | // long pipeline create (the starved wait that loses the device after 10 s). | ||
| 1700 | const SubmitMutex::SubmitTurn turn(submit_mutex_); | ||
| 1701 | const auto result = wait_submitted_locked(kTitleWriteWaitNs, "vkWaitSemaphores (title texture upload)"); | ||
| 1702 | // Not done in time: VK_NOT_READY, so the caller takes its staged path (ordered on the queue) or tries | ||
| 1703 | // again later, and the skip is not counted as a failed fill. | ||
| 1704 | if (result == VK_TIMEOUT) return VK_NOT_READY; | ||
| 1599 | if (result != VK_SUCCESS) return result; | 1705 | if (result != VK_SUCCESS) return result; |
| 1600 | image_work_pending_ = false; | 1706 | image_work_pending_ = false; |
| 1601 | } | 1707 | } |
| @@ -1613,7 +1719,8 @@ public: | |||
| 1613 | LayoutPieces pieces; | 1719 | LayoutPieces pieces; |
| 1614 | if (!tracker_.pieces(id, range, pieces) || pieces.empty()) return VK_ERROR_UNKNOWN; | 1720 | if (!tracker_.pieces(id, range, pieces) || pieces.empty()) return VK_ERROR_UNKNOWN; |
| 1615 | if (image_work_pending_) { | 1721 | if (image_work_pending_) { |
| 1616 | const auto r = observe_result(vk.vkDeviceWaitIdle(device_), "vkDeviceWaitIdle (title staging)"); | 1722 | const SubmitMutex::SubmitTurn turn(submit_mutex_); // a queue operation: the compile gate (as above) |
| 1723 | const auto r = wait_submitted_locked(kTitleWriteWaitNs, "vkWaitSemaphores (title staging)"); | ||
| 1617 | if (r != VK_SUCCESS) return r; | 1724 | if (r != VK_SUCCESS) return r; |
| 1618 | image_work_pending_ = false; | 1725 | image_work_pending_ = false; |
| 1619 | } | 1726 | } |
| @@ -1738,7 +1845,6 @@ public: | |||
| 1738 | // `before` is called at the start of every submission of command lists (a held batch: when it is released), | 1845 | // `before` is called at the start of every submission of command lists (a held batch: when it is released), |
| 1739 | // before any lock here is taken: the device re-copies its slot-133 shadow buffers from the title's pages there. | 1846 | // before any lock here is taken: the device re-copies its slot-133 shadow buffers from the title's pages there. |
| 1740 | // Set once, before the first queue exists. | 1847 | // Set once, before the first queue exists. |
| 1741 | void set_before_execute(std::function<void()> before) { before_execute_ = std::move(before); } | ||
| 1742 | 1848 | ||
| 1743 | // Table VAs are offsets in this device's arena. Install its scanner before creating any queues. | 1849 | // Table VAs are offsets in this device's arena. Install its scanner before creating any queues. |
| 1744 | // (The per-device scan is from the patch descriptor-table-refresh, part 2, of | 1850 | // (The per-device scan is from the patch descriptor-table-refresh, part 2, of |
| @@ -1775,11 +1881,22 @@ public: | |||
| 1775 | return true; | 1881 | return true; |
| 1776 | } | 1882 | } |
| 1777 | const char* diagnostic_compute_name(std::uintptr_t id) { | 1883 | const char* diagnostic_compute_name(std::uintptr_t id) { |
| 1778 | std::shared_lock lock(resource_mutex_); | 1884 | std::shared_lock lock(pipeline_mutex_); |
| 1779 | if (!device_fault_) return nullptr; | 1885 | if (!device_fault_) return nullptr; |
| 1780 | const auto it = device_fault_->pipeline_names.find(id); | 1886 | const auto it = device_fault_->pipeline_names.find(id); |
| 1781 | return it == device_fault_->pipeline_names.end() ? nullptr : it->second[0]; | 1887 | return it == device_fault_->pipeline_names.end() ? nullptr : it->second[0]; |
| 1782 | } | 1888 | } |
| 1889 | void set_before_execute(std::function<void()> before) { before_execute_ = std::move(before); } | ||
| 1890 | // GPU work the lists of a submission depend on, recorded at the start of its command buffer by a queue that can | ||
| 1891 | // run compute (the console heap translation pass, src/console_heap_gpu.h): `record` returns true when it recorded | ||
| 1892 | // something, and `commit` follows that submit (true: it reached the queue; the ticket is a retire ticket at or | ||
| 1893 | // after it). Every other queue's next submission then waits for that one, as for a bindless table upload: a | ||
| 1894 | // queue that records nothing itself may run lists that read what the pass wrote. Called with tracker_mutex_ | ||
| 1895 | // held, so passes and those waits follow submission order. Set once, before the first queue exists. | ||
| 1896 | void set_prelude(std::function<bool(VkCommandBuffer)> record, std::function<void(bool, std::uint64_t)> commit) { | ||
| 1897 | prelude_record_ = std::move(record); | ||
| 1898 | prelude_commit_ = std::move(commit); | ||
| 1899 | } | ||
| 1783 | 1900 | ||
| 1784 | void set_bindless_prepare(std::function<bool(VkCommandBuffer)> prepare) { | 1901 | void set_bindless_prepare(std::function<bool(VkCommandBuffer)> prepare) { |
| 1785 | std::unique_lock lock(resource_mutex_); | 1902 | std::unique_lock lock(resource_mutex_); |
| @@ -1934,7 +2051,14 @@ public: | |||
| 1934 | VulkanDeviceFunctions vk; | 2051 | VulkanDeviceFunctions vk; |
| 1935 | 2052 | ||
| 1936 | // Vulkan requires external synchronisation of a VkQueue; every D3D12 queue of the device may share one. | 2053 | // Vulkan requires external synchronisation of a VkQueue; every D3D12 queue of the device may share one. |
| 1937 | std::mutex& submit_mutex() { return submit_mutex_; } | 2054 | SubmitMutex& submit_mutex() { return submit_mutex_; } |
| 2055 | |||
| 2056 | // vkQueueSubmit through the compile gate (SubmitMutex::SubmitTurn): it waits here, not in the driver, while a | ||
| 2057 | // pipeline create is in the driver. Called with the submit lock held; the caller observes the result. | ||
| 2058 | VkResult queue_submit(VkQueue queue, std::uint32_t count, const VkSubmitInfo* submits, VkFence fence) { | ||
| 2059 | const SubmitMutex::SubmitTurn turn(submit_mutex_); | ||
| 2060 | return vk.vkQueueSubmit(queue, count, submits, fence); | ||
| 2061 | } | ||
| 1938 | 2062 | ||
| 1939 | void mark_device_lost(const char* where = "a Vulkan call returned VK_ERROR_DEVICE_LOST") noexcept { | 2063 | void mark_device_lost(const char* where = "a Vulkan call returned VK_ERROR_DEVICE_LOST") noexcept { |
| 1940 | set_device_lost(device_lost_, where); | 2064 | set_device_lost(device_lost_, where); |
| @@ -2104,19 +2228,32 @@ private: | |||
| 2104 | using Watch = SubmissionProgressWatch; | 2228 | using Watch = SubmissionProgressWatch; |
| 2105 | Watch watch; | 2229 | Watch watch; |
| 2106 | std::uint64_t retired = 0; | 2230 | std::uint64_t retired = 0; |
| 2231 | std::int64_t reported_hold = -1; | ||
| 2232 | std::int64_t busy_since = -1; | ||
| 2233 | SubmitMutex::GateStats gate_logged; | ||
| 2234 | unsigned tick = 0; | ||
| 2107 | std::mutex timer_mutex; | 2235 | std::mutex timer_mutex; |
| 2108 | std::condition_variable_any timer; | 2236 | std::condition_variable_any timer; |
| 2109 | std::unique_lock timer_lock(timer_mutex); | 2237 | std::unique_lock timer_lock(timer_mutex); |
| 2238 | // LOCAL DIAGNOSTIC (post-load GPU hangs): with the device-fault report on, sample every 250 ms, so a loss the | ||
| 2239 | // driver has already reset is seen (and its checkpoints read) before a watchdog outside kills the process. | ||
| 2240 | const auto period = device_fault_ ? std::chrono::milliseconds(250) : std::chrono::milliseconds(1000); | ||
| 2241 | const unsigned per_10s = unsigned(std::chrono::seconds(10) / period); | ||
| 2110 | while (!stop.stop_requested()) { | 2242 | while (!stop.stop_requested()) { |
| 2111 | timer.wait_for(timer_lock, stop, std::chrono::seconds(1), [] { return false; }); | 2243 | timer.wait_for(timer_lock, stop, period, [] { return false; }); |
| 2112 | if (stop.stop_requested() || is_device_lost()) break; | 2244 | if (stop.stop_requested() || is_device_lost()) break; |
| 2113 | auto state = Watch::State::submit_lock_busy; | 2245 | auto state = Watch::State::submit_lock_busy; |
| 2114 | VkResult result = VK_SUCCESS; | 2246 | VkResult result = VK_SUCCESS; |
| 2115 | std::uint64_t submitted; | 2247 | std::uint64_t submitted; |
| 2116 | { | 2248 | { |
| 2117 | // Keep queue timelines alive as in completed_retire_ticket(). A submit or idle wait | 2249 | // Keep queue timelines alive as in completed_retire_ticket(). A submit or idle wait |
| 2118 | // blocked inside the driver can hold this mutex indefinitely. | 2250 | // blocked inside the driver can hold this mutex indefinitely. Under heavy submission one try finds |
| 2251 | // it busy most of the time: a few more within a millisecond or two. | ||
| 2119 | std::unique_lock lock(submit_mutex_, std::try_to_lock); | 2252 | std::unique_lock lock(submit_mutex_, std::try_to_lock); |
| 2253 | for (int retry = 0; !lock.owns_lock() && retry < 20; ++retry) { | ||
| 2254 | std::this_thread::sleep_for(std::chrono::microseconds(100)); | ||
| 2255 | if (lock.try_lock()) break; | ||
| 2256 | } | ||
| 2120 | submitted = submitted_retire_ticket(); | 2257 | submitted = submitted_retire_ticket(); |
| 2121 | if (lock.owns_lock()) { | 2258 | if (lock.owns_lock()) { |
| 2122 | if (is_device_lost()) break; | 2259 | if (is_device_lost()) break; |
| @@ -2124,12 +2261,49 @@ private: | |||
| 2124 | state = retired < submitted ? Watch::State::pending : Watch::State::idle; | 2261 | state = retired < submitted ? Watch::State::pending : Watch::State::idle; |
| 2125 | } | 2262 | } |
| 2126 | } | 2263 | } |
| 2264 | // LOCAL DIAGNOSTIC (early device loss): a submission unfinished for 4 s dumps the recent submissions with | ||
| 2265 | // their semaphore counters (unreadable once the device is lost); a hold of the submit lock of 3 s names | ||
| 2266 | // its thread and prints its call chain, once per hold. | ||
| 2267 | // A vkQueueSubmit stuck in the driver (measured: 10 s, then VK_ERROR_DEVICE_LOST) also blocks | ||
| 2268 | // vkGetSemaphoreCounterValue, so with the lock busy the watch stays out of the driver: the holder report | ||
| 2269 | // samples stacks only, and the counters are read once the lock is free again. | ||
| 2270 | if (state == Watch::State::submit_lock_busy) { | ||
| 2271 | const std::uint32_t owner = submit_mutex_.owner(); | ||
| 2272 | const std::int64_t since = submit_mutex_.since_ms(); | ||
| 2273 | const std::int64_t held = diagnostic_ms() - since; | ||
| 2274 | if (owner && held >= 3000 && since != reported_hold) { | ||
| 2275 | reported_hold = since; | ||
| 2276 | device_fault_->report_submit_lock_holder(owner, held); | ||
| 2277 | } | ||
| 2278 | // Busy at every sample but changing hands: contended, not stuck. Only a hold that lasts (the same | ||
| 2279 | // holder since the same time) counts toward the 15 s stall report. | ||
| 2280 | if (since != busy_since) { | ||
| 2281 | busy_since = since; | ||
| 2282 | state = Watch::State::idle; | ||
| 2283 | } | ||
| 2284 | } else { | ||
| 2285 | device_fault_->check_submit_progress(); | ||
| 2286 | } | ||
| 2127 | if (result == VK_ERROR_DEVICE_LOST) { | 2287 | if (result == VK_ERROR_DEVICE_LOST) { |
| 2128 | mark_device_lost(); | 2288 | mark_device_lost(); |
| 2129 | break; | 2289 | break; |
| 2130 | } | 2290 | } |
| 2131 | // A failed counter query does not measure GPU progress. | 2291 | // A failed counter query does not measure GPU progress. |
| 2132 | if (result != VK_SUCCESS) state = Watch::State::idle; | 2292 | if (result != VK_SUCCESS) state = Watch::State::idle; |
| 2293 | // Every 10 s while it changes: what the compile gate has cost so far (SubmitMutex::CompileTurn). | ||
| 2294 | if (++tick % per_10s == 0) { | ||
| 2295 | const SubmitMutex::GateStats gate = submit_mutex_.gate_stats(); | ||
| 2296 | if (gate.submits != gate_logged.submits || gate.creates != gate_logged.creates) { | ||
| 2297 | gate_logged = gate; | ||
| 2298 | std::fprintf(stderr, "[rt] compile-gate: t=%.0f s: %llu submissions waited for pipeline creates " | ||
| 2299 | "(%lld ms in all, longest %lld ms); %llu creates waited behind a submission " | ||
| 2300 | "(%lld ms in all, longest %lld ms)\n", | ||
| 2301 | double(diagnostic_ms()) / 1000.0, static_cast<unsigned long long>(gate.submits), | ||
| 2302 | static_cast<long long>(gate.submit_ms), static_cast<long long>(gate.submit_max_ms), | ||
| 2303 | static_cast<unsigned long long>(gate.creates), static_cast<long long>(gate.create_ms), | ||
| 2304 | static_cast<long long>(gate.create_max_ms)); | ||
| 2305 | } | ||
| 2306 | } | ||
| 2133 | // LEONIDA_HANG_EXIT_S=<s> (for boots): work pending and retirement still for s seconds is a GPU hang | 2307 | // LEONIDA_HANG_EXIT_S=<s> (for boots): work pending and retirement still for s seconds is a GPU hang |
| 2134 | // the driver may recover from without Vulkan ever reporting the device lost (Xid 109: the title then | 2308 | // the driver may recover from without Vulkan ever reporting the device lost (Xid 109: the title then |
| 2135 | // waits forever, the window frozen). The stall is reported (with the checkpoints under | 2309 | // waits forever, the window frozen). The stall is reported (with the checkpoints under |
| @@ -2157,7 +2331,9 @@ private: | |||
| 2157 | } | 2331 | } |
| 2158 | if (watch.sample(state, retired, Watch::Clock::now())) | 2332 | if (watch.sample(state, retired, Watch::Clock::now())) |
| 2159 | device_fault_->report_stall(state == Watch::State::pending ? "queue retirement has not advanced" | 2333 | device_fault_->report_stall(state == Watch::State::pending ? "queue retirement has not advanced" |
| 2160 | : "could not sample the submit lock", | 2334 | : submit_mutex_.gate_waiter() && submit_mutex_.gate_waiter() == submit_mutex_.owner() |
| 2335 | ? "could not sample the submit lock (its holder waits at the compile gate)" | ||
| 2336 | : "could not sample the submit lock", | ||
| 2161 | submitted, retired); | 2337 | submitted, retired); |
| 2162 | } | 2338 | } |
| 2163 | } | 2339 | } |
| @@ -2167,10 +2343,17 @@ private: | |||
| 2167 | bool ray_tracing_ = false; | 2343 | bool ray_tracing_ = false; |
| 2168 | std::unique_ptr<XdxrBuilder> xdxr_; // set: acceleration structures are XDXR BVH4 records | 2344 | std::unique_ptr<XdxrBuilder> xdxr_; // set: acceleration structures are XDXR BVH4 records |
| 2169 | std::atomic<bool> device_lost_{false}; | 2345 | std::atomic<bool> device_lost_{false}; |
| 2346 | alignas(64) std::shared_mutex pipeline_mutex_; // shared for prepare/compile/emit pipeline lookups, unique for add/remove/workers | ||
| 2170 | alignas(64) std::shared_mutex resource_mutex_; // shared for prepare lookups, unique for add/remove | 2347 | alignas(64) std::shared_mutex resource_mutex_; // shared for prepare lookups, unique for add/remove |
| 2171 | alignas(64) std::mutex tracker_mutex_; | 2348 | alignas(64) std::mutex tracker_mutex_; |
| 2172 | alignas(64) std::mutex views_mutex_; | 2349 | alignas(64) std::mutex views_mutex_; |
| 2173 | alignas(64) std::mutex submit_mutex_; | 2350 | // Lock hierarchy (see VulkanQueue::execute): resource_mutex_ -> tracker_mutex_ -> submit_mutex_. A PSO build |
| 2351 | // (shims/d3d12_vulkan_device.cpp, PipelineState::build_compute / build) holds its variants_mutex_ and the | ||
| 2352 | // static big_compile mutex while it waits for the submit lock (SubmitMutex::let_submit_finish) or at the compile | ||
| 2353 | // gate: variants_mutex_ -> big_compile -> submit_mutex_, and nothing holding submit_mutex_ takes either. The | ||
| 2354 | // gate's own mutex is a leaf; a submission waits at the gate with submit_mutex_ held, for creates already in the | ||
| 2355 | // driver only (SubmitMutex::CompileTurn). | ||
| 2356 | alignas(64) SubmitMutex submit_mutex_; | ||
| 2174 | bool image_work_pending_ = false; // under submit_mutex_ | 2357 | bool image_work_pending_ = false; // under submit_mutex_ |
| 2175 | HostTextureStats host_texture_stats_; // under submit_mutex_ | 2358 | HostTextureStats host_texture_stats_; // under submit_mutex_ |
| 2176 | RetireTickets<VkSemaphore> retire_tickets_; | 2359 | RetireTickets<VkSemaphore> retire_tickets_; |
| @@ -2186,6 +2369,8 @@ private: | |||
| 2186 | std::unordered_map<std::uintptr_t, ComputePipeline> pipelines_; | 2369 | std::unordered_map<std::uintptr_t, ComputePipeline> pipelines_; |
| 2187 | std::unordered_map<std::uintptr_t, GraphicsPipeline> graphics_pipelines_; | 2370 | std::unordered_map<std::uintptr_t, GraphicsPipeline> graphics_pipelines_; |
| 2188 | std::unique_ptr<PipelineWorkers> pipeline_workers_; | 2371 | std::unique_ptr<PipelineWorkers> pipeline_workers_; |
| 2372 | std::function<std::uint64_t()> large_compile_budget_; | ||
| 2373 | std::function<std::shared_ptr<void>()> large_compile_demand_; | ||
| 2189 | std::unordered_map<std::uint64_t, VkAccelerationStructureKHR> acceleration_structures_; | 2374 | std::unordered_map<std::uint64_t, VkAccelerationStructureKHR> acceleration_structures_; |
| 2190 | LayoutTracker tracker_; | 2375 | LayoutTracker tracker_; |
| 2191 | std::mutex storage_mutex_; // a leaf lock: guards storage_pending_ and zero_pending_ only | 2376 | std::mutex storage_mutex_; // a leaf lock: guards storage_pending_ and zero_pending_ only |
| @@ -2220,6 +2405,11 @@ private: | |||
| 2220 | VkSemaphore bindless_upload_semaphore_ = VK_NULL_HANDLE; | 2405 | VkSemaphore bindless_upload_semaphore_ = VK_NULL_HANDLE; |
| 2221 | std::uint64_t bindless_upload_value_ = 0; | 2406 | std::uint64_t bindless_upload_value_ = 0; |
| 2222 | std::uint64_t bindless_upload_version_ = 0; | 2407 | std::uint64_t bindless_upload_version_ = 0; |
| 2408 | std::function<bool(VkCommandBuffer)> prelude_record_; | ||
| 2409 | std::function<void(bool, std::uint64_t)> prelude_commit_; | ||
| 2410 | VkSemaphore prelude_semaphore_ = VK_NULL_HANDLE; // the queue whose submission recorded the last prelude | ||
| 2411 | std::uint64_t prelude_value_ = 0; | ||
| 2412 | std::uint64_t prelude_version_ = 0; | ||
| 2223 | std::unique_ptr<Depth24Converter> depth24_; | 2413 | std::unique_ptr<Depth24Converter> depth24_; |
| 2224 | std::unique_ptr<ScratchBuffers> scratch_; // copies staged through a buffer (depth <-> colour) | 2414 | std::unique_ptr<ScratchBuffers> scratch_; // copies staged through a buffer (depth <-> colour) |
| 2225 | std::function<void(bool)> bindless_commit_; | 2415 | std::function<void(bool)> bindless_commit_; |
| @@ -2257,7 +2447,19 @@ public: | |||
| 2257 | } | 2447 | } |
| 2258 | ~VulkanFence() { | 2448 | ~VulkanFence() { |
| 2259 | if (!semaphore_) return; | 2449 | if (!semaphore_) return; |
| 2450 | // LOCAL DIAGNOSTIC (early device loss): a fence released while a Signal the GPU has not run yet names it. | ||
| 2451 | if (!context_.is_device_lost()) { | ||
| 2452 | const std::uint64_t submitted = context_.holds().submitted_value(semaphore_); | ||
| 2453 | std::uint64_t reached = 0; | ||
| 2454 | if (submitted && context_.vk.vkGetSemaphoreCounterValue(context_.device(), semaphore_, &reached) == VK_SUCCESS && | ||
| 2455 | reached < submitted) | ||
| 2456 | std::fprintf(stderr, "[rt] d3d12: fence semaphore %p destroyed with a Signal pending (submitted %llu, " | ||
| 2457 | "reached %llu) at t=%.3f s\n", | ||
| 2458 | static_cast<void*>(semaphore_), static_cast<unsigned long long>(submitted), | ||
| 2459 | static_cast<unsigned long long>(reached), double(diagnostic_ms()) / 1000.0); | ||
| 2460 | } | ||
| 2260 | context_.holds().remove_fence(semaphore_); // batches held on it can never run: dropped and reported | 2461 | context_.holds().remove_fence(semaphore_); // batches held on it can never run: dropped and reported |
| 2462 | if (DeviceFaultDiagnostics* ring = context_.device_fault()) ring->forget(semaphore_); // no report reads it | ||
| 2261 | context_.vk.vkDestroySemaphore(context_.device(), semaphore_, nullptr); | 2463 | context_.vk.vkDestroySemaphore(context_.device(), semaphore_, nullptr); |
| 2262 | } | 2464 | } |
| 2263 | VulkanFence(const VulkanFence&) = delete; | 2465 | VulkanFence(const VulkanFence&) = delete; |
| @@ -2391,16 +2593,24 @@ public: | |||
| 2391 | 2593 | ||
| 2392 | ~VulkanQueue() { | 2594 | ~VulkanQueue() { |
| 2393 | auto& vk = context_.vk; | 2595 | auto& vk = context_.vk; |
| 2596 | stop_async(); // LEONIDA_SUBMIT_ASYNC: what is queued runs first | ||
| 2597 | std::fprintf(stderr, "[rt] d3d12: queue %p (progress %p) destroyed at t=%.3f s\n", static_cast<void*>(queue_), | ||
| 2598 | static_cast<void*>(progress_), double(diagnostic_ms()) / 1000.0); | ||
| 2394 | context_.holds().detach(this); // no thread releases into this queue from here on | 2599 | context_.holds().detach(this); // no thread releases into this queue from here on |
| 2395 | report_held_at_teardown(); | 2600 | report_held_at_teardown(); |
| 2396 | context_.holds().pump_ready(); // presents queued behind what was just dropped can run | 2601 | context_.holds().pump_ready(); // presents queued behind what was just dropped can run |
| 2397 | if (queue_) { | 2602 | if (queue_) { |
| 2398 | std::lock_guard lock(context_.submit_mutex()); | 2603 | std::lock_guard lock(context_.submit_mutex()); |
| 2604 | const SubmitMutex::SubmitTurn turn(context_.submit_mutex()); // a queue operation: the compile gate | ||
| 2399 | for (; open_labels_; --open_labels_) context_.labels_.queue_end(queue_); | 2605 | for (; open_labels_; --open_labels_) context_.labels_.queue_end(queue_); |
| 2400 | const VkResult idle_result = context_.observe_result(vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle"); | 2606 | const VkResult idle_result = context_.observe_result(vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle"); |
| 2401 | if (idle_result == VK_SUCCESS) { | 2607 | if (idle_result == VK_SUCCESS) { |
| 2402 | if (progress_) context_.retire_queue_idle_locked(progress_); | 2608 | if (progress_) context_.retire_queue_idle_locked(progress_); |
| 2403 | } else { | 2609 | } else { |
| 2610 | // Any failure here makes every fence read ~0 from now on: say so when it is not a real loss. | ||
| 2611 | if (idle_result != VK_ERROR_DEVICE_LOST) | ||
| 2612 | std::fprintf(stderr, "[rt] d3d12: vkQueueWaitIdle at queue teardown returned %d; the device is " | ||
| 2613 | "treated as lost\n", int(idle_result)); | ||
| 2404 | context_.mark_device_lost(); | 2614 | context_.mark_device_lost(); |
| 2405 | } | 2615 | } |
| 2406 | } | 2616 | } |
| @@ -2415,9 +2625,15 @@ public: | |||
| 2415 | // finished: the next submission on another queue must not wait on a semaphore that is about to go. | 2625 | // finished: the next submission on another queue must not wait on a semaphore that is about to go. |
| 2416 | std::lock_guard lock(context_.storage_mutex_); | 2626 | std::lock_guard lock(context_.storage_mutex_); |
| 2417 | if (context_.storage_init_semaphore_ == progress_) context_.storage_init_semaphore_ = VK_NULL_HANDLE; | 2627 | if (context_.storage_init_semaphore_ == progress_) context_.storage_init_semaphore_ = VK_NULL_HANDLE; |
| 2628 | // The same for the bindless table upload: a queue that had not seen its version yet would otherwise | ||
| 2629 | // wait on this destroyed semaphore in its next vkQueueSubmit. | ||
| 2630 | if (context_.bindless_upload_semaphore_ == progress_) context_.bindless_upload_semaphore_ = VK_NULL_HANDLE; | ||
| 2418 | } | 2631 | } |
| 2419 | if (pool_) vk.vkDestroyCommandPool(context_.device(), pool_, nullptr); | 2632 | if (pool_) vk.vkDestroyCommandPool(context_.device(), pool_, nullptr); |
| 2420 | if (progress_) vk.vkDestroySemaphore(context_.device(), progress_, nullptr); | 2633 | if (progress_) { |
| 2634 | if (DeviceFaultDiagnostics* ring = context_.device_fault()) ring->forget(progress_); // no report reads it | ||
| 2635 | vk.vkDestroySemaphore(context_.device(), progress_, nullptr); | ||
| 2636 | } | ||
| 2421 | destroy_khr_stages(khr_stage_pool_); | 2637 | destroy_khr_stages(khr_stage_pool_); |
| 2422 | destroy_khr_as_queries(khr_as_query_pool_); | 2638 | destroy_khr_as_queries(khr_as_query_pool_); |
| 2423 | for (auto& slot : buffers_) { | 2639 | for (auto& slot : buffers_) { |
| @@ -2432,6 +2648,8 @@ public: | |||
| 2432 | VulkanQueue& operator=(const VulkanQueue&) = delete; | 2648 | VulkanQueue& operator=(const VulkanQueue&) = delete; |
| 2433 | 2649 | ||
| 2434 | bool ok() const { return ok_; } | 2650 | bool ok() const { return ok_; } |
| 2651 | // A queue of the runtime's own whose caller waits for each call (a staging copy): never on a worker. | ||
| 2652 | void make_synchronous() { synchronous_ = true; } | ||
| 2435 | 2653 | ||
| 2436 | // Entries kept between executions. Execute only uses the first lists.size(); a larger count is retained storage, | 2654 | // Entries kept between executions. Execute only uses the first lists.size(); a larger count is retained storage, |
| 2437 | // not work the next submission will replay (vk_queue_test checks both halves of that contract). | 2655 | // not work the next submission will replay (vk_queue_test checks both halves of that contract). |
| @@ -2440,6 +2658,7 @@ public: | |||
| 2440 | template<typename GetHeap> | 2658 | template<typename GetHeap> |
| 2441 | bool update_tiles(ResourceId id, std::span<const TileRegion> regions, | 2659 | bool update_tiles(ResourceId id, std::span<const TileRegion> regions, |
| 2442 | std::span<const TileRange> ranges, GetHeap&& get_heap) { | 2660 | std::span<const TileRange> ranges, GetHeap&& get_heap) { |
| 2661 | flush_async(); // after the calls queued before it (LEONIDA_SUBMIT_ASYNC) | ||
| 2443 | std::lock_guard state(state_mutex_); // outermost: held batches are released from other threads | 2662 | std::lock_guard state(state_mutex_); // outermost: held batches are released from other threads |
| 2444 | std::unique_lock lock(context_.resource_mutex_); | 2663 | std::unique_lock lock(context_.resource_mutex_); |
| 2445 | const auto it = context_.sparse_resources_.find(id); | 2664 | const auto it = context_.sparse_resources_.find(id); |
| @@ -2487,6 +2706,7 @@ public: | |||
| 2487 | 2706 | ||
| 2488 | bool copy_tile_mappings(ResourceId dst, std::span<const TileRegion> dst_regions, ResourceId src, | 2707 | bool copy_tile_mappings(ResourceId dst, std::span<const TileRegion> dst_regions, ResourceId src, |
| 2489 | std::span<const TileRegion> src_regions) { | 2708 | std::span<const TileRegion> src_regions) { |
| 2709 | flush_async(); | ||
| 2490 | std::lock_guard state(state_mutex_); | 2710 | std::lock_guard state(state_mutex_); |
| 2491 | std::unique_lock lock(context_.resource_mutex_); | 2711 | std::unique_lock lock(context_.resource_mutex_); |
| 2492 | const auto source = context_.sparse_resources_.find(src), target = context_.sparse_resources_.find(dst); | 2712 | const auto source = context_.sparse_resources_.find(src), target = context_.sparse_resources_.find(dst); |
| @@ -2519,8 +2739,23 @@ public: | |||
| 2519 | using PinFn = std::function<std::shared_ptr<void>()>; | 2739 | using PinFn = std::function<std::shared_ptr<void>()>; |
| 2520 | 2740 | ||
| 2521 | ReplayResult execute(std::span<const CommandList* const> lists, const PinFn& pin = {}) { | 2741 | ReplayResult execute(std::span<const CommandList* const> lists, const PinFn& pin = {}) { |
| 2742 | pipeline_wait::note_submission(); // big compute warm-ups are left to their first use while the title submits | ||
| 2522 | auto* diagnostics = context_.device_fault(); | 2743 | auto* diagnostics = context_.device_fault(); |
| 2523 | const auto execute_call = diagnostics ? diagnostics->next_execute_call() : 0; | 2744 | const auto execute_call = diagnostics ? diagnostics->next_execute_call() : 0; |
| 2745 | if (async_on()) { // copied and queued: the worker replays it (a failure is reported as a held one's) | ||
| 2746 | Call call; | ||
| 2747 | call.kind = Call::Kind::execute; | ||
| 2748 | call.execute_call = execute_call; | ||
| 2749 | call.lists.reserve(lists.size()); | ||
| 2750 | for (const CommandList* list : lists) call.lists.push_back(*list); | ||
| 2751 | if (pin) call.pin = pin(); | ||
| 2752 | enqueue(std::move(call)); | ||
| 2753 | return ReplayResult::success; | ||
| 2754 | } | ||
| 2755 | return execute_sync(lists, pin, execute_call); | ||
| 2756 | } | ||
| 2757 | |||
| 2758 | ReplayResult execute_sync(std::span<const CommandList* const> lists, const PinFn& pin, std::uint64_t execute_call) { | ||
| 2524 | ReplayResult result = ReplayResult::success; | 2759 | ReplayResult result = ReplayResult::success; |
| 2525 | bool held = false; | 2760 | bool held = false; |
| 2526 | std::vector<std::shared_ptr<void>> retired; // destroyed after state_mutex_ is released | 2761 | std::vector<std::shared_ptr<void>> retired; // destroyed after state_mutex_ is released |
| @@ -2551,6 +2786,19 @@ public: | |||
| 2551 | // held operations, so the fence does not run ahead of the work it follows. `pin` (called only when the Signal is | 2786 | // held operations, so the fence does not run ahead of the work it follows. `pin` (called only when the Signal is |
| 2552 | // held) keeps the fence object alive until it has been submitted, as D3D12 does. | 2787 | // held) keeps the fence object alive until it has been submitted, as D3D12 does. |
| 2553 | bool signal(VkSemaphore fence, std::uint64_t value, const PinFn& pin = {}) { | 2788 | bool signal(VkSemaphore fence, std::uint64_t value, const PinFn& pin = {}) { |
| 2789 | if (async_on()) { | ||
| 2790 | Call call; | ||
| 2791 | call.kind = Call::Kind::signal; | ||
| 2792 | call.fence = fence; | ||
| 2793 | call.value = value; | ||
| 2794 | if (pin) call.pin = pin(); | ||
| 2795 | enqueue(std::move(call)); | ||
| 2796 | return true; | ||
| 2797 | } | ||
| 2798 | return signal_sync(fence, value, pin); | ||
| 2799 | } | ||
| 2800 | |||
| 2801 | bool signal_sync(VkSemaphore fence, std::uint64_t value, const PinFn& pin) { | ||
| 2554 | bool ok = true; | 2802 | bool ok = true; |
| 2555 | std::vector<std::shared_ptr<void>> retired; | 2803 | std::vector<std::shared_ptr<void>> retired; |
| 2556 | { | 2804 | { |
| @@ -2564,6 +2812,10 @@ public: | |||
| 2564 | hold(std::move(op)); | 2812 | hold(std::move(op)); |
| 2565 | } else { | 2813 | } else { |
| 2566 | ok = submit(VK_NULL_HANDLE, fence, value); | 2814 | ok = submit(VK_NULL_HANDLE, fence, value); |
| 2815 | // As for a held Signal (release_held): the fence object, and so its semaphore, stays alive until the | ||
| 2816 | // GPU has run the signal. Destroying a semaphore a pending submission signals is undefined | ||
| 2817 | // (VUID-vkDestroySemaphore-semaphore-05149), and a title may release a fence right after Signal. | ||
| 2818 | if (ok && pin) pin_queue_.push_back({submitted_, pin()}); | ||
| 2567 | } | 2819 | } |
| 2568 | drain_pins(retired); | 2820 | drain_pins(retired); |
| 2569 | } | 2821 | } |
| @@ -2576,6 +2828,19 @@ public: | |||
| 2576 | // batch, so it is kept and attached to the next submission (held on the CPU if no Signal reaches it yet). | 2828 | // batch, so it is kept and attached to the next submission (held on the CPU if no Signal reaches it yet). |
| 2577 | // `pin` returns what keeps the fence object alive until then (a D3D12 queue holds its fences). | 2829 | // `pin` returns what keeps the fence object alive until then (a D3D12 queue holds its fences). |
| 2578 | void wait(VkSemaphore fence, std::uint64_t value, const PinFn& pin = {}) { | 2830 | void wait(VkSemaphore fence, std::uint64_t value, const PinFn& pin = {}) { |
| 2831 | if (async_on()) { | ||
| 2832 | Call call; | ||
| 2833 | call.kind = Call::Kind::wait; | ||
| 2834 | call.fence = fence; | ||
| 2835 | call.value = value; | ||
| 2836 | if (pin) call.pin = pin(); | ||
| 2837 | enqueue(std::move(call)); | ||
| 2838 | return; | ||
| 2839 | } | ||
| 2840 | wait_sync(fence, value, pin); | ||
| 2841 | } | ||
| 2842 | |||
| 2843 | void wait_sync(VkSemaphore fence, std::uint64_t value, const PinFn& pin) { | ||
| 2579 | std::vector<std::shared_ptr<void>> retired; // fences whose submission has completed: released unlocked | 2844 | std::vector<std::shared_ptr<void>> retired; // fences whose submission has completed: released unlocked |
| 2580 | { | 2845 | { |
| 2581 | std::lock_guard state(state_mutex_); | 2846 | std::lock_guard state(state_mutex_); |
| @@ -2596,6 +2861,18 @@ public: | |||
| 2596 | // ID3D12CommandQueue::SetMarker/BeginEvent/EndEvent: queue labels, between the submissions around them. An end | 2861 | // ID3D12CommandQueue::SetMarker/BeginEvent/EndEvent: queue labels, between the submissions around them. An end |
| 2597 | // with no begin open on this queue is dropped, as Vulkan requires a matching begin. No-ops without the extension. | 2862 | // with no begin open on this queue is dropped, as Vulkan requires a matching begin. No-ops without the extension. |
| 2598 | void marker(DebugMarker::Kind kind, const char* label) { | 2863 | void marker(DebugMarker::Kind kind, const char* label) { |
| 2864 | if (async_on()) { | ||
| 2865 | Call call; | ||
| 2866 | call.kind = Call::Kind::marker; | ||
| 2867 | call.marker_kind = kind; | ||
| 2868 | call.label = label ? label : ""; | ||
| 2869 | enqueue(std::move(call)); | ||
| 2870 | return; | ||
| 2871 | } | ||
| 2872 | marker_sync(kind, label); | ||
| 2873 | } | ||
| 2874 | |||
| 2875 | void marker_sync(DebugMarker::Kind kind, const char* label) { | ||
| 2599 | std::vector<std::shared_ptr<void>> retired; | 2876 | std::vector<std::shared_ptr<void>> retired; |
| 2600 | std::lock_guard state(state_mutex_); | 2877 | std::lock_guard state(state_mutex_); |
| 2601 | drain_pins(retired); // destroyed after the lock (reverse declaration order) | 2878 | drain_pins(retired); // destroyed after the lock (reverse declaration order) |
| @@ -2611,7 +2888,9 @@ public: | |||
| 2611 | } | 2888 | } |
| 2612 | 2889 | ||
| 2613 | bool idle() { | 2890 | bool idle() { |
| 2891 | flush_async(); | ||
| 2614 | std::lock_guard lock(context_.submit_mutex()); | 2892 | std::lock_guard lock(context_.submit_mutex()); |
| 2893 | const SubmitMutex::SubmitTurn turn(context_.submit_mutex()); // a queue operation: the compile gate | ||
| 2615 | return context_.observe_result(context_.vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle") == VK_SUCCESS; | 2894 | return context_.observe_result(context_.vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle") == VK_SUCCESS; |
| 2616 | } | 2895 | } |
| 2617 | 2896 | ||
| @@ -2900,11 +3179,15 @@ private: | |||
| 2900 | } | 3179 | } |
| 2901 | } khr_guard{this}; | 3180 | } khr_guard{this}; |
| 2902 | std::function<void(bool)> bindless_commit; | 3181 | std::function<void(bool)> bindless_commit; |
| 2903 | // Lock hierarchy: resource_mutex_ -> tracker_mutex_ -> submit_mutex_. | 3182 | // Lock hierarchy: state_mutex_ -> pipeline_mutex_ -> resource_mutex_ -> tracker_mutex_ -> submit_mutex_. |
| 2904 | // Shared read-lock allows concurrent prepare() across queues; tracker_mutex_ is acquired lazily during | 3183 | // Shared pipeline_lock keeps registered pipelines, pipeline_names, and pipeline_workers_ alive across |
| 2905 | // prepare() only if a list actually converts a depth24_as_float copy, and otherwise right before | 3184 | // preparation, compilation, and emit. Shared resource_lock allows concurrent prepare() across queues and is |
| 2906 | // bindless_prepare_/emit() through submit() so bindless flushes, layout emits, and submissions stay in order. | 3185 | // released while unbuilt pipelines compile so add_resource()/remove_resource() never stall behind shader |
| 2907 | std::shared_lock resource_lock(context_.resource_mutex_); | 3186 | // compiles; tracker_mutex_ is acquired lazily during prepare() only if a list uses a shared helper, and |
| 3187 | // otherwise right before bindless_prepare_/emit() through submit() so bindless flushes, layout emits, and | ||
| 3188 | // submissions stay in order. | ||
| 3189 | std::shared_lock pipeline_lock(context_.pipeline_mutex_); | ||
| 3190 | std::shared_lock resource_lock(context_.resource_mutex_, std::defer_lock); | ||
| 2908 | std::unique_lock tracker_lock(context_.tracker_mutex_, std::defer_lock); | 3191 | std::unique_lock tracker_lock(context_.tracker_mutex_, std::defer_lock); |
| 2909 | // Declared after tracker_lock so any early return after depth24_->prepare() retires uncommitted scratch/pools | 3192 | // Declared after tracker_lock so any early return after depth24_->prepare() retires uncommitted scratch/pools |
| 2910 | // with ticket 0 while tracker_lock is still held. | 3193 | // with ticket 0 while tracker_lock is still held. |
| @@ -2915,7 +3198,7 @@ private: | |||
| 2915 | ~Depth24Guard() { | 3198 | ~Depth24Guard() { |
| 2916 | if (active && d24) d24->retire(progress, 0); | 3199 | if (active && d24) d24->retire(progress, 0); |
| 2917 | } | 3200 | } |
| 2918 | } depth24_guard{context_.depth24_.get(), progress_, false}; | 3201 | } depth24_guard{nullptr, progress_, false}; |
| 2919 | struct ScratchGuard { // the same for the copy scratch | 3202 | struct ScratchGuard { // the same for the copy scratch |
| 2920 | ScratchBuffers* scratch = nullptr; | 3203 | ScratchBuffers* scratch = nullptr; |
| 2921 | VkSemaphore progress = VK_NULL_HANDLE; | 3204 | VkSemaphore progress = VK_NULL_HANDLE; |
| @@ -2923,7 +3206,7 @@ private: | |||
| 2923 | ~ScratchGuard() { | 3206 | ~ScratchGuard() { |
| 2924 | if (active && scratch) scratch->retire(progress, 0); | 3207 | if (active && scratch) scratch->retire(progress, 0); |
| 2925 | } | 3208 | } |
| 2926 | } scratch_guard{context_.scratch_.get(), progress_, false}; | 3209 | } scratch_guard{nullptr, progress_, false}; |
| 2927 | struct ClampGuard { // and for the ExecuteIndirect clamp's record scratch | 3210 | struct ClampGuard { // and for the ExecuteIndirect clamp's record scratch |
| 2928 | IndirectArgumentClamp* clamp = nullptr; | 3211 | IndirectArgumentClamp* clamp = nullptr; |
| 2929 | VkSemaphore progress = VK_NULL_HANDLE; | 3212 | VkSemaphore progress = VK_NULL_HANDLE; |
| @@ -2931,9 +3214,8 @@ private: | |||
| 2931 | ~ClampGuard() { | 3214 | ~ClampGuard() { |
| 2932 | if (active && clamp) clamp->retire(progress, 0); | 3215 | if (active && clamp) clamp->retire(progress, 0); |
| 2933 | } | 3216 | } |
| 2934 | } clamp_guard{context_.indirect_clamp_.get(), progress_, false}; | 3217 | } clamp_guard{nullptr, progress_, false}; |
| 2935 | const bool transfer_only = family_ == context_.transfer_only_family_; | 3218 | const bool transfer_only = family_ == context_.transfer_only_family_; |
| 2936 | if (!transfer_only) bindless_commit = context_.bindless_commit_; | ||
| 2937 | // Kept between executions: prepare refills each list's entries in the storage the last execution left, where | 3219 | // Kept between executions: prepare refills each list's entries in the storage the last execution left, where |
| 2938 | // making them fresh for every command was about half the layer's CPU cost per command (replay_cpu_bench). | 3220 | // making them fresh for every command was about half the layer's CPU cost per command (replay_cpu_bench). |
| 2939 | auto& prepared = prepared_; | 3221 | auto& prepared = prepared_; |
| @@ -2941,42 +3223,9 @@ private: | |||
| 2941 | // a queue that sees 8 lists and then 1 in every frame would rebuild them on each execution. The loops below | 3223 | // a queue that sees 8 lists and then 1 in every frame would rebuild them on each execution. The loops below |
| 2942 | // use only the first lists.size() entries, so stale entries are never prepared, queried or emitted. | 3224 | // use only the first lists.size() entries, so stale entries are never prepared, queried or emitted. |
| 2943 | if (prepared.size() < lists.size()) prepared.resize(lists.size()); | 3225 | if (prepared.size() < lists.size()) prepared.resize(lists.size()); |
| 2944 | ReplayFunctions replay = context_.replay_; | 3226 | ReplayFunctions replay{}; |
| 2945 | unsigned mesh_draws = 0; | 3227 | unsigned mesh_draws = 0; |
| 2946 | if (pipeline_profile::enabled()) replay.mesh_draw_count = &mesh_draws; | ||
| 2947 | std::vector<VulkanContext::GeometryUpload> geometry; | 3228 | std::vector<VulkanContext::GeometryUpload> geometry; |
| 2948 | if (context_.geometry_provider_) { | ||
| 2949 | replay.title_memory = [&](std::uint64_t va, std::uint64_t bytes, VkBuffer& buffer, VkDeviceSize& offset) { | ||
| 2950 | if (!va || !bytes || bytes>UINT64_MAX-va) return false; | ||
| 2951 | for (const auto& upload : geometry) { | ||
| 2952 | if (va < upload.source || va-upload.source > upload.size || bytes > upload.size-(va-upload.source)) continue; | ||
| 2953 | buffer=upload.buffer; offset=upload.offset+(va-upload.source); | ||
| 2954 | return true; | ||
| 2955 | } | ||
| 2956 | VulkanContext::GeometryUpload upload; | ||
| 2957 | if (!context_.geometry_provider_(va,bytes,upload)) return false; | ||
| 2958 | buffer=upload.buffer;offset=upload.offset; | ||
| 2959 | geometry.push_back(std::move(upload)); | ||
| 2960 | return true; | ||
| 2961 | }; | ||
| 2962 | } | ||
| 2963 | replay.graphics_family = family_ == context_.graphics_family_; | ||
| 2964 | replay.queue_stages = kind_ == QueueKind::copy ? detail::queue_stages_copy | ||
| 2965 | : kind_ == QueueKind::compute ? detail::queue_stages_compute | ||
| 2966 | : 0; | ||
| 2967 | replay.prepare_khr_instances = [this, &replay, &khr_guard](const BuildAccelerationStructure& build, | ||
| 2968 | VkDeviceAddress& address) { | ||
| 2969 | return stage_khr_instances(replay, build, khr_guard.stages, address); | ||
| 2970 | }; | ||
| 2971 | replay.prepare_xdxr_table = [this, &khr_guard](VkDeviceAddress& address, std::uint32_t& count) { | ||
| 2972 | return stage_xdxr_table(khr_guard.stages, address, count); | ||
| 2973 | }; | ||
| 2974 | if (replay.write_acceleration_structures_properties) { | ||
| 2975 | replay.prepare_khr_postbuild = [this, &khr_guard](std::uint32_t count, VkQueryPool& pool, | ||
| 2976 | std::uint32_t& first) { | ||
| 2977 | return allocate_khr_as_queries(count, khr_guard.as_queries, pool, first); | ||
| 2978 | }; | ||
| 2979 | } | ||
| 2980 | std::uint64_t captures = 0; | 3229 | std::uint64_t captures = 0; |
| 2981 | for (const auto* list : lists) | 3230 | for (const auto* list : lists) |
| 2982 | for (const auto& command : list->commands()) | 3231 | for (const auto& command : list->commands()) |
| @@ -2985,149 +3234,239 @@ private: | |||
| 2985 | std::unique_ptr<PredicatedBufferCopier::Batch> copy_batch; | 3234 | std::unique_ptr<PredicatedBufferCopier::Batch> copy_batch; |
| 2986 | std::unique_ptr<IndirectDispatchCounter::Batch> counted_batch; | 3235 | std::unique_ptr<IndirectDispatchCounter::Batch> counted_batch; |
| 2987 | std::unique_ptr<IndirectArgumentClamp::Batch> clamp_batch; | 3236 | std::unique_ptr<IndirectArgumentClamp::Batch> clamp_batch; |
| 2988 | if (captures) { | 3237 | const auto& occlusion_memory = context_.occlusion_resolve_memory_; |
| 2989 | if (kind_ == QueueKind::copy || !context_.predicate_reducer_ || family_ != context_.predicate_family_) | 3238 | const bool can_resolve_occlusion = occlusion_memory.memoryTypeCount != 0; |
| 2990 | return queue_unsupported(__LINE__); | 3239 | const auto resolve = [this](ResourceId id) { return context_.resolve(id); }; |
| 2991 | // The helper's lazy pipeline is shared by queues. Serialize preparation with the tracker lock, | 3240 | std::uint32_t segments = 0, statistics_segments = 0; |
| 2992 | // retaining main's resource -> tracker -> submit lock order through emit and submission. | 3241 | bool has_queries = false; |
| 2993 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | 3242 | const auto run_compiles = [this](std::size_t count, const std::function<void(std::size_t)>& job) { |
| 2994 | batch = context_.predicate_reducer_->batch(captures); | 3243 | context_.pipeline_workers_->run(count, job); |
| 2995 | if (!batch) return queue_unsupported(__LINE__); | 3244 | }; |
| 2996 | replay.prepare_predicate = [&](VkBuffer buffer, VkDeviceSize offset, PredicateCapture& out) { | 3245 | PipelineCompiles prior_compiles; |
| 2997 | return batch->prepare(buffer, offset, out); | 3246 | bool has_prior_compiles = false; |
| 3247 | for (int pass = 0;; ++pass) { | ||
| 3248 | resource_lock.lock(); | ||
| 3249 | bindless_commit = !transfer_only ? context_.bindless_commit_ : std::function<void(bool)>{}; | ||
| 3250 | replay = context_.replay_; | ||
| 3251 | mesh_draws = 0; | ||
| 3252 | if (pipeline_profile::enabled()) replay.mesh_draw_count = &mesh_draws; | ||
| 3253 | if (context_.geometry_provider_) { | ||
| 3254 | replay.title_memory = [&](std::uint64_t va, std::uint64_t bytes, VkBuffer& buffer, VkDeviceSize& offset) { | ||
| 3255 | if (!va || !bytes || bytes>UINT64_MAX-va) return false; | ||
| 3256 | for (const auto& upload : geometry) { | ||
| 3257 | if (va < upload.source || va-upload.source > upload.size || bytes > upload.size-(va-upload.source)) continue; | ||
| 3258 | buffer=upload.buffer; offset=upload.offset+(va-upload.source); | ||
| 3259 | return true; | ||
| 3260 | } | ||
| 3261 | VulkanContext::GeometryUpload upload; | ||
| 3262 | if (!context_.geometry_provider_(va,bytes,upload)) return false; | ||
| 3263 | buffer=upload.buffer;offset=upload.offset; | ||
| 3264 | geometry.push_back(std::move(upload)); | ||
| 3265 | return true; | ||
| 3266 | }; | ||
| 3267 | } | ||
| 3268 | replay.graphics_family = family_ == context_.graphics_family_; | ||
| 3269 | replay.queue_stages = kind_ == QueueKind::copy ? detail::queue_stages_copy | ||
| 3270 | : kind_ == QueueKind::compute ? detail::queue_stages_compute | ||
| 3271 | : 0; | ||
| 3272 | replay.prepare_khr_instances = [this, &replay, &khr_guard](const BuildAccelerationStructure& build, | ||
| 3273 | VkDeviceAddress& address) { | ||
| 3274 | return stage_khr_instances(replay, build, khr_guard.stages, address); | ||
| 2998 | }; | 3275 | }; |
| 2999 | replay.capture_predicate = [&](VkCommandBuffer cb, const PredicateCapture& p) { | 3276 | replay.prepare_xdxr_table = [this, &khr_guard](VkDeviceAddress& address, std::uint32_t& count) { |
| 3000 | context_.predicate_reducer_->capture(cb, p); | 3277 | return stage_xdxr_table(khr_guard.stages, address, count); |
| 3001 | }; | 3278 | }; |
| 3002 | if (context_.predicated_copier_) { | 3279 | if (replay.write_acceleration_structures_properties) { |
| 3003 | copy_batch = context_.predicated_copier_->batch(); | 3280 | replay.prepare_khr_postbuild = [this, &khr_guard](std::uint32_t count, VkQueryPool& pool, |
| 3004 | replay.prepare_predicated_copy = [&](VkBuffer source, VkBuffer destination, VkDeviceSize src, | 3281 | std::uint32_t& first) { |
| 3005 | VkDeviceSize dst, VkDeviceSize size, | 3282 | return allocate_khr_as_queries(count, khr_guard.as_queries, pool, first); |
| 3006 | std::vector<PredicatedCopyDispatch>& out) { | ||
| 3007 | return copy_batch->prepare(source, destination, src, dst, size, out); | ||
| 3008 | }; | ||
| 3009 | replay.emit_predicated_copy = [&](VkCommandBuffer cb, const std::vector<PredicatedCopyDispatch>& jobs) { | ||
| 3010 | context_.predicated_copier_->emit(cb, jobs); | ||
| 3011 | }; | 3283 | }; |
| 3012 | } | 3284 | } |
| 3013 | } | 3285 | if (captures) { |
| 3014 | if (context_.scratch_) { | 3286 | if (kind_ == QueueKind::copy || !context_.predicate_reducer_ || family_ != context_.predicate_family_) |
| 3015 | replay.copy_scratch = [this, &tracker_lock, &scratch_guard](VkDeviceSize bytes, VkBuffer& buffer, | 3287 | return queue_unsupported(__LINE__); |
| 3016 | VkDeviceSize& offset) { | 3288 | // The helper's lazy pipeline is shared by queues. Serialize preparation with the tracker lock, |
| 3289 | // retaining pipeline -> resource -> tracker -> submit lock order through emit and submission. | ||
| 3017 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | 3290 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); |
| 3018 | if (!scratch_guard.active) { | 3291 | batch = context_.predicate_reducer_->batch(captures); |
| 3019 | context_.scratch_->collect(); | 3292 | if (!batch) return queue_unsupported(__LINE__); |
| 3020 | scratch_guard.active = true; | 3293 | replay.prepare_predicate = [&](VkBuffer buffer, VkDeviceSize offset, PredicateCapture& out) { |
| 3294 | return batch->prepare(buffer, offset, out); | ||
| 3295 | }; | ||
| 3296 | replay.capture_predicate = [&](VkCommandBuffer cb, const PredicateCapture& p) { | ||
| 3297 | context_.predicate_reducer_->capture(cb, p); | ||
| 3298 | }; | ||
| 3299 | if (context_.predicated_copier_) { | ||
| 3300 | copy_batch = context_.predicated_copier_->batch(); | ||
| 3301 | replay.prepare_predicated_copy = [&](VkBuffer source, VkBuffer destination, VkDeviceSize src, | ||
| 3302 | VkDeviceSize dst, VkDeviceSize size, | ||
| 3303 | std::vector<PredicatedCopyDispatch>& out) { | ||
| 3304 | return copy_batch->prepare(source, destination, src, dst, size, out); | ||
| 3305 | }; | ||
| 3306 | replay.emit_predicated_copy = [&](VkCommandBuffer cb, const std::vector<PredicatedCopyDispatch>& jobs) { | ||
| 3307 | context_.predicated_copier_->emit(cb, jobs); | ||
| 3308 | }; | ||
| 3021 | } | 3309 | } |
| 3022 | return context_.scratch_->get(bytes, buffer, offset); | 3310 | } |
| 3023 | }; | 3311 | if (context_.scratch_) { |
| 3024 | } | 3312 | replay.copy_scratch = [this, &tracker_lock, &scratch_guard](VkDeviceSize bytes, VkBuffer& buffer, |
| 3025 | if (kind_ != QueueKind::copy && context_.indirect_clamp_) { | 3313 | VkDeviceSize& offset) { |
| 3026 | // The record scratch belongs to this submission: collected here, retired below with its ticket. The | 3314 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); |
| 3027 | // counter slots are read back once that ticket completes (the batch's destructor). | 3315 | if (!scratch_guard.active) { |
| 3028 | replay.prepare_indirect_clamp = [this, &tracker_lock, &clamp_batch, &clamp_guard]( | 3316 | scratch_guard.scratch = context_.scratch_.get(); |
| 3029 | VkBuffer arguments, VkDeviceSize argument_offset, VkBuffer count, | 3317 | context_.scratch_->collect(); |
| 3030 | VkDeviceSize count_offset, std::uint32_t kind, std::uint32_t stride, | 3318 | scratch_guard.active = true; |
| 3031 | std::uint32_t max_count, ClampedIndirect& out) { | 3319 | } |
| 3032 | // Pipeline creation is lazy and shared across queues; serialize it with other replay preparation. | 3320 | return context_.scratch_->get(bytes, buffer, offset); |
| 3033 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | 3321 | }; |
| 3034 | if (!clamp_batch) clamp_batch = context_.indirect_clamp_->batch(); | 3322 | } |
| 3035 | if (!clamp_guard.active) { | 3323 | if (kind_ != QueueKind::copy && context_.indirect_clamp_) { |
| 3036 | context_.indirect_clamp_->collect(); | 3324 | // The record scratch belongs to this submission: collected here, retired below with its ticket. The |
| 3037 | clamp_guard.active = true; | 3325 | // counter slots are read back once that ticket completes (the batch's destructor). |
| 3326 | replay.prepare_indirect_clamp = [this, &tracker_lock, &clamp_batch, &clamp_guard]( | ||
| 3327 | VkBuffer arguments, VkDeviceSize argument_offset, VkBuffer count, | ||
| 3328 | VkDeviceSize count_offset, std::uint32_t kind, std::uint32_t stride, | ||
| 3329 | std::uint32_t max_count, ClampedIndirect& out) { | ||
| 3330 | // Pipeline creation is lazy and shared across queues; serialize it with other replay preparation. | ||
| 3331 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | ||
| 3332 | if (!clamp_batch) clamp_batch = context_.indirect_clamp_->batch(); | ||
| 3333 | if (!clamp_guard.active) { | ||
| 3334 | clamp_guard.clamp = context_.indirect_clamp_.get(); | ||
| 3335 | context_.indirect_clamp_->collect(); | ||
| 3336 | clamp_guard.active = true; | ||
| 3337 | } | ||
| 3338 | return clamp_batch->prepare(arguments, argument_offset, count, count_offset, kind, stride, | ||
| 3339 | max_count, out); | ||
| 3340 | }; | ||
| 3341 | } | ||
| 3342 | if (kind_ != QueueKind::copy && context_.counted_dispatch_) { | ||
| 3343 | replay.prepare_counted_dispatch = [this, &tracker_lock, &counted_batch]( | ||
| 3344 | VkBuffer args, VkDeviceSize args_offset, VkBuffer count, VkDeviceSize count_offset, | ||
| 3345 | std::uint32_t stride, std::uint32_t maximum, CountedDispatch& out) { | ||
| 3346 | // Pipeline creation is lazy and shared across queues; serialize it with other replay preparation. | ||
| 3347 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | ||
| 3348 | if (!counted_batch) counted_batch = context_.counted_dispatch_->batch(); | ||
| 3349 | return counted_batch->prepare(args, args_offset, count, count_offset, stride, maximum, out); | ||
| 3350 | }; | ||
| 3351 | replay.emit_counted_dispatch = [this](VkCommandBuffer cb, const CountedDispatch& job) { | ||
| 3352 | context_.counted_dispatch_->emit(cb, job); | ||
| 3353 | }; | ||
| 3354 | } | ||
| 3355 | if (kind_ != QueueKind::copy && context_.quad_indices_ && context_.scratch_) { | ||
| 3356 | replay.prepare_quad_indices = [this, &tracker_lock]( | ||
| 3357 | VkBuffer indices, VkDeviceSize offset, VkIndexType type, std::uint64_t readable, std::uint32_t quads, | ||
| 3358 | VkBuffer scratch, VkDeviceSize scratch_offset, QuadIndexExpansion& out) { | ||
| 3359 | // Pipeline creation is lazy and shared across queues; serialize it with other replay preparation. | ||
| 3360 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | ||
| 3361 | return context_.quad_indices_->prepare(indices, offset, type, readable, quads, scratch, | ||
| 3362 | scratch_offset, out); | ||
| 3363 | }; | ||
| 3364 | replay.emit_quad_indices = [this](VkCommandBuffer cb, const QuadIndexExpansion& job) { | ||
| 3365 | context_.quad_indices_->emit(cb, job); | ||
| 3366 | }; | ||
| 3367 | } | ||
| 3368 | if (context_.depth24_ && !transfer_only) { | ||
| 3369 | replay.depth24_prepare = [this, &tracker_lock, &depth24_guard](Depth24Job& job, | ||
| 3370 | std::vector<Depth24Job>& parts) { | ||
| 3371 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | ||
| 3372 | if (!depth24_guard.active) { | ||
| 3373 | depth24_guard.d24 = context_.depth24_.get(); | ||
| 3374 | context_.depth24_->collect(); | ||
| 3375 | depth24_guard.active = true; | ||
| 3376 | } | ||
| 3377 | return context_.depth24_->prepare(job, parts); | ||
| 3378 | }; | ||
| 3379 | } | ||
| 3380 | if (can_resolve_occlusion) { | ||
| 3381 | replay.sum_occlusion = [this](VkCommandBuffer cb, VkQueryPool pool, std::uint32_t first, | ||
| 3382 | std::uint32_t count, VkBuffer dst, VkDeviceSize offset) { | ||
| 3383 | occlusion_resolve_->sum(cb, pool, first, count, dst, offset); | ||
| 3384 | }; | ||
| 3385 | replay.resolve_binary_occlusion = [this](VkCommandBuffer cb, VkQueryPool pool, std::uint32_t first, | ||
| 3386 | std::uint32_t count, VkBuffer dst, VkDeviceSize offset) { | ||
| 3387 | occlusion_resolve_->normalize(cb, pool, first, count, dst, offset); | ||
| 3388 | }; | ||
| 3389 | replay.sum_statistics = [this](VkCommandBuffer cb, VkQueryPool pool, VkQueryPool mesh_pool, | ||
| 3390 | VkQueryPool primitives_pool, const std::uint8_t* mesh, | ||
| 3391 | std::uint32_t first, std::uint32_t count, VkBuffer dst, | ||
| 3392 | VkDeviceSize offset) { | ||
| 3393 | occlusion_resolve_->sum_statistics(cb, pool, mesh_pool, primitives_pool, mesh, first, count, dst, | ||
| 3394 | offset); | ||
| 3395 | }; | ||
| 3396 | replay.sum_binary_occlusion = [this](VkCommandBuffer cb, VkQueryPool pool, std::uint32_t first, | ||
| 3397 | std::uint32_t count, VkBuffer dst, VkDeviceSize offset) { | ||
| 3398 | occlusion_resolve_->sum_binary(cb, pool, first, count, dst, offset); | ||
| 3399 | }; | ||
| 3400 | } | ||
| 3401 | segments = 0; | ||
| 3402 | statistics_segments = 0; | ||
| 3403 | has_queries = false; | ||
| 3404 | // Collect unbuilt pipelines via PipelineCompiles (whether pipeline_workers_ is enabled or serial). | ||
| 3405 | // On pass 0, if any pipeline must be compiled, release pass-0 transient state along with tracker_lock | ||
| 3406 | // and resource_lock before invoking the compiler (keeping pipeline_lock so registered pipelines and | ||
| 3407 | // workers stay alive), then re-prepare on pass 1 against current resources. | ||
| 3408 | PipelineCompiles compiles; | ||
| 3409 | replay.compiles = &compiles; | ||
| 3410 | ReplayResult prepare_result = ReplayResult::success; | ||
| 3411 | for (std::size_t i = 0; i < lists.size(); ++i) { | ||
| 3412 | const auto result = prepare(*lists[i], resolve, replay, prepared[i], can_resolve_occlusion); | ||
| 3413 | if (result != ReplayResult::success) { | ||
| 3414 | prepare_result = result; | ||
| 3415 | break; | ||
| 3038 | } | 3416 | } |
| 3039 | return clamp_batch->prepare(arguments, argument_offset, count, count_offset, kind, stride, max_count, | 3417 | if (prepared[i].segment_count > UINT32_MAX - segments || |
| 3040 | out); | 3418 | prepared[i].statistics_segment_count > UINT32_MAX - statistics_segments) |
| 3041 | }; | 3419 | return queue_unsupported(__LINE__); |
| 3042 | } | 3420 | segments += prepared[i].segment_count; |
| 3043 | if (kind_ != QueueKind::copy && context_.counted_dispatch_) { | 3421 | statistics_segments += prepared[i].statistics_segment_count; |
| 3044 | replay.prepare_counted_dispatch = [this, &tracker_lock, &counted_batch]( | 3422 | has_queries = has_queries || !prepared[i].queries.empty(); |
| 3045 | VkBuffer args, VkDeviceSize args_offset, VkBuffer count, VkDeviceSize count_offset, | 3423 | } |
| 3046 | std::uint32_t stride, std::uint32_t maximum, CountedDispatch& out) { | 3424 | if (pass == 0 && !compiles.empty()) { |
| 3047 | // Pipeline creation is lazy and shared across queues; serialize it with other replay preparation. | 3425 | if (depth24_guard.active) { |
| 3048 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | 3426 | context_.depth24_->retire(progress_, 0); |
| 3049 | if (!counted_batch) counted_batch = context_.counted_dispatch_->batch(); | 3427 | depth24_guard.active = false; |
| 3050 | return counted_batch->prepare(args, args_offset, count, count_offset, stride, maximum, out); | ||
| 3051 | }; | ||
| 3052 | replay.emit_counted_dispatch = [this](VkCommandBuffer cb, const CountedDispatch& job) { | ||
| 3053 | context_.counted_dispatch_->emit(cb, job); | ||
| 3054 | }; | ||
| 3055 | } | ||
| 3056 | if (kind_ != QueueKind::copy && context_.quad_indices_ && context_.scratch_) { | ||
| 3057 | replay.prepare_quad_indices = [this, &tracker_lock]( | ||
| 3058 | VkBuffer indices, VkDeviceSize offset, VkIndexType type, std::uint64_t readable, std::uint32_t quads, | ||
| 3059 | VkBuffer scratch, VkDeviceSize scratch_offset, QuadIndexExpansion& out) { | ||
| 3060 | // Pipeline creation is lazy and shared across queues; serialize it with other replay preparation. | ||
| 3061 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | ||
| 3062 | return context_.quad_indices_->prepare(indices, offset, type, readable, quads, scratch, | ||
| 3063 | scratch_offset, out); | ||
| 3064 | }; | ||
| 3065 | replay.emit_quad_indices = [this](VkCommandBuffer cb, const QuadIndexExpansion& job) { | ||
| 3066 | context_.quad_indices_->emit(cb, job); | ||
| 3067 | }; | ||
| 3068 | } | ||
| 3069 | if (context_.depth24_ && !transfer_only) { | ||
| 3070 | replay.depth24_prepare = [this, &tracker_lock, &depth24_guard](Depth24Job& job, | ||
| 3071 | std::vector<Depth24Job>& parts) { | ||
| 3072 | if (!tracker_lock.owns_lock()) tracker_lock.lock(); | ||
| 3073 | if (!depth24_guard.active) { | ||
| 3074 | context_.depth24_->collect(); | ||
| 3075 | depth24_guard.active = true; | ||
| 3076 | } | 3428 | } |
| 3077 | return context_.depth24_->prepare(job, parts); | 3429 | if (scratch_guard.active) { |
| 3078 | }; | 3430 | context_.scratch_->retire(progress_, 0); |
| 3079 | } | 3431 | scratch_guard.active = false; |
| 3080 | const auto& occlusion_memory = context_.occlusion_resolve_memory_; | 3432 | } |
| 3081 | const bool can_resolve_occlusion = occlusion_memory.memoryTypeCount != 0; | 3433 | if (clamp_guard.active) { |
| 3082 | if (can_resolve_occlusion) { | 3434 | context_.indirect_clamp_->retire(progress_, 0); |
| 3083 | replay.sum_occlusion = [this](VkCommandBuffer cb, VkQueryPool pool, std::uint32_t first, | 3435 | clamp_guard.active = false; |
| 3084 | std::uint32_t count, VkBuffer dst, VkDeviceSize offset) { | 3436 | } |
| 3085 | occlusion_resolve_->sum(cb, pool, first, count, dst, offset); | 3437 | batch.reset(); |
| 3086 | }; | 3438 | copy_batch.reset(); |
| 3087 | replay.resolve_binary_occlusion = [this](VkCommandBuffer cb, VkQueryPool pool, std::uint32_t first, | 3439 | counted_batch.reset(); |
| 3088 | std::uint32_t count, VkBuffer dst, VkDeviceSize offset) { | 3440 | clamp_batch.reset(); |
| 3089 | occlusion_resolve_->normalize(cb, pool, first, count, dst, offset); | 3441 | if (tracker_lock.owns_lock()) tracker_lock.unlock(); |
| 3090 | }; | 3442 | resource_lock.unlock(); |
| 3091 | replay.sum_statistics = [this](VkCommandBuffer cb, VkQueryPool pool, VkQueryPool mesh_pool, | 3443 | recycle_khr_stages(khr_guard.stages); |
| 3092 | VkQueryPool primitives_pool, const std::uint8_t* mesh, | 3444 | recycle_khr_as_queries(khr_guard.as_queries); |
| 3093 | std::uint32_t first, std::uint32_t count, VkBuffer dst, | 3445 | geometry.clear(); |
| 3094 | VkDeviceSize offset) { | 3446 | |
| 3095 | occlusion_resolve_->sum_statistics(cb, pool, mesh_pool, primitives_pool, mesh, first, count, dst, | 3447 | std::shared_ptr<void> demand; |
| 3096 | offset); | 3448 | if (context_.large_compile_demand_ && compiles.any_large()) demand = context_.large_compile_demand_(); |
| 3097 | }; | 3449 | if (context_.pipeline_workers_) |
| 3098 | replay.sum_binary_occlusion = [this](VkCommandBuffer cb, VkQueryPool pool, std::uint32_t first, | 3450 | compiles.build(run_compiles, context_.large_compile_budget_); |
| 3099 | std::uint32_t count, VkBuffer dst, VkDeviceSize offset) { | 3451 | else |
| 3100 | occlusion_resolve_->sum_binary(cb, pool, first, count, dst, offset); | 3452 | compiles.build_serial(); |
| 3101 | }; | 3453 | demand.reset(); |
| 3102 | } | 3454 | const ReplayResult compile_result = check_compiled_pipelines(compiles, prepare_result); |
| 3103 | const auto resolve = [this](ResourceId id) { return context_.resolve(id); }; | 3455 | if (compile_result != ReplayResult::success) return compile_result; |
| 3104 | std::uint32_t segments = 0, statistics_segments = 0; | 3456 | prior_compiles = std::move(compiles); |
| 3105 | bool has_queries = false; | 3457 | has_prior_compiles = true; |
| 3106 | // With workers, the pipelines the lists need and that are not built yet are compiled together below instead of | 3458 | continue; |
| 3107 | // one after another in prepare(). resource_lock is held until they are all built, which keeps the pipeline | ||
| 3108 | // states that own them alive (remove_pipeline takes it uniquely). | ||
| 3109 | PipelineCompiles compiles; | ||
| 3110 | if (context_.pipeline_workers_) replay.compiles = &compiles; | ||
| 3111 | ReplayResult prepare_result = ReplayResult::success; | ||
| 3112 | for (std::size_t i = 0; i < lists.size(); ++i) { | ||
| 3113 | const auto result = prepare(*lists[i], resolve, replay, prepared[i], can_resolve_occlusion); | ||
| 3114 | if (result != ReplayResult::success) { | ||
| 3115 | prepare_result = result; | ||
| 3116 | break; | ||
| 3117 | } | 3459 | } |
| 3118 | if (prepared[i].segment_count > UINT32_MAX - segments || | 3460 | const PipelineCompiles* prior = has_prior_compiles ? &prior_compiles : nullptr; |
| 3119 | prepared[i].statistics_segment_count > UINT32_MAX - statistics_segments) | 3461 | prepare_result = context_.pipeline_workers_ |
| 3120 | return queue_unsupported(__LINE__); | 3462 | ? build_pipelines(compiles, std::span(prepared).first(lists.size()), prepare_result, |
| 3121 | segments += prepared[i].segment_count; | 3463 | run_compiles, context_.large_compile_budget_, prior) |
| 3122 | statistics_segments += prepared[i].statistics_segment_count; | 3464 | : build_pipelines_serial(compiles, std::span(prepared).first(lists.size()), |
| 3123 | has_queries = has_queries || !prepared[i].queries.empty(); | 3465 | prepare_result, prior); |
| 3124 | } | 3466 | replay.compiles = nullptr; |
| 3125 | prepare_result = build_pipelines( | 3467 | if (prepare_result != ReplayResult::success) return prepare_result; |
| 3126 | compiles, std::span(prepared).first(lists.size()), prepare_result, | 3468 | break; |
| 3127 | [this](std::size_t count, const std::function<void(std::size_t)>& job) { | 3469 | } |
| 3128 | context_.pipeline_workers_->run(count, job); | ||
| 3129 | }); | ||
| 3130 | if (prepare_result != ReplayResult::success) return prepare_result; | ||
| 3131 | const auto segment_pool = [this](VkQueryType type, std::uint32_t count, | 3470 | const auto segment_pool = [this](VkQueryType type, std::uint32_t count, |
| 3132 | std::shared_ptr<OcclusionSegmentPool>& out) { | 3471 | std::shared_ptr<OcclusionSegmentPool>& out) { |
| 3133 | const auto& vk = context_.vk; | 3472 | const auto& vk = context_.vk; |
| @@ -3254,6 +3593,7 @@ private: | |||
| 3254 | const bool ended = context_.observe_result(context_.vk.vkEndCommandBuffer(command_buffer), | 3593 | const bool ended = context_.observe_result(context_.vk.vkEndCommandBuffer(command_buffer), |
| 3255 | "vkEndCommandBuffer") == VK_SUCCESS; | 3594 | "vkEndCommandBuffer") == VK_SUCCESS; |
| 3256 | resource_lock.unlock(); | 3595 | resource_lock.unlock(); |
| 3596 | pipeline_lock.unlock(); | ||
| 3257 | const bool submitted = ended && submit(command_buffer, VK_NULL_HANDLE, 0); | 3597 | const bool submitted = ended && submit(command_buffer, VK_NULL_HANDLE, 0); |
| 3258 | if (!submitted) discard(); | 3598 | if (!submitted) discard(); |
| 3259 | if (depth24_guard.active) { | 3599 | if (depth24_guard.active) { |
| @@ -3331,6 +3671,25 @@ private: | |||
| 3331 | auto pieces = detail::current(&next_tracker, id, range, VK_IMAGE_LAYOUT_UNDEFINED); | 3671 | auto pieces = detail::current(&next_tracker, id, range, VK_IMAGE_LAYOUT_UNDEFINED); |
| 3332 | detail::initialize(replay, command_buffer, *image, id, pieces, VK_IMAGE_LAYOUT_GENERAL, &next_tracker); | 3672 | detail::initialize(replay, command_buffer, *image, id, pieces, VK_IMAGE_LAYOUT_GENERAL, &next_tracker); |
| 3333 | } | 3673 | } |
| 3674 | // The prelude (set_prelude): recorded here, after the set's upload and before the lists, and in either case | ||
| 3675 | // after the last submission of another queue that recorded one (its pass writes what these lists read, and | ||
| 3676 | // a pass here must not overtake it). | ||
| 3677 | const bool prelude = !transfer_only && context_.prelude_record_ && context_.prelude_record_(command_buffer); | ||
| 3678 | // LEONIDA_PRELUDE_QUEUE_WAIT=0 (an experiment): no wait for another queue's pass, so the queues do not | ||
| 3679 | // serialise on each other's whole submissions; a list may then read what that pass has not written yet. | ||
| 3680 | static const bool cross_wait = [] { | ||
| 3681 | const char* v = std::getenv("LEONIDA_PRELUDE_QUEUE_WAIT"); | ||
| 3682 | return !(v && v[0] == '0' && v[1] == 0); | ||
| 3683 | }(); | ||
| 3684 | { | ||
| 3685 | std::lock_guard lock(context_.storage_mutex_); | ||
| 3686 | if (cross_wait && context_.prelude_semaphore_ && context_.prelude_semaphore_ != progress_ && | ||
| 3687 | context_.prelude_version_ != prelude_seen_) { | ||
| 3688 | waits_.push_back(context_.prelude_semaphore_); | ||
| 3689 | wait_values_.push_back(context_.prelude_value_); | ||
| 3690 | } | ||
| 3691 | prelude_seen_ = context_.prelude_version_; | ||
| 3692 | } | ||
| 3334 | bool wrote_readback = false; | 3693 | bool wrote_readback = false; |
| 3335 | VkPipelineStageFlags2 readback_stages = 0; | 3694 | VkPipelineStageFlags2 readback_stages = 0; |
| 3336 | std::uint32_t open_labels = 0; // events may span the lists of one ExecuteCommandLists | 3695 | std::uint32_t open_labels = 0; // events may span the lists of one ExecuteCommandLists |
| @@ -3387,7 +3746,8 @@ private: | |||
| 3387 | } | 3746 | } |
| 3388 | const bool ended = context_.observe_result(context_.vk.vkEndCommandBuffer(command_buffer), | 3747 | const bool ended = context_.observe_result(context_.vk.vkEndCommandBuffer(command_buffer), |
| 3389 | "vkEndCommandBuffer") == VK_SUCCESS; | 3748 | "vkEndCommandBuffer") == VK_SUCCESS; |
| 3390 | resource_lock.unlock(); // release resource_mutex_ before vkQueueSubmit while keeping tracker_lock held | 3749 | resource_lock.unlock(); // release resource_mutex_ and pipeline_mutex_ before vkQueueSubmit while keeping tracker_lock held |
| 3750 | pipeline_lock.unlock(); | ||
| 3391 | const bool wait_previous = ordered_timestamps && submitted_; | 3751 | const bool wait_previous = ordered_timestamps && submitted_; |
| 3392 | if (wait_previous) { | 3752 | if (wait_previous) { |
| 3393 | waits_.push_back(progress_); | 3753 | waits_.push_back(progress_); |
| @@ -3418,6 +3778,16 @@ private: | |||
| 3418 | ++context_.bindless_upload_version_; | 3778 | ++context_.bindless_upload_version_; |
| 3419 | bindless_upload_seen_ = context_.bindless_upload_version_; | 3779 | bindless_upload_seen_ = context_.bindless_upload_version_; |
| 3420 | } | 3780 | } |
| 3781 | if (prelude) { | ||
| 3782 | if (submitted) { | ||
| 3783 | std::lock_guard lock(context_.storage_mutex_); | ||
| 3784 | context_.prelude_semaphore_ = progress_; | ||
| 3785 | context_.prelude_value_ = submitted_; | ||
| 3786 | ++context_.prelude_version_; | ||
| 3787 | prelude_seen_ = context_.prelude_version_; | ||
| 3788 | } | ||
| 3789 | if (context_.prelude_commit_) context_.prelude_commit_(submitted, context_.submitted_retire_ticket()); | ||
| 3790 | } | ||
| 3421 | if (wait_previous && !submitted && !waits_.empty()) { // a failed submit keeps the waits for the next one | 3791 | if (wait_previous && !submitted && !waits_.empty()) { // a failed submit keeps the waits for the next one |
| 3422 | waits_.pop_back(); | 3792 | waits_.pop_back(); |
| 3423 | wait_values_.pop_back(); | 3793 | wait_values_.pop_back(); |
| @@ -3538,7 +3908,9 @@ private: | |||
| 3538 | 3908 | ||
| 3539 | // Appends `op`, which takes the pending waits with it (a marker has none). Called with state_mutex_ held. | 3909 | // Appends `op`, which takes the pending waits with it (a marker has none). Called with state_mutex_ held. |
| 3540 | void hold(Deferred&& op) { | 3910 | void hold(Deferred&& op) { |
| 3541 | op.seq = context_.holds().next_seq(); | 3911 | // A call the worker runs (LEONIDA_SUBMIT_ASYNC) keeps the number it was queued with: what was registered |
| 3912 | // behind it (a Present) still waits for it. | ||
| 3913 | op.seq = async_seq_ ? async_seq_ : context_.holds().next_seq(); | ||
| 3542 | if (op.kind != Deferred::Kind::marker) { | 3914 | if (op.kind != Deferred::Kind::marker) { |
| 3543 | op.waits = std::move(waits_); | 3915 | op.waits = std::move(waits_); |
| 3544 | op.wait_values = std::move(wait_values_); | 3916 | op.wait_values = std::move(wait_values_); |
| @@ -3549,6 +3921,7 @@ private: | |||
| 3549 | } | 3921 | } |
| 3550 | if (gpu_latency::enabled()) op.held_at = std::chrono::steady_clock::now(); | 3922 | if (gpu_latency::enabled()) op.held_at = std::chrono::steady_clock::now(); |
| 3551 | held_.push_back(std::move(op)); | 3923 | held_.push_back(std::move(op)); |
| 3924 | held_front_seq_.store(held_.front().seq, std::memory_order_release); | ||
| 3552 | context_.holds().held_changed(1); | 3925 | context_.holds().held_changed(1); |
| 3553 | } | 3926 | } |
| 3554 | 3927 | ||
| @@ -3595,7 +3968,21 @@ private: | |||
| 3595 | bool ready(const Deferred& op) const { return !waits_pending(op.waits, op.wait_values); } | 3968 | bool ready(const Deferred& op) const { return !waits_pending(op.waits, op.wait_values); } |
| 3596 | 3969 | ||
| 3597 | // Holder: called by the thread whose Signal made a held operation ready (never with a queue lock held). | 3970 | // Holder: called by the thread whose Signal made a held operation ready (never with a queue lock held). |
| 3971 | // With LEONIDA_SUBMIT_ASYNC another thread does not run this queue's held work: it asks the queue's worker, | ||
| 3972 | // which releases it and then pumps the holds itself (so a Present behind it still runs after it). | ||
| 3598 | bool release_ready() override { | 3973 | bool release_ready() override { |
| 3974 | if (async_started_.load(std::memory_order_acquire) && t_worker_of_ != this) { | ||
| 3975 | { | ||
| 3976 | std::lock_guard lock(inbox_mutex_); | ||
| 3977 | release_requested_ = true; | ||
| 3978 | } | ||
| 3979 | inbox_cv_.notify_one(); | ||
| 3980 | return false; | ||
| 3981 | } | ||
| 3982 | return release_held(); | ||
| 3983 | } | ||
| 3984 | |||
| 3985 | bool release_held() { | ||
| 3599 | std::vector<std::shared_ptr<void>> retired; | 3986 | std::vector<std::shared_ptr<void>> retired; |
| 3600 | bool released = false; | 3987 | bool released = false; |
| 3601 | { | 3988 | { |
| @@ -3604,8 +3991,19 @@ private: | |||
| 3604 | Deferred op = std::move(held_.front()); | 3991 | Deferred op = std::move(held_.front()); |
| 3605 | held_.pop_front(); | 3992 | held_.pop_front(); |
| 3606 | context_.holds().held_changed(-1); | 3993 | context_.holds().held_changed(-1); |
| 3607 | if (gpu_latency::enabled()) gpu_latency::held(int(kind_), int(op.kind), op.held_at); | 3994 | if (gpu_latency::enabled()) { |
| 3995 | // The wait that was pending when it was held: the fence whose Signal let it go. | ||
| 3996 | std::uint64_t fence = 0, value = 0; | ||
| 3997 | for (std::size_t i = 0; i < op.waits.size(); ++i) | ||
| 3998 | if (op.wait_values[i] > value) { | ||
| 3999 | fence = std::uint64_t(reinterpret_cast<std::uintptr_t>(op.waits[i])); | ||
| 4000 | value = op.wait_values[i]; | ||
| 4001 | } | ||
| 4002 | gpu_latency::held(int(kind_), int(op.kind), op.held_at, fence, value); | ||
| 4003 | } | ||
| 3608 | if (!context_.is_device_lost()) run(op); | 4004 | if (!context_.is_device_lost()) run(op); |
| 4005 | // Only now: until it has run, the operation still counts as the oldest held one. | ||
| 4006 | held_front_seq_.store(held_.empty() ? 0 : held_.front().seq, std::memory_order_release); | ||
| 3609 | released = true; | 4007 | released = true; |
| 3610 | } | 4008 | } |
| 3611 | drain_pins(retired); | 4009 | drain_pins(retired); |
| @@ -3630,13 +4028,22 @@ private: | |||
| 3630 | it = held_.erase(it); | 4028 | it = held_.erase(it); |
| 3631 | context_.holds().held_changed(-1); | 4029 | context_.holds().held_changed(-1); |
| 3632 | } | 4030 | } |
| 4031 | held_front_seq_.store(held_.empty() ? 0 : held_.front().seq, std::memory_order_release); | ||
| 3633 | } | 4032 | } |
| 3634 | } | 4033 | } |
| 3635 | 4034 | ||
| 3636 | // Holder: the sequence number of the oldest held operation. | 4035 | // Holder: the sequence number of the oldest held operation. |
| 3637 | std::uint64_t oldest_held_seq() override { | 4036 | std::uint64_t oldest_held_seq() override { |
| 3638 | std::lock_guard state(state_mutex_); | 4037 | if (!async_on()) { |
| 3639 | return held_.empty() ? 0 : held_.front().seq; | 4038 | std::lock_guard state(state_mutex_); |
| 4039 | return held_.empty() ? 0 : held_.front().seq; | ||
| 4040 | } | ||
| 4041 | // Not under state_mutex_, which the worker holds while it replays: the front's number is kept apart. | ||
| 4042 | std::uint64_t oldest = held_front_seq_.load(std::memory_order_acquire); | ||
| 4043 | std::lock_guard lock(inbox_mutex_); | ||
| 4044 | const std::uint64_t queued = running_seq_ ? running_seq_ : inbox_.empty() ? 0 : inbox_.front().seq; | ||
| 4045 | if (queued && (!oldest || queued < oldest)) oldest = queued; | ||
| 4046 | return oldest; | ||
| 3640 | } | 4047 | } |
| 3641 | 4048 | ||
| 3642 | // A queue destroyed with held work. Reported, not waited for: nothing was submitted for it, so the VkQueue is | 4049 | // A queue destroyed with held work. Reported, not waited for: nothing was submitted for it, so the VkQueue is |
| @@ -3662,6 +4069,7 @@ private: | |||
| 3662 | if (op.kind == Deferred::Kind::signal) context_.cancel_fence_waits(op.fence); | 4069 | if (op.kind == Deferred::Kind::signal) context_.cancel_fence_waits(op.fence); |
| 3663 | context_.holds().held_changed(-static_cast<std::int64_t>(held_.size())); | 4070 | context_.holds().held_changed(-static_cast<std::int64_t>(held_.size())); |
| 3664 | dropped.swap(held_); | 4071 | dropped.swap(held_); |
| 4072 | held_front_seq_.store(0, std::memory_order_release); | ||
| 3665 | } | 4073 | } |
| 3666 | // The pins (fences, pipeline states) are released here, outside the lock. | 4074 | // The pins (fences, pipeline states) are released here, outside the lock. |
| 3667 | } | 4075 | } |
| @@ -3796,8 +4204,12 @@ private: | |||
| 3796 | pending_bindings_.push_back(std::move(pending)); | 4204 | pending_bindings_.push_back(std::move(pending)); |
| 3797 | { | 4205 | { |
| 3798 | std::lock_guard lock(context_.submit_mutex()); | 4206 | std::lock_guard lock(context_.submit_mutex()); |
| 3799 | const auto result = context_.observe_result(vk.vkQueueBindSparse(queue_, 1, &info, VK_NULL_HANDLE), | 4207 | VkResult bound; |
| 3800 | "vkQueueBindSparse"); | 4208 | { |
| 4209 | const SubmitMutex::SubmitTurn turn(context_.submit_mutex()); // a queue operation: the compile gate | ||
| 4210 | bound = vk.vkQueueBindSparse(queue_, 1, &info, VK_NULL_HANDLE); | ||
| 4211 | } | ||
| 4212 | const auto result = context_.observe_result(bound, "vkQueueBindSparse"); | ||
| 3801 | if (result != VK_SUCCESS) { | 4213 | if (result != VK_SUCCESS) { |
| 3802 | if (result == VK_ERROR_DEVICE_LOST) context_.mark_device_lost(); | 4214 | if (result == VK_ERROR_DEVICE_LOST) context_.mark_device_lost(); |
| 3803 | pending_bindings_.pop_back(); | 4215 | pending_bindings_.pop_back(); |
| @@ -4021,10 +4433,32 @@ private: | |||
| 4021 | if (diagnostics) pass_trace(*diagnostics); | 4433 | if (diagnostics) pass_trace(*diagnostics); |
| 4022 | // Publish before the driver can execute a marker or a concurrent fence wait can see the loss. | 4434 | // Publish before the driver can execute a marker or a concurrent fence wait can see the loss. |
| 4023 | if (diagnostics) context_.device_fault()->publish(std::move(*diagnostics)); | 4435 | if (diagnostics) context_.device_fault()->publish(std::move(*diagnostics)); |
| 4024 | const auto label_fence=context_.gpu_labels_.submit_fence(command_buffer); | 4436 | DeviceFaultDiagnostics* const ring = context_.device_fault(); |
| 4025 | res = context_.observe_result(context_.vk.vkQueueSubmit(queue_, 1, &submit, label_fence), | 4437 | std::size_t ring_at = 0; |
| 4438 | const std::int64_t submit_start = diagnostic_ms(); | ||
| 4439 | if (ring) { | ||
| 4440 | SubmitRecord record; | ||
| 4441 | record.at_ms = submit_start; | ||
| 4442 | record.queue = queue_; | ||
| 4443 | record.kind = kind_ == QueueKind::direct ? "direct" : kind_ == QueueKind::compute ? "compute" : "copy"; | ||
| 4444 | record.progress = progress_; | ||
| 4445 | record.ticket = ticket; | ||
| 4446 | record.buffers = submit.commandBufferCount; | ||
| 4447 | if (signals_fence) { | ||
| 4448 | record.fence = fence; | ||
| 4449 | record.fence_value = value; | ||
| 4450 | } | ||
| 4451 | record.waits = std::uint32_t(semaphores.size()); | ||
| 4452 | for (std::size_t i = 0; i < semaphores.size() && i < SubmitRecord::max_waits; ++i) { | ||
| 4453 | record.wait_semaphores[i] = semaphores[i]; | ||
| 4454 | record.wait_values[i] = values[i]; | ||
| 4455 | } | ||
| 4456 | ring_at = ring->begin_submit(record); | ||
| 4457 | } | ||
| 4458 | res = context_.observe_result(context_.queue_submit(queue_, 1, &submit, context_.gpu_labels_.submit_fence(command_buffer)), | ||
| 4026 | "vkQueueSubmit"); | 4459 | "vkQueueSubmit"); |
| 4027 | context_.gpu_labels_.submitted(command_buffer,res==VK_SUCCESS); | 4460 | context_.gpu_labels_.submitted(command_buffer, res == VK_SUCCESS); |
| 4461 | if (ring) ring->end_submit(ring_at, diagnostic_ms() - submit_start, res); | ||
| 4028 | if (res == VK_SUCCESS) { | 4462 | if (res == VK_SUCCESS) { |
| 4029 | context_.record_submit_locked(progress_, ticket); | 4463 | context_.record_submit_locked(progress_, ticket); |
| 4030 | if (signals_fence) context_.holds().signaled(fence, value); | 4464 | if (signals_fence) context_.holds().signaled(fence, value); |
| @@ -4063,6 +4497,7 @@ private: | |||
| 4063 | std::unique_ptr<OcclusionResolve> occlusion_resolve_; | 4497 | std::unique_ptr<OcclusionResolve> occlusion_resolve_; |
| 4064 | std::uint64_t storage_init_seen_ = 0; // the storage_init_version_ this queue has waited for | 4498 | std::uint64_t storage_init_seen_ = 0; // the storage_init_version_ this queue has waited for |
| 4065 | std::uint64_t bindless_upload_seen_ = 0; // the bindless_upload_version_ this queue has waited for | 4499 | std::uint64_t bindless_upload_seen_ = 0; // the bindless_upload_version_ this queue has waited for |
| 4500 | std::uint64_t prelude_seen_ = 0; // the prelude_version_ this queue has waited for (or recorded) | ||
| 4066 | std::uint64_t last_sparse_ = 0; | 4501 | std::uint64_t last_sparse_ = 0; |
| 4067 | std::deque<PendingBindings> pending_bindings_; | 4502 | std::deque<PendingBindings> pending_bindings_; |
| 4068 | std::vector<VkSemaphore> waits_; | 4503 | std::vector<VkSemaphore> waits_; |
| @@ -4072,8 +4507,260 @@ private: | |||
| 4072 | std::vector<PreparedList> prepared_; | 4507 | std::vector<PreparedList> prepared_; |
| 4073 | std::uint32_t open_labels_ = 0; // queue labels begun and not ended | 4508 | std::uint32_t open_labels_ = 0; // queue labels begun and not ended |
| 4074 | bool ok_ = false; | 4509 | bool ok_ = false; |
| 4075 | // Wait-before-Signal. state_mutex_ is outermost (before resource_mutex_ -> tracker_mutex_ -> submit_mutex_) and | 4510 | // ---- LEONIDA_SUBMIT_ASYNC=<n>: the queue's calls run on a worker of its own ----------------------------------- |
| 4076 | // guards the members above that execute, signal, wait and marker touch. | 4511 | // ExecuteCommandLists, Signal, Wait and the markers are queued in call order and return at once; one worker per |
| 4512 | // queue runs each through the synchronous path (execute_sync & co.), so the replay, the before-submission | ||
| 4513 | // refreshes and vkQueueSubmit leave the caller's thread and overlap with its next frame. At most n batches wait per | ||
| 4514 | // queue; the caller of the next one waits for room (the in-flight bound). A queued call counts as held work | ||
| 4515 | // (QueueHolds), numbered when it was called, so a Present behind it still waits for it and cross-queue order is | ||
| 4516 | // the call order. Calls that use the queue's state at once (tile mappings, idle, the destructor) first wait for | ||
| 4517 | // what is queued. A batch that fails is reported as a held one is (stderr, take_held_failure()). Off (0) by | ||
| 4518 | // default: every call runs on the caller's thread, as before. | ||
| 4519 | static unsigned async_depth() { | ||
| 4520 | static const unsigned depth = [] { | ||
| 4521 | const char* v = std::getenv("LEONIDA_SUBMIT_ASYNC"); | ||
| 4522 | const int n = v && *v ? std::atoi(v) : 0; | ||
| 4523 | return n > 0 ? unsigned(n) : 0u; | ||
| 4524 | }(); | ||
| 4525 | return depth; | ||
| 4526 | } | ||
| 4527 | |||
| 4528 | bool async_on() const { return async_depth() && !synchronous_; } | ||
| 4529 | |||
| 4530 | struct Call { | ||
| 4531 | enum class Kind : std::uint8_t { execute, signal, wait, marker }; | ||
| 4532 | Kind kind = Kind::execute; | ||
| 4533 | std::uint64_t seq = 0, execute_call = 0, value = 0; | ||
| 4534 | std::vector<CommandList> lists; // copies: the application may Reset its lists after the call | ||
| 4535 | std::shared_ptr<void> pin; // the fence, or the lists' pipeline states and root signatures | ||
| 4536 | VkSemaphore fence = VK_NULL_HANDLE; | ||
| 4537 | DebugMarker::Kind marker_kind = DebugMarker::Kind::set; | ||
| 4538 | std::string label; | ||
| 4539 | std::chrono::steady_clock::time_point queued_at{}; | ||
| 4540 | }; | ||
| 4541 | |||
| 4542 | struct AsyncStats { // under inbox_mutex_, since the last line | ||
| 4543 | std::uint64_t calls = 0, batches = 0, room_waits = 0, room_wait_ns = 0, run_ns = 0, lag_ns = 0, lag_max_ns = 0; | ||
| 4544 | std::size_t depth_max = 0; | ||
| 4545 | std::chrono::steady_clock::time_point since = std::chrono::steady_clock::now(); | ||
| 4546 | }; | ||
| 4547 | |||
| 4548 | void enqueue(Call&& call) { | ||
| 4549 | const bool batch = call.kind == Call::Kind::execute; | ||
| 4550 | std::unique_lock lock(inbox_mutex_); | ||
| 4551 | if (!worker_.joinable()) { | ||
| 4552 | worker_ = std::thread([this] { async_worker(); }); | ||
| 4553 | async_started_.store(true, std::memory_order_release); | ||
| 4554 | } | ||
| 4555 | // n batches, and 4n calls of any kind (a title that signals after every small job must not queue Signals | ||
| 4556 | // without bound). n = 1 makes each caller wait for the batch before it: n should be 2 or more. | ||
| 4557 | const auto room = [this, batch] { | ||
| 4558 | return async_stop_ || | ||
| 4559 | ((!batch || inbox_batches_ < async_depth()) && inbox_.size() < 4 * std::size_t(async_depth())); | ||
| 4560 | }; | ||
| 4561 | if (!room()) { | ||
| 4562 | const auto start = std::chrono::steady_clock::now(); | ||
| 4563 | room_cv_.wait(lock, room); | ||
| 4564 | ++async_stats_.room_waits; | ||
| 4565 | async_stats_.room_wait_ns += std::uint64_t( | ||
| 4566 | std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now() - start).count()); | ||
| 4567 | } | ||
| 4568 | if (batch) { | ||
| 4569 | ++inbox_batches_; | ||
| 4570 | ++async_stats_.batches; | ||
| 4571 | } | ||
| 4572 | ++async_stats_.calls; | ||
| 4573 | call.seq = context_.holds().next_seq(); | ||
| 4574 | call.queued_at = std::chrono::steady_clock::now(); | ||
| 4575 | context_.holds().held_changed(1); | ||
| 4576 | inbox_.push_back(std::move(call)); | ||
| 4577 | async_stats_.depth_max = std::max(async_stats_.depth_max, inbox_.size()); | ||
| 4578 | lock.unlock(); | ||
| 4579 | inbox_cv_.notify_one(); | ||
| 4580 | } | ||
| 4581 | |||
| 4582 | void async_worker() { | ||
| 4583 | t_worker_of_ = this; | ||
| 4584 | for (;;) { | ||
| 4585 | Call call; | ||
| 4586 | bool have = false, release = false; | ||
| 4587 | { | ||
| 4588 | std::unique_lock lock(inbox_mutex_); | ||
| 4589 | inbox_cv_.wait(lock, [this] { return !inbox_.empty() || release_requested_ || async_stop_; }); | ||
| 4590 | release = std::exchange(release_requested_, false); | ||
| 4591 | if (!inbox_.empty()) { | ||
| 4592 | call = std::move(inbox_.front()); | ||
| 4593 | inbox_.pop_front(); | ||
| 4594 | running_seq_ = call.seq; | ||
| 4595 | have = true; | ||
| 4596 | } else if (!release) { | ||
| 4597 | return; // stopping, nothing queued | ||
| 4598 | } | ||
| 4599 | worker_busy_ = true; | ||
| 4600 | } | ||
| 4601 | if (release) release_held(); | ||
| 4602 | std::uint64_t ran_ns = 0; | ||
| 4603 | if (have) { | ||
| 4604 | const auto start = std::chrono::steady_clock::now(); | ||
| 4605 | run_call(call); | ||
| 4606 | const auto end = std::chrono::steady_clock::now(); | ||
| 4607 | ran_ns = std::uint64_t(std::chrono::duration_cast<std::chrono::nanoseconds>(end - start).count()); | ||
| 4608 | const auto lag = std::uint64_t( | ||
| 4609 | std::chrono::duration_cast<std::chrono::nanoseconds>(start - call.queued_at).count()); | ||
| 4610 | std::lock_guard lock(inbox_mutex_); | ||
| 4611 | async_stats_.run_ns += ran_ns; | ||
| 4612 | async_stats_.lag_ns += lag; | ||
| 4613 | async_stats_.lag_max_ns = std::max(async_stats_.lag_max_ns, lag); | ||
| 4614 | } | ||
| 4615 | { | ||
| 4616 | std::lock_guard lock(inbox_mutex_); | ||
| 4617 | running_seq_ = 0; | ||
| 4618 | worker_busy_ = false; | ||
| 4619 | if (have && call.kind == Call::Kind::execute) --inbox_batches_; | ||
| 4620 | if (have) room_cv_.notify_all(); | ||
| 4621 | idle_cv_.notify_all(); | ||
| 4622 | report_async_locked(); | ||
| 4623 | } | ||
| 4624 | if (have) context_.holds().held_changed(-1); | ||
| 4625 | call = Call{}; // the copies and pins go before the pump, outside the lock | ||
| 4626 | context_.holds().pump_ready(); | ||
| 4627 | } | ||
| 4628 | } | ||
| 4629 | |||
| 4630 | // An exception on the worker would end the process (std::terminate) and leave the queue's callers waiting: it is | ||
| 4631 | // turned into a held failure and a lost device instead, as a failed submission would be, and the worker goes on | ||
| 4632 | // (each later call fails at once on the lost device). | ||
| 4633 | void run_call(Call& call) { | ||
| 4634 | try { | ||
| 4635 | run_call_unguarded(call); | ||
| 4636 | } catch (const std::exception& e) { | ||
| 4637 | worker_threw(call, e.what()); | ||
| 4638 | } catch (...) { | ||
| 4639 | worker_threw(call, "not a std::exception"); | ||
| 4640 | } | ||
| 4641 | async_seq_ = 0; | ||
| 4642 | } | ||
| 4643 | |||
| 4644 | void worker_threw(const Call& call, const char* what) { | ||
| 4645 | int none = static_cast<int>(ReplayResult::success); | ||
| 4646 | held_failure_.compare_exchange_strong(none, static_cast<int>(ReplayResult::unsupported)); | ||
| 4647 | std::fprintf(stderr, "[rt] d3d12: the queue's worker caught an exception running a queued %s (%s); the device is " | ||
| 4648 | "marked lost\n", | ||
| 4649 | call.kind == Call::Kind::execute ? "ExecuteCommandLists" | ||
| 4650 | : call.kind == Call::Kind::signal ? "Signal" | ||
| 4651 | : call.kind == Call::Kind::wait ? "Wait" | ||
| 4652 | : "marker", | ||
| 4653 | what); | ||
| 4654 | context_.mark_device_lost(); | ||
| 4655 | } | ||
| 4656 | |||
| 4657 | void run_call_unguarded(Call& call) { | ||
| 4658 | async_seq_ = call.seq; | ||
| 4659 | const PinFn pin = call.pin ? PinFn([&call] { return call.pin; }) : PinFn{}; | ||
| 4660 | switch (call.kind) { | ||
| 4661 | case Call::Kind::execute: { | ||
| 4662 | std::vector<const CommandList*> lists; | ||
| 4663 | lists.reserve(call.lists.size()); | ||
| 4664 | for (const CommandList& list : call.lists) lists.push_back(&list); | ||
| 4665 | const ReplayResult result = execute_sync(lists, pin, call.execute_call); | ||
| 4666 | if (result != ReplayResult::success) { | ||
| 4667 | int none = static_cast<int>(ReplayResult::success); | ||
| 4668 | held_failure_.compare_exchange_strong(none, static_cast<int>(result)); | ||
| 4669 | std::fprintf(stderr, "[rt] d3d12: a queued ExecuteCommandLists failed on the queue's worker (result " | ||
| 4670 | "%d); nothing was submitted for it\n", | ||
| 4671 | static_cast<int>(result)); | ||
| 4672 | } | ||
| 4673 | break; | ||
| 4674 | } | ||
| 4675 | case Call::Kind::signal: | ||
| 4676 | if (!signal_sync(call.fence, call.value, pin)) { | ||
| 4677 | int none = static_cast<int>(ReplayResult::success); | ||
| 4678 | held_failure_.compare_exchange_strong(none, static_cast<int>(ReplayResult::unsupported)); | ||
| 4679 | std::fprintf(stderr, "[rt] d3d12: a queued Signal failed on the queue's worker\n"); | ||
| 4680 | } | ||
| 4681 | break; | ||
| 4682 | case Call::Kind::wait: wait_sync(call.fence, call.value, pin); break; | ||
| 4683 | case Call::Kind::marker: marker_sync(call.marker_kind, call.label.c_str()); break; | ||
| 4684 | } | ||
| 4685 | if (call.pin && call.kind == Call::Kind::execute) { | ||
| 4686 | // The pipeline states stay alive until what was just submitted has completed (a held batch keeps its own). | ||
| 4687 | std::lock_guard state(state_mutex_); | ||
| 4688 | std::vector<std::shared_ptr<void>> pins{std::move(call.pin)}; | ||
| 4689 | retire_pins(pins, submitted_); | ||
| 4690 | } | ||
| 4691 | } | ||
| 4692 | |||
| 4693 | // Every 10 s, per queue: what the worker did. Called with inbox_mutex_ held. | ||
| 4694 | void report_async_locked() { | ||
| 4695 | const auto now = std::chrono::steady_clock::now(); | ||
| 4696 | const double s = std::chrono::duration<double>(now - async_stats_.since).count(); | ||
| 4697 | if (s < 10.0) return; | ||
| 4698 | static constexpr const char* kinds[] = {"direct", "compute", "copy"}; | ||
| 4699 | const AsyncStats& a = async_stats_; | ||
| 4700 | std::fprintf(stderr, | ||
| 4701 | "[rt] submit-async: %s queue %p: %.1f calls/s (%.1f batches/s), queued now %zu (max %zu), " | ||
| 4702 | "worker busy %.0f%%, call waited for the worker avg %.2f ms max %.2f ms, caller waited for " | ||
| 4703 | "room %llu times %.1f ms\n", | ||
| 4704 | kinds[int(kind_) < 3 ? int(kind_) : 0], static_cast<const void*>(this), double(a.calls) / s, | ||
| 4705 | double(a.batches) / s, inbox_.size(), a.depth_max, 100.0 * double(a.run_ns) / (s * 1e9), | ||
| 4706 | a.calls ? double(a.lag_ns) / double(a.calls) / 1e6 : 0.0, double(a.lag_max_ns) / 1e6, | ||
| 4707 | static_cast<unsigned long long>(a.room_waits), double(a.room_wait_ns) / 1e6); | ||
| 4708 | async_stats_ = AsyncStats{}; | ||
| 4709 | } | ||
| 4710 | |||
| 4711 | // What was queued before this call has run (held work may stay held, as without the worker). A worker that does | ||
| 4712 | // not come back (a GPU hang inside wait_for_room, say) is reported every 10 s, and after 60 s the caller goes on | ||
| 4713 | // without it: false. | ||
| 4714 | bool flush_async() { | ||
| 4715 | if (!async_started_.load(std::memory_order_acquire) || t_worker_of_ == this) return true; | ||
| 4716 | std::unique_lock lock(inbox_mutex_); | ||
| 4717 | const auto idle = [this] { return inbox_.empty() && !worker_busy_; }; | ||
| 4718 | for (int slice = 1; slice <= 6; ++slice) { | ||
| 4719 | if (idle_cv_.wait_for(lock, std::chrono::seconds(10), idle)) return true; | ||
| 4720 | std::fprintf(stderr, "[rt] d3d12: waited %d s for a queue's worker to finish what is queued (%zu calls, " | ||
| 4721 | "running call %llu)%s\n", | ||
| 4722 | slice * 10, inbox_.size(), static_cast<unsigned long long>(running_seq_), | ||
| 4723 | slice == 6 ? "; going on without it" : ""); | ||
| 4724 | } | ||
| 4725 | return false; | ||
| 4726 | } | ||
| 4727 | |||
| 4728 | void stop_async() { | ||
| 4729 | if (!async_started_.load(std::memory_order_acquire)) return; | ||
| 4730 | const bool drained = flush_async(); | ||
| 4731 | { | ||
| 4732 | std::lock_guard lock(inbox_mutex_); | ||
| 4733 | async_stop_ = true; | ||
| 4734 | } | ||
| 4735 | inbox_cv_.notify_all(); | ||
| 4736 | room_cv_.notify_all(); | ||
| 4737 | if (!worker_.joinable()) return; | ||
| 4738 | if (drained) { | ||
| 4739 | worker_.join(); | ||
| 4740 | return; | ||
| 4741 | } | ||
| 4742 | // A worker stuck for a minute holds this queue's objects: it is left running rather than joined forever | ||
| 4743 | // (only at teardown; the process is ending or the device is gone). | ||
| 4744 | std::fprintf(stderr, "[rt] d3d12: a queue's worker did not finish; it is detached at the queue's destruction\n"); | ||
| 4745 | worker_.detach(); | ||
| 4746 | } | ||
| 4747 | |||
| 4748 | std::mutex inbox_mutex_; | ||
| 4749 | std::condition_variable inbox_cv_, room_cv_, idle_cv_; | ||
| 4750 | std::deque<Call> inbox_; | ||
| 4751 | std::size_t inbox_batches_ = 0; | ||
| 4752 | std::uint64_t running_seq_ = 0; // the call the worker runs now | ||
| 4753 | bool worker_busy_ = false, release_requested_ = false, async_stop_ = false; | ||
| 4754 | AsyncStats async_stats_; | ||
| 4755 | std::atomic<bool> async_started_{false}; | ||
| 4756 | bool synchronous_ = false; // make_synchronous() | ||
| 4757 | std::thread worker_; | ||
| 4758 | static inline thread_local VulkanQueue* t_worker_of_ = nullptr; // the queue whose worker this thread is | ||
| 4759 | static inline thread_local std::uint64_t async_seq_ = 0; // the sequence number of the call being run | ||
| 4760 | std::atomic<std::uint64_t> held_front_seq_{0}; // held_.front().seq, 0 when empty; see release_held() | ||
| 4761 | |||
| 4762 | // Wait-before-Signal. state_mutex_ is outermost (before pipeline_mutex_ -> resource_mutex_ -> tracker_mutex_ -> | ||
| 4763 | // submit_mutex_) and guards the members above that execute, signal, wait and marker touch. | ||
| 4077 | std::mutex state_mutex_; | 4764 | std::mutex state_mutex_; |
| 4078 | std::deque<Deferred> held_; | 4765 | std::deque<Deferred> held_; |
| 4079 | std::vector<std::shared_ptr<void>> wait_pins_; // keep the fences of waits_ alive | 4766 | std::vector<std::shared_ptr<void>> wait_pins_; // keep the fences of waits_ alive |
diff --git a/runtime/src/vulkan_bindless.h b/runtime/src/vulkan_bindless.h index e72225396..da6d680f0 100644 --- a/runtime/src/vulkan_bindless.h +++ b/runtime/src/vulkan_bindless.h | |||
| @@ -25,6 +25,14 @@ | |||
| 25 | // and samplers it adds and keeps them alive while they are in the set; this class owns only the fallbacks and the | 25 | // and samplers it adds and keeps them alive while they are in the set; this class owns only the fallbacks and the |
| 26 | // table's buffer. | 26 | // table's buffer. |
| 27 | // | 27 | // |
| 28 | // The T#'s own type is the truth: the index was given out in ITS dimension's space, so a shader reading it through | ||
| 29 | // another dimension's array (a 2D instruction on a 2D-array or cube T#, say) must not use it blindly. Every entry | ||
| 30 | // therefore carries, next to the index, which arrays the index is bound in (descriptor_table.h's kind bits), and a | ||
| 31 | // translated module of the tagged contract reads that word: it uses the index only in an array the entry names and | ||
| 32 | // otherwise takes that array's fallback. For the one mismatch the hardware reads rather than drops - a 2D | ||
| 33 | // instruction on a 2D-array or cube T#, which addresses slice 0 - add_image's MirrorViews bind a view of that slice | ||
| 34 | // at the same index in the 2D arrays and name 2D in the kind, so the instruction finds it. | ||
| 35 | // | ||
| 28 | // The fallbacks stand for the console's null descriptors (a zero T#, a T# whose image the layer refused or never | 36 | // The fallbacks stand for the console's null descriptors (a zero T#, a T# whose image the layer refused or never |
| 29 | // saw): each is of the kind the instruction asks for, since the translator picks the binding by the instruction's | 37 | // saw): each is of the kind the instruction asks for, since the translator picks the binding by the instruction's |
| 30 | // dimension and the view by the T#'s numeric class, and a miss at any of them reads zeros. On the console a store or | 38 | // dimension and the view by the T#'s numeric class, and a miss at any of them reads zeros. On the console a store or |
| @@ -68,6 +76,7 @@ | |||
| 68 | 76 | ||
| 69 | #include <algorithm> | 77 | #include <algorithm> |
| 70 | #include <array> | 78 | #include <array> |
| 79 | #include <cassert> | ||
| 71 | #include <cstdint> | 80 | #include <cstdint> |
| 72 | #include <cstring> | 81 | #include <cstring> |
| 73 | #include <functional> | 82 | #include <functional> |
| @@ -398,6 +407,8 @@ public: | |||
| 398 | BindlessSet& operator=(const BindlessSet&) = delete; | 407 | BindlessSet& operator=(const BindlessSet&) = delete; |
| 399 | 408 | ||
| 400 | bool ok() const { return ok_; } | 409 | bool ok() const { return ok_; } |
| 410 | // What the set layout was made from (the pipeline journal names compute pipelines by it). | ||
| 411 | const BindlessFeatures& features() const { return features_; } | ||
| 401 | bool supports_ms_class(std::uint32_t component_class) const { | 412 | bool supports_ms_class(std::uint32_t component_class) const { |
| 402 | return component_class < classes && features_.ms_samples[component_class] != VK_SAMPLE_COUNT_1_BIT; | 413 | return component_class < classes && features_.ms_samples[component_class] != VK_SAMPLE_COUNT_1_BIT; |
| 403 | } | 414 | } |
| @@ -461,29 +472,109 @@ public: | |||
| 461 | &done, 0, nullptr, 0, nullptr); | 472 | &done, 0, nullptr, 0, nullptr); |
| 462 | } | 473 | } |
| 463 | 474 | ||
| 475 | // A second view of the same image in the 2D arrays: the slice a 2D instruction reads through a 2D-array or cube | ||
| 476 | // T# (its first layer). The hardware addresses such a read as slice 0, and the translated shader reads binding 0 | ||
| 477 | // with the identity the table gives, so the runtime binds this copy at the image's own index and records that | ||
| 478 | // index as valid in the 2D array too (kind_sampled_bit), owned by this image (mirror_of): another dimension's | ||
| 479 | // image with the same slot number does not inherit it. The storage views follow the same rule when the image has | ||
| 480 | // them, so a 2D store or atomic lands on layer 0. | ||
| 481 | struct MirrorViews { | ||
| 482 | VkImageView sampled = VK_NULL_HANDLE; | ||
| 483 | VkImageLayout sampled_layout = VK_IMAGE_LAYOUT_GENERAL; | ||
| 484 | StorageViews storage{}; | ||
| 485 | }; | ||
| 486 | |||
| 464 | // Gives an image an index in its dimension's bindings: 0 when the dimension is full. `sampled` goes to the | 487 | // Gives an image an index in its dimension's bindings: 0 when the dimension is full. `sampled` goes to the |
| 465 | // sampled array in `sampled_layout` (the layout the image is in when shaders read it); the storage views go to | 488 | // sampled array in `sampled_layout` (the layout the image is in when shaders read it); the storage views go to |
| 466 | // the storage arrays in GENERAL. For MS views, sampled_class selects the float, uint or sint sampled array. | 489 | // the storage arrays in GENERAL. For MS views, sampled_class selects the float, uint or sint sampled array. |
| 467 | // The caller maps the T# to the index with insert_key(). Takes effect at flush(). | 490 | // `mirror` adds the same index in the 2D arrays (a 2D-array or cube image's slice 0): the slot must then be free |
| 491 | // in both index spaces. `kind_out`, when given, receives what the index is bound in (descriptor_table.h's kind | ||
| 492 | // bits), which the caller records with insert_key. The caller maps the T# to the index with insert_key(). Takes | ||
| 493 | // effect at flush(). | ||
| 468 | std::uint32_t add_image(ImageDimension dimension, VkImageView sampled, VkImageLayout sampled_layout, | 494 | std::uint32_t add_image(ImageDimension dimension, VkImageView sampled, VkImageLayout sampled_layout, |
| 469 | const StorageViews& storage = {}, std::uint32_t sampled_class = 0) { | 495 | const StorageViews& storage = {}, std::uint32_t sampled_class = 0, |
| 496 | const MirrorViews* mirror = nullptr, std::uint32_t* kind_out = nullptr) { | ||
| 470 | const bool stores = storage.as_float || storage.as_uint || storage.as_sint || storage.r32ui; | 497 | const bool stores = storage.as_float || storage.as_uint || storage.as_sint || storage.r32ui; |
| 471 | if (!stores && bindless::sampled_binding(dimension) == bindless::no_binding) return 0; | 498 | if (!stores && bindless::sampled_binding(dimension) == bindless::no_binding) return 0; |
| 472 | if (bindless::multisampled(dimension) && (stores || !supports_ms_class(sampled_class))) return 0; | 499 | if (bindless::multisampled(dimension) && (stores || !supports_ms_class(sampled_class))) return 0; |
| 473 | auto& used = image_used_[std::uint32_t(dimension)]; | 500 | auto& used = image_used_[std::uint32_t(dimension)]; |
| 474 | const std::uint32_t low_end = std::min(std::uint32_t(used.size()), storage_capacity(dimension)); | 501 | const std::uint32_t low_end = std::min(std::uint32_t(used.size()), storage_capacity(dimension)); |
| 475 | std::uint32_t index = stores ? 0 : allocate(used, low_end, std::uint32_t(used.size())); | 502 | std::vector<std::uint8_t>* used_2d = nullptr; // the mirror's index space, when there is one |
| 476 | if (!index) index = allocate(used, 1, low_end); | 503 | if (mirror && dimension != ImageDimension::dim_2d && mirror->sampled) { |
| 477 | if (index) write_image(dimension, index, sampled, sampled_layout, storage, sampled_class); | 504 | used_2d = &image_used_[std::uint32_t(ImageDimension::dim_2d)]; |
| 505 | if (mirror->sampled_layout == VK_IMAGE_LAYOUT_UNDEFINED) used_2d = nullptr; | ||
| 506 | } | ||
| 507 | // A store through the array T# and one through its 2D slice both have to land on a view, so an index with | ||
| 508 | // storage views must be inside this dimension's storage arrays and, when the mirror has storage views too, | ||
| 509 | // inside the 2D arrays' (their range can be the shorter of the two). | ||
| 510 | const bool any_stores = stores || mirror_storage(mirror); | ||
| 511 | const std::uint32_t mirrored_storage_end = std::min(stores ? low_end : std::uint32_t(used.size()), | ||
| 512 | storage_capacity(ImageDimension::dim_2d)); | ||
| 513 | std::uint32_t index = 0; | ||
| 514 | if (used_2d) { | ||
| 515 | index = any_stores ? allocate_pair(used, *used_2d, 1, mirrored_storage_end) | ||
| 516 | : allocate_pair(used, *used_2d, low_end, std::uint32_t(used.size())); | ||
| 517 | if (!index && !any_stores) index = allocate_pair(used, *used_2d, 1, low_end); | ||
| 518 | if (!index) { | ||
| 519 | // No shared slot: the image still gets its own dimension's slot, unmirrored (a 2D read then finds | ||
| 520 | // the fallback). A full array is what returns 0. | ||
| 521 | used_2d = nullptr; | ||
| 522 | } | ||
| 523 | } | ||
| 524 | if (!used_2d) { | ||
| 525 | index = stores ? allocate(used, 1, low_end) : allocate(used, low_end, std::uint32_t(used.size())); | ||
| 526 | if (!index) index = allocate(used, 1, low_end); | ||
| 527 | } | ||
| 528 | if (!index) return 0; | ||
| 529 | assert(!used_2d || !any_stores || index < storage_capacity(ImageDimension::dim_2d)); | ||
| 530 | write_image(dimension, index, sampled, sampled_layout, storage, sampled_class); | ||
| 531 | if (index < storage_used_[std::uint32_t(dimension)].size()) | ||
| 532 | storage_used_[std::uint32_t(dimension)][index] = stores ? 1 : 0; | ||
| 533 | if (used_2d) { | ||
| 534 | write_image(ImageDimension::dim_2d, index, mirror->sampled, mirror->sampled_layout, mirror->storage, 0); | ||
| 535 | used_2d->at(index) = in_use; | ||
| 536 | // The 2D slot is this image's mirror, and this image is its owner: the slot number alone does not say | ||
| 537 | // so, because every dimension's index space is dense and independent. | ||
| 538 | if (index < mirror_owner_.size()) { | ||
| 539 | mirror_owner_[index] = std::uint8_t(std::uint32_t(dimension) + 1); | ||
| 540 | mirror_storage_used_[index] = mirror_storage(mirror) ? 1 : 0; | ||
| 541 | } | ||
| 542 | auto& storage_2d = storage_used_[std::uint32_t(ImageDimension::dim_2d)]; | ||
| 543 | if (index < storage_2d.size()) storage_2d[index] = mirror_storage(mirror) ? 1 : 0; | ||
| 544 | } | ||
| 545 | if (kind_out) { | ||
| 546 | *kind_out = kind_sampled_bit(std::uint32_t(dimension)) | | ||
| 547 | (stores ? kind_storage_bit(std::uint32_t(dimension)) : 0) | | ||
| 548 | (used_2d ? (kind_sampled_bit(std::uint32_t(ImageDimension::dim_2d)) | | ||
| 549 | (mirror_storage(mirror) ? kind_storage_bit(std::uint32_t(ImageDimension::dim_2d)) | ||
| 550 | : 0)) | ||
| 551 | : 0); | ||
| 552 | } | ||
| 478 | return index; | 553 | return index; |
| 479 | } | 554 | } |
| 480 | 555 | ||
| 481 | // New views or a new layout for an index add_image returned (a texture's state changed, say). | 556 | // New views or a new layout for an index add_image returned (a texture's state changed, say). `mirror` is |
| 557 | // refreshed too when the image was added with one (mirror_of says whose 2D slot it is). The slot bookkeeping | ||
| 558 | // follows what was written, and `kind_out`, when given, receives the index's kind word afterwards for a | ||
| 559 | // re-insert: the table keeps the kind it was given, so a caller that adds or drops storage views re-records it. | ||
| 482 | void update_image(ImageDimension dimension, std::uint32_t index, VkImageView sampled, VkImageLayout sampled_layout, | 560 | void update_image(ImageDimension dimension, std::uint32_t index, VkImageView sampled, VkImageLayout sampled_layout, |
| 483 | const StorageViews& storage = {}, std::uint32_t sampled_class = 0) { | 561 | const StorageViews& storage = {}, std::uint32_t sampled_class = 0, |
| 562 | const MirrorViews* mirror = nullptr, std::uint32_t* kind_out = nullptr) { | ||
| 484 | const auto& used = image_used_[std::uint32_t(dimension)]; | 563 | const auto& used = image_used_[std::uint32_t(dimension)]; |
| 485 | if (index && index < used.size() && used[index] == in_use) | 564 | const bool live = index && index < used.size() && used[index] == in_use; |
| 565 | if (live) { | ||
| 486 | write_image(dimension, index, sampled, sampled_layout, storage, sampled_class); | 566 | write_image(dimension, index, sampled, sampled_layout, storage, sampled_class); |
| 567 | const bool stores = storage.as_float || storage.as_uint || storage.as_sint || storage.r32ui; | ||
| 568 | if (index < storage_used_[std::uint32_t(dimension)].size()) | ||
| 569 | storage_used_[std::uint32_t(dimension)][index] = stores ? 1 : 0; | ||
| 570 | } | ||
| 571 | if (live && mirror && mirror->sampled && mirror_of(dimension, index)) { | ||
| 572 | write_image(ImageDimension::dim_2d, index, mirror->sampled, mirror->sampled_layout, mirror->storage, 0); | ||
| 573 | if (index < mirror_storage_used_.size()) mirror_storage_used_[index] = mirror_storage(mirror) ? 1 : 0; | ||
| 574 | auto& storage_2d = storage_used_[std::uint32_t(ImageDimension::dim_2d)]; | ||
| 575 | if (index < storage_2d.size()) storage_2d[index] = mirror_storage(mirror) ? 1 : 0; | ||
| 576 | } | ||
| 577 | if (kind_out) *kind_out = image_kind_at(dimension, index); | ||
| 487 | } | 578 | } |
| 488 | 579 | ||
| 489 | // Returns the index to the fallback and frees it. The caller removes the image's keys with erase_key() first. | 580 | // Returns the index to the fallback and frees it. The caller removes the image's keys with erase_key() first. |
| @@ -495,7 +586,22 @@ public: | |||
| 495 | if (!index || index >= used.size() || used[index] != in_use) return; | 586 | if (!index || index >= used.size() || used[index] != in_use) return; |
| 496 | write_image(dimension, index, VK_NULL_HANDLE, VK_IMAGE_LAYOUT_GENERAL, {}, 0); | 587 | write_image(dimension, index, VK_NULL_HANDLE, VK_IMAGE_LAYOUT_GENERAL, {}, 0); |
| 497 | used[index] = table_dirty_ ? held : 0; | 588 | used[index] = table_dirty_ ? held : 0; |
| 589 | if (index < storage_used_[std::uint32_t(dimension)].size()) | ||
| 590 | storage_used_[std::uint32_t(dimension)][index] = 0; | ||
| 498 | if (table_dirty_) held_images_.push_back({dimension, index}); | 591 | if (table_dirty_) held_images_.push_back({dimension, index}); |
| 592 | // Its 2D copy goes back to the fallback as well (add_image's mirror), when this image is the one that owns | ||
| 593 | // that slot: another dimension's image at the same slot number has its own index space and keeps its 2D | ||
| 594 | // descriptor (and, if it is a 2D-array image, its own mirror there). | ||
| 595 | if (mirror_of(dimension, index)) { | ||
| 596 | auto& used_2d = image_used_[std::uint32_t(ImageDimension::dim_2d)]; | ||
| 597 | write_image(ImageDimension::dim_2d, index, VK_NULL_HANDLE, VK_IMAGE_LAYOUT_GENERAL, {}, 0); | ||
| 598 | used_2d[index] = table_dirty_ ? held : 0; | ||
| 599 | mirror_owner_[index] = 0; | ||
| 600 | mirror_storage_used_[index] = 0; | ||
| 601 | auto& storage_2d = storage_used_[std::uint32_t(ImageDimension::dim_2d)]; | ||
| 602 | if (index < storage_2d.size()) storage_2d[index] = 0; | ||
| 603 | if (table_dirty_) held_images_.push_back({ImageDimension::dim_2d, index}); | ||
| 604 | } | ||
| 499 | } | 605 | } |
| 500 | 606 | ||
| 501 | // 0 when the sampler array is full. | 607 | // 0 when the sampler array is full. |
| @@ -512,15 +618,37 @@ public: | |||
| 512 | if (table_dirty_) held_samplers_.push_back(index); | 618 | if (table_dirty_) held_samplers_.push_back(index); |
| 513 | } | 619 | } |
| 514 | 620 | ||
| 515 | // T# and S# keys to the indices above: the table of binding 2 (descriptor_table.h). Changes reach the shaders | 621 | // What an index of `dimension` is bound in, from what add_image wrote: that dimension's sampled bit, its storage |
| 516 | // at flush(). | 622 | // bit when the slot holds storage views, and the 2D bits when this image owns the slot at the same number in the |
| 517 | bool insert_key(const DescriptorKey& key, std::uint32_t index) { | 623 | // 2D arrays as its mirror (mirror_of). |
| 518 | const auto result = table_.insert_or_update(key.data(), index); | 624 | std::uint32_t image_kind_at(ImageDimension dimension, std::uint32_t index) const { |
| 625 | const auto set = [&](const std::vector<std::uint8_t>& used) { | ||
| 626 | return index < used.size() && used[index] != 0; | ||
| 627 | }; | ||
| 628 | const std::uint32_t d = std::uint32_t(dimension); | ||
| 629 | std::uint32_t kind = kind_sampled_bit(d) | (set(storage_used_[d]) ? kind_storage_bit(d) : 0); | ||
| 630 | if (mirror_of(dimension, index)) { | ||
| 631 | kind |= kind_sampled_bit(std::uint32_t(ImageDimension::dim_2d)); | ||
| 632 | if (set(mirror_storage_used_)) kind |= kind_storage_bit(std::uint32_t(ImageDimension::dim_2d)); | ||
| 633 | } | ||
| 634 | return kind; | ||
| 635 | } | ||
| 636 | |||
| 637 | // T# and S# keys to the indices above: the table of binding 2 (descriptor_table.h). `kind` is what the index is | ||
| 638 | // bound in, for the modules that read it (descriptor_table.h's kind bits); a sampler's entry has none. Changes | ||
| 639 | // reach the shaders at flush(). | ||
| 640 | bool insert_key(const DescriptorKey& key, std::uint32_t index, std::uint32_t kind = 0) { | ||
| 641 | const auto result = table_.insert_or_update(key.data(), index, kind); | ||
| 519 | table_dirty_ |= result != DescriptorTable::InsertResult::unchanged; | 642 | table_dirty_ |= result != DescriptorTable::InsertResult::unchanged; |
| 520 | existing_entries_changed_ |= result == DescriptorTable::InsertResult::replaced || | 643 | existing_entries_changed_ |= result == DescriptorTable::InsertResult::replaced || |
| 521 | result == DescriptorTable::InsertResult::added_with_relocation; | 644 | result == DescriptorTable::InsertResult::added_with_relocation; |
| 522 | return true; | 645 | return true; |
| 523 | } | 646 | } |
| 647 | // The T#'s own dimension, whose kind the set derives from the index it gave out (image_kind_at): a caller that | ||
| 648 | // knows the T#'s TYPE needs to pass no bits. | ||
| 649 | bool insert_key(const DescriptorKey& key, std::uint32_t index, ImageDimension dimension) { | ||
| 650 | return insert_key(key, index, image_kind_at(dimension, index)); | ||
| 651 | } | ||
| 524 | // Erasing empties only the key's own slot; no other entry moves (DescriptorTable::erase), so it needs no idle. | 652 | // Erasing empties only the key's own slot; no other entry moves (DescriptorTable::erase), so it needs no idle. |
| 525 | // The caller erases a key once no submitted work uses it (its texture is gone), like D3D12 requires. | 653 | // The caller erases a key once no submitted work uses it (its texture is gone), like D3D12 requires. |
| 526 | bool erase_key(const DescriptorKey& key) { | 654 | bool erase_key(const DescriptorKey& key) { |
| @@ -754,6 +882,34 @@ private: | |||
| 754 | return 0; | 882 | return 0; |
| 755 | } | 883 | } |
| 756 | 884 | ||
| 885 | // The first index in [begin, end) free in both arrays, marked used in the first; 0 when there is none. The | ||
| 886 | // second array's size bounds the range: a mirrored index must exist in it (its 2D slot). | ||
| 887 | static std::uint32_t allocate_pair(std::vector<std::uint8_t>& used, std::vector<std::uint8_t>& other, | ||
| 888 | std::uint32_t begin, std::uint32_t end) { | ||
| 889 | end = std::min(end, std::uint32_t(other.size())); | ||
| 890 | for (std::uint32_t i = begin; i < end; ++i) { | ||
| 891 | if (used[i] || other[i]) continue; | ||
| 892 | used[i] = 1; | ||
| 893 | return i; | ||
| 894 | } | ||
| 895 | return 0; | ||
| 896 | } | ||
| 897 | |||
| 898 | // A mirror is worth binding only when it has a view; its storage views make the 2D storage arrays valid too. | ||
| 899 | static bool mirror_storage(const MirrorViews* mirror) { | ||
| 900 | return mirror && (mirror->storage.as_float || mirror->storage.as_uint || mirror->storage.as_sint || | ||
| 901 | mirror->storage.r32ui); | ||
| 902 | } | ||
| 903 | |||
| 904 | // True when the 2D slot at `index` is the mirror of the image whose index is `index` in `dimension` (add_image's | ||
| 905 | // MirrorViews). A bare per-slot flag cannot say so: every dimension's index space is dense and independent, so | ||
| 906 | // the Nth image of one dimension shares its slot number with the Nth 2D-array image's mirror slot in the 2D | ||
| 907 | // arrays. The owner is the dimension + 1 (0: no mirror). | ||
| 908 | bool mirror_of(ImageDimension dimension, std::uint32_t index) const { | ||
| 909 | if (dimension == ImageDimension::dim_2d) return false; | ||
| 910 | return index < mirror_owner_.size() && mirror_owner_[index] == std::uint8_t(std::uint32_t(dimension) + 1); | ||
| 911 | } | ||
| 912 | |||
| 757 | std::uint32_t memory_type(std::uint32_t allowed, VkMemoryPropertyFlags wanted) const { | 913 | std::uint32_t memory_type(std::uint32_t allowed, VkMemoryPropertyFlags wanted) const { |
| 758 | for (std::uint32_t i = 0; i < memory_.memoryTypeCount; ++i) | 914 | for (std::uint32_t i = 0; i < memory_.memoryTypeCount; ++i) |
| 759 | if ((allowed & (1u << i)) && (memory_.memoryTypes[i].propertyFlags & wanted) == wanted) return i; | 915 | if ((allowed & (1u << i)) && (memory_.memoryTypes[i].propertyFlags & wanted) == wanted) return i; |
| @@ -778,6 +934,10 @@ private: | |||
| 778 | image_used_[d].assign(image_capacity(ImageDimension(d)), 0); | 934 | image_used_[d].assign(image_capacity(ImageDimension(d)), 0); |
| 779 | image_used_[d][0] = 1; | 935 | image_used_[d][0] = 1; |
| 780 | } | 936 | } |
| 937 | for (std::uint32_t d = 0; d < dimensions; ++d) | ||
| 938 | storage_used_[d].assign(image_capacity(ImageDimension(d)), 0); | ||
| 939 | mirror_owner_.assign(image_capacity(ImageDimension::dim_2d), 0); | ||
| 940 | mirror_storage_used_.assign(image_capacity(ImageDimension::dim_2d), 0); | ||
| 781 | sampler_used_.assign(sampler_capacity(), 0); | 941 | sampler_used_.assign(sampler_capacity(), 0); |
| 782 | sampler_used_[0] = 1; | 942 | sampler_used_[0] = 1; |
| 783 | return true; | 943 | return true; |
| @@ -1282,6 +1442,14 @@ private: | |||
| 1282 | VkSampler fallback_sampler_ = VK_NULL_HANDLE; | 1442 | VkSampler fallback_sampler_ = VK_NULL_HANDLE; |
| 1283 | bool fallbacks_ready_ = false; | 1443 | bool fallbacks_ready_ = false; |
| 1284 | std::array<std::vector<std::uint8_t>, dimensions> image_used_; | 1444 | std::array<std::vector<std::uint8_t>, dimensions> image_used_; |
| 1445 | // Which of those slots also hold storage views (add_image's `storage`), and which 2D slots hold the mirror of an | ||
| 1446 | // image in another dimension (add_image's MirrorViews): removing that image frees the 2D slot too. insert_key | ||
| 1447 | // reads both to say which arrays an index is bound in. mirror_owner_ says whose mirror each of those 2D slots is | ||
| 1448 | // (dimension + 1, 0 for none) and mirror_storage_used_ whether it has storage views: the 2D slot numbers line up | ||
| 1449 | // with another dimension's indices, so the slot alone does not identify its owner. | ||
| 1450 | std::array<std::vector<std::uint8_t>, dimensions> storage_used_; | ||
| 1451 | std::vector<std::uint8_t> mirror_owner_; | ||
| 1452 | std::vector<std::uint8_t> mirror_storage_used_; | ||
| 1285 | std::vector<std::uint8_t> sampler_used_; | 1453 | std::vector<std::uint8_t> sampler_used_; |
| 1286 | std::vector<std::pair<ImageDimension, std::uint32_t>> held_images_; // removed, not yet free (remove_image) | 1454 | std::vector<std::pair<ImageDimension, std::uint32_t>> held_images_; // removed, not yet free (remove_image) |
| 1287 | std::vector<std::uint32_t> held_samplers_; | 1455 | std::vector<std::uint32_t> held_samplers_; |
diff --git a/runtime/src/vulkan_device_fault.h b/runtime/src/vulkan_device_fault.h index d60367491..18f2529c3 100644 --- a/runtime/src/vulkan_device_fault.h +++ b/runtime/src/vulkan_device_fault.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <atomic> | 7 | #include <atomic> |
| 8 | #include <chrono> | 8 | #include <chrono> |
| 9 | #include <condition_variable> | ||
| 9 | #include <cinttypes> | 10 | #include <cinttypes> |
| 10 | #include <cstddef> | 11 | #include <cstddef> |
| 11 | #include <cstdint> | 12 | #include <cstdint> |
| @@ -15,6 +16,8 @@ | |||
| 15 | #include <cstring> | 16 | #include <cstring> |
| 16 | #include <mutex> | 17 | #include <mutex> |
| 17 | #include <span> | 18 | #include <span> |
| 19 | #include <string> | ||
| 20 | #include <thread> | ||
| 18 | #include <unordered_map> | 21 | #include <unordered_map> |
| 19 | #include <utility> | 22 | #include <utility> |
| 20 | #include <vector> | 23 | #include <vector> |
| @@ -244,6 +247,302 @@ inline void run_device_lost_hook() noexcept { | |||
| 244 | if (const auto hook = device_lost_hook.load(std::memory_order_acquire)) hook(); | 247 | if (const auto hook = device_lost_hook.load(std::memory_order_acquire)) hook(); |
| 245 | } | 248 | } |
| 246 | 249 | ||
| 250 | // LOCAL DIAGNOSTIC (early device loss): what the submit lock, the recent submissions and the other threads were | ||
| 251 | // doing when a submission stalled or the device was lost. | ||
| 252 | inline std::int64_t diagnostic_ms() { | ||
| 253 | static const auto start = std::chrono::steady_clock::now(); | ||
| 254 | return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start).count(); | ||
| 255 | } | ||
| 256 | |||
| 257 | #ifdef _WIN32 | ||
| 258 | extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(void); | ||
| 259 | inline std::uint32_t diagnostic_thread_id() { return static_cast<std::uint32_t>(GetCurrentThreadId()); } | ||
| 260 | #else | ||
| 261 | inline std::uint32_t diagnostic_thread_id() { return 0; } | ||
| 262 | #endif | ||
| 263 | |||
| 264 | // Set by gta6rt's main (src/thread_stacks.cpp): prints the call chain of thread `tid`, or of every other thread | ||
| 265 | // when `tid` is 0. Unset in the tests. | ||
| 266 | inline std::atomic<void (*)(std::uint32_t tid, const char* why) noexcept> thread_stack_hook{nullptr}; | ||
| 267 | |||
| 268 | inline void print_thread_stacks(std::uint32_t tid, const char* why) noexcept { | ||
| 269 | if (const auto hook = thread_stack_hook.load(std::memory_order_acquire)) hook(tid, why); | ||
| 270 | } | ||
| 271 | |||
| 272 | // The compute pipeline vkCreateComputePipelines is building now (one at a time is enough: the reports name the one | ||
| 273 | // set last), for the submit-lock hold report. Names are ShaderLibrary strings, valid until device teardown. | ||
| 274 | struct DriverCompile { | ||
| 275 | std::atomic<const char*> name{nullptr}; | ||
| 276 | std::atomic<const char*> trigger{nullptr}; | ||
| 277 | std::atomic<std::int64_t> since_ms{0}; | ||
| 278 | std::atomic<std::size_t> bytes{0}; | ||
| 279 | }; | ||
| 280 | inline DriverCompile driver_compile; | ||
| 281 | |||
| 282 | // VulkanContext's submit lock, which also remembers who holds it, since when and how many threads wait for it. A | ||
| 283 | // submit or an idle wait blocked inside the driver holds it for as long as it blocks; the stall watchdog and the loss | ||
| 284 | // report name that thread, and a hold of a second or more is logged when it ends. | ||
| 285 | class SubmitMutex { | ||
| 286 | public: | ||
| 287 | static constexpr std::int64_t kLongHoldMs = 1000; | ||
| 288 | // How long let_submit_finish(true) keeps letting queued submitters go first before the caller goes ahead anyway, | ||
| 289 | // so a steady stream of submits cannot hold the compile worker back for ever. Waiting out the holder itself is | ||
| 290 | // not capped: entering the driver while a submit is inside it is what lost the device. | ||
| 291 | static constexpr std::int64_t kHandoffCapMs = 250; | ||
| 292 | |||
| 293 | void lock() { | ||
| 294 | if (mutex_.try_lock()) { | ||
| 295 | taken(); | ||
| 296 | return; | ||
| 297 | } | ||
| 298 | // Counted until this thread owns the lock (owner_ set), so let_submit_finish never sees neither. | ||
| 299 | waiting_.fetch_add(1, std::memory_order_relaxed); | ||
| 300 | mutex_.lock(); | ||
| 301 | taken(); | ||
| 302 | waiting_.fetch_sub(1, std::memory_order_relaxed); | ||
| 303 | } | ||
| 304 | bool try_lock() { | ||
| 305 | if (!mutex_.try_lock()) return false; | ||
| 306 | taken(); | ||
| 307 | return true; | ||
| 308 | } | ||
| 309 | void unlock() { | ||
| 310 | const std::int64_t since = since_.load(std::memory_order_relaxed); | ||
| 311 | const std::uint32_t owner = owner_.load(std::memory_order_relaxed); | ||
| 312 | owner_.store(0, std::memory_order_relaxed); | ||
| 313 | releases_.fetch_add(1); // seq_cst with the handoff_waiters_ load: no let_submit_finish misses this release | ||
| 314 | mutex_.unlock(); | ||
| 315 | if (handoff_waiters_.load()) { | ||
| 316 | std::lock_guard lock(handoff_mutex_); | ||
| 317 | released_.notify_all(); | ||
| 318 | } | ||
| 319 | const std::int64_t now = diagnostic_ms(); | ||
| 320 | if (now - since >= kLongHoldMs) | ||
| 321 | std::fprintf(stderr, "[rt] submit-lock: held %lld ms by thread %u, t=%.3f..%.3f s\n", | ||
| 322 | static_cast<long long>(now - since), owner, double(since) / 1000.0, double(now) / 1000.0); | ||
| 323 | } | ||
| 324 | |||
| 325 | std::uint32_t owner() const { return owner_.load(std::memory_order_relaxed); } | ||
| 326 | std::int64_t since_ms() const { return since_.load(std::memory_order_relaxed); } | ||
| 327 | // Threads blocked in lock() (try_lock never counts). | ||
| 328 | std::uint32_t waiting() const { return waiting_.load(std::memory_order_relaxed); } | ||
| 329 | |||
| 330 | // Called before the driver calls that build pipelines: waits for a submit in progress to finish (unless this | ||
| 331 | // thread is the one submitting). Measured on NVIDIA 630.20 (three early losses): back-to-back pipeline creates on | ||
| 332 | // the compile worker keep re-taking a driver lock that vkQueueSubmit waits for; after 10 s of that wait the driver | ||
| 333 | // returns VK_ERROR_DEVICE_LOST, with no GPU fault and no TDR. Not entering the driver while a submit is in it lets | ||
| 334 | // the submit take that lock between two creates. | ||
| 335 | // `queued` (the compile worker): also lets the submitters queued behind the holder go first - std::mutex is not | ||
| 336 | // fair, so without that the worker's next create could get in ahead of them - for at most `cap_ms`; past it the | ||
| 337 | // hold in progress is the last one waited for. The wait never takes the lock itself (taking it could queue behind | ||
| 338 | // every submitter that re-takes it), it waits for the hold it saw to end. Returns how many milliseconds it waited. | ||
| 339 | std::int64_t let_submit_finish(bool queued = true, std::int64_t cap_ms = kHandoffCapMs) { | ||
| 340 | const std::uint32_t self = diagnostic_thread_id(); | ||
| 341 | if (owner_.load(std::memory_order_relaxed) == self) return 0; // this thread submits: nothing to let through | ||
| 342 | const auto queue = [&] { return queued && waiting_.load(std::memory_order_relaxed) != 0; }; | ||
| 343 | std::uint64_t seen = releases_.load(); | ||
| 344 | const auto held = [&] { | ||
| 345 | seen = releases_.load(); // read before the owner: a hold that ends after this changes it | ||
| 346 | return owner_.load() != 0; | ||
| 347 | }; | ||
| 348 | if (!held() && !queue()) return 0; | ||
| 349 | const std::int64_t start = diagnostic_ms(); | ||
| 350 | for (;;) { | ||
| 351 | const bool over = diagnostic_ms() - start >= cap_ms; | ||
| 352 | if (held()) { | ||
| 353 | wait_release(seen); | ||
| 354 | if (!queued || over) break; | ||
| 355 | } else if (!queue() || over) { | ||
| 356 | break; | ||
| 357 | } else { | ||
| 358 | std::this_thread::yield(); // a queued submitter is between its wake-up and taking the lock | ||
| 359 | } | ||
| 360 | } | ||
| 361 | return diagnostic_ms() - start; | ||
| 362 | } | ||
| 363 | |||
| 364 | // The compile gate. A queue submission never enters the driver while a pipeline create is in it: measured on | ||
| 365 | // NVIDIA 630.20 (wf6), a vkQueueSubmit that entered while the warm-up thread was inside one long | ||
| 366 | // vkCreateComputePipelines waited 10 s in the driver and returned VK_ERROR_DEVICE_LOST; let_submit_finish cannot | ||
| 367 | // help once the create is already running. Creates pass the gate shared, a submission exclusively, and a create | ||
| 368 | // that arrives while a submission waits queues behind it, so a submission waits only for the creates already in | ||
| 369 | // the driver. A long compile then stalls the submitting thread here, in our code, instead of in the driver. | ||
| 370 | // No deadlock: a create holds the gate only across its vkCreate*Pipelines and a submission only across its | ||
| 371 | // vkQueueSubmit, and neither driver call waits for anything of ours. LEONIDA_COMPILE_GATE=0 turns it off. | ||
| 372 | class CompileTurn { // around vkCreate*Pipelines | ||
| 373 | public: | ||
| 374 | explicit CompileTurn(SubmitMutex& gate) : gate_(gate), waited_(gate.enter_compile()) {} | ||
| 375 | ~CompileTurn() { gate_.leave_compile(); } | ||
| 376 | CompileTurn(const CompileTurn&) = delete; | ||
| 377 | CompileTurn& operator=(const CompileTurn&) = delete; | ||
| 378 | std::int64_t waited_ms() const { return waited_; } | ||
| 379 | |||
| 380 | private: | ||
| 381 | SubmitMutex& gate_; | ||
| 382 | std::int64_t waited_; | ||
| 383 | }; | ||
| 384 | class SubmitTurn { // around vkQueueSubmit, with the submit lock held | ||
| 385 | public: | ||
| 386 | explicit SubmitTurn(SubmitMutex& gate) : gate_(gate) { gate.enter_submit(); } | ||
| 387 | ~SubmitTurn() { gate_.leave_submit(); } | ||
| 388 | SubmitTurn(const SubmitTurn&) = delete; | ||
| 389 | SubmitTurn& operator=(const SubmitTurn&) = delete; | ||
| 390 | |||
| 391 | private: | ||
| 392 | SubmitMutex& gate_; | ||
| 393 | }; | ||
| 394 | |||
| 395 | static bool compile_gate_enabled() { | ||
| 396 | static const bool on = [] { | ||
| 397 | const char* value = std::getenv("LEONIDA_COMPILE_GATE"); | ||
| 398 | return !(value && !std::strcmp(value, "0")); | ||
| 399 | }(); | ||
| 400 | return on; | ||
| 401 | } | ||
| 402 | |||
| 403 | // The thread waiting in enter_submit for creates to leave the driver, or 0. | ||
| 404 | std::uint32_t gate_waiter() const { return gate_waiter_.load(std::memory_order_relaxed); } | ||
| 405 | |||
| 406 | struct GateStats { | ||
| 407 | std::uint64_t submits = 0; // submissions that had to wait for a create | ||
| 408 | std::int64_t submit_ms = 0, submit_max_ms = 0; | ||
| 409 | std::uint64_t creates = 0; // creates that waited behind a submission | ||
| 410 | std::int64_t create_ms = 0, create_max_ms = 0; | ||
| 411 | }; | ||
| 412 | GateStats gate_stats() { | ||
| 413 | std::lock_guard lock(gate_mutex_); | ||
| 414 | return stats_; | ||
| 415 | } | ||
| 416 | |||
| 417 | std::int64_t enter_compile() { | ||
| 418 | if (!compile_gate_enabled()) return 0; | ||
| 419 | std::unique_lock lock(gate_mutex_); | ||
| 420 | std::int64_t waited = 0; | ||
| 421 | if (submits_) { | ||
| 422 | const std::int64_t start = diagnostic_ms(); | ||
| 423 | gate_changed_.wait(lock, [&] { return submits_ == 0; }); | ||
| 424 | waited = diagnostic_ms() - start; | ||
| 425 | ++stats_.creates; | ||
| 426 | stats_.create_ms += waited; | ||
| 427 | stats_.create_max_ms = (std::max)(stats_.create_max_ms, waited); | ||
| 428 | } | ||
| 429 | ++compiles_; | ||
| 430 | return waited; | ||
| 431 | } | ||
| 432 | void leave_compile() { | ||
| 433 | if (!compile_gate_enabled()) return; | ||
| 434 | std::lock_guard lock(gate_mutex_); | ||
| 435 | if (--compiles_ == 0 && submits_) gate_changed_.notify_all(); | ||
| 436 | } | ||
| 437 | |||
| 438 | std::int64_t enter_submit() { | ||
| 439 | if (!compile_gate_enabled()) return 0; | ||
| 440 | std::unique_lock lock(gate_mutex_); | ||
| 441 | ++submits_; | ||
| 442 | if (!compiles_) return 0; | ||
| 443 | const std::uint32_t self = diagnostic_thread_id(); | ||
| 444 | gate_waiter_.store(self, std::memory_order_relaxed); | ||
| 445 | const std::int64_t start = diagnostic_ms(); | ||
| 446 | const GateWait what{self, compiles_, driver_compile.name.load(std::memory_order_acquire), | ||
| 447 | driver_compile.trigger.load(std::memory_order_relaxed), | ||
| 448 | driver_compile.bytes.load(std::memory_order_relaxed)}; | ||
| 449 | std::int64_t next_note = 2000; | ||
| 450 | while (!gate_changed_.wait_for(lock, std::chrono::milliseconds(250), [&] { return compiles_ == 0; })) { | ||
| 451 | const std::int64_t waited = diagnostic_ms() - start; | ||
| 452 | if (waited < next_note) continue; | ||
| 453 | next_note = waited + 5000; | ||
| 454 | note_gate_wait("has waited", what, waited); | ||
| 455 | } | ||
| 456 | gate_waiter_.store(0, std::memory_order_relaxed); | ||
| 457 | const std::int64_t waited = diagnostic_ms() - start; | ||
| 458 | ++stats_.submits; | ||
| 459 | stats_.submit_ms += waited; | ||
| 460 | stats_.submit_max_ms = (std::max)(stats_.submit_max_ms, waited); | ||
| 461 | // Every wait of 500 ms or more, and the first 32 of 50 ms or more. | ||
| 462 | if (waited >= 500 || (waited >= 50 && logged_waits_ < 32)) { | ||
| 463 | ++logged_waits_; | ||
| 464 | note_gate_wait("waited", what, waited); | ||
| 465 | } | ||
| 466 | return waited; | ||
| 467 | } | ||
| 468 | void leave_submit() { | ||
| 469 | if (!compile_gate_enabled()) return; | ||
| 470 | std::lock_guard lock(gate_mutex_); | ||
| 471 | if (--submits_ == 0) gate_changed_.notify_all(); | ||
| 472 | } | ||
| 473 | |||
| 474 | private: | ||
| 475 | void taken() { | ||
| 476 | since_.store(diagnostic_ms(), std::memory_order_relaxed); | ||
| 477 | owner_.store(diagnostic_thread_id(), std::memory_order_relaxed); | ||
| 478 | } | ||
| 479 | |||
| 480 | // Until a hold ends after `seen` releases. | ||
| 481 | void wait_release(std::uint64_t seen) { | ||
| 482 | handoff_waiters_.fetch_add(1); | ||
| 483 | { | ||
| 484 | std::unique_lock lock(handoff_mutex_); | ||
| 485 | released_.wait(lock, [&] { return releases_.load() != seen; }); | ||
| 486 | } | ||
| 487 | handoff_waiters_.fetch_sub(1); | ||
| 488 | } | ||
| 489 | |||
| 490 | // With gate_mutex_ held. | ||
| 491 | // The creates a submission found in the driver: how many, and the compute one named last (graphics creates are | ||
| 492 | // not named). Names are ShaderLibrary strings, valid until device teardown. | ||
| 493 | struct GateWait { | ||
| 494 | std::uint32_t thread; | ||
| 495 | std::uint32_t creates; | ||
| 496 | const char* name; | ||
| 497 | const char* trigger; | ||
| 498 | std::size_t bytes; | ||
| 499 | }; | ||
| 500 | void note_gate_wait(const char* how, const GateWait& what, std::int64_t waited) const { | ||
| 501 | std::fprintf(stderr, "[rt] compile-gate: vkQueueSubmit on thread %u %s %lld ms for %u pipeline create(s) to " | ||
| 502 | "leave the driver (compute %s, %zu B SPIR-V, %s) at t=%.3f s; %llu such waits so far, " | ||
| 503 | "%lld ms in all, longest %lld ms\n", | ||
| 504 | what.thread, how, static_cast<long long>(waited), what.creates, what.name ? what.name : "-", | ||
| 505 | what.name ? what.bytes : std::size_t{0}, what.name && what.trigger ? what.trigger : "-", | ||
| 506 | double(diagnostic_ms()) / 1000.0, static_cast<unsigned long long>(stats_.submits), | ||
| 507 | static_cast<long long>(stats_.submit_ms), static_cast<long long>(stats_.submit_max_ms)); | ||
| 508 | } | ||
| 509 | |||
| 510 | std::mutex mutex_; | ||
| 511 | std::atomic<std::uint32_t> owner_{0}; | ||
| 512 | std::atomic<std::int64_t> since_{0}; | ||
| 513 | std::atomic<std::uint32_t> waiting_{0}; | ||
| 514 | std::atomic<std::uint64_t> releases_{0}; // unlocks so far | ||
| 515 | std::atomic<std::uint32_t> handoff_waiters_{0}; | ||
| 516 | std::mutex handoff_mutex_; // leaf | ||
| 517 | std::condition_variable released_; | ||
| 518 | |||
| 519 | std::mutex gate_mutex_; // leaf: guards the gate counts and stats | ||
| 520 | std::condition_variable gate_changed_; | ||
| 521 | std::uint32_t compiles_ = 0; // creates in the driver | ||
| 522 | std::uint32_t submits_ = 0; // submissions waiting for them or in the driver | ||
| 523 | std::atomic<std::uint32_t> gate_waiter_{0}; | ||
| 524 | GateStats stats_; | ||
| 525 | unsigned logged_waits_ = 0; | ||
| 526 | }; | ||
| 527 | |||
| 528 | // One vkQueueSubmit of a VulkanQueue: its waits, its signals and how long the call took (-1: not returned yet). | ||
| 529 | struct SubmitRecord { | ||
| 530 | static constexpr std::size_t max_waits = 6; | ||
| 531 | std::int64_t at_ms = 0; | ||
| 532 | std::int64_t took_ms = -1; | ||
| 533 | int result = 1; | ||
| 534 | VkQueue queue = VK_NULL_HANDLE; | ||
| 535 | const char* kind = ""; | ||
| 536 | VkSemaphore progress = VK_NULL_HANDLE; | ||
| 537 | std::uint64_t ticket = 0; | ||
| 538 | VkSemaphore fence = VK_NULL_HANDLE; | ||
| 539 | std::uint64_t fence_value = 0; | ||
| 540 | std::uint32_t buffers = 0; | ||
| 541 | std::uint32_t waits = 0; | ||
| 542 | std::array<VkSemaphore, max_waits> wait_semaphores{}; | ||
| 543 | std::array<std::uint64_t, max_waits> wait_values{}; | ||
| 544 | }; | ||
| 545 | |||
| 247 | class DeviceFaultDiagnostics { | 546 | class DeviceFaultDiagnostics { |
| 248 | public: | 547 | public: |
| 249 | DeviceFaultDiagnostics(PFN_vkGetDeviceProcAddr get, VkDevice device, DeviceFaultExtensions enabled) | 548 | DeviceFaultDiagnostics(PFN_vkGetDeviceProcAddr get, VkDevice device, DeviceFaultExtensions enabled) |
| @@ -254,6 +553,7 @@ public: | |||
| 254 | LEONIDA_FAULT_LOAD(vkCmdSetCheckpointNV); | 553 | LEONIDA_FAULT_LOAD(vkCmdSetCheckpointNV); |
| 255 | LEONIDA_FAULT_LOAD(vkGetQueueCheckpointDataNV); | 554 | LEONIDA_FAULT_LOAD(vkGetQueueCheckpointDataNV); |
| 256 | } | 555 | } |
| 556 | LEONIDA_FAULT_LOAD(vkGetSemaphoreCounterValue); | ||
| 257 | #undef LEONIDA_FAULT_LOAD | 557 | #undef LEONIDA_FAULT_LOAD |
| 258 | std::fprintf(stderr, "[rt] device-fault: enabled (fault info %s, checkpoints %s, NVIDIA diagnostics config %s)\n", | 558 | std::fprintf(stderr, "[rt] device-fault: enabled (fault info %s, checkpoints %s, NVIDIA diagnostics config %s)\n", |
| 259 | vkGetDeviceFaultInfoEXT ? "on" : "unavailable", checkpoint_command() ? "on" : "unavailable", | 559 | vkGetDeviceFaultInfoEXT ? "on" : "unavailable", checkpoint_command() ? "on" : "unavailable", |
| @@ -272,6 +572,141 @@ public: | |||
| 272 | 572 | ||
| 273 | std::uint64_t next_execute_call() { return ++execute_calls_; } | 573 | std::uint64_t next_execute_call() { return ++execute_calls_; } |
| 274 | 574 | ||
| 575 | void set_submit_lock(const SubmitMutex* lock) { submit_lock_ = lock; } | ||
| 576 | |||
| 577 | // Called under the submit lock, before and after the vkQueueSubmit it describes. | ||
| 578 | std::size_t begin_submit(const SubmitRecord& record) { | ||
| 579 | std::lock_guard lock(mutex_); | ||
| 580 | const std::size_t at = submit_count_++; | ||
| 581 | submits_[at % submits_.size()] = record; | ||
| 582 | return at; | ||
| 583 | } | ||
| 584 | void end_submit(std::size_t at, std::int64_t took_ms, VkResult result) { | ||
| 585 | std::lock_guard lock(mutex_); | ||
| 586 | if (submit_count_ - at > submits_.size()) return; | ||
| 587 | auto& record = submits_[at % submits_.size()]; | ||
| 588 | record.took_ms = took_ms; | ||
| 589 | record.result = int(result); | ||
| 590 | } | ||
| 591 | |||
| 592 | // The holder of the submit lock has kept it for `held_ms`: its call chain and what was submitted last. | ||
| 593 | void report_submit_lock_holder(std::uint32_t owner, std::int64_t held_ms) { | ||
| 594 | std::fprintf(stderr, "[rt] submit-lock: thread %u has held it for %lld ms (t=%.3f s)\n", owner, | ||
| 595 | static_cast<long long>(held_ms), double(diagnostic_ms()) / 1000.0); | ||
| 596 | if (const char* name = driver_compile.name.load(std::memory_order_acquire)) { | ||
| 597 | const char* trigger = driver_compile.trigger.load(std::memory_order_relaxed); | ||
| 598 | std::fprintf(stderr, "[rt] submit-lock: vkCreateComputePipelines has been building %s (%zu B SPIR-V, %s) " | ||
| 599 | "for %lld ms\n", | ||
| 600 | name, driver_compile.bytes.load(std::memory_order_relaxed), trigger ? trigger : "?", | ||
| 601 | static_cast<long long>(diagnostic_ms() - driver_compile.since_ms.load(std::memory_order_relaxed))); | ||
| 602 | } | ||
| 603 | if (submit_lock_ && submit_lock_->gate_waiter() == owner) { | ||
| 604 | // Not in the driver: waiting at the compile gate for the create named above (SubmitMutex::CompileTurn). | ||
| 605 | std::fprintf(stderr, "[rt] submit-lock: thread %u is waiting at the compile gate, not in the driver\n", owner); | ||
| 606 | return; | ||
| 607 | } | ||
| 608 | // Every thread, the holder included: what the driver waits for may be another thread's work. No counters | ||
| 609 | // here (dump_submits would block in the driver behind the holder); the loss report has them. A long hold can | ||
| 610 | // also be a legitimate vkDeviceWaitIdle: the stacks of the first three holds, then at most one a minute. | ||
| 611 | const std::int64_t now = diagnostic_ms(); | ||
| 612 | if (stack_reports_ >= 3 && now - last_stack_report_ms_ < 60000) return; | ||
| 613 | ++stack_reports_; | ||
| 614 | last_stack_report_ms_ = now; | ||
| 615 | print_thread_stacks(0, "submit-lock hold"); | ||
| 616 | } | ||
| 617 | |||
| 618 | // Before `semaphore` is destroyed (~VulkanFence, ~VulkanQueue): the ring stops naming it, so no report reads the | ||
| 619 | // counter of a destroyed semaphore. Waits for a report that is reading counters now. | ||
| 620 | void forget(VkSemaphore semaphore) { | ||
| 621 | if (!semaphore) return; | ||
| 622 | std::lock_guard reading(read_mutex_); | ||
| 623 | if (stalled_progress_ == semaphore) stalled_progress_ = VK_NULL_HANDLE; | ||
| 624 | std::lock_guard lock(mutex_); | ||
| 625 | for (auto& r : submits_) { | ||
| 626 | if (r.progress == semaphore) r.progress = VK_NULL_HANDLE; | ||
| 627 | if (r.fence == semaphore) r.fence = VK_NULL_HANDLE; | ||
| 628 | for (auto& wait : r.wait_semaphores) | ||
| 629 | if (wait == semaphore) wait = VK_NULL_HANDLE; | ||
| 630 | } | ||
| 631 | } | ||
| 632 | |||
| 633 | // Once a second from the progress watch, without the submit lock: when the oldest submission in the ring that | ||
| 634 | // has not finished is 4 s old, the ring with every counter as it is now, once per such submission. | ||
| 635 | void check_submit_progress() { | ||
| 636 | std::lock_guard reading(read_mutex_); // the semaphores read below outlive this call (forget) | ||
| 637 | const std::vector<SubmitRecord> records = submit_records(); | ||
| 638 | if (!vkGetSemaphoreCounterValue) return; | ||
| 639 | const std::int64_t now = diagnostic_ms(); | ||
| 640 | for (const auto& r : records) { | ||
| 641 | if (r.took_ms < 0 || r.result != VK_SUCCESS || !r.progress) continue; | ||
| 642 | std::uint64_t done = 0; | ||
| 643 | if (vkGetSemaphoreCounterValue(device_, r.progress, &done) != VK_SUCCESS) return; | ||
| 644 | if (done >= r.ticket) continue; | ||
| 645 | // Age from when vkQueueSubmit returned: the call itself may have waited at the compile gate. | ||
| 646 | if (now - (r.at_ms + r.took_ms) < 4000) return; // the oldest unfinished one is young | ||
| 647 | if (r.progress == stalled_progress_ && r.ticket == stalled_ticket_) return; | ||
| 648 | stalled_progress_ = r.progress; | ||
| 649 | stalled_ticket_ = r.ticket; | ||
| 650 | std::fprintf(stderr, "[rt] gpu-stall: %s queue %p ticket %llu submitted at t=%.3f s not done after %lld ms " | ||
| 651 | "(progress %llu)\n", | ||
| 652 | r.kind, static_cast<void*>(r.queue), static_cast<unsigned long long>(r.ticket), | ||
| 653 | double(r.at_ms) / 1000.0, static_cast<long long>(now - r.at_ms), | ||
| 654 | static_cast<unsigned long long>(done)); | ||
| 655 | dump_submits_reading(); | ||
| 656 | return; | ||
| 657 | } | ||
| 658 | } | ||
| 659 | |||
| 660 | // The last submissions, oldest first, with every semaphore's counter now (? once the device is lost, or for a | ||
| 661 | // semaphore destroyed since). | ||
| 662 | void dump_submits() { | ||
| 663 | std::lock_guard reading(read_mutex_); | ||
| 664 | dump_submits_reading(); | ||
| 665 | } | ||
| 666 | |||
| 667 | private: | ||
| 668 | std::vector<SubmitRecord> submit_records() { | ||
| 669 | std::vector<SubmitRecord> records; | ||
| 670 | std::lock_guard lock(mutex_); | ||
| 671 | const std::size_t n = std::min(submit_count_, submits_.size()); | ||
| 672 | records.reserve(n); | ||
| 673 | for (std::size_t i = submit_count_ - n; i < submit_count_; ++i) records.push_back(submits_[i % submits_.size()]); | ||
| 674 | return records; | ||
| 675 | } | ||
| 676 | |||
| 677 | // dump_submits with read_mutex_ held. | ||
| 678 | void dump_submits_reading() { | ||
| 679 | const std::vector<SubmitRecord> records = submit_records(); | ||
| 680 | // Every semaphore the ring names is non-null when recorded: null is one destroyed since (forget). | ||
| 681 | const auto counter = [&](VkSemaphore semaphore) -> std::string { | ||
| 682 | std::uint64_t value = 0; | ||
| 683 | if (!semaphore) return "destroyed"; | ||
| 684 | if (!vkGetSemaphoreCounterValue || vkGetSemaphoreCounterValue(device_, semaphore, &value) != VK_SUCCESS) | ||
| 685 | return "?"; | ||
| 686 | return std::to_string(value); | ||
| 687 | }; | ||
| 688 | const std::int64_t now = diagnostic_ms(); | ||
| 689 | for (const auto& r : records) { | ||
| 690 | std::string line = "[rt] submit-ring: t=" + std::to_string(double(r.at_ms) / 1000.0) + " s " + r.kind + | ||
| 691 | " queue=" + std::to_string(reinterpret_cast<std::uintptr_t>(r.queue)) + | ||
| 692 | " buffers=" + std::to_string(r.buffers) + " ticket=" + std::to_string(r.ticket) + | ||
| 693 | " progress=" + counter(r.progress) + " took=" + | ||
| 694 | (r.took_ms < 0 ? "pending(" + std::to_string(now - r.at_ms) + " ms)" | ||
| 695 | : std::to_string(r.took_ms) + " ms") + | ||
| 696 | " result=" + std::to_string(r.result); | ||
| 697 | if (r.fence || r.fence_value) | ||
| 698 | line += " signal=" + std::to_string(pipeline_handle(r.fence)) + ":" + std::to_string(r.fence_value) + | ||
| 699 | " now " + counter(r.fence); | ||
| 700 | for (std::uint32_t i = 0; i < r.waits && i < SubmitRecord::max_waits; ++i) | ||
| 701 | line += " wait=" + std::to_string(pipeline_handle(r.wait_semaphores[i])) + ":" + | ||
| 702 | std::to_string(r.wait_values[i]) + " now " + counter(r.wait_semaphores[i]); | ||
| 703 | if (r.waits > SubmitRecord::max_waits) line += " (+" + std::to_string(r.waits - SubmitRecord::max_waits) + " waits)"; | ||
| 704 | line += '\n'; | ||
| 705 | std::fputs(line.c_str(), stderr); | ||
| 706 | } | ||
| 707 | } | ||
| 708 | |||
| 709 | public: | ||
| 275 | // Accessed under the context's resource lock. Reports read the names copied into the ring instead. | 710 | // Accessed under the context's resource lock. Reports read the names copied into the ring instead. |
| 276 | std::unordered_map<std::uintptr_t, CheckpointShaders> pipeline_names; | 711 | std::unordered_map<std::uintptr_t, CheckpointShaders> pipeline_names; |
| 277 | 712 | ||
| @@ -292,7 +727,16 @@ public: | |||
| 292 | 727 | ||
| 293 | static VkResult observe(DeviceFaultDiagnostics* diagnostics, VkResult result, const char* operation) noexcept { | 728 | static VkResult observe(DeviceFaultDiagnostics* diagnostics, VkResult result, const char* operation) noexcept { |
| 294 | if (result == VK_ERROR_DEVICE_LOST) { | 729 | if (result == VK_ERROR_DEVICE_LOST) { |
| 295 | if (diagnostics) diagnostics->report(operation); | 730 | if (diagnostics) { |
| 731 | diagnostics->report(operation); | ||
| 732 | } else { | ||
| 733 | // Without LEONIDA_DEVICE_FAULT a loss was silent: the title only saw ~0 in its fence words. | ||
| 734 | static std::atomic<bool> logged{false}; | ||
| 735 | if (!logged.exchange(true, std::memory_order_relaxed)) | ||
| 736 | std::fprintf(stderr, "[rt] vulkan: VK_ERROR_DEVICE_LOST from %s at t=%.3f s on thread %u " | ||
| 737 | "(LEONIDA_DEVICE_FAULT=1 for the fault report)\n", | ||
| 738 | operation, double(diagnostic_ms()) / 1000.0, diagnostic_thread_id()); | ||
| 739 | } | ||
| 296 | run_device_lost_hook(); | 740 | run_device_lost_hook(); |
| 297 | } | 741 | } |
| 298 | return result; | 742 | return result; |
| @@ -354,6 +798,16 @@ private: | |||
| 354 | void report(const char* operation) noexcept { | 798 | void report(const char* operation) noexcept { |
| 355 | if (reported_.exchange(true, std::memory_order_relaxed)) return; | 799 | if (reported_.exchange(true, std::memory_order_relaxed)) return; |
| 356 | std::fprintf(stderr, "[rt] device-fault: VK_ERROR_DEVICE_LOST from %s\n", operation); | 800 | std::fprintf(stderr, "[rt] device-fault: VK_ERROR_DEVICE_LOST from %s\n", operation); |
| 801 | try { | ||
| 802 | const std::int64_t now = diagnostic_ms(); | ||
| 803 | const std::uint32_t owner = submit_lock_ ? submit_lock_->owner() : 0; | ||
| 804 | std::fprintf(stderr, "[rt] device-fault: t=%.3f s on thread %u; submit lock held by thread %u for %lld ms\n", | ||
| 805 | double(now) / 1000.0, diagnostic_thread_id(), owner, | ||
| 806 | owner ? static_cast<long long>(now - submit_lock_->since_ms()) : 0LL); | ||
| 807 | dump_submits(); | ||
| 808 | print_thread_stacks(0, "device lost"); | ||
| 809 | } catch (...) { | ||
| 810 | } | ||
| 357 | dump_dispatches(); | 811 | dump_dispatches(); |
| 358 | try { | 812 | try { |
| 359 | std::function<void()> hook; | 813 | std::function<void()> hook; |
| @@ -455,6 +909,36 @@ private: | |||
| 455 | pipeline.shaders[2] ? pipeline.shaders[2] : "-"); | 909 | pipeline.shaders[2] ? pipeline.shaders[2] : "-"); |
| 456 | } | 910 | } |
| 457 | } | 911 | } |
| 912 | // LOCAL DIAGNOSTIC (post-load GPU faults): the work in flight is between the bottom-of-pipe checkpoint (last | ||
| 913 | // command finished) and the top-of-pipe one (last command started) of the same list. Every pipeline bound in | ||
| 914 | // that window, so the faulting program is among them; the dispatch ring above only keeps the last 64 | ||
| 915 | // dispatches of all queues, and those were from another queue in the fault this was added for. | ||
| 916 | for (std::uint32_t i = 0; i < count; ++i) { | ||
| 917 | const auto top = CheckpointMarker::decode(reinterpret_cast<std::uintptr_t>(data[i].pCheckpointMarker)); | ||
| 918 | if (!top.submission || !(static_cast<std::uint64_t>(data[i].stage) & VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT)) | ||
| 919 | continue; | ||
| 920 | std::uint32_t from = 0; // no bottom-of-pipe checkpoint in this list: from its start | ||
| 921 | for (std::uint32_t j = 0; j < count; ++j) { | ||
| 922 | const auto bottom = CheckpointMarker::decode(reinterpret_cast<std::uintptr_t>(data[j].pCheckpointMarker)); | ||
| 923 | if (bottom.submission == top.submission && bottom.list == top.list && | ||
| 924 | (static_cast<std::uint64_t>(data[j].stage) & VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT)) | ||
| 925 | from = bottom.command; | ||
| 926 | } | ||
| 927 | const auto& entry = recent_[top.submission % recent_.size()]; | ||
| 928 | if (entry.sequence != top.submission || entry.queue != queue || top.list >= entry.lists.size()) continue; | ||
| 929 | const auto& shaders = entry.lists[top.list].shaders; | ||
| 930 | // The pipeline bound when `from` ran, then every change up to the top-of-pipe command. | ||
| 931 | auto it = std::upper_bound(shaders.begin(), shaders.end(), from, | ||
| 932 | [](auto command, const auto& change) { return command < change.command; }); | ||
| 933 | if (it != shaders.begin()) --it; | ||
| 934 | for (; it != shaders.end() && it->command <= top.command; ++it) | ||
| 935 | std::fprintf(stderr, "[rt] device-fault: in flight (submission %u list %u, commands %u..%u): command %u " | ||
| 936 | "pipeline=0x%" PRIx64 " shaders=%s %s %s\n", | ||
| 937 | top.submission, top.list, from, top.command, unsigned(it->command), | ||
| 938 | pipeline_handle(it->pipeline.handle), it->pipeline.shaders[0] ? it->pipeline.shaders[0] : "-", | ||
| 939 | it->pipeline.shaders[1] ? it->pipeline.shaders[1] : "-", | ||
| 940 | it->pipeline.shaders[2] ? it->pipeline.shaders[2] : "-"); | ||
| 941 | } | ||
| 458 | } | 942 | } |
| 459 | 943 | ||
| 460 | template<typename Handle> | 944 | template<typename Handle> |
| @@ -467,9 +951,20 @@ private: | |||
| 467 | PFN_vkGetDeviceFaultInfoEXT vkGetDeviceFaultInfoEXT = nullptr; | 951 | PFN_vkGetDeviceFaultInfoEXT vkGetDeviceFaultInfoEXT = nullptr; |
| 468 | PFN_vkCmdSetCheckpointNV vkCmdSetCheckpointNV = nullptr; | 952 | PFN_vkCmdSetCheckpointNV vkCmdSetCheckpointNV = nullptr; |
| 469 | PFN_vkGetQueueCheckpointDataNV vkGetQueueCheckpointDataNV = nullptr; | 953 | PFN_vkGetQueueCheckpointDataNV vkGetQueueCheckpointDataNV = nullptr; |
| 954 | PFN_vkGetSemaphoreCounterValue vkGetSemaphoreCounterValue = nullptr; | ||
| 955 | const SubmitMutex* submit_lock_ = nullptr; | ||
| 956 | std::array<SubmitRecord, 96> submits_{}; // under mutex_ | ||
| 957 | std::size_t submit_count_ = 0; | ||
| 958 | unsigned stack_reports_ = 0; // report_submit_lock_holder: the progress watch's thread only | ||
| 959 | std::int64_t last_stack_report_ms_ = 0; | ||
| 960 | VkSemaphore stalled_progress_ = VK_NULL_HANDLE; // under read_mutex_ | ||
| 961 | std::uint64_t stalled_ticket_ = 0; | ||
| 470 | std::atomic<bool> reported_{false}; | 962 | std::atomic<bool> reported_{false}; |
| 471 | std::atomic<std::uint64_t> execute_calls_{0}; | 963 | std::atomic<std::uint64_t> execute_calls_{0}; |
| 472 | std::uint32_t sequence_ = 0; | 964 | std::uint32_t sequence_ = 0; |
| 965 | // Held while a report reads the counters of the semaphores in the ring, and by forget before one is destroyed. | ||
| 966 | // Before mutex_; the submit path never takes it. | ||
| 967 | std::mutex read_mutex_; | ||
| 473 | std::mutex mutex_; // leaf lock, guards queues_ and recent_ | 968 | std::mutex mutex_; // leaf lock, guards queues_ and recent_ |
| 474 | std::vector<VkQueue> queues_; | 969 | std::vector<VkQueue> queues_; |
| 475 | const bool include_roots_ = [] { | 970 | const bool include_roots_ = [] { |
diff --git a/runtime/src/vulkan_indirect_clamp.h b/runtime/src/vulkan_indirect_clamp.h index 3eb192d0f..1822d9614 100644 --- a/runtime/src/vulkan_indirect_clamp.h +++ b/runtime/src/vulkan_indirect_clamp.h | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <algorithm> | 37 | #include <algorithm> |
| 38 | #include <cstdint> | 38 | #include <cstdint> |
| 39 | #include <cstdio> | 39 | #include <cstdio> |
| 40 | #include <chrono> | ||
| 40 | #include <cstdlib> | 41 | #include <cstdlib> |
| 41 | #include <cstring> | 42 | #include <cstring> |
| 42 | #include <memory> | 43 | #include <memory> |
| @@ -161,6 +162,11 @@ public: | |||
| 161 | std::uint64_t zeroed = 0; | 162 | std::uint64_t zeroed = 0; |
| 162 | std::uint64_t unclamped_calls = 0; // the fallbacks: calls the pool or the limits left to the replay | 163 | std::uint64_t unclamped_calls = 0; // the fallbacks: calls the pool or the limits left to the replay |
| 163 | std::uint64_t uncounted_calls = 0; // clamped with no counter slot free: their counters are not read back | 164 | std::uint64_t uncounted_calls = 0; // clamped with no counter slot free: their counters are not read back |
| 165 | // Mesh records before the clamp: all active ones, those with y > 1 or z > 1, and the largest y and z asked. | ||
| 166 | std::uint64_t mesh_records = 0; | ||
| 167 | std::uint64_t mesh_yz_records = 0; | ||
| 168 | std::uint32_t mesh_max_y = 0; | ||
| 169 | std::uint32_t mesh_max_z = 0; | ||
| 164 | }; | 170 | }; |
| 165 | 171 | ||
| 166 | // One submission's clamp state: the counter slots its calls claimed, read and released together once that | 172 | // One submission's clamp state: the counter slots its calls claimed, read and released together once that |
| @@ -226,7 +232,7 @@ private: | |||
| 226 | VkDeviceMemory memory = VK_NULL_HANDLE; | 232 | VkDeviceMemory memory = VK_NULL_HANDLE; |
| 227 | std::uint8_t* host = nullptr; | 233 | std::uint8_t* host = nullptr; |
| 228 | std::uint32_t slots = 0; | 234 | std::uint32_t slots = 0; |
| 229 | static constexpr std::uint32_t slot_bytes = 32; // 16 bytes of counters, 16 of padding | 235 | static constexpr std::uint32_t slot_bytes = 64; // 48 bytes of counters (words 4-7 unused), 16 of padding |
| 230 | }; | 236 | }; |
| 231 | static constexpr std::uint32_t slots_per_area = 64; | 237 | static constexpr std::uint32_t slots_per_area = 64; |
| 232 | // 4,096 slots (128 KiB of host memory): enough for a submission's ExecuteIndirect calls after the load, and the | 238 | // 4,096 slots (128 KiB of host memory): enough for a submission's ExecuteIndirect calls after the load, and the |
| @@ -258,6 +264,7 @@ private: | |||
| 258 | std::vector<Slot> free_slots_; | 264 | std::vector<Slot> free_slots_; |
| 259 | Counters counters_{}; | 265 | Counters counters_{}; |
| 260 | std::uint64_t next_report_frame_ = 0; | 266 | std::uint64_t next_report_frame_ = 0; |
| 267 | std::chrono::steady_clock::time_point next_mesh_report_{}; | ||
| 261 | }; | 268 | }; |
| 262 | 269 | ||
| 263 | namespace detail { | 270 | namespace detail { |
| @@ -440,9 +447,13 @@ inline void IndirectArgumentClamp::release(std::vector<Slot>& slots, bool read) | |||
| 440 | delta.counts_clamped += words[1]; | 447 | delta.counts_clamped += words[1]; |
| 441 | delta.over_budget += words[2]; | 448 | delta.over_budget += words[2]; |
| 442 | delta.zeroed += words[3]; | 449 | delta.zeroed += words[3]; |
| 450 | delta.mesh_records += words[8]; | ||
| 451 | delta.mesh_yz_records += words[9]; | ||
| 452 | delta.mesh_max_y = std::max(delta.mesh_max_y, words[10]); | ||
| 453 | delta.mesh_max_z = std::max(delta.mesh_max_z, words[11]); | ||
| 443 | // Clear after reading so a later aborted batch that reuses this slot without submitting never | 454 | // Clear after reading so a later aborted batch that reuses this slot without submitting never |
| 444 | // double-counts a previous submission's counters. | 455 | // double-counts a previous submission's counters. |
| 445 | std::memset(words, 0, 4 * sizeof(std::uint32_t)); | 456 | std::memset(words, 0, HostArea::slot_bytes); |
| 446 | } | 457 | } |
| 447 | free_slots_.push_back(slot); | 458 | free_slots_.push_back(slot); |
| 448 | } | 459 | } |
| @@ -450,6 +461,20 @@ inline void IndirectArgumentClamp::release(std::vector<Slot>& slots, bool read) | |||
| 450 | counters_.counts_clamped += delta.counts_clamped; | 461 | counters_.counts_clamped += delta.counts_clamped; |
| 451 | counters_.over_budget += delta.over_budget; | 462 | counters_.over_budget += delta.over_budget; |
| 452 | counters_.zeroed += delta.zeroed; | 463 | counters_.zeroed += delta.zeroed; |
| 464 | counters_.mesh_records += delta.mesh_records; | ||
| 465 | counters_.mesh_yz_records += delta.mesh_yz_records; | ||
| 466 | counters_.mesh_max_y = std::max(counters_.mesh_max_y, delta.mesh_max_y); | ||
| 467 | counters_.mesh_max_z = std::max(counters_.mesh_max_z, delta.mesh_max_z); | ||
| 468 | // One line every 10 s while mesh records are clamped: does the console's mesh dispatch use y or z? | ||
| 469 | const auto now = std::chrono::steady_clock::now(); | ||
| 470 | if (read && counters_.mesh_records && now >= next_mesh_report_) { | ||
| 471 | next_mesh_report_ = now + std::chrono::seconds(10); | ||
| 472 | std::fprintf(stderr, "[rt] indirect clamp mesh: %llu records, %llu with y > 1 or z > 1 (forced to 1), " | ||
| 473 | "max y %u, max z %u\n", | ||
| 474 | static_cast<unsigned long long>(counters_.mesh_records), | ||
| 475 | static_cast<unsigned long long>(counters_.mesh_yz_records), counters_.mesh_max_y, | ||
| 476 | counters_.mesh_max_z); | ||
| 477 | } | ||
| 453 | const auto frame = submit_phases::totals().present_serial.load(std::memory_order_relaxed); | 478 | const auto frame = submit_phases::totals().present_serial.load(std::memory_order_relaxed); |
| 454 | if (read && calls && frame >= next_report_frame_) { | 479 | if (read && calls && frame >= next_report_frame_) { |
| 455 | next_report_frame_ = frame + 60; | 480 | next_report_frame_ = frame + 60; |
| @@ -562,6 +587,7 @@ inline void IndirectArgumentClamp::emit(VkCommandBuffer cb, const ClampedIndirec | |||
| 562 | // The counters start at zero: the budget's compare-and-swap and the record counts accumulate into them. A | 587 | // The counters start at zero: the budget's compare-and-swap and the record counts accumulate into them. A |
| 563 | // transfer write, ordered to the compute stage by the barrier below, like the arguments' own writes. | 588 | // transfer write, ordered to the compute stage by the barrier below, like the arguments' own writes. |
| 564 | fn<PFN_vkCmdFillBuffer>("vkCmdFillBuffer")(cb, job.buffer, job.stats_scratch_offset, job.list_budget == job.stats + 16 ? 20 : 16, 0); | 589 | fn<PFN_vkCmdFillBuffer>("vkCmdFillBuffer")(cb, job.buffer, job.stats_scratch_offset, job.list_budget == job.stats + 16 ? 20 : 16, 0); |
| 590 | fn<PFN_vkCmdFillBuffer>("vkCmdFillBuffer")(cb, job.buffer, job.stats_scratch_offset + 32, 16, 0); // mesh words 8-11 | ||
| 565 | VkMemoryBarrier before{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; | 591 | VkMemoryBarrier before{VK_STRUCTURE_TYPE_MEMORY_BARRIER}; |
| 566 | before.srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT; // every earlier write: the compute that wrote these arguments | 592 | before.srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT; // every earlier write: the compute that wrote these arguments |
| 567 | before.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; | 593 | before.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; |
| @@ -600,7 +626,7 @@ inline void IndirectArgumentClamp::emit(VkCommandBuffer cb, const ClampedIndirec | |||
| 600 | after_copy.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; | 626 | after_copy.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; |
| 601 | barrier(cb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &after_copy, 0, nullptr, | 627 | barrier(cb, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 1, &after_copy, 0, nullptr, |
| 602 | 0, nullptr); | 628 | 0, nullptr); |
| 603 | VkBufferCopy copy{job.stats_scratch_offset, job.stats_offset, 4 * sizeof(std::uint32_t)}; | 629 | VkBufferCopy copy{job.stats_scratch_offset, job.stats_offset, 12 * sizeof(std::uint32_t)}; |
| 604 | fn<PFN_vkCmdCopyBuffer>("vkCmdCopyBuffer")(cb, job.buffer, job.stats_buffer, 1, ©); | 630 | fn<PFN_vkCmdCopyBuffer>("vkCmdCopyBuffer")(cb, job.buffer, job.stats_buffer, 1, ©); |
| 605 | } | 631 | } |
| 606 | // The indirect command reads the records, and nothing else may read them while it does. | 632 | // The indirect command reads the records, and nothing else may read them while it does. |
diff --git a/runtime/src/vulkan_memory_budget.h b/runtime/src/vulkan_memory_budget.h new file mode 100644 index 000000000..e9bc549b1 --- /dev/null +++ b/runtime/src/vulkan_memory_budget.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | // VK_EXT_memory_budget: how much GPU memory this process uses and may use, read from the Vulkan device itself. The | ||
| 4 | // device publishes it (memory_figures.h) for the title HUD (shims/title_hud.h, LEONIDA_TITLE_HUD) and the dev overlay | ||
| 5 | // (dev_overlay.h, LEONIDA_DEV_OVERLAY); DXGI's QueryVideoMemoryInfo, which the HUD read before, is 0 under Wine. The | ||
| 6 | // sums depend only on the two Vulkan structures, so a test can feed them made-up heaps. | ||
| 7 | |||
| 8 | #ifndef VK_NO_PROTOTYPES | ||
| 9 | #define VK_NO_PROTOTYPES | ||
| 10 | #endif | ||
| 11 | #include <vulkan/vulkan.h> | ||
| 12 | |||
| 13 | #include <cstdint> | ||
| 14 | |||
| 15 | #include "memory_figures.h" // VramBudget | ||
| 16 | |||
| 17 | namespace leonida { | ||
| 18 | |||
| 19 | inline VramBudget sum_vram_budget(const VkPhysicalDeviceMemoryProperties& memory, | ||
| 20 | const VkPhysicalDeviceMemoryBudgetPropertiesEXT& budget) { | ||
| 21 | VramBudget out; | ||
| 22 | for (std::uint32_t i = 0; i < memory.memoryHeapCount && i < VK_MAX_MEMORY_HEAPS; ++i) { | ||
| 23 | if (memory.memoryHeaps[i].flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) { | ||
| 24 | out.local_usage += budget.heapUsage[i]; | ||
| 25 | out.local_budget += budget.heapBudget[i]; | ||
| 26 | } else { | ||
| 27 | out.shared_usage += budget.heapUsage[i]; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | out.available = out.local_budget != 0; | ||
| 31 | return out; | ||
| 32 | } | ||
| 33 | |||
| 34 | // Reads the budget now. `physical` must have VK_EXT_memory_budget (enabled on the logical device, as the runtime's | ||
| 35 | // device does). One vkGetPhysicalDeviceMemoryProperties2 call, which needs no external synchronization, so another | ||
| 36 | // thread (the HUD's or the overlay's) may call it while the device is in use. | ||
| 37 | inline VramBudget query_vram_budget(PFN_vkGetPhysicalDeviceMemoryProperties2 get_memory_properties2, | ||
| 38 | VkPhysicalDevice physical) { | ||
| 39 | if (!get_memory_properties2 || physical == VK_NULL_HANDLE) return {}; | ||
| 40 | VkPhysicalDeviceMemoryBudgetPropertiesEXT budget{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT}; | ||
| 41 | VkPhysicalDeviceMemoryProperties2 properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2, &budget}; | ||
| 42 | get_memory_properties2(physical, &properties); | ||
| 43 | return sum_vram_budget(properties.memoryProperties, budget); | ||
| 44 | } | ||
| 45 | |||
| 46 | } // namespace leonida | ||
diff --git a/runtime/src/vulkan_present.h b/runtime/src/vulkan_present.h index d494233d3..81f3b57e1 100644 --- a/runtime/src/vulkan_present.h +++ b/runtime/src/vulkan_present.h | |||
| @@ -183,7 +183,7 @@ public: | |||
| 183 | std::error_code created; | 183 | std::error_code created; |
| 184 | std::filesystem::create_directories(capture_dir_, created); | 184 | std::filesystem::create_directories(capture_dir_, created); |
| 185 | capture_to_disk_ = true; | 185 | capture_to_disk_ = true; |
| 186 | capture_ = true; // the swapchain needs TRANSFER_SRC, and every frame copies into a staging buffer | 186 | capture_ = true; // provision TRANSFER_SRC and staging; disk-only copies follow the requested cadence |
| 187 | if (const char* every = std::getenv("LEONIDA_CAPTURE_EVERY")) capture_every_ = std::max(1, std::atoi(every)); | 187 | if (const char* every = std::getenv("LEONIDA_CAPTURE_EVERY")) capture_every_ = std::max(1, std::atoi(every)); |
| 188 | if (const char* limit = std::getenv("LEONIDA_CAPTURE_LIMIT")) capture_limit_ = std::max(1, std::atoi(limit)); | 188 | if (const char* limit = std::getenv("LEONIDA_CAPTURE_LIMIT")) capture_limit_ = std::max(1, std::atoi(limit)); |
| 189 | std::fprintf(stderr, "[rt] present: capture on: every %d presented frame(s), at most %d, into %s\n", | 189 | std::fprintf(stderr, "[rt] present: capture on: every %d presented frame(s), at most %d, into %s\n", |
| @@ -212,6 +212,7 @@ public: | |||
| 212 | const VkDevice device = context_.device(); | 212 | const VkDevice device = context_.device(); |
| 213 | { | 213 | { |
| 214 | std::lock_guard lock(context_.submit_mutex()); | 214 | std::lock_guard lock(context_.submit_mutex()); |
| 215 | const SubmitMutex::SubmitTurn turn(context_.submit_mutex()); // a queue operation: the compile gate | ||
| 215 | context_.observe_result(vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle (present)"); | 216 | context_.observe_result(vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle (present)"); |
| 216 | // A WSI layer may perform a device-wide idle while destroying the swapchain. | 217 | // A WSI layer may perform a device-wide idle while destroying the swapchain. |
| 217 | // Keep that implicit idle serialized with submits from every context queue. | 218 | // Keep that implicit idle serialized with submits from every context queue. |
| @@ -348,15 +349,9 @@ public: | |||
| 348 | // Call before the first present. | 349 | // Call before the first present. |
| 349 | bool enable_capture() { | 350 | bool enable_capture() { |
| 350 | std::lock_guard lock(present_mutex_); | 351 | std::lock_guard lock(present_mutex_); |
| 351 | if (!ok_) return false; | ||
| 352 | splash_capture_only_ = false; | 352 | splash_capture_only_ = false; |
| 353 | capture_ = true; | 353 | continuous_readback_ = enable_capture_storage(); |
| 354 | stale_ = true; | 354 | return continuous_readback_; |
| 355 | if (!recreate(vsync_, swapchain_srgb_, swapchain_hdr_req_) || (swapchain_ && !capture_buffer_)) { | ||
| 356 | capture_ = false; | ||
| 357 | return false; | ||
| 358 | } | ||
| 359 | return true; | ||
| 360 | } | 355 | } |
| 361 | 356 | ||
| 362 | // Present the shell image immediately. Keep it on screen until the window has a non-black title frame. | 357 | // Present the shell image immediately. Keep it on screen until the window has a non-black title frame. |
| @@ -365,7 +360,7 @@ public: | |||
| 365 | // The last presented frame as the swapchain stores it (4 bytes a texel, rows tightly packed, format() order). | 360 | // The last presented frame as the swapchain stores it (4 bytes a texel, rows tightly packed, format() order). |
| 366 | // Waits for the frame to finish. False when nothing was presented since enable_capture(), after a present | 361 | // Waits for the frame to finish. False when nothing was presented since enable_capture(), after a present |
| 367 | // that was skipped because the window is minimised (it returned VK_SUCCESS but showed nothing), until the next | 362 | // that was skipped because the window is minimised (it returned VK_SUCCESS but showed nothing), until the next |
| 368 | // frame that is shown (the frame before it is not what the window was last asked to show), or when the wait fails. | 363 | // frame that is shown, on an unsampled disk-only present, or when the wait fails. |
| 369 | bool read_back(std::vector<std::uint8_t>& pixels, VkExtent2D* extent, VkFormat* format) { | 364 | bool read_back(std::vector<std::uint8_t>& pixels, VkExtent2D* extent, VkFormat* format) { |
| 370 | std::lock_guard lock(present_mutex_); | 365 | std::lock_guard lock(present_mutex_); |
| 371 | if (!capture_ || !capture_ptr_ || !captured_) return false; | 366 | if (!capture_ || !capture_ptr_ || !captured_) return false; |
| @@ -416,6 +411,19 @@ public: | |||
| 416 | } | 411 | } |
| 417 | 412 | ||
| 418 | private: | 413 | private: |
| 414 | // Called with present_mutex_ held. Reserving staging for the splash or rare disk samples | ||
| 415 | // is distinct from promising the caller a copy of every frame through read_back(). | ||
| 416 | bool enable_capture_storage() { | ||
| 417 | if (!ok_) return false; | ||
| 418 | capture_ = true; | ||
| 419 | stale_ = true; | ||
| 420 | if (!recreate(vsync_, swapchain_srgb_, swapchain_hdr_req_) || (swapchain_ && !capture_buffer_)) { | ||
| 421 | capture_ = false; | ||
| 422 | return false; | ||
| 423 | } | ||
| 424 | return true; | ||
| 425 | } | ||
| 426 | |||
| 419 | bool should_abort() { | 427 | bool should_abort() { |
| 420 | std::function<bool()> abort; | 428 | std::function<bool()> abort; |
| 421 | { | 429 | { |
| @@ -507,14 +515,13 @@ private: | |||
| 507 | if ((binding || planes) && !(format_features(format_) & VK_FORMAT_FEATURE_BLIT_DST_BIT)) | 515 | if ((binding || planes) && !(format_features(format_) & VK_FORMAT_FEATURE_BLIT_DST_BIT)) |
| 508 | return VK_ERROR_FORMAT_NOT_SUPPORTED; | 516 | return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 509 | if (planes && !prepare_compose()) return VK_ERROR_FORMAT_NOT_SUPPORTED; | 517 | if (planes && !prepare_compose()) return VK_ERROR_FORMAT_NOT_SUPPORTED; |
| 510 | auto& vk = context_.vk; | ||
| 511 | const VkDevice device = context_.device(); | 518 | const VkDevice device = context_.device(); |
| 512 | Frame& frame = frames_[frame_index_ % frames_.size()]; | 519 | Frame& frame = frames_[frame_index_ % frames_.size()]; |
| 513 | if (const VkResult waited = context_.observe_result( | 520 | if (const VkResult waited = context_.observe_result( |
| 514 | vkWaitForFences_(device, 1, &frame.done, VK_TRUE, UINT64_MAX), "vkWaitForFences (present)"); | 521 | vkWaitForFences_(device, 1, &frame.done, VK_TRUE, UINT64_MAX), "vkWaitForFences (present)"); |
| 515 | waited != VK_SUCCESS) | 522 | waited != VK_SUCCESS) |
| 516 | return stop(waited); | 523 | return stop(waited); |
| 517 | // Every submit copies into the same mapped buffer, even if its frame is outside the disk capture stride. | 524 | // Drain the preceding disk sample before reusing its fence or advancing its metadata. |
| 518 | if (const VkResult r = finish_pending_capture(); r != VK_SUCCESS) return stop(r); | 525 | if (const VkResult r = finish_pending_capture(); r != VK_SUCCESS) return stop(r); |
| 519 | 526 | ||
| 520 | std::uint32_t image = 0; | 527 | std::uint32_t image = 0; |
| @@ -537,6 +544,15 @@ private: | |||
| 537 | // An out-of-date retry above may have given the swapchain another extent: the compose target follows it. | 544 | // An out-of-date retry above may have given the swapchain another extent: the compose target follows it. |
| 538 | if (planes && !prepare_compose()) return give_back(frame, VK_ERROR_FORMAT_NOT_SUPPORTED); | 545 | if (planes && !prepare_compose()) return give_back(frame, VK_ERROR_FORMAT_NOT_SUPPORTED); |
| 539 | 546 | ||
| 547 | // The ordinal counts accepted presents, not submissions or deferred requests. Decide after | ||
| 548 | // draining the previous disk sample and any acquire/recreate retry; an unshown attempt consumes no slot. | ||
| 549 | const bool disk_sample = capture_to_disk_ && capture_written_ < capture_limit_ && | ||
| 550 | presented_ % std::uint64_t(capture_every_) == 0; | ||
| 551 | const bool inspect = splash_owner_ && capture_ptr_; | ||
| 552 | // Merely allocating a temporary splash buffer does not require a copy. In particular, a minimized | ||
| 553 | // initial splash can return before taking ownership; later ordinary frames must not become continuous. | ||
| 554 | const bool copy_frame = capture_buffer_ && ((capture_ && (disk_sample || continuous_readback_ || inspect)) || dump_.due(presented_)); | ||
| 555 | captured_ = false; // never expose a stale sample after an unsampled or unshown frame | ||
| 540 | bool recorded = false; | 556 | bool recorded = false; |
| 541 | std::unique_lock tracker_lock(context_.tracker_mutex_, std::defer_lock); | 557 | std::unique_lock tracker_lock(context_.tracker_mutex_, std::defer_lock); |
| 542 | bool rollback_source = false; | 558 | bool rollback_source = false; |
| @@ -561,7 +577,8 @@ private: | |||
| 561 | plane_rollbacks[i].tracked = context_.tracker_.tracked(plane_rollbacks[i].id); | 577 | plane_rollbacks[i].tracked = context_.tracker_.tracked(plane_rollbacks[i].id); |
| 562 | if (plane_rollbacks[i].tracked) plane_rollbacks[i].layout = context_.tracker_.layout(plane_rollbacks[i].id, 0); | 578 | if (plane_rollbacks[i].tracked) plane_rollbacks[i].layout = context_.tracker_.layout(plane_rollbacks[i].id, 0); |
| 563 | } | 579 | } |
| 564 | recorded = record_planes(frame, std::uint32_t(frame_index_ % frames_.size()), current, *planes, image); | 580 | recorded = record_planes(frame, std::uint32_t(frame_index_ % frames_.size()), current, *planes, |
| 581 | image, copy_frame); | ||
| 565 | } | 582 | } |
| 566 | } | 583 | } |
| 567 | } else if (binding) { | 584 | } else if (binding) { |
| @@ -574,11 +591,11 @@ private: | |||
| 574 | tracker_lock.lock(); | 591 | tracker_lock.lock(); |
| 575 | rollback_source = context_.tracker_.tracked(source); | 592 | rollback_source = context_.tracker_.tracked(source); |
| 576 | if (rollback_source) prev_layout = context_.tracker_.layout(source, 0); | 593 | if (rollback_source) prev_layout = context_.tracker_.layout(source, 0); |
| 577 | record(frame.commands, *current, source, image, source_rect); | 594 | record(frame.commands, *current, source, image, source_rect, copy_frame); |
| 578 | recorded = true; | 595 | recorded = true; |
| 579 | } | 596 | } |
| 580 | } else { | 597 | } else { |
| 581 | record_blank(frame.commands, image); | 598 | record_blank(frame.commands, image, copy_frame); |
| 582 | recorded = true; | 599 | recorded = true; |
| 583 | } | 600 | } |
| 584 | const auto rollback = [&] { | 601 | const auto rollback = [&] { |
| @@ -624,7 +641,6 @@ private: | |||
| 624 | const bool tearing = false; | 641 | const bool tearing = false; |
| 625 | (void)tear; | 642 | (void)tear; |
| 626 | #endif | 643 | #endif |
| 627 | const bool inspect = splash_owner_ && capture_ptr_; | ||
| 628 | bool show_title = false; | 644 | bool show_title = false; |
| 629 | if (inspect) { | 645 | if (inspect) { |
| 630 | submit_info.signalSemaphoreCount = 0; // signal ready only after choosing the image the window will show | 646 | submit_info.signalSemaphoreCount = 0; // signal ready only after choosing the image the window will show |
| @@ -633,7 +649,10 @@ private: | |||
| 633 | VkResult submitted, result = VK_SUCCESS; | 649 | VkResult submitted, result = VK_SUCCESS; |
| 634 | { | 650 | { |
| 635 | std::lock_guard lock(context_.submit_mutex()); | 651 | std::lock_guard lock(context_.submit_mutex()); |
| 636 | submitted = context_.observe_result(vk.vkQueueSubmit(queue_, 1, &submit_info, frame.done), | 652 | // One turn of the compile gate for the submit and the present after it: no pipeline create enters the |
| 653 | // driver between the two (queue_submit's own turn nests inside this one). | ||
| 654 | const SubmitMutex::SubmitTurn turn(context_.submit_mutex()); // a queue operation: the compile gate | ||
| 655 | submitted = context_.observe_result(context_.queue_submit(queue_, 1, &submit_info, frame.done), | ||
| 637 | "vkQueueSubmit (present)"); | 656 | "vkQueueSubmit (present)"); |
| 638 | if (submitted == VK_SUCCESS) context_.note_image_work_locked(); | 657 | if (submitted == VK_SUCCESS) context_.note_image_work_locked(); |
| 639 | if (submitted != VK_SUCCESS) rollback(); | 658 | if (submitted != VK_SUCCESS) rollback(); |
| @@ -674,14 +693,12 @@ private: | |||
| 674 | last_tore_ = true; | 693 | last_tore_ = true; |
| 675 | ++tear_presents_; | 694 | ++tear_presents_; |
| 676 | } | 695 | } |
| 677 | if (capture_to_disk_ && capture_ && capture_ptr_ && capture_written_ < capture_limit_ && | 696 | if (copy_frame && capture_ptr_) { // a temporary splash-only allocation may have just been released |
| 678 | (presented_ - 1) % std::uint64_t(capture_every_) == 0) | 697 | captured_ = true; |
| 679 | pending_capture_ = frame.done; | 698 | captured_extent_ = extent_; |
| 680 | } | 699 | captured_format_ = format_; |
| 681 | if (capture_ && capture_ptr_) { | 700 | if (disk_sample) pending_capture_ = frame.done; |
| 682 | captured_ = true; | 701 | } |
| 683 | captured_extent_ = extent_; | ||
| 684 | captured_format_ = format_; | ||
| 685 | } | 702 | } |
| 686 | if (result == VK_ERROR_SURFACE_LOST_KHR) { | 703 | if (result == VK_ERROR_SURFACE_LOST_KHR) { |
| 687 | // The surface was lost during the present (display disconnected, a driver reset of the window's | 704 | // The surface was lost during the present (display disconnected, a driver reset of the window's |
| @@ -913,7 +930,7 @@ private: | |||
| 913 | VkResult submitted; | 930 | VkResult submitted; |
| 914 | { | 931 | { |
| 915 | std::lock_guard lock(context_.submit_mutex()); | 932 | std::lock_guard lock(context_.submit_mutex()); |
| 916 | submitted = context_.observe_result(vk.vkQueueSubmit(queue_, 1, &submit_info, probe_fence_), | 933 | submitted = context_.observe_result(context_.queue_submit(queue_, 1, &submit_info, probe_fence_), |
| 917 | "vkQueueSubmit (present probe)"); | 934 | "vkQueueSubmit (present probe)"); |
| 918 | if (submitted == VK_SUCCESS) context_.note_image_work_locked(); | 935 | if (submitted == VK_SUCCESS) context_.note_image_work_locked(); |
| 919 | } | 936 | } |
| @@ -1034,7 +1051,7 @@ private: | |||
| 1034 | VkResult submitted; | 1051 | VkResult submitted; |
| 1035 | { | 1052 | { |
| 1036 | std::lock_guard lock(context_.submit_mutex()); | 1053 | std::lock_guard lock(context_.submit_mutex()); |
| 1037 | submitted = context_.observe_result(context_.vk.vkQueueSubmit(queue_, 1, &submit_info, frame.done), | 1054 | submitted = context_.observe_result(context_.queue_submit(queue_, 1, &submit_info, frame.done), |
| 1038 | "vkQueueSubmit (return present image)"); | 1055 | "vkQueueSubmit (return present image)"); |
| 1039 | } | 1056 | } |
| 1040 | if (submitted != VK_SUCCESS) return stop(failure); | 1057 | if (submitted != VK_SUCCESS) return stop(failure); |
| @@ -1066,6 +1083,7 @@ private: | |||
| 1066 | const VkDevice device = context_.device(); | 1083 | const VkDevice device = context_.device(); |
| 1067 | { | 1084 | { |
| 1068 | std::lock_guard lock(context_.submit_mutex()); | 1085 | std::lock_guard lock(context_.submit_mutex()); |
| 1086 | const SubmitMutex::SubmitTurn turn(context_.submit_mutex()); // a queue operation: the compile gate | ||
| 1069 | // The old swapchain's images and semaphores may still be in use. | 1087 | // The old swapchain's images and semaphores may still be in use. |
| 1070 | context_.observe_result(vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle (present)"); | 1088 | context_.observe_result(vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle (present)"); |
| 1071 | release(swapchain_); | 1089 | release(swapchain_); |
| @@ -1079,7 +1097,7 @@ private: | |||
| 1079 | } | 1097 | } |
| 1080 | 1098 | ||
| 1081 | void record(VkCommandBuffer commands, const ResourceBinding& binding, ResourceId source, std::uint32_t image, | 1099 | void record(VkCommandBuffer commands, const ResourceBinding& binding, ResourceId source, std::uint32_t image, |
| 1082 | const PresentRect* source_rect) { | 1100 | const PresentRect* source_rect, bool copy_frame) { |
| 1083 | auto& vk = context_.vk; | 1101 | auto& vk = context_.vk; |
| 1084 | const ReplayFunctions& fn = context_.replay_; | 1102 | const ReplayFunctions& fn = context_.replay_; |
| 1085 | vk.vkResetCommandBuffer(commands, 0); | 1103 | vk.vkResetCommandBuffer(commands, 0); |
| @@ -1122,7 +1140,7 @@ private: | |||
| 1122 | VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blit, | 1140 | VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blit, |
| 1123 | sw == dw && sh == dh ? VK_FILTER_NEAREST : blit_filter(binding.format)); | 1141 | sw == dw && sh == dh ? VK_FILTER_NEAREST : blit_filter(binding.format)); |
| 1124 | 1142 | ||
| 1125 | finish_image(commands, image); | 1143 | finish_image(commands, image, copy_frame); |
| 1126 | for (const auto& piece : pieces) | 1144 | for (const auto& piece : pieces) |
| 1127 | detail::image_barrier(fn, commands, binding, piece.range, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, | 1145 | detail::image_barrier(fn, commands, binding, piece.range, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, |
| 1128 | piece.layout, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, any, | 1146 | piece.layout, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, any, |
| @@ -1156,6 +1174,7 @@ private: | |||
| 1156 | return true; | 1174 | return true; |
| 1157 | { | 1175 | { |
| 1158 | std::lock_guard lock(context_.submit_mutex()); | 1176 | std::lock_guard lock(context_.submit_mutex()); |
| 1177 | const SubmitMutex::SubmitTurn turn(context_.submit_mutex()); // a queue operation: the compile gate | ||
| 1159 | // The old target may still be in use. | 1178 | // The old target may still be in use. |
| 1160 | context_.observe_result(context_.vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle (present)"); | 1179 | context_.observe_result(context_.vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle (present)"); |
| 1161 | } | 1180 | } |
| @@ -1166,7 +1185,7 @@ private: | |||
| 1166 | // Records the composition of `planes` and its copy to swapchain image `image`. False, with nothing recorded and the | 1185 | // Records the composition of `planes` and its copy to swapchain image `image`. False, with nothing recorded and the |
| 1167 | // tracker untouched, when a view cannot be made. The caller holds the resource and tracker locks. | 1186 | // tracker untouched, when a view cannot be made. The caller holds the resource and tracker locks. |
| 1168 | bool record_planes(Frame& frame, std::uint32_t slot, const std::array<ResourceBinding, 2>& current, | 1187 | bool record_planes(Frame& frame, std::uint32_t slot, const std::array<ResourceBinding, 2>& current, |
| 1169 | const PresentPlanes& planes, std::uint32_t image) { | 1188 | const PresentPlanes& planes, std::uint32_t image, bool copy_frame) { |
| 1170 | auto& vk = context_.vk; | 1189 | auto& vk = context_.vk; |
| 1171 | const ReplayFunctions& fn = context_.replay_; | 1190 | const ReplayFunctions& fn = context_.replay_; |
| 1172 | if (composer_->target() == VK_NULL_HANDLE || composer_->extent().width != extent_.width || | 1191 | if (composer_->target() == VK_NULL_HANDLE || composer_->extent().width != extent_.width || |
| @@ -1254,7 +1273,7 @@ private: | |||
| 1254 | blit.dstOffsets[1] = {std::int32_t(extent_.width), std::int32_t(extent_.height), 1}; | 1273 | blit.dstOffsets[1] = {std::int32_t(extent_.width), std::int32_t(extent_.height), 1}; |
| 1255 | vkCmdBlitImage_(commands, composer_->target(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, images_[image], | 1274 | vkCmdBlitImage_(commands, composer_->target(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, images_[image], |
| 1256 | VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blit, VK_FILTER_NEAREST); | 1275 | VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blit, VK_FILTER_NEAREST); |
| 1257 | finish_image(commands, image); | 1276 | finish_image(commands, image, copy_frame); |
| 1258 | for (std::uint32_t i = 0; i < planes.count; ++i) { | 1277 | for (std::uint32_t i = 0; i < planes.count; ++i) { |
| 1259 | if (i == 1 && same) continue; | 1278 | if (i == 1 && same) continue; |
| 1260 | for (const auto& piece : pieces[i]) | 1279 | for (const auto& piece : pieces[i]) |
| @@ -1291,7 +1310,7 @@ private: | |||
| 1291 | } | 1310 | } |
| 1292 | 1311 | ||
| 1293 | // Clears the swapchain image to opaque black. | 1312 | // Clears the swapchain image to opaque black. |
| 1294 | void record_blank(VkCommandBuffer commands, std::uint32_t image) { | 1313 | void record_blank(VkCommandBuffer commands, std::uint32_t image, bool copy_frame) { |
| 1295 | auto& vk = context_.vk; | 1314 | auto& vk = context_.vk; |
| 1296 | const ReplayFunctions& fn = context_.replay_; | 1315 | const ReplayFunctions& fn = context_.replay_; |
| 1297 | vk.vkResetCommandBuffer(commands, 0); | 1316 | vk.vkResetCommandBuffer(commands, 0); |
| @@ -1304,18 +1323,18 @@ private: | |||
| 1304 | VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT); | 1323 | VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT); |
| 1305 | const VkClearColorValue black{{0.0f, 0.0f, 0.0f, 1.0f}}; | 1324 | const VkClearColorValue black{{0.0f, 0.0f, 0.0f, 1.0f}}; |
| 1306 | vkCmdClearColorImage_(commands, images_[image], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &black, 1, &range); | 1325 | vkCmdClearColorImage_(commands, images_[image], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &black, 1, &range); |
| 1307 | finish_image(commands, image); | 1326 | finish_image(commands, image, copy_frame); |
| 1308 | vk.vkEndCommandBuffer(commands); | 1327 | vk.vkEndCommandBuffer(commands); |
| 1309 | } | 1328 | } |
| 1310 | 1329 | ||
| 1311 | // The swapchain image is written (TRANSFER_DST): optionally copy it to the capture buffer, then hand it to | 1330 | // The swapchain image is written (TRANSFER_DST): optionally copy it to the capture buffer, then hand it to |
| 1312 | // the presentation engine. | 1331 | // the presentation engine. |
| 1313 | void finish_image(VkCommandBuffer commands, std::uint32_t image) { | 1332 | void finish_image(VkCommandBuffer commands, std::uint32_t image, bool copy_frame) { |
| 1314 | const ReplayFunctions& fn = context_.replay_; | 1333 | const ReplayFunctions& fn = context_.replay_; |
| 1315 | const VkImageSubresourceRange range{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; | 1334 | const VkImageSubresourceRange range{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; |
| 1316 | VkImageLayout layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; | 1335 | VkImageLayout layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; |
| 1317 | VkAccessFlags access = VK_ACCESS_TRANSFER_WRITE_BIT; | 1336 | VkAccessFlags access = VK_ACCESS_TRANSFER_WRITE_BIT; |
| 1318 | if (capture_buffer_ && (capture_ || dump_.due(presented_))) { | 1337 | if (copy_frame) { |
| 1319 | // Two frames may be in flight and share `capture_buffer_`: serialize the prior frame's capture copy | 1338 | // Two frames may be in flight and share `capture_buffer_`: serialize the prior frame's capture copy |
| 1320 | // before overwriting it, while moving this frame's swapchain image to TRANSFER_SRC. | 1339 | // before overwriting it, while moving this frame's swapchain image to TRANSFER_SRC. |
| 1321 | VkBufferMemoryBarrier capture_waw{VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER}; | 1340 | VkBufferMemoryBarrier capture_waw{VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER}; |
| @@ -1512,6 +1531,7 @@ private: | |||
| 1512 | const VkDevice device = context_.device(); | 1531 | const VkDevice device = context_.device(); |
| 1513 | { | 1532 | { |
| 1514 | std::lock_guard lock(context_.submit_mutex()); | 1533 | std::lock_guard lock(context_.submit_mutex()); |
| 1534 | const SubmitMutex::SubmitTurn turn(context_.submit_mutex()); // a queue operation: the compile gate | ||
| 1515 | // The old swapchain's images and semaphores may still be in use. | 1535 | // The old swapchain's images and semaphores may still be in use. |
| 1516 | context_.observe_result(vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle (present)"); | 1536 | context_.observe_result(vk.vkQueueWaitIdle(queue_), "vkQueueWaitIdle (present)"); |
| 1517 | } | 1537 | } |
| @@ -1819,6 +1839,7 @@ private: | |||
| 1819 | bool capture_ = false; | 1839 | bool capture_ = false; |
| 1820 | present_dump::PresentDump dump_; | 1840 | present_dump::PresentDump dump_; |
| 1821 | bool dump_pq_ = false; | 1841 | bool dump_pq_ = false; |
| 1842 | bool continuous_readback_ = false; // explicit enable_capture(), independent of disk sampling | ||
| 1822 | VkBuffer capture_buffer_ = VK_NULL_HANDLE; | 1843 | VkBuffer capture_buffer_ = VK_NULL_HANDLE; |
| 1823 | VkDeviceMemory capture_memory_ = VK_NULL_HANDLE; | 1844 | VkDeviceMemory capture_memory_ = VK_NULL_HANDLE; |
| 1824 | VkDeviceSize capture_size_ = 0; | 1845 | VkDeviceSize capture_size_ = 0; |
diff --git a/runtime/src/vulkan_present_splash.h b/runtime/src/vulkan_present_splash.h index affc9a92b..450b06296 100644 --- a/runtime/src/vulkan_present_splash.h +++ b/runtime/src/vulkan_present_splash.h | |||
| @@ -13,7 +13,7 @@ inline bool VulkanPresenter::present_splash(ResourceId source, std::shared_ptr<v | |||
| 13 | if (!binding || !binding->image) return false; | 13 | if (!binding || !binding->image) return false; |
| 14 | splash_binding_ = *binding; | 14 | splash_binding_ = *binding; |
| 15 | } | 15 | } |
| 16 | if (!capture_) splash_capture_only_ = enable_capture(); | 16 | if (!capture_) splash_capture_only_ = enable_capture_storage(); |
| 17 | const auto before = presented(); | 17 | const auto before = presented(); |
| 18 | if (present(source, true) != VK_SUCCESS || presented() == before) return false; | 18 | if (present(source, true) != VK_SUCCESS || presented() == before) return false; |
| 19 | const Frame& frame = frames_[(frame_index_ - 1) % frames_.size()]; | 19 | const Frame& frame = frames_[(frame_index_ - 1) % frames_.size()]; |
| @@ -61,14 +61,16 @@ inline VkResult VulkanPresenter::finish_startup_frame(Frame& frame, std::uint32_ | |||
| 61 | VkSubmitInfo ready{VK_STRUCTURE_TYPE_SUBMIT_INFO}; | 61 | VkSubmitInfo ready{VK_STRUCTURE_TYPE_SUBMIT_INFO}; |
| 62 | ready.signalSemaphoreCount = 1; | 62 | ready.signalSemaphoreCount = 1; |
| 63 | ready.pSignalSemaphores = &ready_[image]; | 63 | ready.pSignalSemaphores = &ready_[image]; |
| 64 | if (show_title) return context_.vk.vkQueueSubmit(queue_, 1, &ready, VK_NULL_HANDLE); | 64 | if (show_title) return context_.queue_submit(queue_, 1, &ready, VK_NULL_HANDLE); |
| 65 | // The acquire was consumed and the title commands finished. Overwrite the same image before presenting it. | 65 | // The acquire was consumed and the title commands finished. Overwrite the same image before presenting it. |
| 66 | record(frame.commands, splash_binding_, splash_source_, image, nullptr); | 66 | // The inspected copy contains the black title frame. Overwrite staging with the |
| 67 | // splash actually shown; this is the copy an active disk/readback consumer must see. | ||
| 68 | record(frame.commands, splash_binding_, splash_source_, image, nullptr, true); | ||
| 67 | result = vkResetFences_(device, 1, &frame.done); | 69 | result = vkResetFences_(device, 1, &frame.done); |
| 68 | if (result != VK_SUCCESS) return result; | 70 | if (result != VK_SUCCESS) return result; |
| 69 | ready.commandBufferCount = 1; | 71 | ready.commandBufferCount = 1; |
| 70 | ready.pCommandBuffers = &frame.commands; | 72 | ready.pCommandBuffers = &frame.commands; |
| 71 | return context_.vk.vkQueueSubmit(queue_, 1, &ready, frame.done); | 73 | return context_.queue_submit(queue_, 1, &ready, frame.done); |
| 72 | } | 74 | } |
| 73 | 75 | ||
| 74 | } // namespace leonida | 76 | } // namespace leonida |
diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h index 5a3e569dd..706bb2f72 100644 --- a/runtime/src/vulkan_replay.h +++ b/runtime/src/vulkan_replay.h | |||
| @@ -60,9 +60,12 @@ | |||
| 60 | #include <limits> | 60 | #include <limits> |
| 61 | #include <map> | 61 | #include <map> |
| 62 | #include <memory> | 62 | #include <memory> |
| 63 | #include <mutex> | ||
| 63 | #include <optional> | 64 | #include <optional> |
| 65 | #include <span> | ||
| 64 | #include <type_traits> | 66 | #include <type_traits> |
| 65 | #include <unordered_map> | 67 | #include <unordered_map> |
| 68 | #include <unordered_set> | ||
| 66 | #include <utility> | 69 | #include <utility> |
| 67 | #include <vector> | 70 | #include <vector> |
| 68 | 71 | ||
| @@ -843,14 +846,19 @@ struct OcclusionResult { | |||
| 843 | // A D3D12 query heap on Vulkan. The host tracks which queries hold a result. A resolve of a query that | 846 | // A D3D12 query heap on Vulkan. The host tracks which queries hold a result. A resolve of a query that |
| 844 | // was never ended writes zeros instead of waiting on it. | 847 | // was never ended writes zeros instead of waiting on it. |
| 845 | struct QueryPool { | 848 | struct QueryPool { |
| 846 | // Null for a stream-output statistics heap: the layer has no stream output (PSOs with StreamOutput entries are | 849 | // Null for a stream-output statistics heap on a device without VK_EXT_transform_feedback (D3D-302): every |
| 847 | // refused), so every SO_STATISTICS_STREAMn query counts 0 written and 0 needed, and a resolve fills zeros. | 850 | // SO_STATISTICS_STREAMn query then counts 0 written and 0 needed, and a resolve fills zeros. With the feature |
| 851 | // it is a VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT pool, begun/ended indexed on the stream. | ||
| 848 | VkQueryPool pool = VK_NULL_HANDLE; | 852 | VkQueryPool pool = VK_NULL_HANDLE; |
| 849 | std::uint32_t heap_type = 0; // d3d12_query_heap | 853 | std::uint32_t heap_type = 0; // d3d12_query_heap |
| 850 | std::uint32_t count = 0; | 854 | std::uint32_t count = 0; |
| 851 | bool precise = false; // occlusionQueryPrecise: D3D12_QUERY_TYPE_OCCLUSION counts exact samples | 855 | bool precise = false; // occlusionQueryPrecise: D3D12_QUERY_TYPE_OCCLUSION counts exact samples |
| 852 | std::vector<bool> ended; | 856 | std::vector<bool> ended; |
| 853 | std::unordered_map<std::uint32_t, OcclusionResult> occlusion; | 857 | std::unordered_map<std::uint32_t, OcclusionResult> occlusion; |
| 858 | // Transform-feedback streams the pool can query (D3D-302): 0 when it has no pool, otherwise the device's | ||
| 859 | // maxTransformFeedbackStreams clamped to D3D12's four. SO_STATISTICS_STREAMn with n at or above this runs nothing | ||
| 860 | // and resolves zero. | ||
| 861 | std::uint32_t streams = 0; | ||
| 854 | }; | 862 | }; |
| 855 | 863 | ||
| 856 | // A compute pipeline as replay needs it. code_base is the console VA of the shader's FSSM blob (push-constant | 864 | // A compute pipeline as replay needs it. code_base is the console VA of the shader's FSSM blob (push-constant |
| @@ -860,16 +868,18 @@ struct ComputePipeline { | |||
| 860 | VkPipelineLayout layout = VK_NULL_HANDLE; | 868 | VkPipelineLayout layout = VK_NULL_HANDLE; |
| 861 | std::uint64_t code_base = 0; | 869 | std::uint64_t code_base = 0; |
| 862 | VkDescriptorSet bindless_set = VK_NULL_HANDLE; // set 0 of the layout, bound at every dispatch; null: none | 870 | VkDescriptorSet bindless_set = VK_NULL_HANDLE; // set 0 of the layout, bound at every dispatch; null: none |
| 863 | // A pipeline built on first use: with `pipeline` null, `build(build_context)` returns the handle (building it if | 871 | // A pipeline built on first use: with `pipeline` null, `build(build_context)` returns the handle, or null when it |
| 864 | // nobody has yet), or null when it cannot be built. Null `build`: `pipeline` is final. | 872 | // cannot be built or (async_build) is still being built - it never waits for a build another thread runs, since |
| 873 | // prepare calls it with the resource lock held. Null `build`: `pipeline` is final. | ||
| 865 | VkPipeline (*build)(void*) = nullptr; | 874 | VkPipeline (*build)(void*) = nullptr; |
| 866 | void* build_context = nullptr; | 875 | void* build_context = nullptr; |
| 867 | bool async_build = false; // a null handle may be waiting for the compile worker | 876 | bool async_build = false; // a null handle may be waiting for the compile worker |
| 868 | // What `build` would return when it is built already and nobody is building it, else null; builds nothing. Null: a | 877 | // What `build` would return when it is built already and nobody is building it, else null; builds nothing. Null: a |
| 869 | // first use is always built where prepare() meets it. Not used with async_build. See PipelineCompiles. | 878 | // first use is always built where prepare() meets it. Not used with async_build. See PipelineCompiles. |
| 870 | VkPipeline (*built)(void*) = nullptr; | 879 | VkPipeline (*built)(void*) = nullptr; |
| 871 | bool large = false; // compiled one after another with the other large ones (PipelineCompiles) | 880 | bool large = false; // PipelineCompiles limits how many of these compile at once |
| 872 | bool skipped = false; // never built on request (LEONIDA_SKIP_COMPUTE): its dispatches are dropped | 881 | bool skipped = false; // never built on request (LEONIDA_SKIP_COMPUTE): its dispatches are dropped |
| 882 | std::uint64_t estimate = 0; // large: the bytes of memory its compile is expected to take | ||
| 873 | }; | 883 | }; |
| 874 | 884 | ||
| 875 | // A graphics pipeline as replay needs it: the formats its attachments must have and which vertex-input slots it | 885 | // A graphics pipeline as replay needs it: the formats its attachments must have and which vertex-input slots it |
| @@ -888,6 +898,7 @@ struct GraphicsPipeline { | |||
| 888 | std::uint32_t strip_cut = 0; // D3D12_INDEX_BUFFER_STRIP_CUT_VALUE (0: off, 1: 0xFFFF, 2: 0xFFFFFFFF) | 898 | std::uint32_t strip_cut = 0; // D3D12_INDEX_BUFFER_STRIP_CUT_VALUE (0: off, 1: 0xFFFF, 2: 0xFFFFFFFF) |
| 889 | bool mesh = false; // a mesh shader instead of a vertex shader: drawn by DispatchMesh only | 899 | bool mesh = false; // a mesh shader instead of a vertex shader: drawn by DispatchMesh only |
| 890 | bool viewport_with_count = false; // pipeline uses VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT / SCISSOR_WITH_COUNT | 900 | bool viewport_with_count = false; // pipeline uses VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT / SCISSOR_WITH_COUNT |
| 901 | bool depth_bounds = false; // depthBoundsTestEnable: the bounds are dynamic (vkCmdSetDepthBounds) | ||
| 891 | // The same pipeline with some attachment formats VK_FORMAT_UNDEFINED, for a draw that leaves those slots | 902 | // The same pipeline with some attachment formats VK_FORMAT_UNDEFINED, for a draw that leaves those slots |
| 892 | // unbound (D3D12 allows it; dynamic rendering needs the formats to agree). Bit i: colour slot i, bit 8: depth | 903 | // unbound (D3D12 allows it; dynamic rendering needs the formats to agree). Bit i: colour slot i, bit 8: depth |
| 893 | // and stencil. Null when it cannot be built. | 904 | // and stencil. Null when it cannot be built. |
| @@ -903,6 +914,7 @@ struct GraphicsPipeline { | |||
| 903 | std::uint32_t samples = 1; // rasterizationSamples; every bound attachment must have this count | 914 | std::uint32_t samples = 1; // rasterizationSamples; every bound attachment must have this count |
| 904 | bool async_build = false; | 915 | bool async_build = false; |
| 905 | bool nonunit_vertex_divisor = false; // an actual instance divisor > 1, not a zero-stride emulation | 916 | bool nonunit_vertex_divisor = false; // an actual instance divisor > 1, not a zero-stride emulation |
| 917 | std::uint64_t estimate = 0; // as ComputePipeline::estimate | ||
| 906 | }; | 918 | }; |
| 907 | 919 | ||
| 908 | // The 144-byte push-constant block every translated shader declares: s0..s31, heap base, code base. | 920 | // The 144-byte push-constant block every translated shader declares: s0..s31, heap base, code base. |
| @@ -988,7 +1000,7 @@ inline ReplayResult unsupported_at(int line) { | |||
| 988 | 1000 | ||
| 989 | // The pipelines of a submission that are not built yet. prepare() adds each of them once and goes on; build_pipelines() | 1001 | // The pipelines of a submission that are not built yet. prepare() adds each of them once and goes on; build_pipelines() |
| 990 | // then compiles them all and puts them where prepare() left them out. Holds pointers to registered pipelines: valid | 1002 | // then compiles them all and puts them where prepare() left them out. Holds pointers to registered pipelines: valid |
| 991 | // while the context's resource lock is held. | 1003 | // while the context's pipeline lock is held. |
| 992 | class PipelineCompiles { | 1004 | class PipelineCompiles { |
| 993 | public: | 1005 | public: |
| 994 | // Where a prepared command finds its pipeline: an index for `built`, plus one; 0 when it needs none. | 1006 | // Where a prepared command finds its pipeline: an index for `built`, plus one; 0 when it needs none. |
| @@ -1000,7 +1012,7 @@ public: | |||
| 1000 | User user; | 1012 | User user; |
| 1001 | }; | 1013 | }; |
| 1002 | // A compile takes the driver some hundred bytes of memory for each byte of SPIR-V (docs/pipeline_check.md): graphics | 1014 | // A compile takes the driver some hundred bytes of memory for each byte of SPIR-V (docs/pipeline_check.md): graphics |
| 1003 | // pipelines of this much or more are `large`. | 1015 | // pipelines of this much or more are `large`. For compute pipelines the D3D12 layer decides. |
| 1004 | static constexpr std::uint64_t large_spirv_bytes = 1u << 20; | 1016 | static constexpr std::uint64_t large_spirv_bytes = 1u << 20; |
| 1005 | 1017 | ||
| 1006 | Ticket add(const GraphicsPipeline& pipeline, std::uint32_t flags) { | 1018 | Ticket add(const GraphicsPipeline& pipeline, std::uint32_t flags) { |
| @@ -1009,29 +1021,111 @@ public: | |||
| 1009 | Ticket add(const ComputePipeline& pipeline, User user) { return add({nullptr, &pipeline, 0}, user); } | 1021 | Ticket add(const ComputePipeline& pipeline, User user) { return add({nullptr, &pipeline, 0}, user); } |
| 1010 | 1022 | ||
| 1011 | bool empty() const { return jobs_.empty(); } | 1023 | bool empty() const { return jobs_.empty(); } |
| 1024 | bool any_large() const { | ||
| 1025 | return std::any_of(jobs_.begin(), jobs_.end(), [](const Job& job) { return is_large(job); }); | ||
| 1026 | } | ||
| 1012 | std::size_t size() const { return jobs_.size(); } | 1027 | std::size_t size() const { return jobs_.size(); } |
| 1013 | VkPipeline built(Ticket ticket) const { return jobs_[ticket - 1].built; } | 1028 | VkPipeline built(Ticket ticket) const { return jobs_[ticket - 1].built; } |
| 1014 | const std::vector<Use>& uses() const { return uses_; } // in the order of the commands | 1029 | const std::vector<Use>& uses() const { return uses_; } // in the order of the commands |
| 1015 | 1030 | ||
| 1016 | // Compiles all of them through run(count, job) (PipelineWorkers::run): the large ones one after another, as without | 1031 | // Whether this batch already attempted (pipeline, flags); writes its outcome (built handle or VK_NULL_HANDLE) to `out`. |
| 1017 | // workers, beside the others. | 1032 | bool lookup(const GraphicsPipeline* graphics, const ComputePipeline* compute, std::uint32_t flags, |
| 1033 | VkPipeline& out) const { | ||
| 1034 | const void* const pipeline = graphics ? static_cast<const void*>(graphics) : compute; | ||
| 1035 | const auto it = tickets_.find({pipeline, flags}); | ||
| 1036 | if (it == tickets_.end()) return false; | ||
| 1037 | out = jobs_[it->second - 1].built; | ||
| 1038 | return true; | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | // Whether this batch already attempted the job named by `other`'s `ticket`. | ||
| 1042 | bool contains_ticket(const PipelineCompiles& other, Ticket ticket) const { | ||
| 1043 | VkPipeline unused = VK_NULL_HANDLE; | ||
| 1044 | const Job& job = other.jobs_[ticket - 1]; | ||
| 1045 | return lookup(job.graphics, job.compute, job.flags, unused); | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | // Compiles all of them through run(count, job) (PipelineWorkers::run). The large ones share budget() bytes of memory: | ||
| 1049 | // the largest first, as many at once as their estimates fit, one at least; while the next one does not fit, the | ||
| 1050 | // others are compiled first. No budget, or 0: the large ones one after another, as without workers, beside the others. | ||
| 1018 | template<typename Run> | 1051 | template<typename Run> |
| 1019 | void build(Run&& run) { | 1052 | void build(Run&& run, const std::function<std::uint64_t()>& read_budget = {}, |
| 1053 | const PipelineCompiles* prior = nullptr) { | ||
| 1020 | std::vector<std::size_t> single, large; | 1054 | std::vector<std::size_t> single, large; |
| 1021 | for (std::size_t i = 0; i < jobs_.size(); ++i) (is_large(jobs_[i]) ? large : single).push_back(i); | 1055 | for (std::size_t i = 0; i < jobs_.size(); ++i) { |
| 1056 | if (prior && prior->lookup(jobs_[i].graphics, jobs_[i].compute, jobs_[i].flags, jobs_[i].built)) continue; | ||
| 1057 | (is_large(jobs_[i]) ? large : single).push_back(i); | ||
| 1058 | } | ||
| 1059 | if (single.empty() && large.empty()) return; | ||
| 1060 | // The first jobs of the run are lanes, which take large ones until none is left: no more of them than there are | ||
| 1061 | // large ones that fit the budget together (the smallest), so that no thread waits here for room in vain. | ||
| 1062 | std::size_t lanes = large.empty() ? 0 : 1; | ||
| 1063 | const std::uint64_t budget = lanes && read_budget ? read_budget() : 0; | ||
| 1064 | if (budget) { | ||
| 1065 | std::stable_sort(large.begin(), large.end(), [this](std::size_t a, std::size_t b) { | ||
| 1066 | return estimate(jobs_[a]) > estimate(jobs_[b]); | ||
| 1067 | }); | ||
| 1068 | std::uint64_t sum = estimate(jobs_[large.back()]); | ||
| 1069 | while (lanes < large.size() && (sum += estimate(jobs_[large[large.size() - 1 - lanes]])) <= budget) ++lanes; | ||
| 1070 | } | ||
| 1022 | const auto compile = [this](std::size_t i) { | 1071 | const auto compile = [this](std::size_t i) { |
| 1023 | Job& job = jobs_[i]; | 1072 | Job& job = jobs_[i]; |
| 1024 | job.built = job.graphics ? job.graphics->variant(job.flags) : job.compute->build(job.compute->build_context); | 1073 | job.built = job.graphics ? job.graphics->variant(job.flags) : job.compute->build(job.compute->build_context); |
| 1025 | }; | 1074 | }; |
| 1026 | const std::size_t chain = large.empty() ? 0 : 1; // the large ones are one unit, the first | 1075 | std::mutex mutex; // guards the four below |
| 1027 | run(chain + single.size(), [&](std::size_t i) { | 1076 | std::size_t next_single = 0, next_large = 0, compiling = 0; |
| 1028 | if (i >= chain) | 1077 | std::uint64_t reserved = 0; // the estimates of the large ones compiling |
| 1029 | compile(single[i - chain]); | 1078 | run(lanes + single.size(), [&](std::size_t i) { |
| 1030 | else | 1079 | std::unique_lock lock(mutex); |
| 1031 | for (const std::size_t each : large) compile(each); | 1080 | if (i >= lanes) { |
| 1081 | if (next_single == single.size()) return; // a lane has taken it | ||
| 1082 | const std::size_t index = single[next_single++]; | ||
| 1083 | lock.unlock(); | ||
| 1084 | compile(index); | ||
| 1085 | return; | ||
| 1086 | } | ||
| 1087 | while (next_large < large.size()) { | ||
| 1088 | const std::uint64_t need = estimate(jobs_[large[next_large]]); | ||
| 1089 | const bool fits = !compiling || reserved + need <= budget; | ||
| 1090 | if (!fits && next_single < single.size()) { | ||
| 1091 | const std::size_t index = single[next_single++]; | ||
| 1092 | lock.unlock(); | ||
| 1093 | compile(index); | ||
| 1094 | lock.lock(); | ||
| 1095 | continue; | ||
| 1096 | } | ||
| 1097 | const std::size_t index = large[next_large++]; | ||
| 1098 | ++compiling; | ||
| 1099 | reserved += need; | ||
| 1100 | lock.unlock(); | ||
| 1101 | compile(index); | ||
| 1102 | lock.lock(); | ||
| 1103 | --compiling; | ||
| 1104 | reserved -= need; | ||
| 1105 | } | ||
| 1032 | }); | 1106 | }); |
| 1033 | } | 1107 | } |
| 1034 | 1108 | ||
| 1109 | // Compiles jobs serially in command order without workers, stopping at the first fatal refusal (a failed draw, a | ||
| 1110 | // failed indirect dispatch, or any failed dispatch under strict_replay()). Matches serial prepare() short-circuit | ||
| 1111 | // semantics while allowing the caller to compile outside resource_mutex_. | ||
| 1112 | void build_serial(const PipelineCompiles* prior = nullptr) { | ||
| 1113 | std::vector<bool> done(jobs_.size(), false); | ||
| 1114 | for (const Use& use : uses_) { | ||
| 1115 | const std::size_t i = use.ticket - 1; | ||
| 1116 | if (!done[i]) { | ||
| 1117 | done[i] = true; | ||
| 1118 | Job& job = jobs_[i]; | ||
| 1119 | if (!prior || !prior->lookup(job.graphics, job.compute, job.flags, job.built)) { | ||
| 1120 | job.built = | ||
| 1121 | job.graphics ? job.graphics->variant(job.flags) : job.compute->build(job.compute->build_context); | ||
| 1122 | } | ||
| 1123 | } | ||
| 1124 | if (!jobs_[i].built && (use.user == User::draw || use.user == User::indirect_dispatch || strict_replay())) | ||
| 1125 | return; | ||
| 1126 | } | ||
| 1127 | } | ||
| 1128 | |||
| 1035 | private: | 1129 | private: |
| 1036 | struct Job { | 1130 | struct Job { |
| 1037 | const GraphicsPipeline* graphics; // one of the two | 1131 | const GraphicsPipeline* graphics; // one of the two |
| @@ -1040,6 +1134,9 @@ private: | |||
| 1040 | VkPipeline built = VK_NULL_HANDLE; | 1134 | VkPipeline built = VK_NULL_HANDLE; |
| 1041 | }; | 1135 | }; |
| 1042 | static bool is_large(const Job& job) { return job.graphics ? job.graphics->large : job.compute->large; } | 1136 | static bool is_large(const Job& job) { return job.graphics ? job.graphics->large : job.compute->large; } |
| 1137 | static std::uint64_t estimate(const Job& job) { | ||
| 1138 | return job.graphics ? job.graphics->estimate : job.compute->estimate; | ||
| 1139 | } | ||
| 1043 | Ticket add(const Job& job, User user) { | 1140 | Ticket add(const Job& job, User user) { |
| 1044 | const void* const pipeline = job.graphics ? static_cast<const void*>(job.graphics) : job.compute; | 1141 | const void* const pipeline = job.graphics ? static_cast<const void*>(job.graphics) : job.compute; |
| 1045 | const auto [it, added] = tickets_.try_emplace({pipeline, job.flags}, Ticket(jobs_.size() + 1)); | 1142 | const auto [it, added] = tickets_.try_emplace({pipeline, job.flags}, Ticket(jobs_.size() + 1)); |
| @@ -1087,6 +1184,10 @@ struct ReplayFunctions { | |||
| 1087 | PFN_vkCmdResetQueryPool reset_query_pool = nullptr; // queries, with fill_buffer for unavailable results | 1184 | PFN_vkCmdResetQueryPool reset_query_pool = nullptr; // queries, with fill_buffer for unavailable results |
| 1088 | PFN_vkCmdBeginQuery begin_query = nullptr; | 1185 | PFN_vkCmdBeginQuery begin_query = nullptr; |
| 1089 | PFN_vkCmdEndQuery end_query = nullptr; | 1186 | PFN_vkCmdEndQuery end_query = nullptr; |
| 1187 | // VK_EXT_transform_feedback (D3D-302): SO_STATISTICS queries begin/end indexed on a stream. Null when the device | ||
| 1188 | // lacks the feature. | ||
| 1189 | PFN_vkCmdBeginQueryIndexedEXT begin_query_indexed = nullptr; | ||
| 1190 | PFN_vkCmdEndQueryIndexedEXT end_query_indexed = nullptr; | ||
| 1090 | PFN_vkCmdWriteTimestamp write_timestamp = nullptr; | 1191 | PFN_vkCmdWriteTimestamp write_timestamp = nullptr; |
| 1091 | PFN_vkCmdCopyQueryPoolResults copy_query_pool_results = nullptr; | 1192 | PFN_vkCmdCopyQueryPoolResults copy_query_pool_results = nullptr; |
| 1092 | // Set only where a copy of timestamp results is not ordered after the timestamps written before it (MoltenVK on | 1193 | // Set only where a copy of timestamp results is not ordered after the timestamps written before it (MoltenVK on |
| @@ -1116,9 +1217,13 @@ struct ReplayFunctions { | |||
| 1116 | PFN_vkCmdSetPrimitiveRestartEnable set_primitive_restart_enable = nullptr; | 1217 | PFN_vkCmdSetPrimitiveRestartEnable set_primitive_restart_enable = nullptr; |
| 1117 | PFN_vkCmdSetStencilReference set_stencil_reference = nullptr; | 1218 | PFN_vkCmdSetStencilReference set_stencil_reference = nullptr; |
| 1118 | PFN_vkCmdSetBlendConstants set_blend_constants = nullptr; | 1219 | PFN_vkCmdSetBlendConstants set_blend_constants = nullptr; |
| 1220 | PFN_vkCmdSetDepthBounds set_depth_bounds = nullptr; // for depth-bounds pipelines only | ||
| 1119 | PFN_vkCmdDraw draw = nullptr; | 1221 | PFN_vkCmdDraw draw = nullptr; |
| 1120 | unsigned* mesh_draw_count = nullptr; // opt-in count for this submission | 1222 | unsigned* mesh_draw_count = nullptr; // opt-in count for this submission |
| 1121 | PFN_vkCmdDrawMeshTasksEXT draw_mesh_tasks = nullptr; // VK_EXT_mesh_shader; null: mesh draws are unsupported | 1223 | PFN_vkCmdDrawMeshTasksEXT draw_mesh_tasks = nullptr; // VK_EXT_mesh_shader; null: mesh draws are unsupported |
| 1224 | // ExecuteIndirect with a DISPATCH_MESH signature. Its 12-byte record is VkDrawMeshTasksIndirectCommandEXT. | ||
| 1225 | PFN_vkCmdDrawMeshTasksIndirectEXT draw_mesh_tasks_indirect = nullptr; | ||
| 1226 | PFN_vkCmdDrawMeshTasksIndirectCountEXT draw_mesh_tasks_indirect_count = nullptr; | ||
| 1122 | PFN_vkCmdDrawIndexed draw_indexed = nullptr; | 1227 | PFN_vkCmdDrawIndexed draw_indexed = nullptr; |
| 1123 | std::function<const GraphicsPipeline*(std::uintptr_t)> graphics_pipeline; | 1228 | std::function<const GraphicsPipeline*(std::uintptr_t)> graphics_pipeline; |
| 1124 | // The buffer and offset a console VA range starts in (from ResourceBinding::va), false when none does. `size` is | 1229 | // The buffer and offset a console VA range starts in (from ResourceBinding::va), false when none does. `size` is |
| @@ -1192,6 +1297,7 @@ struct ReplayFunctions { | |||
| 1192 | std::function<bool(VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, std::uint32_t, std::uint32_t, std::uint32_t, | 1297 | std::function<bool(VkBuffer, VkDeviceSize, VkBuffer, VkDeviceSize, std::uint32_t, std::uint32_t, std::uint32_t, |
| 1193 | ClampedIndirect&)> prepare_indirect_clamp; | 1298 | ClampedIndirect&)> prepare_indirect_clamp; |
| 1194 | std::function<void(VkCommandBuffer, const ClampedIndirect&)> emit_indirect_clamp; | 1299 | std::function<void(VkCommandBuffer, const ClampedIndirect&)> emit_indirect_clamp; |
| 1300 | bool external_graphics_scope = false; // Caller supplies the rendering scope, pipeline and bindings for legacy draws. | ||
| 1195 | bool require_indirect_clamp = false; // an enabled device refuses an indirect if scratch preparation fails | 1301 | bool require_indirect_clamp = false; // an enabled device refuses an indirect if scratch preparation fails |
| 1196 | // Optional VK_KHR_acceleration_structure: BuildRaytracingAccelerationStructure. | 1302 | // Optional VK_KHR_acceleration_structure: BuildRaytracingAccelerationStructure. |
| 1197 | PFN_vkCmdBuildAccelerationStructuresKHR build_acceleration_structures = nullptr; | 1303 | PFN_vkCmdBuildAccelerationStructuresKHR build_acceleration_structures = nullptr; |
| @@ -1296,7 +1402,7 @@ struct Prepared { | |||
| 1296 | PredicateCapture predicate; | 1402 | PredicateCapture predicate; |
| 1297 | std::vector<PredicatedCopyDispatch> predicated_copy; | 1403 | std::vector<PredicatedCopyDispatch> predicated_copy; |
| 1298 | CountedDispatch counted_dispatch; | 1404 | CountedDispatch counted_dispatch; |
| 1299 | ClampedIndirect indirect_clamp; // ExecuteIndirect: the clamped arguments the command reads, or null | 1405 | ClampedIndirect indirect_clamp; // an indirect command's clamped arguments it reads, or null |
| 1300 | ResourceBinding binding; | 1406 | ResourceBinding binding; |
| 1301 | VkImageSubresourceRange range{}; // the barrier range, or the cleared view (cleared aspects only) | 1407 | VkImageSubresourceRange range{}; // the barrier range, or the cleared view (cleared aspects only) |
| 1302 | VkImageView view = VK_NULL_HANDLE; | 1408 | VkImageView view = VK_NULL_HANDLE; |
| @@ -2561,7 +2667,9 @@ ReplayResult prepare_draw(const Draw& draw, const IndirectDrawArgs* arguments, R | |||
| 2561 | const ReplayFunctions& vk, PreparedDraw& p) { | 2667 | const ReplayFunctions& vk, PreparedDraw& p) { |
| 2562 | if (arguments) { | 2668 | if (arguments) { |
| 2563 | const IndirectDrawArgs& arg = *arguments; | 2669 | const IndirectDrawArgs& arg = *arguments; |
| 2564 | const VkDeviceSize record_size = draw.indexed ? sizeof(VkDrawIndexedIndirectCommand) : sizeof(VkDrawIndirectCommand); | 2670 | const VkDeviceSize record_size = draw.mesh ? sizeof(VkDrawMeshTasksIndirectCommandEXT) |
| 2671 | : draw.indexed ? sizeof(VkDrawIndexedIndirectCommand) | ||
| 2672 | : sizeof(VkDrawIndirectCommand); | ||
| 2565 | if (!arg.argument_buffer || !arg.max_count || arg.stride < record_size || | 2673 | if (!arg.argument_buffer || !arg.max_count || arg.stride < record_size || |
| 2566 | (arg.stride | arg.argument_offset | arg.count_offset) % 4 || (!arg.count_buffer && arg.count_offset)) | 2674 | (arg.stride | arg.argument_offset | arg.count_offset) % 4 || (!arg.count_buffer && arg.count_offset)) |
| 2567 | return ReplayResult::invalid_indirect_arguments; | 2675 | return ReplayResult::invalid_indirect_arguments; |
| @@ -2569,8 +2677,10 @@ ReplayResult prepare_draw(const Draw& draw, const IndirectDrawArgs* arguments, R | |||
| 2569 | // independently of the supplied maxDrawCount. On a device with a smaller limit an | 2677 | // independently of the supplied maxDrawCount. On a device with a smaller limit an |
| 2570 | // arbitrary D3D12 count requires a GPU clamp pass; keep that case guarded for now. | 2678 | // arbitrary D3D12 count requires a GPU clamp pass; keep that case guarded for now. |
| 2571 | const bool counted = arg.count_buffer != 0; | 2679 | const bool counted = arg.count_buffer != 0; |
| 2572 | const bool entry_available = counted ? (draw.indexed ? vk.draw_indexed_indirect_count : vk.draw_indirect_count) != nullptr | 2680 | const bool entry_available = |
| 2573 | : (draw.indexed ? vk.draw_indexed_indirect : vk.draw_indirect) != nullptr; | 2681 | draw.mesh ? (counted ? vk.draw_mesh_tasks_indirect_count != nullptr : vk.draw_mesh_tasks_indirect != nullptr) |
| 2682 | : counted ? (draw.indexed ? vk.draw_indexed_indirect_count : vk.draw_indirect_count) != nullptr | ||
| 2683 | : (draw.indexed ? vk.draw_indexed_indirect : vk.draw_indirect) != nullptr; | ||
| 2574 | // The GPU supplies firstIndex/indexCount at execution (VUID-08798). A sized binding alone | 2684 | // The GPU supplies firstIndex/indexCount at execution (VUID-08798). A sized binding alone |
| 2575 | // does not guarantee a robust fetch, and the legacy binding covers the backing buffer's tail. | 2685 | // does not guarantee a robust fetch, and the legacy binding covers the backing buffer's tail. |
| 2576 | const auto skip = [&](indirect_stats::Reason reason) { | 2686 | const auto skip = [&](indirect_stats::Reason reason) { |
| @@ -2578,11 +2688,13 @@ ReplayResult prepare_draw(const Draw& draw, const IndirectDrawArgs* arguments, R | |||
| 2578 | p.skipped = true; | 2688 | p.skipped = true; |
| 2579 | return ReplayResult::success; | 2689 | return ReplayResult::success; |
| 2580 | }; | 2690 | }; |
| 2581 | if (draw.mesh) return skip(indirect_stats::mesh); | 2691 | // A mesh draw has no topology, first instance or index buffer; its records go through the clamp pass, |
| 2692 | // which bounds x and sets y = z = 1 (the console's mesh dispatch is one-dimensional), or it is not drawn. | ||
| 2693 | if (draw.mesh && (!entry_available || !leonida::indirect_clamp_enabled())) return skip(indirect_stats::mesh); | ||
| 2582 | static_assert(indirect_stats::topology_supported(topology_rect_list) && | 2694 | static_assert(indirect_stats::topology_supported(topology_rect_list) && |
| 2583 | !indirect_stats::topology_supported(topology_quad_list)); | 2695 | !indirect_stats::topology_supported(topology_quad_list)); |
| 2584 | if (!indirect_stats::topology_supported(draw.topology)) return skip(indirect_stats::topology); | 2696 | if (!draw.mesh && !indirect_stats::topology_supported(draw.topology)) return skip(indirect_stats::topology); |
| 2585 | if (!vk.draw_indirect_first_instance) return skip(indirect_stats::first_instance); | 2697 | if (!draw.mesh && !vk.draw_indirect_first_instance) return skip(indirect_stats::first_instance); |
| 2586 | if (!entry_available) return skip(indirect_stats::entry); | 2698 | if (!entry_available) return skip(indirect_stats::entry); |
| 2587 | if (draw.indexed && !vk.bind_robust_index_view) return skip(indirect_stats::robust_index); | 2699 | if (draw.indexed && !vk.bind_robust_index_view) return skip(indirect_stats::robust_index); |
| 2588 | if (arg.max_count > vk.max_draw_indirect_count) return skip(indirect_stats::count_limit); | 2700 | if (arg.max_count > vk.max_draw_indirect_count) return skip(indirect_stats::count_limit); |
| @@ -2626,6 +2738,7 @@ ReplayResult prepare_draw(const Draw& draw, const IndirectDrawArgs* arguments, R | |||
| 2626 | if (draw.mesh && !vk.draw_mesh_tasks) return unsupported_at(__LINE__); | 2738 | if (draw.mesh && !vk.draw_mesh_tasks) return unsupported_at(__LINE__); |
| 2627 | if (pipeline->viewport_with_count && (!vk.set_viewport_with_count || !vk.set_scissor_with_count)) | 2739 | if (pipeline->viewport_with_count && (!vk.set_viewport_with_count || !vk.set_scissor_with_count)) |
| 2628 | return unsupported_at(__LINE__); | 2740 | return unsupported_at(__LINE__); |
| 2741 | if (pipeline->depth_bounds && !vk.set_depth_bounds) return unsupported_at(__LINE__); | ||
| 2629 | if (pipeline->bindless_set && !vk.bind_descriptor_sets) return unsupported_at(__LINE__); | 2742 | if (pipeline->bindless_set && !vk.bind_descriptor_sets) return unsupported_at(__LINE__); |
| 2630 | if (pipeline->color_formats.size() > max_render_targets) return unsupported_at(__LINE__); | 2743 | if (pipeline->color_formats.size() > max_render_targets) return unsupported_at(__LINE__); |
| 2631 | p.graphics = pipeline; | 2744 | p.graphics = pipeline; |
| @@ -2940,30 +3053,51 @@ public: | |||
| 2940 | std::vector<detail::PreparedKhrPostbuild> khr_postbuilds; | 3053 | std::vector<detail::PreparedKhrPostbuild> khr_postbuilds; |
| 2941 | }; | 3054 | }; |
| 2942 | 3055 | ||
| 2943 | // Ends the preparation of a submission whose prepare() calls used `compiles` and returned `result` (the first that | 3056 | // Checks the outcomes of a compiled PipelineCompiles batch against `result` (the first prepare() failure, if any). |
| 2944 | // failed, if any): builds the pipelines through run(count, job), puts them into `lists`, and returns what the calls would | 3057 | // Every use in `compiles` comes from a command before the one that failed, so a pipeline that cannot be built counts |
| 2945 | // have returned had they built each pipeline themselves. Every use in `compiles` comes from a command before the one that | 3058 | // first, at the earliest command that uses it: it fails the list of a draw or an indirect dispatch, and a dispatch is |
| 2946 | // failed, so a pipeline that cannot be built counts first, at the earliest command that uses it: it fails the list of a | 3059 | // dropped as prepare() drops one. Non-strict failed dispatches already logged in `prior` are not logged twice. |
| 2947 | // draw or an indirect dispatch, and a dispatch is dropped as prepare() drops one. | 3060 | inline ReplayResult check_compiled_pipelines(const PipelineCompiles& compiles, ReplayResult result, |
| 2948 | template<typename Run> | 3061 | const PipelineCompiles* prior = nullptr) { |
| 2949 | ReplayResult build_pipelines(PipelineCompiles& compiles, std::span<PreparedList> lists, ReplayResult result, | ||
| 2950 | Run&& run) { | ||
| 2951 | if (compiles.empty()) return result; | ||
| 2952 | compiles.build(run); | ||
| 2953 | for (const PipelineCompiles::Use& use : compiles.uses()) { | 3062 | for (const PipelineCompiles::Use& use : compiles.uses()) { |
| 2954 | if (compiles.built(use.ticket)) continue; | 3063 | if (compiles.built(use.ticket)) continue; |
| 2955 | if (use.user == PipelineCompiles::User::draw) return unsupported_at(__LINE__); | 3064 | if (use.user == PipelineCompiles::User::draw) return unsupported_at(__LINE__); |
| 2956 | if (use.user == PipelineCompiles::User::indirect_dispatch || strict_replay()) return unresolved_at(__LINE__); | 3065 | if (use.user == PipelineCompiles::User::indirect_dispatch || strict_replay()) return unresolved_at(__LINE__); |
| 2957 | unresolved_at(__LINE__); | 3066 | if (!prior || !prior->contains_ticket(compiles, use.ticket)) unresolved_at(__LINE__); |
| 2958 | } | 3067 | } |
| 2959 | if (result != ReplayResult::success) return result; | 3068 | return result; |
| 3069 | } | ||
| 3070 | |||
| 3071 | inline ReplayResult finish_compiled_pipelines(const PipelineCompiles& compiles, std::span<PreparedList> lists, | ||
| 3072 | ReplayResult result, const PipelineCompiles* prior = nullptr) { | ||
| 3073 | const ReplayResult checked = check_compiled_pipelines(compiles, result, prior); | ||
| 3074 | if (checked != ReplayResult::success) return checked; | ||
| 2960 | for (PreparedList& list : lists) { | 3075 | for (PreparedList& list : lists) { |
| 2961 | for (detail::Prepared& command : list.commands) | 3076 | for (detail::Prepared& command : list.commands) |
| 2962 | if (command.compile) command.pipeline.pipeline = compiles.built(command.compile); | 3077 | if (command.compile) command.pipeline.pipeline = compiles.built(command.compile); |
| 2963 | for (std::size_t i = 0; i < list.draw_count; ++i) | 3078 | for (std::size_t i = 0; i < list.draw_count; ++i) |
| 2964 | if (list.draws[i].compile) list.draws[i].pipeline = compiles.built(list.draws[i].compile); | 3079 | if (list.draws[i].compile) list.draws[i].pipeline = compiles.built(list.draws[i].compile); |
| 2965 | } | 3080 | } |
| 2966 | return result; | 3081 | return checked; |
| 3082 | } | ||
| 3083 | |||
| 3084 | // Ends the preparation of a submission whose prepare() calls used `compiles` and returned `result` (the first that | ||
| 3085 | // failed, if any): builds the pipelines through run(count, job), puts them into `lists`, and returns what the calls would | ||
| 3086 | // have returned had they built each pipeline themselves. | ||
| 3087 | template<typename Run> | ||
| 3088 | ReplayResult build_pipelines(PipelineCompiles& compiles, std::span<PreparedList> lists, ReplayResult result, | ||
| 3089 | Run&& run, const std::function<std::uint64_t()>& budget = {}, | ||
| 3090 | const PipelineCompiles* prior = nullptr) { | ||
| 3091 | if (compiles.empty()) return result; | ||
| 3092 | compiles.build(run, budget, prior); | ||
| 3093 | return finish_compiled_pipelines(compiles, lists, result, prior); | ||
| 3094 | } | ||
| 3095 | |||
| 3096 | inline ReplayResult build_pipelines_serial(PipelineCompiles& compiles, std::span<PreparedList> lists, | ||
| 3097 | ReplayResult result, const PipelineCompiles* prior = nullptr) { | ||
| 3098 | if (compiles.empty()) return result; | ||
| 3099 | compiles.build_serial(prior); | ||
| 3100 | return finish_compiled_pipelines(compiles, lists, result, prior); | ||
| 2967 | } | 3101 | } |
| 2968 | 3102 | ||
| 2969 | inline ReplayResult plan_occlusion_segments(PreparedList& out) { | 3103 | inline ReplayResult plan_occlusion_segments(PreparedList& out) { |
| @@ -3278,6 +3412,8 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun | |||
| 3278 | out.unpredicated_copies = 0; | 3412 | out.unpredicated_copies = 0; |
| 3279 | const bool queries = vk.reset_query_pool && vk.begin_query && vk.end_query && vk.write_timestamp && | 3413 | const bool queries = vk.reset_query_pool && vk.begin_query && vk.end_query && vk.write_timestamp && |
| 3280 | vk.copy_query_pool_results && vk.fill_buffer && vk.query_pool; | 3414 | vk.copy_query_pool_results && vk.fill_buffer && vk.query_pool; |
| 3415 | // An SO_STATISTICS query on a real transform-feedback heap additionally needs the indexed begin/end (D3D-302). | ||
| 3416 | const bool so_queries = vk.begin_query_indexed && vk.end_query_indexed; | ||
| 3281 | // Vulkan allows one active query per type. Overlapping ordinary and binary occlusion share one physical | 3417 | // Vulkan allows one active query per type. Overlapping ordinary and binary occlusion share one physical |
| 3282 | // segment pool, and overlapping statistics split into the statistics pool (D3D-252); a physical query of a | 3418 | // segment pool, and overlapping statistics split into the statistics pool (D3D-252); a physical query of a |
| 3283 | // type is still open at most once at any point, because each event closes the one open slot and opens a new | 3419 | // type is still open at most once at any point, because each event closes the one open slot and opens a new |
| @@ -3285,6 +3421,10 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun | |||
| 3285 | VkDeviceAddress indirect_list_budget = 0; | 3421 | VkDeviceAddress indirect_list_budget = 0; |
| 3286 | std::size_t ordinary_active = 0, binary_active = 0, statistics_active_count = 0; | 3422 | std::size_t ordinary_active = 0, binary_active = 0, statistics_active_count = 0; |
| 3287 | bool overlaps = false, statistics_overlaps = false, statistics_active = false; | 3423 | bool overlaps = false, statistics_overlaps = false, statistics_active = false; |
| 3424 | // Streams with an active SO_STATISTICS query in this list, one bit each (D3D-302). Two active transform-feedback | ||
| 3425 | // queries on one stream break VUID-vkCmdBeginQueryIndexedEXT-queryPool-04753 anywhere in the command buffer, | ||
| 3426 | // whatever their pools, so prepare refuses a second Begin on an active stream. | ||
| 3427 | std::uint32_t so_active = 0; | ||
| 3288 | out.wrote_readback = false; | 3428 | out.wrote_readback = false; |
| 3289 | out.readback_src_stages = 0; | 3429 | out.readback_src_stages = 0; |
| 3290 | 3430 | ||
| @@ -3833,7 +3973,23 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun | |||
| 3833 | overlaps |= begin && (ordinary_active || binary_active); | 3973 | overlaps |= begin && (ordinary_active || binary_active); |
| 3834 | if (begin) ++binary_active; else --binary_active; | 3974 | if (begin) ++binary_active; else --binary_active; |
| 3835 | } else if (is_so_statistics(range.type)) { | 3975 | } else if (is_so_statistics(range.type)) { |
| 3836 | // No Vulkan query runs for it (QueryPool::pool is null), so it overlaps nothing. | 3976 | // A real transform-feedback heap queries on a stream (D3D-302). Stream n runs only when the |
| 3977 | // heap's pool covers it; then the indexed commands are required. Without a pool (the feature is | ||
| 3978 | // off or has no transformFeedbackQueries) or past maxTransformFeedbackStreams it runs nothing | ||
| 3979 | // and resolves zero. Two overlapping queries on one stream cannot both be active in one command | ||
| 3980 | // buffer, even in two heaps (VUID-vkCmdBeginQueryIndexedEXT-queryPool-04753), so a second Begin | ||
| 3981 | // is refused. | ||
| 3982 | const std::uint32_t stream = range.type - d3d12_query::so_statistics_stream0; | ||
| 3983 | if (heap->pool && stream < heap->streams) { | ||
| 3984 | if (!so_queries) return unsupported_at(__LINE__); | ||
| 3985 | const std::uint32_t bit = 1u << stream; // stream < heap->streams <= 4 | ||
| 3986 | if (begin) { | ||
| 3987 | if (so_active & bit) return ReplayResult::invalid_query; | ||
| 3988 | so_active |= bit; | ||
| 3989 | } else { | ||
| 3990 | so_active &= ~bit; | ||
| 3991 | } | ||
| 3992 | } | ||
| 3837 | } else { | 3993 | } else { |
| 3838 | statistics_overlaps |= begin && statistics_active_count; | 3994 | statistics_overlaps |= begin && statistics_active_count; |
| 3839 | if (begin) ++statistics_active_count; else --statistics_active_count; | 3995 | if (begin) ++statistics_active_count; else --statistics_active_count; |
| @@ -3879,6 +4035,58 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun | |||
| 3879 | return ReplayResult::invalid_indirect_arguments; | 4035 | return ReplayResult::invalid_indirect_arguments; |
| 3880 | p.source = *cnt; | 4036 | p.source = *cnt; |
| 3881 | } | 4037 | } |
| 4038 | if (ind->kind != IndirectKind::dispatch && !vk.external_graphics_scope) continue; | ||
| 4039 | // The clamp pass (vulkan_indirect_clamp.h): the arguments are copied on the GPU into scratch with their | ||
| 4040 | // values bounded before the indirect command reads them, so a stale or garbage record left by a skipped or | ||
| 4041 | // mistranslated compute pass cannot run for seconds and reset the display driver. A counted call has its | ||
| 4042 | // count clamped to max_command_count too. It is a helper dispatch, so it needs the statistics segments of | ||
| 4043 | // a pipeline-statistics query. Every clamp of this list shares one work budget: a list of many calls does | ||
| 4044 | // not multiply the per-list limit. | ||
| 4045 | const bool clamp_command_available = | ||
| 4046 | ind->kind == IndirectKind::dispatch | ||
| 4047 | ? vk.dispatch_indirect != nullptr | ||
| 4048 | : ind->kind == IndirectKind::draw | ||
| 4049 | ? (ind->count_buffer ? vk.draw_indirect_count != nullptr : vk.draw_indirect != nullptr) | ||
| 4050 | : (ind->count_buffer ? vk.draw_indexed_indirect_count != nullptr | ||
| 4051 | : vk.draw_indexed_indirect != nullptr); | ||
| 4052 | const bool clamped = | ||
| 4053 | leonida::indirect_clamp_enabled() && vk.prepare_indirect_clamp && vk.emit_indirect_clamp && | ||
| 4054 | clamp_command_available && !(statistics_active && !statistics_helpers) && | ||
| 4055 | vk.prepare_indirect_clamp(p.binding.buffer, p.binding.buffer_offset + ind->argument_offset, | ||
| 4056 | ind->count_buffer ? p.source.buffer : VK_NULL_HANDLE, | ||
| 4057 | ind->count_buffer ? p.source.buffer_offset + ind->count_offset : 0, | ||
| 4058 | static_cast<std::uint32_t>(ind->kind), ind->stride, ind->max_count, | ||
| 4059 | p.indirect_clamp); | ||
| 4060 | if (clamped) p.indirect_clamp.share_list_budget(indirect_list_budget); | ||
| 4061 | // A device with the pass enabled refuses an indirect call whose clamp could not be prepared: reading the | ||
| 4062 | // application's buffer is what the clamp exists to avoid. Otherwise the fallbacks below apply. | ||
| 4063 | if (!clamped && vk.require_indirect_clamp) return unsupported_at(__LINE__); | ||
| 4064 | // Nothing else to resolve when clamped: the clamp's scratch is the indirect buffer and its count word. | ||
| 4065 | if (!clamped) { | ||
| 4066 | if (ind->kind == IndirectKind::dispatch) { | ||
| 4067 | if (ind->count_buffer || indirect_group_budget()) { | ||
| 4068 | // Vulkan lacks vkCmdDispatchIndirectCount. Copy the GPU-visible commands to private scratch | ||
| 4069 | // and replace commands past min(count, max_count) with zero-group dispatches - or, with | ||
| 4070 | // LEONIDA_INDIRECT_GROUP_BUDGET and no count buffer, keep the whole batch inside its work | ||
| 4071 | // budget. `source` is the count binding, null without one. | ||
| 4072 | if (!ind->pipeline || !vk.dispatch_indirect || !vk.prepare_counted_dispatch || | ||
| 4073 | !vk.emit_counted_dispatch || (statistics_active && !statistics_helpers) || | ||
| 4074 | !vk.prepare_counted_dispatch(p.binding.buffer, p.binding.buffer_offset + ind->argument_offset, | ||
| 4075 | p.source.buffer, p.source.buffer_offset + ind->count_offset, | ||
| 4076 | ind->stride, ind->max_count, p.counted_dispatch)) | ||
| 4077 | return unsupported_at(__LINE__); | ||
| 4078 | } else if (!vk.dispatch_indirect) { | ||
| 4079 | return unsupported_at(__LINE__); | ||
| 4080 | } | ||
| 4081 | } else if (!clamp_command_available) { | ||
| 4082 | // A legacy graphics indirect draw is still emitted (a caller that opened its own rendering scope | ||
| 4083 | // around the replay, as the tests do); without vkCmdDrawIndirect[Count] there is nothing to emit. | ||
| 4084 | return unsupported_at(__LINE__); | ||
| 4085 | } | ||
| 4086 | } | ||
| 4087 | // Legacy graphics IR carries no graphics state of its own: the recorded, stateful graphics indirects are | ||
| 4088 | // Draw commands (IndirectRasterDraw) and open their own rendering scope. A legacy one is emitted as it is | ||
| 4089 | // - the clamp pass above is what keeps its arguments safe - and its dispatch-side work ends here. | ||
| 3882 | if (ind->kind == IndirectKind::dispatch && ind->pipeline) { // the pipeline and root arguments it was recorded | 4090 | if (ind->kind == IndirectKind::dispatch && ind->pipeline) { // the pipeline and root arguments it was recorded |
| 3883 | if (!vk.bind_pipeline || !vk.push_constants || !vk.compute_pipeline) return unsupported_at(__LINE__); | 4091 | if (!vk.bind_pipeline || !vk.push_constants || !vk.compute_pipeline) return unsupported_at(__LINE__); |
| 3884 | const ComputePipeline* pipeline = vk.compute_pipeline(ind->pipeline); | 4092 | const ComputePipeline* pipeline = vk.compute_pipeline(ind->pipeline); |
| @@ -3890,28 +4098,6 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun | |||
| 3890 | if (!found) return unresolved_at(__LINE__); | 4098 | if (!found) return unresolved_at(__LINE__); |
| 3891 | if (pipeline->bindless_set && !vk.bind_descriptor_sets) return unsupported_at(__LINE__); | 4099 | if (pipeline->bindless_set && !vk.bind_descriptor_sets) return unsupported_at(__LINE__); |
| 3892 | } | 4100 | } |
| 3893 | if (ind->kind == IndirectKind::dispatch && vk.require_indirect_clamp) { | ||
| 3894 | if (!ind->pipeline || !vk.dispatch_indirect || !vk.prepare_indirect_clamp || !vk.emit_indirect_clamp || | ||
| 3895 | (statistics_active && !statistics_helpers) || | ||
| 3896 | !vk.prepare_indirect_clamp(p.binding.buffer, p.binding.buffer_offset + ind->argument_offset, | ||
| 3897 | p.source.buffer, p.source.buffer_offset + ind->count_offset, indirect_clamp_dispatch, | ||
| 3898 | ind->stride, ind->max_count, p.indirect_clamp)) | ||
| 3899 | return unsupported_at(__LINE__); | ||
| 3900 | p.indirect_clamp.share_list_budget(indirect_list_budget); | ||
| 3901 | } else if (ind->kind == IndirectKind::dispatch && (ind->count_buffer || indirect_group_budget())) { | ||
| 3902 | // Vulkan lacks vkCmdDispatchIndirectCount. Copy the GPU-visible commands to private scratch | ||
| 3903 | // and replace commands past min(count, max_count) with zero-group dispatches. | ||
| 3904 | if (!ind->pipeline || !vk.dispatch_indirect || !vk.prepare_counted_dispatch || | ||
| 3905 | !vk.emit_counted_dispatch || (statistics_active && !statistics_helpers) || | ||
| 3906 | !vk.prepare_counted_dispatch(p.binding.buffer, p.binding.buffer_offset + ind->argument_offset, | ||
| 3907 | p.source.buffer, p.source.buffer_offset + ind->count_offset, | ||
| 3908 | ind->stride, ind->max_count, p.counted_dispatch)) | ||
| 3909 | return unsupported_at(__LINE__); | ||
| 3910 | } else if (ind->kind == IndirectKind::dispatch && !vk.dispatch_indirect) { | ||
| 3911 | return unsupported_at(__LINE__); | ||
| 3912 | } | ||
| 3913 | // Legacy graphics IR carries no graphics state. Validate its resource ranges above, | ||
| 3914 | // but never emit it; stateful graphics indirects use Draw and its rendering scope. | ||
| 3915 | } else if (const auto* build = std::get_if<BuildAccelerationStructure>(&command)) { | 4101 | } else if (const auto* build = std::get_if<BuildAccelerationStructure>(&command)) { |
| 3916 | p.khr_instances = 0; | 4102 | p.khr_instances = 0; |
| 3917 | if (vk.xdxr_check) { | 4103 | if (vk.xdxr_check) { |
| @@ -4052,19 +4238,49 @@ ReplayResult prepare(const CommandList& list, Resolve&& resolve, const ReplayFun | |||
| 4052 | if (const auto r = detail::prepare_quad_indices(*draw.state, vk, prepared_draw); r != ReplayResult::success) | 4238 | if (const auto r = detail::prepare_quad_indices(*draw.state, vk, prepared_draw); r != ReplayResult::success) |
| 4053 | return r; | 4239 | return r; |
| 4054 | } | 4240 | } |
| 4055 | if (draw.arguments && !prepared_draw.skipped && vk.require_indirect_clamp) { | 4241 | // A stateful indirect draw takes the same clamp pass (vulkan_indirect_clamp.h) as a legacy ExecuteIndirect: |
| 4056 | const auto& arg = *draw.arguments; | 4242 | // the arguments it reads are copied and bounded on the GPU before its rendering scope opens, and the draw |
| 4057 | if (!vk.prepare_indirect_clamp || !vk.emit_indirect_clamp || (statistics_active && !statistics_helpers) || | 4243 | // then reads that scratch. Recorded in this command's Prepared so the emit phase records the pass before |
| 4058 | !vk.prepare_indirect_clamp(prepared_draw.indirect_buffer, prepared_draw.indirect_offset, | 4244 | // vkCmdBeginRendering - outside the scope and outside a pipeline-statistics query. A draw that was already |
| 4059 | prepared_draw.indirect_count_buffer, prepared_draw.indirect_count_offset, | 4245 | // dropped, or whose indirect entry point or scratch is missing, keeps the application's argument buffer. |
| 4060 | draw.state->indexed ? indirect_clamp_draw_indexed : indirect_clamp_draw, | 4246 | if (draw.arguments && !prepared_draw.skipped) { |
| 4061 | arg.stride, arg.max_count, p.indirect_clamp)) | 4247 | const IndirectDrawArgs& arg = *draw.arguments; |
| 4248 | const ResourceBinding* args_of = resolve(arg.argument_buffer); | ||
| 4249 | const ResourceBinding* count = arg.count_buffer ? resolve(arg.count_buffer) : nullptr; | ||
| 4250 | const bool indexed = draw.state->indexed; | ||
| 4251 | const bool mesh = draw.state->mesh; | ||
| 4252 | const bool clamp_command_available = | ||
| 4253 | mesh ? (arg.count_buffer ? vk.draw_mesh_tasks_indirect_count != nullptr | ||
| 4254 | : vk.draw_mesh_tasks_indirect != nullptr) | ||
| 4255 | : arg.count_buffer | ||
| 4256 | ? (indexed ? vk.draw_indexed_indirect_count != nullptr : vk.draw_indirect_count != nullptr) | ||
| 4257 | : (indexed ? vk.draw_indexed_indirect != nullptr : vk.draw_indirect != nullptr); | ||
| 4258 | const bool clamped = | ||
| 4259 | args_of && args_of->buffer && clamp_command_available && leonida::indirect_clamp_enabled() && | ||
| 4260 | vk.prepare_indirect_clamp && vk.emit_indirect_clamp && !(statistics_active && !statistics_helpers) && | ||
| 4261 | vk.prepare_indirect_clamp(args_of->buffer, args_of->buffer_offset + arg.argument_offset, | ||
| 4262 | count ? count->buffer : VK_NULL_HANDLE, | ||
| 4263 | count ? count->buffer_offset + arg.count_offset : 0, | ||
| 4264 | static_cast<std::uint32_t>(mesh ? IndirectKind::dispatch_mesh | ||
| 4265 | : indexed ? IndirectKind::draw_indexed | ||
| 4266 | : IndirectKind::draw), | ||
| 4267 | arg.stride, arg.max_count, p.indirect_clamp); | ||
| 4268 | if (clamped) { | ||
| 4269 | // Clamped: p.indirect_clamp names the scratch this draw reads; nothing else to resolve. Its budget | ||
| 4270 | // is the list's (one per command list, shared with the legacy ExecuteIndirect clamps above), and | ||
| 4271 | // the prepared draw carries the clamped arguments too. | ||
| 4272 | p.indirect_clamp.share_list_budget(indirect_list_budget); | ||
| 4273 | prepared_draw.indirect_buffer = p.indirect_clamp.buffer; | ||
| 4274 | prepared_draw.indirect_offset = p.indirect_clamp.offset; | ||
| 4275 | prepared_draw.indirect_count_buffer = p.indirect_clamp.count_buffer; | ||
| 4276 | prepared_draw.indirect_count_offset = p.indirect_clamp.count_offset; | ||
| 4277 | } else if (mesh) { | ||
| 4278 | // Unclamped, a mesh record's y and z are whatever the title left there: not drawn. | ||
| 4279 | indirect_stats::skip(indirect_stats::Event::replay_skip, indirect_stats::mesh); | ||
| 4280 | prepared_draw.skipped = true; | ||
| 4281 | } else if (vk.require_indirect_clamp) { | ||
| 4062 | return unsupported_at(__LINE__); | 4282 | return unsupported_at(__LINE__); |
| 4063 | p.indirect_clamp.share_list_budget(indirect_list_budget); | 4283 | } |
| 4064 | prepared_draw.indirect_buffer = p.indirect_clamp.buffer; | ||
| 4065 | prepared_draw.indirect_offset = p.indirect_clamp.offset; | ||
| 4066 | prepared_draw.indirect_count_buffer = p.indirect_clamp.count_buffer; | ||
| 4067 | prepared_draw.indirect_count_offset = p.indirect_clamp.count_offset; | ||
| 4068 | } | 4284 | } |
| 4069 | } | 4285 | } |
| 4070 | } | 4286 | } |
| @@ -4147,12 +4363,16 @@ public: | |||
| 4147 | query.statistics_end != detail::PreparedQuery::no_segment; | 4363 | query.statistics_end != detail::PreparedQuery::no_segment; |
| 4148 | const std::uint32_t size = query_result_size(resolve.type); | 4364 | const std::uint32_t size = query_result_size(resolve.type); |
| 4149 | const auto offset = list.commands[query.command].binding.buffer_offset + resolve.offset; | 4365 | const auto offset = list.commands[query.command].binding.buffer_offset + resolve.offset; |
| 4366 | // A stream past the pool's maxTransformFeedbackStreams ran nothing (D3D-302): its resolve is zeros. | ||
| 4367 | const std::uint32_t so_stream = | ||
| 4368 | is_so_statistics(resolve.type) ? resolve.type - d3d12_query::so_statistics_stream0 : 0; | ||
| 4369 | const bool so_runs = !is_so_statistics(resolve.type) || so_stream < query.heap->streams; | ||
| 4150 | for (std::uint32_t i = 0; i < resolve.count; ++i) { | 4370 | for (std::uint32_t i = 0; i < resolve.count; ++i) { |
| 4151 | const auto index = resolve.first + i; | 4371 | const auto index = resolve.first + i; |
| 4152 | const auto value = lookup(*query.heap, index); | 4372 | const auto value = lookup(*query.heap, index); |
| 4153 | if (binary && value.ended && !uncounted) return unsupported_at(__LINE__); | 4373 | if (binary && value.ended && !uncounted) return unsupported_at(__LINE__); |
| 4154 | needs_binary |= binary && value.ended; | 4374 | needs_binary |= binary && value.ended; |
| 4155 | detail::QueryResolveRun run{value.ended ? query.heap->pool : VK_NULL_HANDLE, | 4375 | detail::QueryResolveRun run{value.ended && so_runs ? query.heap->pool : VK_NULL_HANDLE, |
| 4156 | index, 1, offset + VkDeviceSize(i) * size}; | 4376 | index, 1, offset + VkDeviceSize(i) * size}; |
| 4157 | if (value.occlusion.segments) { | 4377 | if (value.occlusion.segments) { |
| 4158 | if (resolve.type != d3d12_query::occlusion && !binary && !statistics) | 4378 | if (resolve.type != d3d12_query::occlusion && !binary && !statistics) |
| @@ -4276,17 +4496,34 @@ inline void emit_query(const PreparedList& list, const detail::PreparedQuery& qu | |||
| 4276 | begin_statistics(); | 4496 | begin_statistics(); |
| 4277 | return; | 4497 | return; |
| 4278 | } | 4498 | } |
| 4279 | // A heap without a Vulkan pool (stream-output statistics: the layer has no stream output) runs nothing for | 4499 | // A heap without a Vulkan pool (stream-output statistics on a device without VK_EXT_transform_feedback) runs |
| 4280 | // BeginQuery and EndQuery; its resolves were planned as zero fills. | 4500 | // nothing for BeginQuery and EndQuery; its resolves were planned as zero fills. |
| 4281 | if (!heap.pool && !std::holds_alternative<ResolveQueries>(command)) return; | 4501 | if (!heap.pool && !std::holds_alternative<ResolveQueries>(command)) return; |
| 4502 | // An SO_STATISTICS_STREAMn query begins/ends indexed on that stream (D3D-302): the query type's stream index is | ||
| 4503 | // the `index` argument of vkCmdBeginQueryIndexedEXT / vkCmdEndQueryIndexedEXT. A stream past the pool's | ||
| 4504 | // maxTransformFeedbackStreams runs nothing, like a heap without a pool: its resolves were planned as zero fills. | ||
| 4505 | const auto so_stream = [](std::uint32_t type) -> std::uint32_t { | ||
| 4506 | return is_so_statistics(type) ? type - d3d12_query::so_statistics_stream0 : 0; | ||
| 4507 | }; | ||
| 4508 | const auto so_runs = [&](std::uint32_t type) { | ||
| 4509 | return !is_so_statistics(type) || so_stream(type) < heap.streams; | ||
| 4510 | }; | ||
| 4282 | if (const auto* begin = std::get_if<BeginQuery>(&command)) { | 4511 | if (const auto* begin = std::get_if<BeginQuery>(&command)) { |
| 4512 | if (!so_runs(begin->type)) return; | ||
| 4283 | vk.reset_query_pool(cb, heap.pool, begin->index, 1); | 4513 | vk.reset_query_pool(cb, heap.pool, begin->index, 1); |
| 4284 | const bool precise = begin->type == d3d12_query::occlusion && heap.precise; | 4514 | if (is_so_statistics(begin->type)) { |
| 4285 | vk.begin_query(cb, heap.pool, begin->index, precise ? VK_QUERY_CONTROL_PRECISE_BIT : 0); | 4515 | vk.begin_query_indexed(cb, heap.pool, begin->index, so_stream(begin->type), 0); |
| 4516 | } else { | ||
| 4517 | const bool precise = begin->type == d3d12_query::occlusion && heap.precise; | ||
| 4518 | vk.begin_query(cb, heap.pool, begin->index, precise ? VK_QUERY_CONTROL_PRECISE_BIT : 0); | ||
| 4519 | } | ||
| 4286 | } else if (const auto* end = std::get_if<EndQuery>(&command)) { | 4520 | } else if (const auto* end = std::get_if<EndQuery>(&command)) { |
| 4521 | if (!so_runs(end->type)) return; | ||
| 4287 | if (end->type == d3d12_query::timestamp) { | 4522 | if (end->type == d3d12_query::timestamp) { |
| 4288 | vk.reset_query_pool(cb, heap.pool, end->index, 1); | 4523 | vk.reset_query_pool(cb, heap.pool, end->index, 1); |
| 4289 | vk.write_timestamp(cb, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, heap.pool, end->index); | 4524 | vk.write_timestamp(cb, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, heap.pool, end->index); |
| 4525 | } else if (is_so_statistics(end->type)) { | ||
| 4526 | vk.end_query_indexed(cb, heap.pool, end->index, so_stream(end->type)); | ||
| 4290 | } else { | 4527 | } else { |
| 4291 | vk.end_query(cb, heap.pool, end->index); | 4528 | vk.end_query(cb, heap.pool, end->index); |
| 4292 | } | 4529 | } |
| @@ -4387,13 +4624,8 @@ inline void emit_commands(const PreparedList& prepared, VkCommandBuffer command_ | |||
| 4387 | // draw's own rendering scope begins. The index expansion of an indexed quad list runs here too: outside the | 4624 | // draw's own rendering scope begins. The index expansion of an indexed quad list runs here too: outside the |
| 4388 | // rendering scope, and between the segments so that no query counts its dispatch (D3D-162). It stays inside | 4625 | // rendering scope, and between the segments so that no query counts its dispatch (D3D-162). It stays inside |
| 4389 | // the predicate, which skips it together with its draw. | 4626 | // the predicate, which skips it together with its draw. |
| 4390 | if (p.indirect_clamp.buffer) { | 4627 | if (!p.indirect_clamp.buffer && !p.counted_dispatch.indirect && |
| 4391 | end_statistics(); | 4628 | (raster.state || std::holds_alternative<ExecuteIndirect>(command))) { |
| 4392 | if (predicate.buffer) vk.end_conditional_rendering(command_buffer); | ||
| 4393 | vk.emit_indirect_clamp(command_buffer, p.indirect_clamp); | ||
| 4394 | if (predicate.buffer) vk.begin_conditional_rendering(command_buffer, &predicate); | ||
| 4395 | begin_statistics(); | ||
| 4396 | } else if (!p.counted_dispatch.indirect && (raster.state || std::holds_alternative<ExecuteIndirect>(command))) { | ||
| 4397 | end_statistics(); | 4629 | end_statistics(); |
| 4398 | if (raster.state && prepared.draws[p.draw].quad_indices.buffer) | 4630 | if (raster.state && prepared.draws[p.draw].quad_indices.buffer) |
| 4399 | vk.emit_quad_indices(command_buffer, prepared.draws[p.draw].quad_indices); | 4631 | vk.emit_quad_indices(command_buffer, prepared.draws[p.draw].quad_indices); |
| @@ -4998,17 +5230,64 @@ inline void emit_commands(const PreparedList& prepared, VkCommandBuffer command_ | |||
| 4998 | VK_PIPELINE_STAGE_TRANSFER_BIT); | 5230 | VK_PIPELINE_STAGE_TRANSFER_BIT); |
| 4999 | vk.copy_buffer(command_buffer, p.source.buffer, p.binding.buffer, 1, p.buffer_copies.data()); | 5231 | vk.copy_buffer(command_buffer, p.source.buffer, p.binding.buffer, 1, p.buffer_copies.data()); |
| 5000 | } else if (const auto* ind = std::get_if<ExecuteIndirect>(&command)) { | 5232 | } else if (const auto* ind = std::get_if<ExecuteIndirect>(&command)) { |
| 5001 | if (ind->kind != IndirectKind::dispatch) { | 5233 | if (ind->kind != IndirectKind::dispatch && !vk.external_graphics_scope) { |
| 5002 | indirect_stats::skip(indirect_stats::Event::replay_skip, indirect_stats::stateless); | 5234 | indirect_stats::skip(indirect_stats::Event::replay_skip, indirect_stats::stateless); |
| 5003 | continue; | 5235 | continue; |
| 5004 | } | 5236 | } |
| 5237 | // The clamp pass (vulkan_indirect_clamp.h) runs before anything reads the indirect arguments, and before | ||
| 5238 | // the drawing scope an indirect draw opens around itself. It is a helper dispatch: a pipeline-statistics | ||
| 5239 | // query must not count it, and it runs even under a false predicate (the draw it feeds may be the one | ||
| 5240 | // the predicate discards, and a later command may read the same scratch). | ||
| 5241 | const bool clamped = p.indirect_clamp.buffer != VK_NULL_HANDLE; | ||
| 5242 | if (clamped) { | ||
| 5243 | end_statistics(); | ||
| 5244 | if (predicate.buffer) vk.end_conditional_rendering(command_buffer); | ||
| 5245 | vk.emit_indirect_clamp(command_buffer, p.indirect_clamp); | ||
| 5246 | if (predicate.buffer) vk.begin_conditional_rendering(command_buffer, &predicate); | ||
| 5247 | begin_statistics(); | ||
| 5248 | } | ||
| 5249 | // What the indirect command reads: the clamped scratch, the application's own buffer, or for a counted | ||
| 5250 | // DISPATCH (Vulkan has no vkCmdDispatchIndirectCount, and LEONIDA_INDIRECT_GROUP_BUDGET packs a batch | ||
| 5251 | // without one too) the zero-filled copy the replay made. | ||
| 5252 | const bool counted_dispatch = !clamped && p.counted_dispatch.indirect; | ||
| 5253 | const VkBuffer indirect_buffer = clamped ? p.indirect_clamp.buffer | ||
| 5254 | : counted_dispatch ? p.counted_dispatch.indirect | ||
| 5255 | : p.binding.buffer; | ||
| 5256 | const VkDeviceSize arguments = clamped ? p.indirect_clamp.offset | ||
| 5257 | : counted_dispatch ? p.counted_dispatch.offset | ||
| 5258 | : p.binding.buffer_offset + ind->argument_offset; | ||
| 5259 | const VkBuffer count_buffer = clamped ? p.indirect_clamp.count_buffer : p.source.buffer; | ||
| 5260 | const VkDeviceSize count_offset = clamped ? p.indirect_clamp.count_offset : p.source.buffer_offset + ind->count_offset; | ||
| 5261 | const std::uint32_t records = clamped ? p.indirect_clamp.records : ind->max_count; | ||
| 5262 | const std::uint32_t stride = clamped ? p.indirect_clamp.stride | ||
| 5263 | : counted_dispatch ? std::uint32_t(sizeof(VkDispatchIndirectCommand)) | ||
| 5264 | : ind->stride; | ||
| 5265 | // A legacy graphics indirect draw opens no rendering scope of its own: the caller has one open around the | ||
| 5266 | // replay (the tests do), and the recorded, stateful graphics indirects are Draw commands instead. | ||
| 5267 | if (ind->kind != IndirectKind::dispatch) { | ||
| 5268 | if constexpr (Checkpoints) checkpoints->record(command_buffer, i, CheckpointKind::draw); | ||
| 5269 | if (ind->count_buffer) { | ||
| 5270 | if (ind->kind == IndirectKind::draw) | ||
| 5271 | vk.draw_indirect_count(command_buffer, indirect_buffer, arguments, count_buffer, count_offset, | ||
| 5272 | records, stride); | ||
| 5273 | else | ||
| 5274 | vk.draw_indexed_indirect_count(command_buffer, indirect_buffer, arguments, count_buffer, | ||
| 5275 | count_offset, records, stride); | ||
| 5276 | } else if (ind->kind == IndirectKind::draw) { | ||
| 5277 | vk.draw_indirect(command_buffer, indirect_buffer, arguments, records, stride); | ||
| 5278 | } else { | ||
| 5279 | vk.draw_indexed_indirect(command_buffer, indirect_buffer, arguments, records, stride); | ||
| 5280 | } | ||
| 5281 | continue; | ||
| 5282 | } | ||
| 5005 | if (ind->pipeline && !p.pipeline.pipeline && (p.pipeline.async_build || p.pipeline.skipped)) continue; | 5283 | if (ind->pipeline && !p.pipeline.pipeline && (p.pipeline.async_build || p.pipeline.skipped)) continue; |
| 5006 | if constexpr (Checkpoints) | 5284 | if constexpr (Checkpoints) |
| 5007 | checkpoints->dispatch(command_buffer, i, p.pipeline.pipeline, ind->pipeline, ind->user_data, {}, true, | 5285 | checkpoints->dispatch(command_buffer, i, p.pipeline.pipeline, ind->pipeline, ind->user_data, {}, true, |
| 5008 | ind->argument_buffer, ind->argument_offset, ind->count_buffer, | 5286 | reinterpret_cast<std::uintptr_t>(indirect_buffer), |
| 5009 | ind->count_offset, ind->max_count, ind->stride); | 5287 | clamped || counted_dispatch ? arguments : ind->argument_offset, |
| 5010 | const VkDeviceSize arguments = p.binding.buffer_offset + ind->argument_offset; | 5288 | ind->count_buffer ? reinterpret_cast<std::uintptr_t>(count_buffer) : 0, |
| 5011 | if (p.counted_dispatch.indirect) { | 5289 | clamped ? count_offset : ind->count_offset, records, stride); |
| 5290 | if (counted_dispatch) { | ||
| 5012 | // No D3D12 query must count this internal compute pass as an application dispatch. | 5291 | // No D3D12 query must count this internal compute pass as an application dispatch. |
| 5013 | end_statistics(); | 5292 | end_statistics(); |
| 5014 | vk.emit_counted_dispatch(command_buffer, p.counted_dispatch); | 5293 | vk.emit_counted_dispatch(command_buffer, p.counted_dispatch); |
| @@ -5028,13 +5307,8 @@ inline void emit_commands(const PreparedList& prepared, VkCommandBuffer command_ | |||
| 5028 | vk.push_constants(command_buffer, p.pipeline.layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(data), | 5307 | vk.push_constants(command_buffer, p.pipeline.layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(data), |
| 5029 | &data); | 5308 | &data); |
| 5030 | } | 5309 | } |
| 5031 | for (std::uint32_t k = 0; k < ind->max_count; ++k) { | 5310 | for (std::uint32_t k = 0; k < records; ++k) { |
| 5032 | vk.dispatch_indirect(command_buffer, | 5311 | vk.dispatch_indirect(command_buffer, indirect_buffer, arguments + VkDeviceSize(k) * stride); |
| 5033 | p.indirect_clamp.buffer ? p.indirect_clamp.buffer : | ||
| 5034 | p.counted_dispatch.indirect ? p.counted_dispatch.indirect : p.binding.buffer, | ||
| 5035 | (p.indirect_clamp.buffer ? p.indirect_clamp.offset + VkDeviceSize(k) * p.indirect_clamp.stride | ||
| 5036 | : p.counted_dispatch.indirect ? p.counted_dispatch.offset + VkDeviceSize(k) * 12 | ||
| 5037 | : arguments + VkDeviceSize(k) * ind->stride)); | ||
| 5038 | } | 5312 | } |
| 5039 | } else if (const auto* xdxr_build = std::get_if<BuildAccelerationStructure>(&command); | 5313 | } else if (const auto* xdxr_build = std::get_if<BuildAccelerationStructure>(&command); |
| 5040 | xdxr_build && vk.xdxr_record) { | 5314 | xdxr_build && vk.xdxr_record) { |
| @@ -5156,6 +5430,16 @@ inline void emit_commands(const PreparedList& prepared, VkCommandBuffer command_ | |||
| 5156 | const Draw* draw = raster.state; | 5430 | const Draw* draw = raster.state; |
| 5157 | const detail::PreparedDraw& d = prepared.draws[p.draw]; | 5431 | const detail::PreparedDraw& d = prepared.draws[p.draw]; |
| 5158 | if (d.skipped) continue; // could not be resolved in prepare: dropped | 5432 | if (d.skipped) continue; // could not be resolved in prepare: dropped |
| 5433 | // The clamp pass for a stateful indirect draw (vulkan_indirect_clamp.h) runs before vkCmdBeginRendering, | ||
| 5434 | // because its copy and transfer barrier are not allowed inside a dynamic-rendering scope. It is a helper | ||
| 5435 | // dispatch, so a pipeline-statistics query must not count it, and it runs even under a false predicate. | ||
| 5436 | if (p.indirect_clamp.buffer != VK_NULL_HANDLE) { | ||
| 5437 | end_statistics(); | ||
| 5438 | if (predicate.buffer) vk.end_conditional_rendering(command_buffer); | ||
| 5439 | vk.emit_indirect_clamp(command_buffer, p.indirect_clamp); | ||
| 5440 | if (predicate.buffer) vk.begin_conditional_rendering(command_buffer, &predicate); | ||
| 5441 | begin_statistics(); | ||
| 5442 | } | ||
| 5159 | if constexpr (Checkpoints) | 5443 | if constexpr (Checkpoints) |
| 5160 | checkpoints->record(command_buffer, i, CheckpointKind::draw, | 5444 | checkpoints->record(command_buffer, i, CheckpointKind::draw, |
| 5161 | d.pipeline, draw->pipeline); | 5445 | d.pipeline, draw->pipeline); |
| @@ -5265,6 +5549,12 @@ inline void emit_commands(const PreparedList& prepared, VkCommandBuffer command_ | |||
| 5265 | vk.set_stencil_reference(command_buffer, VK_STENCIL_FACE_FRONT_BIT, draw->stencil_front); | 5549 | vk.set_stencil_reference(command_buffer, VK_STENCIL_FACE_FRONT_BIT, draw->stencil_front); |
| 5266 | vk.set_stencil_reference(command_buffer, VK_STENCIL_FACE_BACK_BIT, draw->stencil_back); | 5550 | vk.set_stencil_reference(command_buffer, VK_STENCIL_FACE_BACK_BIT, draw->stencil_back); |
| 5267 | vk.set_blend_constants(command_buffer, draw->blend_factor.data()); | 5551 | vk.set_blend_constants(command_buffer, draw->blend_factor.data()); |
| 5552 | if (graphics.depth_bounds) { | ||
| 5553 | // Vulkan takes bounds in [0, 1] only (without VK_EXT_depth_range_unrestricted), as D3D12 does. | ||
| 5554 | const float lo = std::clamp(draw->depth_bounds[0], 0.0f, 1.0f); | ||
| 5555 | const float hi = std::clamp(draw->depth_bounds[1], 0.0f, 1.0f); | ||
| 5556 | vk.set_depth_bounds(command_buffer, lo, hi); | ||
| 5557 | } | ||
| 5268 | for (std::uint32_t slot = 0; slot < d.vertex_buffers.size(); ++slot) { | 5558 | for (std::uint32_t slot = 0; slot < d.vertex_buffers.size(); ++slot) { |
| 5269 | if (!d.vertex_buffers[slot]) continue; | 5559 | if (!d.vertex_buffers[slot]) continue; |
| 5270 | vk.bind_vertex_buffers2(command_buffer, slot, 1, &d.vertex_buffers[slot], &d.vertex_offsets[slot], | 5560 | vk.bind_vertex_buffers2(command_buffer, slot, 1, &d.vertex_buffers[slot], &d.vertex_offsets[slot], |
| @@ -5279,14 +5569,29 @@ inline void emit_commands(const PreparedList& prepared, VkCommandBuffer command_ | |||
| 5279 | const VkDeviceSize bytes = draw->index.size - draw->index.size % width; | 5569 | const VkDeviceSize bytes = draw->index.size - draw->index.size % width; |
| 5280 | vk.bind_robust_index_view(command_buffer, d.index_buffer, d.index_offset, bytes, d.index_type); | 5570 | vk.bind_robust_index_view(command_buffer, d.index_buffer, d.index_offset, bytes, d.index_type); |
| 5281 | } | 5571 | } |
| 5282 | const auto stride = p.indirect_clamp.buffer ? p.indirect_clamp.stride : arg.stride; | 5572 | // What the draw reads: the clamp pass's scratch (and its clamped count) when it ran, else the |
| 5283 | if (arg.count_buffer) { | 5573 | // application's own buffer. Its records and stride are the clamp's then, not the signature's. |
| 5574 | const bool clamped = p.indirect_clamp.buffer != VK_NULL_HANDLE; | ||
| 5575 | const VkBuffer arguments_buffer = clamped ? p.indirect_clamp.buffer : d.indirect_buffer; | ||
| 5576 | const VkDeviceSize arguments_offset = clamped ? p.indirect_clamp.offset : d.indirect_offset; | ||
| 5577 | const VkBuffer count_buffer = clamped ? p.indirect_clamp.count_buffer : d.indirect_count_buffer; | ||
| 5578 | const VkDeviceSize count_offset = clamped ? p.indirect_clamp.count_offset : d.indirect_count_offset; | ||
| 5579 | const std::uint32_t records = clamped ? p.indirect_clamp.records : arg.max_count; | ||
| 5580 | const std::uint32_t stride = clamped ? p.indirect_clamp.stride : arg.stride; | ||
| 5581 | if (draw->mesh) { | ||
| 5582 | if (arg.count_buffer) | ||
| 5583 | vk.draw_mesh_tasks_indirect_count(command_buffer, arguments_buffer, arguments_offset, count_buffer, | ||
| 5584 | count_offset, records, stride); | ||
| 5585 | else | ||
| 5586 | vk.draw_mesh_tasks_indirect(command_buffer, arguments_buffer, arguments_offset, records, stride); | ||
| 5587 | if (vk.mesh_draw_count) ++*vk.mesh_draw_count; | ||
| 5588 | } else if (arg.count_buffer) { | ||
| 5284 | const auto emit_counted = draw->indexed ? vk.draw_indexed_indirect_count : vk.draw_indirect_count; | 5589 | const auto emit_counted = draw->indexed ? vk.draw_indexed_indirect_count : vk.draw_indirect_count; |
| 5285 | emit_counted(command_buffer, d.indirect_buffer, d.indirect_offset, d.indirect_count_buffer, | 5590 | emit_counted(command_buffer, arguments_buffer, arguments_offset, count_buffer, count_offset, |
| 5286 | d.indirect_count_offset, arg.max_count, stride); | 5591 | records, stride); |
| 5287 | } else { | 5592 | } else { |
| 5288 | const auto emit_fixed = draw->indexed ? vk.draw_indexed_indirect : vk.draw_indirect; | 5593 | const auto emit_fixed = draw->indexed ? vk.draw_indexed_indirect : vk.draw_indirect; |
| 5289 | emit_fixed(command_buffer, d.indirect_buffer, d.indirect_offset, arg.max_count, stride); | 5594 | emit_fixed(command_buffer, arguments_buffer, arguments_offset, records, stride); |
| 5290 | } | 5595 | } |
| 5291 | } else if (draw->mesh) { | 5596 | } else if (draw->mesh) { |
| 5292 | vk.draw_mesh_tasks(command_buffer, draw->count, draw->instances, draw->first); | 5597 | vk.draw_mesh_tasks(command_buffer, draw->count, draw->instances, draw->first); |