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 / om / cache / validate.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Runtime adapter reuses the sole-owner validator and fresh staged composer. |
| 3 | note No caller may supply successful composer statistics or substitute code. |
| 4 | note Callee scratch avoids the pinned compiler's sixteen-slot register ceiling. |
| 5 | fn nv_record cfg view ulong 16 rec view uchar 4096 launch view uchar 4096 actual view ulong 8 to uint |
| 6 | l = new ulong 32 0 |
| 7 | for i ulong 32 |
| 8 | put l i compose_word launch i |
| 9 | end |
| 10 | ret bc_record cfg rec l actual |
| 11 | end |
| 12 | fn nv_code ins view ulong 8192 phys view ulong 288 count ulong code view uchar 16384 bytes ulong to int |
| 13 | fresh = new uchar 16384 0 |
| 14 | n = bc_encode ins phys count 1 fresh |
| 15 | if or eq n 0 ne n bytes |
| 16 | ret -14 |
| 17 | end |
| 18 | for i ulong n |
| 19 | if ne get fresh i get code i |
| 20 | ret -14 |
| 21 | end |
| 22 | end |
| 23 | ret 0 |
| 24 | end |
| 25 | fn nv_staged rec view uchar 4096 code view uchar 16384 launch view uchar 4096 bytes ulong to int |
| 26 | cfg = new ulong 16 0 |
| 27 | ins = new ulong 8192 0 |
| 28 | meta = new ulong 2048 0 |
| 29 | phys = new ulong 288 0 |
| 30 | actual = new ulong 8 0 |
| 31 | if and ne compose_word launch 12 8 ne compose_word launch 12 12 |
| 32 | ret -14 |
| 33 | end |
| 34 | put cfg 0 3 |
| 35 | put cfg 1 compose_word rec 6 |
| 36 | put cfg 2 div compose_word rec 16 32 |
| 37 | put cfg 3 compose_word rec 14 |
| 38 | put cfg 4 compose_word rec 17 |
| 39 | put cfg 5 div sub compose_word launch 12 8 4 |
| 40 | if ne bc_compose cfg ins meta phys actual 0 |
| 41 | ret -14 |
| 42 | end |
| 43 | if ne nv_record cfg rec launch actual 0 |
| 44 | ret -14 |
| 45 | end |
| 46 | ret nv_code ins phys get actual 0 code bytes |
| 47 | end |
| 48 | fn native_validate rec view uchar 4096 sizes view ulong 4 code view uchar 16384 launch view uchar 4096 expected view uchar 32 out edit uchar 32 to long |
| 49 | key = new uchar 32 0 |
| 50 | for i ulong 32 |
| 51 | put out i 0 |
| 52 | end |
| 53 | rc = kc_validate rec sizes code launch expected key |
| 54 | if ne rc 0 |
| 55 | ret long rc |
| 56 | end |
| 57 | if eq compose_word rec 19 3 |
| 58 | if ne nv_staged rec code launch get sizes 1 0 |
| 59 | ret -14 |
| 60 | end |
| 61 | end |
| 62 | for i ulong 32 |
| 63 | put out i get key i |
| 64 | end |
| 65 | ret 0 |
| 66 | end |