diff --git a/docs/runtime/API.md b/docs/runtime/API.md index fb29c98b..733b7535 100644 --- a/docs/runtime/API.md +++ b/docs/runtime/API.md @@ -1,6 +1,6 @@ # Omega Runtime API v0 -Omega Runtime API version: 0.9.0 +Omega Runtime API version: 0.10.0 Status: first written version, 2026-10-19 (slice R1, omega-mv#594, tracking #593). Source of truth is the C headers in `src/`. This file describes them; `docs/runtime/omega_runtime_api.manifest` lists them; `make test-runtime-api` checks the @@ -36,8 +36,9 @@ signature against the headers on every run. ## 2. Version and compatibility rule -The version is MAJOR.MINOR.PATCH (semantic versioning), currently **0.9.0**. It is a property of the list of entries and +The version is MAJOR.MINOR.PATCH (semantic versioning), currently **0.10.0**. It is a property of the list of entries and their behaviour, not of the library build. Changes so far: +- 0.10.0: adds the experimental `omega_gpu_pf_qgemm_set_group` selector. Existing entry signatures and the default execution order are unchanged. - 0.9.0 (AmperePort, CUDApp#170): grows STABLE `OmegaGpuLaunch` with `target_sm` (a MAJOR-class change taken as MINOR under the major-version-zero rule); adds EXPERIMENTAL `omega_gpu_session_target_sm`. Zero-initialized legacy launches still mean sm_121, not auto-detect. @@ -593,7 +594,7 @@ values, poison patterns) are in the INTERNAL list. | `src/omega_gpu_prefill_attn_api.h` | `OmegaGpuPrefillAttnInfo`, `OmegaGpuPrefillAttnMirrorView`, `omega_gpu_prefill_attn`, `omega_gpu_prefill_attn_release`, `omega_gpu_prefill_attn_dev`, `omega_gpu_prefill_attn_set_warps`, `omega_gpu_prefill_attn_set_fused`, `omega_gpu_prefill_attn_set_kv_mirror`, `omega_gpu_prefill_attn_kv_mirror_view`, `omega_gpu_prefill_attn_kv_mirror_invalidate`, `omega_gpu_prefill_attn_kv_mirror_forget`, `omega_gpu_prefill_attn_kv_mirror_available` | Causal prefill attention for Qwen3-30B-A3B, with an optional KV mirror; one model. | | `src/omega_gpu_moe_api.h` | `omega_gpu_moe_tensor_upload_bf16`, `omega_gpu_moe_tensor_upload_f32`, `omega_gpu_moe_tensor_free`, `omega_gpu_moe_tensor_shape`, `omega_gpu_matmul_resident_window_f32`, `omega_gpu_matmul_resident_window_bf16`, `omega_gpu_matmul_resident_windows_f32`, `omega_gpu_moe_reserve`, `omega_gpu_moe_prepare`, `omega_gpu_moe_seal`, `omega_gpu_moe_unreserve`, `omega_gpu_moe_cache_clear`, `omega_gpu_moe_set_cta_budget`, `omega_gpu_moe_cta_budget`, `omega_gpu_moe_window_byte_offset` | Column windows over a resident bf16 expert tensor (OWN-30B); tied to the serving pool. | | `src/omega_gpu_decode_graph.h` | `OmegaGpuDecodeGraphConfig`, `OmegaGpuDecodeGraphStats`, `OmegaGpuDecodeGraphVas`, `omega_gpu_decode_graph_create`, `omega_gpu_decode_graph_free`, `omega_gpu_decode_graph_set_layer`, `omega_gpu_decode_graph_set_final_norm`, `omega_gpu_decode_graph_token`, `omega_gpu_decode_graph_begin_token`, `omega_gpu_decode_graph_record_layer`, `omega_gpu_decode_graph_record_final`, `omega_gpu_decode_graph_end_token`, `omega_gpu_decode_graph_abort_token`, `omega_gpu_decode_graph_record_res`, `omega_gpu_decode_graph_record_swiglu`, `omega_gpu_decode_graph_list`, `omega_gpu_decode_graph_vas`, `omega_gpu_decode_graph_read`, `omega_gpu_decode_graph_set_stamps`, `omega_gpu_decode_graph_set_barrier`, `omega_gpu_decode_graph_barrier`, `omega_gpu_decode_graph_stamps`, `omega_gpu_decode_graph_kind_name`, `omega_gpu_decode_graph_set_flush_each`, `omega_gpu_decode_graph_set_prefetch`, `omega_gpu_decode_graph_prefetch` | One Qwen3-30B-A3B decode token as one command list; scheduling, barrier and prefetch modes are still measured. | -| `src/omega_gpu_prefill.h` | `OmegaPfWeights`, `omega_gpu_pf_rc_name`, `omega_gpu_pf_alloc_dev`, `omega_gpu_pf_alloc_host`, `omega_gpu_pf_free`, `omega_gpu_pf_upload`, `omega_gpu_pf_download`, `omega_gpu_pf_copy_va`, `omega_gpu_pf_stats`, `omega_gpu_pf_stats_reset`, `omega_gpu_pf_weights_upload`, `omega_gpu_pf_weights_free`, `omega_gpu_pf_weights_host_form`, `omega_gpu_pf_gemm_bm`, `omega_gpu_pf_gemm_tiles`, `omega_gpu_pf_gemm`, `omega_gpu_pf_gemm_set_shape`, `omega_gpu_pf_quant`, `omega_gpu_pf_qgemm_bm`, `omega_gpu_pf_qgemm_tiles`, `omega_gpu_pf_qgemm_tiles_va`, `omega_gpu_pf_qgemm`, `omega_gpu_pf_qgemm_set_shape`, `omega_gpu_pf_quant_record`, `omega_gpu_pf_qgemm_record` | Device-resident one-pass prefill for OWN-30B; arguments carry raw device addresses. | +| `src/omega_gpu_prefill.h` | `OmegaPfWeights`, `omega_gpu_pf_rc_name`, `omega_gpu_pf_alloc_dev`, `omega_gpu_pf_alloc_host`, `omega_gpu_pf_free`, `omega_gpu_pf_upload`, `omega_gpu_pf_download`, `omega_gpu_pf_copy_va`, `omega_gpu_pf_stats`, `omega_gpu_pf_stats_reset`, `omega_gpu_pf_weights_upload`, `omega_gpu_pf_weights_free`, `omega_gpu_pf_weights_host_form`, `omega_gpu_pf_gemm_bm`, `omega_gpu_pf_gemm_tiles`, `omega_gpu_pf_gemm`, `omega_gpu_pf_gemm_set_shape`, `omega_gpu_pf_quant`, `omega_gpu_pf_qgemm_bm`, `omega_gpu_pf_qgemm_tiles`, `omega_gpu_pf_qgemm_tiles_va`, `omega_gpu_pf_qgemm`, `omega_gpu_pf_qgemm_set_shape`, `omega_gpu_pf_qgemm_set_group`, `omega_gpu_pf_quant_record`, `omega_gpu_pf_qgemm_record` | Device-resident one-pass prefill for OWN-30B; arguments carry raw device addresses. | | `src/omega_gpu_pfhost.h` | `omega_gpu_pf_router_rows`, `omega_gpu_pf_router_packed_bytes`, `omega_gpu_pf_router_pack`, `omega_gpu_pf_router_logits`, `omega_gpu_pf_moe_combine`, `omega_gpu_pf_router_set_rows` | Whole-prompt prefill router logits and MoE combine for OWN-30B; arguments carry raw device addresses. | ### 9.8 General matrix multiply (`src/omega_gpu_gemm_ex.h`, added in 0.8.0) diff --git a/docs/runtime/omega_runtime_api.manifest b/docs/runtime/omega_runtime_api.manifest index a91cd5e3..b77f66eb 100644 --- a/docs/runtime/omega_runtime_api.manifest +++ b/docs/runtime/omega_runtime_api.manifest @@ -12,7 +12,7 @@ # After a deliberate header change: edit the line here, run `tools/runtime_api_check.sh --bless` to refresh numbers, review the diff, # and bump the version (MAJOR/MINOR/PATCH, rule in API.md section 2; tools/runtime_api_semver.sh checks the bump against the base). # Names a manifest header declares that are NOT API go in omega_runtime_api.internal, each with a reason (the check fails otherwise). -abi omega_runtime 0.9.0 +abi omega_runtime 0.10.0 header src/omega_runtime_api.h header src/omega_gpu_platform.h header src/omega_gpu_session.h @@ -38,9 +38,9 @@ header src/omega_gpu_pfhost.h header src/omega_gpu_gemm_ex.h # ---- version ---- const OMEGA_RUNTIME_API_VERSION_MAJOR 0 -const OMEGA_RUNTIME_API_VERSION_MINOR 9 +const OMEGA_RUNTIME_API_VERSION_MINOR 10 const OMEGA_RUNTIME_API_VERSION_PATCH 0 -const OMEGA_RUNTIME_API_VERSION 9 +const OMEGA_RUNTIME_API_VERSION 10 # ---- platform contract (src/omega_gpu_platform.h, ABI 1.2) ---- struct OmegaGpuDeviceHandle 8 4 # STABLE field OmegaGpuDeviceHandle index 0 4 u32 1 @@ -954,6 +954,7 @@ fn omega_gpu_pf_qgemm_tiles fn(*const OmegaGpuFp8Tensor, *const u32, *mut c_void fn omega_gpu_pf_qgemm_tiles_va fn(u32, *const u64, *const u64, *const u32, *mut c_void, u32) -> u32 # EXPERIMENTAL fn omega_gpu_pf_qgemm fn(u32, u32, u32, u64, u32, u64, u64, u64, u64, *mut u64) -> i32 # EXPERIMENTAL fn omega_gpu_pf_qgemm_set_shape fn(u32, u32, u32) -> () # EXPERIMENTAL +fn omega_gpu_pf_qgemm_set_group fn(u32) -> () # EXPERIMENTAL fn omega_gpu_pf_quant_record fn(*mut OmegaGpuCmdList, u32, u32, u32, u64, u64, u64) -> i32 # EXPERIMENTAL fn omega_gpu_pf_qgemm_record fn(*mut OmegaGpuCmdList, u32, u32, u32, u64, u32, u64, u64, u64, u64) -> i32 # EXPERIMENTAL fn omega_gpu_pf_router_rows fn() -> u32 # EXPERIMENTAL diff --git a/mk/prefill-shape.mk b/mk/prefill-shape.mk index f9cda4d5..375f4d46 100644 --- a/mk/prefill-shape.mk +++ b/mk/prefill-shape.mk @@ -14,3 +14,14 @@ test-prefill-shape: $(OUT_DIR)/prefill-shape.so $(OUT_DIR)/gpu_qgemm_test $(OUT_ ifeq ($(CUDAPP_OMC_HOST),1) OMEGA_OMC="$(OMEGA_OMC)" OMEGA_BRIDGE="$(OMEGA_BRIDGE)" CC="$(CC)" python3 om/prefill-shape/mutants.py endif + +CARRIED_HOST_TESTS += test-prefill-order +.PHONY: test-prefill-order +$(OUT_DIR)/prefill-order.so: src/cudapp_om_prefill_order.c + @mkdir -p $(OUT_DIR) + $(CC) $(filter-out -MMD -MP,$(CFLAGS)) -shared -fPIC $< -o $@ +test-prefill-order: $(OUT_DIR)/prefill-order.so $(OUT_DIR)/gpu_qgemm_test + python3 om/prefill-shape/order-check.py $(abspath $(OUT_DIR))/prefill-order.so +ifeq ($(CUDAPP_OMC_HOST),1) + OMEGA_OMC="$(OMEGA_OMC)" OMEGA_BRIDGE="$(OMEGA_BRIDGE)" CC="$(CC)" python3 om/prefill-shape/order-mutants.py +endif diff --git a/om/prefill-shape/.crumb b/om/prefill-shape/.crumb index 280aecff..bde24f45 100644 --- a/om/prefill-shape/.crumb +++ b/om/prefill-shape/.crumb @@ -3,18 +3,18 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-11-01T20:02:57Z", + "compiled_at": "2026-11-01T20:06:13Z", "compiler": "crumb-compile/1", - "digest": "sha256:ae913da5184e86a744633421c5efc316da0feddc1b05ef48f29068bf23cb3cb4", + "digest": "sha256:4c2da4b06b3a47de49eab897326282dd21ea66e3ae1947054c5fb6e42b500e83", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 11, - "generated_at_commit": "572a73bfd138b78154172f7746504842a7168f9c", - "source_tree": "sha256:5a30b12b78795c04d77df1becd2e406ac22d55b56966c255817d06a22046309b" + "files": 20, + "generated_at_commit": "3751e1ab02034a48d1fbc1217c70d60dc97382fc", + "source_tree": "sha256:141935040c08042f989ba49e50d9b43736e36c5f10faedad3b3af5b42c158e6b" } }, "layer": "native-policy", "name": "prefill-shape", - "purpose": "Checked Omega admission for bounded prompt matrix tile shapes and independent parity verification", + "purpose": "Checked Omega admission and work ordering for bounded prompt matrix tiles, with independent parity verification", "schema_version": "1.0.0" } diff --git a/om/prefill-shape/README.md b/om/prefill-shape/README.md index 57d71c67..9fed5be1 100644 --- a/om/prefill-shape/README.md +++ b/om/prefill-shape/README.md @@ -27,6 +27,21 @@ Before the change, all four 27B projection shapes refused 128-row generation. Th The subsequent [full host-suite receipt](large-shape-full-host-validation.json) records all 77 targets passing on the candidate source. It includes the failed absolute-output-path invocation and its correction. GPU and full-model qualification remain pending. +## Grouped work-order experiment + +The separate grouped-order candidate revisits the mechanism in historical Omega commit `86211a39965bd903b6be482cfc784c7dd58733a5`. It schedules nearby matrix jobs over the same weight panel before advancing to another panel. Historical chip screens motivated that work, but their shared-machine measurements and sampled-row checks do not qualify this implementation or a full model. + +`order.om` owns the grid and coordinate-remapping instruction plan. Group 0 keeps the original order. Groups 1 through 5 gather consecutive row tiles into groups of powers of two. The Omega plan checks input and grid bounds before returning success. Jobs beyond the last tile branch out before reading the tile table. The existing C emitter interprets only the plan's primitive instructions; it does not calculate the coordinate mapping. + +The private plan is 64 unsigned words: grid x, grid y, instruction count, then five-word records `(operation, destination, source1, source2, immediate)`. Register roles are column coordinate, row coordinate, temporary and tile count. Operations are AND-immediate, shift-right-immediate, multiply-add-immediate, constant load, unsigned greater-or-equal predicate, and predicate branch. The prefix emits the mapping plus a tail guard; the output-store prefix repeats the same mapping. Matrix arithmetic and the existing wait distance are unchanged. + +Select a candidate with `omega_gpu_pf_qgemm_set_group(group)` before model work begins. Never change it while a model operation is in flight. This composes with the existing shape test knob. Default group 0 remains unchanged. `order-check.py` independently interprets the plan and verifies coverage, uniqueness and boundaries; `order-mutants.py` checks source faults. The matrix simulator exercises groups 0, 1, 3 and 4 across direct/indexed inputs and partial tiles. GPU and full-model correctness and speed remain unqualified. + +The complete 78-target host suite and API version check pass. On the full 27B reader, group4 and group0 preserve every output-score bit and next-token choice in all six frozen cases. Repeated 5,017-token reading was 18.817 seconds with group0 and 16.199 seconds with group4 in this shared-machine screen. This is not quiet-machine qualification. Group0 remains the default. `order-validation.json` records source identities, checks and per-case observations. The separate 128-row full-model attempt was refused by an older prefill-cache register cap before its first matrix; that correction is being verified on the parent branch and is not part of this tested group4 binary. The first full-model 128-row trial exposed an older cache-admission cap: it refused the generated 152-register declaration before the first matrix launch. The cache now honors the generator's existing opt-in budget, bounded by the allocator's hardware ceiling. The default declaration cap and the launch/record register-file checks remain enforced. `cache-check.c` reproduces the real cache call without a GPU by stopping at code allocation: it fails on the original library and passes the correction, including absent-opt-in and over-budget refusals. The correction also passes the matrix simulator and admission mutants. The corrected full-model run passed all six complete-score comparisons. The repeated 5,017-token read was 14.759 seconds versus 18.817 seconds in the comparison run. These are shared-machine observations, not quiet qualification; the full-host correction suite remains pending. See `large-shape-gpu-validation.json`. See `cache-admission-regression.json`. +With the cache-budget correction included, the 128-row/group4 combination passed all six full-model score and next-token comparisons. The repeated 5,017-token read took 14.348 seconds versus 18.817 seconds for 64-row/group0. Group5 at 128 rows took 15.379 seconds in the same screening series. These are shared-machine observations. `order-combined-validation.json` records every compared setting and the complete selected-candidate comparison. The combined host rerun and serving qualification remain pending; no default changed. + +The subsequent full host rerun completed successfully: all 78 targets passed at runtime source `28b533c95a2dce42cb14c9d8bc4a05847a5981a0`. See `order-combined-full-host-validation.json` for the command, timing and log digest. This does not qualify the later scoped API or serving performance. + The subsequent full host rerun completed successfully: all 77 targets passed at runtime source `572a73bfd138b78154172f7746504842a7168f9c`. See `cache-full-host-validation.json` for the command, timing and log digest. This does not qualify the later scoped API or serving performance. diff --git a/om/prefill-shape/order-check.py b/om/prefill-shape/order-check.py new file mode 100644 index 00000000..f8e5ec35 --- /dev/null +++ b/om/prefill-shape/order-check.py @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# Independent external oracle. Not a production dependency. +import ctypes,itertools,sys +lib=ctypes.CDLL(sys.argv[1]);fn=lib.omega_native_qgorder +fn.argtypes=[ctypes.POINTER(ctypes.c_uint64),ctypes.c_void_p]+[ctypes.c_uint64]*5 +fn.restype=ctypes.c_uint32 + +def plan(group,cols,tiles,guard=1): + out=(ctypes.c_uint64*64)();result=ctypes.c_uint64(99) + rc=fn(ctypes.byref(result),out,64,group,cols,tiles,guard) + assert rc==0,rc + return result.value,list(out) + +def execute(p,x,y): + r=[x,y,0,0];pred=False + for i in range(p[2]): + op,d,a,b,imm=p[3+5*i:8+5*i] + assert max(d,a,b)<4 + if op==1:r[d]=r[a]&imm + elif op==2:r[d]=r[a]>>imm + elif op==3:r[d]=r[a]*imm+r[b] + elif op==4: + assert imm==896+11*4 + r[d]=execute.tiles + elif op==5:pred=r[a]>=r[b] + elif op==6: + if pred:return None + else:raise AssertionError('unknown opcode') + return (r[0],r[1]) + +def cover(p,cols,tiles): + execute.tiles=tiles;seen=set() + for x,y in itertools.product(range(p[0]),range(p[1])): + mapped=execute(p,x,y) + if mapped is None:continue + if mapped in seen or not (0<=mapped[0]=1 + om=t/(name+'.om');om.write_text(source.replace(old,new,1)) + c=t/(name+'.c');so=t/(name+'.so') + with c.open('w') as f:subprocess.run(['sh',str(bridge),'c',str(om)],env=env,stdout=f,check=True) + subprocess.run([os.environ.get('CC','cc'),'-O2','-shared','-fPIC',str(c),'-o',str(so)],check=True) + p=subprocess.run(['python3',str(root/'om/prefill-shape/order-check.py'),str(so)],capture_output=True,text=True) + assert p.returncode!=0,name+' escaped oracle' + assert 'AssertionError' in p.stderr,(name,p.stderr) + print(name+': caught',flush=True) diff --git a/om/prefill-shape/order-validation.json b/om/prefill-shape/order-validation.json new file mode 100644 index 00000000..f7cc9f5b --- /dev/null +++ b/om/prefill-shape/order-validation.json @@ -0,0 +1,132 @@ +{ + "status": "PASS_EXACT_SCORES", + "scope": "Shared-machine single-run diagnostic. Not quiet or statistically qualified.", + "formula": "seconds=ns/1e9; reduction_percent=100*(baseline_ns-candidate_ns)/baseline_ns", + "inputs": { + "reading-screen-group0-20261101T194419Z": "b8bcb76500664674cfc9ef99003f23df731a90fb121794abb79f6c0a581b2537", + "reading-screen-group4-20261101T194534Z": "a7802b188ee8d2bb54e0a8d4d9e3dcffaf50867f1fdb6b81dfd8e86be008ffc6", + "Optimize27-checkpoint-20261101": "44e4cb62fc06712f3728c26d0ba0a70dc4e516fb4557f80060f756720e8d26d6" + }, + "rows": [ + { + "trial": 0, + "prompt_tokens": 30, + "chunk": 4096, + "all_score_bits_and_next_equal": true, + "score_sha256": "890aabe9fed6550d1665eaa1fb20c3dfc25efe514db8d8ca6b97160be5bde853", + "baseline_s": 0.332722031, + "candidate_s": 0.328841392, + "wall_reduction_percent": 1.1663306419285473, + "baseline_gemm_s": 0.164627506, + "candidate_gemm_s": 0.163969208 + }, + { + "trial": 1, + "prompt_tokens": 513, + "chunk": 512, + "all_score_bits_and_next_equal": true, + "score_sha256": "751c59e6812c98bedc12ccb72bf878cb7c52fe6734a51a96646b1d0bd5937396", + "baseline_s": 2.258274006, + "candidate_s": 2.156755011, + "wall_reduction_percent": 4.4954241482776025, + "baseline_gemm_s": 1.337981532, + "candidate_gemm_s": 1.209889835 + }, + { + "trial": 2, + "prompt_tokens": 941, + "chunk": 4096, + "all_score_bits_and_next_equal": true, + "score_sha256": "36dabb2803481bdd0e552d3c631557e3047d2e233e43f5636dccceae143661c0", + "baseline_s": 3.650990357, + "candidate_s": 3.306518864, + "wall_reduction_percent": 9.435015141564232, + "baseline_gemm_s": 2.213912136, + "candidate_gemm_s": 1.795833972 + }, + { + "trial": 3, + "prompt_tokens": 5017, + "chunk": 4096, + "all_score_bits_and_next_equal": true, + "score_sha256": "88ca539df5ecfc096a32e59aec5c48da86f9bcc54f6d78e2bcb9fa4a79535447", + "baseline_s": 19.126557271, + "candidate_s": 16.36954494, + "wall_reduction_percent": 14.414577029919688, + "baseline_gemm_s": 11.546749839, + "candidate_gemm_s": 8.809191353 + }, + { + "trial": 4, + "prompt_tokens": 30, + "chunk": 4096, + "all_score_bits_and_next_equal": true, + "score_sha256": "890aabe9fed6550d1665eaa1fb20c3dfc25efe514db8d8ca6b97160be5bde853", + "baseline_s": 0.3078444, + "candidate_s": 0.316550316, + "wall_reduction_percent": -2.8280248073377328, + "baseline_gemm_s": 0.165410748, + "candidate_gemm_s": 0.162994709 + }, + { + "trial": 5, + "prompt_tokens": 5017, + "chunk": 4096, + "all_score_bits_and_next_equal": true, + "score_sha256": "88ca539df5ecfc096a32e59aec5c48da86f9bcc54f6d78e2bcb9fa4a79535447", + "baseline_s": 18.816751006, + "candidate_s": 16.198925508, + "wall_reduction_percent": 13.91220778318886, + "baseline_gemm_s": 11.509962547, + "candidate_gemm_s": 8.801004973 + } + ], + "binary_sha256": "8b8687ada95f10254ddf7dbedb9bbecc080fd35c42bed77d104666d417388d58", + "settings": { + "baseline": { + "rt": 4, + "group": 0 + }, + "candidate": { + "rt": 4, + "group": 4 + }, + "warps": 8, + "wait": 45 + }, + "host": { + "status": "PASS", + "exit_code": 0, + "targets": 78, + "command": "make -j4 OUT_DIR=../optimize27-qg-order-build test test-runtime-api-semver RUNTIME_API_BASE=ecb672c77f6f9145f0983348277ae8f58c74c8d3", + "compiler_sha256": "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f", + "full_log_sha256": "4db1c5946321e1d77594196896039749f70246247dd202646de6bb8051ca52eb", + "source_identity": { + "base": "ecb672c77f6f9145f0983348277ae8f58c74c8d3", + "status": "PASS full host suite78, semver, exact GPU scores group0/group4; shared timing only", + "sources": { + "docs/runtime/API.md": "2d9e4e4390ca852ff05dd76e6290778cf90173e94348b8deabb3978ec5e1292f", + "docs/runtime/omega_runtime_api.manifest": "0fd414db619b7fc8d40b503c4368e415fd215b05e29039346a855e3d8e5d717e", + "mk/prefill-shape.mk": "ccba4c78dc228c864094028674319b6c07a6b403a852c7b0e10014805c30fe39", + "om/prefill-shape/README.md": "5cfd7bc8ac55bb62a19996a0c79de2eebecc0357121a362c2705dcf8157cc293", + "om/units.sh": "90e2b06d539b0fce4b8b1642985bd339f7df103c10689721bdf279cbb6ef6324", + "src/cudapp_native.h": "91cab62eed37af70fe6b83710b5c0d2ea1f365f4a626fb988550ea3a0c0a65d6", + "src/cudapp_om_units.ident": "77b16d01c829b52e115eb9ed659664921fa3d9d419319869e03b0399c8f43650", + "src/omega_blackwell_codegen_qg.c": "cf2c5cd3d58d9f0439e116143199054e0d6ff4c7117c96c64ad6b0995072cfeb", + "src/omega_blackwell_codegen_qg.h": "c19bbd7f882c99da69b23d2e6cb9b3fd999f541803730f0aa0db023019ed4806", + "src/omega_gpu_pfgemm.c": "c2379b1758dd402dc2eb5608404e5f333531994e39ebd5d7f8058247e21e47b7", + "src/omega_gpu_prefill.h": "3460cfeeb2f19799b318e059a6cdfb66447ab0a4dc720d8c5122e98d86c02e90", + "src/omega_runtime_api.h": "a52d32533dafe83ca20d69399b59f998389cd867cb3b9de6b4e2937926e3547f", + "tests/bw_hazard_test.c": "9cb312122fab1e0f9cfeb17a42dd64310d51919bf9fa6f019bc82f4e2ead9757", + "tests/gpu_qgemm_test.c": "407875e2d792c0db39903bf3a2689a954e90a5c2698426fb09d93ffe0108acd9", + "om/prefill-shape/order.om": "13f0e33cd7013f62564a82e5e6a2a9722ab3de92e10934ed46fffc2c5174de9b", + "om/prefill-shape/order-check.py": "62032077e16c8e0e99c32c016b051e19b706b887da2e722b04c63c7124ff73b4", + "om/prefill-shape/order-mutants.py": "0795f05f7661e0c0b58dd066cae8e470f64392b6389ea3b7a8d25e0aaf199442", + "src/cudapp_om_prefill_order.c": "43c835999dd230d3b953ad5b002a63d116638d93b4cb6893525676db6432ae77", + "src/cudapp_om_prefill_order.ident": "fb4a96a87f733878627afadf6562b9f6b3c51bea805cb9c61c51b33ab9bcce71" + }, + "archive_sha256": "7d29f388fd6e270e4017df99e7e2ef18f914a9aeee0837a74fc9b05980eb0cbd" + }, + "scope": "Host tests and simulated matrix arithmetic, including all 137 plan cases and five Omega source mutants. Not hardware performance qualification." + } +} diff --git a/om/prefill-shape/order.om b/om/prefill-shape/order.om new file mode 100644 index 00000000..f35e69b8 --- /dev/null +++ b/om/prefill-shape/order.om @@ -0,0 +1,53 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Grouped work order: adjacent column jobs reuse one weight panel across row tiles. +note Private plan: grid x, grid y, record count, then records of opcode,dst,src1,src2,immediate. +note Registers 0=cx,1=cy,2=temporary,3=tile count. Opcodes are private adapter operations. +fn qgo_put plan edit ulong 64 at ulong op ulong regs ulong imm ulong to ulong +put plan at op +put plan add at 1 rem regs 4 +put plan add at 2 rem div regs 4 4 +put plan add at 3 div regs 16 +put plan add at 4 imm +ret add at 5 +end + +fn qgo_emit plan edit ulong 64 group ulong guard ulong to ulong +size = shl ulong 1 group +at = qgo_put plan 3 1 2 sub size 1 +at = qgo_put plan at 2 0 group +at = qgo_put plan at 3 37 size +if eq guard 1 +note Tile count is constant-bank argument word11, byte896+44=940. +at = qgo_put plan at 4 3 940 +at = qgo_put plan at 5 52 0 +at = qgo_put plan at 6 0 0 +end +put plan 2 div sub at 3 5 +ret 1 +end + +fn native_qgorder plan edit ulong 64 group ulong cols ulong tiles ulong guard ulong to ulong +put plan 0 0 +put plan 1 0 +put plan 2 0 +if or gt group 5 gt guard 1 +ret 0 +end +if or eq cols 0 gt cols 65535 +ret 0 +end +if or eq tiles 0 gt tiles 65535 +ret 0 +end +size = shl ulong 1 group +gx = mul cols size +if gt gx 65535 +ret 0 +end +put plan 0 gx +put plan 1 div add tiles sub size 1 size +if eq group 0 +ret 1 +end +ret qgo_emit plan group guard +end diff --git a/om/units.sh b/om/units.sh index 937cf5bc..59913531 100755 --- a/om/units.sh +++ b/om/units.sh @@ -19,7 +19,7 @@ ENC="om/encoder/bw_enc_sm121.om,om/encoder/bw_spec_sm121.om,om/components/encode MOE="om/moe/moe_plan.om om/moe/moe_group.om om/moe/moe_ids32.om om/moe/moe_maps32.om om/moe/moe_segs32.om om/moe/moe_windows.om moe_admission=$PIPE,om/moe/moe_group.om,om/moe/moe_admit.om" CLOSURE="$REAL,om/cache/digest.om,om/moe/moe_windows.om,om/moe/moe_group.om,native/learn53/moe-closure.om" OBSERVE="closure_code=$CLOSURE,om/moe/closure_code.om closure_launch=$CLOSURE,om/moe/closure_launch.om closure_dir=$CLOSURE,om/moe/closure_dir.om closure_alloc=$CLOSURE,om/moe/closure_alloc.om closure_series=$CLOSURE,om/moe/closure_series.om" -UNITS="${OMEGA_UNITS:-om/encoder/bw_enc_sm121.om om/cubin/cubin_elf.om om/encoder/ampere_enc_sm86.om om/encoder/amp_runtime.om repack=$QUANT,om/quant/repack.om quant_wire=$QUANT,om/quant/runtime.om compose=$COMP encode=$ENC cache_runtime=om/cache/residency.om,om/cache/runtime.om lease=om/cache/residency.om,om/cache/runtime.om,om/cache/lease.om slotrev=om/cache/residency.om,om/cache/slotrev.om command=om/cache/residency.om,om/cache/command.om validate=$CACHE,$COMP,$ENC,om/components/admit.om,om/cache/validate.om digest=$REAL,om/cache/digest.om,om/cache/key.om code_digest=$REAL,om/cache/digest.om,om/cache/codekey.om templates=$REAL,om/cache/digest.om,om/cache/templates.om graph=$PIPE,om/pipeline/runtime.om context_lookup=om/pipeline/context.om,om/pipeline/context_abi.om binding=$REAL,om/pipeline/binding.om $MOE closure_pack=$CLOSURE,om/moe/closure_pack.om closure_bind=$CLOSURE,om/moe/closure_bind.om closure_blob=$CLOSURE,om/moe/closure_blob.om closure_cover=$CLOSURE,om/pipeline/mccover.om,om/pipeline/coverage_entry.om closure_intent=$CLOSURE,om/pipeline/mccover.om closure_seal=$CLOSURE,om/pipeline/mccover.om,om/pipeline/seal_entry.om closure_reseal=$CLOSURE,om/pipeline/mccover.om,om/pipeline/seal_reuse.om $OBSERVE prefill_shape=om/prefill-shape/admit.om q38_runtime=om/q38-head/envelope.om,om/q38-head/plan.om q38_emit=om/components/bw_alloc.om,om/components/bw_effect.om,om/components/bw_check.om,om/components/bw_project.om,$ENC,om/q38-head/bounds.om,om/q38-head/emit.om}" +UNITS="${OMEGA_UNITS:-om/encoder/bw_enc_sm121.om om/cubin/cubin_elf.om om/encoder/ampere_enc_sm86.om om/encoder/amp_runtime.om repack=$QUANT,om/quant/repack.om quant_wire=$QUANT,om/quant/runtime.om compose=$COMP encode=$ENC cache_runtime=om/cache/residency.om,om/cache/runtime.om lease=om/cache/residency.om,om/cache/runtime.om,om/cache/lease.om slotrev=om/cache/residency.om,om/cache/slotrev.om command=om/cache/residency.om,om/cache/command.om validate=$CACHE,$COMP,$ENC,om/components/admit.om,om/cache/validate.om digest=$REAL,om/cache/digest.om,om/cache/key.om code_digest=$REAL,om/cache/digest.om,om/cache/codekey.om templates=$REAL,om/cache/digest.om,om/cache/templates.om graph=$PIPE,om/pipeline/runtime.om context_lookup=om/pipeline/context.om,om/pipeline/context_abi.om binding=$REAL,om/pipeline/binding.om $MOE closure_pack=$CLOSURE,om/moe/closure_pack.om closure_bind=$CLOSURE,om/moe/closure_bind.om closure_blob=$CLOSURE,om/moe/closure_blob.om closure_cover=$CLOSURE,om/pipeline/mccover.om,om/pipeline/coverage_entry.om closure_intent=$CLOSURE,om/pipeline/mccover.om closure_seal=$CLOSURE,om/pipeline/mccover.om,om/pipeline/seal_entry.om closure_reseal=$CLOSURE,om/pipeline/mccover.om,om/pipeline/seal_reuse.om $OBSERVE prefill_shape=om/prefill-shape/admit.om prefill_order=om/prefill-shape/order.om q38_runtime=om/q38-head/envelope.om,om/q38-head/plan.om q38_emit=om/components/bw_alloc.om,om/components/bw_effect.om,om/components/bw_check.om,om/components/bw_project.om,$ENC,om/q38-head/bounds.om,om/q38-head/emit.om}" PURE_UNITS="revision=om/pipeline/revision.om epoch=om/pipeline/epoch.om f16=om/numeric/f16.om" DEST="${OMEGA_UNITS_DEST:-$ROOT/src}" OUTS="cudapp_native.h cudapp_om_units.ident" diff --git a/src/cudapp_native.h b/src/cudapp_native.h index 90ff6a56..d52e4a26 100644 --- a/src/cudapp_native.h +++ b/src/cudapp_native.h @@ -50,6 +50,7 @@ uint32_t omega_native_mcdir(uint64_t *result, const void *p0, uint64_t p0_n, con uint32_t omega_native_mcalloc(uint64_t *result, const void *p0, uint64_t p0_n, const void *p1, uint64_t p1_n, void *p2, uint64_t p2_n); uint32_t omega_native_mcseries(uint64_t *result, const void *p0, uint64_t p0_n, const void *p1, uint64_t p1_n, const void *p2, uint64_t p2_n, void *p3, uint64_t p3_n); uint32_t omega_native_qgshape(uint64_t *result, uint64_t p0, uint64_t p1, uint64_t p2, uint64_t p3); +uint32_t omega_native_qgorder(uint64_t *result, void *p0, uint64_t p0_n, uint64_t p1, uint64_t p2, uint64_t p3, uint64_t p4); uint32_t omega_q38_runtime(uint64_t *result, const void *p0, uint64_t p0_n, const void *p1, uint64_t p1_n, void *p2, uint64_t p2_n); uint32_t omega_q38_emit(uint64_t *result, void *p0, uint64_t p0_n); uint32_t omega_native_revision(uint64_t *result, uint64_t p0); diff --git a/src/cudapp_om_prefill_order.c b/src/cudapp_om_prefill_order.c new file mode 100644 index 00000000..fbe2abfb --- /dev/null +++ b/src/cudapp_om_prefill_order.c @@ -0,0 +1,116 @@ +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif +/* Emitted by Omega Bridge. GNU C11, POSIX. Scalars use canonical 64-bit bits. */ +#include +#include +#include +#include +#include +static _Thread_local jmp_buf o_jmp; +static _Thread_local int o_busy; +static __attribute__((noreturn)) void o_trap(int c){if(o_busy)longjmp(o_jmp,c);_exit(100+c);} +static _Thread_local unsigned o_depth; +static void o_enter(void){if(++o_depth>128)o_trap(6);} +static uint64_t o_leave(uint64_t v){--o_depth;return v;} +static unsigned o_width(unsigned t){static const unsigned w[]={0,1,8,16,32,64,8,16,32,64};return w[t];} +static __int128 o_value(unsigned t,uint64_t v){return t>=6 && v>>63 ? (__int128)v-(((__int128)1)<<64):(__int128)v;} +static uint64_t o_norm(unsigned t,__int128 v,int code){unsigned w=o_width(t);if(t>=6){__int128 m=((__int128)1)<<(w-1);if(v< -m||v>=m)o_trap(code);}else {if(v<0||(__uint128_t)v>=(((__uint128_t)1)<=6&&op<=11){switch(op){case 6:return x==y;case 7:return x!=y;case 8:return xy;default:return x>=y;}} + if(op==12)return a&b;if(op==13)return a|b;if(op==14)return a^b; + if(op==15||op==16){if(b>=w)o_trap(7);if(op==15)return t>=6?o_norm(t,x*(((__int128)1)<>b;if(!b)return a;return (a>>b)|((a>>63)?(UINT64_MAX<<(64-b)):0);} + if(op==17){if(t<6)return (0-a)&mask;return o_norm(t,-x,1);}if(op==18)return t==1?!a:(t>=6?~a:(~a)&mask); + if(op==4||op==5){if(!b)o_trap(2);z=op==4?x/y:x%y;return t>=6?o_norm(t,z,1):(uint64_t)z;} + if(t<6){if(op==1)return (a+b)&mask;if(op==2)return (a-b)&mask;return (a*b)&mask;} + if(op==1)z=x+y;if(op==2)z=x-y;if(op==3)z=x*y;return o_norm(t,z,1); +} +static uint64_t o_get(const void *p,uint64_t n,uint64_t i,unsigned t){if(i>=n)o_trap(3);switch(t){case 2:return ((const uint8_t*)p)[i];case 3:return ((const uint16_t*)p)[i];case 4:return ((const uint32_t*)p)[i];case 5:return ((const uint64_t*)p)[i];case 6:return (uint64_t)((const int8_t*)p)[i];case 7:return (uint64_t)((const int16_t*)p)[i];case 8:return (uint64_t)((const int32_t*)p)[i];default:return (uint64_t)((const int64_t*)p)[i];}} +static void o_put(void *p,uint64_t n,uint64_t i,uint64_t v,unsigned t){if(i>=n)o_trap(3);o_norm(t,o_value(t,v),5);switch(t){case 2:((uint8_t*)p)[i]=(uint8_t)v;break;case 3:((uint16_t*)p)[i]=(uint16_t)v;break;case 4:((uint32_t*)p)[i]=(uint32_t)v;break;case 5:((uint64_t*)p)[i]=v;break;case 6:((int8_t*)p)[i]=(int8_t)o_value(t,v);break;case 7:((int16_t*)p)[i]=(int16_t)o_value(t,v);break;case 8:((int32_t*)p)[i]=(int32_t)o_value(t,v);break;default:((int64_t*)p)[i]=(int64_t)o_value(t,v);}} +static void o_fill(void *p,uint64_t n,uint64_t v,unsigned t){for(uint64_t i=0;in||len>n-off)o_trap(3);int f=(int)o_value(8,fd);ssize_t r=op==1?read(f,(uint8_t*)p+off,(size_t)len):write(f,(const uint8_t*)p+off,(size_t)len);return r<0?(uint64_t)(-(int64_t)errno):(uint64_t)r;} +static int o_valid(unsigned t,uint64_t v){unsigned w=o_width(t);__int128 x=o_value(t,v);__int128 m=((__int128)1)<<(t>=6?w-1:w);return t>=6?x>=-m&&x=0&&x +#include +#if FLT_RADIX != 2 || FLT_MANT_DIG != 24 || FLT_MAX_EXP != 128 || FLT_EVAL_METHOD != 0 +#error unsupported binary32 environment +#endif +#if defined(__FAST_MATH__) +#error fast math is not a supported Omega environment +#endif +static uint64_t o_f32(unsigned op,uint64_t a,uint64_t b){uint32_t ua=(uint32_t)a,ub=(uint32_t)b,ur;float x,y;__builtin_memcpy(&x,&ua,4);__builtin_memcpy(&y,&ub,4);if(op==1)return ua&UINT32_C(0x7fffffff);if(op==2){volatile float z=x*y;__builtin_memcpy(&ur,(const void*)&z,4);return ur;}return x<=y;} +static uint64_t f0(void *v0, uint64_t v0_n, uint64_t v1, uint64_t v2, uint64_t v3, uint64_t v4); +static uint64_t f1(void *v0, uint64_t v0_n, uint64_t v1, uint64_t v2); +static uint64_t f2(void *v0, uint64_t v0_n, uint64_t v1, uint64_t v2, uint64_t v3, uint64_t v4); +static uint64_t f0(void *v0, uint64_t v0_n, uint64_t v1, uint64_t v2, uint64_t v3, uint64_t v4){ +o_enter(); +{uint64_t _i=v1;uint64_t _v=v2;o_put(v0, v0_n, _i,_v,5);} +{uint64_t _i=({uint64_t _a=v1;uint64_t _b=1ULL;o_op(1, 5, _a,_b);});uint64_t _v=({uint64_t _a=v3;uint64_t _b=4ULL;o_op(5, 5, _a,_b);});o_put(v0, v0_n, _i,_v,5);} +{uint64_t _i=({uint64_t _a=v1;uint64_t _b=2ULL;o_op(1, 5, _a,_b);});uint64_t _v=({uint64_t _a=({uint64_t _a=v3;uint64_t _b=4ULL;o_op(4, 5, _a,_b);});uint64_t _b=4ULL;o_op(5, 5, _a,_b);});o_put(v0, v0_n, _i,_v,5);} +{uint64_t _i=({uint64_t _a=v1;uint64_t _b=3ULL;o_op(1, 5, _a,_b);});uint64_t _v=({uint64_t _a=v3;uint64_t _b=16ULL;o_op(4, 5, _a,_b);});o_put(v0, v0_n, _i,_v,5);} +{uint64_t _i=({uint64_t _a=v1;uint64_t _b=4ULL;o_op(1, 5, _a,_b);});uint64_t _v=v4;o_put(v0, v0_n, _i,_v,5);} +return o_leave(({uint64_t _a=v1;uint64_t _b=5ULL;o_op(1, 5, _a,_b);})); +} +static uint64_t f1(void *v0, uint64_t v0_n, uint64_t v1, uint64_t v2){ +o_enter(); +uint64_t __attribute__((unused)) v3=({uint64_t _a=1ULL;uint64_t _b=v1;o_op(15, 5, _a,_b);}); +uint64_t __attribute__((unused)) v4=({uint64_t p1=3ULL;uint64_t p2=1ULL;uint64_t p3=2ULL;uint64_t p4=({uint64_t _a=v3;uint64_t _b=1ULL;o_op(2, 5, _a,_b);});f0(v0, v0_n, p1, p2, p3, p4);}); +v4=({uint64_t p1=v4;uint64_t p2=2ULL;uint64_t p3=0ULL;uint64_t p4=v1;f0(v0, v0_n, p1, p2, p3, p4);}); +v4=({uint64_t p1=v4;uint64_t p2=3ULL;uint64_t p3=37ULL;uint64_t p4=v3;f0(v0, v0_n, p1, p2, p3, p4);}); +if(({uint64_t _a=v2;uint64_t _b=1ULL;o_op(6, 5, _a,_b);})){ +v4=({uint64_t p1=v4;uint64_t p2=4ULL;uint64_t p3=3ULL;uint64_t p4=940ULL;f0(v0, v0_n, p1, p2, p3, p4);}); +v4=({uint64_t p1=v4;uint64_t p2=5ULL;uint64_t p3=52ULL;uint64_t p4=0ULL;f0(v0, v0_n, p1, p2, p3, p4);}); +v4=({uint64_t p1=v4;uint64_t p2=6ULL;uint64_t p3=0ULL;uint64_t p4=0ULL;f0(v0, v0_n, p1, p2, p3, p4);}); +} +{uint64_t _i=2ULL;uint64_t _v=({uint64_t _a=({uint64_t _a=v4;uint64_t _b=3ULL;o_op(2, 5, _a,_b);});uint64_t _b=5ULL;o_op(4, 5, _a,_b);});o_put(v0, v0_n, _i,_v,5);} +return o_leave(1ULL); +} +static uint64_t f2(void *v0, uint64_t v0_n, uint64_t v1, uint64_t v2, uint64_t v3, uint64_t v4){ +o_enter(); +{uint64_t _i=0ULL;uint64_t _v=0ULL;o_put(v0, v0_n, _i,_v,5);} +{uint64_t _i=1ULL;uint64_t _v=0ULL;o_put(v0, v0_n, _i,_v,5);} +{uint64_t _i=2ULL;uint64_t _v=0ULL;o_put(v0, v0_n, _i,_v,5);} +if(({uint64_t _a=({uint64_t _a=v1;uint64_t _b=5ULL;o_op(10, 5, _a,_b);});uint64_t _b=({uint64_t _a=v4;uint64_t _b=1ULL;o_op(10, 5, _a,_b);});o_op(13, 1, _a,_b);})){ +return o_leave(0ULL); +} +if(({uint64_t _a=({uint64_t _a=v2;uint64_t _b=0ULL;o_op(6, 5, _a,_b);});uint64_t _b=({uint64_t _a=v2;uint64_t _b=65535ULL;o_op(10, 5, _a,_b);});o_op(13, 1, _a,_b);})){ +return o_leave(0ULL); +} +if(({uint64_t _a=({uint64_t _a=v3;uint64_t _b=0ULL;o_op(6, 5, _a,_b);});uint64_t _b=({uint64_t _a=v3;uint64_t _b=65535ULL;o_op(10, 5, _a,_b);});o_op(13, 1, _a,_b);})){ +return o_leave(0ULL); +} +uint64_t __attribute__((unused)) v5=({uint64_t _a=1ULL;uint64_t _b=v1;o_op(15, 5, _a,_b);}); +uint64_t __attribute__((unused)) v6=({uint64_t _a=v2;uint64_t _b=v5;o_op(3, 5, _a,_b);}); +if(({uint64_t _a=v6;uint64_t _b=65535ULL;o_op(10, 5, _a,_b);})){ +return o_leave(0ULL); +} +{uint64_t _i=0ULL;uint64_t _v=v6;o_put(v0, v0_n, _i,_v,5);} +{uint64_t _i=1ULL;uint64_t _v=({uint64_t _a=({uint64_t _a=v3;uint64_t _b=({uint64_t _a=v5;uint64_t _b=1ULL;o_op(2, 5, _a,_b);});o_op(1, 5, _a,_b);});uint64_t _b=v5;o_op(4, 5, _a,_b);});o_put(v0, v0_n, _i,_v,5);} +if(({uint64_t _a=v1;uint64_t _b=0ULL;o_op(6, 5, _a,_b);})){ +return o_leave(1ULL); +} +return o_leave(({uint64_t p1=v1;uint64_t p2=v4;f1(v0, v0_n, p1, p2);})); +} +uint32_t omega_native_qgorder(uint64_t *result, void *p0, uint64_t p0_n, volatile uint64_t p1, volatile uint64_t p2, volatile uint64_t p3, volatile uint64_t p4){ +if(!o_buf(result,1,1,5))return 32; +if(!o_buf(p0, p0_n,64, 5))return 32; +if(o_overlap(result,8,p0, p0_n*8))return 32; +if(!o_valid(5, p1))return 32; +if(!o_valid(5, p2))return 32; +if(!o_valid(5, p3))return 32; +if(!o_valid(5, p4))return 32; +if(o_busy)return 33; +o_busy=1;o_depth=0;int code=setjmp(o_jmp); +if(!code)*result=f2(p0, p0_n, p1, p2, p3, p4); +o_busy=0;o_depth=0;return (uint32_t)code; +} +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif diff --git a/src/cudapp_om_prefill_order.ident b/src/cudapp_om_prefill_order.ident new file mode 100644 index 00000000..4e0810f7 --- /dev/null +++ b/src/cudapp_om_prefill_order.ident @@ -0,0 +1 @@ +omega-ident 2 unit=prefill_order abi=bridge-seeded src=72bd9cd03401012a45c9ea4e0f4e583bfda23fe1e58e628e773cc856344eaf3e c=43c835999dd230d3b953ad5b002a63d116638d93b4cb6893525676db6432ae77 omc=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f converter=3a416aea14770bd3fab4880337e89020c10476214d7a3c139d8cd1a8ba1423e6 frontend=23ff7a2356bb5d980060a4685a27ac46587013069b7d24b37c2873d7ee659b37 path=prefill_order=om/prefill-shape/order.om diff --git a/src/cudapp_om_units.ident b/src/cudapp_om_units.ident index 14e4decd..4b8ce9a5 100644 --- a/src/cudapp_om_units.ident +++ b/src/cudapp_om_units.ident @@ -37,6 +37,7 @@ omega-ident 2 unit=closure_dir abi=bridge-seeded src=744abff597179e71cbfc63b9f23 omega-ident 2 unit=closure_alloc abi=bridge-seeded src=03d54ba1cd85fe2745e53dd8b8f2698db633c2e40d6bd3cffaa282111d04be47 c=b93849c3f0791273b3f150294a8ea95c82d747dbf9369a639b41a0aadd04238b omc=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f converter=3a416aea14770bd3fab4880337e89020c10476214d7a3c139d8cd1a8ba1423e6 frontend=23ff7a2356bb5d980060a4685a27ac46587013069b7d24b37c2873d7ee659b37 path=closure_alloc=om/quant/quant.om,om/components/realize.om,om/cache/digest.om,om/moe/moe_windows.om,om/moe/moe_group.om,native/learn53/moe-closure.om,om/moe/closure_alloc.om omega-ident 2 unit=closure_series abi=bridge-seeded src=f58f14e2050dff8ccee6dedc11dfc92fe16d113988f2ee4d8e3d52480345ddae c=abd1ffe24fa67b2266790b07034c4691b4fbb8dacc2dd9bc4f8c8ef78a191832 omc=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f converter=3a416aea14770bd3fab4880337e89020c10476214d7a3c139d8cd1a8ba1423e6 frontend=23ff7a2356bb5d980060a4685a27ac46587013069b7d24b37c2873d7ee659b37 path=closure_series=om/quant/quant.om,om/components/realize.om,om/cache/digest.om,om/moe/moe_windows.om,om/moe/moe_group.om,native/learn53/moe-closure.om,om/moe/closure_series.om omega-ident 2 unit=prefill_shape abi=bridge-seeded src=0a64dc98f47711c6e75af62b6afe43b0f4ffbc3181c2f3a34ac1f2788d2ac23b c=4dca73ff1821f73bdc6d13050a1a1be4762354ee9c6d082145adf057c49530b6 omc=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f converter=3a416aea14770bd3fab4880337e89020c10476214d7a3c139d8cd1a8ba1423e6 frontend=23ff7a2356bb5d980060a4685a27ac46587013069b7d24b37c2873d7ee659b37 path=prefill_shape=om/prefill-shape/admit.om +omega-ident 2 unit=prefill_order abi=bridge-seeded src=72bd9cd03401012a45c9ea4e0f4e583bfda23fe1e58e628e773cc856344eaf3e c=43c835999dd230d3b953ad5b002a63d116638d93b4cb6893525676db6432ae77 omc=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f converter=3a416aea14770bd3fab4880337e89020c10476214d7a3c139d8cd1a8ba1423e6 frontend=23ff7a2356bb5d980060a4685a27ac46587013069b7d24b37c2873d7ee659b37 path=prefill_order=om/prefill-shape/order.om omega-ident 2 unit=q38_runtime abi=bridge-seeded src=9b688d301a7dfa239268b23487bd653243625a785bb33f941c2f94d9f40a38ff c=df1efe6702506d0ce9a62fe47115af7a3bc68d098ad28a9973884be7943cebec omc=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f converter=3a416aea14770bd3fab4880337e89020c10476214d7a3c139d8cd1a8ba1423e6 frontend=23ff7a2356bb5d980060a4685a27ac46587013069b7d24b37c2873d7ee659b37 path=q38_runtime=om/q38-head/envelope.om,om/q38-head/plan.om omega-ident 2 unit=q38_emit abi=bridge-seeded src=f929bdf0f5198c5e4f0b3ff369f2755985b5e9e19303df895ca8e7d49e744b21 c=113b5c9e6ffefe0adfe6fb3e2f06da6dd276a8b3ff350a9509694b03cc4cbba0 omc=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f converter=3a416aea14770bd3fab4880337e89020c10476214d7a3c139d8cd1a8ba1423e6 frontend=23ff7a2356bb5d980060a4685a27ac46587013069b7d24b37c2873d7ee659b37 path=q38_emit=om/components/bw_alloc.om,om/components/bw_effect.om,om/components/bw_check.om,om/components/bw_project.om,om/encoder/bw_enc_sm121.om,om/encoder/bw_spec_sm121.om,om/components/encode.om,om/q38-head/bounds.om,om/q38-head/emit.om omega-ident 2 unit=revision abi=bridge-freest src=53a0fb536fed186d2fcd2d1793eb580892f07a372292f2ca0d7d7cb1cafb9c2d c=951aaf9528e3a24ff8e08cf40d064c3816feb9be352b959b512bb0ae59dca718 omc=2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f converter=836cbf9ef8a3c4ee82b0458070884405bc8296f83b10f933556bf27750bb3661 frontend=51b41794e7001c5606b715fd7de8a34ec935a6e4e4bc1da36ad08102c009537d path=revision=om/pipeline/revision.om diff --git a/src/omega_blackwell_codegen_qg.c b/src/omega_blackwell_codegen_qg.c index 09945473..58d76153 100644 --- a/src/omega_blackwell_codegen_qg.c +++ b/src/omega_blackwell_codegen_qg.c @@ -80,7 +80,8 @@ int omega_qg_spec_ok(const OmegaQgSpec *s) { if (s->n == 0 || s->n % (s->warps * 16u)) return 0; if ((16u * s->rt * 4u) % (32u * s->warps)) return 0; /* whole 16-byte staging slots per thread */ if (s->mutant < 0 || s->mutant > 4) return 0; - return 1; + uint64_t plan[64] = {0}, ok = 0; + return omega_native_qgorder(&ok, plan, 64, s->group, s->n / (s->warps * 16u), 1, 1) == OMEGA_OK && ok == 1; } uint32_t omega_qg_shared_bytes(const OmegaQgSpec *s) { return omega_qg_spec_ok(s) ? 2u * (16u * s->rt * 64u + 16u * s->rt * 4u) : 0u; } uint32_t omega_qg_span(const OmegaQgSpec *s) { return omega_qg_spec_ok(s) ? s->warps * 16u : 0u; } @@ -91,6 +92,28 @@ static void ffma_s(Em *e, int d, unsigned dsub, int a, unsigned asub, int b, uns } static void mufu_q(Em *e, BlackwellIROpcode op, int d, int a) { BlackwellIRInsn i = I0(op); i.dst_vreg = d; i.src1_vreg = a; emit(e, i, K_VAR); } +/* Primitive adapter for the instruction stream owned by om/prefill-shape/order.om. + * It contains no coordinate mapping policy. Roles: cx, cy, temporary, tile count. */ +static int qg_order_emit(Em *e, const uint64_t p[64], const int role[4], int *branch) { + if (p[2] > 6) return -1; + for (uint64_t i = 0; i < p[2]; i++) { + const uint64_t *v = p + 3 + 5 * i; + if (v[1] > 3 || v[2] > 3 || v[3] > 3 || v[4] > UINT32_MAX) return -1; + const int d = role[v[1]], a = role[v[2]], b = role[v[3]]; + const uint32_t imm = (uint32_t)v[4]; + switch (v[0]) { + case 1: andi(e, d, a, 0, imm); break; + case 2: shr(e, d, a, 0, imm); break; + case 3: imadi(e, d, a, 0, imm, b); break; + case 4: ldc32(e, d, imm); break; + case 5: isetp_ge_u32(e, a, b); break; + case 6: if (!branch || *branch >= 0) return -1; *branch = bra_if_p0_fwd(e); break; + default: return -1; + } + } + return e->err ? -1 : 0; +} + int omega_blackwell_codegen_qgemm_prog(const OmegaQgSpec *spec, BlackwellIRProgram *prog) { if (!omega_qg_spec_ok(spec) || !prog) return -1; const uint32_t K = spec->k, RT = spec->rt, W = spec->warps, T = 32u * W; @@ -102,6 +125,10 @@ int omega_blackwell_codegen_qgemm_prog(const OmegaQgSpec *spec, BlackwellIRProgr * times threads. Blackwell Tuning Guide, physical page 13. */ if (RT == 8 && omega_bw_ir_set_gpr_limit(prog, BW_PHYS_GPR_HW_LIMIT) != 0) return -1; Em em; memset(&em, 0, sizeof em); em.p = prog; Em *e = &em; + uint64_t order[64] = {0}, epilogue[64] = {0}, ok = 0; + if (omega_native_qgorder(&ok, order, 64, spec->group, spec->n / SPAN, 1, 1) != OMEGA_OK || ok != 1) return -1; + if (omega_native_qgorder(&ok, epilogue, 64, spec->group, spec->n / SPAN, 1, 0) != OMEGA_OK || ok != 1) return -1; + int at_exit = -1; int udesc = UV64(e), ptab = V64(e), pidx = V64(e), px = V64(e), pxs = V64(e); int tid = V(e), cx = V(e), cy = V(e), warp = V(e), lane = V(e), g = V(e), tq = V(e), one = V(e), tent = V64(e); @@ -112,6 +139,11 @@ int omega_blackwell_codegen_qgemm_prog(const OmegaQgSpec *spec, BlackwellIRProgr ldc64(e, ptab, 0x380); if (!spec->direct) ldc64(e, pidx, 0x388); ldc64(e, px, 0x390); ldc64(e, pxs, 0x3a0); s2r(e, tid, BW_SR_TID_X); s2r(e, cx, BW_SR_CTAID_X); s2r(e, cy, BW_SR_CTAID_Y); movi(e, one, 1); + if (order[2]) { + int ntl = V(e); + const int role[4] = {cx, cy, tmp, ntl}; + if (e->err || qg_order_emit(e, order, role, &at_exit)) return -1; + } shr(e, warp, tid, 0, 5); andi(e, lane, tid, 0, 31); shr(e, g, lane, 0, 2); andi(e, tq, lane, 0, 3); imadw(e, tent, cy, OMEGA_QG_TILE_BYTES, ptab); ldg_wide(e, BW_IR_LDG_E_64, wbase, tent, 0, udesc, 1); @@ -226,6 +258,8 @@ int omega_blackwell_codegen_qgemm_prog(const OmegaQgSpec *spec, BlackwellIRProgr if (e->err) return -1; ldc64(e, tab2, 0x380); ldc64(e, py2, 0x398); ldc32(e, n2, 0x3a8); s2r(e, tid2, BW_SR_TID_X); s2r(e, cx2, BW_SR_CTAID_X); s2r(e, cy2, BW_SR_CTAID_Y); + const int role[4] = {cx2, cy2, tmp2, NOREG}; + if (qg_order_emit(e, epilogue, role, NULL)) return -1; imadw(e, ten2, cy2, OMEGA_QG_TILE_BYTES, tab2); ldg_wide(e, BW_IR_LDG_E_64, rc2, ten2, 16, udesc, 1); andi(e, lane2, tid2, 0, 31); shr(e, g2, lane2, 0, 2); andi(e, tq3, lane2, 0, 3); @@ -276,6 +310,7 @@ int omega_blackwell_codegen_qgemm_prog(const OmegaQgSpec *spec, BlackwellIRProgr bsync(e); for (uint32_t q = 0; q < nskip; q++) patch_bra(e, skips[q], at_bsync); patch_bra(e, at_bssy, at_bsync + 1); } + if (at_exit >= 0) patch_bra(e, at_exit, here(e)); tail(e); if (e->err) return -1; return omega_bw_regalloc_solve(prog); diff --git a/src/omega_blackwell_codegen_qg.h b/src/omega_blackwell_codegen_qg.h index de698914..4be353e9 100644 --- a/src/omega_blackwell_codegen_qg.h +++ b/src/omega_blackwell_codegen_qg.h @@ -44,7 +44,7 @@ int omega_blackwell_codegen_pq_prog(const OmegaPqSpec *s, BlackwellIRProgram *pr * 0 .. I-1 then up rows I .. 2I-1, as the checkpoint): column tile 0 of a warp is gate rows n0w / 2 .. +7, tile 1 the up rows I later; act[row][n0w / 2 + 2t + q] = bf16_rn(g * rcp(2^min(-g log2 e, 125) + 1) * u), no extra scale * (the cap keeps the reciprocal normal: for g < -86.6 the result is g * 2^-125 * u instead of a flushed or subnormal value). * Tile entry (32 bytes): { w_va u64, s_va u64, row0 u32, cnt u32 (1 .. 16 rt), pad u64 }; rows past cnt are not stored. - * Constant bank 0x380: tiles, rowidx (ignored when direct), xq, y, xs (u64 each), n u32 at 0x3a8. + * Constant bank 0x380: tiles, rowidx (ignored when direct), xq, y, xs (u64 each), n u32 at 0x3a8, tile count u32 at 0x3ac. * Grid: n / (warps * 16) x tiles; 32 * warps threads; shared 2 * (16 rt * 64 + 16 rt * 4) bytes. * mutant (tests only): 1 drops sa (uses sw only), 2 never advances the sw pointer, 3 row tile i reads tile i^1, 4 drops step 1 * of every odd chunk. */ @@ -58,8 +58,9 @@ typedef struct { uint32_t n; /* output width (weight rows), multiple of warps * 16 */ uint32_t wait; /* stall cycles between a row tile's last QMMA and the first FFMA reading its result */ int mutant; + uint32_t group; /* 0: original order; 1..5: checked Omega weight-panel reuse groups */ } OmegaQgSpec; -#define OMEGA_QG_ARGS_WORDS 11u +#define OMEGA_QG_ARGS_WORDS 12u #define OMEGA_QG_TILE_BYTES 32u int omega_qg_spec_ok(const OmegaQgSpec *s); uint32_t omega_qg_shared_bytes(const OmegaQgSpec *s); diff --git a/src/omega_gpu_pfgemm.c b/src/omega_gpu_pfgemm.c index 00f79f75..2733418a 100644 --- a/src/omega_gpu_pfgemm.c +++ b/src/omega_gpu_pfgemm.c @@ -5,6 +5,7 @@ #include "omega_gpu_fp8_api.h" #include "omega_gpu_cmdlist.h" #include "omega_gpu_fmt.h" +#include "cudapp_native.h" #include #include @@ -143,7 +144,8 @@ int omega_gpu_pf_quant_record(OmegaGpuCmdList *cl, uint32_t k, uint32_t in_type, /* ---- native FP8 path (W-L1G): grouped GEMM on QMMA (omega_blackwell_codegen_qg.h) ---- */ #define KIND_QG 4u -static struct { uint32_t rt, warps, wait, set; int mutant; } q; +static struct { uint32_t rt, warps, wait, set; int mutant; uint32_t group; } q; +void omega_gpu_pf_qgemm_set_group(uint32_t group) { q.group = group; } void omega_gpu_pf_qgemm_set_shape(uint32_t rt, uint32_t warps, uint32_t wait) { q.rt = rt; q.warps = warps; q.wait = wait; q.set = rt || warps || wait; } void omega_gpu_pf_qgemm_test_set_mutant(int m) { q.mutant = m; } static uint32_t QRT(void) { return q.rt ? q.rt : 4u; } @@ -195,7 +197,7 @@ static int qg_core(OmegaGpuCmdList *cl, uint32_t n, uint32_t k, uint32_t layout, if (ntiles == 0) return OMEGA_GPU_PF_OK; if (ntiles > 65535u) return OMEGA_GPU_PF_TOO_LARGE; OmegaQgSpec s; memset(&s, 0, sizeof s); - s.k = k; s.rt = QRT(); s.warps = QWARPS(); s.wait = QWAIT(); s.n = n; s.mutant = q.mutant; + s.k = k; s.rt = QRT(); s.warps = QWARPS(); s.wait = QWAIT(); s.n = n; s.mutant = q.mutant; s.group = q.group; s.epi = layout == OMEGA_GPU_PF_SWIGLU_NAT ? OMEGA_QG_EPI_SWIGLU : OMEGA_QG_EPI_F32; s.direct = rowidx_va == 0; if (!omega_qg_spec_ok(&s)) return OMEGA_GPU_PF_BAD_ARGS; const uint32_t span = omega_qg_span(&s); @@ -205,14 +207,16 @@ static int qg_core(OmegaGpuCmdList *cl, uint32_t n, uint32_t k, uint32_t layout, uint32_t args[OMEGA_QG_ARGS_WORDS]; const uint64_t va[5] = { tiles_va, rowidx_va, xq_va, y_va, xs_va }; for (int i = 0; i < 5; i++) { args[2 * i] = (uint32_t)va[i]; args[2 * i + 1] = (uint32_t)(va[i] >> 32); } - args[10] = n; + args[10] = n; args[11] = ntiles; + uint64_t plan[64] = {0}, ok = 0; + if (omega_native_qgorder(&ok, plan, 64, s.group, n / span, ntiles, 1) != OMEGA_OK || ok != 1) return OMEGA_GPU_PF_BAD_ARGS; if (!cl) omega_gpu_session_lock(); int rc = omega_gpu_pf_open_locked(); OmegaPfKernel kern; if (rc == OMEGA_GPU_PF_OK) rc = omega_gpu_pf_kernel_locked(&key, gen_qg, &kern); if (rc == OMEGA_GPU_PF_OK) - rc = cl ? omega_gpu_pf_record_locked(cl, &kern, 32u * s.warps, n / span, ntiles, omega_qg_shared_bytes(&s), args, OMEGA_QG_ARGS_WORDS) - : omega_gpu_pf_launch_locked(&kern, 32u * s.warps, n / span, ntiles, omega_qg_shared_bytes(&s), args, OMEGA_QG_ARGS_WORDS, ns); + rc = cl ? omega_gpu_pf_record_locked(cl, &kern, 32u * s.warps, (uint32_t)plan[0], (uint32_t)plan[1], omega_qg_shared_bytes(&s), args, OMEGA_QG_ARGS_WORDS) + : omega_gpu_pf_launch_locked(&kern, 32u * s.warps, (uint32_t)plan[0], (uint32_t)plan[1], omega_qg_shared_bytes(&s), args, OMEGA_QG_ARGS_WORDS, ns); if (!cl) omega_gpu_session_unlock(); return rc; } diff --git a/src/omega_gpu_prefill.h b/src/omega_gpu_prefill.h index 9a365c64..0dc62b5f 100644 --- a/src/omega_gpu_prefill.h +++ b/src/omega_gpu_prefill.h @@ -105,6 +105,7 @@ struct OmegaGpuCmdList; int omega_gpu_pf_quant_record(struct OmegaGpuCmdList *cl, uint32_t k, uint32_t in_type, uint32_t rows, uint64_t x_va, uint64_t q_va, uint64_t s_va); int omega_gpu_pf_qgemm_record(struct OmegaGpuCmdList *cl, uint32_t n, uint32_t k, uint32_t layout, uint64_t tiles_va, uint32_t ntiles, uint64_t rowidx_va, uint64_t xq_va, uint64_t xs_va, uint64_t y_va); +void omega_gpu_pf_qgemm_set_group(uint32_t group); /* 0 restores original order; 1..5 candidate reuse groups. Set before model use. */ void omega_gpu_pf_qgemm_set_shape(uint32_t rt, uint32_t warps, uint32_t wait); /* knobs (all 0 restores rt 4, warps 8, wait 45) */ void omega_gpu_pf_qgemm_test_set_mutant(int m); #ifdef __cplusplus diff --git a/src/omega_runtime_api.h b/src/omega_runtime_api.h index 888c551b..7558d535 100644 --- a/src/omega_runtime_api.h +++ b/src/omega_runtime_api.h @@ -14,7 +14,7 @@ * tools/runtime_api_semver.sh fails when the manifest changed without the bump the rule asks for. */ #define OMEGA_RUNTIME_API_VERSION_MAJOR 0 -#define OMEGA_RUNTIME_API_VERSION_MINOR 9 +#define OMEGA_RUNTIME_API_VERSION_MINOR 10 #define OMEGA_RUNTIME_API_VERSION_PATCH 0 /* One number for #if comparisons: (MAJOR << 16) | MINOR. PATCH is left out: it never changes the surface. */ #define OMEGA_RUNTIME_API_VERSION ((OMEGA_RUNTIME_API_VERSION_MAJOR << 16) | OMEGA_RUNTIME_API_VERSION_MINOR) diff --git a/tests/bw_hazard_test.c b/tests/bw_hazard_test.c index 09af4f2a..7d3ee406 100644 --- a/tests/bw_hazard_test.c +++ b/tests/bw_hazard_test.c @@ -520,7 +520,7 @@ static void sweep(void) { } for (unsigned a = 0; a < 5; a++) for (unsigned w = 8; w <= 16; w *= 2) for (unsigned epi = 0; epi <= 1; epi++) for (unsigned dir = 0; dir <= 1; dir++) for (unsigned wt = 0; wt <= 120; wt += 60) { - OmegaQgSpec s = { ks[a], 4, w, epi, dir, 512, wt, 0 }; + OmegaQgSpec s = { ks[a], 4, w, epi, dir, 512, wt, 0, 0 }; snprintf(v, sizeof v, "k%u warps%u epi%u direct%u n512 wait%u", ks[a], w, epi, dir, wt); if (BUILD(omega_blackwell_codegen_qgemm_prog(&s, &g_prog))) sweep_prog("qgemm", v, P_TC | P_QMMA); } diff --git a/tests/gpu_qgemm_test.c b/tests/gpu_qgemm_test.c index 76c5e53d..85c48574 100644 --- a/tests/gpu_qgemm_test.c +++ b/tests/gpu_qgemm_test.c @@ -287,7 +287,7 @@ static int qg128_host(void) { int fail=0; for (size_t c=0;cwarps; s.smem = smem; s.smem_bytes = omega_qg_shared_bytes(sp); s.order = order; const uint64_t a[5] = { (uintptr_t)tiles, sp->direct ? 0 : (uintptr_t)ridx, (uintptr_t)p->xq, (uintptr_t)y, (uintptr_t)p->xs }; for (int i = 0; i < 5; i++) { s.cbank[(0x380 + 8 * i) / 4] = (uint32_t)a[i]; s.cbank[(0x380 + 8 * i) / 4 + 1] = (uint32_t)(a[i] >> 32); } - s.cbank[0x3a8 / 4] = p->n; + s.cbank[0x3a8 / 4] = p->n; s.cbank[0x3ac / 4] = nt; const size_t XR = p->xr + p->pad; s.ranges[0].lo = (uintptr_t)tiles; s.ranges[0].hi = (uintptr_t)(tiles + nt); s.ranges[1].lo = (uintptr_t)ridx; s.ranges[1].hi = (uintptr_t)(ridx + p->M + bm); @@ -350,7 +350,8 @@ static int qg_sim_run(const QProb *p, const OmegaQgSpec *sp, int order, void *y, s.ranges[5].lo = (uintptr_t)p->swf; s.ranges[5].hi = (uintptr_t)(p->swf + (size_t)p->E * (p->n / 128) * KB); s.ranges[6].lo = (uintptr_t)p->xs; s.ranges[6].hi = (uintptr_t)(p->xs + XR * KB); s.nranges = 7; - const int err = ws_run(&s, p->n / span, nt); + const uint32_t group_size = 1u << sp->group; + const int err = ws_run(&s, (p->n / span) * group_size, (nt + group_size - 1u) / group_size); if (err) snprintf(msg, msgn, "simulator %.150s", s.msg); free(tiles); free(ridx); free(smem); return err ? -1 : 0; @@ -376,14 +377,16 @@ static int qg_sim(void) { for (size_t c = 0; c < sizeof cs / sizeof cs[0]; c++) { const uint32_t bm = 16 * cs[c].rt; QProb p; qprob_make(&p, cs[c].E, cs[c].n, cs[c].k, cs[c].M, cs[c].xr, cs[c].layout, cs[c].direct, bm); - OmegaQgSpec sp = { cs[c].k, cs[c].rt, cs[c].warps, cs[c].layout == OMEGA_GPU_PF_PLAIN ? OMEGA_QG_EPI_F32 : OMEGA_QG_EPI_SWIGLU, cs[c].direct, cs[c].n, 45, 0 }; + OmegaQgSpec sp = { cs[c].k, cs[c].rt, cs[c].warps, cs[c].layout == OMEGA_GPU_PF_PLAIN ? OMEGA_QG_EPI_F32 : OMEGA_QG_EPI_SWIGLU, cs[c].direct, cs[c].n, 45, 0, 0 }; uint32_t *rows = malloc(p.M * 4); for (uint32_t i = 0; i < p.M; i++) rows[i] = i; void *y = malloc((size_t)(p.M + bm) * p.n * 4); - for (int order = 0; order < 2; order++) { + const uint32_t groups[] = {0,1,3,4}; + for (size_t gi=0;gi