Copyright (c) 2025-2025 Huawei Technologies Co., Ltd.
sysHAX-adapter is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
PURPOSE.
See the Mulan PSL v2 for more details.
Created: 2026-2-13
Desc: CPU inference quantization Q8Align
*/
#ifndef QUANTIZATION_Q8ALIGN_H
#define QUANTIZATION_Q8ALIGN_H
#include "quantization_base.h"
namespace cpu_inference {
#define QK8_ALIGN 32
typedef struct {
int8_t qs[QK8_ALIGN];
} block_q8align;
class Q8Align {
public:
static void q8align_quantize(
const float16_t* const base_src_data, int8_t* base_dst_data_val, float* base_dst_data_d,
size_t block_id, size_t block_cnt, size_t block_in_row, bool is_input);
static const int elem_cnt_in_block = QK8_ALIGN;
static const int block_byte_size = sizeof(block_q8align);
};
};
#endif