You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

somas_stream.h 1.8 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright 2020 Huawei Technologies Co., Ltd
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. * http://www.apache.org/licenses/LICENSE-2.0
  7. * Unless required by applicable law or agreed to in writing, software
  8. * distributed under the License is distributed on an "AS IS" BASIS,
  9. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. * See the License for the specific language governing permissions and
  11. * limitations under the License.
  12. */
  13. #ifndef MINDSPORE_CCSRC_BACKEND_OPTIMIZER_SOMAS_SOMAS_STREAM_H_
  14. #define MINDSPORE_CCSRC_BACKEND_OPTIMIZER_SOMAS_SOMAS_STREAM_H_
  15. #include "backend/optimizer/somas/somas_node.h"
  16. #include "backend/optimizer/somas/somas_tensor.h"
  17. #include <memory>
  18. #include <set>
  19. #include <vector>
  20. namespace mindspore {
  21. namespace somas {
  22. class SomasNode;
  23. class SomasTensor;
  24. using SomasTensorPtr = std::shared_ptr<SomasTensor>;
  25. class SomasStream {
  26. public:
  27. using SomasStreamPtr = std::shared_ptr<SomasStream>;
  28. using SomasNodePtr = std::shared_ptr<SomasNode>;
  29. // Attributes mutated in code
  30. std::vector<SomasTensorPtr> tensors_; // vector needed for same-stream loop in ConflictComputing()
  31. std::set<SomasStreamPtr> ancestor_streams_;
  32. std::vector<SomasNodePtr> nodes_;
  33. // Constructors/Destructors
  34. explicit SomasStream(int64_t id) : id_(id) {}
  35. SomasStream(const SomasStream &) = delete;
  36. SomasStream &operator=(const SomasStream &) = delete;
  37. ~SomasStream() = default;
  38. // Accessors
  39. const int64_t &GetId() const { return id_; }
  40. private:
  41. const int64_t id_{0};
  42. };
  43. } // namespace somas
  44. } // namespace mindspore
  45. #endif // MINDSPORE_CCSRC_BACKEND_OPTIMIZER_SOMAS_SOMAS_STREAM_H_