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 / device-trace / guard-test.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Compose after trace-emit.om. Noncanonical enable/check values cannot bypass refusal. |
| 3 | note Refusal preserves every output byte and its old length, not only a chosen prefix. |
| 4 | |
| 5 | fn gprepare to void |
| 6 | for i ulong 8192 |
| 7 | put gbout i 165 |
| 8 | end |
| 9 | put gboutlen 0 7 |
| 10 | put gbinlen 0 0 |
| 11 | end |
| 12 | |
| 13 | fn gunchanged to bool |
| 14 | if ne get gboutlen 0 7 |
| 15 | ret false |
| 16 | end |
| 17 | for i ulong 8192 |
| 18 | if ne get gbout i 165 |
| 19 | ret false |
| 20 | end |
| 21 | end |
| 22 | ret true |
| 23 | end |
| 24 | |
| 25 | fn main to int |
| 26 | vals = new ulong 4 0 |
| 27 | put vals 1 1 |
| 28 | put vals 2 2 |
| 29 | put vals 3 18446744073709551615 |
| 30 | for i ulong 4 |
| 31 | for j ulong 4 |
| 32 | gprepare |
| 33 | on = get vals i |
| 34 | checks = get vals j |
| 35 | put gtchecks 0 checks |
| 36 | ok = gtewrap on 2 |
| 37 | if and ne on 0 ne checks 1 |
| 38 | if ok |
| 39 | ret 1 |
| 40 | end |
| 41 | if ne get gterr 0 4 |
| 42 | ret 2 |
| 43 | end |
| 44 | same = gunchanged |
| 45 | if not same |
| 46 | ret 3 |
| 47 | end |
| 48 | else |
| 49 | if not ok |
| 50 | ret 4 |
| 51 | end |
| 52 | end |
| 53 | end |
| 54 | end |
| 55 | ret 0 |
| 56 | end |