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 / platform-linux / fake_devctl.om

42 lines · 793 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Fake-device fixture. Opens a pipe, never /dev/nvidia. FIONREAD is 21531.
3note A wrong expected count is the negative control: this program exits 4.
4global ends uchar 8
5global count uchar 12
6text msg "Omega device boundary"
7fn word32 off ulong to int
8v = uint 0
9for i ulong 4
10v = or v shl uint get ends add off i mul i 8
11end
12ret int v
13end
14fn main to int
15if ne pipefds ends 0 8 0 0
16ret 1
17end
18rd = word32 0
19wr = word32 4
20if ne write wr msg 0 len msg long len msg
21ret 2
22end
23for i ulong 12
24put count i 171
25end
26if ne devctl rd uint 21531 count 4 4 0
27ret 3
28end
29if ne get count 4 uchar len msg
30ret 4
31end
32if ne devctl neg int 1 uint 21531 count 4 4 neg long 9
33ret 5
34end
35if ne fclose rd 0
36ret 6
37end
38if ne fclose wr 0
39ret 7
40end
41ret 0
42end