interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / om / units.sh

357 lines · 28725 bytes Raw Blame History
1#!/bin/sh
2# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3# Regenerate checked portable Omega C and declarations for all canonical roots.
4# Seeded e5b32567 validates the portable bytes lowered by the locked converter.
5# NO_POSIX additionally carries checked native sources for both supported ISAs.
6set -eu
7OMC_PIN=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f
8
9CONVERTER_PIN=f04bc8dc3a898c374016268f5414bfc5f4ee801d18017c379fda6229fd5fbab4
10FRONTEND_PIN=a3a455bd77381e132215924295763e8728889d7d578278ae376de78324be8629
11FREEST_CONVERTER_PIN=836cbf9ef8a3c4ee82b0458070884405bc8296f83b10f933556bf27750bb3661
12FREEST_FRONTEND_PIN=17d7412a4dedfe4a2fb57c979cf02a9df21ff9499d78ea9d65d4f4bbf03702dc
13ROOT=$(cd "$(dirname "$0")/.." && pwd)
14# Native NO_POSIX roots have separate bridge pins and import-free object custody.
15if [ "${1:-}" = --native-no-posix ]; then
16 exec sh "$ROOT/om/no-posix.sh"
17fi
18QUANT=om/quant/quant.om
19REAL="$QUANT,om/components/realize.om"
20CACHE="$REAL,om/cache/digest.om,om/cache/residency.om,om/cache/artifact.om"
21PIPE="$CACHE,om/pipeline/select.om,om/pipeline/graph.om,om/pipeline/consume.om"
22COMP="om/components/bw_alloc.om,om/components/bw_effect.om,om/components/bw_check.om,om/components/bw_project.om,om/components/rowpipe.om,om/components/staged.om,om/components/compose.om,om/components/runtime.om"
23ENC="om/encoder/bw_enc_sm121.om,om/encoder/bw_spec_sm121.om,om/components/encode.om"
24MOE="om/moe/moe_plan.om om/moe/moe_group.om om/moe/moe_ids32.om om/moe/moe_maps32.om om/moe/moe_segs32.om om/moe/moe_windows.om moe_admission=$PIPE,om/moe/moe_group.om,om/moe/moe_admit.om om/moe/moe_plan_wide.om om/moe/moe_group_wide.om om/moe/moe_ids32_wide.om om/moe/moe_maps32_wide.om om/moe/moe_segs32_wide.om om/moe/moe_windows_wide.om moe_admission_wide=$PIPE,om/moe/moe_group_wide.om,om/moe/moe_admit_wide.om"
25CLOSURE="$REAL,om/cache/digest.om,om/moe/moe_windows.om,om/moe/moe_group.om,native/learn53/moe-closure.om"
26OBSERVE="closure_code=$CLOSURE,om/moe/closure_code.om closure_launch=$CLOSURE,om/moe/closure_launch.om closure_dir=$CLOSURE,om/moe/closure_dir.om closure_alloc=$CLOSURE,om/moe/closure_alloc.om closure_series=$CLOSURE,om/moe/closure_series.om"
27UNITS="${OMEGA_UNITS:-om/encoder/bw_enc_sm121.om om/cubin/cubin_elf.om om/mathlibs/mathlibs_ir.om om/encoder/ampere_enc_sm86.om om/encoder/amp_runtime.om repack=$QUANT,om/quant/repack.om quant_wire=$QUANT,om/quant/runtime.om compose=$COMP encode=$ENC cache_runtime=om/cache/residency.om,om/cache/runtime.om lease=om/cache/residency.om,om/cache/runtime.om,om/cache/lease.om slotrev=om/cache/residency.om,om/cache/slotrev.om command=om/cache/residency.om,om/cache/command.om validate=$CACHE,$COMP,$ENC,om/components/admit.om,om/cache/validate.om digest=$REAL,om/cache/digest.om,om/cache/key.om code_digest=$REAL,om/cache/digest.om,om/cache/codekey.om templates=$REAL,om/cache/digest.om,om/cache/templates.om graph=$PIPE,om/pipeline/runtime.om context_lookup=om/pipeline/context.om,om/pipeline/context_abi.om binding=$REAL,om/pipeline/binding.om $MOE closure_pack=$CLOSURE,om/moe/closure_pack.om closure_bind=$CLOSURE,om/moe/closure_bind.om closure_blob=$CLOSURE,om/moe/closure_blob.om closure_cover=$CLOSURE,om/pipeline/mccover.om,om/pipeline/coverage_entry.om closure_intent=$CLOSURE,om/pipeline/mccover.om closure_seal=$CLOSURE,om/pipeline/mccover.om,om/pipeline/seal_entry.om closure_reseal=$CLOSURE,om/pipeline/mccover.om,om/pipeline/seal_reuse.om $OBSERVE prefill_shape=om/prefill-shape/admit.om prefill_reading=om/prefill-shape/reading.om prefill_workspace=om/prefill-shape/workspace.om prefill_order=om/prefill-shape/order.om attn_mirror_plan=om/attention-mirror/plan.om attn_mirror_step=om/attention-mirror/step.om q38_runtime=om/q38-head/envelope.om,om/q38-head/plan.om q38_emit=om/components/bw_alloc.om,om/components/bw_effect.om,om/components/bw_check.om,om/components/bw_project.om,$ENC,om/q38-head/bounds.om,om/q38-head/emit.om}"
28if [ -z "${OMEGA_UNITS:-}" ]; then
29 UNITS="$UNITS cg_qmma=om/codegen/cg_qmma.om cg_qmma_patch=om/codegen/cg_qmma_patch.om"
30 UNITS="$UNITS qm_self=om/codegen/cg_qmma.om,om/codegen/qm_self.om qm_host=om/codegen/qm_host.om"
31fi
32if [ -z "${OMEGA_UNITS:-}" ]; then
33 UNITS="$UNITS cg_tgemm_spec=om/codegen/cg_tgemm_spec.om cg_tgemm=om/codegen/cg_qmma.om,om/codegen/cg_tgemm_emit.om,om/codegen/cg_tgemm.om"
34 UNITS="$UNITS cg_pf=om/codegen/cg_pf.om"
35 UNITS="$UNITS cg_tern=om/codegen/cg_tern_common.om,om/codegen/cg_tern.om cg_tern_sched=om/codegen/cg_tern_sched.om cg_tern_policy=om/codegen/cg_tern_common.om,om/codegen/cg_tern_policy.om"
36fi
37[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS om/streams/streams.om"
38[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS numeric=om/numeric/numeric.om numeric_tile=om/numeric/numeric.om,om/numeric/tile.om"
39if [ -z "${OMEGA_UNITS:-}" ]; then
40 CM_HOST_MATH=om/components/cm_math.om,om/components/cm_math_extra.om,om/components/cm_math_erfc.om
41 UNITS="$UNITS artifact_policy=om/components/artifact_policy.om artifact_parse=om/components/artifact_parse.om api_policy=om/components/api_policy.om cm_sort=om/components/cm_sort.om cm_math=$CM_HOST_MATH cm_fit=$CM_HOST_MATH,om/components/cm_fit.om cm_stats=$CM_HOST_MATH,om/components/cm_stats.om cm_features=$CM_HOST_MATH,om/components/cm_features.om"
42 UNITS="$UNITS cm_quantile=$CM_HOST_MATH,om/components/cm_quantile.om cm_decision=$CM_HOST_MATH,om/components/cm_decision.om"
43 UNITS="$UNITS cm_prediction=$CM_HOST_MATH,om/components/cm_prediction.om cm_calibration=$CM_HOST_MATH,om/components/cm_quantile.om,om/components/cm_calibration.om"
44 UNITS="$UNITS cm_blob=om/components/cm_blob.om cm_digest=om/cache/digest.om,om/components/cm_digest.om"
45 UNITS="$UNITS artifact_format=om/components/artifact_format.om artifact_admit=om/components/artifact_parse.om,om/components/artifact_policy.om,om/components/artifact_format.om,om/components/artifact_admit.om"
46 UNITS="$UNITS artifact_elf=om/components/artifact_elf.om"
47 UNITS="$UNITS api_mm_plan=om/components/api_mm_plan.om api_at_plan=om/components/api_at_plan.om api_ew_plan=om/components/api_ew_plan.om api_bf_plan=om/components/api_bf_plan.om api_da_plan=om/components/api_da_plan.om api_rt_plan=om/components/api_rt_plan.om"
48fi
49if [ -z "${OMEGA_UNITS:-}" ]; then
50 UNITS="$UNITS ew_ir=om/kgen/ew_emit.om,om/kgen/ew_scalar.om,om/kgen/ew_reconv.om,om/kgen/ew_prime.om,om/kgen/ew_ir.om"
51 UNITS="$UNITS attention_ir=om/kgen/attention_emit.om,om/kgen/attention_tuned.om,om/kgen/attention_general.om,om/kgen/attention_ir.om"
52fi
53if [ -z "${OMEGA_UNITS:-}" ]; then UNITS="$UNITS cmdlist_record=om/cmdlist/record.om cmdlist_plan=om/cmdlist/plan.om cmdlist_layout=om/cmdlist/layout.om cmdlist_access=om/cmdlist/plan.om,om/cmdlist/access.om"; fi
54[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS nvrm_wire_pack=native/nvrm/wire.om,native/nvrm/wire_pack.om nvrm_wire_reply=native/nvrm/wire.om nvrm_heap_wire=native/nvrm/heap_wire.om"
55[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS nvrm_uvm_wire=native/nvrm/uvm_fields.om,native/nvrm/uvm_wire.om nvrm_uvm_map_wire=native/nvrm/uvm_fields.om,native/nvrm/uvm_map_wire.om nvrm_struct=native/nvrm/uvm_fields.om,native/nvrm/struct.om"
56if [ -z "${OMEGA_UNITS:-}" ]; then
57 UNITS="$UNITS plat_policy=om/platform-linux/plat_policy.om"
58 UNITS="$UNITS plat_rest=om/platform-linux/plat_rest.om"
59fi
60NVML="nvml_step=native/nvml/nvml.om,native/nvml/query.om,native/nvml/step.om nvml_errstr=native/nvml/errstr.om"
61[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS $NVML"
62[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS om/admission/chip_admit.om"
63# RegAlloc #309 (seeded allocator, core matmul builders, vecadd writer): appended to the default list only.
64[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS om/codegen/regalloc.om om/codegen/regalloc_ir.om om/codegen/regalloc_live.om om/codegen/cg_matmul.om om/codegen/cg_matmul_params.om om/codegen/cg_matmul_i32.om om/codegen/cg_matmul_tensor.om om/codegen/cg_matmul_loop.om om/codegen/cg_matmul_frag.om om/codegen/cg_matmul_block.om om/codegen/cg_vecadd.om om/codegen/bw_hazard.om bw_hazard_dec=om/codegen/bw_hazard.om,om/codegen/bw_hazard_dec.om om/codegen/cg_bind.om"
65# C3 scan and sort (CUB/Thrust row): the kernel IR and the launch plans
66if [ -z "${OMEGA_UNITS:-}" ]; then UNITS="$UNITS om/scan/scan_ir.om om/scan/scan_plan.om"; fi
67[ -z "${OMEGA_UNITS:-}" ] && UNITS="$UNITS aiengpu=native/aiengpu/context.om"
68# C6 (CUDApp#10): the sm_121 disassembler; appended only to the default list, so OMEGA_UNITS subsets still work.
69[ -z "${OMEGA_UNITS:-}" ] && UNITS="$UNITS om/disasm/sm121_dis.om"
70# dag_eval is the dagsim scheduler; the other om/tools units are the decisions
71# of the host tools (tools-om-2). Append only when the caller did not
72# override the unit list, so a selective OMEGA_UNITS run stays selective.
73if [ -z "${OMEGA_UNITS:-}" ]; then
74 UNITS="$UNITS cg_moe=om/codegen/cg_moe_emit.om,om/codegen/cg_moe_core.om,om/codegen/cg_moe.om cg_moe2=om/codegen/cg_moe_emit.om,om/codegen/cg_moe_core.om,om/codegen/cg_moe2.om cg_moe_sched=om/codegen/cg_moe_sched.om"
75 UNITS="$UNITS cg_gdn=om/codegen/cg_gdn_shape.om,om/codegen/cg_gdn_common.om,om/codegen/cg_gdn.om cg_gdn_policy=om/codegen/cg_gdn_shape.om,om/codegen/cg_gdn_policy.om"
76 UNITS="$UNITS cg_dec=om/codegen/cg_dec_emit.om,om/codegen/cg_dec.om gdn_admit=om/gdn/admit.om"
77 UNITS="$UNITS bw_qmd=om/qmd/bw_qmd.om eng=om/engine/fixture_rest.om,om/engine/eng.om fixture_text=om/engine/fixture_rest.om"
78 UNITS="$UNITS om/tools/dag_eval.om om/tools/dag_parse.om om/tools/dag_fmt.om om/tools/dag_res.om dag_diff=om/tools/dag_res.om,om/tools/dag_diff.om om/tools/own30b_prof.om doctor=om/tools/fmt.om,om/tools/doctor.om om/tools/ampcorp.om om/tools/ampfam.om om/tools/artexp.om"
79fi
80if [ -z "${OMEGA_UNITS:-}" ]; then
81 UNITS="$UNITS cg_tc=om/codegen/cg_tc_emit.om,om/codegen/cg_tc.om"
82 UNITS="$UNITS gemm_any=om/gemm-any/gemm_ir.om"
83 UNITS="$UNITS dnn_rows=om/attn-any/emit.om,om/dnn-rows/kernel.om dnn_rows_plan=om/dnn-rows/plan.om"
84 UNITS="$UNITS gemm_host=om/gemm-any/host.om"
85 UNITS="$UNITS gemm_value=om/gemm-any/host.om,om/gemm-any/value.om gemm_cfg=om/gemm-any/host.om,om/gemm-any/config.om"
86 UNITS="$UNITS gemm_plan=om/gemm-any/host.om,om/gemm-any/plan.om gemm_span=om/gemm-any/host.om,om/gemm-any/span.om"
87 UNITS="$UNITS tc_host=om/numeric/numeric.om,om/codegen/tc_host.om"
88fi
89if [ -z "${OMEGA_UNITS:-}" ]; then
90 UNITS="$UNITS dnn_activations=om/attn-any/emit.om,om/dnn-activations/kernel.om dnn_activations_plan=om/dnn-activations/plan.om"
91fi
92if [ -z "${OMEGA_UNITS:-}" ]; then
93 UNITS="$UNITS cg_attn=om/codegen/cg_attn_emit.om,om/codegen/cg_attn.om cg_pattn=om/codegen/cg_pattn_emit.om,om/codegen/cg_pattn.om"
94fi
95if [ -z "${OMEGA_UNITS:-}" ]; then
96 UNITS="$UNITS cg_pfhost=om/codegen/cg_pfhost_emit.om,om/codegen/cg_pfhost_rl.om,om/codegen/cg_pfhost_mc.om,om/codegen/cg_pfhost.om"
97 UNITS="$UNITS pf_admit=om/codegen/pf_admit.om"
98fi
99[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS nvrm_policy=native/nvrm/policy.om"
100if [ -z "${OMEGA_UNITS:-}" ]; then UNITS="$UNITS session_admit=om/session/admit.om session_words=om/session/words.om session_park=om/session/park.om cmdlist_book=om/cmdlist/book.om"; fi
101# ar_ roots use the existing checked runtime-view profile; no new converter profile.
102[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS ar_memreserve=om/session/reserve.om"
103if [ -z "${OMEGA_UNITS:-}" ]; then
104 UNITS="$UNITS om/codegen/cg_fields.om om/codegen/cg_replay.om om/codegen/cg_life.om om/codegen/cg_invar.om om/codegen/cg_budget.om"
105 UNITS="$UNITS cm_route=om/components/cm_route.om"
106fi
107[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS numeric_rest=om/numeric/numeric.om,om/numeric/rest.om numeric_patch=om/numeric/numeric.om,om/numeric/rest.om,om/numeric/patch.om numeric_check=om/numeric/numeric.om,om/numeric/rest.om,om/numeric/patch.om,om/numeric/check.om"
108[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS numeric_trace=om/numeric/numeric.om,om/numeric/rest.om,om/numeric/trace.om numeric_reduce=om/numeric/numeric.om,om/numeric/tile.om,om/numeric/rest.om,om/numeric/reduce.om"
109[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS mathlibs_host=om/mathlibs/host.om,om/mathlibs/host_scalar.om mathlibs_walk=om/mathlibs/host.om,om/mathlibs/host_walk.om mathlibs_step=om/mathlibs/host.om,om/mathlibs/host_step.om mathlibs_many=om/mathlibs/host.om,om/mathlibs/host_many.om mathlibs_index=om/mathlibs/host.om,om/mathlibs/host_index.om mathlibs_fft=om/mathlibs/host.om,om/mathlibs/host_fft.om"
110[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS standalone_oracles=om/standalone-oracles/oracles.om"
111[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS nvrm_va=native/nvrm/alloc_profile.om,native/nvrm/alloc.om nvrm_alloc_scalar=native/nvrm/policy.om,native/nvrm/alloc_scalar.om nvrm_counts=native/nvrm/counts.om nvrm_alloc_push=native/nvrm/alloc_profile.om,om/encoder/amp_runtime.om,native/nvrm/alloc_push.om"
112[ -z "${OMEGA_UNITS:-}" ] && UNITS="$UNITS om/tools/dag_jstr.om"
113[ -z "${OMEGA_UNITS:-}" ] && UNITS="$UNITS om/disasm/words.om"
114[ -z "${OMEGA_UNITS:-}" ] && UNITS="$UNITS om/admission/chip_enum.om"
115PURE_UNITS="revision=om/pipeline/revision.om epoch=om/pipeline/epoch.om f16=om/numeric/f16.om"
116[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS attn_any=om/attn-any/emit.om,om/attn-any/kernel.om attn_any_plan=om/attn-any/plan.om"
117if [ -z "${OMEGA_UNITS:-}" ]; then
118 UNITS="$UNITS gemm_scalar=om/gemm-any/gemm_ir.om,om/conv2d/dense.om conv2d=om/gemm-any/gemm_ir.om,om/conv2d/conv.om conv_plan=om/gemm-any/gemm_ir.om,om/conv2d/conv.om,om/conv2d/plan.om"
119 UNITS="$UNITS cg_attn256=om/codegen/cg_rest_emit.om,om/codegen/cg_attn256.om cg_pattn256=om/codegen/cg_rest_emit.om,om/codegen/cg_pattn256.om cg_router=om/codegen/cg_rest_emit.om,om/codegen/cg_router.om cg_gemm=om/codegen/cg_rest_emit.om,om/codegen/cg_gemm.om cg_bf16=om/codegen/cg_rest_emit.om,om/codegen/cg_bf16.om cg_qg=om/codegen/cg_rest_emit.om,om/prefill-shape/admit.om,om/prefill-shape/order.om,om/codegen/cg_qg.om"
120 UNITS="$UNITS core_sha=om/core/sha256.om"
121 CORE=om/core
122 for entry in omcanon omcidcmp omcidhex; do
123 UNITS="$UNITS core_$entry=$CORE/canonical.om,$CORE/$entry.om"
124 done
125 for entry in omparse omcver omcheck; do
126 UNITS="$UNITS core_$entry=$CORE/idparse.om,$CORE/$entry.om"
127 done
128 for unit in object graph payload param effect eval vector vecspec vpay fmt fmtnum fmtclip hostmath; do
129 UNITS="$UNITS core_$unit=$CORE/$unit.om"
130 done
131 UNITS="$UNITS core_cubinmsg=$CORE/fmtnum.om,$CORE/cubinmsg.om"
132 GRAPH_REC=om/graph/record.om
133 GRAPH_NODE=$GRAPH_REC,om/graph/scalar.om
134 UNITS="$UNITS model_graph_wire=$GRAPH_REC,om/graph/entry_wire.om model_graph_node=$GRAPH_NODE,om/graph/entry_node.om model_graph_batch=$GRAPH_NODE,om/graph/pf_order.om,om/graph/batch.om,om/graph/entry_batch.om model_graph_launch=$GRAPH_REC,om/graph/entry_launch.om model_graph_copy=om/graph/prefill.om,om/graph/entry_copy.om model_graph_xfer=om/graph/prefill.om,om/graph/entry_xfer.om model_graph=$GRAPH_NODE,om/graph/final.om,om/graph/entry_final.om"
135 UNITS="$UNITS model_graph_expert=$GRAPH_NODE,om/graph/pf_order.om,om/graph/batch.om,om/graph/experts.om"
136 UNITS="$UNITS model_graph_group=om/graph/group.om"
137 UNITS="$UNITS model_graph_address=om/graph/address.om"
138 UNITS="$UNITS model_graph_final_batch=$GRAPH_NODE,om/graph/final_batch.om"
139 UNITS="$UNITS model_graph_window=$GRAPH_NODE,om/graph/window.om"
140 UNITS="$UNITS model_graph_layout=$GRAPH_REC,om/graph/layout.om"
141 UNITS="$UNITS model_graph_aux=$GRAPH_NODE,om/graph/aux.om"
142 UNITS="$UNITS om/resident/resident.om resident_check=om/resident/resident.om,om/resident/check.om"
143 UNITS="$UNITS model_graph_residue=om/graph/residue.om model_graph_table=om/graph/table.om hello_host=om/graph/hello.om hello_plan=om/graph/hello-plan.om"
144 UNITS="$UNITS core_cubadmit=$CORE/fmtnum.om,$CORE/cubadmit.om"
145 UNITS="$UNITS core_ampack=$CORE/ampack.om"
146 UNITS="$UNITS graph_headscale=om/graph/headscale.om"
147fi
148[ -n "${OMEGA_UNITS:-}" ] || PURE_UNITS="$PURE_UNITS c5=tools/c5/policy.om,tools/c5/runtime.om"
149GXNUM=om/gemmex/num.om
150GEMMEX="gemm_ex_plan=$GXNUM,om/gemmex/plan.om gemm_ex_row=$GXNUM,om/gemmex/row.om gemm_ex_x3=$GXNUM,om/gemmex/x3.om gemm_ex_acc=$GXNUM,om/gemmex/acc.om gemm_ex_dot=$GXNUM,om/gemmex/dot.om gemm_ex_epi=$GXNUM,om/gemmex/epi.om gemm_ex_fp8=$GXNUM,om/gemmex/fp8.om"
151[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS $GEMMEX"
152if [ -z "${OMEGA_UNITS:-}" ]; then
153UNITS="$UNITS apish_shp=om/api/apish_shp.om apish_pack=om/api/apish_pack.om apish_slot=om/api/apish_slot.om apish_blk=om/api/apish_blk.om apish_trit=om/api/apish_trit.om"
154fi
155PURE_UNITS="$PURE_UNITS leftovers=om/components/leftovers.om"
156AV=om/apiviews
157APIVIEWS="av_ewarg=$AV/ewarg.om av_fp8am=$AV/fp8am.om av_fp8en=$AV/fp8en.om av_fp8q=$AV/fp8q.om av_e4m3=$AV/e4m3.om av_fp8sc=$AV/fp8sc.om av_gdnch=$AV/gdnch.om av_gdnsl=$AV/gdnsl.om av_scan=$AV/scan.om"
158APIVIEWS_RT="av_bf16=$AV/bf16.om av_widen=$AV/widen.om av_rope=$AV/rope.om av_gdnsc=$AV/gdnsc.om av_gdnex=$AV/gdnex.om av_gdnpt=$AV/gdnpt.om av_gdnut=$AV/gdnut.om av_fp8x=$AV/fp8x.om av_fp8xb=$AV/fp8xb.om"
159APIVIEWS="$APIVIEWS ah_rest=$AV/hostrest.om"
160APIVIEWS_RT="$APIVIEWS_RT ar_carry=$AV/scancarry.om"
161[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS $APIVIEWS $APIVIEWS_RT"
162UNITS="$UNITS bw_identity=om/cache/digest.om,om/blackwell/identity.om"
163UNITS="$UNITS bw_cpui=om/blackwell/views.om,om/blackwell/shape.om,om/blackwell/cpui.om bw_cpuf16=om/blackwell/views.om,om/blackwell/scalar.om,om/blackwell/shape.om,om/blackwell/cpuf16.om bw_cpubf16=om/blackwell/views.om,om/blackwell/shape.om,om/blackwell/cpubf16.om"
164UNITS="$UNITS bw_shape=om/blackwell/views.om,om/blackwell/shape.om,om/blackwell/shape_probe.om bw_name=om/blackwell/name.om"
165PURE_UNITS="$PURE_UNITS bw_scalar=om/blackwell/scalar.om"
166if [ -z "${OMEGA_UNITS:-}" ]; then
167UNITS="$UNITS attn_args=om/api/attn_args.om"
168UNITS="$UNITS attn_lay=om/api/attn_lay.om"
169UNITS="$UNITS attn_buf=om/api/attn_buf.om"
170UNITS="$UNITS attn_math=om/api/attn_math.om"
171UNITS="$UNITS attn_tables=om/api/attn_om2.om,om/api/attn_tables.om"
172UNITS="$UNITS attn_set=om/api/attn_set.om"
173UNITS="$UNITS attn_fill=om/api/attn_fill.om"
174UNITS="$UNITS attn_fillf=om/api/attn_fillf.om"
175UNITS="$UNITS attn_count=om/api/attn_count.om"
176UNITS="$UNITS attn_cntf=om/api/attn_cntf.om"
177UNITS="$UNITS attn_bfexp=om/api/attn_bfexp.om"
178UNITS="$UNITS attn_bffin=om/api/attn_bffin.om"
179UNITS="$UNITS attn_view_any=om/api/attn_any.om"
180UNITS="$UNITS attn_comp=om/api/attn_comp.om"
181UNITS="$UNITS attn_rpois=om/api/attn_rpois.om"
182UNITS="$UNITS attn_z64=om/api/attn_z64.om"
183UNITS="$UNITS attn_bids=om/api/attn_bids.om"
184UNITS="$UNITS attn_rows=om/api/attn_rows.om"
185UNITS="$UNITS attn_gtab=om/api/attn_om2.om,om/api/attn_gtab.om"
186UNITS="$UNITS attn_range=om/api/attn_om2.om,om/components/api_at_plan.om,om/api/attn_range.om"
187UNITS="$UNITS attn_total=om/api/attn_om2.om,om/api/attn_total.om"
188UNITS="$UNITS attn_table=om/api/attn_om2.om,om/api/attn_table.om"
189UNITS="$UNITS attn_touch=om/api/attn_om2.om,om/api/attn_touch.om"
190UNITS="$UNITS attn_blks=om/api/attn_om2.om,om/components/api_at_plan.om,om/api/attn_blks.om"
191UNITS="$UNITS attn_rfit=om/api/attn_om2.om,om/components/api_at_plan.om,om/api/attn_rfit.om"
192UNITS="$UNITS attn_gath=om/api/attn_om2.om,om/api/attn_cseg.om,om/api/attn_gath.om"
193UNITS="$UNITS attn_stage=om/api/attn_om2.om,om/api/attn_cseg.om,om/api/attn_stage.om"
194UNITS="$UNITS attn_reset=om/api/attn_om2.om,om/api/attn_reset.om"
195UNITS="$UNITS attn_hmap=om/api/attn_om2.om,om/components/api_at_plan.om,om/api/attn_hmap.om"
196UNITS="$UNITS attn_eff=om/api/attn_om2.om,om/components/api_at_plan.om,om/api/attn_eff.om"
197UNITS="$UNITS attn_best=om/api/attn_om2.om,om/components/api_at_plan.om,om/api/attn_best.om"
198UNITS="$UNITS attn_max=om/api/attn_om2.om,om/api/attn_max.om"
199UNITS="$UNITS attn_ctx=om/api/attn_ctx.om"
200UNITS="$UNITS attn_ds_round=om/api/attn_om2.om,om/gemmex/num.om,om/api/attn_scalar.om,om/api/ds_round.om"
201UNITS="$UNITS attn_ds_slot=om/api/attn_om2.om,om/gemmex/num.om,om/api/attn_scalar.om,om/api/ds_slot.om"
202UNITS="$UNITS attn_ds_vecf=om/api/attn_om2.om,om/gemmex/num.om,om/api/attn_scalar.om,om/api/ds_vecf.om"
203UNITS="$UNITS attn_ds_vecb=om/api/attn_om2.om,om/gemmex/num.om,om/api/attn_scalar.om,om/api/ds_vecb.om"
204UNITS="$UNITS attn_na_read=om/api/attn_art.om,om/api/na_read.om"
205UNITS="$UNITS attn_na_cubin=om/api/attn_art.om,om/api/na_cubin.om"
206UNITS="$UNITS attn_na_layout=om/api/attn_art.om,om/api/na_layout.om"
207UNITS="$UNITS attn_na_ver=om/api/attn_art.om,om/api/na_ver.om"
208UNITS="$UNITS attn_na_json=om/api/attn_art.om,om/api/na_json.om"
209UNITS="$UNITS attn_mm_dot=om/api/attn_oracle.om,om/api/mm_dot.om"
210UNITS="$UNITS attn_mm_err=om/api/attn_oracle.om,om/api/mm_err.om"
211UNITS="$UNITS attn_mm_init=om/api/mm_init.om"
212UNITS="$UNITS attn_mm_next=om/api/mm_next.om"
213UNITS="$UNITS attn_host=om/api/attn_host.om"
214UNITS="$UNITS attn_scanchk=om/scan/scan_check.om"
215UNITS="$UNITS attn_clock=om/api/clock_ns.om"
216fi
217REST="ar_bf16=om/apiviews/bf16.om,om/apirest/bf16.om"
218for entry in fill count args argsx pad idle route perm widen next key; do
219 REST="$REST ar_$entry=om/apirest/data.om,om/apirest/$entry.om"
220done
221for entry in nan scale fold foldh acc mag; do
222 REST="$REST ar_$entry=om/apirest/pack.om,om/api/apish_pack.om,om/apirest/$entry.om"
223done
224for entry in tiles tg tile groups run; do
225 REST="$REST ar_$entry=om/apirest/tiledata.om,om/apirest/$entry.om"
226done
227for entry in tern trits rev; do
228 REST="$REST ar_$entry=om/apirest/terndata.om,om/apirest/$entry.om"
229done
230for entry in pfcopy pfratio segok segb tspec; do
231 REST="$REST ar_$entry=om/apirest/data.om,om/api/apish_shp.om,om/apirest/$entry.om"
232done
233REST="$REST ar_calc=om/apirest/calc.om ar_launch=om/apirest/launch.om ar_cache=om/apirest/cache.om"
234REST="$REST ar_tcspec=om/apirest/data.om,om/api/apish_shp.om,om/apirest/tcspec.om ar_tcperm=om/apiviews/bf16.om,om/apirest/tcperm.om ar_tcinfo=om/apirest/tcinfo.om ar_gtile=om/apirest/tiledata.om,om/apirest/gtile.om"
235REST="$REST ar_gspec=om/apirest/data.om,om/api/apish_shp.om,om/apirest/gspec.om"
236REST="$REST ar_pfcount=om/apirest/pfhost.om ar_pfreg=om/apirest/pfhost.om,om/apirest/pfreg.om"
237for entry in gargs gseg ginfo xnext gath32 gath16; do
238 REST="$REST ar_$entry=om/apirest/$entry.om"
239done
240for entry in slot sgate; do
241 REST="$REST ar_$entry=om/apirest/data.om,om/api/apish_slot.om,om/apirest/$entry.om"
242done
243REST="$REST ar_copy=om/apirest/copy.om ar_sstats=om/apirest/sstats.om"
244REST="$REST ar_victim=om/apirest/victim.om ar_mstep=om/apirest/data.om,om/api/apish_shp.om,om/apirest/mstep.om"
245REST="$REST om/codegen/cg_pack_len.om om/codegen/cg_pack_h.om om/codegen/cg_mrow.om"
246[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS $REST"
247[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS gemm_ex_policy=om/gemmex/policy.om"
248PURE_UNITS="$PURE_UNITS streams_xq=om/streams/xq.om"
249UNITS="$UNITS fixture_verify=om/codegen/fixture_verify.om"
250DEST="${OMEGA_UNITS_DEST:-$ROOT/src}"
251[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS om/codegen/cg_em.om om/codegen/cg_reconv.om om/codegen/cg_sentin.om"
252OUTS="cudapp_native.h cudapp_om_units.ident"
253OBSOLETE=
254[ -n "${OMEGA_OMC:-}" ] && [ -n "${OMEGA_BRIDGE:-}" ] || { echo "NOT_RUN: set OMEGA_OMC and OMEGA_BRIDGE"; exit 3; }
255[ "$(sha256sum < "$OMEGA_OMC" | cut -c1-64)" = "$OMC_PIN" ] || { echo "NOT_RUN: omc is not the pinned compiler"; exit 3; }
256[ "$(sha256sum < "$OMEGA_BRIDGE/src/toc.om" | cut -c1-64)" = "$CONVERTER_PIN" ] || { echo "NOT_RUN: toc.om is not the pinned converter"; exit 3; }
257[ "$(sha256sum < "$OMEGA_BRIDGE/tools/bridge-seeded" | cut -c1-64)" = "$FRONTEND_PIN" ] || { echo "NOT_RUN: bridge-seeded is not the pinned frontend"; exit 3; }
258[ "$(sha256sum < "$OMEGA_BRIDGE/src/freest.om" | cut -c1-64)" = "$FREEST_CONVERTER_PIN" ] || { echo "NOT_RUN: freest.om is not the pinned converter"; exit 3; }
259[ "$(sha256sum < "$OMEGA_BRIDGE/tools/bridge-freest" | cut -c1-64)" = "$FREEST_FRONTEND_PIN" ] || { echo "NOT_RUN: bridge-freest is not the pinned frontend"; exit 3; }
260T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
261
262cat > "$T/cudapp_native.h" <<'HEADER'
263/* Generated checked portable Omega declarations. Regenerate with om/units.sh.
264 * Status: 0 done, 1..14 trap, 32 argument refused, 33 reentry.
265 * Only a successful call writes result. Fixed views use the declared length.
266 * Runtime-extent units pass the live count under the bridge runtime-views profile.
267 * Implementation is Omega lowered by omega-bridge, not the native AArch64 ABI. */
268#ifndef CUDAPP_PORTABLE_OMEGA_H
269#define CUDAPP_PORTABLE_OMEGA_H
270#include <stdint.h>
271#ifdef __cplusplus
272extern "C" {
273#endif
274#define OMEGA_OK 0u
275#define OMEGA_BAD_ARG 32u
276#define OMEGA_REENTRY 33u
277HEADER
278: > "$T/cudapp_om_units.ident"
279[ -n "${OMEGA_UNITS:-}" ] || UNITS="$UNITS amp_qmd=om/encoder/amp_runtime.om,om/encoder/amp_qmd.om"
280for u in $UNITS $PURE_UNITS; do
281 case "$u" in
282 *=*) name=${u%%=*}; parts=${u#*=} ;;
283 *) name=$(basename "$u" .om | tr -c 'A-Za-z0-9_\n' '_'); parts=$u ;;
284 esac
285 src="$T/$name.om"
286 : > "$src"
287 old_ifs=$IFS; IFS=,
288 for part in $parts; do
289 case "$part" in /*) input=$part ;; *) input=$ROOT/$part ;; esac
290 cat "$input" >> "$src"
291 printf '\n' >> "$src"
292 done
293 IFS=$old_ifs
294 frontend=bridge-seeded
295 abi_name=bridge-seeded
296 converter_pin=$CONVERTER_PIN
297 frontend_pin=$FRONTEND_PIN
298 bridge=$OMEGA_BRIDGE
299 flags=
300 file=cudapp_om_$name.c
301 profile=
302 case "$name" in
303 regalloc|attention_ir|cg_replay|cg_life|cg_invar)
304 frontend=bridge-freest
305 abi_name=bridge-freest
306 converter_pin=$FREEST_CONVERTER_PIN
307 frontend_pin=$FREEST_FRONTEND_PIN
308 file=cudapp_freest_$name.c
309 OBSOLETE="$OBSOLETE cudapp_om_$name.c" ;;
310 revision|epoch|f16|streams_xq|c5|leftovers|bw_scalar|fixture_verify|cg_fields|core_cubinmsg|core_cubadmit|attn_host|attn_mm_dot|attn_mm_err|attn_mm_init|attn_mm_next|attn_args|attn_lay|attn_buf|attn_math|attn_tables|attn_set|attn_fill|attn_fillf|attn_count|attn_cntf|attn_bfexp|attn_bffin|attn_view_any|attn_comp|attn_rpois|attn_z64|attn_bids|attn_rows|attn_gtab|attn_range|attn_total|attn_table|attn_touch|attn_blks|attn_rfit|attn_gath|attn_stage|attn_reset|attn_hmap|attn_eff|attn_best|attn_max|attn_ctx)
311 frontend=bridge-freest
312 abi_name=bridge-freest
313 converter_pin=$FREEST_CONVERTER_PIN
314 frontend_pin=$FREEST_FRONTEND_PIN
315 file=cudapp_freest_$name.c
316 # A root has one generated implementation, shared by hosted and NO_POSIX links.
317 case "$name" in attn_*|cg_fields|core_cubinmsg|core_cubadmit) OBSOLETE="$OBSOLETE cudapp_om_$name.c" ;; esac ;;
318 av_bf16|av_widen|av_rope|av_gdnsc|av_gdnex|av_gdnpt|av_gdnut|av_fp8x|av_fp8xb|ar_carry|bw_cpui|bw_cpuf16|bw_cpubf16|bw_shape|bw_name|model_graph_table|graph_headscale)
319 flags=--runtime-views
320 abi_name=bridge-seeded-runtime ;;
321 attn_ds_*|attn_na_*|attn_scanchk)
322 flags=--runtime-views
323 abi_name=bridge-seeded-runtime ;;
324 ar_*|cg_pack_h|cg_mrow|cg_sentin|nvrm_struct|nvrm_uvm_wire|nvrm_uvm_map_wire|nvrm_va|nvrm_counts|nvrm_alloc_push)
325 flags=--runtime-views
326 abi_name=bridge-seeded-runtime ;;
327 esac
328 printf 'generating portable unit %s (%s%s)\n' "$name" "$frontend" "$flags" >&2
329 OMEGA_SEEDED_OMC="$OMEGA_OMC" sh "$bridge/tools/$frontend" $flags c "$src" > "$T/$file"
330 OMEGA_SEEDED_OMC="$OMEGA_OMC" sh "$bridge/tools/$frontend" $flags h "$src" >> "$T/cudapp_native.h"
331 identity="omega-ident 2 unit=$name abi=$abi_name src=$(sha256sum < "$src" | cut -c1-64) c=$(sha256sum < "$T/$file" | cut -c1-64) omc=$OMC_PIN converter=$converter_pin frontend=$frontend_pin path=$u"
332 printf '%s\n' "$identity" > "$T/cudapp_om_$name.ident"
333 printf '%s\n' "$identity" >> "$T/cudapp_om_units.ident"
334 OUTS="$OUTS $file cudapp_om_$name.ident"
335done
336cat >> "$T/cudapp_native.h" <<'HEADER'
337#ifdef __cplusplus
338}
339#endif
340#endif
341HEADER
342# NO_POSIX (om/no-posix.sh) composes a fixed set of roots, whatever OMEGA_UNITS selects: a selective run (the .om mutant
343# scripts) stays selective and leaves it alone, and a full run works in this run's own $T. A shared build/no_posix_regen
344# let the mutant scripts of a parallel make test rewrite one another's tools/omc-gen and om/no-posix/gen while another
345# ran them (native-x86-host on 630e119b: test-gpu-dnn-rows-mutants stopped inside om/units.sh).
346if [ "${1:-}" = --check ]; then
347 bad=0
348 for f in $OUTS; do cmp -s "$T/$f" "$DEST/$f" || { echo "FAIL $DEST/$f differs from pinned tools"; bad=1; }; done
349 for f in $OBSOLETE; do [ ! -e "$DEST/$f" ] || { echo "FAIL obsolete $DEST/$f remains"; bad=1; }; done
350 [ "$bad" = 0 ] || exit 1
351 [ -n "${OMEGA_UNITS:-}" ] || sh "$ROOT/om/no-posix.sh" --check "$T/no_posix_regen"
352 echo "PASS portable Omega units regenerate byte for byte"; exit 0
353fi
354for f in $OUTS; do cp "$T/$f" "$DEST/$f"; done
355for f in $OBSOLETE; do rm -f "$DEST/$f"; done
356[ -n "${OMEGA_UNITS:-}" ] || sh "$ROOT/om/no-posix.sh" --generate "$T/no_posix_regen"
357echo "wrote checked portable Omega units to $DEST"