okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
a134650e2
main
1// sycl/src/core/verify_refusal_test.cpp - a start the verifier refuses (no VRAM expert tier: --batch slot sessions and the MTP layer left the expert cache no room on an 8 GB 2// card) ends with the refusal text and a clean exit. Two verifiers whose init stops at the check never made queues of their own and hold the process's default queue; their 3// destructors used to destroy it (twice), and the second wait died in urQueueFinish (SIGSEGV on the Arc A750 at the end of `--serve --batch 2 --mtp`). After both are gone the 4// default queue must still run work. 5// verify_refusal_test (needs one SYCL GPU) 6#define DPCT_PROFILING_ENABLED 7#include <sycl/sycl.hpp> 8#include <dpct/dpct.hpp> 9#include "strata/core/verify.hpp" 10 11#include <cstdio> 12#include <string> 13 14static int g_fail = 0 ; 15static void check (bool ok ,const char * what ) { std::printf (" %-100s %s\n" ,what ,ok ?"ok" :"FAIL" );if (!ok )++ g_fail ; } 16 17int main () { 18using namespace strata::core ; 19 sycl::queue * q = & dpct::get_in_order_queue (); 20 std::printf ("device: %s\n" ,q -> get_device ().get_info < sycl::info::device::name > ().c_str ()); 21 { 22WeightTable wt ; 23ModelGeometry g ; 24SessionState ss ; 25VerifyHits hits ;// no cache: d_res, cache_base null 26Verifier a ,b ; 27 std::string ea ,eb ; 28const bool oka = a .init (wt ,g ,ss ,hits ,nullptr ,4 ,ea ); 29const bool okb = b .init (wt ,g ,ss ,hits ,nullptr ,4 ,eb ); 30check (!oka && ea .rfind ("verify: needs the profile-filled VRAM expert tier" ,0 )== 0 ,"first verifier: init refuses, with the expert-tier text" ); 31check (!okb && eb .rfind ("verify: needs the profile-filled VRAM expert tier" ,0 )== 0 ,"second verifier: init refuses, with the expert-tier text" ); 32 }// both destructed here 33float * p = sycl::malloc_device < float > (64 ,* q ); 34q -> fill (p ,2.0f ,64 ).wait (); 35float h [64 ]= {}; 36q -> memcpy (h ,p ,sizeof (h )).wait (); 37 sycl::free (p ,* q ); 38check (h [0 ]== 2.0f && h [63 ]== 2.0f ,"the process's default queue still runs after both destructors" ); 39 std::printf ("%s\n" ,g_fail ?"VERIFY-REFUSAL: FAIL" :"VERIFY-REFUSAL: ok" ); 40return g_fail ?1 :0 ; 41}