interplane.Get Omega
Read in your language

CUDApp

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

Brought by drakestapleton

branch main Branches Tags History

CUDApp / om / core / ampack.om

40 lines · 1202 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Copyright 2026 Drake Stapleton
3note Ampere host packing. C still reads the IR struct (pointer I/O). This unit sign-extends
4note the low 32 bits and packs imm/control plus the flag word. WolframLanguageEvaluator:
5note 2^64 - 2^32 -> 18446744069414584320; 2^31 -> 2147483648.
6note mode 0 packs one instruction from src[16] into dst[0..7].
7note mode 1 sign-extends all 16 slots (the physical-register chunks).
8fn sext32 v ulong to ulong
9v = and v 4294967295
10if ne and v 2147483648 0
11ret or v ulong 18446744069414584320
12end
13ret v
14end
15fn ampack mode ulong src view ulong 16 dst edit ulong 16 to void
16if eq mode 0
17put dst 0 sext32 get src 0
18put dst 1 sext32 get src 1
19put dst 2 sext32 get src 2
20put dst 3 sext32 get src 3
21put dst 4 sext32 get src 4
22put dst 5 sext32 get src 5
23imm = and get src 6 4294967295
24ctl = and get src 7 4294967295
25put dst 6 or imm shl ctl 32
26f = ulong get src 8
27f = or f shl get src 9 1
28f = or f shl get src 10 2
29f = or f shl get src 15 8
30f = or f shl get src 11 16
31f = or f shl get src 12 24
32f = or f shl get src 13 32
33f = or f shl get src 14 40
34put dst 7 f
35else
36for i ulong 16
37put dst i sext32 get src i
38end
39end
40end