openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / workloads / dequant_int8 / kernel.cu
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | #include <cuda_runtime.h> |
| 3 | |
| 4 | __global__ void dequant_int8(const signed char *q, const float *s, float *y, int R, int C) |
| 5 | { |
| 6 | long long i = (long long)blockIdx.x * blockDim.x + threadIdx.x; |
| 7 | if (i >= (long long)R * C) |
| 8 | return; |
| 9 | int r = (int)(i / C); |
| 10 | y[i] = (float)q[i] * s[r]; |
| 11 | } |
| 12 | |
| 13 | void oal_launch(const long long *p, void *const *buf) |
| 14 | { |
| 15 | long long n = p[0] * p[1]; |
| 16 | dequant_int8<<<(unsigned)((n + 255) / 256), 256>>>((const signed char *)buf[0], (const float *)buf[1], |
| 17 | (float *)buf[2], (int)p[0], (int)p[1]); |
| 18 | } |