okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221rc1 merge df2-sycl Arc start-crash fix (ab7baa5b1)a134650e2

main
2.1 KiB41 linesraw
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() {
18    using 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    {
22        WeightTable wt;
23        ModelGeometry g;
24        SessionState ss;
25        VerifyHits hits;   // no cache: d_res, cache_base null
26        Verifier a, b;
27        std::string ea, eb;
28        const bool oka = a.init(wt, g, ss, hits, nullptr, 4, ea);
29        const bool okb = b.init(wt, g, ss, hits, nullptr, 4, eb);
30        check(!oka && ea.rfind("verify: needs the profile-filled VRAM expert tier", 0) == 0, "first verifier: init refuses, with the expert-tier text");
31        check(!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
33    float* p = sycl::malloc_device<float>(64, *q);
34    q->fill(p, 2.0f, 64).wait();
35    float h[64] = {};
36    q->memcpy(h, p, sizeof(h)).wait();
37    sycl::free(p, *q);
38    check(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");
40    return g_fail ? 1 : 0;
41}