| 308 | return kernel_code |
| 309 | |
| 310 | def gen_preprocess_code(): |
| 311 | kernel_code = "\n\ |
| 312 | template<int K>\n\ |
| 313 | void preprocessor_k(void* B, void* LUT_Scales, void* QLUT) {{\n\ |
| 314 | partial_max_reset((&(((bitnet_float_type*)LUT_Scales)[0])));\n\ |
| 315 | per_tensor_quant(K, (&(((bitnet_float_type*)LUT_Scales)[0])), (&(((bitnet_float_type*)B)[0])));\n\ |
| 316 | \n\ |
| 317 | lut_ctor<K>((&(((int8_t*)QLUT)[0])), (&(((bitnet_float_type*)B)[0])), (&(((bitnet_float_type*)LUT_Scales)[0])));\n\ |
| 318 | }}\n" |
| 319 | return kernel_code |
| 320 | |
| 321 | def gen_transform_code(kernel_shape): |
| 322 | kernel_code = "\n\ |