-
Notifications
You must be signed in to change notification settings - Fork 82
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
Through MLIR lowering (not LLVM): Missing CIR operations #561
Comments
Btw, thanks for trying to categorize, this is going to be very useful for distributing work into multiple issues. |
Hello, in the void populateCIRToMLIRConversionPatterns(mlir::RewritePatternSet &patterns,
mlir::TypeConverter &converter) {
patterns.add<CIRReturnLowering, CIRBrOpLowering>(patterns.getContext());
patterns.add<CIRCmpOpLowering, CIRCallOpLowering, CIRUnaryOpLowering,
CIRBinOpLowering, CIRLoadOpLowering, CIRConstantOpLowering,
CIRStoreOpLowering, CIRAllocaOpLowering, CIRFuncOpLowering,
CIRScopeOpLowering, CIRBrCondOpLowering, CIRTernaryOpLowering,
CIRYieldOpLowering>(converter, patterns.getContext());
} I find these operations can be lowered to MLIR, |
Oh, my apologies, this is talking about "Through MLIR" path, not our direct lowering, let me re-open! Sorry for the confusion |
I just updated the issue description! Thanks for pushing this |
@bcardosolopes Currently the lowering prepare pass runs only on the LLVMIR lowering path. Should we introduce a similar pass for the MLIR lowering path? Some of the operations listed here can be transformed or canonicalized before lowering. |
Hello, I have conducted research on these operations, classified them, and made a simple assessment of the difficulty of implementing these operations. I want to solve this issue. The current idea is to solve it one by one from easy to difficult, starting with math-related operations. |
Sounds good |
Sure, we should just add LoweringPrepare for that pipeline. There shouldn't be anything LLVM specific there, though somethings naturally go that direction (e.g. lowering globals). If we find that we need to different decisions, we can think about how to refactor that once we get into those. |
@orbiri this table could be interesting for you too! |
I checked this again. The current LoweringPrepare pass is included in the C++-to-MLIR pipeline (i.e. the pipeline built by clang frontend). But it is not included in the pipelines built by |
LoweringPrepare needs the AST, and we don't have that (yet) by standalone invocations of
We should probably add it to clang driven "through MLIR" codegen, yes. |
Hello , I find that some libc functions lowering to mlir can use |
Sorry, I'm not sure I understand the concern, can you elaborate? |
What I mean is how to translate libc function calls into MLIR , and whether operations related to some vtable can be translated into MLIR? @bcardosolopes |
I understand your question, but I don't understand the specifics:
If you don't want to use
Why? What did you tried that didn't work? Also, on a tangent, what is it your goal on working on MLIR support? Are you just trying to cover all CIR lowering possible for MLIR? |
There are two lowering paths from CIR:
Most effort has been into (1), which the list below doesn't really apply. Here's a the list of missing features in (2):
cir.alloc_exception
cir.await
cir.base_class_addr
cir.break
cir.asm
cir.catch
cir.catch_param
cir.ceil
cir.condition
cir.continue
cir.cos
cir.do
cir.exp2
cir.exp
cir.fabs
cir.floor
cir.for
cir.get_bitfield
cir.get_global
cir.get_member
cir.global
cir.if
cir.iterator_begin
cir.iterator_end
cir.log10
cir.libc.memchr
cir.libc.memcpy
cir.nearbyint
cir.objsize
cir.ptr_diff
cir.ptr_stride
cir.resume
cir.rint
cir.round
cir.set_bitfield
cir.shift
cir.sin
cir.sqrt
cir.stack_restore
cir.stack_save
cir.std.find
cir.throw
cir.trunc
cir.try_call
cir.try
cir.va.arg
cir.va.copy
cir.va.end
cir.vtable.address_point
cir.vec.cmp
cir.vec.create
cir.vec.extract
cir.vec.insert
cir.while
cir.llvmir.zeroinit
The text was updated successfully, but these errors were encountered: