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 / speculation / cost-test.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | fn sample r ulong n ulong to void |
| 3 | for i ulong 16 |
| 4 | put cobs i 0 |
| 5 | end |
| 6 | put cobs 0 r |
| 7 | put cobs 1 n |
| 8 | put cobs 2 1 |
| 9 | put cobs 5 add 100 n |
| 10 | put cobs 8 1 |
| 11 | put cobs 10 add 106 n |
| 12 | put cobs 11 add 100 mul r 10 |
| 13 | put cobs 12 add slen r 1 |
| 14 | put cobs 13 7 |
| 15 | put cobs 14 1 |
| 16 | put cobs 15 63 |
| 17 | end |
| 18 | fn collect to void |
| 19 | fixture |
| 20 | check eq cstart 0 |
| 21 | check eq cseal 75 |
| 22 | for r ulong 7 |
| 23 | for i ulong 5 |
| 24 | sample r i |
| 25 | check eq cadd 0 |
| 26 | end |
| 27 | end |
| 28 | check eq cseal 0 |
| 29 | check eq scost 0 108 |
| 30 | check eq get srows 4 102 |
| 31 | check eq get srows 6 5 |
| 32 | check eq get crange 0 106 |
| 33 | check eq get crange 1 110 |
| 34 | check eq get craw 74 110 |
| 35 | check eq get srows 10 5 |
| 36 | check eq get srows 75 160 |
| 37 | check eq svalid 0 |
| 38 | check eq sbegin 0 0 |
| 39 | put scontrol 0 0 |
| 40 | put scontrol 1 0 |
| 41 | check eq sselect 1000 256 1000 7 2 0 0 |
| 42 | check eq get decision 3 108 |
| 43 | scancel |
| 44 | end |
| 45 | fn reject to void |
| 46 | fixture |
| 47 | check eq cstart 0 |
| 48 | sample 0 0 |
| 49 | put cobs 15 31 |
| 50 | check eq cadd 65 |
| 51 | sample 0 0 |
| 52 | put cobs 5 0 |
| 53 | check eq cadd 65 |
| 54 | sample 0 0 |
| 55 | put cobs 2 0 |
| 56 | check eq cadd 75 |
| 57 | sample 0 0 |
| 58 | put cobs 3 1 |
| 59 | check eq cadd 75 |
| 60 | sample 0 0 |
| 61 | put cobs 10 100 |
| 62 | check eq cadd 65 |
| 63 | sample 0 0 |
| 64 | put cobs 10 18446744073709551615 |
| 65 | check eq cadd 65 |
| 66 | sample 0 0 |
| 67 | put cobs 5 18446744073709551615 |
| 68 | check eq cadd 65 |
| 69 | sample 0 0 |
| 70 | put cobs 4 1 |
| 71 | check eq cadd 65 |
| 72 | sample 0 0 |
| 73 | put cobs 13 8 |
| 74 | check eq cadd 69 |
| 75 | sample 0 0 |
| 76 | put cobs 14 2 |
| 77 | check eq cadd 69 |
| 78 | sample 0 0 |
| 79 | put cobs 12 2 |
| 80 | check eq cadd 65 |
| 81 | sample 7 0 |
| 82 | check eq cadd 65 |
| 83 | sample 0 0 |
| 84 | put cobs 11 0 |
| 85 | check eq cadd 65 |
| 86 | sample 0 1 |
| 87 | check eq cadd 65 |
| 88 | check eq get ccount 0 0 |
| 89 | sample 0 0 |
| 90 | check eq cadd 0 |
| 91 | check eq cadd 65 |
| 92 | check eq get ccount 0 1 |
| 93 | put sid 0 999 |
| 94 | check eq cseal 69 |
| 95 | sample 0 1 |
| 96 | check eq cadd 69 |
| 97 | end |
| 98 | fn capacity to void |
| 99 | fixture |
| 100 | note Unsupported shapes must be declared before collection, not dropped after observing costs. |
| 101 | for r ulong 7 |
| 102 | if gt r 0 |
| 103 | put srows mul r 11 0 |
| 104 | end |
| 105 | end |
| 106 | check eq cstart 0 |
| 107 | for i ulong 32 |
| 108 | sample 0 i |
| 109 | check eq cadd 0 |
| 110 | end |
| 111 | sample 0 32 |
| 112 | check eq cadd 77 |
| 113 | check eq get ccount 0 32 |
| 114 | check eq get craw 506 137 |
| 115 | check eq cseal 0 |
| 116 | check eq get srows 11 0 |
| 117 | put srows 11 1 |
| 118 | check eq cseal 69 |
| 119 | end |
| 120 | fn main to int |
| 121 | collect |
| 122 | reject |
| 123 | capacity |
| 124 | fixture |
| 125 | check eq cstart 0 |
| 126 | sample 0 0 |
| 127 | put sprofile 2 1 |
| 128 | check eq cadd 69 |
| 129 | check eq cseal 69 |
| 130 | fixture |
| 131 | check eq cstart 0 |
| 132 | put sprofile 3 64000 |
| 133 | check eq cadd 69 |
| 134 | check eq cseal 69 |
| 135 | fixture |
| 136 | check eq cstart 0 |
| 137 | put srows 11 0 |
| 138 | check eq cadd 69 |
| 139 | check eq cseal 69 |
| 140 | ret finish |
| 141 | end |