okami.mom/strata

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

Niko1221Merge branch 'f-021-iD' into f-021-int83027df58

main
1.6 KiB31 linesraw
1// warm_policy_test: when the HIP start-up warm-up of hipBLAS may run (include/strata/prefill/warm_policy.hpp). Pure.
2#include "strata/prefill/warm_policy.hpp"
3
4#include <cstdio>
5
6using strata::prefill::warm_gemm_wanted;
7
8static int g_fail = 0;
9static void expect(bool ok, const char* what) {
10    if (!ok) {
11        ++g_fail;
12        std::fprintf(stderr, "FAIL: %s\n", what);
13    }
14}
15
16int main() {
17    expect(warm_gemm_wanted({}, nullptr), "no device list: the warm-up runs");
18    expect(warm_gemm_wanted({"gfx1201"}, nullptr), "one R9700: on");
19    expect(warm_gemm_wanted({"gfx1201", "gfx1201"}, nullptr), "2x R9700 (same architecture): on (021-iD: no loss)");
20    expect(warm_gemm_wanted({"gfx1201:sramecc+:xnack-", "gfx1201"}, nullptr), "feature suffixes do not make a mixed pair");
21    expect(!warm_gemm_wanted({"gfx1151", "gfx1201"}, nullptr), "8060S + R9700 (#3204): off");
22    expect(!warm_gemm_wanted({"gfx1201", "gfx1151"}, nullptr), "the order does not matter");
23    expect(!warm_gemm_wanted({"gfx1100", "gfx1100", "gfx1030"}, nullptr), "any second architecture turns it off");
24    expect(!warm_gemm_wanted({"gfx1201"}, "0"), "STRATA_PREFILL_WARM=0: off");
25    expect(!warm_gemm_wanted({"gfx1201", "gfx1201"}, "0"), "STRATA_PREFILL_WARM=0 on two cards: off");
26    expect(warm_gemm_wanted({"gfx1151", "gfx1201"}, "1"), "STRATA_PREFILL_WARM=1 forces it on a mixed pair");
27    expect(!warm_gemm_wanted({"gfx1151", "gfx1201"}, ""), "an empty value is unset: a mixed pair stays off");
28    if (g_fail) { std::fprintf(stderr, "warm_policy_test: %d failure(s)\n", g_fail); return 1; }
29    std::printf("warm_policy_test: OK\n");
30    return 0;
31}