==> src/gemm.h <==1/* gemm's init and task (src/main.c runs them as a native worker). */
2#ifndef GEMM_H
3#define GEMM_H
4#include "mesh/worker_ctx.h"
5#include <stddef.h>
6#define GEMM_MAGIC 0x4d4d4547u /* "GEMM" */
7#define GEMM_V_SIZE 0x04u
8#define GEMM_V_N 0x08u
9#define GEMM_V_US 0x0cu
10#define GEMM_V_GFLOPS 0x10u
11#define GEMM_V_BEST 0x14u
12#define GEMM_V_PLAIN 0x18u
13#define GEMM_V_SINGLE 0x1cu
14#define GEMM_V_IMPL 0x20u
15#define GEMM_V_THREADS 0x24u
16#define GEMM_V_RUNS 0x28u
17#define GEMM_V_C 0x1000u
18#define GEMM_CHECK_MAX 64u
19#define GEMM_N_MAX 8192u
20#define GEMM_OP_CHECK 3u
21#define GEMM_OP_PLAIN 4u
22#define GEMM_OP_SINGLE 5u
23#define GEMM_OP_THREADS 6u
24/* The size the job items (OP_JOB) multiply. */
25#define GEMM_OP_SIZE 7u
26/* The job items' records (manifest job_out): n u32, GFLOP/s f32, at V_JOB_OUT + 8 (ticket % 64). */
27#define GEMM_V_JOB_OUT 0x6000u
28/* 2: the blocked C GEMM (1, Accelerate, is the Rust's macOS path: not ported). */
29#define GEMM_IMPL 2u
30void gemm_init(const mesh_worker_ctx *ctx, void *user);
31uint32_t gemm_task(const mesh_worker_ctx *ctx, uint32_t op, uint32_t arg, void *user);
32/* C = A B (n x n, row-major) with the blocked kernel over `threads()` threads (single: one). */
33void gemm_fast(size_t n, const float *a, const float *b, float *c, bool single);
34/* The plain loop: what a straightforward C GEMM does on one core (i, j, k; no blocking). */
35void gemm_plain(size_t n, const float *a, const float *b, float *c);
36size_t gemm_threads(void);
37#endif