aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_runner.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-11-01 16:41:27 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-11-01 16:45:11 -0700
commit7b86d87d225b19c47f11763e60a2e1ffe71d6a33 (patch)
tree32ab38bcfd9cfd485f3a260e8a49873e52d8f259 /tensorflow/compiler/xla/service/hlo_runner.cc
parent117bcd9cb5f3e55ce1fcc09a0bb4963c32bad8ce (diff)
Make hlo_parser accepts HloModuleConfig. Make hlo_runner able to read a hlo
module from the hlo text dump. PiperOrigin-RevId: 174256301
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_runner.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_runner.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_runner.cc b/tensorflow/compiler/xla/service/hlo_runner.cc
index c3f74e253f..aaa4e3a2e3 100644
--- a/tensorflow/compiler/xla/service/hlo_runner.cc
+++ b/tensorflow/compiler/xla/service/hlo_runner.cc
@@ -30,6 +30,7 @@ limitations under the License.
#include "tensorflow/compiler/xla/service/transfer_manager.h"
#include "tensorflow/compiler/xla/shape_util.h"
#include "tensorflow/compiler/xla/statusor.h"
+#include "tensorflow/compiler/xla/tools/parser/hlo_parser.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/core/common_runtime/eigen_thread_pool.h"
#include "tensorflow/core/platform/logging.h"
@@ -54,6 +55,17 @@ HloRunner::ReadModuleFromHloProtoFile(const char* filename,
return std::move(module);
}
+/*static*/ StatusOr<std::unique_ptr<HloModule>>
+HloRunner::ReadModuleFromHloTextDumpFile(const char* filename,
+ const DebugOptions& debug_options) {
+ string hlo_string;
+ TF_RETURN_IF_ERROR(tensorflow::ReadFileToString(tensorflow::Env::Default(),
+ filename, &hlo_string));
+ HloModuleConfig config;
+ config.set_debug_options(debug_options);
+ return tools::Parse(hlo_string, config);
+}
+
// Define this in .cc file to avoid having to include eigen or forward declare
// these types in the header.
struct HloRunner::EigenThreadPoolWrapper {