interplane.Get Omega
Read in your language

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

GitHub aien-dev/omega-mv#185 (code only)

closed derived 849e036a6d5be546 #185

Imported from GitHub aien-dev/omega-mv#185 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base d48ab89e571961dec337ee8bc9c26f5027a5a287 · Head 73f68855585fef3ce24fe0046ad6ae26ac12e887

Apply it

git checkout -b patch-849e036a6d5be546 d48ab89e571961dec337ee8bc9c26f5027a5a287
curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/849e036a6d5be546.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/omega-mv
185
73f68855585fef3ce24fe0046ad6ae26ac12e887
{"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":185,"url":"https://github.com/aien-dev/omega-mv/pull/185","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:41Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/docs/tensor/M20_OMEGA_TENSOR.md b/docs/tensor/M20_OMEGA_TENSOR.md
index 49d70cea0..2305c4706 100644
--- a/docs/tensor/M20_OMEGA_TENSOR.md
+++ b/docs/tensor/M20_OMEGA_TENSOR.md
@@ -106,9 +106,12 @@ removed. Order and padding mutations are caught by the E1 WP-D suite.
 | CPU parity | PASS (CPU) | every op bit-exact vs independent reference (omega_ref_*, omega_ieee_div/sqrt, omega_ref_ffma_int, own tree copy), random + all special pairs |
 | Transcendental unary ops (EXP2, LOG2, SIGMOID, TANH) | PASS (CPU) | Host PASS, CPU tier: forge log `HIVE-M20-transc-175026` (`test-tensor` + `test-tensor-mutations`, 7/7 mutants caught). Bounded contract, NOT correctly rounded (max ulp EXP2 2, LOG2 2, SIGMOID 3, TANH 3; `docs/numeric/E1_TRANSCENDENTAL_CONTRACT.md`). `test-tensor` section 7b: raw-bit equality with direct `omega_math_*` calls on dense, transposed, strided-slice-with-offset, transpose-of-slice, broadcast row/scalar and rank-0 operands incl. specials; canonical qNaN; unknown op / F16 / stale / missing `transc` entry refused. Mutants `TRANSC_EXP2_LOG2_SWAP`, `UNARY_VIEW_STRIDE` in `test-tensor-mutations` |
 | GB10 transcendental tensor ops | NOT_RUN | GB10 transcendental tensor ops: NOT_RUN (follow-up). No GB10 `transc` entry; a table without one refuses these ops with `OMEGA_TENSOR_ERR_REALIZATION` |
+| Unary ops EXP, LOG, RELU (M20 cut ops, LT-M21 CR-1..CR-5) | PASS (CPU) | Host PASS, CPU tier: forge log `HIVE-M20-ops-light-185351` at pre-stack head 1e16a8d, re-run at stacked head queued (`test-tensor` 438 pass / 0 fail plain and ASan/UBSan; `test-tensor-mutations` 10/10 tensor mutants caught). EXP / LOG: `OMEGA_TU_EXP` / `OMEGA_TU_LOG` call the E1 Omega-defined polynomials `omega_math_exp` / `omega_math_log` (`src/omega_numeric.c:458`, `:501`) once per element through the CPU `transc` entry; the result must equal a direct E1 call bit for bit. NOT correctly rounded: E1 checks them only against binary128 within EXP 40 ulp, LOG 4 ulp (`tests/test_omega_numeric.c:376-384`; `docs/numeric/E1_GAP_TABLE.md` row 8 and the `CPU_TIER_INDEPENDENT_ORACLE` line). RELU: no E1 op; tensor-layer bit select with no float arithmetic (`src/tensor/omega_tensor.c` `relu_bits`): x > +0 (incl. +subnormals, +inf) -> x; +0, -0, negatives, -inf -> +0.0; any NaN -> canonical qNaN `OMEGA_QNAN_BITS` 0x7fc00000 (`src/omega_numeric.h:48`, as E1 returns, e.g. `src/omega_numeric.c:459`). Tests: section 7b runs EXP / LOG / RELU raw-bit vs direct E1 (RELU vs an independent field-classifying reference) on dense, transposed, strided-slice, transpose-of-slice, broadcast row/scalar and rank-0 views incl. specials (+-0, +-inf, NaN payloads, subnormals, +-2^31, exp cutoffs 88.7228 / -104); section 7c: RELU explicit bit table (-0 -> +0, NaN payloads -> 0x7fc00000), served without a `transc` entry, F16 / stale refused. Mutants `TRANSC_EXP_LOG_SWAP`, `RELU_NEG_ZERO`, `RELU_NAN_PAYLOAD` |
+| GB10 EXP / LOG tensor ops | MISSING_IMPLEMENTATION | E1 itself has no GB10 kernel for the Omega exp / log polynomials (`src/omega_numeric.c:585-588`, `gb10_encoded` false (`src/omega_numeric.h:250`); `docs/numeric/E1_GAP_TABLE.md` row 10) |
+| GB10 RELU tensor op | NOT_RUN | RELU is a tensor-layer bit select with no realization call, so a GB10 context would run the same host code; no GB10 run in this work |
 | General matmul | PASS (CPU) | 1x1x1, 7x13x5, 64x64x64, 129x3x257, 3x1025x2, 1x33x1, strided views, batched broadcast [2,1,3,4]x[5,4,6] |
 | Reductions | PASS (CPU) | lengths 1..32769 across tile/level edges, every axis of [3,37,5], keepdims, view vs copy, -0 sum |
-| Mutation / refusal | PASS (CPU) | `test-tensor-mutations`: 7/7 source mutations caught; 2 in-process mutant realizations (sequential sum, FFMA chain) caught; wrong order string refused |
+| Mutation / refusal | PASS (CPU) | `test-tensor-mutations`: 10/10 tensor source mutations caught (forge log `HIVE-M20-ops-light-185351`); 2 in-process mutant realizations (sequential sum, FFMA chain) caught; wrong order string refused |
 | Determinism | PASS (CPU) | repeated run same value id; frozen KAT value id in the test |
 | Test-only hook not in library | PASS (CPU) | `omega_tensor_test_set_storage_generation` exists only under `-DOMEGA_TENSOR_TEST_HOOKS` (test builds in `mk/tensor.mk`); `test-tensor-no-hooks` (run by `test-tensor`) builds the default objects and fails if `nm` shows the symbol |
 | CI | WIRED | `host-suites-2.yml` job `tensor`: `test-tensor` + `test-tensor-mutations` on the AArch64 hosted runner (not the Spark, not a qualification) |
diff --git a/src/tensor/omega_tensor.c b/src/tensor/omega_tensor.c
index 9b762dfc4..e13576c98 100644
--- a/src/tensor/omega_tensor.c
+++ b/src/tensor/omega_tensor.c
@@ -666,14 +666,37 @@ static int elementwise_n(OmegaTensorCtx *ctx, OmegaNumericOp op, unsigned arity,
     return rc;
 }
 
+/* RELU (M20 cut ops): no E1 op exists, so the tensor layer defines it as a
+ * pure bit-level select on the FP32 pattern, with no float arithmetic and no
+ * realization call. Rule: any NaN (exponent all ones, mantissa nonzero, any
+ * sign or payload) -> the canonical E1 qNaN OMEGA_QNAN_BITS (omega_numeric.h:48,
+ * as E1 ops return it, e.g. omega_numeric.c:459); sign bit set (-0, negative
+ * normals and subnormals, -inf) -> +0.0; otherwise (+0, positive values, +inf)
+ * -> the input bits unchanged. */
+static uint32_t relu_bits(uint32_t u) {
+    if ((u & 0x7fffffffU) > OMEGA_INF_POS) return OMEGA_QNAN_BITS; /* MUT:RELU_NAN_PAYLOAD */
+    if (u >> 31) return 0U; /* MUT:RELU_NEG_ZERO */
+    return u;
+}
+
+static void relu_dense(const float *src, float *dst, size_t n) {
+    for (size_t i = 0; i < n; i++) {
+        uint32_t u;
+        memcpy(&u, &src[i], sizeof u);
+        u = relu_bits(u);
+        memcpy(&dst[i], &u, sizeof u);
+    }
+}
+
 /* Unary ops: gather the operand through its own view descriptor (offset,
  * shape, strides, including stride-0 broadcast axes) into a dense buffer,
  * then one realization call. SQRT goes through the E1 elementwise op; the
- * bounded-contract transcendentals through the realization's transc entry. */
+ * bounded-contract transcendentals and EXP / LOG through the realization's
+ * transc entry; RELU is the tensor-layer bit select above (no realization). */
 int omega_tensor_unary(OmegaTensorCtx *ctx, OmegaTensorUnaryOp op, OmegaTensor a, OmegaTensor *out) {
     if (!ctx || !out) return OMEGA_TENSOR_ERR_BAD_ARGS;
     if ((unsigned)op >= OMEGA_TU_COUNT) return OMEGA_TENSOR_ERR_BAD_ARGS;
-    if (op != OMEGA_TU_SQRT && !ctx->real->transc) return OMEGA_TENSOR_ERR_REALIZATION;
+    if (op != OMEGA_TU_SQRT && op != OMEGA_TU_RELU && !ctx->real->transc) return OMEGA_TENSOR_ERR_REALIZATION;
     TensorSlot *x;
     StorageSlot *s;
     int rc = tensor_get(ctx, a, &x, &s);
@@ -687,8 +710,10 @@ int omega_tensor_unary(OmegaTensorCtx *ctx, OmegaTensorUnaryOp op, OmegaTensor a
     void *buf;
     rc = new_dense(ctx, OMEGA_DT_F32, in.rank, in.shape, out, &buf);
     if (!rc) {
-        int nrc = op == OMEGA_TU_SQRT ? ctx->real->elementwise(OMEGA_NOP_SQRT, src, NULL, NULL, buf, n)
-                                      : ctx->real->transc(op, src, buf, n);
+        int nrc = 0;
+        if (op == OMEGA_TU_RELU) relu_dense(src, buf, n);
+        else nrc = op == OMEGA_TU_SQRT ? ctx->real->elementwise(OMEGA_NOP_SQRT, src, NULL, NULL, buf, n)
+                                       : ctx->real->transc(op, src, buf, n);
         if (nrc) rc = numeric_fail(ctx, nrc, *out);
     }
     free(src);
diff --git a/src/tensor/omega_tensor.h b/src/tensor/omega_tensor.h
index f321587d8..e29b553b9 100644
--- a/src/tensor/omega_tensor.h
+++ b/src/tensor/omega_tensor.h
@@ -112,6 +112,19 @@ typedef enum {
     OMEGA_TU_LOG2,       /* omega_math_log2,    <= OMEGA_TRANSC_MAX_ULP_LOG2 (2)    */
     OMEGA_TU_SIGMOID,    /* omega_math_sigmoid, <= OMEGA_TRANSC_MAX_ULP_SIGMOID (3) */
     OMEGA_TU_TANH,       /* omega_math_tanh,    <= OMEGA_TRANSC_MAX_ULP_TANH (3)    */
+    /* M20 cut ops (LT-M21 CR-1..CR-5). EXP / LOG: the E1 Omega-defined
+     * polynomial sequences omega_math_exp / omega_math_log
+     * (src/omega_numeric.c:458, :501) applied per element through the
+     * realization's transc entry, bit-exact with calling them directly. NOT
+     * correctly rounded: E1 checks them against binary128 within EXP 40 ulp,
+     * LOG 4 ulp (tests/test_omega_numeric.c:376-384). E1 has no GB10 kernel
+     * for either (src/omega_numeric.c:585-588).
+     * RELU: no E1 op; a tensor-layer bit select, no float arithmetic:
+     * x > +0 (incl. +inf, +subnormals) -> x; +0, -0, negatives, -inf -> +0;
+     * any NaN (any sign or payload) -> canonical qNaN OMEGA_QNAN_BITS. */
+    OMEGA_TU_EXP,        /* omega_math_exp, E1 polynomial                   */
+    OMEGA_TU_LOG,        /* omega_math_log, E1 polynomial                   */
+    OMEGA_TU_RELU,       /* bit select in the tensor layer (needs no transc) */
     OMEGA_TU_COUNT
 } OmegaTensorUnaryOp;
 
@@ -156,7 +169,8 @@ typedef struct {
                        float *out, size_t n);
     int (*reduce)(OmegaTensorReduceOp op, const float *x, size_t n, float *out);
     /* Optional. out[i] = op(a[i]) for the bounded-contract unary ops
-     * (OMEGA_TU_EXP2 .. OMEGA_TU_TANH), bit-exact with the E1 CPU sequences.
+     * (OMEGA_TU_EXP2 .. OMEGA_TU_TANH, OMEGA_TU_EXP, OMEGA_TU_LOG), bit-exact
+     * with the E1 CPU sequences.
      * NULL: those ops return OMEGA_TENSOR_ERR_REALIZATION (other ops work). */
     int (*transc)(OmegaTensorUnaryOp op, const float *a, float *out, size_t n);
 } OmegaTensorRealization;
diff --git a/src/tensor/omega_tensor_cpu.c b/src/tensor/omega_tensor_cpu.c
index d9edb4024..8fe8e5e34 100644
--- a/src/tensor/omega_tensor_cpu.c
+++ b/src/tensor/omega_tensor_cpu.c
@@ -1,8 +1,9 @@
 /* CPU realization of M20 OMEGA_TENSOR: the E1 CPU tier (explicit AArch64
  * instructions in omega_numeric_cpu_realize) for elementwise ops, the frozen
  * E1 transcendental sequences (omega_numeric_transc.c, bounded contract) for
- * EXP2 / LOG2 / SIGMOID / TANH, and the reduction seam for reductions. No
- * arithmetic outside those three. */
+ * EXP2 / LOG2 / SIGMOID / TANH, the E1 polynomials omega_math_exp / omega_math_log
+ * (omega_numeric.c) for EXP / LOG, and the reduction seam for reductions. No
+ * arithmetic outside those. RELU is a bit select in omega_tensor.c. */
 #include "omega_tensor.h"
 #include "omega_tensor_reduce_seam.h"
 #include "omega_numeric_transc.h"
@@ -17,6 +18,8 @@ static float (*const TRANSC_FN[OMEGA_TU_COUNT])(float) = {
     [OMEGA_TU_EXP2] = omega_math_exp2, [OMEGA_TU_LOG2] = omega_math_log2, /* MUT:TRANSC_EXP2_LOG2_SWAP */
     [OMEGA_TU_SIGMOID] = omega_math_sigmoid,
     [OMEGA_TU_TANH] = omega_math_tanh,
+    /* E1 Omega-defined polynomials, src/omega_numeric.c:458 and :501 (cut ops) */
+    [OMEGA_TU_EXP] = omega_math_exp, [OMEGA_TU_LOG] = omega_math_log, /* MUT:TRANSC_EXP_LOG_SWAP */
 };
 
 static int cpu_transc(OmegaTensorUnaryOp op, const float *a, float *out, size_t n) {
diff --git a/tests/test_omega_tensor.c b/tests/test_omega_tensor.c
index 4b983fa23..c3c44fe32 100644
--- a/tests/test_omega_tensor.c
+++ b/tests/test_omega_tensor.c
@@ -776,6 +776,10 @@ static const TranscCase TRANSC_CASES[] = {
     {OMEGA_TU_LOG2, omega_math_log2, "LOG2"},
     {OMEGA_TU_SIGMOID, omega_math_sigmoid, "SIGMOID"},
     {OMEGA_TU_TANH, omega_math_tanh, "TANH"},
+    /* M20 cut ops: the E1 Omega-defined polynomials (src/omega_numeric.c:458,
+     * :501), not correctly rounded, bit-exact with the direct call. */
+    {OMEGA_TU_EXP, omega_math_exp, "EXP"},
+    {OMEGA_TU_LOG, omega_math_log, "LOG"},
 };
 #define NTRANSC (sizeof(TRANSC_CASES) / sizeof(TRANSC_CASES[0]))
 
@@ -787,6 +791,12 @@ static const uint32_t TRANSC_SPECIALS[] = {
     0xc2fc0000U /* -126 */, 0x41100000U /* 9 */, 0xc1100000U /* -9 */, 0x42c80000U /* 100 */,
     0xc2c80000U /* -100 */, 0x3f800001U, 0x3f7fffffU, 0x40000000U, 0x3e800000U, 0xbf000000U,
     0x00400000U, 0x80400000U, 0x7fffffffU, 0xffffffffU,
+    /* EXP / LOG edges (omega_numeric.c:460-461): ~88.7228 cutoff and next float
+     * above it, -104 cutoff and its neighbours, -88 (subnormal result),
+     * ~ln2/2 (worst-ulp region), large +-, smallest +-subnormal, NaN payloads */
+    0x42b17218U, 0x42b17219U, 0xc2d00000U, 0xc2cfffffU, 0xc2d00001U, 0xc2b00000U,
+    0x3eb17218U, 0xbeb17218U, 0x4f000000U, 0xcf000000U, 0x00000002U, 0x80000002U,
+    0x7f800001U, 0xff800001U, 0x7fc00001U,
 };
 #define NTSPECIAL (sizeof(TRANSC_SPECIALS) / sizeof(TRANSC_SPECIALS[0]))
 
@@ -812,6 +822,17 @@ static void transc_check(const TranscCase *tc, OmegaTensor V, const float *src,
     if (!rc) omega_tensor_release(g, O);
 }
 
+/* Independent RELU reference, written from the rule in omega_tensor.h (not
+ * from omega_tensor.c): classify the FP32 pattern by its fields. */
+static float ref_relu(float x) {
+    uint32_t u = omega_float_to_bits(x);
+    uint32_t sign = u >> 31, expo = (u >> 23) & 0xffU, mant = u & 0x007fffffU;
+    if (expo == 0xffU && mant != 0) return omega_bits_to_float(0x7fc00000U); /* NaN -> canonical qNaN */
+    if (sign) return omega_bits_to_float(0x00000000U);                      /* -0, < 0, -inf -> +0 */
+    return x;                                                               /* +0, > 0, +inf */
+}
+static const TranscCase RELU_CASE = {OMEGA_TU_RELU, ref_relu, "RELU"};
+
 static void test_transc_unary(void) {
     const size_t n = 4096;
     float *a = malloc(n * 4);
@@ -848,8 +869,9 @@ static void test_transc_unary(void) {
     int rcc = omega_tensor_broadcast_to(g, C0, 2, ssc, &BC);
     CHECK(rcc == 0, "transc: broadcast scalar rc=%d", rcc);
 
-    for (size_t k = 0; k < NTRANSC; k++) {
-        const TranscCase *tc = &TRANSC_CASES[k];
+    /* k == NTRANSC: RELU through the same views (tensor-layer bit select) */
+    for (size_t k = 0; k <= NTRANSC; k++) {
+        const TranscCase *tc = k < NTRANSC ? &TRANSC_CASES[k] : &RELU_CASE;
         for (size_t i = 0; i < n; i++) idx[i] = i;
         transc_check(tc, A1, a, idx, n, "dense [4096]");
         if (!rct) {
@@ -952,6 +974,107 @@ static void test_transc_unary(void) {
     free(idx);
 }
 
+/* ---- 7c. RELU (M20 cut ops) ----------------------------------------------
+ * Rule (omega_tensor.h): x > +0 -> x; +0, -0, negative, -inf -> +0.0; any NaN
+ * -> canonical qNaN 0x7fc00000. Explicit input -> output bit table, checked
+ * on raw bits (NaN payload and the sign of zero are semantic here). Also served
+ * by a realization without a transc entry, and refused like other unary ops. */
+static void test_relu_unary(void) {
+    static const uint32_t TABLE[][2] = {
+        {0x00000000U, 0x00000000U}, /* +0 -> +0 */
+        {0x80000000U, 0x00000000U}, /* -0 -> +0 */
+        {0x7f800000U, 0x7f800000U}, /* +inf -> +inf */
+        {0xff800000U, 0x00000000U}, /* -inf -> +0 */
+        {0x00000001U, 0x00000001U}, /* smallest +subnormal kept */
+        {0x007fffffU, 0x007fffffU}, /* largest +subnormal kept */
+        {0x80000001U, 0x00000000U}, /* -subnormal -> +0 */
+        {0x807fffffU, 0x00000000U},
+        {0x00800000U, 0x00800000U}, /* smallest +normal */
+        {0x7f7fffffU, 0x7f7fffffU}, /* largest +normal */
+        {0xff7fffffU, 0x00000000U}, /* most negative normal -> +0 */
+        {0x3f800000U, 0x3f800000U}, /* 1 */
+        {0xbf800000U, 0x00000000U}, /* -1 */
+        {0x7fc00000U, 0x7fc00000U}, /* canonical qNaN */
+        {0xffc00000U, 0x7fc00000U}, /* negative qNaN -> canonical */
+        {0x7fc00001U, 0x7fc00000U}, /* qNaN payloads -> canonical */
+        {0x7fa00001U, 0x7fc00000U}, /* sNaN -> canonical */
+        {0x7f800001U, 0x7fc00000U},
+        {0xff800001U, 0x7fc00000U},
+        {0xffc00123U, 0x7fc00000U},
+        {0x7fffffffU, 0x7fc00000U},
+        {0xffffffffU, 0x7fc00000U},
+    };
+    enum { NT = sizeof(TABLE) / sizeof(TABLE[0]) };
+    float in[NT];
+    for (size_t i = 0; i < NT; i++) in[i] = omega_bits_to_float(TABLE[i][0]);
+    uint64_t sh[1] = {NT};
+    OmegaTensor X = mk(1, sh, in), O = {0, 0};
+    uint8_t id_before[32], id_after[32];
+    vid(X, id_before);
+    int rc = omega_tensor_unary(g, OMEGA_TU_RELU, X, &O);
+    float *got = rc ? NULL : rd(O);
+    CHECK(!rc && got, "relu: dense special table rc=%d", rc);
+    for (size_t i = 0; got && i < NT; i++) {
+        uint32_t gb = omega_float_to_bits(got[i]);
+        CHECK(gb == TABLE[i][1], "relu(0x%08x) = 0x%08x, rule says 0x%08x", TABLE[i][0], gb, TABLE[i][1]);
+    }
+    free(got);
+    if (!rc) omega_tensor_release(g, O);
+    vid(X, id_after);
+    CHECK(memcmp(id_before, id_after, 32) == 0, "relu: input value id unchanged");
+
+    /* rank 0, -0 and a NaN payload: the two easiest bits to get wrong */
+    const uint32_t r0[2] = {0x80000000U, 0xffc00123U};
+    for (size_t i = 0; i < 2; i++) {
+        float v = omega_bits_to_float(r0[i]);
+        OmegaTensor S = mk(0, NULL, &v), R = {0, 0};
+        rc = omega_tensor_unary(g, OMEGA_TU_RELU, S, &R);
+        float *r = rc ? NULL : rd(R);
+        uint32_t want = i == 0 ? 0x00000000U : 0x7fc00000U;
+        CHECK(r && omega_float_to_bits(r[0]) == want, "relu rank0 0x%08x -> 0x%08x (want 0x%08x)", r0[i],
+              r ? omega_float_to_bits(r[0]) : 0U, want);
+        free(r);
+        if (!rc) omega_tensor_release(g, R);
+        omega_tensor_release(g, S);
+    }
+
+    /* refusals: F16 operand, stale handle */
+    OmegaTensor H = {0, 0};
+    if (!omega_tensor_cast(g, X, OMEGA_DT_F16, &H)) {
+        rc = omega_tensor_unary(g, OMEGA_TU_RELU, H, &O);
+        CHECK(rc == OMEGA_TENSOR_ERR_DTYPE, "relu on F16 refused (rc=%d)", rc);
+        omega_tensor_release(g, H);
+    } else {
+        CHECK(0, "relu: F32->F16 cast for dtype refusal");
+    }
+    omega_tensor_release(g, X);
+    rc = omega_tensor_unary(g, OMEGA_TU_RELU, X, &O);
+    CHECK(rc == OMEGA_TENSOR_ERR_STALE, "relu on released tensor refused (rc=%d)", rc);
+
+    /* served without a transc entry: RELU is not a realization op */
+    OmegaTensorRealization notransc = *omega_tensor_cpu_realization();
+    notransc.name = "NO_TRANSC_ENTRY";
+    notransc.transc = NULL;
+    OmegaTensorCtx *c = NULL;
+    rc = omega_tensor_ctx_create(8, &notransc, &c);
+    CHECK(rc == 0, "relu: realization without transc entry accepted (rc=%d)", rc);
+    if (!rc) {
+        OmegaTensor Y = {0, 0}, Z = {0, 0};
+        omega_tensor_from_f32(c, 1, sh, in, &Y);
+        rc = omega_tensor_unary(c, OMEGA_TU_RELU, Y, &Z);
+        float *z = NULL;
+        if (!rc) {
+            z = malloc(NT * sizeof(float));
+            if (z && omega_tensor_read_f32(c, Z, z, NT)) { free(z); z = NULL; }
+        }
+        size_t bad = 0;
+        for (size_t i = 0; z && i < NT; i++) bad += omega_float_to_bits(z[i]) != TABLE[i][1];
+        CHECK(!rc && z && bad == 0, "relu served without transc entry, same bits (rc=%d, %zu differ)", rc, bad);
+        free(z);
+        omega_tensor_ctx_destroy(c);
+    }
+}
+
 /* ---- 8. determinism ------------------------------------------------------- */
 static void kat_digest(uint8_t out[32]) {
     uint64_t save = g_rng;
@@ -997,6 +1120,7 @@ int main(void) {
     test_matmul_parity();
     test_mutations();
     test_transc_unary();
+    test_relu_unary();
     test_determinism();
     /* every test released what it made */
     uint32_t lt, ls;
diff --git a/tools/tensor_mutations.sh b/tools/tensor_mutations.sh
index 180037a07..27227f5d5 100755
--- a/tools/tensor_mutations.sh
+++ b/tools/tensor_mutations.sh
@@ -21,7 +21,10 @@ BCAST_ZERO_STRIDE|omega_tensor.c|s/o.strides\[d\] = 0;/o.strides[d] = in->stride
 PERMUTE_STRIDES|omega_tensor.c|s/in->strides\[perm\[d\]\]/in->strides[d]/
 SLICE_OFFSET|omega_tensor.c|s/start\[d\], in->strides\[d\]/start[d], 1/
 TRANSC_EXP2_LOG2_SWAP|omega_tensor_cpu.c|s/= omega_math_exp2, \(.*\)= omega_math_log2,/= omega_math_log2, \1= omega_math_exp2,/
-UNARY_VIEW_STRIDE|omega_tensor.c|s/gather(s, .in, src);/dense_strides(in.rank, in.shape, in.strides); gather(s, \&in, src);/'
+UNARY_VIEW_STRIDE|omega_tensor.c|s/gather(s, .in, src);/dense_strides(in.rank, in.shape, in.strides); gather(s, \&in, src);/
+TRANSC_EXP_LOG_SWAP|omega_tensor_cpu.c|s/= omega_math_exp, \(.*\)= omega_math_log,/= omega_math_log, \1= omega_math_exp,/
+RELU_NEG_ZERO|omega_tensor.c|s/if (u >> 31) return 0U;/if (u >> 31) return u == 0x80000000U ? u : 0U;/
+RELU_NAN_PAYLOAD|omega_tensor.c|s/return OMEGA_QNAN_BITS;/return u;/'
 
 # Baseline: the unmutated build must PASS, otherwise every mutant would
 # look "caught" (e.g. the test refusing an unsuitable FP environment).