Open KFAFSP opened 1 year ago
This would also have to incorporate the change to the limits on E
for fixed-point!
What I've done:
[x] Creat a new branch heart23
and remove floating point semantics and folders for ops.
[x] Change FixedPointType from <integerBits, fractionalBits>
to <bitWidth, exponent>
and modify the FixedPointSemantics interface and FixedPointInterpreter to adjust this.
[x] Create Pass ConvertBase2ToArith, which now converts
base2.bit_cast
to arith.bitcast
base2.value_cast
to arith.trunci/extsi/extui
base2.fixed.add
to base2.value_cast
and arith.addi
[x] example of --convert-base2-to-arith
:
!type1 = !base2.fixed_point<signed 6, -3>
!type2 = !base2.fixed_point<unsigned 4, -2>
!type3 = !base2.fixed_point<signed 7, -3>
func.func @test(%arg0: !type1, %arg1: !type2) -> !type3 { %0 = base2.fixed.add %arg0, %arg1 : !type1, !type2 return %0 : !type3 }
func.func @test(%arg0: i6, %arg1: i4) -> i7 { %0 = arith.extsi %arg0 : i6 to i7 %1 = arith.extui %arg1 : i4 to i7 %2 = arith.addi %0, %1 : i7 return %2 : i7 }
What still needs to think of:
- [ ] fixed.op's return type
- [ ] #6 -> How to deal with rounding modes.
- [ ] elaborator methods
- [ ] other ops to add
We want to create a fixed-point only PoC implementation that incorporates the new design and specification elements.
E
for fixed-point (32bits?)Elaborator
for issues #2 , #5 , #6