Skip to content
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

Open
smeenai opened this issue Nov 22, 2024 · 3 comments
Open

Target features need to be propagated to LLVM #1154

smeenai opened this issue Nov 22, 2024 · 3 comments
Assignees
Labels
IR difference A difference in ClangIR-generated LLVM IR that could complicate reusing original CodeGen tests

Comments

@smeenai
Copy link
Collaborator

smeenai commented Nov 22, 2024

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.

@smeenai smeenai added the IR difference A difference in ClangIR-generated LLVM IR that could complicate reusing original CodeGen tests label Nov 22, 2024
@bcardosolopes
Copy link
Member

@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?

@seven-mile
Copy link
Collaborator

@bcardosolopes Clang TargetInfo and Flang treat them parallel with target triple, which I believe is the right abstraction. It sounds reasonable to also have cir.target_features cir.tune_cpu, cir.target_cpu ... as optional StringAttr.

let options = [
Option<"forcedTargetTriple", "target", "std::string", /*default=*/"",
"Override module's target triple.">,
Option<"forcedTargetCPU", "target-cpu", "std::string", /*default=*/"",
"Override module's target CPU.">,
Option<"forcedTuneCPU", "tune-cpu", "std::string", /*default=*/"",
"Override module's tune CPU.">,
Option<"forcedTargetFeatures", "target-features", "std::string",
/*default=*/"", "Override module's target features.">,

@smeenai
Copy link
Collaborator Author

smeenai commented Nov 26, 2024

Note that CodeGen adds these as per-function attributes (presumably for LTO purposes), so we'll want to follow-suit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IR difference A difference in ClangIR-generated LLVM IR that could complicate reusing original CodeGen tests
Projects
None yet
Development

No branches or pull requests

4 participants