Skip to content

Commit

Permalink
Per Row Int po2 kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe5 committed Nov 26, 2024
1 parent 273338d commit 5fa4e57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/brevitas_examples/common/generative/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
from brevitas_examples.common.generative.quantizers import FP8e4m3OCPDynamicActPerRowFloat
from brevitas_examples.common.generative.quantizers import Fp8e4m3WeightSymmetricGroupQuant
from brevitas_examples.common.generative.quantizers import Int8DynamicActPerGroupFloat
from brevitas_examples.common.generative.quantizers import Int8DynamicActPerRowFixedPoint
from brevitas_examples.common.generative.quantizers import Int8DynamicActPerRowFloat
from brevitas_examples.common.generative.quantizers import Int8DynamicActPerTensorFloat
from brevitas_examples.common.generative.quantizers import IntWeightSymmetricGroupQuant
Expand Down Expand Up @@ -171,6 +172,8 @@
'sym': Int8DynamicActPerGroupFloat}}},
'po2_scale': {
'stats': {
'per_row': {
'sym': Int8DynamicActPerRowFixedPoint,},
'per_group': {
'sym': MXInt8Act}}}}},
'float': {
Expand Down
5 changes: 5 additions & 0 deletions src/brevitas_examples/common/generative/quantizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ class Int8DynamicActPerRowFloat(DynamicActProxyMixin, Int8ActPerTensorFloat):
scaling_per_output_channel = True


class Int8DynamicActPerRowFixedPoint(Int8DynamicActPerRowFloat):
restrict_scaling_type = RestrictValueType.POWER_OF_TWO
restrict_value_float_to_int_impl = FloorSte


class Int8DynamicActPerGroupFloat(DynamicActProxyMixin, Int8ActPerTensorFloat):
"""
Symmetric quantizer with per group scale.
Expand Down

0 comments on commit 5fa4e57

Please sign in to comment.