cornell-zhang / hcl-dialect

HeteroCL-MLIR dialect for accelerator design
https://cornell-zhang.github.io/heterocl/index.html
Other
37 stars 15 forks source link

[Backend] Support different quantization and overflow mode for fixed point #166

Open chhzh123 opened 1 year ago

chhzh123 commented 1 year ago

Currently we are using "wrap overflow mode + round zero quantization mode" for fixed point simulation (See the code snippet below). https://github.com/cornell-zhang/heterocl/blob/95f3509a3df50c4e621f82a96ef10c0af388de48/python/heterocl/tensor.py#L321-L329

But we may need different quantization and overflow mode for different scenario, so we need to expose this API for users to select, and also generate correct code for both LLVM and HLS backend.

Based on the HLS manual, we have the following modes.

Screen Shot 2022-10-31 at 10 57 42 AM