-
Notifications
You must be signed in to change notification settings - Fork 388
[Conversion] Add comprehensive CombToLLVM conversion pass with func.func-only scope #9105
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
d95a6e4 to
47c256e
Compare
maerhart
left a comment
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.
This is already getting close to a pass that does a full conversion to LLVM including HW aggregates etc. Been thinking of implementing one based on dialect interfaces for quite a while now.
Given that it also converts SCF and index operations and in the future probably also HW aggregates, we might want to call it something like ConvertToLLVM instead of ConvertCombToLLVM and put it in a separate file.
Otherwise LGTM
1754f18 to
72a756d
Compare
Thanks @maerhart for the detailed review. I agree, this is not just CombToLLVM. So, created the new pass ConvertToLLVM instead. You can add future extensions and patterns as necessary there. |
4534435 to
bf04b41
Compare
This PR adds a complete implementation of the
ConvertCombToLLVMpass that converts Comb and related dialect operations to LLVM IR. The pass is designed to only convert operations insidefunc.funcoperations, leaving all other operations (such ashw.module) unconverted.Previously, the CombToLLVM conversion infrastructure only provided pattern population functions (
populateCombToLLVMConversionPatterns) but no complete pass implementation.This PR adds:
func.funcoperations, allowing mixed representations where:Example Input:
Output after
--convert-comb-to-llvm:Implementation detail:
The pass applies conversion patterns in a specific order to ensure correct lowering:
This change complements the existing conversion infrastructure:
CombToArith: Converts most Comb operations to Arith dialect (used by this pass)HWToLLVM: Provides type conversions for HW types (used by this pass)ArithToLLVM: Converts Arith operations to LLVM dialect (used by this pass)FuncToLLVM: Converts Func operations to LLVM dialect (used by this pass)SCFToControlFlow: Converts SCF to ControlFlow dialect (used by this pass)The CombToLLVM pass orchestrates all these conversions into a single, complete lowering pipeline, but only applies them to
func.funcoperations.Note: This PR has been developed with help from Calude Sonnet 4.5