text
stringlengths
0
2.2M
OptOutConstDispatch::handle(expr);
}
for (const auto& expr : ite->elseBody().exprs()) {
OptOutConstDispatch::handle(expr);
}
}
private:
std::vector<std::vector<const Allocate*>> live_allocations_;
};
} // namespace
// TODO(kir): Kernel IR validation
void Kernel::finalize(std::vector<Expr*> top_level_exprs) {
TORCH_INTERNAL_ASSERT(top_level_exprs_.empty());
top_level_exprs_ = std::move(top_level_exprs);
warp_padded_parallel_info_ = GpuLower::current()->getWarpPaddedParallelInfo();
ValidateAllocation::validate(this);
analyze();
}
void Kernel::analyze() {
FUSER_PERF_SCOPE("Kernel::analyze");
const KernelIrScanner ir_scanner(this);
summary_ = ir_scanner.summary();
}
void Kernel::print() const {
IrPrinter ir_printer(std::cout);
ir_printer.handle(this);
}
//! Register the Val with this fusion
void Kernel::registerVal(Val* val) {
if (inContainer(val)) {
return;
}
if (val->kernel()) {
TORCH_CHECK(
val->kernel() == this,
val->toString(),
" was not found in the active kernel.");
}
Fusion::registerVal(val);
}
//! Register expr with this fusion.
//! When we register an expression, we want to update the dependency tracking
//! of Vals. We add expr to our general expr_set_,
void Kernel::registerExpr(Expr* expr) {
if (inContainer(expr)) {
return;
}
if (expr->kernel()) {
TORCH_CHECK(
expr->kernel() == this,
expr->toString(),
" was not found in the active kernel.");
}
for (Val* input : expr->inputs()) {
TORCH_INTERNAL_ASSERT(
inContainer(input),
"Input\n",
input->toString(),
" to expr,\n",
expr->toString(),
",\n is invalid because it is not in the same kernel.");
}
for (Val* output : expr->outputs()) {
TORCH_INTERNAL_ASSERT(
inContainer(output),
"Output\n",
output->toString(),
" to expr,\n",
expr->toString(),
",\n is invalid because it is not in the same kernel.");
}
// Register expr is explicitly non-SSA when coming from a kernel. This is
// detected inside Fusion::registerExpr
Fusion::registerExpr(expr);
}
} // namespace kir
} // namespace cuda
} // namespace fuser
} // namespace jit
} // namespace torch
//
// ArbitraryTableLookupDemo.cpp
// TonicDemo
//