Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/src/tensor/omega_tensor_reduce_seam.h # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / src / tensor / omega_tensor_reduce_seam.h` 49 lines ยท 2140 bytes Raw Blame History 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 #ifndef OMEGA_TENSOR_REDUCE_SEAM_H 18 #define OMEGA_TENSOR_REDUCE_SEAM_H 19 20 /* 21 * The one place where tensor reductions meet the E1 reduction contract. 22 * 23 * The order is OMEGA_TENSOR_REDUCE_DECLARED_ORDER (omega_tensor.h), the same 24 * string as OMEGA_REDUCE_DECLARED_ORDER in src/omega_numeric_reduce.h of the 25 * E1 WP-D reductions (omega PR #134, docs/numeric/E1_REDUCTION_CONTRACT.md): 26 * 27 * level 0 values are x[0..n). One level turns len values into ceil(len/32) 28 * values: value j of the next level is the 32-lane warp tree (lane i 29 * combines with lane i+d for d = 16, 8, 4, 2, 1, lower lane on the left) 30 * over values [32j, 32j+32) of this level, positions >= len filled with the 31 * identity (SUM/MEAN: -0.0, MAX/MIN: quiet NaN). At least one level is 32 * applied; levels repeat until one value is left. MEAN = omega_math_div(SUM, 33 * (float)n), 1 <= n <= 2^24. 34 * 35 * The seam calls omega_reduce_cpu (src/omega_numeric_reduce.h, E1 WP-D, 36 * omega #134); the local copy of the order used before #134 merged is gone. 37 * The test checks the order string and the bits against an independent 38 * reference of the definition. 39 */ 40 41 #include 42 #include "omega_tensor.h" 43 44 /* Returns 0 or an OMEGA_NUMERIC_* code. n >= 1. */ 45 int omega_tensor_seam_reduce_cpu(OmegaTensorReduceOp op, const float *x, size_t n, float *out); 46 /* Reduction source linked: "E1_WP_D_OMEGA_REDUCE_CPU". */ 47 const char *omega_tensor_seam_reduce_source(void); 48 49 #endif /* OMEGA_TENSOR_REDUCE_SEAM_H */