okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
b1abdcf9b
main
1// stream_floor_default (include/strata/prefill/stream_floor_rule.hpp): the chunk size from which a prompt chunk takes the long-prompt path. 2// Only the measured class (Windows gfx1151) with a layer set that is fused-only on every layer AND without the staged fused entry leaves the 1,024 default. No GPU, no model. 3#include <cstdio> 4 5#include "strata/prefill/stream_floor_rule.hpp" 6 7using strata::prefill::kFusedOnlyFloor ; 8using strata::prefill::kStreamFloorDefault ; 9using strata::prefill::kTrellisCudaFloor ; 10using strata::prefill::stream_floor_default ; 11 12static int failed = 0 ; 13#define CHECK (x ) do { if (!(x)) { std::fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #x); ++failed; } } while (0) 14 15int main () { 16 static_assert(kStreamFloorDefault == 1024 ,"the default floor is the discrete cards' measured 1,024" ); 17 static_assert(kFusedOnlyFloor >=1 && kFusedOnlyFloor < kStreamFloorDefault ,"the fused-only floor is below the default" ); 18// the staged fused entry off (STRATA_PF_STAGED_FO=0, or its prerequisites missing): step one's rule 19CHECK (stream_floor_default (true, true, false)== kFusedOnlyFloor );// Windows gfx1151, every layer fused-only 20CHECK (stream_floor_default (true, false, false)== kStreamFloorDefault );// a layer on MMQ or the FP16 path: unchanged 21CHECK (stream_floor_default (false, true, false)== kStreamFloorDefault );// another card class (not measured): unchanged 22CHECK (stream_floor_default (false, false, false)== kStreamFloorDefault ); 23// the entry on: pieces below 1,024 tokens take it, the long path from 1,024 up, on every class 24CHECK (stream_floor_default (true, true, true)== kStreamFloorDefault ); 25CHECK (stream_floor_default (true, false, true)== kStreamFloorDefault ); 26CHECK (stream_floor_default (false, true, true)== kStreamFloorDefault );// STRATA_PF_STAGED_FO=1 on another class: the floor stays 27CHECK (stream_floor_default (false, false, true)== kStreamFloorDefault ); 28// a build without MMQ with a non-native pack on the fused kernels (the Q2_0 pack): no staged entry or int8 path reads its layout, so the floor is 64 on every class, whatever the other flags 29CHECK (stream_floor_default (false, false, false, true)== kFusedOnlyFloor ); 30CHECK (stream_floor_default (true, true, true, true)== kFusedOnlyFloor ); 31CHECK (stream_floor_default (false, true, true, true)== kFusedOnlyFloor ); 32// a build with MMQ, or a pack that is not plain-and-fused, passes false: the rows above are unchanged 33CHECK (stream_floor_default (false, false, false, false)== kStreamFloorDefault ); 34CHECK (stream_floor_default (true, true, true, false)== kStreamFloorDefault ); 35// a build without MMQ on a gfx12 card with a native pack of trellis pairs on the fused kernels (Gyro-S on the R9700): the floor is 64 whatever the staged entry and the class say 36CHECK (stream_floor_default (false, false, true, false, true)== kFusedOnlyFloor ); 37CHECK (stream_floor_default (false, false, false, false, true)== kFusedOnlyFloor ); 38CHECK (stream_floor_default (true, true, true, false, true)== kFusedOnlyFloor ); 39// a build without MMQ on a CUDA card on which the fused trellis kernels run (Gyro-S on an RTX A6000, sm_86 with 84 SMs): the floor is kTrellisCudaFloor whatever the class and the staged entry say 40CHECK (stream_floor_default (false, false, false, false, false, true)== kTrellisCudaFloor ); 41CHECK (stream_floor_default (false, false, true, false, false, true)== kTrellisCudaFloor ); 42CHECK (stream_floor_default (true, true, true, false, false, true)== kTrellisCudaFloor ); 43CHECK (kTrellisCudaFloor >=1 && kTrellisCudaFloor <=kStreamFloorDefault ); 44// the gfx12 rows stay as gated: the CUDA flag adds nothing to them (the two flags are never both true in one build) 45CHECK (stream_floor_default (false, false, false, false, true, false)== kFusedOnlyFloor ); 46CHECK (stream_floor_default (false, false, false, false, true, true)== kFusedOnlyFloor ); 47// no CUDA flag (a build with MMQ, a card whose trellis kernels are off, another format set): every row above stands 48CHECK (stream_floor_default (false, false, true, false, false, false)== kStreamFloorDefault ); 49CHECK (stream_floor_default (true, false, false, false, false, false)== kStreamFloorDefault ); 50// without the flag (a build with MMQ, another card, another format set) the rows above stand 51CHECK (stream_floor_default (false, false, true, false, false)== kStreamFloorDefault ); 52CHECK (stream_floor_default (false, true, true, false, false)== kStreamFloorDefault ); 53// Windows gfx1151, an all-trellis set on the fused kernels (STRATA_PF_TQ_G1151 on, a build without MMQ): the gfx12 floor, with the staged entry on or off 54CHECK (stream_floor_default (true, true, true, false, false, false, true)== kFusedOnlyFloor ); 55CHECK (stream_floor_default (true, true, false, false, false, false, true)== kFusedOnlyFloor ); 56// the same class and set with the flag false (switch off, Linux, a build with MMQ, another format set): the rows above stand 57CHECK (stream_floor_default (true, true, true, false, false, false, false)== kStreamFloorDefault ); 58CHECK (stream_floor_default (true, false, false, false, false, false, false)== kStreamFloorDefault ); 59CHECK (stream_floor_default (false, false, false, false, false, false, false)== kStreamFloorDefault ); 60// the gfx12 and CUDA rows are not changed by the new flag's default 61CHECK (stream_floor_default (false, false, false, false, true, false, false)== kFusedOnlyFloor ); 62CHECK (stream_floor_default (false, false, false, false, false, true, false)== kTrellisCudaFloor ); 63if (failed ) { 64 std::fprintf (stderr ,"stream_floor_rule_test: %d check(s) failed\n" ,failed ); 65return 1 ; 66 } 67 std::printf ("stream_floor_rule_test: OK\n" ); 68return 0 ; 69}