okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
a8a51b280
main
1#pragma once 2#include <cstdlib> 3#include <cstddef> 4#include <cstdint> 5#include <stdexcept> 6namespace strata::kernels { 7inline bool b60_layout_requested (){static const bool on = [] {const char * p = std::getenv ("STRATA_PRIVATE_B60_DECODE_LAYOUT" );return p && p [0 ]== '1' ;}();return on ;} 8inline bool b60_single_actor_requested (){static const bool on = [] {const char * p = std::getenv ("STRATA_PRIVATE_BMG_SINGLE_ACTOR" );return p && p [0 ]== '1' ;}();return on ;} 9inline bool b60_gr_q8_requested (){static const bool on = [] {const char * p = std::getenv ("STRATA_PRIVATE_GR_Q8_UP32" );return p && p [0 ]== '1' ;}();return on && b60_layout_requested ();} 10bool b60_weights_packed (); 11void b60_set_weights_packed (bool ); 12bool b60_main_actor (); 13void b60_set_main_actor (bool ); 14struct B60MainActorScope { 15bool previous ; 16B60MainActorScope ():previous (b60_main_actor ()){ 17if (b60_layout_requested ()&& !b60_weights_packed ())throw std::logic_error ("B60 main graph recorded while weights are raw" ); 18b60_set_main_actor (previous || b60_layout_requested ()|| b60_single_actor_requested ()); 19 } 20 ~B60MainActorScope (){b60_set_main_actor (previous );} 21}; 22void b60_single_staging_open (int ,size_t ,void * ); 23void b60_single_staging_bind (const void * ,size_t ); 24void b60_single_staging_close (); 25void b60_stage_single_experts (unsigned long long * ,const int32_t * ,int ,int ,size_t ,size_t ,size_t ,void * ); 26// Exchange a packed resident blob with a raw pinned mirror without changing either layout contract. 27void b60_exchange_single_expert (uint8_t * ,uint8_t * ,int ,size_t ,size_t ,size_t ,void * ); 28void b60_weight_permute_many (void * const * ,int ,int ,int ,int ,bool ,void * ); 29}