未验证 提交 94afa31a 编写于 作者: 傅剑寒 提交者: GitHub

delete duplicated optimize in AddFunction (#56192)

上级 d6ebbd49
......@@ -60,14 +60,15 @@ struct CollectHostFunctionVisitor : public ir::IRMutator<> {
private:
void Visit(const ir::_LoweredFunc_* op, Expr* expr) override {
if (op->body.As<ir::Call>()) {
host_module_builder.AddFunction(expr->as_lowered_func_ref());
host_module_builder.AddFunctionWithoutOptim(expr->as_lowered_func_ref());
} else {
if (!op->cuda_axis_info.valid()) {
expr->as_lowered_func_ref()->cuda_axis_info.set_valid(true);
}
auto host_func = CreateHostFunctionGivenDeviceKernel(op);
host_module_builder.AddFunction(host_func.as_lowered_func_ref());
device_module_builder.AddFunction(
host_module_builder.AddFunctionWithoutOptim(
host_func.as_lowered_func_ref());
device_module_builder.AddFunctionWithoutOptim(
CreateDeviceFunctionGivenDeviceKernel(*expr).as_lowered_func_ref());
}
}
......
......@@ -30,6 +30,10 @@ void Module::Builder::AddFunction(ir::LoweredFunc func) {
module_->functions.push_back(func);
}
void Module::Builder::AddFunctionWithoutOptim(const ir::LoweredFunc &func) {
module_->functions.push_back(func);
}
void Module::Builder::AddBuffer(ir::Buffer buffer) {
CHECK(buffer->target.defined())
<< "buffer [" << buffer->name << "]'s target is undefined";
......
......@@ -42,6 +42,7 @@ class Module : public ir::IrNodeRef {
}
void AddFunction(ir::LoweredFunc func);
void AddFunctionWithoutOptim(const ir::LoweredFunc& func);
void AddBuffer(ir::Buffer buffer);
void Clear();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册