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 / tests / models / nvblk-driver.om

52 lines · 1000 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Binary stdin records: 16 little-endian binary32 bit patterns (64 bytes).
3note Binary stdout per record: UE4M3 scale byte, then 8 packed NVFP4 bytes.
4note Clean EOF before a record exits 0; EOF inside a record exits 3.
5fn rd64 x edit uchar 64 to long
6off = ulong 0
7while lt off 64 bound 65
8n = read 0 x off sub ulong 64 off
9if lt n 0
10ret -2
11end
12if eq n 0
13ret long off
14end
15off = add off ulong n
16end
17ret 64
18end
19fn tobits r view uchar 64 x edit uint 16 to void
20for i ulong 16
21p = mul i 4
22v = uint get r p
23v = or v shl uint get r add p 1 8
24v = or v shl uint get r add p 2 16
25v = or v shl uint get r add p 3 24
26put x i v
27end
28end
29fn main to int
30r = new uchar 64 0
31x = new uint 16 0
32q = new uchar 8 0
33o = new uchar 9 0
34for cs ulong 10000000
35n = rd64 edit r
36if eq n 0
37ret 0
38end
39if ne n 64
40ret 3
41end
42tobits view r edit x
43put o 0 uchar nvfp4nib view x edit q
44for j ulong 8
45put o add j 1 get q j
46end
47if ne write 1 o 0 9 9
48ret 4
49end
50end
51ret 5
52end