-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to map FP round currently to lassen. #29
Comments
To be very clear here, the round function that we need takes in a float and produces a float. It does not cast it into an int. |
Round can be implemented (f is a bloat number) I have added int2float, so this is now doable. |
@rdaly525 so...looking at the comments...this is resolved? |
The explicit task is the following:
|
@nikhilbhagdikar, if you need an example of how to use FPVector, you can refer to tests/test_pe.py |
I can try to take on round |
We can partially implement round by cascading FCnvInt2F and FGetFint (int2float and float2int). However it only works for a sub range of floats* also it implements round to 0 (floor on positive, ceil on negative). So *empirically it works (-BOUND, BOUND) for BOUND=215-26-1 I think we could implement a full range round to 0 with the following:
However this will take 5 PEs (extract exponent, compare, mux, i2f, f2i) instead of 2. To get a proper floor we could use the following algorithm:
which takes 3 additional PEs over round (&, abs, |) round to nearest could also be implementable as 1 PE over floor
Long story short: |
@nikhilbhagdikar If you have any ideas on how to do any of this with fewer PEs let me know |
@cdonovick, thanks for doing this analysis. @jeffsetter, could you comment on the range issue for halide applications? Specifically, what sets of applications could we get away with using the Bounded round? |
*empirically it works (-BOUND, BOUND) for BOUND= Since the range of bfloat is approximately |
Sorry, I missed that the range does not have to be bounded, but instead takes 5 PEs. I believe we are most likely to use that mapping in most cases. It is unclear to me if the above strategy is the only one possible for rounding. The algorithm I use in Halide is below, which may be useful in finding a more efficient mapping. |
@jeffsetter just to be clear we talking about implementing a round operations bfloat->bfloat (round(1.2) == 1.0, round(12.0) == 12.0) where only fractional parts (mantissa bits that have value < 1) are rounded. It looks like you are rounding ieee 754 singles to bfloat which is a very different task. |
Github is stupid, partially resolves != resolves |
Being able to do a FP round will give us round, ceil, and floor which are required from the Halide applications.
The text was updated successfully, but these errors were encountered: