microsoft / microxcaling

PyTorch emulation library for Microscaling (MX)-compatible data formats
MIT License
123 stars 14 forks source link

Can MX formats emulate Block Floating Point (BFP)? #15

Closed JeevanBhoot closed 5 months ago

JeevanBhoot commented 5 months ago

Could the mx formats be used to emulate BFP formats such as BFP16: BFP16 format has a common 8 bit exponent with 8 elements. Each element is 8 bits and stored in signed magnitude format (each element has 1 sign bit and a 7 bit magnitude). There is no implicit leading 1 for the magnitudes.

rizhao-msft commented 5 months ago

Yes, BFP16 is essentially MXINT8 with a block size of 8 elements. The configuration will look something like:

mx_specs[‘scale_bits’] = 8
mx_specs[‘w_elem_format’] = 'int8'
mx_specs[‘a_elem_format’] = 'int8'
mx_specs[‘block_size’] = 8