CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[CINN]support backend compiler to link multiple modules #65916
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
[CINN]support backend compiler to link multiple modules #65916
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
if (end) { | ||
RegisterDeviceModuleSymbol(); | ||
engine_->AddSelfModule(); | ||
} |
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.
end是什么含义?
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.
这里沿袭了之前扩展x86时候的参数,语义是已经链接完所有的子Module,可以整合起来。
之后PR中会考虑商量修改一下这里的参数命名
@@ -106,7 +106,7 @@ class Compiler final { | |||
void Build(const ir::Module& module, | |||
const std::string& code = "", | |||
const bool end = true); | |||
void AppendCX86(const ir::Module& module); | |||
void AppendCX86(const ir::Module& module, const bool end = true); |
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.
最好不要使用bool值做参数,语义太弱,扩展性太差。
我看这个函数也不大,直接写成两个函数多好啊。就算调用处的就代码已经拿bool值做参数了,也不是新代码继续这么做的理由
auto PatternMatch = | ||
adt::match{[&](common::UnknownArch) { CINN_NOT_IMPLEMENTED; }, | ||
[&](common::X86Arch) { return; }, | ||
[&](common::ARMArch) { return; }, | ||
[&](common::NVGPUArch) { RegisterCudaModuleSymbol(); }, | ||
[&](common::HygonDCUArchHIP) { CINN_NOT_IMPLEMENTED; }}; | ||
return std::visit(PatternMatch, target_.arch.variant()); |
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.
改一下代码,让它好看点:
return target_.arch.Match(
[&](common::UnknownArch) { CINN_NOT_IMPLEMENTED; },
[&](common::X86Arch) { return; },
[&](common::ARMArch) { return; },
[&](common::NVGPUArch) { RegisterCudaModuleSymbol(); },
[&](common::HygonDCUArchHIP) { CINN_NOT_IMPLEMENTED; });
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.
收到,将在下一个step的PR修改这里的写法
return std::visit(PatternMatch, target_.arch.variant()); | ||
[&](common::NVGPUArch) { CompileCudaModule(module, code); }, | ||
[&](common::HygonDCUArchHIP) { CompileHipModule(module, code); }}; | ||
std::visit(PatternMatch, target_.arch.variant()); |
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.
顺手把这里的代码改成target_.arch.Match(...)的形式。
…#65916) * [CINN]support backend compiler to link multiple modules * change comment
PR Category
CINN
PR Types
New features
Description
Pcard-67164
This PR adds support for codegen of switch, which is the second step for lowering broadcast tree.
To learn more about the theoretical explanation of lowering broadcast tree in host wrapper function and the step-by-step arrangement for the Pull Request (PR), please refer to the draft PR65604 for details.