diff --git a/om/components/.crumb b/om/components/.crumb new file mode 100644 index 00000000..9f81cd5d --- /dev/null +++ b/om/components/.crumb @@ -0,0 +1,19 @@ +{ + "extensions": { + "generated": { + "children": [], + "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "compiled_at": "2026-10-28T16:54:45Z", + "compiler": "crumb-compile/1", + "digest": "sha256:ef89d3db8fa30dee0a75375d1cbcee153387bce9aa19018f2e9f599add562a31", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 12, + "generated_at_commit": "2198c509a5591fa09487e1d30f11447c719d9f98", + "source_tree": "sha256:6ad60ff7ee2ab0445ca4665dc2384bcc51b5ca5da78ff993e751237808cb5ca0" + } + }, + "name": "components", + "purpose": "Typed unsolved Blackwell IR components and canonical realization records", + "schema_version": "1.0.0" +} diff --git a/om/components/README.md b/om/components/README.md new file mode 100644 index 00000000..2b179287 --- /dev/null +++ b/om/components/README.md @@ -0,0 +1,78 @@ +# Native Blackwell components (CUDApp #157) + +## Implementation and integration boundary + +All production component generation, effects, interval construction, global linear-scan allocation and serialization are seeded Omega. The eight-cell unsolved instruction layout is the existing `BlackwellIRProgram` encoder bridge layout, not another IR. No solved instruction bytes are embedded in components. + +Concatenate `bw_alloc.om`, `bw_effect.om`, `bw_check.om`, `bw_project.om`, `rowpipe.om`, `staged.om`, then `compose.om`. `bc_compose(cfg16, ins8192, metadata2048, phys288, out8) -> uint` generates the complete unsolved program, validates operands/bundles/branches/resources, then invokes one global allocation with the existing GPR limit. No component allocates physical registers. Effects are resolved over one continuous emission state, including load read barriers, held prefetch scoreboards, predicates and reconvergence. The existing relative branch patching and loop-lifetime extension are retained. + +`cfg` words: family (1 direct, 2 rowpipe, 3 staged), K, lane bytes, rows/MT, warps, component selection (direct weight-first, staged rowmap, rowpipe zero), mutant zero, remaining words zero. Output words: instruction count, required GPR extent, required UGPR extent, required shared bytes, virtual GPR count, virtual UGPR count, zero, zero. A nonzero return must never be consumed as a realization. + +`bc_project` and `bc_rowpipe` accept eight-word generator specs; `bc_staged` accepts sixteen words. Their outputs remain unsolved and use the same width/alias/lane namespace. Metadata stores widths at0, first/last intervals at288/576, allocation at864, active scratch at1152, stable order at1440. Direct folded-E4M3 decode preserves the existing multiply/shift/sign-bit method; the final byte uses a right shift, not a fabricated integer interpretation of a fractional scale. `bc_mma` checks the existing BF16 HMMA bundle contract and reader-spacing instructions; the migrated FP8 kernels deliberately retain their original FFMA arithmetic, not an unqualified tensor-core replacement. + +After allocation concatenate the unchanged repaired function-mode encoder and semantic spec from [CUDApp revision1c5a8398d93b49e6765c2e3752aaad8611027d0d](https://github.com/aien-dev/CUDApp/commit/1c5a8398d93b49e6765c2e3752aaad8611027d0d), draft dependency [#168](https://github.com/aien-dev/CUDApp/pull/168), then `encode.om`. Each `bc_encode` invocation owns one zero-initialized3001-word spec workspace, reused for all instructions. It emits only words returned by checked `sp_enc`; padding is a semantic NOP encoded through that same checker, never pasted machine bytes or a second permissive emission. The standalone spec driver is no longer part of the unit. Direct/staged callers compare padded output; rowpipe compares the complete unpadded output. + +Main's integration owner alone changes shared registration, generated bridges, public headers, runtime caller selection and cache/graph consumption. Export roots and types above are the integration patch contract; these files do not create another host emitter or silently select a C fallback. The C source is used only as an independent migration oracle here. QuantSchema dependency is fe25929ce71b11703eafa72395df2dd495aa61f2. The production compiler SHA256 remains2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f. + +## Exercised host evidence + +The permanent conductor is seeded Omega: `tests/components/proc.om`, `cases.om` and `run.om`. It handles process execution, exact I/O, source concatenation, case selection, refusals and receipt serialization; no Python or shell program implements those paths. Bootstrap and run it from the repository root using the pinned compiler and explicit verification-tool paths: + +```sh +mkdir -p build/components +cat tests/components/proc.om tests/components/cases.om tests/components/run.om | + "$OMEGA_OMC" > build/components/conductor +chmod +x build/components/conductor +build/components/conductor "$OMEGA_OMC" "$COMPONENT_ENCODER_DIR" \ + "$(command -v nvdisasm)" "$(command -v cc)" "$(command -v sha256sum)" \ + "$COMPONENT_QUANT_SOURCE" +``` + +The conductor checks the compiler, repaired encoder/spec and exact QuantSchema source pins and uses no GPU. Set `COMPONENT_QUANT_SOURCE` to `om/quant/quant.om` from QuantSchema revision `fe25929ce71b11703eafa72395df2dd495aa61f2` (SHA256 `44bce96f3c274401e19a71b835814d69caf2bea8c2b1f4f43616c7c121232f09`). `build/components/receipt.json` is complete only after all checks pass and the conductor exits0; any nonzero exit may leave a partial receipt and is not PASS. It exercises the actual composer root for direct, changed direct component, rowpipe, dense staged and mapped staged generation, plus refusal. Complete frame comparisons cover generation statistics, every virtual width, physical allocation, every existing IR cell and the entire encoded kernel. Independent nvdisasm decodes every emitted instruction. `tests/components/host-receipt.json` records eight direct, fourteen rowpipe and six staged cases, complete numerical transcripts and source/tool identities. Staged cases cover emitted K-step unroll U1/U2/U3, compare fresh composer statistics with the independent original-C frame, exercise canonical/launch/config/result structural refusals, accept legal resource overdeclaration and require a concrete removed-GPR-headroom checker mutant to fail the native test with exit70. Other negative controls retain SB_B/SB_RD/branch reference mutations, truncated/oversized framing, resource exhaustion and typed component refusals. The pinned Omega MCP lookup, compile, run and explain_error tools were used for assistance; compilation alone is not behavior evidence. + +Every native frame also runs through the existing `sim_gemv`/`parity` or `sim_point2` numerical seams. `numerical.c` replaces only the generator callback with deserialization of the actual Omega-produced instruction/allocation frame; it does not implement an interpreter, data generator, packing routine or reference arithmetic. Direct/rowpipe cover distinct experts and activation rows against the existing double oracle. Dense/mapped staged cover both fragment orders, multiple segments, an empty segment, tail rows and actual YMAP movement, bit-identical to the existing emulation. Every case additionally runs an FFMA-to-FADD wrong-result mutant which must execute successfully yet disagree numerically, and an unknown-op mutant which must retain the existing simulator refusal. The base simulator now permits an explicit `WS_MAX_THREADS` configuration, matching the existing `_k` simulator; its default and opcode semantics are unchanged. + +`tests/components/wolfram.json` preserves Main's mounted Wolfram query/result for exact decode/control constants. In particular, the final byte's modeled scale is exactly1/16, and the migrated existing algorithm explicitly uses its source right-shift operation. The verifier tools were nvdisasm CUDA13.0 V13.0.85 and cc Ubuntu13.3.0-6ubuntu2~24.04.1. They are read-only qualification oracles, not production dependencies. + +## Not qualified or integrated by this lane + +Independent numerical execution of every native-produced IR/allocation frame is HOST PASS, including the changed weight-first component and dense/mapped staged configurations. The reused oracle seams are `gpu_fp8_api_test.c` (`sim_gemv`, `parity`) and `gpu_fp8gemm_test.c` (`sim_point2`). This evidence is independent of C-byte parity. Family3 now has strict canonical and launch structural admission derived from the implemented generator, plus `bc_record` binding checks; this does not grant qualification, production registration or physical admission. Shared integration must bind actual retained artifacts and preserve every independent qualification gate. + +Physical whole-model projection/grouped execution, changed-component numerical behavior on GB10, actual launch-template binding, independent device numerical oracle, pipeline/window/VRAM/resource qualification, graph replay and representative large-M latency are NOT_RUN. No GPU authorization or reservation was granted. No device, model, service, driver, firmware, merge or deployment was touched. A host PASS is not hardware qualification. CUDApp #157 remains open; these components are implemented and host exercised, not the complete physical acceptance of #26. + +## Canonical tile and resource scope + +Words14/15/16 are the **per-warp** logical output tile M, output tile N, and K-step. Direct/rowpipe use (1, rows, 32*lane_bytes); staged uses (MT,1,32*lane_bytes). This is source-grounded by `omega_blackwell_codegen_gemm.h`12 (one weight row per warp, MT accumulators) and32 (CTA spans warps weight rows). Word17 separately records the CTA warp count. No inferred alternative staged NI formula is authoritative. + +Realization resources are actual declared launch resources, not merely generator minima: the current legacy QMD builder rounds GPRs and uses shared1024 when a zero request is supplied. A bound canonical record must describe the actual resulting declaration (including padding), independently dominate the emitted requirements and agree with the actual template. Never silently reinterpret a canonical shared0 as1024. UGPR is the required code/ABI extent, not permission to invent a configurable QMD field. `fixture.om` contains synthetic nonzero digest sentinels for schema tests only; it cannot establish artifact admission or hardware safety. + +Family3 structural checks mirror `sg_valid`: K<=16384 divisible by tileK256/512; MT1/2/4/8, tileN1; power-of-two warps<=32; integral MT*laneBytes/warps<=8; shared requirement MT*128*laneBytes<=16384; odd K-step counts only1/3, otherwise emitted unroll U2. Word18 is this **emitted K-step unroll U**, not shared-buffer count or a physical pipeline-depth claim. Family3 declares seven non-MMA component IDs, UGPR6, one barrier, shared128-byte alignment, GPR eight-register alignment, gridZ1 and uint32 grid/stride product bounds. The existing threads*declaredGPR<=65536 bound remains unchanged. + +`bc_record(cfg view ulong16,b view uchar4096,l view ulong32,actual view ulong8)->uint` in `admit.om` adds staged config/canonical/ABI/result structural consistency. Concatenate after the existing composer, QuantSchema and `realize.om`. It requires a fresh successful `bc_compose` result, physicalGPR<=128, virtualGPR1..256, physicalUGPR6/virtualUGPR1, instruction count1..1024, exact emitted shared requirement, zero reserved result/config words, declared shared>=required and **declaredGPR>=actualPhysicalGPR+2**, preserving `omega_bw_gpr_declared_ok` rather than weakening the chip-derived guard. Actual declared GPRs may exceed128 if the existing CTA resource bound permits;128 is the allocator limit, not a declaration cap. Legal shared/GPR padding is retained. + +The eight result counters are **not an authenticated witness**: these functions cannot prove they came from the same retained IR/allocation/code buffers or that digests are true. The integrating caller must generate/check/hash/consume the same snapshots; bind actual K/MT/LB/warps/rowmap config, instruction/allocation/code bytes, parameter ABI, immutable constant bank and QMD; verify actual constant-bank N and stride=gridX*warps, segment/map extents, alias/disjointness and uint32 loop progress; and retain exact-candidate qualification. Opaque component IDs and compatibility hashes do not establish lineage or safety. + +# Composer canonical realization v1 +Owner KernelCompose. CUDApp source baseline [b759afc3f5e46f152ffb06b39882ffa28cacaf96](https://github.com/aien-dev/CUDApp/tree/b759afc3f5e46f152ffb06b39882ffa28cacaf96). Source [om/components/realize.om](https://github.com/aien-dev/CUDApp/blob/2e93f998b70852abcd425f8865d842a05dad76ea/om/components/realize.om) concatenates after QuantSchema `quant.om`. Fixed layout review corrections cover cross-fields, padding, launch consistency and executable admission. Local handoff paths are intentionally absent from this public contract. + +Capacity uchar4096, exactly1152 used bytes, remaining bytes zero. Every integer serialized fieldwise little-endian u64, no struct padding. Metadata words0..63 at bytes0..511. Eight SHA256 digests at512..767 ordered semantic/compiler/encoder-source/spec/unsolvedIR/code/launch/lineage. Each digest must not be all-zero. Exact QuantSchema wire384 at768..1151; quant_read AND quant_check required. + +Metadata:0version1;1used1152;2SM121;3feature mask0(noTMA/TMEM);4M5N6K;7inputtype1F32;8weighttype3E4M3;9outputtype1F32;10accumtype1F32;11numerical contract1folded E4M3;12tails0;13alias0(disjoint);14tileM15tileN16tileK17warps18stages(for family3: emitted K-step unroll U)19pipeline(1direct2rowpipelined3staged);20effects mask<=127;21sharedbytes22GPR23UGPR24barriers25threads(32*warps);26gridX27gridY28gridZ;29nonzero component count;30..37component IDs load/dequant/mma/accumulate/epilogue/sync/prologue/schedule, zero absent;38..63reserved0. + +API compose_check(b view uchar4096,n ulong)->uint:0valid,1malformed/canonicality,2unsupported,3resources,4quant. compose_word(b,k)->ulong accessor. compose_put(b edit,k,v) writer. compose_codeid(b,h view uchar32)->bool and compose_launchid compare digest bytes only, not hash actual inputs. compose_match(a,b)->bool validates both then compares metadata2..13,semantic/compiler/encoder/spec digests and complete QuantSchema384; permits tuning/resources/component/code/launch differences. Match is conservative compatibility, never qualification/admission. It includes quant chunk offsets/extents; nonmatch is not proof of semantic incompatibility. + +Code digest SHA256 exact final instruction bytes including deterministic padding. UnsolvedIR digest SHA256 exact existing8-LE64-cell instruction serializer for used instructions. Lineage SHA256 ordered component-source preimage; IDs are indexes only. Semantic digest is frozen operation contract artifact content. Compiler/encoder/spec digests exact pinned source/binary identities as named. Launch digest SHA256 exact256-byte canonical LE64 launch preimage; this preimage embeds the parameter-ABI, immutable constant-bank and zero-VA QMD template SHA256 digests, so each external artifact is independently content-bound without an ambiguous concatenation. Existing omega-native-artifact/1 remains the authoritative full manifest identity; this is not a replacement manifest. + +compose_launch(b,l view ulong32)->uint checks declarations against launch metadata: words0version1;1gridX2gridY3gridZ;4blockX5blockY=1,6blockZ=1;7shared8GPR9UGPR10barriers;11cbankOffset12argWords(1..32, counts32-bit constant-bank template words, not64-bit parameters)13paramABI=1,14relocationPolicy=1(addressfree);15..18parameter-ABI SHA256 LE64 limbs,19..22constant-bank-template SHA256 limbs,23..26zero-VA QMD-template SHA256 limbs,27..31reserved0. Each embedded digest must be nonzero. compose_launchwrite(l,wire edit uchar4096) serializes exactly256 bytes and zeroes unused capacity; compose_launchread(b,wire,n) requires n256 and zero capacity padding and checks metadata. Hash equality alone never proves consistency. Full loader must verify embedded hashes against actual templates/ABI, validate QMD zero-VA and resources, and validate actual addresses/alias/alignment; source-content identity external to QuantSchema is mandatory. compose_quant/compose_setquant are sole-owner384-byte descriptor accessors. + +Family3 additionally requires launchword11=896 and launchword12=8 for dense or12 for mapped. Mapped MT is at most4. `bc_record` binds this choice to cfgword5, preventing a dense/mapped ABI substitution without adding a second rowmap wire field. Source authority is `sg_prologue` and `omega_blackwell_codegen_gemm.h`; the wire layout and version are unchanged. + +Launch sub-preimages use existing admitted artifact bytes, not a parallel metadata format: + +- Parameter ABI: the unique target `.nv.info.` section's exact contiguous prefix, from the leading attribute0x37 through all KPARAM_INFO0x17 records, parameter-size0x19 and the complete PARAM_CBANK0x0a record, stopping before resource attributes. Existing authority is `om/cubin/cubin_elf.om` (`wpar` and the first16 bytes of `wtail`) and `src/omega_cubin.c`. A strict parser must check ELF bounds/linkage, record order, formats, lengths, supported values and uniqueness. Attribute0x19 is format3: its following16-bit field is a value, not a payload length. +- Constant bank: exact `.cbank_args.bin` template bytes, whose length must equal four times launchword12. +- Zero-VA QMD: exact `.qmd0.bin` bytes followed immediately by exact `.qmd1.bin` bytes; each contains exactly96 existing32-bit words. Neither may contain live device addresses. Do not concatenate hexadecimal hashes or normalize addresses before hashing. + +Compute hashes, cross-field checks and consumption from the same admitted snapshots, not separately reopened files. The ABI prefix is not an injective description of arbitrary exporter-supported scalar sizes: a nonfinal scalar size can change without changing the serialized prefix. Admission must therefore separately enforce the exact family-specific typed argument sizes, offsets, count and extent; hashes do not establish this restriction. Family3 has three64-bit pointers at896/904/912, N32 at920 and stride32 at924; mapped adds64-bit XMAP928 and YMAP936. A generic typed64-only admission rule does not admit this mixed-width ABI. Constant-bank32-bit word count is not parameter count. These are required integration conditions, not a claim that this lane exercised the shared loader. + +Native/host implementation does NOT grant hardware qualification, service activation or GPU authority. Cache hashes exact1152 bytes, uses codeid/launchid accessors, and independently binds blobs. Selector admits each exact candidate qualification with effects/resources/costs; no inheritance across compose_match. diff --git a/om/components/admit.om b/om/components/admit.om new file mode 100644 index 00000000..1935062e --- /dev/null +++ b/om/components/admit.om @@ -0,0 +1,59 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Concatenate after staged.om, compose.om, quant.om and realize.om. +note Structural binding ONLY: out8 must be fresh successful bc_compose output. +note No proof of freshness, code identity, qualification, maps or device safety here. +fn bc_record cfg view ulong 16 b view uchar 4096 l view ulong 32 actual view ulong 8 to uint +spec = new ulong 16 0 +if ne compose_launch b l 0 +ret 1 +end +if or ne get cfg 0 3 ne compose_word b 19 3 +ret 2 +end +for k ulong 10 +if ne get cfg add k 6 0 +ret 2 +end +end +for k ulong 5 +put spec k get cfg add k 1 +end +if not sg_valid spec +ret 2 +end +if or ne get cfg 1 compose_word b 6 ne mul get cfg 2 32 compose_word b 16 +ret 2 +end +if or ne get cfg 3 compose_word b 14 ne get cfg 4 compose_word b 17 +ret 2 +end +if ne get l 12 add ulong 8 mul get cfg 5 4 +ret 2 +end +if or eq get actual 0 0 gt get actual 0 1024 +ret 3 +end +if or lt get actual 1 3 gt get actual 1 128 +ret 3 +end +if or eq get actual 4 0 gt get actual 4 256 +ret 3 +end +if or ne get actual 2 6 ne get actual 5 1 +ret 3 +end +if or ne get actual 6 0 ne get actual 7 0 +ret 3 +end +if ne get actual 3 mul mul get cfg 3 128 get cfg 2 +ret 3 +end +if gt get actual 3 compose_word b 21 +ret 3 +end +note Preserve omega_bw_gpr_declared_ok: multiple8 AND declaration at least peak+2. +if lt compose_word b 22 add get actual 1 2 +ret 3 +end +ret 0 +end diff --git a/om/components/bw_alloc.om b/om/components/bw_alloc.om new file mode 100644 index 00000000..dcc1fc33 --- /dev/null +++ b/om/components/bw_alloc.om @@ -0,0 +1,200 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Native migration of omega_bw_ir_append/regalloc_solve at CUDApp b759afc3. +note Existing BlackwellIR serializer unchanged:8ulong/insn,1024insn,256GPR+32UGPR. +note meta2048: widths0..287,first288..575,last576..863,phys864..1151, +note active1152..1439,order1440..1695. Unallocated width0; no pointer identity. +const BCNONE ulong 18446744073709551615 +fn bc_touch m edit ulong 2048 v ulong at ulong to void +if eq get m add v 288 BCNONE +put m add v 288 at +end +put m add v 576 at +end +fn bc_intervals ins view ulong 8192 n ulong m edit ulong 2048 to uint +for v ulong 288 +put m add v 288 BCNONE +put m add v 576 BCNONE +put m add v 1152 0 +end +for i ulong n +b = mul i 8 +f = get ins add b 7 +for k ulong 5 +v = get ins add add b k 1 +if ne v BCNONE +u = ulong 0 +if eq k 4 +u = 256 +else +if and eq k 0 ne and f 1 0 +u = 256 +end +end +if ge v sub ulong 288 u +ret 1 +end +v = add v u +if eq get m v 0 +ret 1 +end +bc_touch m v i +end +end +end +note Explicit loop extension: every backward BRA extends loop-carried intervals. +for i ulong n +if eq get ins mul i 8 46 +raw = and get ins add mul i 8 6 4294967295 +if ge raw 2147483648 +delta = sub ulong 4294967296 raw +if gt delta i +ret 1 +end +start = sub i delta +for v ulong 256 +first = get m add v 288 +last = get m add v 576 +if ne first BCNONE +if and lt first start ge last start +if lt last i +put m add v 576 i +end +end +end +end +end +end +end +ret 0 +end +fn bc_release m edit ulong 2048 busy edit uchar 246 first ulong lim ulong to void +for v ulong 256 +if ne get m add v 1152 0 +if lt get m add v 576 first +p = get m add v 864 +for k ulong get m v +if lt add p k lim +put busy add p k 0 +end +end +put m add v 1152 0 +end +end +end +end +fn bc_find busy view uchar 246 width ulong lim ulong to ulong +for p ulong lim +if ge p 2 +if eq rem p width 0 +if le add p width lim +ok = true +for k ulong width +if ne get busy add p k 0 +ok = false +end +end +if ok +ret p +end +end +end +end +end +ret BCNONE +end +fn bc_allocate m edit ulong 2048 phys edit ulong 288 lim ulong to ulong +busy = new uchar 246 0 +count = ulong 0 +peak = ulong 2 +for v ulong 256 +if ne get m v 0 +if ne get m add v 288 BCNONE +put m add count 1440 v +count = add count 1 +else +put phys v 2 +end +end +end +note Preserve the reference's exact deterministic pairwise sort, including ties. +for i ulong count +for j ulong count +if gt j i +a = get m add i 1440 +b = get m add j 1440 +if gt get m add a 288 get m add b 288 +put m add i 1440 b +put m add j 1440 a +end +end +end +end +for i ulong count +v = get m add i 1440 +bc_release m busy get m add v 288 lim +w = get m v +p = bc_find busy w lim +if eq p BCNONE +ret 0 +end +for k ulong w +put busy add p k 1 +end +put m add v 864 p +put m add v 1152 1 +put phys v p +top = sub add p w 1 +if gt top peak +peak = top +end +end +ret add peak 1 +end +fn bc_regalloc ins view ulong 8192 n ulong m edit ulong 2048 phys edit ulong 288 stats edit ulong 4 lim ulong to uint +if or eq n 0 gt n 1024 +ret 1 +end +if or lt lim 3 gt lim 246 +ret 1 +end +for v ulong 288 +w = get m v +if and ne w 0 and ne w 1 and ne w 2 ne w 4 +ret 1 +end +if and ge v 256 gt w 2 +ret 1 +end +put phys v BCNONE +end +rc = bc_intervals ins n m +if ne rc 0 +ret rc +end +peak = bc_allocate m phys lim +if eq peak 0 +ret 2 +end +cur = ulong 4 +for uv ulong 32 +v = add uv 256 +w = get m v +if ne w 0 +if eq w 2 +if ne rem cur 2 0 +cur = add cur 1 +end +end +if gt add cur w 32 +ret 2 +end +put phys v cur +cur = add cur w +end +end +put stats 0 n +put stats 1 peak +put stats 2 cur +put stats 3 0 +ret 0 +end diff --git a/om/components/bw_check.om b/om/components/bw_check.om new file mode 100644 index 00000000..336d1c80 --- /dev/null +++ b/om/components/bw_check.om @@ -0,0 +1,142 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Validate the existing IR, never translate to a second representation. +fn bc_width m view ulong 2048 reg ulong width ulong to bool +if ge reg 256 +ret false +end +ret eq get m reg width +end +fn bc_regcheck ins view ulong 8192 base ulong m view ulong 2048 to uint +op = get ins base +flags = get ins add base 7 +if gt op 59 +ret 1 +end +if ne shr flags 48 0 +ret 1 +end +for k ulong 4 +v = get ins add add base 1 k +if ne v BCNONE +if and eq k 0 ne and flags 1 0 +if ge v 32 +ret 2 +end +v = add v 256 +else +if ge v 256 +ret 2 +end +end +width = get m v +if eq width 0 +ret 2 +end +subreg = and shr flags add ulong 16 mul k 8 255 +if ge subreg width +ret 2 +end +end +end +u = get ins add base 5 +if ne u BCNONE +if ge u 32 +ret 2 +end +if eq get m add u 256 0 +ret 2 +end +end +ret 0 +end +fn bc_type ins view ulong 8192 base ulong m view ulong 2048 to uint +op = get ins base +d = get ins add base 1 +a = get ins add base 2 +b = get ins add base 3 +c = get ins add base 4 +if or eq op 56 eq op 57 +width = ulong 2 +if eq op 57 +width = 4 +end +if or eq bc_width m d width false eq bc_width m a 2 false +ret 3 +end +if eq d a +ret 3 +end +end +if eq op 11 +note Scalar loads/stores may select one lane of a live pair/quad; bc_regcheck checks subreg bounds. +if or eq d BCNONE eq bc_width m a 2 false +ret 3 +end +end +if eq op 12 +if or eq bc_width m a 2 false eq b BCNONE +ret 3 +end +end +if eq op 16 +if or eq bc_width m d 4 false eq bc_width m a 4 false +ret 3 +end +if eq bc_width m b 2 false +ret 3 +end +if and ne c BCNONE eq bc_width m c 4 false +ret 3 +end +end +ret 0 +end +fn bc_ctrlcheck ins view ulong 8192 i ulong n ulong to uint +base = mul i 8 +op = get ins base +if or eq op 46 eq op 54 +raw = and get ins add base 6 4294967295 +target = add i raw +if ge raw 2147483648 +target = sub i sub ulong 4294967296 raw +end +if ge target n +ret 4 +end +if and eq op 54 le target i +ret 4 +end +end +if or eq op 11 or eq op 56 eq op 57 +ctrl = shr get ins add base 6 32 +if ne and shr ctrl 17 7 1 +ret 5 +end +wb = and shr ctrl 14 7 +if and ne wb 0 and ne wb 3 ne wb 4 +ret 5 +end +end +ret 0 +end +fn bc_ircheck ins view ulong 8192 n ulong m view ulong 2048 to uint +if or eq n 0 gt n 1024 +ret 1 +end +for i ulong n +base = mul i 8 +rc = bc_regcheck ins base m +if ne rc 0 +ret rc +end +rc = bc_type ins base m +if ne rc 0 +ret rc +end +rc = bc_ctrlcheck ins i n +if ne rc 0 +ret rc +end +end +ret 0 +end diff --git a/om/components/bw_effect.om b/om/components/bw_effect.om new file mode 100644 index 00000000..c30bf583 --- /dev/null +++ b/om/components/bw_effect.om @@ -0,0 +1,197 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Concatenate after bw_alloc.om. No second IR: st16..23 is one existing8cell instruction. +note st0 count,1pending,2held,3error,4nv,5nu; st8..15 temporary component args. +fn bc_node s edit ulong 64 op ulong d ulong a ulong b ulong c ulong to void +put s 16 op +put s 17 d +put s 18 a +put s 19 b +put s 20 c +put s 21 BCNONE +put s 22 0 +put s 23 0 +end +fn bc_vreg s edit ulong 64 m edit ulong 2048 width ulong uniform bool to ulong +k = ulong 4 +base = ulong 0 +cap = ulong 256 +if uniform +k = 5 +base = 256 +cap = 32 +end +v = get s k +if ge v cap +put s 3 1 +ret BCNONE +end +put s k add v 1 +put m add base v width +ret v +end +fn bc_control stall ulong wb ulong rbar ulong wait ulong yield bool to ulong +v = or or shl stall 9 shl wb 14 or shl rbar 17 shl wait 20 +if yield +v = or v 8192 +end +ret v +end +fn bc_append ins edit ulong 8192 s edit ulong 64 to void +for k ulong 8 +put ins add mul get s 0 8 k get s add k 16 +end +put s 0 add get s 0 1 +end +fn bc_emit ins edit ulong 8192 s edit ulong 64 kind ulong to void +if ge get s 0 1024 +put s 3 1 +ret +end +wait = get s 1 +stall = ulong 6 +wb = ulong 7 +rbar = ulong 7 +yld = false +next = ulong 0 +if eq kind 1 +stall = 14 +end +if or eq kind 2 eq kind 3 +stall = 4 +wb = 0 +rbar = 1 +yld = true +next = 3 +if eq kind 3 +wait = and wait 2 +end +end +if eq kind 4 +stall = 4 +wb = 2 +yld = true +next = 4 +end +if eq kind 5 +stall = 4 +rbar = 1 +yld = true +next = 2 +end +if or eq kind 7 eq kind 8 +stall = 5 +if ne and get s 23 2 0 +next = wait +end +end +if eq kind 9 +stall = 1 +yld = true +end +if eq kind 10 +stall = 5 +yld = true +end +note kind11/12 SB_B prefetch,13 first takeover; pending never carries SB_B. +if or eq kind 11 eq kind 12 +stall = 4 +wb = 3 +rbar = 1 +yld = true +next = 2 +put s 2 or get s 2 8 +if eq kind 12 +wait = and wait 2 +end +end +if eq kind 13 +if eq and get s 2 8 0 +put s 3 1 +ret +end +wait = or wait 8 +put s 2 xor get s 2 8 +end +if gt kind 13 +put s 3 1 +ret +end +stall = bc_control stall wb rbar wait yld +put s 22 or and get s 22 4294967295 shl stall 32 +put s 1 next +bc_append ins s +end +fn bc_inst ins edit ulong 8192 s edit ulong 64 op ulong d ulong a ulong imm ulong to void +bc_node s op d a BCNONE BCNONE +put s 22 imm +bc_emit ins s 0 +end +fn bc_imad ins edit ulong 8192 s edit ulong 64 op ulong d ulong a ulong c ulong to void +bc_node s op d a BCNONE c +put s 22 get s 8 +put s 23 shl get s 9 24 +bc_emit ins s 0 +end +fn bc_mem ins edit ulong 8192 s edit ulong 64 op ulong d ulong a ulong kind ulong to void +bc_node s op d a BCNONE BCNONE +put s 21 0 +put s 22 get s 8 +bc_emit ins s kind +end +fn bc_ffma ins edit ulong 8192 s edit ulong 64 d ulong a ulong b ulong c ulong to void +bc_node s 33 d a b c +put s 23 shl get s 9 32 +bc_emit ins s 0 +end +fn bc_pred ins edit ulong 8192 s edit ulong 64 a ulong b ulong to void +bc_node s 28 BCNONE a b BCNONE +bc_emit ins s 1 +end +fn bc_branch ins edit ulong 8192 s edit ulong 64 target ulong ispred bool to ulong +at = get s 0 +bc_node s 46 BCNONE BCNONE BCNONE BCNONE +put s 22 and sub target at 4294967295 +if ispred +put s 23 2 +end +bc_emit ins s 8 +ret at +end +fn bc_patch ins edit ulong 8192 at ulong target ulong to void +k = add mul at 8 6 +put ins k or shl shr get ins k 32 32 and sub target at 4294967295 +end +note Typed HMMA component: BF16 A quad,B pair,C/D quads; no raw solved bytes. +note Component includes existing hmma_wait15+nop14 spacing before any external reader. +fn bc_mma ins edit ulong 8192 s edit ulong 64 m view ulong 2048 args view ulong 4 to uint +for j ulong 4 +if ge get args j 256 +ret 1 +end +end +if or ne get m get args 0 4 ne get m get args 1 4 +ret 1 +end +if or ne get m get args 2 2 ne get m get args 3 4 +ret 1 +end +if gt get s 0 1021 +ret 1 +end +bc_node s 16 get args 0 get args 1 get args 2 get args 3 +put s 22 shl bc_control 8 7 7 get s 1 false 32 +put s 1 0 +if ge get s 0 1024 +ret 1 +end +for j ulong 8 +put ins add mul get s 0 8 j get s add j 16 +end +put s 0 add get s 0 1 +for k ulong 2 +bc_node s 0 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 0 +put ins add mul sub get s 0 1 8 6 shl bc_control sub ulong 15 k 7 7 0 false 32 +end +ret 0 +end diff --git a/om/components/bw_project.om b/om/components/bw_project.om new file mode 100644 index 00000000..c52f58a2 --- /dev/null +++ b/om/components/bw_project.om @@ -0,0 +1,304 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Port of existing nondeep OmegaFp8GemvSpec sched0 coal0 at b759afc3. +note spec8:K,laneBytes,rows,warps,load-order component(0X-first/1W-first),reserved0. +note Mutants are never accepted production specs. No solved bytes or second IR. +fn bc_log v ulong to ulong +for i ulong 32 +if eq shl ulong 1 i v +ret i +end +end +ret BCNONE +end +fn bc_imm ins edit ulong 8192 s edit ulong 64 d ulong a ulong c ulong imm ulong to void +put s 8 imm +put s 9 0 +bc_imad ins s 8 d a c +end +fn bc_wide ins edit ulong 8192 s edit ulong 64 d ulong a ulong c ulong imm ulong to void +put s 8 imm +put s 9 0 +bc_imad ins s 9 d a c +end +fn bc_shift ins edit ulong 8192 s edit ulong 64 d ulong a ulong subreg ulong amount ulong to void +bc_node s 17 d a BCNONE BCNONE +put s 22 amount +put s 23 shl subreg 24 +bc_emit ins s 0 +end +fn bc_mask ins edit ulong 8192 s edit ulong 64 d ulong a ulong subreg ulong mask ulong to void +bc_node s 18 d a BCNONE BCNONE +put s 22 mask +put s 23 shl subreg 24 +bc_emit ins s 0 +end +fn bc_initregs m edit ulong 2048 s edit ulong 64 r edit ulong 64 to void +uv = bc_vreg s m 2 true +for k ulong 31 +width = ulong 1 +if or lt k 3 and ge k 14 le k 16 +width = 2 +end +if or and ge k 18 le k 20 and ge k 24 le k 28 +width = 2 +end +put r k bc_vreg s m width false +end +for row ulong get s 34 +put r add 32 mul row 2 bc_vreg s m 1 false +put r add 33 mul row 2 bc_vreg s m div get s 33 4 false +end +for word ulong get s 38 +put r add word 48 bc_vreg s m 4 false +end +put r 52 bc_vreg s m 1 false +put r 53 bc_vreg s m 2 false +for k ulong 6 +put r add k 54 bc_vreg s m 1 false +end +end +fn bc_prologue ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void +bc_node s 7 0 BCNONE BCNONE BCNONE +put s 22 856 +put s 23 1 +bc_emit ins s 4 +for k ulong 7 +op = ulong 4 +if lt k 3 +op = 5 +end +bc_node s op get r k BCNONE BCNONE BCNONE +put s 22 add ulong 896 mul k 8 +if ge k 3 +put s 22 add ulong 920 mul sub k 3 4 +end +bc_emit ins s 2 +end +for k ulong 3 +bc_node s 3 get r add k 7 BCNONE BCNONE BCNONE +put s 22 33 +if eq k 1 +put s 22 37 +end +if eq k 2 +put s 22 38 +end +bc_emit ins s 2 +end +bc_inst ins s 2 get r 12 BCNONE 1 +bc_shift ins s get r 10 get r 7 0 5 +bc_mask ins s get r 11 get r 7 0 31 +bc_imm ins s get r 13 get r 9 BCNONE 1 +bc_wide ins s get r 14 get r 13 get r 0 16 +put s 8 0 +bc_mem ins s 56 get r 15 get r 14 2 +put s 8 8 +bc_mem ins s 56 get r 16 get r 14 3 +bc_node s 8 get r 17 get r 9 get r 4 BCNONE +bc_emit ins s 0 +bc_wide ins s get r 18 get r 17 get r 1 1 +bc_node s 8 get r 17 get r 9 get r 5 BCNONE +bc_emit ins s 0 +bc_wide ins s get r 19 get r 17 get r 2 1 +bc_wide ins s get r 20 get r 11 get r 18 mul get s 33 4 +bc_imm ins s get r 21 get r 11 BCNONE get s 33 +bc_shift ins s get r 22 get r 11 0 get s 39 +bc_imm ins s get r 22 get r 22 BCNONE 4 +bc_imm ins s get r 23 get r 8 get r 10 get s 35 +end +fn bc_decode ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void +wq = get s 11 +word = get s 12 +byteidx = get s 13 +if lt byteidx 3 +put s 8 shl ulong 1 sub ulong 20 mul byteidx 8 +put s 9 word +bc_imad ins s 8 get r 55 wq BCNONE +else +bc_shift ins s get r 55 wq word 4 +end +bc_mask ins s get r 56 get r 55 0 shl ulong 127 20 +bc_mask ins s get r 57 wq word shl ulong 128 mul byteidx 8 +put s 8 1 +if lt byteidx 3 +put s 8 shl ulong 1 sub ulong 24 mul byteidx 8 +end +put s 9 0 +bc_imad ins s 8 get r 58 get r 57 get r 56 +end +fn bc_xloads ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void +for q ulong get s 38 +put s 8 mul q 16 +bc_mem ins s 57 get r add q 48 get r 26 get s 10 +put s 10 3 +end +end +fn bc_loads ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void +put s 10 2 +if eq get s 36 0 +bc_xloads ins s r +end +bc_wide ins s get r 53 get r 12 get r 25 0 +for row ulong get s 34 +put s 8 mul row get s 32 +op = ulong 56 +if eq get s 33 16 +op = 57 +end +dst = get r add 33 mul row 2 +bc_mem ins s op dst get r 24 get s 10 +put s 10 3 +end +put s 8 0 +bc_mem ins s 11 get r 52 get r 53 3 +if eq get s 36 1 +bc_xloads ins s r +end +end +fn bc_dotword ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void +for byteidx ulong 4 +put s 13 byteidx +bc_decode ins s r +put s 9 byteidx +bc_ffma ins s get r 54 get r 58 get r add get s 12 48 get r 54 +end +end +fn bc_accum ins edit ulong 8192 s edit ulong 64 r view ulong 64 row ulong to void +put s 9 0 +acc = get r add 32 mul row 2 +bc_ffma ins s acc get r 54 get r 52 acc +end +fn bc_dot ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void +for row ulong get s 34 +bc_inst ins s 1 get r 54 BCNONE 0 +put s 11 get r add 33 mul row 2 +for word ulong get s 38 +put s 12 word +bc_dotword ins s r +end +bc_accum ins s r row +end +end +fn bc_reduce ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void +for row ulong get s 34 +acc = get r add 32 mul row 2 +for q ulong 5 +bc_node s 42 get r 59 acc BCNONE BCNONE +put s 22 shr ulong 16 q +bc_emit ins s 2 +bc_node s 30 acc acc get r 59 BCNONE +bc_emit ins s 0 +end +end +end +fn bc_epilogue ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void +bc_reduce ins s r +bc_wide ins s get r 27 get r 23 get r 19 mul get s 34 4 +bc_pred ins s get r 11 get r 12 +put s 13 get s 0 +bc_node s 54 BCNONE BCNONE BCNONE BCNONE +put s 22 2 +bc_emit ins s 9 +put s 14 bc_branch ins s add get s 0 1 true +for row ulong get s 34 +bc_wide ins s get r 28 get r 12 get r 27 mul row 4 +bc_node s 12 BCNONE get r 28 get r add 32 mul row 2 BCNONE +put s 21 0 +bc_emit ins s 5 +end +put s 15 get s 0 +bc_node s 55 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 10 +bc_patch ins get s 14 get s 15 +bc_patch ins get s 13 add get s 15 1 +end +fn bc_prcheck spec view ulong 8 to uint +if or eq get spec 0 0 gt get spec 0 32768 +ret 1 +end +if and ne get spec 1 8 ne get spec 1 16 +ret 1 +end +if and ne get spec 2 1 and ne get spec 2 2 and ne get spec 2 4 ne get spec 2 8 +ret 1 +end +if or eq get spec 3 0 gt get spec 3 32 +ret 1 +end +if ne rem get spec 0 mul get spec 1 32 0 +ret 1 +end +if gt get spec 4 1 +ret 1 +end +for k ulong 3 +if ne get spec add k 5 0 +ret 1 +end +end +ret 0 +end +fn bc_prbody ins edit ulong 8192 s edit ulong 64 r view ulong 64 to void +bc_prologue ins s r +put s 41 get s 0 +bc_pred ins s get r 23 get r 3 +put s 42 bc_branch ins s add get s 0 1 true +bc_wide ins s get r 24 get r 23 get r 15 mul get s 34 get s 32 +bc_wide ins s get r 24 get r 21 get r 24 1 +bc_shift ins s get r 29 get r 23 0 get s 40 +bc_wide ins s get r 25 get r 29 get r 16 div get s 32 32 +bc_wide ins s get r 25 get r 22 get r 25 1 +bc_wide ins s get r 26 get r 12 get r 20 0 +for row ulong get s 34 +bc_inst ins s 1 get r add 32 mul row 2 BCNONE 0 +end +bc_inst ins s 2 get r 30 BCNONE get s 37 +put s 43 get s 0 +bc_loads ins s r +bc_dot ins s r +bc_wide ins s get r 24 get r 12 get r 24 mul get s 33 32 +bc_wide ins s get r 26 get r 12 get r 26 mul get s 33 128 +bc_wide ins s get r 25 get r 12 get r 25 get s 33 +bc_imm ins s get r 30 get r 12 get r 30 4294967295 +bc_pred ins s get r 30 get r 12 +at = bc_branch ins s get s 43 true +bc_epilogue ins s r +bc_imm ins s get r 23 get r 6 get r 23 1 +at = bc_branch ins s get s 41 false +bc_patch ins get s 42 get s 0 +bc_node s 45 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 7 +at = bc_branch ins s get s 0 false +note Historical tail BRA has exact fixed control independent of scheduler pending. +put ins add mul at 8 6 shl ulong 1032192 32 +end +fn bc_project spec view ulong 8 ins edit ulong 8192 m edit ulong 2048 stats edit ulong 4 to uint +if ne bc_prcheck spec 0 +ret 1 +end +s = new ulong 64 0 +r = new ulong 64 0 +for k ulong 2048 +put m k 0 +end +for k ulong 8192 +put ins k 0 +end +for k ulong 5 +put s add k 32 get spec k +end +put s 37 div get spec 0 mul get spec 1 32 +put s 38 div get spec 1 4 +put s 39 bc_log div ulong 128 get spec 1 +put s 40 bc_log div ulong 128 get spec 2 +bc_initregs m s r +bc_prbody ins s r +if ne get s 3 0 +ret 2 +end +put stats 0 get s 0 +put stats 1 get s 4 +put stats 2 get s 5 +put stats 3 0 +ret 0 +end diff --git a/om/components/compose.om b/om/components/compose.om new file mode 100644 index 00000000..0bb6927e --- /dev/null +++ b/om/components/compose.om @@ -0,0 +1,58 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note cfg16:family1direct/2rowpipe/3staged,K,LB,rows-or-MT,warps,component,mutant0,reserved0. +note Native component concatenation shares one instruction array and one allocation namespace. +note No component performs physical allocation. One effect stream covers all boundaries. +note out8:count,peakGPR,peakUGPR,shared,virtualGPR,virtualUGPR,reserved0,reserved0. +fn bc_compose cfg view ulong 16 ins edit ulong 8192 m edit ulong 2048 phys edit ulong 288 out edit ulong 8 to uint +spec = new ulong 16 0 +small = new ulong 8 0 +st = new ulong 4 0 +rs = new ulong 4 0 +for k ulong 8 +put out k 0 +end +for k ulong 10 +if ne get cfg add k 6 0 +ret 1 +end +end +family = get cfg 0 +if or lt family 1 gt family 3 +ret 1 +end +for k ulong 5 +put spec k get cfg add k 1 +put small k get cfg add k 1 +end +rc = uint 1 +if eq family 1 +rc = bc_project small ins m st +end +if eq family 2 +if ne get cfg 5 0 +ret 1 +end +rc = bc_rowpipe small ins m st +end +if eq family 3 +rc = bc_staged spec ins m st +end +if ne rc 0 +ret rc +end +rc = bc_ircheck ins get st 0 m +if ne rc 0 +ret add rc 8 +end +rc = bc_regalloc ins get st 0 m phys rs 128 +if ne rc 0 +ret add rc 16 +end +put out 0 get st 0 +put out 1 get rs 1 +put out 2 get rs 2 +put out 3 get st 3 +put out 4 get st 1 +put out 5 get st 2 +ret 0 +end diff --git a/om/components/encode.om b/om/components/encode.om new file mode 100644 index 00000000..30212b9d --- /dev/null +++ b/om/components/encode.om @@ -0,0 +1,38 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Concatenate the repaired function-mode encoder and checked spec unchanged before this adapter. +note One instruction representation; emit only words returned by the checked sp_enc. +fn bc_encode ins view ulong 8192 phys view ulong 288 n ulong pad ulong code edit uchar 16384 to ulong +state = new ulong 3001 0 +o = new ulong 16 0 +w = new ulong 4 0 +if or eq n 0 gt n 1024 +ret 0 +end +cnt = n +if ne pad 0 +cnt = mul div add n 7 8 8 +if lt cnt 32 +cnt = 32 +end +end +for i ulong n +opnds ins i phys o +if ne sp_enc state o w 0 +ret 0 +end +store code i w +end +if gt cnt n +note BW_IR_NOP is opcode0; padding is encoded semantically, never pasted machine bytes. +for j ulong 16 +put o j 0 +end +if ne sp_enc state o w 0 +ret 0 +end +for j ulong sub cnt n +store code add n j w +end +end +ret mul cnt 16 +end diff --git a/om/components/fixture.om b/om/components/fixture.om new file mode 100644 index 00000000..61012040 --- /dev/null +++ b/om/components/fixture.om @@ -0,0 +1,102 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Host fixture ONLY: digest sentinels are synthetic, never an admission receipt. +fn compose_setid b edit uchar 4096 slot ulong h view uchar 32 to void +if lt slot 8 +for j ulong 32 +put b add add 512 mul slot 32 j get h j +end +end +end +fn compose_fixture b edit uchar 4096 l edit ulong 32 to uint +d = new ulong 48 0 +q = new uchar 384 0 +for j ulong 4096 +put b j 0 +end +for j ulong 32 +put l j 0 +end +put d 0 1 +put d 1 2 +put d 2 8 +put d 4 1 +put d 5 128 +put d 6 128 +put d 11 1 +put d 13 1 +put d 14 8 +put d 15 1 +put d 17 128 +put d 18 256 +put d 19 2 +put d 24 3 +put d 25 256 +put d 26 4 +put d 27 1 +put d 30 32768 +put d 31 4 +put d 33 256 +put d 34 8 +put d 35 4 +put d 36 32768 +put d 37 8 +put d 40 1 +put d 41 256 +rc = quant_write d q +if ne rc 0 +ret rc +end +for j ulong 384 +put b add j 768 get q j +end +compose_put b 0 1 +compose_put b 1 1152 +compose_put b 2 121 +compose_put b 4 1 +compose_put b 5 128 +compose_put b 6 256 +compose_put b 7 1 +compose_put b 8 3 +compose_put b 9 1 +compose_put b 10 1 +compose_put b 11 1 +compose_put b 14 1 +compose_put b 15 1 +compose_put b 16 256 +compose_put b 17 8 +compose_put b 18 1 +compose_put b 19 1 +compose_put b 20 7 +compose_put b 22 64 +compose_put b 23 6 +compose_put b 24 1 +compose_put b 25 256 +compose_put b 26 1 +compose_put b 27 1 +compose_put b 28 1 +compose_put b 29 7 +for k ulong 8 +if ne k 2 +compose_put b add k 30 add k 1 +end +put b add 512 mul k 32 uchar add k 1 +end +put l 0 1 +put l 1 1 +put l 2 1 +put l 3 1 +put l 4 256 +put l 5 1 +put l 6 1 +put l 8 64 +put l 9 6 +put l 10 1 +put l 11 896 +put l 12 10 +put l 13 1 +put l 14 1 +put l 15 1 +put l 19 2 +put l 23 3 +ret compose_check b 1152 +end diff --git a/om/components/realize.om b/om/components/realize.om new file mode 100644 index 00000000..c50e6f61 --- /dev/null +++ b/om/components/realize.om @@ -0,0 +1,355 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note CUDApp157 canonical realization v1. Concatenate after quant.om. +note Wire is 1152 used bytes in uchar4096; trailing bytes MUST zero. +note 64 LE64 metadata, eight SHA256 digests, exact QuantSchema384. +note Digests semantic/compiler/encoder/spec/unsolvedIR/code/launch/lineage. +note A nonzero digest is not evidence: caller must hash actual bytes and qualify. +fn compose_word b view uchar 4096 k ulong to ulong +v = ulong 0 +for j ulong 8 +v = or v shl ulong get b add mul k 8 j mul j 8 +end +ret v +end +fn compose_put b edit uchar 4096 k ulong v ulong to void +for j ulong 8 +put b add mul k 8 j uchar and shr v mul j 8 255 +end +end +fn compose_digest b view uchar 4096 slot ulong h view uchar 32 to bool +if ge slot 8 +ret false +end +for j ulong 32 +if ne get b add add 512 mul slot 32 j get h j +ret false +end +end +ret true +end +fn compose_codeid b view uchar 4096 h view uchar 32 to bool +ret compose_digest b 5 h +end +fn compose_launchid b view uchar 4096 h view uchar 32 to bool +ret compose_digest b 6 h +end +note Family3 structural subset mirrors sg_valid, not artifact qualification. +fn compose_staged b view uchar 4096 to uint +mt = compose_word b 14 +tk = compose_word b 16 +w = compose_word b 17 +if and ne mt 1 and ne mt 2 and ne mt 4 ne mt 8 +ret 2 +end +if ne compose_word b 15 1 +ret 2 +end +if and ne tk 256 ne tk 512 +ret 2 +end +if or eq w 0 gt w 32 +ret 3 +end +if ne and w sub w 1 0 +ret 3 +end +lb = div tk 32 +if ne rem mul mt lb w 0 +ret 2 +end +if gt div mul mt lb w 8 +ret 2 +end +if or gt compose_word b 6 16384 ne rem compose_word b 6 tk 0 +ret 2 +end +ks = div compose_word b 6 tk +if and ne rem ks 2 0 gt ks 3 +ret 2 +end +u = ks +if eq rem ks 2 0 +u = 2 +end +note Word18 is emitted K-step unroll U for family3, not buffer depth. +if ne compose_word b 18 u +ret 2 +end +required = mul mul mt 128 lb +if or lt compose_word b 21 required ne rem compose_word b 21 128 0 +ret 3 +end +note Keep the existing launch declaration granularity; peak+2 needs actual out8. +if or lt compose_word b 22 16 ne rem compose_word b 22 8 0 +ret 3 +end +if or ne compose_word b 23 6 ne compose_word b 24 1 +ret 3 +end +if or gt compose_word b 26 4294967295 gt compose_word b 27 4294967295 +ret 3 +end +if or ne compose_word b 28 1 gt mul compose_word b 26 w 4294967295 +ret 3 +end +note This FFMA family has seven non-MMA component declarations; IDs remain opaque. +if or ne compose_word b 29 7 ne compose_word b 32 0 +ret 2 +end +for k ulong 8 +if ne k 2 +if eq compose_word b add k 30 0 +ret 2 +end +end +end +ret 0 +end +fn compose_check b view uchar 4096 n ulong to uint +d = new ulong 48 0 +q = new uchar 384 0 +if ne n 1152 +ret 1 +end +if or ne compose_word b 0 1 ne compose_word b 1 1152 +ret 1 +end +if ne compose_word b 2 121 +ret 2 +end +note v1 no optional feature bits: SM121 warp instruction path only, no TMA/TMEM. +if ne compose_word b 3 0 +ret 2 +end +for k ulong 3 +v = compose_word b add k 4 +if or eq v 0 gt v 16777216 +ret 3 +end +end +note type tags1F32 2BF16 3E4M3 4E5M2. This bounded realization uses folded E4M3. +if or ne compose_word b 7 1 ne compose_word b 8 3 +ret 2 +end +if or ne compose_word b 9 1 ne compose_word b 10 1 +ret 2 +end +if or ne compose_word b 11 1 ne compose_word b 12 0 +ret 2 +end +note alias0 means disjoint input weights scales output. Admission must prove addresses. +if ne compose_word b 13 0 +ret 2 +end +for k ulong 6 +if eq compose_word b add k 14 0 +ret 3 +end +end +if gt compose_word b 17 32 +ret 3 +end +if gt compose_word b 18 16 +ret 3 +end +if gt compose_word b 19 3 +ret 2 +end +if gt compose_word b 20 127 +ret 2 +end +if gt compose_word b 21 16384 +ret 3 +end +if or lt compose_word b 22 3 gt compose_word b 22 246 +ret 3 +end +if or lt compose_word b 23 4 gt compose_word b 23 32 +ret 3 +end +if gt compose_word b 24 16 +ret 3 +end +if ne compose_word b 25 mul compose_word b 17 32 +ret 3 +end +if gt mul compose_word b 25 compose_word b 22 65536 +ret 3 +end +for k ulong 3 +if eq compose_word b add k 26 0 +ret 3 +end +end +cnt = ulong 0 +for k ulong 8 +if ne compose_word b add k 30 0 +cnt = add cnt 1 +end +end +if or eq cnt 0 ne cnt compose_word b 29 +ret 1 +end +for k ulong 26 +if ne compose_word b add k 38 0 +ret 1 +end +end +for k ulong 8 +nz = uchar 0 +for j ulong 32 +nz = or nz get b add add 512 mul k 32 j +end +if eq nz 0 +ret 1 +end +end +for j ulong 384 +put q j get b add j 768 +end +rc = quant_read q d +if ne rc 0 +ret 4 +end +rc = quant_check d +if ne rc 0 +ret 4 +end +if eq compose_word b 19 3 +rc = compose_staged b +if ne rc 0 +ret rc +end +end +note Quant descriptor describes a load-time chunk, NOT necessarily entire MNK. +if or ne get d 1 2 ne get d 24 3 +ret 2 +end +if or ne get d 40 1 ne get d 32 0 +ret 2 +end +for j ulong 2944 +if ne get b add j 1152 0 +ret 1 +end +end +ret 0 +end +fn compose_match a view uchar 4096 b view uchar 4096 to bool +if ne compose_check a 1152 0 +ret false +end +if ne compose_check b 1152 0 +ret false +end +for k ulong 12 +if ne compose_word a add k 2 compose_word b add k 2 +ret false +end +end +note semantic and pinned tool identities only; qualification remains candidate-specific. +for j ulong 128 +if ne get a add j 512 get b add j 512 +ret false +end +end +for j ulong 384 +if ne get a add j 768 get b add j 768 +ret false +end +end +ret true +end +note launch template is32 LE64 words: v1,gridXYZ,blockXYZ,shared,gpr,ugpr,barriers, +note cbankOffset,argWords,paramABI,relocationPolicy;15..18parameterABI SHA256 limbs, +note 19..22constantbank SHA256 limbs,23..26zeroVA QMD templates SHA256 limbs;27..31zero. +note Address-free templates only; blockY=blockZ=1; args remain immutable artifact data. +fn compose_launch b view uchar 4096 l view ulong 32 to uint +if ne compose_check b 1152 0 +ret 1 +end +if or ne get l 0 1 ne get l 4 compose_word b 25 +ret 1 +end +if or ne get l 5 1 ne get l 6 1 +ret 1 +end +for j ulong 3 +if ne get l add j 1 compose_word b add j 26 +ret 1 +end +end +for j ulong 4 +if ne get l add j 7 compose_word b add j 21 +ret 1 +end +end +if or eq get l 11 0 gt get l 12 32 +ret 1 +end +if or eq get l 12 0 ne get l 13 1 +ret 1 +end +if ne get l 14 1 +ret 1 +end +if eq compose_word b 19 3 +if ne get l 11 896 +ret 1 +end +if and ne get l 12 8 ne get l 12 12 +ret 1 +end +if and eq get l 12 12 gt compose_word b 14 4 +ret 1 +end +end +for k ulong 3 +v = ulong 0 +for j ulong 4 +v = or v get l add add 15 mul k 4 j +end +if eq v 0 +ret 1 +end +end +for j ulong 5 +if ne get l add j 27 0 +ret 1 +end +end +ret 0 +end +fn compose_launchread b view uchar 4096 wire view uchar 4096 n ulong to uint +l = new ulong 32 0 +if ne n 256 +ret 1 +end +for k ulong 32 +put l k compose_word wire k +end +for j ulong 3840 +if ne get wire add j 256 0 +ret 1 +end +end +ret compose_launch b l +end +fn compose_launchwrite l view ulong 32 wire edit uchar 4096 to void +for j ulong 4096 +put wire j 0 +end +for k ulong 32 +compose_put wire k get l k +end +end +fn compose_quant b view uchar 4096 q edit uchar 384 to void +for j ulong 384 +put q j get b add j 768 +end +end +fn compose_setquant b edit uchar 4096 q view uchar 384 to void +for j ulong 384 +put b add j 768 get q j +end +end diff --git a/om/components/rowpipe.om b/om/components/rowpipe.om new file mode 100644 index 00000000..ed2764e6 --- /dev/null +++ b/om/components/rowpipe.om @@ -0,0 +1,435 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Exact source: CUDApp b759afc3 src/omega_blackwell_codegen_moe2.c and moe.h. +note Concatenate bw_alloc,bw_effect,bw_project,rowpipe. No solving or encoding here. +note Frozen spec8:0K,1lane_bytes,2rows,3warps,4mutant MUST0,5..7reserved MUST0. +note Unlike ignored C tuning fields this interface never silently accepts variants. +note Returns0 unsolved IR,1 refused spec,2 emitter capacity. Outputs zero on refusal. +note stats4=count,vregs,uvregs,sharedBytes; launch declares one CTA barrier. +note SB_B data waits only at first takeover; SB_RD protects each load address. +note Runtime loop consumes every issued B set before EXIT; branch/reconvergence order unchanged. +note Private state32..41shape,42..48branchsites,49partial,50step,51row,52word, +note 53weight,54dot/acc,55dot,56scale,57sharedoffset;10..12lowering scratch. +note Shape admission does not solve resources: caller globally allocates with limit128. +fn rp_check spec view ulong 8 to uint +if or eq get spec 0 0 gt get spec 0 32768 +ret 1 +end +if and ne get spec 1 8 ne get spec 1 16 +ret 1 +end +if and ne get spec 2 1 and ne get spec 2 2 and ne get spec 2 4 ne get spec 2 8 +ret 1 +end +if or eq get spec 3 0 gt get spec 3 32 +ret 1 +end +for j ulong 4 +if ne get spec add j 4 0 +ret 1 +end +end +if ne rem get spec 0 mul get spec 1 32 0 +ret 1 +end +ks = div get spec 0 mul get spec 1 32 +if or gt ks 16 gt mul mul get spec 2 ks get spec 1 128 +ret 1 +end +if gt get spec 0 mul get spec 3 512 +ret 1 +end +if ge add mul sub get spec 2 1 get spec 0 get spec 1 shl ulong 1 23 +ret 1 +end +ret 0 +end +fn rp_zero ins edit ulong 8192 m edit ulong 2048 stats edit ulong 4 to void +for j ulong 8192 +put ins j 0 +end +for j ulong 2048 +put m j 0 +end +for j ulong 4 +put stats j 0 +end +end +fn rp_widx row ulong step ulong to ulong +ret add ulong 64 mul add mul row 16 step 2 +end +fn rp_regrow m edit ulong 2048 s edit ulong 64 r edit ulong 512 row ulong to void +uv = bc_vreg s m 1 false +put r add 32 mul row 2 uv +uv = bc_vreg s m 1 false +put r add 33 mul row 2 uv +for step ulong get s 36 +idx = rp_widx row step +uv = bc_vreg s m get s 38 false +put r idx uv +uv = bc_vreg s m get s 38 false +put r add idx 1 uv +end +end +fn rp_regs m edit ulong 2048 s edit ulong 64 r edit ulong 512 to void +uv = bc_vreg s m 2 true +for j ulong 24 +w = ulong 1 +if or lt j 3 or and ge j 14 le j 16 and ge j 18 le j 19 +w = 2 +end +put r j bc_vreg s m w false +end +put r 24 bc_vreg s m 4 false +for row ulong get s 34 +rp_regrow m s r row +end +for step ulong get s 36 +put r add 320 mul step 2 bc_vreg s m 1 false +put r add 321 mul step 2 bc_vreg s m 1 false +end +for j ulong 7 +w = ulong 1 +if lt j 5 +w = 2 +end +put r add j 25 bc_vreg s m w false +end +for j ulong 5 +put r add j 48 bc_vreg s m 1 false +end +for j ulong 9 +w = ulong 1 +if eq j 0 +w = 2 +end +put r add j 352 bc_vreg s m w false +end +for j ulong get s 41 +put r add 384 mul j 2 bc_vreg s m 2 false +put r add 385 mul j 2 bc_vreg s m 1 false +end +end +fn rp_start ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +bc_node s 7 0 BCNONE BCNONE BCNONE +put s 22 856 +put s 23 1 +bc_emit ins s 4 +for j ulong 7 +op = ulong 4 +if lt j 3 +op = 5 +end +bc_node s op get r j BCNONE BCNONE BCNONE +put s 22 add ulong 896 mul j 8 +if ge j 3 +put s 22 add ulong 920 mul sub j 3 4 +end +bc_emit ins s 2 +end +for j ulong 3 +bc_node s 3 get r add j 7 BCNONE BCNONE BCNONE +put s 22 33 +if eq j 1 +put s 22 37 +end +if eq j 2 +put s 22 38 +end +bc_emit ins s 2 +end +bc_inst ins s 2 get r 12 BCNONE 1 +bc_shift ins s get r 10 get r 7 0 5 +bc_mask ins s get r 11 get r 7 0 31 +bc_imm ins s get r 13 get r 9 BCNONE 1 +bc_wide ins s get r 14 get r 13 get r 0 16 +put s 8 0 +bc_mem ins s 56 get r 15 get r 14 2 +put s 8 8 +bc_mem ins s 56 get r 16 get r 14 3 +bc_node s 8 get r 17 get r 9 get r 4 BCNONE +bc_emit ins s 0 +bc_wide ins s get r 18 get r 17 get r 1 1 +bc_node s 8 get r 17 get r 9 get r 5 BCNONE +bc_emit ins s 0 +bc_wide ins s get r 19 get r 17 get r 2 1 +bc_imm ins s get r 20 get r 11 BCNONE get s 33 +bc_shift ins s get r 21 get r 11 0 get s 39 +bc_imm ins s get r 21 get r 21 BCNONE 4 +bc_imm ins s get r 22 get r 8 get r 10 get s 35 +bc_imm ins s get r 23 get r 22 BCNONE 1 +end +fn rp_clamp ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +bc_imm ins s get r 356 get r 7 BCNONE 1 +put s 8 mul mul sub get s 41 1 32 get s 35 +put s 9 0 +bc_imad ins s 8 get r 356 get r 12 get r 356 +bc_imm ins s get r 358 get r 356 BCNONE 4294967295 +bc_imm ins s get r 358 get r 12 get r 358 sub get s 32 1 +bc_shift ins s get r 357 get r 358 0 31 +bc_imm ins s get r 358 get r 356 BCNONE 1 +put s 8 and sub ulong 0 get s 32 4294967295 +put s 9 0 +bc_imad ins s 8 get r 358 get r 12 get r 358 +bc_node s 8 get r 359 get r 357 get r 358 BCNONE +bc_emit ins s 0 +bc_imm ins s get r 359 get r 359 get r 356 4294967295 +bc_imm ins s get r 360 get r 358 BCNONE 1 +bc_imm ins s get r 360 get r 12 get r 360 1 +bc_node s 8 get r 360 get r 357 get r 360 BCNONE +bc_emit ins s 0 +bc_imm ins s get r 360 get r 360 get r 356 4294967295 +bc_wide ins s get r add 384 mul sub get s 41 1 2 get r 360 get r 18 4 +bc_imm ins s get r 355 get r 359 BCNONE 4 +end +fn rp_stage ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +put s 49 rem get s 32 mul get s 35 32 +bc_wide ins s get r 352 get r 7 get r 18 4 +bc_imm ins s get r 353 get r 7 BCNONE 4 +for j ulong get s 41 +put s 8 mul mul j 128 get s 35 +put s 9 0 +bc_imad ins s 9 get r add 384 mul j 2 get r 12 get r 352 +end +if ne get s 49 0 +rp_clamp ins s r +end +for j ulong get s 41 +put s 8 0 +kind = ulong 3 +if eq j 0 +kind = 2 +end +put s 10 get r add 385 mul j 2 +put s 11 get r add 384 mul j 2 +bc_mem ins s 11 get s 10 get s 11 kind +end +for j ulong get s 41 +if and ne get s 49 0 eq j sub get s 41 1 +bc_node s 50 BCNONE get r 355 get r add 385 mul j 2 BCNONE +bc_emit ins s 5 +else +put s 8 mul mul j 128 get s 35 +put s 9 0 +bc_imad ins s 8 get r 354 get r 12 get r 353 +bc_node s 50 BCNONE get r 354 get r add 385 mul j 2 BCNONE +bc_emit ins s 5 +end +end +bc_node s 48 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 6 +bc_imm ins s get r 31 get r 11 BCNONE mul get s 33 4 +end +fn rp_loadrow ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +put s 8 mul get s 51 get s 32 +put s 12 mul get s 50 32 +put s 12 mul get s 12 get s 33 +put s 8 add get s 8 get s 12 +put s 12 rp_widx get s 51 get s 50 +put s 12 get r add get s 12 1 +bc_mem ins s get s 11 get s 12 get r 25 get s 10 +put s 10 12 +end +fn rp_issue ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +bc_wide ins s get r 25 get r 22 get r 15 mul get s 34 get s 32 +bc_wide ins s get r 25 get r 20 get r 25 1 +bc_shift ins s get r 30 get r 22 0 get s 40 +bc_wide ins s get r 26 get r 30 get r 16 div get s 32 32 +bc_wide ins s get r 26 get r 21 get r 26 1 +put s 10 11 +put s 11 56 +if eq get s 33 16 +put s 11 57 +end +for step ulong get s 36 +for row ulong get s 34 +put s 50 step +put s 51 row +rp_loadrow ins s r +end +end +for step ulong get s 36 +if eq step 0 +put s 8 0 +bc_mem ins s 11 get r 321 get r 26 get s 10 +else +put s 8 mul mul step get s 37 4 +put s 9 0 +bc_imad ins s 9 get r 27 get r 12 get r 26 +put s 8 0 +bc_mem ins s 11 get r add 321 mul step 2 get r 27 12 +end +put s 10 12 +end +bc_imm ins s get r 22 get r 6 get r 22 1 +end +fn rp_takerow ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +idx = rp_widx get s 51 get s 50 +for word ulong get s 38 +bc_node s 8 get r idx get r add idx 1 BCNONE BCNONE +put s 22 1 +put s 23 or shl word 16 shl word 24 +bc_emit ins s get s 10 +put s 10 0 +end +end +fn rp_take ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +put s 10 13 +for step ulong get s 36 +for row ulong get s 34 +put s 50 step +put s 51 row +rp_takerow ins s r +end +end +for step ulong get s 36 +put s 10 get r add 320 mul step 2 +put s 11 get r add 321 mul step 2 +bc_imm ins s get s 10 get s 11 BCNONE 1 +end +end +fn rp_decode ins edit ulong 8192 s edit ulong 64 r view ulong 512 wq ulong word ulong byteidx ulong to void +if lt byteidx 3 +put s 8 shl ulong 1 sub ulong 20 mul byteidx 8 +put s 9 word +bc_imad ins s 8 get r 48 wq BCNONE +else +bc_shift ins s get r 48 wq word 4 +end +bc_mask ins s get r 49 get r 48 0 shl ulong 127 20 +bc_mask ins s get r 50 wq word shl ulong 128 mul byteidx 8 +put s 8 1 +if lt byteidx 3 +put s 8 shl ulong 1 sub ulong 24 mul byteidx 8 +end +put s 9 0 +bc_imad ins s 8 get r 51 get r 50 get r 49 +end +fn rp_dotrow ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +put s 53 get r rp_widx get s 51 get s 50 +put s 54 get r add 33 mul get s 51 2 +for byteidx ulong 4 +rp_decode ins s r get s 53 get s 52 byteidx +put s 9 byteidx +bc_ffma ins s get s 54 get r 51 get r 24 get s 54 +end +end +fn rp_step ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +put s 57 mul get s 50 128 +put s 57 mul get s 57 get s 33 +put s 56 get r add 320 mul get s 50 2 +for row ulong get s 34 +bc_inst ins s 1 get r add 33 mul row 2 BCNONE 0 +end +for word ulong get s 38 +put s 52 word +bc_node s 58 get r 24 get r 31 BCNONE BCNONE +put s 22 mul word 16 +put s 22 add get s 22 get s 57 +bc_emit ins s 2 +for row ulong get s 34 +put s 51 row +rp_dotrow ins s r +end +end +for row ulong get s 34 +put s 9 0 +put s 54 get r add 32 mul row 2 +put s 55 get r add 33 mul row 2 +bc_ffma ins s get s 54 get s 55 get s 56 get s 54 +end +end +fn rp_compute ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +for row ulong get s 34 +bc_inst ins s 1 get r add 32 mul row 2 BCNONE 0 +end +for step ulong get s 36 +put s 50 step +rp_step ins s r +end +end +fn rp_store ins edit ulong 8192 s edit ulong 64 r view ulong 512 to void +for row ulong get s 34 +put s 54 get r add 32 mul row 2 +for j ulong 5 +bc_node s 42 get r 52 get s 54 BCNONE BCNONE +put s 22 shr ulong 16 j +bc_emit ins s 2 +bc_node s 30 get s 54 get s 54 get r 52 BCNONE +bc_emit ins s 0 +end +end +bc_wide ins s get r 28 get r 23 get r 19 mul get s 34 4 +bc_pred ins s get r 11 get r 12 +put s 45 get s 0 +bc_node s 54 BCNONE BCNONE BCNONE BCNONE +put s 22 2 +bc_emit ins s 9 +put s 46 bc_branch ins s add get s 0 1 true +for row ulong get s 34 +bc_wide ins s get r 29 get r 12 get r 28 mul row 4 +bc_node s 12 BCNONE get r 29 get r add 32 mul row 2 BCNONE +put s 21 0 +bc_emit ins s 5 +end +put s 47 get s 0 +bc_node s 55 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 10 +bc_patch ins get s 46 get s 47 +bc_patch ins get s 45 add get s 47 1 +end +fn bc_rowpipe spec view ulong 8 ins edit ulong 8192 m edit ulong 2048 stats edit ulong 4 to uint +s = new ulong 64 0 +r = new ulong 512 0 +rp_zero ins m stats +if ne rp_check spec 0 +ret 1 +end +for j ulong 4 +put s add j 32 get spec j +end +put s 36 div get spec 0 mul get spec 1 32 +put s 37 div mul get spec 1 32 128 +put s 38 div get spec 1 4 +put s 39 bc_log div ulong 128 get spec 1 +put s 40 bc_log div ulong 128 get spec 2 +put s 10 mul get spec 3 32 +put s 41 add get spec 0 get s 10 +put s 41 sub get s 41 1 +put s 41 div get s 41 get s 10 +rp_regs m s r +rp_start ins s r +rp_stage ins s r +bc_pred ins s get r 22 get r 3 +put s 42 bc_branch ins s add get s 0 1 true +rp_issue ins s r +put s 43 get s 0 +rp_take ins s r +bc_pred ins s get r 22 get r 3 +put s 44 bc_branch ins s add get s 0 1 true +rp_issue ins s r +bc_patch ins get s 44 get s 0 +rp_compute ins s r +rp_store ins s r +bc_imm ins s get r 23 get r 6 get r 23 1 +bc_pred ins s get r 23 get r 3 +put s 48 bc_branch ins s add get s 0 1 true +at = bc_branch ins s get s 43 false +bc_patch ins get s 42 get s 0 +bc_patch ins get s 48 get s 0 +bc_node s 45 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 7 +at = bc_branch ins s get s 0 false +put ins add mul at 8 6 shl ulong 1032192 32 +if ne get s 3 0 +rp_zero ins m stats +ret 2 +end +put stats 0 get s 0 +put stats 1 get s 4 +put stats 2 get s 5 +put stats 3 mul get s 32 4 +if ne rem get s 32 mul get s 35 32 0 +put stats 3 add get stats 3 16 +end +ret 0 +end diff --git a/om/components/staged.om b/om/components/staged.om new file mode 100644 index 00000000..65c30f1f --- /dev/null +++ b/om/components/staged.om @@ -0,0 +1,587 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Native unsolved port of omega_blackwell_codegen_gemm.c at b759afc3. +note spec16 frozen:0K,1laneBytes,2MT,3warps,4rowmap,5mutant0,6..15reserved0. +note Bounded subset:MT1/2/4/8,NJ=MT*LB/warps<=8,rowmap MT<=4. +note K<=16384;KS even or<=3;LB8/16;warps power2<=32;shared<=16384. +note stats:instruction count,virtual GPR count,virtual UGPR count,shared bytes. +note No allocation/encoding here. Caller runs the shared global allocator once. +note Exact C decode masks/shift provenance:decode_byte lines149..157. +note Exact SB3/4 prefetch/control provenance:ldw_pf/consume lines123..129. +note Source formulas are translated verbatim; no numerical output oracle invented. +fn sg_kind idx ulong to ulong +if eq idx 0 +ret 2 +end +ret 3 +end +fn sg_clear ins edit ulong 8192 m edit ulong 2048 stats edit ulong 4 to void +for k ulong 8192 +put ins k 0 +end +for k ulong 2048 +put m k 0 +end +for k ulong 4 +put stats k 0 +end +end +fn sg_valid spec view ulong 16 to bool +if or eq get spec 0 0 gt get spec 0 16384 +ret false +end +if and ne get spec 1 8 ne get spec 1 16 +ret false +end +if and ne get spec 2 1 and ne get spec 2 2 and ne get spec 2 4 ne get spec 2 8 +ret false +end +if or eq get spec 3 0 gt get spec 3 32 +ret false +end +if eq bc_log get spec 3 BCNONE +ret false +end +if ne rem get spec 0 mul get spec 1 32 0 +ret false +end +if ne rem mul get spec 2 get spec 1 get spec 3 0 +ret false +end +if gt div mul get spec 2 get spec 1 get spec 3 8 +ret false +end +if gt mul mul get spec 2 128 get spec 1 16384 +ret false +end +ks = div get spec 0 mul get spec 1 32 +if and ne rem ks 2 0 gt ks 3 +ret false +end +if or gt get spec 4 1 and eq get spec 4 1 gt get spec 2 4 +ret false +end +for k ulong 11 +if ne get spec add k 5 0 +ret false +end +end +ret true +end +note r0pseg1px2py3n4stride5tid6cx7cy8warp9lane10one11tent12wbase13sbase14rc. +note r15row0 16cnt17tpass18passes19wlane20slane21xl22nm1 23ysn24mrow25off4 26sa0 27base28z. +note r29pxm30pym31rg32over33t1 34d35tmp36rgc37lo38pw39ps40pyrg41rowp42rem43pc. +note r44xrp45xs46pwc47psc48cntk49pyr50pya51t52tq53fl54sv. +note r56..63xb64..67yi68xso69ma70u71a72sg73onef74dum. +note r76..83acc84..91dot92..95xq96..97wq98..99sc100..103fr. +note r104pwn105psn106sa107nf108inc109inc2 110..113xv114..117xa. +fn sg_regs m edit ulong 2048 s edit ulong 64 r edit ulong 128 to void +uv = bc_vreg s m 2 true +for k ulong 29 +w = ulong 1 +if or lt k 3 and ge k 11 le k 14 +w = 2 +end +put r k bc_vreg s m w false +end +if eq get s 36 1 +put r 29 bc_vreg s m 2 false +put r 30 bc_vreg s m 2 false +end +end +fn sg_loopregs m edit ulong 2048 s edit ulong 64 r edit ulong 128 to void +for k ulong 24 +idx = add k 31 +w = ulong 1 +if or and ge idx 38 le idx 40 and ge idx 44 le idx 47 +w = 2 +end +if or eq idx 49 eq idx 50 +w = 2 +end +put r idx bc_vreg s m w false +end +if eq get s 36 1 +for j ulong get s 39 +put r add j 56 bc_vreg s m 2 false +end +for j ulong get s 34 +put r add j 64 bc_vreg s m 1 false +end +put r 68 bc_vreg s m 1 false +put r 69 bc_vreg s m 2 false +end +for j ulong 5 +put r add j 70 bc_vreg s m 1 false +end +for j ulong get s 34 +put r add j 76 bc_vreg s m 1 false +put r add j 84 bc_vreg s m 1 false +end +for j ulong 4 +put r add j 92 bc_vreg s m 4 false +end +for j ulong 2 +put r add j 96 bc_vreg s m div get s 33 4 false +put r add j 98 bc_vreg s m 1 false +end +for j ulong 4 +put r add j 100 bc_vreg s m 1 false +end +end +fn sg_load ins edit ulong 8192 s edit ulong 64 op ulong d ulong off ulong kind ulong to void +bc_node s op d BCNONE BCNONE BCNONE +put s 22 off +if eq op 7 +put s 23 1 +end +bc_emit ins s kind +end +fn sg_prologue ins edit ulong 8192 s edit ulong 64 r view ulong 128 to void +sg_load ins s 7 0 856 4 +for k ulong 5 +op = ulong 5 +off = add ulong 896 mul k 8 +if ge k 3 +op = 4 +off = add ulong 920 mul sub k 3 4 +end +sg_load ins s op get r k off 2 +end +if eq get s 36 1 +sg_load ins s 5 get r 29 928 2 +sg_load ins s 5 get r 30 936 2 +end +for k ulong 3 +sr = ulong 33 +if eq k 1 +sr = 37 +end +if eq k 2 +sr = 38 +end +sg_load ins s 3 get r add k 5 sr 2 +end +bc_inst ins s 2 get r 10 BCNONE 1 +bc_shift ins s get r 8 get r 5 0 5 +bc_mask ins s get r 9 get r 5 0 31 +bc_wide ins s get r 11 get r 7 get r 0 32 +for k ulong 3 +put s 8 mul k 8 +bc_mem ins s 56 get r add k 12 get r 11 sg_kind k +end +put s 8 1 +put s 9 0 +bc_imad ins s 8 get r 15 get r 14 BCNONE +put s 9 1 +bc_imad ins s 8 get r 16 get r 14 BCNONE +bc_imm ins s get r 17 get r 10 get r 16 sub get s 34 1 +bc_shift ins s get r 18 get r 17 0 get s 43 +bc_imm ins s get r 28 get r 10 get r 16 4294967295 +bc_shift ins s get r 28 get r 28 0 31 +bc_pred ins s get r 28 get r 10 +put s 46 bc_branch ins s add get s 0 1 true +bc_imm ins s get r 19 get r 9 BCNONE get s 33 +bc_shift ins s get r 20 get r 9 0 get s 42 +bc_imm ins s get r 20 get r 20 BCNONE 4 +bc_imm ins s get r 21 get r 9 BCNONE 16 +bc_imm ins s get r 22 get r 10 get r 3 4294967295 +bc_imm ins s get r 23 get r 3 BCNONE 4 +bc_shift ins s get r 24 get r 5 0 get s 44 +bc_mask ins s get r 25 get r 5 0 sub get s 40 1 +bc_imm ins s get r 25 get r 25 BCNONE 4 +bc_imm ins s get r 26 get r 5 BCNONE 4 +bc_imm ins s get r 27 get r 6 BCNONE get s 35 +end +fn sg_row ins edit ulong 8192 s edit ulong 64 r view ulong 128 to void +put s 47 get s 0 +bc_pred ins s get r 27 get r 3 +put s 48 bc_branch ins s add get s 0 1 true +bc_imm ins s get r 31 get r 27 get r 8 1 +bc_imm ins s get r 33 get r 31 get r 22 4294967295 +bc_shift ins s get r 32 get r 33 0 31 +bc_imm ins s get r 34 get r 22 get r 31 4294967295 +bc_node s 8 get r 35 get r 32 get r 34 BCNONE +bc_emit ins s 0 +bc_imm ins s get r 36 get r 35 get r 31 4294967295 +bc_wide ins s get r 38 get r 36 get r 12 get s 32 +bc_wide ins s get r 38 get r 19 get r 38 1 +bc_shift ins s get r 35 get r 36 0 7 +bc_wide ins s get r 39 get r 35 get r 13 mul div get s 32 128 4 +bc_wide ins s get r 39 get r 20 get r 39 1 +bc_wide ins s get r 40 get r 31 get r 2 4 +bc_imm ins s get r 37 get r 32 get r 9 1 +bc_imm ins s get r 41 get r 15 BCNONE 1 +bc_imm ins s get r 42 get r 16 BCNONE 1 +bc_imm ins s get r 43 get r 18 BCNONE 1 +end +note Prefetch is an existing IR instruction with explicit control, never encoded bytes. +fn sg_pref ins edit ulong 8192 s edit ulong 64 op ulong d ulong a ulong sb ulong to void +bc_node s op d a BCNONE BCNONE +put s 21 0 +ctrl = bc_control 4 sb 1 and get s 1 2 true +put s 22 shl ctrl 32 +put s 1 or get s 1 2 +put s 2 or get s 2 shl ulong 1 sb +if ge get s 0 1024 +put s 3 1 +ret +end +for k ulong 8 +put ins add mul get s 0 8 k get s add k 16 +end +put s 0 add get s 0 1 +end +fn sg_consume s edit ulong 64 sb ulong to void +mask = shl ulong 1 sb +put s 1 or get s 1 and get s 2 mask +put s 2 and get s 2 not mask +end +fn sg_pass ins edit ulong 8192 s edit ulong 64 r view ulong 128 to void +put s 49 get s 0 +bc_imm ins s get r 51 get r 41 get r 24 1 +if eq get s 36 0 +bc_wide ins s get r 44 get r 51 get r 1 mul get s 32 4 +bc_wide ins s get r 44 get r 25 get r 44 1 +bc_wide ins s get r 45 get r 10 get r 44 0 +else +for j ulong get s 39 +put s 8 div mul j get s 41 get s 40 +bc_imm ins s get r 52 get r 10 get r 51 get s 8 +bc_wide ins s get r 69 get r 52 get r 29 4 +put s 8 0 +bc_mem ins s 11 get r add j 56 get r 69 sg_kind j +end +for j ulong get s 39 +put s 8 mul get s 32 4 +bc_wide ins s get r add j 56 get r add j 56 get r 1 get s 8 +bc_wide ins s get r add j 56 get r 25 get r add j 56 1 +put s 8 mul j get s 41 +put s 8 rem get s 8 get s 40 +put s 8 mul get s 8 4 +bc_wide ins s get r add j 56 get r 10 get r add j 56 get s 8 +end +bc_inst ins s 2 get r 68 BCNONE 0 +end +bc_wide ins s get r 46 get r 10 get r 38 0 +bc_wide ins s get r 47 get r 10 get r 39 0 +for j ulong get s 34 +bc_inst ins s 1 get r add j 76 BCNONE 0 +end +sg_pref ins s get s 45 get r 96 get r 46 3 +sg_pref ins s 11 get r 98 get r 47 3 +bc_inst ins s 2 get r 48 BCNONE div get s 37 get s 38 +put s 50 get s 0 +end +fn sg_addresses ins edit ulong 8192 s edit ulong 64 r edit ulong 128 m edit ulong 2048 us ulong to void +put s 51 0 +if or ne add us 1 get s 38 gt get s 37 get s 38 +put s 51 1 +end +if eq get s 51 1 +put r 104 bc_vreg s m 2 false +put r 105 bc_vreg s m 2 false +end +put r 106 bc_vreg s m 1 false +if eq get s 51 1 +if ne add us 1 get s 38 +put s 8 mul add us 1 get s 40 +bc_wide ins s get r 104 get r 10 get r 46 get s 8 +put s 8 div get s 40 128 +put s 8 mul add us 1 get s 8 +put s 8 mul get s 8 4 +bc_wide ins s get r 105 get r 10 get r 47 get s 8 +else +for j ulong 3 +put r add j 107 bc_vreg s m 1 false +end +bc_imm ins s get r 107 get r 10 get r 48 4294967294 +bc_shift ins s get r 107 get r 107 0 31 +bc_imm ins s get r 107 get r 107 get r 10 4294967295 +put s 8 mul get s 38 get s 40 +bc_imm ins s get r 108 get r 107 BCNONE get s 8 +put s 8 div get s 40 128 +put s 8 mul get s 38 get s 8 +put s 8 mul get s 8 4 +bc_imm ins s get r 109 get r 107 BCNONE get s 8 +bc_wide ins s get r 104 get r 108 get r 46 1 +bc_wide ins s get r 105 get r 109 get r 47 1 +end +end +end +fn sg_stage_size s edit ulong 64 to void +put s 53 sub get s 39 get s 52 +if gt get s 53 4 +put s 53 4 +end +end +fn sg_stage_regs s edit ulong 64 r edit ulong 128 m edit ulong 2048 to void +for q ulong get s 53 +put r add q 110 bc_vreg s m 1 false +put r add q 114 bc_vreg s m 2 false +end +end +fn sg_stage_addr ins edit ulong 8192 s edit ulong 64 r view ulong 128 to void +for q ulong get s 53 +put s 57 add get s 52 q +put s 57 mul get s 57 get s 41 +if eq get s 36 1 +put s 59 add get s 52 q +put s 59 add get s 59 56 +put s 59 get r get s 59 +bc_wide ins s get r add q 114 get r 68 get s 59 1 +else +put s 8 div get s 57 get s 40 +put s 8 mul get s 8 get s 32 +put s 59 rem get s 57 get s 40 +put s 8 add get s 8 get s 59 +put s 8 mul get s 8 4 +bc_wide ins s get r add q 114 get r 10 get r 45 get s 8 +end +end +end +fn sg_stage_round ins edit ulong 8192 s edit ulong 64 r view ulong 128 to void +sg_stage_addr ins s r +for q ulong get s 53 +put s 8 0 +bc_mem ins s 11 get r add q 110 get r add q 114 sg_kind q +end +if and eq get s 51 1 eq get s 52 0 +put s 59 sub ulong 1 and get s 58 1 +sg_pref ins s get s 45 get r add get s 59 96 get r 104 add get s 59 3 +sg_pref ins s 11 get r add get s 59 98 get r 105 add get s 59 3 +end +for q ulong get s 53 +put s 8 add get s 52 q +put s 8 mul get s 8 get s 41 +put s 8 mul get s 8 4 +bc_imm ins s get r 106 get r 10 get r 26 get s 8 +bc_node s 50 BCNONE get r 106 get r add q 110 BCNONE +bc_emit ins s 5 +end +end +fn sg_stage ins edit ulong 8192 s edit ulong 64 r edit ulong 128 m edit ulong 2048 us ulong to void +put s 58 us +put s 52 0 +while lt get s 52 get s 39 bound 2 +sg_stage_size s +sg_stage_regs s r m +sg_stage_round ins s r +put s 52 add get s 52 4 +end +bc_node s 48 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 6 +sg_consume s add and us 1 3 +end +fn sg_decode ins edit ulong 8192 s edit ulong 64 r view ulong 128 wq ulong word ulong byteidx ulong to void +if lt byteidx 3 +put s 8 shl ulong 1 sub ulong 20 mul byteidx 8 +put s 9 word +bc_imad ins s 8 get r 70 wq BCNONE +else +bc_shift ins s get r 70 wq word 4 +end +bc_mask ins s get r 71 get r 70 0 shl ulong 127 20 +bc_mask ins s get r 72 wq word shl ulong 128 mul byteidx 8 +put s 8 1 +if lt byteidx 3 +put s 8 shl ulong 1 sub ulong 24 mul byteidx 8 +end +put s 9 0 +bc_imad ins s 8 get r add byteidx 100 get r 72 get r 71 +end +fn sg_group_lds ins edit ulong 8192 s edit ulong 64 r view ulong 128 q ulong to void +put s 8 add get s 60 q +put s 8 mul get s 8 get s 40 +put s 8 mul get s 8 4 +put s 62 mul get s 61 512 +put s 8 add get s 8 get s 62 +bc_node s 58 get r add q 92 get r 21 BCNONE BCNONE +put s 22 get s 8 +bc_emit ins s sg_kind q +end +fn sg_group_dot ins edit ulong 8192 s edit ulong 64 r view ulong 128 q ulong to void +put s 62 add get s 60 q +put s 62 add get s 62 84 +put s 62 get r get s 62 +for byteidx ulong 4 +put s 9 byteidx +bc_ffma ins s get s 62 get r add byteidx 100 get r add q 92 get s 62 +end +end +fn sg_group ins edit ulong 8192 s edit ulong 64 r view ulong 128 m0 ulong word ulong to void +put s 60 m0 +put s 61 word +nb = sub get s 34 m0 +if gt nb 4 +nb = 4 +end +for q ulong nb +sg_group_lds ins s r q +end +for q ulong nb +sg_group_dot ins s r q +end +end +fn sg_wordcompute ins edit ulong 8192 s edit ulong 64 r view ulong 128 word ulong to void +put s 59 add and get s 58 1 96 +put s 59 get r get s 59 +for byteidx ulong 4 +sg_decode ins s r get s 59 word byteidx +end +for batch ulong div add get s 34 3 4 +sg_group ins s r mul batch 4 word +end +end +fn sg_compute ins edit ulong 8192 s edit ulong 64 r view ulong 128 us ulong to void +for row ulong get s 34 +bc_inst ins s 1 get r add row 84 BCNONE 0 +end +for word ulong div get s 33 4 +sg_wordcompute ins s r word +end +put s 59 add and us 1 98 +put s 59 get r get s 59 +for row ulong get s 34 +put s 60 get r add row 76 +put s 61 get r add row 84 +put s 9 0 +bc_ffma ins s get s 60 get s 61 get s 59 get s 60 +end +bc_node s 48 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 6 +if eq get s 36 1 +bc_imm ins s get r 68 get r 10 get r 68 mul get s 40 4 +else +bc_wide ins s get r 45 get r 10 get r 45 mul get s 40 4 +end +end +fn sg_kend ins edit ulong 8192 s edit ulong 64 r view ulong 128 to void +bc_wide ins s get r 46 get r 10 get r 46 mul get s 38 get s 40 +put s 8 div get s 40 128 +put s 8 mul get s 38 get s 8 +put s 8 mul get s 8 4 +bc_wide ins s get r 47 get r 10 get r 47 get s 8 +bc_imm ins s get r 48 get r 10 get r 48 4294967295 +bc_pred ins s get r 48 get r 10 +at = bc_branch ins s get s 50 true +sg_consume s 3 +sg_consume s 4 +end +fn sg_store ins edit ulong 8192 s edit ulong 64 r view ulong 128 to void +for row ulong get s 34 +for q ulong 5 +bc_node s 42 get r 51 get r add row 76 BCNONE BCNONE +put s 22 shr ulong 16 q +bc_emit ins s 2 +put s 59 get r add row 76 +bc_node s 30 get s 59 get s 59 get r 51 BCNONE +bc_emit ins s 0 +end +end +bc_node s 8 get r 52 get r 41 get r 23 BCNONE +bc_emit ins s 0 +bc_wide ins s get r 49 get r 52 get r 40 1 +if eq get s 36 1 +for row ulong get s 34 +bc_imm ins s get r 52 get r 10 get r 41 row +bc_wide ins s get r 69 get r 52 get r 30 4 +put s 8 0 +bc_mem ins s 11 get r add row 64 get r 69 sg_kind row +end +end +for row ulong get s 34 +bc_imm ins s get r 52 get r 10 get r 42 sub ulong 4294967295 row +bc_shift ins s get r 53 get r 52 0 31 +bc_imm ins s get r 54 get r 53 get r 37 1 +bc_pred ins s get r 54 get r 10 +put s 54 get s 0 +bc_node s 54 BCNONE BCNONE BCNONE BCNONE +put s 22 2 +bc_emit ins s 9 +put s 55 bc_branch ins s add get s 0 1 true +if eq get s 36 1 +bc_node s 8 get r 52 get r add row 64 get r 23 BCNONE +bc_emit ins s 0 +bc_wide ins s get r 50 get r 52 get r 40 1 +else +bc_wide ins s get r 50 get r 23 get r 49 row +end +bc_node s 12 BCNONE get r 50 get r add row 76 BCNONE +put s 21 0 +bc_emit ins s 5 +put s 56 get s 0 +bc_node s 55 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 10 +bc_patch ins get s 55 get s 56 +bc_patch ins get s 54 add get s 56 1 +end +bc_imm ins s get r 41 get r 10 get r 41 get s 34 +bc_imm ins s get r 42 get r 10 get r 42 sub ulong 4294967296 get s 34 +bc_imm ins s get r 43 get r 10 get r 43 4294967295 +bc_pred ins s get r 43 get r 10 +at = bc_branch ins s get s 49 true +bc_imm ins s get r 27 get r 4 get r 27 1 +at = bc_branch ins s get s 47 false +bc_patch ins get s 48 get s 0 +bc_patch ins get s 46 get s 0 +bc_node s 45 BCNONE BCNONE BCNONE BCNONE +bc_emit ins s 7 +note Source tail is an IR self BRA with fixed control 0x000fc000. +bc_node s 46 BCNONE BCNONE BCNONE BCNONE +put s 22 shl ulong 1032192 32 +if lt get s 0 1024 +for k ulong 8 +put ins add mul get s 0 8 k get s add k 16 +end +put s 0 add get s 0 1 +else +put s 3 1 +end +end +fn bc_staged spec view ulong 16 ins edit ulong 8192 m edit ulong 2048 stats edit ulong 4 to uint +s = new ulong 64 0 +r = new ulong 128 18446744073709551615 +sg_clear ins m stats +if not sg_valid spec +ret 1 +end +for k ulong 5 +put s add k 32 get spec k +end +put s 37 div get s 32 mul get s 33 32 +put s 38 get s 37 +if eq rem get s 37 2 0 +put s 38 2 +end +put s 39 div mul get s 34 get s 33 get s 35 +put s 40 mul get s 33 32 +put s 41 mul get s 35 32 +put s 42 bc_log div ulong 128 get s 33 +put s 43 bc_log get s 34 +put s 44 bc_log get s 40 +put s 45 56 +if eq get s 33 16 +put s 45 57 +end +sg_regs m s r +sg_prologue ins s r +sg_loopregs m s r +sg_row ins s r +sg_pass ins s r +for us ulong get s 38 +sg_addresses ins s r m us +sg_stage ins s r m us +sg_compute ins s r us +end +sg_kend ins s r +sg_store ins s r +if ne get s 3 0 +sg_clear ins m stats +ret 2 +end +put stats 0 get s 0 +put stats 1 get s 4 +put stats 2 get s 5 +put stats 3 mul mul get s 34 128 get s 33 +ret 0 +end diff --git a/om/quant/.crumb b/om/quant/.crumb index 317c4f06..37e17f56 100644 --- a/om/quant/.crumb +++ b/om/quant/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-28T11:57:43Z", + "compiled_at": "2026-10-28T16:54:45Z", "compiler": "crumb-compile/1", - "digest": "sha256:df444a4851a11488c9f816664d2271ba87c9a35183fd1e247cc8cc5e0ff18f3f", + "digest": "sha256:85584a1383afc834dcf95e2d86a372c72cb4653e88c5d8dfa34636da93397228", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 0, - "generated_at_commit": "b759afc3f5e46f152ffb06b39882ffa28cacaf96", - "source_tree": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "files": 1, + "generated_at_commit": "2198c509a5591fa09487e1d30f11447c719d9f98", + "source_tree": "sha256:40773d79efbb63efa90821133fd7632d6fe0ffab8da60dd594945217f967e778" } }, "layer": "realization", diff --git a/tests/bw_warp_sim.h b/tests/bw_warp_sim.h index 6bd23e22..8652710e 100644 --- a/tests/bw_warp_sim.h +++ b/tests/bw_warp_sim.h @@ -47,7 +47,9 @@ #include #define WS_WARP 32 +#ifndef WS_MAX_THREADS #define WS_MAX_THREADS 256 +#endif #define WS_MAX_WARPS (WS_MAX_THREADS / WS_WARP) #define WS_MAX_FRAGS 64 #define WS_NBAR BW_RECONV_MAX_BAR diff --git a/tests/components/.crumb b/tests/components/.crumb new file mode 100644 index 00000000..cf538e5d --- /dev/null +++ b/tests/components/.crumb @@ -0,0 +1,19 @@ +{ + "extensions": { + "generated": { + "children": [], + "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "compiled_at": "2026-10-28T16:54:45Z", + "compiler": "crumb-compile/1", + "digest": "sha256:71a5e4075ce92cc88d89b08c8a8986baf095bf60ef0fef90389948b768650026", + "evidence_files": 0, + "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "files": 16, + "generated_at_commit": "2198c509a5591fa09487e1d30f11447c719d9f98", + "source_tree": "sha256:bee726888f639bfc65369c92659636a0dc91fcd23faf599edf8908845d5e9ae9" + } + }, + "name": "componenttests", + "purpose": "Native composer host acceptance and independent oracles", + "schema_version": "1.0.0" +} diff --git a/tests/components/cases.om b/tests/components/cases.om new file mode 100644 index 00000000..c44e2b36 --- /dev/null +++ b/tests/components/cases.om @@ -0,0 +1,479 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Native host acceptance only; C references and numerical executables are verification oracles. +note Concatenate into the OM2 conductor after proc.om; no standalone main. +global KCActual uchar 256 +global KCAn ulong 1 +global KCCode uchar 256 +global KCCn ulong 1 +global KCBytes ulong 1 +global KCNum uchar 256 +global KCNn ulong 1 +global KCCfg ulong 16 +global KCFrame uchar 262144 +global KCSize ulong 1 +text KCPrefix "build/components/" +text KCDirect "direct" +text KCRow "rowpipe" +text KCStaged "staged" +text KCDash "-" +text KCActExt ".actual" +text KCExpExt ".expected" +text KCBinExt ".bin" +text KCSasExt ".sass" +text KCNumExt ".numeric" +text KCOracle "-oracle" +text KCInput "build/components/input" +text KCBadOut "build/components/control.actual" +text KCBadRef "build/components/control.expected" +text KCRef0 "build/components/rowpipe-0.actual" +text KCUnit "build/components/component-unit" +text KCCmp "build/components/compose-unit" +text KCGemv "build/components/numerical-gemv" +text KCStageN "build/components/numerical-staged" +text KCDisB "-b" +text KCSM "SM121" +text KCZero "0" +text KCOne "1" +text KCTwo "2" +text KCInv "INVALID" +text KCUnk "UNKNOWN" +text KCSbB "--sb-b" +text KCSbRd "--sb-rd" +text KCBranch "--branch" +text KCRText ".record" +text KCRBad ".record-mutant" +text KCRec "build/components/record-unit" +text KCRecMut "build/components/record-mutant" +text KCDSpecs "256 8 1 4 0\n256 8 1 4 1\n512 16 1 4 0\n512 16 1 4 1\n2048 8 2 8 0\n2048 8 2 8 1\n4096 16 4 16 0\n4096 16 4 16 1\n" +text KCRSpecs "256 8 1 1\n768 8 1 5\n512 16 8 16\n4096 16 1 32\n256 8 2 1\n256 8 4 1\n256 8 8 1\n512 16 1 1\n512 16 2 3\n512 16 4 3\n1024 8 1 2\n2048 16 1 4\n1536 16 1 5\n1024 16 2 3\n" +text KCSSpecs "2048 16 4 16 0\n2048 16 8 16 0\n2048 16 4 16 1\n768 8 4 8 0\n1024 16 4 16 0\n256 8 4 8 0\n" + +fn kc_piece dst edit uchar * pos ulong src view uchar * used ulong to ulong +hp_require le used sub len dst pos +for j ulong used +put dst add pos j get src j +end +ret add pos used +end +fn kc_family fam ulong dst edit uchar * pos ulong to ulong +if eq fam 1 +ret kc_piece dst pos KCDirect len KCDirect +end +if eq fam 2 +ret kc_piece dst pos KCRow len KCRow +end +hp_require eq fam 3 +ret kc_piece dst pos KCStaged len KCStaged +end +fn kc_name fam ulong idx ulong suffix view uchar * dst edit uchar * to ulong +num = new uchar 32 0 +pos = kc_piece dst 0 KCPrefix len KCPrefix +pos = kc_family fam dst pos +pos = kc_piece dst pos KCDash len KCDash +used = hp_num idx num +pos = kc_piece dst pos num used +ret kc_piece dst pos suffix len suffix +end +fn kc_binary fam ulong suffix view uchar * used ulong dst edit uchar * to ulong +pos = kc_piece dst 0 KCPrefix len KCPrefix +pos = kc_family fam dst pos +ret kc_piece dst pos suffix used +end +fn kc_load table view uchar * idx ulong fields ulong to void +for j ulong 16 +put KCCfg j 0 +end +pos = ulong 0 +line = ulong 0 +while lt line idx bound 1024 +hp_require lt pos len table +if eq get table pos 10 +line = add line 1 +end +pos = add pos 1 +end +for j ulong fields +v = ulong 0 +digits = ulong 0 +while lt pos len table bound 20 +c = get table pos +pos = add pos 1 +if or eq c 32 eq c 10 +break +end +hp_require and ge c 48 le c 57 +v = add mul v 10 sub ulong c 48 +digits = add digits 1 +end +hp_require gt digits 0 +put KCCfg j v +end +end +fn kc_spec fam ulong idx ulong to void +if eq fam 1 +kc_load KCDSpecs idx 5 +else +if eq fam 2 +kc_load KCRSpecs idx 4 +else +hp_require eq fam 3 +kc_load KCSSpecs idx 5 +end +end +end +note Globals are never function arguments at the pinned compiler. Copy paths locally. +fn kc_save which ulong path view uchar * used ulong to void +hp_require le used 256 +for j ulong used +if eq which 0 +put KCActual j get path j +else +if eq which 1 +put KCCode j get path j +else +put KCNum j get path j +end +end +end +if eq which 0 +put KCAn 0 used +else +if eq which 1 +put KCCn 0 used +else +put KCNn 0 used +end +end +end +fn kc_path which ulong path edit uchar * to ulong +used = get KCAn 0 +if eq which 1 +used = get KCCn 0 +end +if eq which 2 +used = get KCNn 0 +end +hp_require le used len path +for j ulong used +if eq which 0 +put path j get KCActual j +else +if eq which 1 +put path j get KCCode j +else +put path j get KCNum j +end +end +end +ret used +end +fn kc_read path view uchar * used ulong to ulong +buf = new uchar 262144 0 +n = hp_read path used buf len buf +for j ulong n +put KCFrame j get buf j +end +put KCSize 0 n +ret n +end +fn kc_store path view uchar * used ulong count ulong to void +fd = int fopen path 0 used 578 420 +hp_require ge fd 0 +pos = ulong 0 +while lt pos count bound 262144 +n = write fd KCFrame pos sub count pos +if eq n -4 +continue +end +hp_require gt n 0 +pos = add pos ulong n +end +hp_require eq fclose fd 0 +end +fn kc_pack words ulong to void +for j ulong words +v = get KCCfg j +base = mul j 8 +for k ulong 8 +shift = mul k 8 +octet = uchar and shr v shift 255 +pos = add base k +put KCFrame pos octet +end +end +end +fn kc_input fam ulong used ulong to void +for j ulong 129 +put KCFrame j 0 +end +words = ulong 8 +if eq fam 3 +words = 16 +end +kc_pack words +kc_store KCInput len KCInput used +end +fn kc_run infd int path view uchar * used ulong status long to void +fd = int fopen path 0 used 578 420 +hp_require ge fd 0 +hp_exec infd fd status +hp_require eq fclose fd 0 +end +fn kc_native fam ulong used ulong status long to void +path = new uchar 256 0 +n = kc_binary fam KCOracle 0 path +kc_input fam used +fd = int fopen KCInput 0 len KCInput 0 0 +hp_require ge fd 0 +hp_start path n +kc_run fd KCBadOut len KCBadOut status +hp_require eq fclose fd 0 +end +fn kc_args fam ulong to void +num = new uchar 32 0 +fields = ulong 5 +if eq fam 2 +fields = 4 +end +for j ulong fields +n = hp_num get KCCfg j num +hp_arg num n +end +end +fn kc_ref fam ulong path view uchar * used ulong to void +bin = new uchar 256 0 +n = kc_binary fam KCOracle len KCOracle bin +hp_start bin n +kc_args fam +kc_run -1 path used 0 +end +fn kc_word off ulong to ulong +hp_require le add off 8 get KCSize 0 +v = ulong 0 +for j ulong 8 +v = or v shl ulong get KCFrame add off j mul j 8 +end +ret v +end +fn kc_offset fam ulong to ulong +prefix = ulong 0 +if eq fam 3 +prefix = 8 +hp_require eq kc_word 0 0 +end +n = kc_word prefix +nv = kc_word add prefix 8 +nu = kc_word add prefix 16 +hp_require and gt n 0 le n 1024 +hp_require and le nv 256 le nu 64 +regs = mul add nv nu 16 +start = add add prefix 48 regs +start = add start mul n 64 +hp_require le start get KCSize 0 +ret start +end +fn kc_code start ulong to void +code = new uchar 16384 0 +path = new uchar 256 0 +used = sub get KCSize 0 start +hp_require and gt used 0 le used len code +for j ulong used +put code j get KCFrame add start j +end +pn = kc_path 1 path +hp_write path pn code used +put KCBytes 0 used +end +fn kc_extract fam ulong to void +path = new uchar 256 0 +pn = kc_path 0 path +n = kc_read path pn +start = kc_offset fam +kc_code start +end +fn kc_match sass view uchar * pos ulong word view uchar * used ulong to bool +if gt len word sub used pos +ret false +end +for j ulong len word +c = get sass add pos j +if and ge c 97 le c 122 +c = sub c 32 +end +if ne c get word j +ret false +end +end +ret true +end +fn kc_dis fam ulong idx ulong to void +path = new uchar 256 0 +codepath = new uchar 256 0 +sass = new uchar 1048576 0 +n = kc_name fam idx KCSasExt path +cn = kc_path 1 codepath +hp_tool 2 +hp_arg KCDisB len KCDisB +hp_arg KCSM len KCSM +hp_arg codepath cn +kc_run -1 path n 0 +used = hp_read path n sass len sass +for j ulong used +hp_require not kc_match sass j KCInv used +hp_require not kc_match sass j KCUnk used +end +end +fn kc_numeric fam ulong to void +path = new uchar 256 0 +output = new uchar 256 0 +pn = kc_path 0 path +on = kc_path 2 output +if eq fam 3 +hp_start KCStageN len KCStageN +else +hp_start KCGemv len KCGemv +end +hp_arg path pn +kc_args fam +if eq fam 2 +hp_arg KCZero len KCZero +hp_arg KCTwo len KCTwo +else +hp_arg KCOne len KCOne +end +kc_run -1 output on 0 +end +fn kc_record fam ulong idx ulong expect view uchar * en ulong to void +path = new uchar 256 0 +for mutant ulong 2 +fd = int fopen expect 0 en 0 0 +hp_require ge fd 0 +status = long 0 +n = ulong 0 +if eq mutant 0 +n = kc_name fam idx KCRText path +hp_start KCRec len KCRec +else +n = kc_name fam idx KCRBad path +hp_start KCRecMut len KCRecMut +status = 70 +end +kc_args fam +kc_run fd path n status +hp_require eq fclose fd 0 +end +end +fn kc_positive fam ulong idx ulong to void +path = new uchar 256 0 +expect = new uchar 256 0 +cfg = new ulong 16 0 +actual = new uchar 256 0 +n = kc_name fam idx KCActExt actual +kc_save 0 actual n +n = kc_name fam idx KCBinExt path +kc_save 1 path n +n = kc_name fam idx KCNumExt path +kc_save 2 path n +n = kc_binary fam KCOracle 0 path +used = ulong 64 +if eq fam 3 +used = 128 +end +kc_input fam used +fd = int fopen KCInput 0 len KCInput 0 0 +hp_require ge fd 0 +hp_start path n +kc_run fd actual get KCAn 0 0 +hp_require eq fclose fd 0 +en = kc_name fam idx KCExpExt expect +kc_ref fam expect en +hp_require hp_cmp actual get KCAn 0 expect en +kc_extract fam +kc_dis fam idx +kc_numeric fam +if eq fam 3 +kc_record fam idx expect en +end +for j ulong 16 +put cfg j get KCCfg j +end +rc_case fam idx cfg +end +fn kc_empty path view uchar * used ulong to void +n = kc_read path used +hp_require eq n 0 +end +fn kc_reserved fam ulong to void +kc_spec fam 0 +used = ulong 64 +status = long 66 +slot = ulong 5 +if eq fam 3 +used = 128 +status = 0 +slot = 6 +end +put KCCfg slot 1 +kc_native fam used status +if eq fam 3 +n = kc_read KCBadOut len KCBadOut +hp_require eq n 8 +hp_require eq kc_word 0 1 +else +kc_empty KCBadOut len KCBadOut +end +end +fn kc_mutant mutation view uchar * to void +path = new uchar 256 0 +n = kc_binary 2 KCOracle len KCOracle path +hp_start path n +kc_args 2 +hp_arg mutation len mutation +kc_run -1 KCBadRef len KCBadRef 0 +hp_require not hp_cmp KCRef0 len KCRef0 KCBadRef len KCBadRef +end +fn kc_resource to void +path = new uchar 256 0 +kc_spec 2 0 +put KCCfg 0 4096 +put KCCfg 3 16 +kc_native 2 64 67 +kc_empty KCBadOut len KCBadOut +n = kc_binary 2 KCOracle len KCOracle path +fd = int fopen KCInput 0 len KCInput 0 0 +hp_require ge fd 0 +hp_start path n +kc_run fd KCBadRef len KCBadRef 66 +hp_require eq fclose fd 0 +kc_empty KCBadRef len KCBadRef +kc_native 2 63 65 +kc_empty KCBadOut len KCBadOut +kc_native 2 65 65 +kc_empty KCBadOut len KCBadOut +end +fn kc_cases to void +hp_start KCUnit len KCUnit +hp_exec -1 -1 0 +hp_start KCCmp len KCCmp +hp_exec -1 -1 0 +for fam ulong 3 +family = add fam 1 +count = ulong 8 +if eq family 2 +count = 14 +end +if eq family 3 +count = 6 +end +for idx ulong count +kc_spec family idx +kc_positive family idx +end +kc_reserved family +end +kc_spec 2 0 +kc_mutant KCSbB +kc_mutant KCSbRd +kc_mutant KCBranch +kc_resource +end diff --git a/tests/components/component-unit.om b/tests/components/component-unit.om new file mode 100644 index 00000000..77a68beb --- /dev/null +++ b/tests/components/component-unit.om @@ -0,0 +1,117 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Concatenate allocator,effect,check,project,then this host-only unit caller. +fn ut_ir ins edit ulong 8192 meta edit ulong 2048 n ulong to int +old = get ins 0 +put ins 0 999 +if eq bc_ircheck ins n meta 0 +ret 5 +end +put ins 0 old +for i ulong n +base = mul i 8 +op = get ins base +if eq op 56 +slot = add base 6 +old = get ins slot +put ins slot and old 4294967295 +if eq bc_ircheck ins n meta 0 +ret 6 +end +put ins slot old +reg = get ins add base 1 +width = get meta reg +put meta reg 1 +if eq bc_ircheck ins n meta 0 +ret 7 +end +put meta reg width +end +if eq op 54 +slot = add base 6 +old = get ins slot +put ins slot or shl shr old 32 32 2147483647 +if eq bc_ircheck ins n meta 0 +ret 8 +end +put ins slot old +end +end +ret 0 +end +fn ut_mma to int +ins = new ulong 8192 0 +meta = new ulong 2048 0 +s = new ulong 64 0 +args = new ulong 4 0 +bc_node s 1 0 1 BCNONE BCNONE +bc_emit ins s 13 +if eq get s 3 0 +ret 11 +end +for j ulong 64 +put s j 0 +end +for j ulong 4 +put args j j +put meta j 4 +end +put meta 2 2 +if ne bc_mma ins s meta args 0 +ret 12 +end +if ne get s 0 3 +ret 13 +end +if ne shr get ins 6 32 bc_control 8 7 7 0 false +ret 14 +end +if ne shr get ins 14 32 bc_control 15 7 7 0 false +ret 15 +end +if ne shr get ins 22 32 bc_control 14 7 7 0 false +ret 16 +end +put meta 2 1 +if eq bc_mma ins s meta args 0 +ret 17 +end +ret 0 +end +fn main to int +spec = new ulong 8 0 +ins = new ulong 8192 0 +meta = new ulong 2048 0 +phys = new ulong 288 0 +st = new ulong 4 0 +rs = new ulong 4 0 +put spec 0 256 +put spec 1 8 +put spec 2 1 +put spec 3 4 +if ne bc_project spec ins meta st 0 +ret 1 +end +if ne bc_ircheck ins get st 0 meta 0 +ret 2 +end +if ne bc_regalloc ins get st 0 meta phys rs 128 0 +ret 3 +end +if eq bc_regalloc ins get st 0 meta phys rs 3 0 +ret 4 +end +rc = ut_ir ins meta get st 0 +if ne rc 0 +ret rc +end +put spec 4 2 +if eq bc_project spec ins meta st 0 +ret 9 +end +put spec 4 0 +put spec 5 1 +if eq bc_project spec ins meta st 0 +ret 10 +end +ret ut_mma +end diff --git a/tests/components/compose-unit.om b/tests/components/compose-unit.om new file mode 100644 index 00000000..01c4c95f --- /dev/null +++ b/tests/components/compose-unit.om @@ -0,0 +1,53 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Actual root caller, not a generator-only substitute. +fn ut_compose cfg view ulong 16 to uint +ins = new ulong 8192 0 +m = new ulong 2048 0 +p = new ulong 288 0 +out = new ulong 8 0 +rc = bc_compose cfg ins m p out +if ne rc 0 +ret rc +end +if or eq get out 0 0 eq get out 1 0 +ret 99 +end +ret 0 +end +fn main to int +cfg = new ulong 16 0 +put cfg 0 1 +put cfg 1 256 +put cfg 2 8 +put cfg 3 1 +put cfg 4 4 +if ne ut_compose cfg 0 +ret 1 +end +put cfg 5 1 +if ne ut_compose cfg 0 +ret 2 +end +put cfg 0 2 +put cfg 5 0 +if ne ut_compose cfg 0 +ret 3 +end +put cfg 0 3 +put cfg 1 2048 +put cfg 2 16 +put cfg 3 4 +put cfg 4 16 +if ne ut_compose cfg 0 +ret 4 +end +put cfg 5 1 +if ne ut_compose cfg 0 +ret 5 +end +put cfg 6 1 +if eq ut_compose cfg 0 +ret 6 +end +ret 0 +end diff --git a/tests/components/direct-caller.om b/tests/components/direct-caller.om new file mode 100644 index 00000000..ec71aa4c --- /dev/null +++ b/tests/components/direct-caller.om @@ -0,0 +1,66 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Concatenate allocator,effect,project,repaired bw_enc_sm121,then this host caller. +global CTIn uchar 64 +global CTOut uchar 8 +fn ct_word v ulong to bool +for j ulong 8 +put CTOut j uchar and shr v mul j 8 255 +end +ret eq write 1 CTOut 0 8 8 +end +fn ct_parse spec edit ulong 8 to void +for k ulong 8 +v = ulong 0 +for j ulong 8 +v = or v shl ulong get CTIn add mul k 8 j mul j 8 +end +put spec k v +end +end +fn ct_frame ins view ulong 8192 meta view ulong 2048 phys view ulong 288 st view ulong 4 rs view ulong 4 to void +for k ulong 4 +ok = ct_word get st k +end +ok = ct_word get rs 1 +ok = ct_word get rs 2 +for k ulong get st 1 +ok = ct_word get meta k +ok = ct_word get phys k +end +for k ulong get st 2 +ok = ct_word get meta add k 256 +ok = ct_word get phys add k 256 +end +for k ulong mul get st 0 8 +ok = ct_word get ins k +end +end +fn main to int +spec = new ulong 8 0 +ins = new ulong 8192 0 +meta = new ulong 2048 0 +phys = new ulong 288 0 +st = new ulong 4 0 +rs = new ulong 4 0 +code = new uchar 16384 0 +if ne read 0 CTIn 0 64 64 +ret 65 +end +ct_parse spec +rc = bc_project spec ins meta st +if ne rc 0 +ret 66 +end +if ne bc_regalloc ins get st 0 meta phys rs 128 0 +ret 67 +end +nbytes = bc_encode ins phys get st 0 1 code +if eq nbytes 0 +ret 68 +end +ct_frame ins meta phys st rs +if ne write 1 code 0 nbytes long nbytes +ret 74 +end +ret 0 +end diff --git a/tests/components/direct-oracle.c b/tests/components/direct-oracle.c new file mode 100644 index 00000000..b88d05d9 --- /dev/null +++ b/tests/components/direct-oracle.c @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ +/* Verification only: existing C algorithm and independently retained C encoder. */ +#include "omega_blackwell_codegen_moe.h" +#include +#include +#include +static void word(uint64_t v) { for (unsigned j=0;j<8;j++) putchar((int)((v>>(j*8))&255)); } +static uint64_t reg(int v) { return v < 0 ? UINT64_MAX : (uint64_t)v; } +int main(int argc,char **argv) { + if(argc!=6) return 65; + OmegaFp8GemvSpec s={0}; + s.k=(uint32_t)strtoul(argv[1],NULL,10);s.lane_bytes=(uint32_t)strtoul(argv[2],NULL,10); + s.rows=(uint32_t)strtoul(argv[3],NULL,10);s.warps=(uint32_t)strtoul(argv[4],NULL,10); + s.wfirst=(uint32_t)strtoul(argv[5],NULL,10); + BlackwellIRProgram p; + omega_bw_ir_init(&p); + if(omega_blackwell_codegen_fp8_gemv_prog(&s,&p)!=0) return 66; + uint8_t code[16384]; size_t nbytes=0; + if(omega_bw_encode_program(&p,code,sizeof code,&nbytes)!=0) return 67; + word(p.count);word(p.regalloc.num_vregs);word(p.regalloc.num_uvregs);word(0); + word(p.regalloc.peak_gpr_usage);word(p.regalloc.peak_ugpr_usage); + for(int v=0;vbundle_size?q->bundle_size:(q->is_pair?2:(q->is_quad?4:1))); + word(reg(p.regalloc.vreg_to_phys[v])); + } + for(int v=0;vop);word(reg(i->dst_vreg));word(reg(i->src1_vreg));word(reg(i->src2_vreg)); + word(reg(i->src3_vreg));word(reg(i->ureg)); + word((uint64_t)i->imm|((uint64_t)i->control<<32)); + word((uint64_t)i->is_uniform|((uint64_t)i->predicate_p0<<1)|((uint64_t)i->predicate_not<<2)| + ((uint64_t)i->bar_reg<<8)|((uint64_t)i->dst_subreg<<16)|((uint64_t)i->src1_subreg<<24)| + ((uint64_t)i->src2_subreg<<32)|((uint64_t)i->src3_subreg<<40)); + } + if(fwrite(code,1,nbytes,stdout)!=nbytes) return 74; + return 0; +} diff --git a/tests/components/host-receipt.json b/tests/components/host-receipt.json new file mode 100644 index 00000000..b9070429 --- /dev/null +++ b/tests/components/host-receipt.json @@ -0,0 +1,29 @@ +{"conductor":"seeded Omega proc.om + cases.om + run.om","compiler":"2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f","source_baseline":"b759afc3f5e46f152ffb06b39882ffa28cacaf96","encoder_source_revision":"1c5a8398d93b49e6765c2e3752aaad8611027d0d","quant_source_revision":"fe25929ce71b11703eafa72395df2dd495aa61f2","physical_execution":"NOT_RUN: no GPU authority","cases":[ +{"family":"direct","spec":[256,8,1,4,0],"whole_frame_sha256":"b5bb30768c79fdd6e463153e38ce69663e6b7bfa6f9777f21e59d29aee3dc5e7","code_sha256":"b98ca8e082ea30ac4b4dfc6fd1c467dae9b2d7ec57e8e485d269a35bf75eb218","code_bytes":1792,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst4.6231305e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"direct","spec":[256,8,1,4,1],"whole_frame_sha256":"82e1fe1f85ae72da78da8435a467aeaad12ba3142355dda985111d5e74ab7e78","code_sha256":"4332a0604636db1bba0190e3924cca4a48bf1edbb92dcc436c329fb8a8f2186a","code_bytes":1792,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst4.6231305e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"direct","spec":[512,16,1,4,0],"whole_frame_sha256":"dfe766517383af13f38a3be4832881d7b1fbff1820e6d4fd08916cb9da0248e2","code_sha256":"5ddf1834fa8f873cfb408a3db23bf9ee98856717bca07eb0bc2de86ca5ea1203","code_bytes":2560,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst5.08413955e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"direct","spec":[512,16,1,4,1],"whole_frame_sha256":"f76f241f356bd835eee26ebb6c62649cdff353125ae6dee88065d36017490ce9","code_sha256":"c6e0000a724c9b60294c1c04fbdc9fd3d3d66a77644533bd3be6c7051b4f2a35","code_bytes":2560,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst5.08413955e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"direct","spec":[2048,8,2,8,0],"whole_frame_sha256":"b5c9e72c669b051bbb176fc6e34ab7cd0fd2e404f153c60669935693a7a16744","code_sha256":"54a6dccc0a7e28049b78b86143b773a1674169104437f38bdf6cdf795e57d3b0","code_bytes":2688,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst2.19413562e-08\u000awrong-result mutant: double-oracle bad192\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"direct","spec":[2048,8,2,8,1],"whole_frame_sha256":"205d60f19cfeef336863ee70719cc4ad19e0868f95b09da40309ae5c4cd5260d","code_sha256":"27df81f48fb5e37108b83ffac9432108245105f1f0bcad05a4db378b7ec5a05b","code_bytes":2688,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst2.19413562e-08\u000awrong-result mutant: double-oracle bad192\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"direct","spec":[4096,16,4,16,0],"whole_frame_sha256":"e28872ee8f3ef58ef893c7cc8d0f55f8854208dfb9960a408f67b7f3fdcf9989","code_sha256":"f0231a9e12751e58fd0f8235f15bc517f8fdc9f85f9bb2b0506e5265b2e93fe5","code_bytes":7168,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst2.34430326e-08\u000awrong-result mutant: double-oracle bad96\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"direct","spec":[4096,16,4,16,1],"whole_frame_sha256":"ec5e30c2dddd377866677ee0232f2a2daa69c1c0e1b9795d66cb1dabd26c6146","code_sha256":"7474910f589e2c87ec14c13f2b071085ae0ee8dabe34aa0cfe4b63e6b351b4e4","code_bytes":7168,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst2.34430326e-08\u000awrong-result mutant: double-oracle bad96\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[256,8,1,1],"whole_frame_sha256":"3a371f1666bd5dc9a19cf5b8194efe036ab870a7fc75895f8e6ec19f3ac35e91","code_sha256":"78bc0f2df9a571413ffcdd3a39ddbd5dbc7621110df820f61315dfaab377ac69","code_bytes":2464,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst4.6231305e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[768,8,1,5],"whole_frame_sha256":"a4a5dbd7262f52094cab063de88f87acb64495bfbe22b721dff58cb4e4df0566","code_sha256":"90aee5a111786f94c020e9811292fe00163d58149286958d01fb417e688673e3","code_bytes":4192,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst4.09446669e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[512,16,8,16],"whole_frame_sha256":"3098e413ee1a5dcc9f88eb391aedeecd213605f73347b3dea72b1f9c82c3f4ed","code_sha256":"0f74138cc209383a759856cc664ad93191bac3be216a67445d7d6584d3c3e885","code_bytes":14032,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst5.08413955e-08\u000awrong-result mutant: double-oracle bad48\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[4096,16,1,32],"whole_frame_sha256":"cdfaf9063264eac4a82ec5d8a2e485030d16fd6e5c566fdc03fd94e00f05428d","code_sha256":"26fa9aa2e8c7f13092ee0c3ce05af084817c463c3c5729bcf44886aa214d9b30","code_bytes":13776,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst2.34430326e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[256,8,2,1],"whole_frame_sha256":"9bb2ccf3ff595fd2d13e4a3fb675d8985b8c906162118147df82a0c82fea3870","code_sha256":"ed0b07997b07ff610a8fe4f606419a5a535f7f2d8c5adb4dee93dd088bc9e834","code_bytes":3408,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst4.6231305e-08\u000awrong-result mutant: double-oracle bad192\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[256,8,4,1],"whole_frame_sha256":"1175b512ada89033d8e325ef848f0d7627b70821f106fec855cd6b4d2e5b3647","code_sha256":"6f5f4a6656e609237cbebea8a515b122759a0da815f2ccd96f9b71f721580bb6","code_bytes":5296,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst4.6231305e-08\u000awrong-result mutant: double-oracle bad96\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[256,8,8,1],"whole_frame_sha256":"aa3277e5d7eb736c85893d6fed49e1cdb388d495498981eb44669bdae834696c","code_sha256":"baf48e0f39b2f28248aef84ceeb0d16f9eba8d6169a9cda47a713103e626859b","code_bytes":9072,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst4.6231305e-08\u000awrong-result mutant: double-oracle bad48\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[512,16,1,1],"whole_frame_sha256":"0e79082d41d08f8731e4b18b9bcf076f19d7b2229eae0a2bd9c47e6daf481633","code_sha256":"f027ef23ca78a894058c5dfb1f5fa03a7d84c6140239a6dc30c03e329bfce4ea","code_bytes":3680,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst5.08413955e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[512,16,2,3],"whole_frame_sha256":"69a78e64b0b94c6158b39e9c22fae4f07352aaf85d996683acae19dcf9626474","code_sha256":"f3a31d0e46633f8b8f6f676e60200fdc70e7dccece61a621e9e2566744692f41","code_bytes":4880,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst5.08413955e-08\u000awrong-result mutant: double-oracle bad192\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[512,16,4,3],"whole_frame_sha256":"f0724d95784e2823dc71db7f54c594e3441baacddce5e6cb9688f3a3749777a6","code_sha256":"14c088bcc43a1ea3d969efbd48ce58178826829f2a432ed65b56222162a65add","code_bytes":8112,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst5.08413955e-08\u000awrong-result mutant: double-oracle bad96\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[1024,8,1,2],"whole_frame_sha256":"0d7e5e353eef118c833e5e59d4d1b2312e22f0003d81f7836c4e9675b1c49aee","code_sha256":"951d37014603add081a6aed701bedfb9092ca68ca24c5ba95591204588a74724","code_bytes":5520,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst3.52032282e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[2048,16,1,4],"whole_frame_sha256":"2556960f0cd0a56319fc07874ef7272a3e387fbdb8ac1859bdff6d5a6e3cdecd","code_sha256":"31ff252e98a4bec3aceac3927c4a2ee85d0ae06db4ecb47f535da2ad213b7e58","code_bytes":8336,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst2.31778183e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[1536,16,1,5],"whole_frame_sha256":"b7c47a397281a2e803392726f2a0eaaf5c59fe17dd702a85bf5540e35c098c01","code_sha256":"115cc72a3661f7bc9c292960c57a12fa32d92f068a5a2ac16eb43fce2164c67f","code_bytes":6624,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst2.71861138e-08\u000awrong-result mutant: double-oracle bad384\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"rowpipe","spec":[1024,16,2,3],"whole_frame_sha256":"6bf26339edc695467a15ed717f407917beb8dda3a04745b1928d556cecbe5540","code_sha256":"4d21346c76a6c1a7c46139a599fade79f2ffe3fc2f581d595b243db9ec8e4c98","code_bytes":8160,"numerical_result":"native grouped gemv both fragment orders, distinct experts/X rows, double-oracle bad0 worst2.77894745e-08\u000awrong-result mutant: double-oracle bad192\u000aunknown-op mutant refused: run 0 (order 0, warp order 0): OP at pc 0: opcode not modelled\u000a","result":"PASS"}, +{"family":"staged","spec":[2048,16,4,16,0],"whole_frame_sha256":"b9c7ab925b8ac3218fa5da8b84ec1a4274bfbc3825178810dea6c3662aaf0cb0","code_sha256":"8a22d1b4d7410de7ba90c99b2df9d411cd57ca62be65874892c333dfe6ec7053","code_bytes":8320,"numerical_result":"native staged both fragment orders, empty segment, tail rows, multi-segment: 0 of 600 outputs differ from the emulation (bit-identical)\u000awrong-result mutant: 240 of 600 outputs differ from the emulation\u000aunknown-op mutant refused: order 0: OP at pc 0: opcode not modelled (pc 0)\u000a","staged_structural_result":"PASS staged canonical/launch/cfg/out8 controls and independent C statistics\u000a","result":"PASS"}, +{"family":"staged","spec":[2048,16,8,16,0],"whole_frame_sha256":"d2aadb24ccef714ab59c3c8faa9ef7bab63864061ad184d75f317959cc37afde","code_sha256":"14dda72a841737c0d05170e21d5c18f5b503070780c23e83dd35fc7b560174eb","code_bytes":12928,"numerical_result":"native staged both fragment orders, empty segment, tail rows, multi-segment: 0 of 600 outputs differ from the emulation (bit-identical)\u000awrong-result mutant: 160 of 600 outputs differ from the emulation\u000aunknown-op mutant refused: order 0: OP at pc 0: opcode not modelled (pc 0)\u000a","staged_structural_result":"PASS staged canonical/launch/cfg/out8 controls and independent C statistics\u000a","result":"PASS"}, +{"family":"staged","spec":[2048,16,4,16,1],"whole_frame_sha256":"4b9d01bba1d132fad59aa1ab6cbb5f9f47fab1569d4ea9585a112a3b59d521c3","code_sha256":"fda45ac0af6ea2b4e158f0bf741224f60ba9712fe1aab3a20bd8465f6f1f6bb8","code_bytes":8960,"numerical_result":"native staged both fragment orders, empty segment, tail rows, multi-segment, YMAP movement: 0 of 600 outputs differ from the emulation (bit-identical), rows moved by YMAP\u000awrong-result mutant: 240 of 600 outputs differ from the emulation, rows moved by YMAP\u000aunknown-op mutant refused: order 0: OP at pc 0: opcode not modelled (pc 0)\u000a","staged_structural_result":"PASS staged canonical/launch/cfg/out8 controls and independent C statistics\u000a","result":"PASS"}, +{"family":"staged","spec":[768,8,4,8,0],"whole_frame_sha256":"1187077d46bbde6a47308c5a0eb0cdb2f7b656609c612667f466c9c27cf1373e","code_sha256":"dcc15337b09a9567dac2ff8b3e909fce8cc1cc270ddcd85ddbd7c2998d1a9ba3","code_bytes":7424,"numerical_result":"native staged both fragment orders, empty segment, tail rows, multi-segment: 0 of 600 outputs differ from the emulation (bit-identical)\u000awrong-result mutant: 240 of 600 outputs differ from the emulation\u000aunknown-op mutant refused: order 0: OP at pc 0: opcode not modelled (pc 0)\u000a","staged_structural_result":"PASS staged canonical/launch/cfg/out8 controls and independent C statistics\u000a","result":"PASS"}, +{"family":"staged","spec":[1024,16,4,16,0],"whole_frame_sha256":"397a81243d3f0ebd069fbb667bc0420ff5645d28c48d441a0682ab06cde9b638","code_sha256":"2da1a95abf7f3c1f4fe858f641e17c27503ebecb10ed3a1494a5682983526b77","code_bytes":8064,"numerical_result":"native staged both fragment orders, empty segment, tail rows, multi-segment: 0 of 600 outputs differ from the emulation (bit-identical)\u000awrong-result mutant: 240 of 600 outputs differ from the emulation\u000aunknown-op mutant refused: order 0: OP at pc 0: opcode not modelled (pc 0)\u000a","staged_structural_result":"PASS staged canonical/launch/cfg/out8 controls and independent C statistics\u000a","result":"PASS"}, +{"family":"staged","spec":[256,8,4,8,0],"whole_frame_sha256":"4df0b5844620cf53da7265fdb92cea0409224dceedde6e29695e4cadaec4c947","code_sha256":"f3334526491398abf804757fa866674907376488ae8ee9986d4974eae86cf88f","code_bytes":4224,"numerical_result":"native staged both fragment orders, empty segment, tail rows, multi-segment: 0 of 600 outputs differ from the emulation (bit-identical)\u000awrong-result mutant: 240 of 600 outputs differ from the emulation\u000aunknown-op mutant refused: order 0: OP at pc 0: opcode not modelled (pc 0)\u000a","staged_structural_result":"PASS staged canonical/launch/cfg/out8 controls and independent C statistics\u000a","result":"PASS"}],"independent_numerical_execution":"PASS reused existing scalar/warp oracles on every native IR/allocation frame","composer_root":"PASS direct/changed-direct/rowpipe/dense-staged/mapped-staged and mutant refusal","negative_controls":["reserved component fields refuse","SB_B/SB_RD/branch reference mutations differ","native/oracle resource exhaustion refuses without output","truncated/oversized frames refuse without output","typed op/bundle/wait/branch/resource/MMA controls PASS","every native frame FFMA-to-FADD executes but numerical oracle disagrees","every native frame unknown-op refusal preserved"],"source_sha256":{"tests/components/proc.om":"3253be8b0dbc81956d3ebb2892e45837f85b3fc8030f09a7556c44056168bb42","tests/components/cases.om":"b0ca81ec23f90a23c7cfea3fdfb54582deea3a4e4d9a2df55ee5bb6678b003eb","tests/components/run.om":"324e63a7c5d4e22946d3be4638aca51a67bf4474dffe9ade653515411906dd73","tests/components/numerical.c":"2a681d826969bcf52422e19e60fc47d73f0529d536738f9007499732dbbfe2dc","tests/components/native-frame.h":"08e7f87ffa3360531e4779ac2b8cc9a8b93dad816b396a8be1f5d3d732640ca6","tests/gpu_fp8_api_test.c":"f71b34e1c77f9f6a17e62757e26a97b4f8f181ba746e5acad6ce87ebf2e81072","tests/gpu_fp8gemm_test.c":"c5a804c46c79da1cf2f4c1bd82f6ab0c2ee5e7f15f0438326392b3a657e6e3de","tests/bw_warp_sim.h":"f709e17cf4fceab93f1f33f8d63798dc652c6cf4e88d968532898b933dd5dc80","tests/bw_warp_sim_k.h":"2f7167ac67d9bb815372df0a8f8cd0cefcb05035b44313bd62f1e8354ecd02c2","src/omega_gpu_fp8_pack.c":"eaa651e04da8bd72957b374395e419e41872e3e1af761e9fba7135014445c87a","src/omega_gpu_hostmath.c":"9aee5b24d788434236f8dd0fd5d201c4dd6d78712adad966f44ce5797e71b622","src/omega_gpu_fp8gemm_api.c":"e89a21c96fd578bbb57990141c945f1098abaac90d230cbc3afffe26f58527b7","src/omega_blackwell_matmul.c":"457cafc15d3d040091e64830b1856367a3150d061dd450f15939d1c4462bde69","om/components/bw_alloc.om":"d19186b871f96c3983818cdd1a159f829c2f117f7e5c051d1f51fb39d846399b","om/components/bw_check.om":"3bed2f9d851560ed15997e1cc2d092c4342f5a1eef1a94311b844608d4d24fd6","om/components/bw_effect.om":"7656d6150f90c132cb1c50671b47f4cc996c170a919c58301d3e6f8612e0ea67","om/components/bw_project.om":"fdc86e652e51883bff2f3c01af20384db16a68af6ef9500f920016f10d354812","om/components/compose.om":"75ae7428c745582c97efd74c370851777062a5de80ac539c3c89ab0b410d0162","om/components/encode.om":"8d112a96ee2fe7719fc40bfafe91f8699a09905a532b0dea583f4b43b22ade4f","om/components/fixture.om":"082e53cff85d139de60bb0bc9dd83b8fc3368b7c1c09397699db9f30883ed3ee","om/components/realize.om":"990ee91cf164d5a77bfa2918ba77828550fc6d191abf40dd293523dda359931c","om/components/rowpipe.om":"6676bdb26037acff3739c2c0117869d9e52345dec5a987079ed9f2497783b43a","om/components/staged.om":"6c36ce4f58f04225558a384818573c76b11591bcb734c386ff8ee17149f87257","tests/components/component-unit.om":"d383d5df1f3b69e6392c21f912fbb87b6107be0088802363ce150183cb162965","tests/components/compose-unit.om":"514248f0b2f828870150800ef59c0940062c8711ed4de4bf1592d29a5dc648b1","tests/components/direct-caller.om":"829702d137a7b23d92ed7b50f74675c936023194c98ca7d89954daa7831a918a","tests/components/rowpipe-caller.om":"82ebf58234d79426c4a109321548c276bf6ca8695144e951e555798a6cd2840a","tests/components/staged-caller.om":"0c7c811686849666763ab31fd6550af14e322648bd1e19d6d91dc268677cc9c1","tests/components/direct-oracle.c":"14f68114d56814127e0a5d5370dd75f2b9718817aea0af005a8d69ce1f0b5e60","tests/components/rowpipe-oracle.c":"e125b8b3777c4ff1f3aa3db3c3ccba07c691570e0ba584df9a7eb08d84421cd1","tests/components/staged-oracle.c":"a64c615f4e00a85286ba3f4438f7b8af6490107b850939cb75c2683e9976c857","src/omega_blackwell_codegen.c":"5fad4042ea39e498a634dd34a6b833106430c934907a59bdfc8d5ddb074263b6","src/omega_blackwell_codegen_moe.c":"5db114eebcbb02ef0a4c016d7f94757f076b403d72a8ee0400d72d5e956af85d","src/omega_blackwell_codegen_moe2.c":"8032e43778c11da167697be3f20cd408fc8a37ee3b6863c894623c83292f5f19","src/omega_blackwell_codegen_gemm.c":"3bea15f1790dcb26be81cd98c40e52b6059256bb3c15c57b8726708a70d59921","src/omega_blackwell_codegen.h":"4d7e077e9e5b9682fe8fa14c0ea115eb8a4b6670fe2b8082b21c58b7d9ee4146","tests/components/wolfram.json":"33b2a6d34633221bf235433a30b5d760b9b795d5ac0176e02162c338074bc16c","om/components/admit.om":"b62d4647c7e19fe45103af148b2200708e557ba71ce7c533045684cd98089f0d","tests/components/record-unit.om":"8ea97f05b56bead49dc12bf75532dfa6d738248059863f2ee7ca330a3f383b04","om/quant/quant.om":"44bce96f3c274401e19a71b835814d69caf2bea8c2b1f4f43616c7c121232f09"},"encoder_source_sha256":{"om/encoder/bw_enc_sm121.om":"12369bf1e383e79a4926e7758aaf5f3f778f2945c91327ce0aa570babffc05e6","om/encoder/bw_spec_sm121.om":"d38dd63f842dff1dae525208576825f3a0027dead5ab2cde9482cf70b87e8ae9"},"tool_versions":{"nvdisasm":"nvdisasm: NVIDIA (R) CUDA disassembler\u000aCopyright (c) 2005-2025 NVIDIA Corporation\u000aBuilt on Thu_Aug_14_07:20:28_PM_PDT_2025\u000aCuda compilation tools, release 13.0, V13.0.85\u000aBuild cuda_13.0.r13.0/compiler.36400806_0\u000a","cc":"cc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0\u000aCopyright (C) 2023 Free Software Foundation, Inc.\u000aThis is free software; see the source for copying conditions. There is NO\u000awarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\u000a\u000a","sha256sum":"sha256sum (GNU coreutils) 9.4\u000aCopyright (C) 2023 Free Software Foundation, Inc.\u000aLicense GPLv3+: GNU GPL version 3 or later .\u000aThis is free software: you are free to change and redistribute it.\u000aThere is NO WARRANTY, to the extent permitted by law.\u000a\u000aWritten by Ulrich Drepper, Scott Miller, and David Madore.\u000a"}} diff --git a/tests/components/native-frame.h b/tests/components/native-frame.h new file mode 100644 index 00000000..1d70ca43 --- /dev/null +++ b/tests/components/native-frame.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ +/* Verification-only deserializer into the existing BlackwellIRProgram. + * No instructions, allocator, numerical algorithm, or interpreter live here. */ +#ifndef COMPONENT_NATIVE_FRAME_H +#define COMPONENT_NATIVE_FRAME_H +static BlackwellIRProgram native_program; +static int frame_word(FILE *f, uint64_t *v) { + unsigned char b[8]; + if (fread(b,1,8,f)!=8) return 0; + *v=0; for(unsigned j=0;j<8;j++) *v|=(uint64_t)b[j]<<(j*8); + return 1; +} +static int frame_reg(uint64_t n) { return n==UINT64_MAX ? -1 : (int)n; } +static int frame_load(const char *path,int staged) { + FILE *f=fopen(path,"rb"); if(!f) return 0; + uint64_t h[6],q[8],v; int ok=0; + memset(&native_program,0,sizeof native_program); + if(staged && (!frame_word(f,&v)||v)) goto done; + for(unsigned j=0;j<6;j++) if(!frame_word(f,&h[j])) goto done; + if(!h[0]||h[0]>BW_MAX_IR_INSNS||h[1]>BW_MAX_VREGS||h[2]>BW_MAX_UVREGS||h[4]>256||h[5]>64) goto done; + native_program.count=(size_t)h[0]; + OmegaRegAlloc *r=&native_program.regalloc; + r->num_vregs=(int)h[1];r->num_uvregs=(int)h[2];r->peak_gpr_usage=(uint32_t)h[4];r->peak_ugpr_usage=(uint32_t)h[5]; + for(unsigned bank=0;bank<2;bank++) for(int j=0;j<(bank?r->num_uvregs:r->num_vregs);j++) { + uint64_t width,phys; + if(!frame_word(f,&width)||!frame_word(f,&phys)||!width||width>128|| + (phys!=UINT64_MAX&&(phys>=(bank?64u:256u)||width>(bank?64u:256u)-phys))) goto done; + OmegaLiveInterval *l=bank?&r->uintervals[j]:&r->intervals[j]; + l->bundle_size=(uint32_t)width;l->is_pair=width==2;l->is_quad=width==4;l->vreg=j;l->phys_reg=frame_reg(phys); + if(bank) r->uvreg_to_phys[j]=frame_reg(phys);else r->vreg_to_phys[j]=frame_reg(phys); + } + for(size_t j=0;jop=(BlackwellIROpcode)q[0];i->dst_vreg=frame_reg(q[1]);i->src1_vreg=frame_reg(q[2]);i->src2_vreg=frame_reg(q[3]);i->src3_vreg=frame_reg(q[4]);i->ureg=frame_reg(q[5]); + i->imm=(uint32_t)q[6];i->control=(uint32_t)(q[6]>>32); + i->is_uniform=q[7]&1;i->predicate_p0=(q[7]>>1)&1;i->predicate_not=(q[7]>>2)&1; + i->bar_reg=(uint8_t)(q[7]>>8);i->dst_subreg=(uint8_t)(q[7]>>16);i->src1_subreg=(uint8_t)(q[7]>>24);i->src2_subreg=(uint8_t)(q[7]>>32);i->src3_subreg=(uint8_t)(q[7]>>40); + } + /* Code is independently compared/disassembled by the native Omega conductor, never interpreted here. */ + { size_t bytes=0;while(fgetc(f)!=EOF) bytes++; + if(ferror(f)||bytes16384) goto done; } + ok=1; +done: + fclose(f);return ok; +} +static int frame_wrong_result(void) { + for(size_t j=0;jk!=shape[0]||s->lane_bytes!=shape[1]||s->mt!=shape[2]||s->warps!=shape[3]||s->rowmap!=shape[4]||s->mutant) return -1; + *p=native_program;return 0; +} +#else +static int component_native_gemv(const OmegaFp8GemvSpec *s,BlackwellIRProgram *p) { + if(s->k!=shape[0]||s->lane_bytes!=shape[1]||s->rows!=shape[2]||s->warps!=shape[3]||s->wfirst!=shape[4]||s->mutant||s->coal||s->depth||s->sched) return -1; + *p=native_program;return 0; +} +int component_native_direct(const OmegaFp8GemvSpec *s,BlackwellIRProgram *p) {return component_native_gemv(s,p);} +int component_native_rowpipe(const OmegaFp8GemvSpec *s,BlackwellIRProgram *p) {return component_native_gemv(s,p);} +#endif +int main(int argc,char **argv) { + /* frame K LB rows/MT warps wfirst/rowmap family */ + if(argc!=8) return 65; + for(unsigned j=0;j<5;j++) shape[j]=(uint32_t)strtoul(argv[j+2],NULL,10); + char msg[512];size_t bad=0;int rc; +#ifdef COMPONENT_STAGED + if(!frame_load(argv[1],1)) return 66; + SimPt point={shape[0],40,shape[1],shape[2],shape[3],2,{1,5,9},3}; + int moved=0; + rc=sim_point2(&point,0,41,(int)shape[4],1,0,msg,sizeof msg,&bad,&moved); + if(rc||bad||(shape[4]&&!moved)) {fprintf(stderr,"native staged numerical: rc%d bad%zu: %s\n",rc,bad,msg);return 1;} + printf("native staged both fragment orders, empty segment, tail rows, multi-segment%s: %s\n",shape[4]?", YMAP movement":"",msg); + if(!frame_wrong_result()) return 67; + bad=0;rc=sim_point2(&point,0,41,(int)shape[4],1,0,msg,sizeof msg,&bad,&moved); + if(rc||!bad) {fprintf(stderr,"FFMA->FADD wrong-result mutant not numerically caught: %s\n",msg);return 2;} + printf("wrong-result mutant: %s\n",msg); + native_program.insns[0].op=(BlackwellIROpcode)0x7fffffff; + rc=sim_point2(&point,0,41,(int)shape[4],1,0,msg,sizeof msg,&bad,&moved); +#else + if(!frame_load(argv[1],0)) return 66; + g_sim_variant=atoi(argv[7]); + if(g_sim_variant!=1&&g_sim_variant!=2) return 65; + Weights weights;weights_make(&weights,3,128,shape[0],41); + uint32_t ids[3]={2,0,1},seed=42; + size_t words=(size_t)3*shape[0];float *x=malloc(words*4),*y=malloc(3*128*4); + if(!x||!y) return 68; + for(size_t j=0;jFADD wrong-result mutant not numerically caught: %s\n",msg);return 2;} + printf("wrong-result mutant: double-oracle bad%zu\n",bad); + native_program.insns[0].op=(BlackwellIROpcode)0x7fffffff; + rc=sim_gemv(&spec,&weights,3,ids,x,3,y,2,0,msg,sizeof msg); + weights_free(&weights);free(x);free(y); +#endif + if(!rc||!strstr(msg,"opcode not modelled")) {fprintf(stderr,"unknown-op refusal lost: rc%d %s\n",rc,msg);return 3;} + printf("unknown-op mutant refused: %s\n",msg); + return 0; +} diff --git a/tests/components/proc.om b/tests/components/proc.om new file mode 100644 index 00000000..fb1a02a5 --- /dev/null +++ b/tests/components/proc.om @@ -0,0 +1,633 @@ +om2 +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Concatenate into the conductor's om2 program; this unit has no main. +note Host forms checked with omega lookup at omega-mv e5b32567. +note Compiler SHA256 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f. +note Tool paths are configured by Main; each mutable count is a ulong 1 pool. +global HOm uchar 1024 +global HOn ulong 1 +global HEnc uchar 1024 +global HEn ulong 1 +global HDis uchar 1024 +global HDn ulong 1 +global HCc uchar 1024 +global HCn ulong 1 +global HSha uchar 1024 +global HSn ulong 1 +global HArg uchar 4096 +global HLen ulong 1 +global HCnt ulong 1 +global HSrc uchar 1048576 +global HUsed ulong 1 +text HPFail "component conductor refused\n" +text HPComp "build/components/compile.om" + +text HPExec "component exec refusal:" +text HPExp " expected=" +text HPSt0 " wait[0]=" +text HPSt1 " wait[1]=" +text HPSt2 " wait[2]=" +text HPSt3 " wait[3]=" +text HPPipe " exec-pipe=" +text HPByte " exec-byte=" +text HPArg " argv0=" +text HPNew "\n" +text HPMinus "-" + +fn hp_require ok bool to void +if not ok +note Diagnostics must not contaminate the JSON receipt on stdout. +r = write 2 HPFail 0 len HPFail +exit 90 +end +end + +fn hp_path a view uchar * n ulong to void +hp_require and gt n 0 le n len a +hp_require le n 4095 +for i ulong n +hp_require ne get a i 0 +end +end + +fn hp_start a view uchar * n ulong to void +hp_path a n +put HLen 0 2 +put HCnt 0 0 +put HArg 0 0 +put HArg 1 0 +hp_arg a n +end + +fn hp_arg a view uchar * n ulong to void +hp_require le n len a +hp_require le n 4092 +hp_require lt get HCnt 0 64 +p = get HLen 0 +hp_require and ge p 2 le p 4096 +hp_require le add n 2 sub 4096 p +for i ulong n +hp_require ne get a i 0 +end +put HArg p uchar and n 255 +put HArg add p 1 uchar shr n 8 +for i ulong n +put HArg add add p 2 i get a i +end +put HLen 0 add add p 2 n +c = add get HCnt 0 1 +put HCnt 0 c +put HArg 0 uchar and c 255 +put HArg 1 uchar shr c 8 +end + +note Main can select tools without borrowing a global pool as a function argument. +fn hp_tool which ulong to void +p = new uchar 1024 0 +n = ulong 0 +hp_require le which 3 +if eq which 0 +n = get HOn 0 +hp_require le n 1024 +for i ulong n +put p i get HOm i +end +end +if eq which 1 +n = get HCn 0 +hp_require le n 1024 +for i ulong n +put p i get HCc i +end +end +if eq which 2 +n = get HDn 0 +hp_require le n 1024 +for i ulong n +put p i get HDis i +end +end +if eq which 3 +n = get HSn 0 +hp_require le n 1024 +for i ulong n +put p i get HSha i +end +end +hp_start p n +end + +note Retry budgets are finite; exhausting one refuses instead of reporting success. +fn hp_get fd int b edit uchar * off ulong n ulong to long +for tries ulong 64 +r = read fd b off n +if ne r -4 +ret r +end +end +hp_require false +ret -4 +end + +fn hp_put fd int b view uchar * off ulong n ulong to long +for tries ulong 64 +r = write fd b off n +if ne r -4 +ret r +end +end +hp_require false +ret -4 +end + +fn hp_open p view uchar * n ulong flags int mode int to int +hp_path p n +for tries ulong 64 +r = fopen p 0 n flags mode +if ne r -4 +hp_require ge r 0 +ret int r +end +end +hp_require false +ret -1 +end + +note On Linux close releases the descriptor even when it reports EINTR; never retry it. +fn hp_close fd int to void +r = fclose fd +hp_require eq r 0 +end + +note Fill one chunk; independent short-read boundaries cannot create false mismatches. +fn hp_fill fd int b edit uchar * off ulong n ulong to ulong +hp_require le n 4096 +hp_require le off len b +hp_require le n sub len b off +used = ulong 0 +while lt used n bound 4096 +r = hp_get fd b add off used sub n used +hp_require ge r 0 +if eq r 0 +ret used +end +hp_require le ulong r sub n used +used = add used ulong r +end +ret used +end + +fn hp_wpart fd int b view uchar * off ulong n ulong to void +hp_require le n 4096 +hp_require le off len b +hp_require le n sub len b off +used = ulong 0 +while lt used n bound 4096 +r = hp_put fd b add off used sub n used +hp_require gt r 0 +hp_require le ulong r sub n used +used = add used ulong r +end +end + +fn hp_write path view uchar * n ulong b view uchar * used ulong to void +hp_require le used len b +fd = hp_open path n or int 577 524288 420 +off = ulong 0 +note Each outer pass completes up to 4096 bytes, even under one-byte short writes. +while lt off used bound 999999 +step = sub used off +if gt step 4096 +step = 4096 +end +hp_wpart fd b off step +off = add off step +end +hp_close fd +end + +fn hp_read path view uchar * n ulong b edit uchar * cap ulong to ulong +probe = new uchar 1 0 +hp_require le cap len b +fd = hp_open path n 524288 0 +used = ulong 0 +while lt used cap bound 999999 +step = sub cap used +if gt step 4096 +step = 4096 +end +k = hp_fill fd b used step +used = add used k +if lt k step +hp_close fd +ret used +end +end +note Exact-capacity input is accepted only after a separate EOF probe. +r = hp_get fd probe 0 1 +hp_require eq r 0 +hp_close fd +ret used +end + +fn hp_cat path view uchar * n ulong to void +b = new uchar 4096 0 +hp_require le get HUsed 0 len HSrc +fd = hp_open path n 524288 0 +for chunk ulong 999999 +k = hp_fill fd b 0 4096 +p = get HUsed 0 +hp_require le k sub len HSrc p +for i ulong k +put HSrc add p i get b i +end +put HUsed 0 add p k +if lt k 4096 +hp_close fd +ret +end +end +hp_require false +end + +fn hp_fdok fd int to void +b = new uchar 128 0 +for tries ulong 64 +r = fstat fd b 0 128 +if ne r -4 +hp_require eq r 0 +ret +end +end +hp_require false +end + +note Copy into an unused descriptor above stderr, without changing the parent's table. +note Called only after fork; this single-threaded child performs no concurrent opens. +fn hp_save fd int to int +b = new uchar 128 0 +for cand ulong 65536 +if ge cand 3 +r = fstat int cand b 0 128 +if eq r -4 +continue +end +if eq r -9 +for tries ulong 64 +r = dupfd fd int cand 524288 +if ne r -4 +if eq r long cand +ret int cand +end +ret -1 +end +end +ret -1 +end +if ne r 0 +ret -1 +end +end +end +ret -1 +end + +note A failed child writes the exec-error pipe and exits 127, never an expected tool exit. +fn hp_childbad errfd int to void +b = new uchar 1 1 +for tries ulong 64 +r = write errfd b 0 1 +if eq r 1 +exit 127 +end +if ne r -4 +break +end +end +note If the error cannot be reported, force a signaled status that the parent refuses. +r = killpid int getpid 9 +exit 127 +end + +fn hp_dupto fd int target int errfd int to void +if eq fd target +ret +end +for tries ulong 64 +r = dupfd fd target 0 +if ne r -4 +if ne r long target +hp_childbad errfd +end +ret +end +end +hp_childbad errfd +end + +fn hp_child infd int outfd int rd int wr int to void +errfd = wr +if lt wr 3 +errfd = hp_save wr +if lt errfd 0 +hp_childbad wr +end +r = fclose wr +if ne r 0 +hp_childbad errfd +end +end +r = fclose rd +if ne r 0 +hp_childbad errfd +end +saved = int -1 +if ge infd 0 +saved = hp_save infd +if lt saved 0 +hp_childbad errfd +end +end +note Preserve stdin first, so even the input=1/output=0 swap is well-defined. +if ge outfd 0 +if eq outfd 1 +temp = hp_save outfd +if lt temp 0 +hp_childbad errfd +end +hp_dupto temp 1 errfd +r = fclose temp +if ne r 0 +hp_childbad errfd +end +else +hp_dupto outfd 1 errfd +end +end +if ge saved 0 +hp_dupto saved 0 errfd +r = fclose saved +if ne r 0 +hp_childbad errfd +end +end +if gt infd 2 +r = fclose infd +if ne r 0 +hp_childbad errfd +end +end +if and gt outfd 2 ne outfd infd +r = fclose outfd +if ne r 0 +hp_childbad errfd +end +end +r = execprog HArg 0 get HLen 0 +hp_childbad errfd +end + +note Validate the complete canonical list before execprog can trap in a child. +fn hp_args to void +total = get HLen 0 +count = get HCnt 0 +hp_require and ge total 4 le total 4096 +hp_require and ge count 1 le count 64 +head = or ulong get HArg 0 shl ulong get HArg 1 8 +hp_require eq head count +p = ulong 2 +for record ulong count +hp_require le p sub total 2 +n = or ulong get HArg p shl ulong get HArg add p 1 8 +p = add p 2 +hp_require le n sub total p +if eq record 0 +hp_require gt n 0 +end +for i ulong n +hp_require ne get HArg add p i 0 +end +p = add p n +end +hp_require eq p total +end + + +fn hp_u32 b view uchar * off ulong to ulong +v = ulong 0 +for i ulong 4 +v = or v shl ulong get b add off i mul i 8 +end +ret v +end + +fn hp_wait pid long st edit uchar 4 to void +for tries ulong 64 +r = waitpid int pid st 0 4 0 +if ne r -4 +hp_require eq r pid +ret +end +end +hp_require false +end + +fn hp_say label view uchar * to void +hp_wpart 2 label 0 len label +end + +fn hp_diag label view uchar * value long to void +digits = new uchar 32 0 +hp_say label +v = value +if lt v 0 +hp_say HPMinus +v = neg v +end +n = hp_num ulong v digits +hp_wpart 2 digits 0 n +end + +fn hp_argv0 to void +hp_say HPArg +n = or ulong get HArg 2 shl ulong get HArg 3 8 +used = ulong 0 +while lt used n bound 4096 +r = long -4 +for tries ulong 64 +r = write 2 HArg add used 4 sub n used +if ne r -4 +break +end +end +if le r 0 +ret +end +used = add used ulong r +end +hp_say HPNew +end + +fn hp_result expected long st view uchar 4 piperc long marker uchar to void +ok = eq piperc 0 +ok = and ok eq get st 0 0 +ok = and ok eq get st 2 0 +ok = and ok eq get st 3 0 +ok = and ok eq long get st 1 expected +if not ok +hp_say HPExec +hp_diag HPExp expected +hp_diag HPSt0 long get st 0 +hp_diag HPSt1 long get st 1 +hp_diag HPSt2 long get st 2 +hp_diag HPSt3 long get st 3 +hp_diag HPPipe piperc +hp_diag HPByte long marker +hp_argv0 +end +hp_require ok +end + +fn hp_exec infd int outfd int expected long to void +ends = new uchar 8 0 +st = new uchar 4 0 +probe = new uchar 1 0 +hp_require and ge expected 0 le expected 255 +hp_args +if ge infd 0 +hp_fdok infd +end +if ge outfd 0 +hp_fdok outfd +end +r = long -4 +for tries ulong 64 +r = pipefds ends 0 8 524288 +if ne r -4 +break +end +end +hp_require eq r 0 +rd = int hp_u32 ends 0 +wr = int hp_u32 ends 4 +pid = fork +if eq pid 0 +hp_child infd outfd rd wr +exit 127 +end +if lt pid 0 +hp_close rd +hp_close wr +hp_require false +end +hp_close wr +hp_wait pid st +r = hp_get rd probe 0 1 +hp_close rd +note Error-pipe EOF and all four wait-status bytes are checked together. +hp_result expected st r get probe 0 +end + +note The global source is written directly, never passed across a global-borrow boundary. +fn hp_src fd int to void +hp_require le get HUsed 0 len HSrc +off = ulong 0 +while lt off get HUsed 0 bound 999999 +step = sub get HUsed 0 off +if gt step 4096 +step = 4096 +end +used = ulong 0 +while lt used step bound 4096 +r = long -4 +for tries ulong 64 +r = write fd HSrc add off used sub step used +if ne r -4 +break +end +end +hp_require gt r 0 +hp_require le ulong r sub step used +used = add used ulong r +end +off = add off step +end +end + +fn hp_build path view uchar * n ulong to void +hp_path path n +fd = hp_open HPComp len HPComp or int 577 524288 420 +hp_src fd +hp_close fd +infd = hp_open HPComp len HPComp 524288 0 +outfd = hp_open path n or int 577 524288 420 +hp_tool 0 +hp_exec infd outfd 0 +hp_close infd +hp_close outfd +for tries ulong 64 +r = chmod path 0 n 493 +if ne r -4 +hp_require eq r 0 +ret +end +end +hp_require false +end + +fn hp_equal a view uchar * b view uchar * used ulong to bool +hp_require le used len a +hp_require le used len b +for i ulong used +if ne get a i get b i +ret false +end +end +ret true +end + +fn hp_cmp a view uchar * an ulong b view uchar * bn ulong to bool +left = new uchar 4096 0 +right = new uchar 4096 0 +af = hp_open a an 524288 0 +bf = hp_open b bn 524288 0 +for chunk ulong 999999 +ac = hp_fill af left 0 4096 +bc = hp_fill bf right 0 4096 +if ne ac bc +hp_close af +hp_close bf +ret false +end +if not hp_equal left right ac +hp_close af +hp_close bf +ret false +end +if lt ac 4096 +hp_close af +hp_close bf +ret true +end +end +hp_require false +ret false +end + +fn hp_num value ulong dst edit uchar 32 to ulong +rev = new uchar 32 0 +v = value +n = ulong 0 +while true bound 32 +put rev n uchar add rem v 10 48 +n = add n 1 +v = div v 10 +if eq v 0 +break +end +end +for i ulong n +put dst i get rev sub sub n 1 i +end +ret n +end diff --git a/tests/components/record-unit.om b/tests/components/record-unit.om new file mode 100644 index 00000000..dc73198c --- /dev/null +++ b/tests/components/record-unit.om @@ -0,0 +1,217 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Verification entry: stdin is independent original-C staged frame; argv is K LB MT W rowmap. +note Conductor compares complete native/C frames and disassembles all code before this test. +text RUOk "PASS staged canonical/launch/cfg/out8 controls and independent C statistics\n" +fn ru_word h view uchar 56 k ulong to ulong +v = ulong 0 +for j ulong 8 +v = or v shl ulong get h add mul k 8 j mul j 8 +end +ret v +end +fn ru_arg k ulong to ulong +a = new uchar 8 0 +n = argread k a 0 8 +if or le n 0 gt n 5 +ret 0 +end +v = ulong 0 +for j ulong ulong n +c = get a j +if or lt c 48 gt c 57 +ret 0 +end +v = add mul v 10 sub ulong c 48 +end +if gt v 16384 +ret 0 +end +ret v +end +fn ru_bad b edit uchar 4096 field ulong value ulong to bool +old = compose_word b field +compose_put b field value +rc = compose_check b 1152 +compose_put b field old +ret ne rc 0 +end +fn ru_input cfg edit ulong 16 out edit ulong 8 to int +h = new uchar 56 0 +pos = ulong 0 +while lt pos 56 bound 56 +n = read 0 h pos sub ulong 56 pos +if le n 0 +ret 11 +end +pos = add pos ulong n +end +if ne ru_word h 0 0 +ret 12 +end +put cfg 0 3 +for j ulong 5 +put cfg add j 1 ru_arg add j 1 +end +put out 0 ru_word h 1 +put out 1 ru_word h 5 +put out 2 ru_word h 6 +put out 3 ru_word h 4 +put out 4 ru_word h 2 +put out 5 ru_word h 3 +ret 0 +end +fn ru_build cfg view ulong 16 b edit uchar 4096 l edit ulong 32 out edit ulong 8 to int +ins = new ulong 8192 0 +meta = new ulong 2048 0 +phys = new ulong 288 0 +fresh = new ulong 8 0 +if ne bc_compose cfg ins meta phys fresh 0 +ret 13 +end +for j ulong 8 +if ne get fresh j get out j +ret 14 +end +put out j get fresh j +end +ret ru_fill cfg b l out +end +fn ru_fill cfg view ulong 16 b edit uchar 4096 l edit ulong 32 out view ulong 8 to int +if ne compose_fixture b l 0 +ret 17 +end +compose_put b 4 64 +compose_put b 6 get cfg 1 +compose_put b 14 get cfg 3 +compose_put b 16 mul get cfg 2 32 +compose_put b 17 get cfg 4 +ks = div get cfg 1 mul get cfg 2 32 +u = ks +if eq rem ks 2 0 +u = 2 +end +compose_put b 18 u +compose_put b 19 3 +compose_put b 21 get out 3 +note Exact original-C omega_bw_gpr_declared expression, not a new launch policy. +decl = add get out 1 2 +decl = add decl 7 +decl = div decl 8 +decl = mul decl 8 +compose_put b 22 decl +compose_put b 25 mul get cfg 4 32 +put l 4 mul get cfg 4 32 +put l 7 get out 3 +put l 8 decl +put l 12 add ulong 8 mul get cfg 5 4 +ret 0 +end +fn ru_checks cfg edit ulong 16 b edit uchar 4096 l edit ulong 32 out edit ulong 8 to int +if ne bc_record cfg b l out 0 +ret 18 +end +decl = compose_word b 22 +peak = get out 1 +u = compose_word b 18 +note A removed +2 guard must be caught even when declaration remains eight-aligned. +put out 1 sub decl 1 +if eq bc_record cfg b l out 0 +ret 70 +end +put out 1 peak +if not ru_bad b 14 3 +ret 20 +end +if not ru_bad b 15 2 +ret 21 +end +if not ru_bad b 16 128 +ret 22 +end +if not ru_bad b 17 3 +ret 23 +end +if not ru_bad b 18 add u 1 +ret 24 +end +if not ru_bad b 21 sub get out 3 128 +ret 25 +end +if not ru_bad b 22 add decl 1 +ret 26 +end +if not ru_bad b 23 7 +ret 27 +end +if not ru_bad b 24 0 +ret 28 +end +if not ru_bad b 28 2 +ret 29 +end +put l 11 904 +if eq compose_launch b l 0 +ret 30 +end +put l 11 896 +put l 12 10 +if eq compose_launch b l 0 +ret 31 +end +put l 12 add ulong 8 mul get cfg 5 4 +put cfg 5 sub ulong 1 get cfg 5 +if eq bc_record cfg b l out 0 +ret 32 +end +put cfg 5 sub ulong 1 get cfg 5 +put cfg 6 1 +if eq bc_record cfg b l out 0 +ret 33 +end +put cfg 6 0 +put out 6 1 +if eq bc_record cfg b l out 0 +ret 34 +end +put out 6 0 +if lt get out 3 16384 +compose_put b 21 add get out 3 128 +put l 7 add get out 3 128 +if ne bc_record cfg b l out 0 +ret 35 +end +compose_put b 21 get out 3 +put l 7 get out 3 +end +if le mul get l 4 add decl 8 65536 +compose_put b 22 add decl 8 +put l 8 add decl 8 +if ne bc_record cfg b l out 0 +ret 36 +end +end +ret 0 +end +fn main to int +if ne argcnt 6 +ret 10 +end +cfg = new ulong 16 0 +b = new uchar 4096 0 +l = new ulong 32 0 +out = new ulong 8 0 +rc = ru_input cfg out +if ne rc 0 +ret rc +end +rc = ru_build cfg b l out +if ne rc 0 +ret rc +end +rc = ru_checks cfg b l out +if ne rc 0 +ret rc +end +z = write 1 RUOk 0 len RUOk +ret 0 +end diff --git a/tests/components/rowpipe-caller.om b/tests/components/rowpipe-caller.om new file mode 100644 index 00000000..e574df5e --- /dev/null +++ b/tests/components/rowpipe-caller.om @@ -0,0 +1,148 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Host-only caller. stdin exactly64 bytes: eight LE64 spec words. +note Concatenate bw_alloc,bw_effect,bw_project,rowpipe,bw_enc_sm121,bw_spec_sm121,this. +note bw_spec_sm121 contributes only the prefix before its standalone fn main. +note stdout same shared caller frame:stats4,peakGPR,peakUGPR,width+phys per GPR/UGPR, +note all used eight-cell instructions,then unpadded instruction bytes. +note Exit66 is a clean refusal with zero outputs;69 means refusal leaked output. +fn rp_word v ulong to bool +b = new uchar 8 0 +for j ulong 8 +put b j uchar and shr v mul j 8 255 +end +n = ulong 0 +while lt n 8 bound 8 +k = write 1 b n sub ulong 8 n +if le k 0 +ret false +end +n = add n ulong k +end +ret true +end +fn rp_bytes b view uchar 16384 n ulong to int +sent = ulong 0 +while lt sent n bound 16384 +k = write 1 b sent sub n sent +if le k 0 +ret 74 +end +sent = add sent ulong k +end +ret 0 +end +fn rp_admit ins view ulong 8192 phys view ulong 288 n ulong to uint +state = new ulong 3001 0 +o = new ulong 16 0 +w = new ulong 4 0 +for j ulong n +opnds ins j phys o +if ne sp_enc state o w 0 +ret 1 +end +end +ret 0 +end +fn rp_input spec edit ulong 8 to int +b = new uchar 64 0 +n = ulong 0 +while lt n 64 bound 64 +k = read 0 b n sub ulong 64 n +if le k 0 +ret 65 +end +n = add n ulong k +end +extra = read 0 b 0 1 +if ne extra 0 +ret 65 +end +for j ulong 8 +v = ulong 0 +for k ulong 8 +v = or v shl ulong get b add mul j 8 k mul k 8 +end +put spec j v +end +ret 0 +end +fn rp_irout ins view ulong 8192 m view ulong 2048 phys view ulong 288 stats view ulong 4 astats view ulong 4 to int +for j ulong 4 +if not rp_word get stats j +ret 74 +end +end +if not rp_word get astats 1 +ret 74 +end +if not rp_word get astats 2 +ret 74 +end +for j ulong get stats 1 +if not rp_word get m j +ret 74 +end +if not rp_word get phys j +ret 74 +end +end +for j ulong get stats 2 +if not rp_word get m add j 256 +ret 74 +end +if not rp_word get phys add j 256 +ret 74 +end +end +for j ulong mul get stats 0 8 +if not rp_word get ins j +ret 74 +end +end +ret 0 +end +fn main to int +spec = new ulong 8 0 +ins = new ulong 8192 1 +m = new ulong 2048 1 +stats = new ulong 4 1 +astats = new ulong 4 0 +phys = new ulong 288 0 +code = new uchar 16384 0 +if ne rp_input spec 0 +ret 65 +end +rc = bc_rowpipe spec ins m stats +if ne rc 0 +for j ulong 8192 +if ne get ins j 0 +ret 69 +end +end +for j ulong 2048 +if ne get m j 0 +ret 69 +end +end +for j ulong 4 +if ne get stats j 0 +ret 69 +end +end +ret 66 +end +if ne bc_regalloc ins get stats 0 m phys astats 128 0 +ret 67 +end +if ne rp_admit ins phys get stats 0 0 +ret 68 +end +size = bw_enc_sm121 ins phys get stats 0 0 code +if eq size 0 +ret 68 +end +if ne rp_irout ins m phys stats astats 0 +ret 74 +end +ret rp_bytes code size +end diff --git a/tests/components/rowpipe-oracle.c b/tests/components/rowpipe-oracle.c new file mode 100644 index 00000000..b28d2b96 --- /dev/null +++ b/tests/components/rowpipe-oracle.c @@ -0,0 +1,119 @@ +/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ +/* Verification ONLY. Uses the existing b759afc3 rowpipe C generator, its allocator, + * and independently retained C encoder. This is not a production implementation. + * Build after all component edits, no GPU: + * cc -std=c11 -Wall -Wextra -Werror -DOMEGA_GPU_NO_POSIX -ffunction-sections + * -fdata-sections -Wl,--gc-sections -Isrc tests/components/rowpipe-oracle.c + * src/omega_blackwell_codegen_moe2.c src/omega_blackwell_codegen.c -o ORACLE + * Input: no arguments reads exactly eight LE64 spec words on stdin. Alternatively + * ORACLE K LB ROWS WARPS accepts the production spec. Optional final argument + * --sb-b / --sb-rd / --branch corrupts independent reference IR for negative cmp. + * Native caller and oracle stdout must compare byte for byte, including widths, + * allocation, every IR field, and every unpadded encoded instruction. Exit66 + * is refusal; run mutants1..3 and each reserved field nonzero against native + * caller and require66 (caller also verifies all refusal outputs were cleared). + * Cover K256 LB8 R1 W1, K768 LB8 R1 W5(partial staging), + * K512 LB16 R8 W16, K4096 LB16 R1 W32, and R1/2/4/8 and LB8/16. + * K4096 LB8 R1 W16 is a resource-refusal control: generator shape admission + * precedes global allocation; native caller returns67 while this combined C + * generator/allocator returns66. Neither may emit any output for that control. + * Each --sb-b/--sb-rd/--branch output must FAIL cmp against the original caller. + * No result from these host checks is device qualification. + */ +#include "omega_blackwell_codegen_moe2.h" +#include +#include +#include +#include + +static int word(uint64_t v) { + for (unsigned j = 0; j < 8; ++j) + if (putchar((int)((v >> (j * 8)) & 255)) == EOF) return 0; + return 1; +} +static uint64_t regword(int v) { return v < 0 ? UINT64_MAX : (uint64_t)v; } +static int number(const char *s, uint64_t *v) { + char *end; + if (!s[0] || s[0] == '-') return 0; + errno = 0; + unsigned long long n = strtoull(s, &end, 10); + if (errno || *end) return 0; + *v = (uint64_t)n; + return 1; +} +static int input(uint64_t spec[8]) { + unsigned char b[64]; + if (fread(b, 1, sizeof b, stdin) != sizeof b || getchar() != EOF) return 0; + for (unsigned j = 0; j < 8; ++j) + for (unsigned k = 0; k < 8; ++k) + spec[j] |= (uint64_t)b[j * 8 + k] << (k * 8); + return !ferror(stdin); +} +static int mutate(BlackwellIRProgram *p, const char *kind) { + if (!kind) return 1; + for (size_t j = 0; j < p->count; ++j) { + BlackwellIRInsn *i = &p->insns[j]; + if (!strcmp(kind, "--sb-b") && ((i->control >> 20) & (1u << 3))) { + i->control ^= (1u << 3) << 20; + return 1; + } + if (!strcmp(kind, "--sb-rd") && ((i->control >> 14) & 7) == 3) { + i->control = (i->control & ~(7u << 17)) | (7u << 17); + return 1; + } + if (!strcmp(kind, "--branch") && i->op == BW_IR_BRA && i->predicate_p0) { + ++i->imm; + return 1; + } + } + return 0; +} +int main(int argc, char **argv) { + uint64_t spec[8] = {0}; + const char *mutation = NULL; + if (argc == 1 || argc == 2) { + if (!input(spec)) return 65; + if (argc == 2) mutation = argv[1]; + } else if (argc == 5 || argc == 6) { + for (unsigned j = 0; j < 4; ++j) + if (!number(argv[j + 1], &spec[j])) return 65; + if (argc == 6) mutation = argv[5]; + } else return 65; + for (unsigned j = 0; j < 4; ++j) if (spec[j] > UINT32_MAX) return 66; + for (unsigned j = 4; j < 8; ++j) if (spec[j]) return 66; + OmegaFp8GemvSpec s = {0}; + s.k = (uint32_t)spec[0]; s.lane_bytes = (uint32_t)spec[1]; + s.rows = (uint32_t)spec[2]; s.warps = (uint32_t)spec[3]; + static BlackwellIRProgram p; + if (omega_blackwell_codegen_fp8_gemv2_prog(&s, &p) != 0) return 66; + if (!mutate(&p, mutation)) return 70; + unsigned char code[16384]; + size_t padded = 0; + if (omega_bw_encode_program(&p, code, sizeof code, &padded) != 0) return 68; + size_t used = p.count * 16; + if (padded < used) return 68; + if (!word(p.count) || !word((uint64_t)p.regalloc.num_vregs) || + !word((uint64_t)p.regalloc.num_uvregs) || !word(omega_fp8_gemv2_shared_bytes(&s)) || + !word(p.regalloc.peak_gpr_usage) || !word(p.regalloc.peak_ugpr_usage)) return 74; + for (int v = 0; v < p.regalloc.num_vregs; ++v) { + const OmegaLiveInterval *q = &p.regalloc.intervals[v]; + if (!word(q->bundle_size ? q->bundle_size : (q->is_pair ? 2 : (q->is_quad ? 4 : 1))) || + !word(regword(p.regalloc.vreg_to_phys[v]))) return 74; + } + for (int v = 0; v < p.regalloc.num_uvregs; ++v) + if (!word(p.regalloc.uintervals[v].is_pair ? 2 : 1) || + !word(regword(p.regalloc.uvreg_to_phys[v]))) return 74; + for (size_t j = 0; j < p.count; ++j) { + const BlackwellIRInsn *i = &p.insns[j]; + uint64_t f = (uint64_t)i->is_uniform | ((uint64_t)i->predicate_p0 << 1) | + ((uint64_t)i->predicate_not << 2) | ((uint64_t)i->bar_reg << 8) | + ((uint64_t)i->dst_subreg << 16) | ((uint64_t)i->src1_subreg << 24) | + ((uint64_t)i->src2_subreg << 32) | ((uint64_t)i->src3_subreg << 40); + if (!word(i->op) || !word(regword(i->dst_vreg)) || !word(regword(i->src1_vreg)) || + !word(regword(i->src2_vreg)) || !word(regword(i->src3_vreg)) || + !word(regword(i->ureg)) || !word((uint64_t)i->imm | ((uint64_t)i->control << 32)) || + !word(f)) return 74; + } + if (fwrite(code, 1, used, stdout) != used || fflush(stdout) != 0) return 74; + return 0; +} diff --git a/tests/components/run.om b/tests/components/run.om new file mode 100644 index 00000000..e503cca9 --- /dev/null +++ b/tests/components/run.om @@ -0,0 +1,685 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Seeded native host conductor; concatenate proc.om, cases.om, then this file. +note C and nvdisasm/sha256sum are independent verification tools only, never production dependencies. +text Rt00000 "om/encoder/bw_spec_sm121.om" +text Rt00002 "om/components/bw_alloc.om" +text Rt00003 "om/components/bw_effect.om" +text Rt00004 "om/components/bw_check.om" +text Rt00005 "om/components/bw_project.om" +text Rt00006 "om/components/rowpipe.om" +text Rt00007 "om/components/staged.om" +text Rt00008 "om/components/compose.om" +text Rt00009 "om/encoder/bw_enc_sm121.om" +text Rt00010 "om/components/encode.om" +text Rt00011 "build/components/component-unit" +text Rt00012 "tests/components/component-unit.om" +text Rt00013 "build/components/compose-unit" +text Rt00014 "tests/components/compose-unit.om" +text Rt00015 "build/components/direct" +text Rt00016 "tests/components/direct-caller.om" +text Rt00017 "build/components/rowpipe" +text Rt00018 "tests/components/rowpipe-caller.om" +text Rt00019 "build/components/staged" +text Rt00020 "tests/components/staged-caller.om" +text Rt00021 "-std=gnu11" +text Rt00022 "-O2" +text Rt00023 "-Wall" +text Rt00024 "-Wextra" +text Rt00025 "-Werror" +text Rt00026 "-DOMEGA_GPU_NO_POSIX" +text Rt00027 "-ffunction-sections" +text Rt00028 "-fdata-sections" +text Rt00029 "-Wl,--gc-sections" +text Rt00030 "-Isrc" +text Rt00031 "-DWS_MAX_THREADS=1024" +text Rt00032 "-DCOMPONENT_STAGED" +text Rt00033 "tests/components/numerical.c" +text Rt00034 "src/omega_gpu_fp8_pack.c" +text Rt00035 "src/omega_gpu_hostmath.c" +text Rt00036 "src/omega_gpu_fp8gemm_api.c" +text Rt00037 "src/omega_blackwell_matmul.c" +text Rt00038 "src/omega_blackwell_codegen_moe.c" +text Rt00039 "src/omega_blackwell_codegen_moe2.c" +text Rt00040 "src/omega_blackwell_codegen_gemm.c" +text Rt00041 "src/omega_blackwell_codegen.c" +text Rt00042 "-lm" +text Rt00043 "tests/components/direct-oracle.c" +text Rt00044 "src/omega_blackwell_codegen_moe.c" +text Rt00045 "tests/components/rowpipe-oracle.c" +text Rt00046 "src/omega_blackwell_codegen_moe2.c" +text Rt00047 "tests/components/staged-oracle.c" +text Rt00048 "src/omega_blackwell_codegen_gemm.c" +text Rt00049 "src/omega_blackwell_codegen.c" +text Rt00050 "-o" +text Rt00051 "build/components/direct-oracle" +text Rt00052 "build/components/rowpipe-oracle" +text Rt00053 "build/components/staged-oracle" +text Rt00054 "build/components/numerical-gemv" +text Rt00055 "build/components/numerical-staged" +text Rt00056 "build/components/hash.txt" +text Rt00057 "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f" +text Rt00058 "\"" +text Rt00059 "\\" +text Rt00060 "," +text Rt00061 "\n" +text Rt00062 "\n{\"family\":" +text Rt00063 "direct" +text Rt00064 "rowpipe" +text Rt00065 "staged" +text Rt00066 ",\"spec\":[" +text Rt00067 "],\"whole_frame_sha256\":" +text Rt00068 ",\"code_sha256\":" +text Rt00069 ",\"numerical_result\":" +text Rt00070 ",\"result\":\"PASS\"}" +text Rt00071 ":" +text Rt00072 "build/components/receipt.json" +text Rt00073 "{\"conductor\":\"seeded Omega proc.om + cases.om + run.om\",\"compiler\":\"2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f\",\"source_baseline\":\"b759afc3f5e46f152ffb06b39882ffa28cacaf96\",\"encoder_source_revision\":\"1c5a8398d93b49e6765c2e3752aaad8611027d0d\",\"quant_source_revision\":\"fe25929ce71b11703eafa72395df2dd495aa61f2\",\"physical_execution\":\"NOT_RUN: no GPU authority\",\"cases\":[" +text Rt00074 "],\"independent_numerical_execution\":\"PASS reused existing scalar/warp oracles on every native IR/allocation frame\",\"composer_root\":\"PASS direct/changed-direct/rowpipe/dense-staged/mapped-staged and mutant refusal\",\"negative_controls\":[\"reserved component fields refuse\",\"SB_B/SB_RD/branch reference mutations differ\",\"native/oracle resource exhaustion refuses without output\",\"truncated/oversized frames refuse without output\",\"typed op/bundle/wait/branch/resource/MMA controls PASS\",\"every native frame FFMA-to-FADD executes but numerical oracle disagrees\",\"every native frame unknown-op refusal preserved\"],\"source_sha256\":{\"tests/components/proc.om\":" +text Rt00075 "tests/components/proc.om" +text Rt00076 "tests/components/cases.om" +text Rt00077 "tests/components/run.om" +text Rt00078 "tests/components/numerical.c" +text Rt00079 "tests/components/native-frame.h" +text Rt00080 "tests/gpu_fp8_api_test.c" +text Rt00081 "tests/gpu_fp8gemm_test.c" +text Rt00082 "tests/bw_warp_sim.h" +text Rt00083 "tests/bw_warp_sim_k.h" +text Rt00084 "src/omega_gpu_fp8_pack.c" +text Rt00085 "src/omega_gpu_hostmath.c" +text Rt00086 "src/omega_gpu_fp8gemm_api.c" +text Rt00087 "src/omega_blackwell_matmul.c" +text Rt00088 "om/components/bw_alloc.om" +text Rt00089 "om/components/bw_check.om" +text Rt00090 "om/components/bw_effect.om" +text Rt00091 "om/components/bw_project.om" +text Rt00092 "om/components/compose.om" +text Rt00093 "om/components/encode.om" +text Rt00094 "om/components/fixture.om" +text Rt00095 "om/components/realize.om" +text Rt00096 "om/components/rowpipe.om" +text Rt00097 "om/components/staged.om" +text Rt00098 "},\"encoder_source_sha256\":{" +text Rt00099 "om/encoder/bw_enc_sm121.om" +text Rt00100 "om/encoder/bw_spec_sm121.om" +text Rt00101 "},\"tool_versions\":{\"nvdisasm\":" +text Rt00102 "usage: conductor OMC ENCODER_ROOT NVDISASM CC SHA256SUM QUANT_SOURCE\n" +text Rt00103 "build" +text Rt00104 "build/components" +text Rt00105 "PASS native Omega component conductor: 8 direct, 14 rowpipe, 6 staged; independent numerics/bytes/disassembly/refusals and staged structural controls\n" +text RtBytes ",\"code_bytes\":" +text RtCcVer ",\"cc\":" +text RtShaVer ",\"sha256sum\":" +text RtVEnd "}}\n" +text RtVerP "build/components/version.txt" +text RtVFlag "--version" +text RtDFlag "-V" +text RtEncPin "12369bf1e383e79a4926e7758aaf5f3f778f2945c91327ce0aa570babffc05e6" +text RtSpPin "d38dd63f842dff1dae525208576825f3a0027dead5ab2cde9482cf70b87e8ae9" +text RtSrc0 "tests/components/component-unit.om" +text RtSrc1 "tests/components/compose-unit.om" +text RtSrc2 "tests/components/direct-caller.om" +text RtSrc3 "tests/components/rowpipe-caller.om" +text RtSrc4 "tests/components/staged-caller.om" +text RtSrc5 "tests/components/direct-oracle.c" +text RtSrc6 "tests/components/rowpipe-oracle.c" +text RtSrc7 "tests/components/staged-oracle.c" +text RtSrc8 "src/omega_blackwell_codegen.c" +text RtSrc9 "src/omega_blackwell_codegen_moe.c" +text RtSrc10 "src/omega_blackwell_codegen_moe2.c" +text RtSrc11 "src/omega_blackwell_codegen_gemm.c" +text RtSrc12 "src/omega_blackwell_codegen.h" +text RtSrc13 "tests/components/wolfram.json" +global HQuant uchar 1024 +global HQn ulong 1 +text RtQuant "om/quant/quant.om" +text RtQPin "44bce96f3c274401e19a71b835814d69caf2bea8c2b1f4f43616c7c121232f09" +text RtAdmit "om/components/admit.om" +text RtRUnit "tests/components/record-unit.om" +text RtRBin "build/components/record-unit" +text RtRMut "build/components/record-mutant" +text RtGuard "if lt compose_word b 22 add get actual 1 2" +text RtWeak "if false" +text RtRKey ",\"staged_structural_result\":" +text RtRcpt "tests/components/host-receipt.json" +fn rc_publish to void +b = new uchar 262144 0 +n = hp_read Rt00072 len Rt00072 b len b +hp_require gt n 0 +hp_write RtRcpt len RtRcpt b n +end +fn rt_qpath path edit uchar 1024 to ulong +used = get HQn 0 +for j ulong used +put path j get HQuant j +end +ret used +end +fn rt_qpin to void +path = new uchar 1024 0 +n = rt_qpath path +h = new uchar 64 0 +rh_get path n h +for j ulong 64 +hp_require eq get h j get RtQPin j +end +end +note Build a concrete weak-GPR checker mutant without changing checked-in production source. +fn rt_weak to void +hits = ulong 0 +used = get HUsed 0 +for pos ulong sub used len RtGuard +same = uint 1 +for j ulong len RtGuard +if ne get HSrc add pos j get RtGuard j +same = 0 +end +end +if ne same 0 +hits = add hits 1 +for j ulong len RtGuard +c = uchar 32 +if lt j len RtWeak +c = get RtWeak j +end +put HSrc add pos j c +end +end +end +hp_require eq hits 1 +end +fn rt_record kind ulong to void +path = new uchar 1024 0 +n = rt_qpath path +hp_cat path n +rt_nl +hp_cat Rt00095 len Rt00095 +rt_nl +hp_cat RtAdmit len RtAdmit +rt_nl +hp_cat Rt00094 len Rt00094 +rt_nl +hp_cat RtRUnit len RtRUnit +rt_nl +if eq kind 7 +rt_weak +hp_build RtRMut len RtRMut +else +hp_build RtRBin len RtRBin +end +end + +fn rt_nl to void +pos = get HUsed 0 +hp_require lt pos len HSrc +put HSrc pos 10 +put HUsed 0 add pos 1 +end +fn rt_path suffix view uchar * n ulong dst edit uchar 1024 to ulong +used = get HEn 0 +hp_require le add add used 1 n 1024 +for j ulong used +put dst j get HEnc j +end +put dst used 47 +for j ulong n +put dst add add used 1 j get suffix j +end +ret add add used 1 n +end +fn rt_enc suffix view uchar * n ulong to void +path = new uchar 1024 0 +used = rt_path suffix n path +hp_cat path used +rt_nl +end +fn rt_spec to void +rt_enc Rt00000 len Rt00000 +end +fn rt_comp kind ulong to void +put HUsed 0 0 +hp_cat Rt00002 len Rt00002 +rt_nl +hp_cat Rt00003 len Rt00003 +rt_nl +hp_cat Rt00004 len Rt00004 +rt_nl +hp_cat Rt00005 len Rt00005 +rt_nl +if or ge kind 6 or eq kind 2 eq kind 4 +hp_cat Rt00006 len Rt00006 +rt_nl +end +if or ge kind 6 or eq kind 2 eq kind 5 +hp_cat Rt00007 len Rt00007 +rt_nl +end +if or eq kind 2 ge kind 6 +hp_cat Rt00008 len Rt00008 +rt_nl +end +if and ge kind 3 le kind 5 +rt_enc Rt00009 len Rt00009 +rt_spec +hp_cat Rt00010 len Rt00010 +rt_nl +end +if eq kind 1 +hp_cat Rt00012 len Rt00012 +rt_nl +hp_build Rt00011 len Rt00011 +end +if eq kind 2 +hp_cat Rt00014 len Rt00014 +rt_nl +hp_build Rt00013 len Rt00013 +end +if eq kind 3 +hp_cat Rt00016 len Rt00016 +rt_nl +hp_build Rt00015 len Rt00015 +end +if eq kind 4 +hp_cat Rt00018 len Rt00018 +rt_nl +hp_build Rt00017 len Rt00017 +end +if eq kind 5 +hp_cat Rt00020 len Rt00020 +rt_nl +hp_build Rt00019 len Rt00019 +end +if ge kind 6 +rt_record kind +end +end +note execprog intentionally supplies an empty environment; locate the selected cc toolchain explicitly. +fn rt_ccpref to void +b = new uchar 1024 0 +last = ulong 0 +for j ulong get HCn 0 +if eq get HCc j 47 +last = add j 1 +end +end +hp_require gt last 0 +hp_require le last 1022 +put b 0 45 +put b 1 66 +for j ulong last +put b add j 2 get HCc j +end +hp_arg b add last 2 +end +fn rt_cc kind ulong to void +hp_tool 1 +rt_ccpref +hp_arg Rt00021 len Rt00021 +hp_arg Rt00022 len Rt00022 +hp_arg Rt00023 len Rt00023 +hp_arg Rt00024 len Rt00024 +hp_arg Rt00025 len Rt00025 +hp_arg Rt00026 len Rt00026 +hp_arg Rt00027 len Rt00027 +hp_arg Rt00028 len Rt00028 +hp_arg Rt00029 len Rt00029 +hp_arg Rt00030 len Rt00030 +if ge kind 4 +hp_arg Rt00031 len Rt00031 +if eq kind 5 +hp_arg Rt00032 len Rt00032 +end +hp_arg Rt00033 len Rt00033 +hp_arg Rt00034 len Rt00034 +hp_arg Rt00035 len Rt00035 +hp_arg Rt00036 len Rt00036 +hp_arg Rt00037 len Rt00037 +hp_arg Rt00038 len Rt00038 +hp_arg Rt00039 len Rt00039 +hp_arg Rt00040 len Rt00040 +hp_arg Rt00041 len Rt00041 +hp_arg Rt00042 len Rt00042 +else +if eq kind 1 +hp_arg Rt00043 len Rt00043 +hp_arg Rt00044 len Rt00044 +end +if eq kind 2 +hp_arg Rt00045 len Rt00045 +hp_arg Rt00046 len Rt00046 +end +if eq kind 3 +hp_arg Rt00047 len Rt00047 +hp_arg Rt00048 len Rt00048 +end +hp_arg Rt00049 len Rt00049 +end +hp_arg Rt00050 len Rt00050 +if eq kind 1 +hp_arg Rt00051 len Rt00051 +end +if eq kind 2 +hp_arg Rt00052 len Rt00052 +end +if eq kind 3 +hp_arg Rt00053 len Rt00053 +end +if eq kind 4 +hp_arg Rt00054 len Rt00054 +end +if eq kind 5 +hp_arg Rt00055 len Rt00055 +end +hp_exec -1 -1 0 +end +fn rh_get path view uchar * n ulong dst edit uchar 64 to void +hp_tool 3 +hp_arg path n +fd = int fopen Rt00056 0 len Rt00056 577 420 +hp_require ge fd 0 +hp_exec -1 fd 0 +hp_require eq fclose fd 0 +b = new uchar 2048 0 +used = hp_read Rt00056 len Rt00056 b 2048 +hp_require ge used 66 +hp_require eq get b 64 32 +for j ulong 64 +v = get b j +hp_require or and ge v 48 le v 57 and ge v 97 le v 102 +put dst j v +end +end +fn rt_pin to void +path = new uchar 1024 0 +n = get HOn 0 +for j ulong n +put path j get HOm j +end +h = new uchar 64 0 +rh_get path n h +for j ulong 64 +hp_require eq get h j get Rt00057 j +end +end +global RCFile int 1 +global RCCount ulong 1 +fn rc_text a view uchar * n ulong to void +pos = ulong 0 +tries = ulong 0 +while lt pos n bound 999999 +z = write get RCFile 0 a pos sub n pos +if eq z -4 +tries = add tries 1 +hp_require le tries 64 +else +hp_require gt z 0 +pos = add pos ulong z +end +end +end +fn rc_quote a view uchar * n ulong to void +rc_text Rt00058 len Rt00058 +b = new uchar 6 0 +for j ulong n +v = get a j +if or eq v 34 eq v 92 +put b 0 92 +put b 1 v +rc_text b 2 +else +if lt v 32 +put b 0 92 +put b 1 117 +put b 2 48 +put b 3 48 +hi = div ulong v 16 +lo = rem ulong v 16 +put b 4 uchar add hi 48 +if ge hi 10 +put b 4 uchar add hi 87 +end +put b 5 uchar add lo 48 +if ge lo 10 +put b 5 uchar add lo 87 +end +rc_text b 6 +else +put b 0 v +rc_text b 1 +end +end +end +rc_text Rt00058 len Rt00058 +end +fn rc_num n ulong to void +b = new uchar 32 0 +used = hp_num n b +rc_text b used +end +fn rc_hash path view uchar * n ulong to void +h = new uchar 64 0 +rh_get path n h +rc_quote h 64 +end +fn rc_chash which ulong to void +path = new uchar 256 0 +n = get KCAn 0 +if eq which 1 +n = get KCCn 0 +end +for j ulong n +if eq which 0 +put path j get KCActual j +else +put path j get KCCode j +end +end +rc_hash path n +end +fn rc_numout to void +path = new uchar 256 0 +n = get KCNn 0 +for j ulong n +put path j get KCNum j +end +b = new uchar 8192 0 +used = hp_read path n b 8192 +hp_require gt used 0 +rc_quote b used +end +fn rc_record fam ulong idx ulong to void +path = new uchar 256 0 +n = kc_name fam idx KCRText path +b = new uchar 1024 0 +used = hp_read path n b 1024 +hp_require gt used 0 +rc_text RtRKey len RtRKey +rc_quote b used +end +fn rc_case fam ulong idx ulong cfg view ulong 16 to void +if ne get RCCount 0 0 +rc_text Rt00060 len Rt00060 +end +rc_text Rt00062 len Rt00062 +if eq fam 1 +rc_quote Rt00063 len Rt00063 +end +if eq fam 2 +rc_quote Rt00064 len Rt00064 +end +if eq fam 3 +rc_quote Rt00065 len Rt00065 +end +rc_text Rt00066 len Rt00066 +fields = ulong 5 +if eq fam 2 +fields = ulong 4 +end +for j ulong fields +if ne j 0 +rc_text Rt00060 len Rt00060 +end +rc_num get cfg j +end +rc_text Rt00067 len Rt00067 +rc_chash 0 +rc_text Rt00068 len Rt00068 +rc_chash 1 +rc_text RtBytes len RtBytes +rc_num get KCBytes 0 +rc_text Rt00069 len Rt00069 +rc_numout +if eq fam 3 +rc_record fam idx +end +rc_text Rt00070 len Rt00070 +put RCCount 0 add get RCCount 0 1 +end +fn rc_source path view uchar * n ulong to void +rc_text Rt00060 len Rt00060 +rc_quote path n +rc_text Rt00071 len Rt00071 +rc_hash path n +end +fn rc_begin to void +fd = int fopen Rt00072 0 len Rt00072 577 420 +hp_require ge fd 0 +put RCFile 0 fd +put RCCount 0 0 +rc_text Rt00073 len Rt00073 +end +fn rc_finish to void +hp_require eq get RCCount 0 28 +rc_text Rt00074 len Rt00074 +rc_hash Rt00075 len Rt00075 +rc_source Rt00076 len Rt00076 +rc_source Rt00077 len Rt00077 +rc_source Rt00078 len Rt00078 +rc_source Rt00079 len Rt00079 +rc_source Rt00080 len Rt00080 +rc_source Rt00081 len Rt00081 +rc_source Rt00082 len Rt00082 +rc_source Rt00083 len Rt00083 +rc_source Rt00084 len Rt00084 +rc_source Rt00085 len Rt00085 +rc_source Rt00086 len Rt00086 +rc_source Rt00087 len Rt00087 +rc_source Rt00088 len Rt00088 +rc_source Rt00089 len Rt00089 +rc_source Rt00090 len Rt00090 +rc_source Rt00091 len Rt00091 +rc_source Rt00092 len Rt00092 +rc_source Rt00093 len Rt00093 +rc_source Rt00094 len Rt00094 +rc_source Rt00095 len Rt00095 +rc_source Rt00096 len Rt00096 +rc_source Rt00097 len Rt00097 +rc_source RtSrc0 len RtSrc0 +rc_source RtSrc1 len RtSrc1 +rc_source RtSrc2 len RtSrc2 +rc_source RtSrc3 len RtSrc3 +rc_source RtSrc4 len RtSrc4 +rc_source RtSrc5 len RtSrc5 +rc_source RtSrc6 len RtSrc6 +rc_source RtSrc7 len RtSrc7 +rc_source RtSrc8 len RtSrc8 +rc_source RtSrc9 len RtSrc9 +rc_source RtSrc10 len RtSrc10 +rc_source RtSrc11 len RtSrc11 +rc_source RtSrc12 len RtSrc12 +rc_source RtSrc13 len RtSrc13 +rc_source RtAdmit len RtAdmit +rc_source RtRUnit len RtRUnit +rc_text Rt00060 len Rt00060 +rc_quote RtQuant len RtQuant +rc_text Rt00071 len Rt00071 +path = new uchar 1024 0 +n = rt_qpath path +rc_hash path n +rc_text Rt00098 len Rt00098 +rc_quote Rt00099 len Rt00099 +rc_text Rt00071 len Rt00071 +rc_ehash Rt00099 len Rt00099 +rc_text Rt00060 len Rt00060 +rc_quote Rt00100 len Rt00100 +rc_text Rt00071 len Rt00071 +rc_ehash Rt00100 len Rt00100 +rc_text Rt00101 len Rt00101 +rc_ver 2 RtDFlag len RtDFlag +rc_text RtCcVer len RtCcVer +rc_ver 1 RtVFlag len RtVFlag +rc_text RtShaVer len RtShaVer +rc_ver 3 RtVFlag len RtVFlag +rc_text RtVEnd len RtVEnd +hp_require eq fsync get RCFile 0 0 +hp_require eq fclose get RCFile 0 0 +end +fn rc_ehash path view uchar * n ulong to void +b = new uchar 1024 0 +used = rt_path path n b +rc_hash b used +end +fn rt_epin suffix view uchar * n ulong expected view uchar 64 to void +path = new uchar 1024 0 +used = rt_path suffix n path +h = new uchar 64 0 +rh_get path used h +for j ulong 64 +hp_require eq get h j get expected j +end +end +fn rc_ver which ulong flag view uchar * n ulong to void +hp_tool which +hp_arg flag n +fd = int fopen RtVerP 0 len RtVerP 577 420 +hp_require ge fd 0 +hp_exec -1 fd 0 +hp_require eq fclose fd 0 +b = new uchar 8192 0 +used = hp_read RtVerP len RtVerP b 8192 +hp_require gt used 0 +rc_quote b used +end +fn main to int +if ne argcnt 7 +z = write 2 Rt00102 0 len Rt00102 +ret 64 +end +n = argread 1 HOm 0 1024 +hp_require and gt n 0 le n 1024 +put HOn 0 ulong n +n = argread 2 HEnc 0 1024 +hp_require and gt n 0 le n 1024 +put HEn 0 ulong n +n = argread 3 HDis 0 1024 +hp_require and gt n 0 le n 1024 +put HDn 0 ulong n +n = argread 4 HCc 0 1024 +hp_require and gt n 0 le n 1024 +put HCn 0 ulong n +n = argread 5 HSha 0 1024 +hp_require and gt n 0 le n 1024 +put HSn 0 ulong n +n = argread 6 HQuant 0 1024 +hp_require and gt n 0 le n 1024 +put HQn 0 ulong n +z = makedir Rt00103 0 len Rt00103 493 +hp_require or eq z 0 eq z -17 +z = makedir Rt00104 0 len Rt00104 493 +hp_require or eq z 0 eq z -17 +rt_pin +rt_epin Rt00099 len Rt00099 RtEncPin +rt_epin Rt00100 len Rt00100 RtSpPin +rt_qpin +for i ulong 5 +rt_comp add i 1 +rt_cc add i 1 +end +rt_comp 6 +rt_comp 7 +rc_begin +kc_cases +rc_finish +rc_publish +z = write 1 Rt00105 0 len Rt00105 +ret 0 +end diff --git a/tests/components/staged-caller.om b/tests/components/staged-caller.om new file mode 100644 index 00000000..40c381cb --- /dev/null +++ b/tests/components/staged-caller.om @@ -0,0 +1,125 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Concat bw_alloc,bw_effect,bw_project,staged,bw_enc_sm121 then this caller. +note stdin exact128 bytes LE64 spec16. stdout LE64 rc then successful payload. +note Payload stats4,GPRpeak,UGPRpeak,(width,phys) GPRs then UGPRs,IR8cells,padded code. +note Compare entire stdout with staged-oracle built against existing C generator. +note Filed algorithm provenance src/omega_blackwell_codegen_gemm.c at b759afc3. +note First/changed components:K2048,LB16,MT4,W16,RM0 then MT8; also RM1 MT4. +note Exercise LB8 K768 MT4 W8 oddKS3 and K1024 LB16 MT4 W16 evenKS2. +note Mutants1..4,reserved6..15,rowmap2,K0,oddKS5,MT3,W3,NJ>8 must refuse. +global SGInput uchar 128 +global SGOutput uchar 8 +fn sg_word v ulong to void +for j ulong 8 +put SGOutput j uchar and shr v mul j 8 255 +end +pos = ulong 0 +while lt pos 8 bound 8 +n = write 1 SGOutput pos sub ulong 8 pos +if le n 0 +exit 74 +end +pos = add pos ulong n +end +end +fn sg_input to bool +pos = ulong 0 +while lt pos 128 bound 128 +n = read 0 SGInput pos sub ulong 128 pos +if le n 0 +ret false +end +pos = add pos ulong n +end +ret true +end +fn sg_parse spec edit ulong 16 to void +for k ulong 16 +v = ulong 0 +for j ulong 8 +v = or v shl ulong get SGInput add mul k 8 j mul j 8 +end +put spec k v +end +end +fn sg_stats st view ulong 4 rs view ulong 4 to void +sg_word 0 +for k ulong 4 +sg_word get st k +end +sg_word get rs 1 +sg_word get rs 2 +end +fn sg_regsout meta view ulong 2048 phys view ulong 288 nv ulong nu ulong to void +for k ulong nv +sg_word get meta k +sg_word get phys k +end +for k ulong nu +sg_word get meta add k 256 +sg_word get phys add k 256 +end +end +fn sg_irout ins view ulong 8192 n ulong to void +for k ulong mul n 8 +sg_word get ins k +end +end +fn sg_codeout code view uchar 16384 nbytes ulong to bool +pos = ulong 0 +while lt pos nbytes bound 16384 +n = write 1 code pos sub nbytes pos +if le n 0 +ret false +end +pos = add pos ulong n +end +ret true +end +fn main to int +spec = new ulong 16 0 +ins = new ulong 8192 99 +meta = new ulong 2048 99 +phys = new ulong 288 0 +st = new ulong 4 99 +rs = new ulong 4 0 +code = new uchar 16384 0 +if not sg_input +ret 65 +end +sg_parse spec +rc = bc_staged spec ins meta st +if ne rc 0 +for k ulong 8192 +if ne get ins k 0 +ret 70 +end +end +for k ulong 2048 +if ne get meta k 0 +ret 71 +end +end +for k ulong 4 +if ne get st k 0 +ret 72 +end +end +sg_word ulong rc +ret 0 +end +if ne bc_regalloc ins get st 0 meta phys rs 128 0 +ret 67 +end +nbytes = bc_encode ins phys get st 0 1 code +if eq nbytes 0 +ret 68 +end +sg_stats st rs +sg_regsout meta phys get st 1 get st 2 +sg_irout ins get st 0 +if not sg_codeout code nbytes +ret 74 +end +ret 0 +end diff --git a/tests/components/staged-oracle.c b/tests/components/staged-oracle.c new file mode 100644 index 00000000..6825e7d2 --- /dev/null +++ b/tests/components/staged-oracle.c @@ -0,0 +1,80 @@ +/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ +/* Verification only. The existing independent C generator/allocator/encoder + * supplies every successful expected bit; this file has no GEMM algorithm. + * Protocol and suggested cases are in staged-caller.om. No GPU is opened. */ +#include "omega_blackwell_codegen_gemm.h" +#include +#include +#include +#include +#include + +static void word(uint64_t v) { + for (unsigned j=0;j<8;j++) putchar((int)((v>>(j*8))&255)); +} +static uint64_t reg(int v) { return v<0 ? UINT64_MAX : (uint64_t)v; } +static int power2(uint64_t v) { return v && !(v&(v-1)); } +/* The native bounded contract is checked independently, before narrowing. */ +static int supported(const uint64_t s[16]) { + if (!s[0] || s[0]>16384 || (s[1]!=8 && s[1]!=16)) return 0; + if (s[2]!=1 && s[2]!=2 && s[2]!=4 && s[2]!=8) return 0; + if (!power2(s[3]) || s[3]>32 || (s[2]*s[1])%s[3]) return 0; + if (s[2]*s[1]/s[3]>8 || s[2]*128*s[1]>16384) return 0; + if (s[0]%(32*s[1])) return 0; + const uint64_t ks=s[0]/(32*s[1]); + if ((ks&1) && ks>3) return 0; + if (s[4]>1 || (s[4] && s[2]>4)) return 0; + for (unsigned j=5;j<16;j++) if (s[j]) return 0; + return 1; +} +int main(int argc, char **argv) { + uint64_t s[16]={0}; + if (argc==1) { + unsigned char raw[128]; + if (fread(raw,1,sizeof raw,stdin)!=sizeof raw) return 65; + for (unsigned k=0;k<16;k++) + for (unsigned j=0;j<8;j++) s[k]|=(uint64_t)raw[k*8+j]<<(j*8); + } else if (argc==6) { + for (unsigned k=0;k<5;k++) { + char *tail=NULL; + if (argv[k+1][0]<'0' || argv[k+1][0]>'9') return 65; + errno=0; + s[k]=strtoull(argv[k+1],&tail,10); + if (errno || !tail || *tail) return 65; + } + } else return 65; + if (!supported(s)) { word(1); return ferror(stdout)?74:0; } + OmegaFp8GemmSpec spec={0}; + spec.k=(uint32_t)s[0]; spec.lane_bytes=(uint32_t)s[1]; + spec.mt=(uint32_t)s[2]; spec.warps=(uint32_t)s[3]; + spec.rowmap=(uint32_t)s[4]; + BlackwellIRProgram p; + memset(&p,0,sizeof p); + if (omega_blackwell_codegen_fp8gemm_prog(&spec,&p)!=0) return 66; + uint8_t code[16384]; size_t nbytes=0; + if (omega_bw_encode_program(&p,code,sizeof code,&nbytes)!=0) return 68; + word(0); word(p.count); word(p.regalloc.num_vregs); + word(p.regalloc.num_uvregs); word(omega_fp8gemm_shared_bytes(&spec)); + word(p.regalloc.peak_gpr_usage); word(p.regalloc.peak_ugpr_usage); + for (int v=0;vbundle_size?q->bundle_size:(q->is_pair?2:(q->is_quad?4:1))); + word(reg(p.regalloc.vreg_to_phys[v])); + } + for (int v=0;vop); word(reg(i->dst_vreg)); word(reg(i->src1_vreg)); + word(reg(i->src2_vreg)); word(reg(i->src3_vreg)); word(reg(i->ureg)); + word((uint64_t)i->imm|((uint64_t)i->control<<32)); + word((uint64_t)i->is_uniform|((uint64_t)i->predicate_p0<<1)| + ((uint64_t)i->predicate_not<<2)|((uint64_t)i->bar_reg<<8)| + ((uint64_t)i->dst_subreg<<16)|((uint64_t)i->src1_subreg<<24)| + ((uint64_t)i->src2_subreg<<32)|((uint64_t)i->src3_subreg<<40)); + } + if (fwrite(code,1,nbytes,stdout)!=nbytes || ferror(stdout)) return 74; + return 0; +} diff --git a/tests/components/wolfram.json b/tests/components/wolfram.json new file mode 100644 index 00000000..4aa4ce18 --- /dev/null +++ b/tests/components/wolfram.json @@ -0,0 +1,12 @@ +{ + "query": { + "code": "Table[{i,2^(20-8 i),BitShiftLeft[128,8 i],If[i<3,2^(24-8 i),1]},{i,0,3}]; FromDigits[\"07F00000\",16]; FromDigits[\"358\",16]; Map[Function[x,Append[x,BitShiftLeft[x[[1]],9]+BitShiftLeft[x[[2]],14]+BitShiftLeft[x[[3]],17]]],{{6,7,7},{14,7,7},{4,0,1},{4,3,1},{4,2,7},{4,7,1},{5,7,7},{1,7,7}}]" + }, + "result": [ + { + "type": "text", + "text": "Out[1]= {{6, 7, 7, 1035264}, {14, 7, 7, 1039360}, {4, 0, 1, 133120}, {4, 3, 1, 182272}, {4, 2, 7, 952320}, {4, 7, 1, 247808}, {5, 7, 7, 1034752}, {1, 7, 7, 1032704}}" + } + ], + "isError": false +}