/** * Copyright 2020 Huawei Technologies Co., Ltd * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MINDSPORE_CCSRC_BACKEND_OPTIMIZER_SOMAS_SOMAS_NODE_H_ #define MINDSPORE_CCSRC_BACKEND_OPTIMIZER_SOMAS_SOMAS_NODE_H_ #include "backend/optimizer/somas/somas_stream.h" #include "backend/optimizer/somas/somas_tensor.h" #include "backend/optimizer/somas/somas_parameter.h" #include #include #include #include #include #include namespace mindspore { namespace somas { class SomasStream; class SomasTensor; enum NodeType { kCommonNode, kCommunicationNode }; using SomasStreamPtr = std::shared_ptr; using SomasTensorPtr = std::shared_ptr; class SomasNode { public: using SomasNodePtr = std::shared_ptr; // Public attributes (mutated in code) std::string scope_full_name_; // node's dependency including data dependency and time dependency std::set ancestor_nodes_; std::set tensors_; std::vector input_tensors_; std::vector output_tensors_; std::vector workspace_tensors_; std::map input_parameters_map_; std::unordered_map anc_stream_max_order_; // Constructors/Destructors SomasNode(size_t id, NodeType type, SomasStreamPtr stream) : id_(id), stream_(stream), type_(type) {} SomasNode(const SomasNode &) = delete; SomasNode &operator=(const SomasNode &) = delete; ~SomasNode() = default; // Accessors const size_t &GetId() { return id_; } SomasStreamPtr GetStream() { return stream_; } const NodeType &GetType() { return type_; } private: const size_t id_{0}; SomasStreamPtr const stream_; const NodeType type_; }; } // namespace somas } // namespace mindspore #endif // MINDSPORE_CCSRC_BACKEND_OPTIMIZER_SOMAS_SOMAS_NODE_H_