14 #ifndef TENSORFLOW_COMPILER_XLA_SERVICE_HLO_PASS_PIPELINE_H_ 15 #define TENSORFLOW_COMPILER_XLA_SERVICE_HLO_PASS_PIPELINE_H_ 20 #include "tensorflow/compiler/xla/ptr_util.h" 22 #include "tensorflow/compiler/xla/service/hlo_pass_interface.h" 23 #include "tensorflow/compiler/xla/statusor.h" 24 #include "tensorflow/compiler/xla/types.h" 25 #include "tensorflow/core/platform/macros.h" 36 tensorflow::StringPiece name()
const override {
return name_; }
43 template <
typename T,
typename... Args>
45 CHECK(!run_called_) <<
"AddPass cannot be called after Run";
46 auto pass =
new T(std::forward<Args>(args)...);
47 passes_.push_back(std::unique_ptr<T>(pass));
56 template <
typename T,
typename... Args>
58 CHECK(!run_called_) <<
"AddInvariantChecker cannot be called after Run";
59 auto pass =
new T(std::forward<Args>(args)...);
60 invariant_checkers_.push_back(std::unique_ptr<T>(pass));
67 std::vector<std::unique_ptr<HloPassInterface>> passes_;
68 std::vector<std::unique_ptr<HloPassInterface>> invariant_checkers_;
69 bool run_called_ =
false;
73 #endif // TENSORFLOW_COMPILER_XLA_SERVICE_HLO_PASS_PIPELINE_H_ T & AddPass(Args &&... args)
Add a pass to the pipeline. It should be called with the arguments for the pass constructor: ...
Definition: hlo_pass_pipeline.h:44
HloPassPipeline(const string &name)
Definition: hlo_pass_pipeline.h:35
StatusOr< bool > Run(HloModule *module) override
Run the Hlo pipeline by invoking each class' Run method.
Definition: hlo_pass_pipeline.cc:59
namespace for xla
Definition: client_library.cc:26
Definition: hlo_module.h:52
Definition: hlo_pass_pipeline.h:30
T & AddInvariantChecker(Args &&... args)
Definition: hlo_pass_pipeline.h:57