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 / omega / slices / doorbell.osc

57 lines · 1997 bytes Raw Blame History
1// slice-entry: doorbell_token doorbell_off doorbell_bar doorbell_ring
2// Our doorbell. No video path. Channel id in bits 11:0, runlist id in bits 22:16.
3// A value that does not fit refuses. The store is one write of that token at byte
4// offset 144, cell 18 of the usermode page. BAR0 offset of the same word is 196752.
5// Expected values from Wolfram: (3,42)->196650, (127,4095)->8327167, (64,0)->4194304.
6// slice-run: doorbell_token bytes: 0 1 -> 1
7// slice-run: doorbell_token bytes: 1 0 -> 65536
8// slice-run: doorbell_token bytes: 3 42 -> 196650
9// slice-run: doorbell_token bytes: 0 4095 -> 4095
10// slice-run: doorbell_token bytes: 127 4095 -> 8327167
11// slice-run: doorbell_token bytes: 64 0 -> 4194304
12// slice-run: doorbell_token bytes: 0 4096 -> 18446744073709551615
13// slice-run: doorbell_token bytes: 128 0 -> 18446744073709551615
14// slice-run: doorbell_off bytes: -> 144
15// slice-run: doorbell_bar bytes: -> 196752
16
17
18// slice-run: doorbell_ring cells:32 3 42 -> 0 cells=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,196650,0,0,0,0,0,0,0,0,0,0,0,0,0
19// slice-run: doorbell_ring cells:8 0 1 -> 18446744073709551615
20// slice-run: doorbell_ring cells:32 128 0 -> 18446744073709551615
21fn doorbell_token(b: bytes, runlist: u64, channel: u64) -> u64 {
22 if b.len > 0 {
23 return 18446744073709551615;
24 }
25 if channel > 4095 {
26 return 18446744073709551615;
27 }
28 if runlist > 127 {
29 return 18446744073709551615;
30 }
31 return channel | (runlist << 16);
32}
33
34fn doorbell_off(b: bytes) -> u64 {
35 if b.len > 0 {
36 return 18446744073709551615;
37 }
38 return 144;
39}
40
41fn doorbell_bar(b: bytes) -> u64 {
42 if b.len > 0 {
43 return 18446744073709551615;
44 }
45 return 196752;
46}
47
48fn doorbell_ring(page: cells, runlist: u64, channel: u64) -> u64 {
49 if page.len < 19 {
50 return 18446744073709551615;
51 }
52 if channel > 4095 || runlist > 127 {
53 return 18446744073709551615;
54 }
55 page[18] = channel | (runlist << 16);
56 return 0;
57}