mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[LT] Move MakeNode into ir_builder.h
Summary: Move MakeNode into ir_builder.h to avoid circular header reference later when introducing a trie cache for IR node lookup. Pull Request resolved: https://github.com/pytorch/pytorch/pull/76482 Approved by: https://github.com/wconstab
This commit is contained in:
parent
138c944a6b
commit
f8a4780eb2
8 changed files with 13 additions and 6 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <c10/util/Exception.h>
|
||||
#include <torch/csrc/lazy/core/config.h>
|
||||
#include <torch/csrc/lazy/core/ir.h>
|
||||
#include <torch/csrc/lazy/core/ir_builder.h>
|
||||
#include <torch/csrc/lazy/core/debug_util.h>
|
||||
#include <torch/csrc/lazy/core/ir_metadata.h>
|
||||
#include <torch/csrc/lazy/ts_backend/ts_node.h>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include <c10/util/Exception.h>
|
||||
#include <torch/csrc/lazy/core/config.h>
|
||||
#include <torch/csrc/lazy/core/ir.h>
|
||||
#include <torch/csrc/lazy/core/ir_builder.h>
|
||||
#include <torch/csrc/lazy/core/ir_metadata.h>
|
||||
#include <torch/csrc/lazy/core/ir_util.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <c10/core/Device.h>
|
||||
#include <test/cpp/lazy/test_lazy_ops_util.h>
|
||||
#include <torch/csrc/lazy/core/helpers.h>
|
||||
#include <torch/csrc/lazy/core/ir_builder.h>
|
||||
#include <torch/csrc/lazy/core/metrics.h>
|
||||
#include <torch/csrc/lazy/core/debug_util.h>
|
||||
#include <torch/csrc/lazy/core/lazy_graph_executor.h>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <test/cpp/lazy/test_lazy_ops_util.h>
|
||||
#include <torch/csrc/lazy/core/debug_util.h>
|
||||
#include <torch/csrc/lazy/core/helpers.h>
|
||||
#include <torch/csrc/lazy/core/ir_builder.h>
|
||||
#include <torch/csrc/lazy/core/lazy_graph_executor.h>
|
||||
#include <torch/csrc/lazy/core/metrics.h>
|
||||
#include <torch/csrc/lazy/core/permutation_util.h>
|
||||
|
|
|
|||
|
|
@ -175,12 +175,6 @@ inline std::ostream& operator<<(std::ostream& stream, const Node& node) {
|
|||
return stream;
|
||||
}
|
||||
|
||||
// TODO(alanwaketan): Support r-value reference argument type.
|
||||
template <typename T, typename... Args>
|
||||
NodePtr MakeNode(Args&&... args) {
|
||||
return std::make_shared<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const T* NodeCast(const Node* node, OpKind op) {
|
||||
if (op != node->op()) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@
|
|||
namespace torch {
|
||||
namespace lazy {
|
||||
|
||||
// TODO(alanwaketan): Support r-value reference argument type.
|
||||
template <typename T, typename... Args>
|
||||
NodePtr MakeNode(Args&&... args) {
|
||||
return std::make_shared<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
struct IrBuilder {
|
||||
virtual NodePtr MakeDeviceData(const std::shared_ptr<BackendData>& data) const = 0;
|
||||
virtual NodePtr MakeScalar(const at::Scalar& value, const at::ScalarType& type) const = 0;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <torch/csrc/lazy/ts_backend/ts_node.h>
|
||||
|
||||
#include <torch/csrc/lazy/core/ir_builder.h>
|
||||
|
||||
namespace torch {
|
||||
namespace lazy {
|
||||
|
||||
|
|
|
|||
|
|
@ -451,6 +451,7 @@ def run_gen_lazy_tensor(
|
|||
"ATen/MetaFunctions.h",
|
||||
"ATen/Operators.h",
|
||||
"ATen/native/CPUFallback.h",
|
||||
"torch/csrc/lazy/core/ir_builder.h",
|
||||
"torch/csrc/lazy/core/lazy_graph_executor.h",
|
||||
"torch/csrc/lazy/core/metrics.h",
|
||||
"torch/csrc/lazy/core/shape.h",
|
||||
|
|
|
|||
Loading…
Reference in a new issue