text
stringlengths
0
2.2M
namespace impl {
namespace gpu {
namespace nvidia {
namespace {
constexpr impl_list_item_t cuda_concat_impl_list[]
= {impl_list_item_t::concat_type_deduction_helper_t<
gpu::ocl::ref_concat_t::pd_t>(),
nullptr};
} // namespace
const impl_list_item_t *
cuda_gpu_engine_impl_list_t::get_concat_implementation_list() {
return cuda_concat_impl_list;
}
} // namespace nvidia
} // namespace gpu
} // namespace impl
} // namespace dnnl
#include <torch/csrc/jit/frontend/convert_to_ssa.h>
#include <torch/csrc/jit/frontend/exit_transforms.h>
#include <torch/csrc/jit/frontend/inline_loop_condition.h>
#include <torch/csrc/jit/frontend/ir_emitter.h>
#include <torch/csrc/jit/frontend/mini_environment.h>
#include <torch/csrc/jit/ir/ir.h>
#include <torch/csrc/jit/ir/ir_views.h>
namespace torch {
namespace jit {
// At the beginning of the pass the Graph has already undergone type checking,
// and writes or reads to a variable are emitted as Loads and Stores in the
// graph.
// a = 1
// print(a)
// is represented as:
// %a.1 : int = prim::Constant[value=1]()
// prim::Store[name="a"](%a.1)
// %a : int = prim::Load[name="a"]()
// prim::Print(%a)
//
// First, this pass recursively adds the Loads & Stores to control flow nodes
// Then the graph is converted to SSA form.
using ValueEnvironment = MiniEnvironment<Value*>;
using TypeEnvironment = MiniEnvironment<TypePtr>;
// Adds Loads & Stores to Loops & Ifs
struct ControlFlowLoadStores {
static void addBlockInput(
Block* b,
const TypePtr& type,
const std::string& name) {
auto g = b->owningGraph();
g->createStore(name, b->addInput(name)->setType(type))
->insertAfter(b->param_node());
}
static void addBlockOutput(
Block* exit_block,
const TypePtr& type,
const std::string& name) {
WithInsertPoint insert(exit_block);
auto g = exit_block->owningGraph();
auto block_exit = g->insertNode(g->createLoad(name, type))->output();
exit_block->registerOutput(block_exit);
}
static void addNodeOutput(
Node* n,
const TypePtr& type,
const std::string& name) {
auto out = n->addOutput()->setType(type);
if (meaningfulName(name)) {
out->setDebugName(name);
}
auto g = n->owningGraph();
g->createStore(name, out)->insertAfter(n);
}
static void addNodeInput(
Node* n,
const TypePtr& type,
const std::string& name) {
auto g = n->owningGraph();
auto inp = g->createLoad(name, type)->insertBefore(n)->output();
n->addInput(inp);
}
void addIfLoadStores(Node* n) {
auto true_block = n->blocks().at(0);
auto false_block = n->blocks().at(1);
auto true_vars = addControlFlowLoadStores(true_block);
auto false_vars = addControlFlowLoadStores(false_block);
std::set<std::string> mutated_variables;