File size: 1,362 Bytes
1dc29e9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#pragma once
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#include <cstddef>
#include <cstdint>
#include <vector>
namespace fastertransformer {
enum class QuantType { INT8_WEIGHT_ONLY, PACKED_INT4_WEIGHT_ONLY };
int get_bits_in_quant_type(QuantType quant_type);
void preprocess_weights(int8_t *preprocessed_quantized_weight,
const int8_t *row_major_quantized_weight, size_t rows,
size_t cols, bool is_int4, int arch);
template<typename ComputeType, typename WeightType>
void symmetric_quantize(int8_t* processed_quantized_weight,
ComputeType* scale_ptr,
const WeightType* input_weight_ptr,
const std::vector<size_t>& shape,
QuantType quant_type);
template<typename ComputeType, typename WeightType>
void symmetric_quantize(int8_t* processed_quantized_weight,
int8_t* unprocessed_quantized_weight,
ComputeType* scale_ptr,
const WeightType* input_weight_ptr,
const std::vector<size_t>& shape,
QuantType quant_type);
} // namespace fastertransformer
|