-
Notifications
You must be signed in to change notification settings - Fork 103
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
Target features need to be propagated to LLVM #1154
Comments
@seven-mile from your target triple explorations, do you have a hint on what are we missing or whether we can map this as part of MLIR datalayout? |
@bcardosolopes Clang TargetInfo and Flang treat them parallel with target triple, which I believe is the right abstraction. It sounds reasonable to also have clangir/flang/include/flang/Optimizer/CodeGen/CGPasses.td Lines 72 to 80 in 41078e9
|
Note that CodeGen adds these as per-function attributes (presumably for LTO purposes), so we'll want to follow-suit. |
Thanks, @seven-mile for good direction. Here what I'm thinking after looking at Flang's way a bit. Therefore, I'm thinking to do some experiment on CIR side, basically during loweringPrepare, add needed target feature info as ModuleOp string attributes ( we should have those info during loweringPrepare, thus no need to pass them as Pass Option as Flang does). Then during LLVM Lowering pick them up, pass them into LLVM::ModuleOp, and this might just work. |
@ghehg Your plan sounds nice ; ) Given a ClangIR module corresponds to a TU, it should not lose any expressiveness for a module-level attribute. As for the information we need, they basically reside in Earlier timepoint also seem okay to me, e.g. the same time when we set triple for the module. |
Sounds good. setting triple may have better readability other than avoiding command options, one can just read from CIR file to know what target features are being used for the TU. |
See https://godbolt.org/z/3n85TK4ab for an example. CodeGen adds
-target-features
to LLVM function attributes to propagate-march
. CIRGen needs to match this so that we can e.g. use feature-specific intrinsics end-to-end.The text was updated successfully, but these errors were encountered: