mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 23:08:36 +00:00
The re-adjusted Inkling-2-Mini-SQ-20 and Vision files have their section table at 0x20 (a u16 tile_layout_id at 0x10), sections 16 KiB aligned and Section 3 padded to 16 KiB. Every reader of 0.2.22 reads the table at 0x10, so it sees six empty sections and an empty manifest: StrataFileReader::open succeeds and the loader fails later with "manifest parse error: JSON: unexpected char", with a Vision file refused as profile 2. strata_layout.hpp (new, header only) is the one place that tells the layouts apart: both section tables are checked (section_id equals the index, 4 KiB / 16 KiB alignment, inside the file, no overlap) and a header that is neither, or both, is refused with a message that says why. A u64 below 4096 at 0x10 is not used for the decision. Section 3 of the 16 KiB layout takes its entry count from the manifest (top-level num_physical_layers x num_experts_per_layer, found by walking the JSON, with each factor capped so the arithmetic cannot wrap), so a padded length that happens to be a multiple of 34 is not miscounted, and a nested key or a chat template that spells the key is not taken for it. Callers: StrataFileReader (CUDA, HIP, CPU Inkling, Hy4 CUDA/HIP/SYCL/CPU), the no-zstd Mac reader, the Metal and SYCL Inkling loaders (header, Section 3 count), the Metal and SYCL vision loaders, the Hy4 CPU expert directory. The Inkling Vision shard is recognised by header profile 3 or by arch inkling2_vision in the manifest (the new file has profile 2). Test: engine/tests/quant/strata_reader_layout_test.cpp (CMake: strata_reader_layout_test), with the real 0.2.22 headers of SQ-20, SQ-10 and Vision as golden frames.