-
Notifications
You must be signed in to change notification settings - Fork 366
Datapath Dialect Definition #8638
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
Conversation
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.
Looks awesome! I think the dialect definition is great. Could you add a rational doc under docs/Dialects/
to describe the purpose of the Dialect (which you explained in a PR description). Also could you update https://github.com/llvm/circt/blob/main/test/circt-opt/commandline.mlir?
Added a rationale document and corrected @uenoku comments above |
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.
Awesome thanks! Do you have a commit access?
Not yet - am awaiting this request to be approved! So if you someone can merge that would be great. @uenoku - have been testing out the longest path analysis on small datapath benchmarks - so hope to share results soon! |
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.
Very cool! Can't wait for CIRCT to get more serious about data path synthesis 🥳. Thanks for adding docs as well 🏅!
Merged the PR 👍 Thank you for trying LongestPath analysis! #8644 should provide more nicer report FYI. |
The datapath dialect will be used as part of the growing synthesis capabilities, where arithmetic operators such as comb.mul and multi-input comb.add can be lowered to gates via the datapath dialect. The datapath dialect allows us to directly express efficient circuits such as compressor trees, in the IR itself, allowing us to manipulate and combine arithmetic operations. The key idea is to view datapath operators as generators of circuits that satisfy some contract, for example in the case of the datapath.compress summing it's results is equivalent to summing it's inputs. This allows us to defer implementing these critical circuits until later in the synthesis flow. In a simple example, we can fold a*b+c using the datapath dialect to remove a carry-propagate adder: ```mlir %0 = comb.mul %a, %b : i4 %1 = comb.add %0, %c : i4 ``` Which is equivalent to: ```mlir %0:4 = datapath.pp %a, %b : 4 x i4 %1:2 = datapath.compress %0#0, %0#1, %0#2, %0#3, %c : 5 x i4 -> (i4, i4) %2 = comb.add %1#0, %1#1 : i4 ``` This is the first in a series of commits to add datapath synthesis capabilities that will include the following (implemented but not merged):
The datapath dialect will be used as part of the growing synthesis capabilities, where arithmetic operators such as comb.mul and multi-input comb.add can be lowered to gates via the datapath dialect. The datapath dialect allows us to directly express efficient circuits such as compressor trees, in the IR itself, allowing us to manipulate and combine arithmetic operations. The key idea is to view datapath operators as generators of circuits that satisfy some contract, for example in the case of the datapath.compress summing it's results is equivalent to summing it's inputs. This allows us to defer implementing these critical circuits until later in the synthesis flow. In a simple example, we can fold a*b+c using the datapath dialect to remove a carry-propagate adder: ```mlir %0 = comb.mul %a, %b : i4 %1 = comb.add %0, %c : i4 ``` Which is equivalent to: ```mlir %0:4 = datapath.pp %a, %b : 4 x i4 %1:2 = datapath.compress %0#0, %0#1, %0#2, %0#3, %c : 5 x i4 -> (i4, i4) %2 = comb.add %1#0, %1#1 : i4 ``` This is the first in a series of commits to add datapath synthesis capabilities that will include the following (implemented but not merged):
Creating the boilerplate dialect definition to split up a closed PR - a follow-up PR will add the operations described below and much more.
The datapath dialect will be used as part of the growing synthesis capabilities, where arithmetic operators such as comb.mul and multi-input comb.add can be lowered to gates via the datapath dialect. The datapath dialect allows us to directly express efficient circuits such as compressor trees, in the IR itself, allowing us to manipulate and combine arithmetic operations.
The key idea is to view datapath operators as generators of circuits that satisfy some contract, for example in the case of the datapath.compress summing it's results is equivalent to summing it's inputs. This allows us to defer implementing these critical circuits until later in the synthesis flow.
In a simple example, we can fold a*b+c using the datapath dialect to remove a carry-propagate adder:
Which is equivalent to:
This is the first in a series of PRs to add datapath synthesis capabilities that will include the following (implemented but not merged):
Comb to Datapath pass
Datapath to Comb pass - for lowering datapath ops to comb gates
Datapath to SMT - for contract verification
Incorporating datapath passes into circt-synth
Replicate adds pass - to enable unsharing for better delay performance