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 / speculation / native-memory-test.om

82 lines · 1773 bytes Raw Blame History
1note Physical RM/UVM buffer lifecycle and CPU access. No kernel or GPU coherence claim.
2global payload uchar 256
3global readback uchar 256
4global diag uchar 24
5text ok "NATIVE_DEVICE_MEMORY_PASS\n"
6text bad "NATIVE_DEVICE_MEMORY_FAIL\n"
7fn pack off ulong v long to void
8for i ulong 8
9put diag add off i uchar and shr v mul i 8 255
10end
11end
12fn ck yes bool to void
13if not yes
14pack 0 long get nvstage 0
15pack 8 get nverr 0
16closed = nvstop
17pack 16 long get nvfault 0
18r = write 2 bad 0 len bad
19r = write 1 diag 0 len diag
20exit int 80
21end
22end
23fn checkmem m long size ulong salt uint to void
24ck gt m 0
25ck eq and mapaddr m 4095 0
26ck eq mapget m 0 8 0
27ck eq mapget m sub size 8 8 0
28for i ulong 256
29put payload i uchar and add uint i salt 255
30end
31off = ulong 0
32while lt off size
33ck eq mapwrite m off payload 0 256 256
34off = add off 256
35end
36off = ulong 0
37while lt off size
38ck eq mapread m off readback 0 256 256
39for i ulong 256
40ck eq get readback i get payload i
41end
42off = add off 256
43end
44end
45fn main to int
46ck nvstop
47for attempt uint 3
48ck nvfull
49ck not nvstart
50ck eq get nverr 0 neg long 16
51put nverr 0 0
52a = nvalloc 4096 true
53checkmem a 4096 attempt
54b = nvalloc 65536 false
55checkmem b 65536 add attempt 17
56ck ne mapaddr a mapaddr b
57ck eq mapget a 0 4 ulong add uint 50462976 mul attempt 16843009
58ck nvdrop a
59ck not nvdrop a
60ck eq get nverr 0 neg long 22
61put nverr 0 0
62c = nvalloc 1048576 true
63checkmem c 1048576 add attempt 31
64ck ne c a
65ck nvdrop b
66ck nvdrop c
67d = nvalloc 4097 true
68checkmem d 8192 add attempt 47
69note The final live buffer is intentionally released by context shutdown.
70ck nvstop
71ck nvstop
72for i ulong len nvmflag
73ck eq get nvmflag i 0
74end
75for i ulong len nvfd
76ck eq get nvfd i neg int 1
77end
78ck eq get nvfault 0 0
79end
80ck eq write 1 ok 0 len ok long len ok
81ret 0
82end