openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / workloads / dequant_int4 / workload.json
| 1 | { |
| 2 | "name": "dequant_int4", |
| 3 | "family": "quantization", |
| 4 | "summary": "group-wise int4 dequantization: w is R x C/2 packed u8 (element 2k in the low nibble, 2k+1 in the high nibble, each a 4-bit two's complement value -8..7); y[r][c] = nibble * s[r][c / 32] with one f32 scale per group of 32 columns", |
| 5 | "provenance": "authored for OpenAccel Lab (Apache-2.0); the packed signed-nibble, group-32 layout of common 4-bit weight formats", |
| 6 | "params": { |
| 7 | "R": 64, |
| 8 | "C": 256 |
| 9 | }, |
| 10 | "derived": { |
| 11 | "G": "(C + 31) // 32", |
| 12 | "NB": "C // 2" |
| 13 | }, |
| 14 | "cases": [ |
| 15 | {}, |
| 16 | { |
| 17 | "R": 1, |
| 18 | "C": 2 |
| 19 | }, |
| 20 | { |
| 21 | "R": 5, |
| 22 | "C": 70 |
| 23 | } |
| 24 | ], |
| 25 | "shrink": { |
| 26 | "R": { |
| 27 | "min": 1 |
| 28 | }, |
| 29 | "C": { |
| 30 | "min": 2, |
| 31 | "multiple_of": 2 |
| 32 | } |
| 33 | }, |
| 34 | "inputs": [ |
| 35 | { |
| 36 | "name": "w", |
| 37 | "dtype": "u8", |
| 38 | "shape": [ |
| 39 | "R", |
| 40 | "NB" |
| 41 | ], |
| 42 | "gen": { |
| 43 | "kind": "int", |
| 44 | "lo": 0, |
| 45 | "hi": 255 |
| 46 | } |
| 47 | }, |
| 48 | { |
| 49 | "name": "s", |
| 50 | "dtype": "f32", |
| 51 | "shape": [ |
| 52 | "R", |
| 53 | "G" |
| 54 | ], |
| 55 | "gen": { |
| 56 | "kind": "uniform", |
| 57 | "lo": 0.001, |
| 58 | "hi": 0.05 |
| 59 | } |
| 60 | } |
| 61 | ], |
| 62 | "outputs": [ |
| 63 | { |
| 64 | "name": "y", |
| 65 | "dtype": "f32", |
| 66 | "shape": [ |
| 67 | "R", |
| 68 | "C" |
| 69 | ] |
| 70 | } |
| 71 | ], |
| 72 | "tolerance": { |
| 73 | "y": { |
| 74 | "kind": "exact", |
| 75 | "why": "the nibble is an exact integer -8..7, converts to f32 exactly, then one correctly rounded f32 multiply per element" |
| 76 | } |
| 77 | }, |
| 78 | "timing": { |
| 79 | "warmup": 2, |
| 80 | "repeats": 10 |
| 81 | }, |
| 82 | "backends": { |
| 83 | "omega": { |
| 84 | "src": "omega.om" |
| 85 | }, |
| 86 | "opencl": { |
| 87 | "src": "kernel.cl", |
| 88 | "launches": [ |
| 89 | { |
| 90 | "kernel": "dequant_int4", |
| 91 | "global": [ |
| 92 | "R", |
| 93 | "C" |
| 94 | ], |
| 95 | "local": null, |
| 96 | "args": [ |
| 97 | "w", |
| 98 | "s", |
| 99 | "y", |
| 100 | "R", |
| 101 | "C", |
| 102 | "G", |
| 103 | "NB" |
| 104 | ] |
| 105 | } |
| 106 | ] |
| 107 | }, |
| 108 | "triton": { |
| 109 | "src": "triton_kernel.py" |
| 110 | }, |
| 111 | "cuda": { |
| 112 | "src": "kernel.cu" |
| 113 | } |
| 114 | } |
| 115 | } |