[IR] Added special-purpose dequantize
instruction (#759)
It is currently necessary for optimal performance in quantized workloads to add a special-purpose instruction in the IR. Backward compatibility with this instruction is *NOT* guaranteed.
This commit is contained in:
@@ -120,6 +120,14 @@ value *builder::create_ret(value* val) {
|
||||
return insert(return_inst::create(ctx_, val));
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// dequantize instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
value* builder::create_dequantize(value *src, value *scale, value *shift, type *dst_ty){
|
||||
return insert(dequantize_inst::create(src, scale, shift, dst_ty));
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// cast instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@@ -323,6 +323,21 @@ unary_inst::unary_inst(type *ty, value_id_t id, value *v, const std::string &nam
|
||||
set_operand(0, v);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// dequantize_inst classes
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
dequantize_inst::dequantize_inst(type *ty, value *v, value *scale, value *shift, const std::string &name, instruction *next)
|
||||
: instruction(ty, INST_DEQUANTIZE, 3, name, next) {
|
||||
set_operand(0, v);
|
||||
set_operand(1, scale);
|
||||
set_operand(2, shift);
|
||||
}
|
||||
|
||||
dequantize_inst *dequantize_inst::create(value *arg, value *scale, value *shift, type *ty, const std::string &name, instruction *next){
|
||||
return new dequantize_inst(ty, arg, scale, shift, name, next);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// cast_inst classes
|
||||
//===----------------------------------------------------------------------===//
|
||||
@@ -584,7 +599,7 @@ masked_store_inst::masked_store_inst(value *ptr, value *val, value *mask, EVICTI
|
||||
set_operand(2, mask);
|
||||
}
|
||||
|
||||
masked_store_inst* masked_store_inst::create(value *ptr, value *val, value *mask, EVICTION_POLICY eviction,
|
||||
masked_store_inst* masked_store_inst::create(value *ptr, value *val, value *mask, EVICTION_POLICY eviction,
|
||||
const std::string &name, instruction *next) {
|
||||
return new masked_store_inst(ptr, val, mask, eviction, name, next);
|
||||
}
|
||||
|
Reference in New Issue
Block a user