本文整理汇总了C++中Split::is_fuse方法的典型用法代码示例。如果您正苦于以下问题:C++ Split::is_fuse方法的具体用法?C++ Split::is_fuse怎么用?C++ Split::is_fuse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Split
的用法示例。
在下文中一共展示了Split::is_fuse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
vector<std::pair<string, Expr>> compute_loop_bounds_after_split(const Split &split, string prefix) {
// Define the bounds on the split dimensions using the bounds
// on the function args. If it is a purify, we should use the bounds
// from the dims instead.
vector<std::pair<string, Expr>> let_stmts;
Expr old_var_extent = Variable::make(Int(32), prefix + split.old_var + ".loop_extent");
Expr old_var_max = Variable::make(Int(32), prefix + split.old_var + ".loop_max");
Expr old_var_min = Variable::make(Int(32), prefix + split.old_var + ".loop_min");
if (split.is_split()) {
Expr inner_extent = split.factor;
Expr outer_extent = (old_var_max - old_var_min + split.factor)/split.factor;
let_stmts.push_back({ prefix + split.inner + ".loop_min", 0 });
let_stmts.push_back({ prefix + split.inner + ".loop_max", inner_extent-1 });
let_stmts.push_back({ prefix + split.inner + ".loop_extent", inner_extent });
let_stmts.push_back({ prefix + split.outer + ".loop_min", 0 });
let_stmts.push_back({ prefix + split.outer + ".loop_max", outer_extent-1 });
let_stmts.push_back({ prefix + split.outer + ".loop_extent", outer_extent });
} else if (split.is_fuse()) {
// Define bounds on the fused var using the bounds on the inner and outer
Expr inner_extent = Variable::make(Int(32), prefix + split.inner + ".loop_extent");
Expr outer_extent = Variable::make(Int(32), prefix + split.outer + ".loop_extent");
Expr fused_extent = inner_extent * outer_extent;
let_stmts.push_back({ prefix + split.old_var + ".loop_min", 0 });
let_stmts.push_back({ prefix + split.old_var + ".loop_max", fused_extent - 1 });
let_stmts.push_back({ prefix + split.old_var + ".loop_extent", fused_extent });
} else if (split.is_rename()) {
let_stmts.push_back({ prefix + split.outer + ".loop_min", old_var_min });
let_stmts.push_back({ prefix + split.outer + ".loop_max", old_var_max });
let_stmts.push_back({ prefix + split.outer + ".loop_extent", old_var_extent });
}
// Do nothing for purify
return let_stmts;
}