You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto compilation_key = cinn_compiler->AddGraph(std::move(subgraph));
VLOG(4) << "Compilation Key:\n"
<< cinn_compiler->ReadableKey(compilation_key);
// Replace the found cluster to a new cinn op nodeReplaceSubGraphWithCinnOpNode(cluster_set,
cluster_inputs,
cluster_outputs,
cluster_internals,
compilation_key,
graph);
一、CINN 流程
当前主框架下放到CINN后端的主要逻辑是:
新的优化流程示意图 (家人们,点击图片查看大图)
关于fusion merge pass实现的细节, 详细参考:Group融合Pass流程简述
gusion merge架构会升级下下面的结构;
阶段一:
ProgramDesc
=>ir::Graph
=>CinnCompiler
,由build_cinn_pass
承担阶段二:
ir::Graph
=>frontend::Program
=>hlir::Graph
,由CinnCompiler
承担阶段三:
hlir::Graph
=>Compute/Schedule
=>AST 层面
=>Module::Builder
=>CodeGen+NVRTC
=>Runtime::Program
,由GraphCompiler
承担二、适配方案
若要从:framework::ProgramDesc →ir::Graph → frontend::Program (NetBuilder 层)→ hlir::Graph → Compute/Schedule → AST 层面 → Module::Builder → CodeGen+NVRTC → Runtime::Program
迁移到:framework::ProgramDesc → ProgramTranslator → New IR → New IR Graph → Compute/Schedule → AST 层面 → Module::Builder → CodeGen+NVRTC → Runtime::Program
则各个模块的角色变动如下:
Build()
动态生成的都将是 New IR,而非 frontend::Program,目前主框架已经有此组件,要考虑如何兼顾Phi和CINN,进一步抽象支持扩展性方案思路:
GraphCompiler
为核心切入点,以单测驱动机制验证工作二、一些开发经验
builder.Build<paddle::dialect::XX>
要包含头文件#include "paddle/fluid/ir/dialect/pd_op.h"
InsertBufferHandlers
里会动态地掺入一些内存malloc和free的额外Instruction。The text was updated successfully, but these errors were encountered: