skip to content
==> include/mesh/abi/view_infer.h <==
1/* @ajax/mesh-abi-view-infer: programs/infer's view: the trained cubic on a grid.
2 *
3 * Part of alpha-c-mesh, a C port of alpha-rust-mesh (README.md says from where). */
4#ifndef MESH_ABI_VIEW_INFER_H
5#define MESH_ABI_VIEW_INFER_H
6
7#include <stdbool.h>
8#include <stddef.h>
9#include <stdint.h>
10
11/* programs/infer: the trained cubic over a 64-point grid, reading train's
12 * view through `Ctx::peer_view` (manifest `reads = ["train"]`). */
13#define MESH_INFER_I_PARAMS 0x00u /* f32 x 4: the params the last run used */
14#define MESH_INFER_I_RUNS 0x10u /* u32 runs that found train */
15#define MESH_INFER_I_TRAIN_STEP 0x14u /* u32 train's T_NEXT_STEP at the last run */
16#define MESH_INFER_I_X 0x100u /* f32 x POINTS: -1 + 2 i / (POINTS - 1) (OP_INIT) */
17#define MESH_INFER_I_Y 0x300u /* f32 x POINTS */
18#define MESH_INFER_POINTS 64u
19#define MESH_INFER_VIEW_BYTES 0x1000u
20/* op 3: probe `peer_view(arg)`: the view's length, or R_NO_VIEW (an
21 * undeclared slot also records FAULT_PEER_VIEW: a test hook for `reads`). */
22#define MESH_INFER_OP_PROBE_READ 3u
23#define MESH_INFER_R_NO_VIEW 0xfffffffeu
24/* Task result when train is not loaded (no run). */
25#define MESH_INFER_R_NO_TRAIN 0u
26
27/* The Rust const asserts that only involve this package. */
28_Static_assert(MESH_INFER_I_Y + 4 * MESH_INFER_POINTS <= MESH_INFER_VIEW_BYTES, "infer::I_Y + 4 * infer::POINTS <= infer::VIEW_BYTES");
29_Static_assert(MESH_INFER_I_X + 4 * MESH_INFER_POINTS <= MESH_INFER_I_Y, "infer::I_X + 4 * infer::POINTS <= infer::I_Y");
30
31#endif