omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tests / runtime / rx_sp_workloads.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * rx_sp_workloads.h -- representative AIEN cognitive operations for the |
| 19 | * state projection gate. |
| 20 | * |
| 21 | * Each task builds a Cortex history with a planted answer: the generator |
| 22 | * decides the cause, the verdict or the choice first and writes the history |
| 23 | * so that it is true. The consumer (sp_reason) is then scored against the |
| 24 | * planted answer, never against itself. |
| 25 | * |
| 26 | * The consumer is an explicit rule-based reasoner in the style of R11's |
| 27 | * statistical AIEN. It is not a neural model. It reads whatever view it is |
| 28 | * given, the whole store or a projection, with the same code, and filters |
| 29 | * for relevance itself, so it pays for every object it is handed. |
| 30 | */ |
| 31 | #ifndef RX_SP_WORKLOADS_H |
| 32 | #define RX_SP_WORKLOADS_H |
| 33 | |
| 34 | #include "runtime/rx_cortex.h" |
| 35 | #include "runtime/rx_projection.h" |
| 36 | |
| 37 | #include <stdint.h> |
| 38 | |
| 39 | /* Cortex kinds used by the workloads (unique across classes). */ |
| 40 | enum { |
| 41 | K_GENERATION = 1, K_GOAL, K_TELEMETRY, K_RESOURCE, K_REALIZATION, K_VERIFY, K_COMMIT, |
| 42 | K_EFFECT, K_AUTHORITY, K_REGRESSION, K_HYPOTHESIS, K_COST_CLAIM, K_PLAN, K_DEPENDS |
| 43 | }; |
| 44 | |
| 45 | enum { W_EXPLAIN = 0, W_VERIFY, W_PLAN, W_BRANCH, W_ASSESS, W_COUNT }; |
| 46 | |
| 47 | /* W_EXPLAIN causes, in the reasoner's order of precedence. */ |
| 48 | enum { CAUSE_RESOURCE = 1, CAUSE_DEPENDENCY, CAUSE_RECURRENCE, CAUSE_DRIFT }; |
| 49 | enum { V_SUPPORTED = 1, V_REFUTED, V_UNVERIFIABLE }; |
| 50 | enum { G_MET = 1, G_UNMET, G_UNCERTAIN }; |
| 51 | |
| 52 | typedef struct { uint64_t a[6]; } SpAnswer; |
| 53 | |
| 54 | typedef struct { |
| 55 | uint32_t subjects; /* subsystems, excluding the machine (subject 0) */ |
| 56 | uint64_t t_end; /* "now" */ |
| 57 | } SpScale; |
| 58 | |
| 59 | #define SP_MAX_NEEDED 512u |
| 60 | |
| 61 | typedef struct { |
| 62 | uint32_t workload, seed; |
| 63 | uint64_t subject, focus, t_now, t0; |
| 64 | uint32_t branch; |
| 65 | SpAnswer truth; |
| 66 | uint64_t needed[SP_MAX_NEEDED]; /* objects the planted answer rests on */ |
| 67 | uint32_t n_needed; |
| 68 | uint64_t deps[2]; |
| 69 | } SpTask; |
| 70 | |
| 71 | typedef struct { |
| 72 | uint64_t touched; /* items the reasoner iterated over */ |
| 73 | uint64_t words; /* payload words it read */ |
| 74 | uint8_t *used; /* per view item: entered a decision */ |
| 75 | } SpTrace; |
| 76 | |
| 77 | extern const char *const sp_workload_names[W_COUNT]; |
| 78 | |
| 79 | int sp_build(CxStore *s, uint32_t workload, uint32_t seed, const SpScale *sc, SpTask *t); |
| 80 | void sp_need(const SpTask *t, CognitiveNeed *n); |
| 81 | void sp_reason(const SpTask *t, const PjView *v, SpAnswer *out, SpTrace *tr); |
| 82 | |
| 83 | #endif /* RX_SP_WORKLOADS_H */ |