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

[Question] Why do we need C wrapper emission attribute? #3025

Open
Sylvexia opened this issue Dec 7, 2024 · 2 comments
Open

[Question] Why do we need C wrapper emission attribute? #3025

Sylvexia opened this issue Dec 7, 2024 · 2 comments

Comments

@Sylvexia
Copy link

Sylvexia commented Dec 7, 2024

// Request C wrapper emission via attribute.
for (auto func : module.getOps<func::FuncOp>()) {
func->setAttr(LLVM::LLVMDialect::getEmitCWrapperAttrName(),
UnitAttr::get(&getContext()));
}

Recently I've been experimenting the pass inside this project.
The experiment involves mapping certain op into Func dialect operations, which is before ConvertKrnlToLLVM pass.
However, the reference code inject the C wrapper emission attribute for all Func declaration.
Causing the symbol name have unexpected _mlir_ciface_ prefix when lowering to LLVM dialect.

I've commented the reference code and it runs fine for my use case end to end.
Any idea on why we need the C wrapper emission attribute?
If remove it from project, what potential break this might been?

Thanks.

@AlexandreEichenberger
Copy link
Collaborator

@tungld or @chentong319 any suggestions on this one?

@tungld
Copy link
Collaborator

tungld commented Dec 10, 2024

I am not the original author of that but we can refer to this MLIR document to understand what it is: https://mlir.llvm.org/docs/TargetLLVMIR/#c-compatible-wrapper-emission

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants