cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
322 stars 92 forks source link

Integer Division Truncation is different to Halide #127

Closed tonyjie closed 1 year ago

tonyjie commented 5 years ago

I just found that HeteroCL's Integer division truncation is toward zero (-3 / 4 = 0), while the Halide behavior is truncation toward the lower integer (-3 / 4 = -1). This causes lots of problem when comparing the results between Halide programs and HeteroCL programs, because if there's negative integer division occured in the process, the results can't be the same... So I'm wondering if there's a way to change this behavior to "Truncation toward Lower Integer"? Thanks!

seanlatias commented 5 years ago

I think I'll need to add a mode to allow that because in C++ -3/4 is 0. I'll mark this issue as an enhancement.

seanlatias commented 5 years ago

Actually, this is a good point because for Python -3/4 = -1.

tonyjie commented 5 years ago

Yes. So I think for now I can't change this behavior, right? Looking forward to the upgrade.

chhzh123 commented 1 year ago

As we have released a new version of HeteroCL that entirely moves the compilation stack to MLIR, issues related to the original HalideIR flow will be closed. Please check out the latest HeteroCL and see if the issue still exists.