Commit 48b27a7f authored by Shucai Xiao's avatar Shucai Xiao
Browse files

add an env variable to print out the quantization parameter

parent 69da37bb
...@@ -8,12 +8,15 @@ ...@@ -8,12 +8,15 @@
#include <migraphx/config.hpp> #include <migraphx/config.hpp>
#include <migraphx/target.hpp> #include <migraphx/target.hpp>
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/env.hpp>
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
struct program; struct program;
MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_INT8_QUANTIZATION_PARAMS)
void quantize_fp16(program& prog, const std::vector<std::string>& ins_names); void quantize_fp16(program& prog, const std::vector<std::string>& ins_names);
void quantize_fp16(program& prog); void quantize_fp16(program& prog);
......
...@@ -309,6 +309,15 @@ void quantize_int8(program& prog, ...@@ -309,6 +309,15 @@ void quantize_int8(program& prog,
const std::vector<std::pair<float, float>>& quant_params, const std::vector<std::pair<float, float>>& quant_params,
const std::vector<std::string>& ins_names) const std::vector<std::string>& ins_names)
{ {
if(enabled(MIGRAPHX_INT8_QUANTIZATION_PARAMS{})) {
for (std::size_t i = 0; i < quant_params.size(); ++i)
{
auto param = quant_params.at(i);
std::cout << "ins_index = " << i << ", scale = " << param.first << ", shift = " << param.second << std::endl;
}
std::cout << std::endl;
}
// For now, we only support the int8 quantization of gemm and convolution // For now, we only support the int8 quantization of gemm and convolution
std::vector<std::string> op_names = {"dot", "convolution"}; std::vector<std::string> op_names = {"dot", "convolution"};
if(!std::all_of(ins_names.begin(), ins_names.end(), [&](auto name) { if(!std::all_of(ins_names.begin(), ins_names.end(), [&](auto name) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment