-
Notifications
You must be signed in to change notification settings - Fork 296
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 Binary Floating Point AddF Operator #7089
Conversation
This is interesting. I think we keep having to add ops because we don't have a good mechanism to talk about extern ops in the dialect. @cgyurgyik do you have thoughts on how best to encode external ops in the dialect? |
By "extern", are you talking about an op that is defined outside of the Calyx standard primitive libary? Don't we provide support for this à la HW dialect? |
@cgyurgyik exactly! We should build support for something like this in the Calyx dialect. A tricky thing is that we want to specify paths to Verilog files which implement the specific extern we're talking about. The upside would be that we don't have to keep adding new primitives to CIRCT ops definition (especially because we're not defining any optimizations over them). |
Got it. Would this back us into a corner from ever defining optimizations over them? I could imagine a world where Calyx would allow the following,
Could be rewritten to:
These "peephole" optimizations would be easier to implement with different Edit: I guess this also encompasses user-defined primitives, that may not be readily optimized by a Calyx compiler. |
@cgyurgyik finally catching up to your comment. This is a good question about which ops we want to perform peephole optimizations on. In general, I think we should define them only on "simple" operations like addition. Something like a floating-point operation should probably be implemented as an external because the most optimized version is going to be some black-box RTL anyways. (FWIW, this argument should also extend to really large adders! For example, it is not obvious to me that a 128-bit adder is best implemented automatically. For now, however, we'll leave this dragon sleeping.) @jiahanxie353 How critical is this PR in the stack that you're trying to get approved? For example, if it is not yet super critical, I would lean towards redesigning this to use |
d4c8351
to
deb4fab
Compare
I believe I'm using externs, because it emits Am I missing anything? Are you saying we should completely get rid of |
Yeah, @andrewb1999 has been working on a idea for defining operator libraries that might eventually allow us to decouple the specification of new primitives from new ops in the compiler. For now, this seems fine. One nit about the new operator definitions (that you can address in a follow-on PR if it's a bigger change). Instead of |
sounds very neat, looking forward to it
Agree. I'll address when there's a need in the future. For now, I'll click the button if it looks good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small nits, otherwise LGTM
deb4fab
to
808af9a
Compare
This patch stacks on #7086 .
Add support for floating point addition in Calyx