okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
fd19246dc
main
1// src/kernels/latent_source_check.cpp - FileExpertSource/ExpertLayout on the 48-layer latent A pack. 2#include "strata/core/expert_source.hpp" 3#include "strata/kernels/cpu/expert_layout.hpp" 4 5#include <cstdio> 6#include <cstring> 7#include <fstream> 8#include <string> 9#include <vector> 10 11int main (int argc ,char ** argv ) { 12if (argc < 2 ) { std::fprintf (stderr ,"usage: %s <latent_a_pack> [layer0_native.bin]\n" ,argv [0 ]);return 2 ; } 13 std::string err ; 14if (!strata::kernels::cpu::expert_layout_load (argv [1 ],48 ,512 ,err )) { 15 std::fprintf (stderr ,"layout: %s\n" ,err .c_str ());return 1 ; 16 } 17 strata::core::FileExpertSource src ; 18if (!src .open (argv [1 ],48 ,512 ,err )) { 19 std::fprintf (stderr ,"source: %s\n" ,err .c_str ());return 1 ; 20 } 21const auto & L = strata::kernels::cpu::expert_layout (); 22 std::printf ("mapped=%d blobs=%lld max_blob=%llu\n" , (int )src .mapped (), (long long )src .blobs (), 23 (unsigned long long )L .max_blob ); 24int bad = 0 ; 25for (int64_t l : {0LL ,1LL ,23LL ,47LL }) { 26for (int e : {0 ,1 ,256 ,511 }) { 27const uint8_t * p = src .blob (l ,e ); 28if (!p ) { std::printf ("null layer %lld expert %d\n" , (long long )l ,e );++ bad ;continue ; } 29 (void )p ; 30 } 31 } 32if (argc > 2 ) { 33 std::ifstream f (argv [2 ], std::ios::binary ); 34 std::vector < uint8_t > want (L .blob_bytes (0 )); 35f .seekg ((std::streamoff )256 * L .blob_bytes (0 )); 36f .read ((char * )want .data (), (std::streamsize )want .size ()); 37const uint8_t * p = src .blob (0 ,256 ); 38const bool same = p && std::memcmp (p ,want .data (),want .size ())== 0 ; 39 std::printf ("layer0 expert256 byte-equal to single-layer pack: %s\n" ,same ?"yes" :"NO" ); 40bad += same ?0 :1 ; 41 } 42 std::printf ("RESULT: %s\n" ,bad == 0 ?"ok" :"BAD" ); 43return bad == 0 ?0 :1 ; 44}