-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FC] Add dequantize action to FC layer #2936
base: main
Are you sure you want to change the base?
Conversation
EunjuYang
commented
Feb 11, 2025
•
edited
Loading
edited
- This commit is temporary one to realize a fc layer with QINT weight.
- This should be fixed in the way to move the dequantize operations under the tensor op.
- dequantization overhead :
Without SWAP | With SWAP (LA=2) | ||
---|---|---|---|
FP32-FP32 | QINT8-FP32 | FP32-FP32 | QINT8-FP32 |
0.162787 | 0.166505 | 0.0487955 | 0.127012 |
|
||
///@todo this quantizaer should be moved to tensor, not layer! | ||
switch (context.getWeightDataType()) { | ||
case ml::train::TensorDim::DataType::QINT4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about adding 'not supported yet' message till implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It intends to make a quantizerfor all QINT4, QINT8, QINT16 cases. AFIK, QINT4, 8, 16 all work with a quantizer. Please let me know if I missed something!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
FYI) I tested the case where QINT8-FP32 is used (weight dtype-tensor dtype).
bin file size is 400 MB vs. 100 MB. |
- This commit is temporary one to realize a fc layer with QINT weight. - This should be fixed in the way to move the dequantize operations under the tensor op. Signed-off-by: Eunju Yang <[email protected]>
e2c2423
to
133ea02
Compare
///@todo This dequantization action should be moved to tensor.dot() | ||
if (quantizer != nullptr) { | ||
Tensor weight_ = quantizer->dequantize(weight, input_.getDataType()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, I wonder how should it be expected to work at Tensor::dot()
.
Maybe something like:
Tensor::dot() {
...
int8_t data = getData();
int8_t input_data = input;
Tensor qinput = quantizer->dequantize(...);
GEMM(data, qinput.getData(), output);
...
}
?