-
Notifications
You must be signed in to change notification settings - Fork 302
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
[Calyx] Floating Point Comparisons #7821
Comments
Can I tag @ekiwi as well given your expertise? Thanks! |
Either have a dedicated unordered/ordered comparison (based on some standard, eg ieee754) operations if the hardware supports it, or decompose it into a series of smaller operations |
I found this in the Berkeley HardFloat: module
compareRecFN#(parameter expWidth, parameter sigWidth) (
input [(expWidth + sigWidth):0] a,
input [(expWidth + sigWidth):0] b,
input signaling,
output lt,
output eq,
output gt,
output unordered,
output [4:0] exceptionFlags How does the following plan sound.
|
This seems reasonable to me. Any reason why you prefer three different primitives rather than a single primitive with 3 parameters Side note: It is surprising that there isn't just two parameters, |
I don't have any compelling argument right now, just thought:
So I thought I should bring it up and discuss with you all regarding which decision may be better to take before making an actual PR.
yeah.. |
My understanding is we could just set these to 1'd0? I'm not saying it is the right choice, but a reason to use the same primitive for all of these is resource sharing in the compiler. At least currently, it cannot infer that |
I agree, I'm drafting a PR at the moment that only has a single |
I'm going to support the lowering of
arith.maximumf
to Calyx dialect, for the sake of ReLU operations in neural networks. It's going to be a bit tricky since it involves ordered and unordered comparisons, where there might be NaNs in the latter case.What do you think about it? If we have the bit vector representation, it's easy to determine NaN by looking at the relevant bits; but how should Calyx determine if it's NaN given that we are passing regular decimal numbers as inputs (like 4.20)? Let's assume it's IEEE754 standard for now.
And I took some inspirations from the existing pass,
-arith-expand
path, which legalizes operations such asmaximumf
to the operations that LLVM can support, from:we get:
If we have to use similar comparison operators, how does Calyx library ops support unordered comparisons?
Thoughts? @rachitnigam @andrewb1999 @cgyurgyik
The text was updated successfully, but these errors were encountered: