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 / models / quant-consumer.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Actual existing mxmm receives canonical packed output without weight expansion. |
| 3 | fn qt_packcompact a edit uchar 4096 sa edit uchar 256 to uint |
| 4 | d = new ulong 48 0 |
| 5 | src = new uchar 65536 0 |
| 6 | sc = new uchar 1024 0 |
| 7 | out = new uchar 65536 0 |
| 8 | os = new uchar 1024 0 |
| 9 | qt_base d 4 3 |
| 10 | put src 0 33 |
| 11 | put src 1 3 |
| 12 | put sc 0 127 |
| 13 | if ne quant_repack d src sc out os 0 |
| 14 | ret 1 |
| 15 | end |
| 16 | for i ulong 16 |
| 17 | put a i get out i |
| 18 | end |
| 19 | put sa 0 get os 0 |
| 20 | ret 0 |
| 21 | end |
| 22 | fn qt_consumer to uint |
| 23 | a = new uchar 4096 0 |
| 24 | b = new uchar 4096 0 |
| 25 | sa = new uchar 256 0 |
| 26 | sb = new uchar 256 0 |
| 27 | c = new f64 256 0.0f64 |
| 28 | shape = new ulong 4 0 |
| 29 | put shape 0 1 |
| 30 | put shape 1 1 |
| 31 | put shape 2 1 |
| 32 | put shape 3 32 |
| 33 | put a 0 33 |
| 34 | put a 1 3 |
| 35 | put b 0 33 |
| 36 | put b 1 3 |
| 37 | put sa 0 127 |
| 38 | put sb 0 127 |
| 39 | mxmm a sa b sb c shape |
| 40 | expected = get c 0 |
| 41 | if ne qt_packcompact b sb 0 |
| 42 | ret 1 |
| 43 | end |
| 44 | mxmm a sa b sb c shape |
| 45 | if ne get c 0 expected |
| 46 | ret 2 |
| 47 | end |
| 48 | ret 0 |
| 49 | end |