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
CUDApp / tests / shader-pilot / stream-check.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Test-only canonical stream checker. Exactly ID, selector, payload until EOF. |
| 3 | global spbuf uchar 515 |
| 4 | fn main to int |
| 5 | pos = ulong 0 |
| 6 | done = false |
| 7 | while not done bound 516 |
| 8 | r = read 0 spbuf pos sub 515 pos |
| 9 | if lt r 0 |
| 10 | ret 74 |
| 11 | end |
| 12 | if eq r 0 |
| 13 | done = true |
| 14 | else |
| 15 | pos = add pos ulong r |
| 16 | if eq pos 515 |
| 17 | ret 65 |
| 18 | end |
| 19 | end |
| 20 | end |
| 21 | if lt pos 2 |
| 22 | ret 65 |
| 23 | end |
| 24 | mode = get spbuf 1 |
| 25 | if and ne mode 1 ne mode 2 |
| 26 | ret 77 |
| 27 | end |
| 28 | n = spload ulong get spbuf 0 |
| 29 | if eq n 0 |
| 30 | ret 77 |
| 31 | end |
| 32 | if eq mode 2 |
| 33 | n = 512 |
| 34 | end |
| 35 | if ne pos add n 2 |
| 36 | ret 65 |
| 37 | end |
| 38 | for i ulong n |
| 39 | want = get kt i |
| 40 | if eq mode 2 |
| 41 | want = get gbcode i |
| 42 | end |
| 43 | if ne get spbuf add i 2 want |
| 44 | ret 1 |
| 45 | end |
| 46 | end |
| 47 | ret 0 |
| 48 | end |