aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/cpu/ir_emitter.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-11-29 08:05:58 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-11-29 08:09:41 -0800
commit18a36a823141c675658d218fa78ed5e2bf19ea8c (patch)
treea3b1430b5fe5f8243c3881385193533844aaf006 /tensorflow/compiler/xla/service/cpu/ir_emitter.h
parente6d823dd19a5768d0dcd651c14a6ebf4bb023180 (diff)
[XLA:CPU] Factor IR function building logic out of IrEmitter into its own file (no functional changes, just code movement). This will enable building parallel IR functions from other emitters, and remove the requirement that parallel IR functions are associated with a sub-computation.
PiperOrigin-RevId: 177309875
Diffstat (limited to 'tensorflow/compiler/xla/service/cpu/ir_emitter.h')
-rw-r--r--tensorflow/compiler/xla/service/cpu/ir_emitter.h20
1 files changed, 6 insertions, 14 deletions
diff --git a/tensorflow/compiler/xla/service/cpu/ir_emitter.h b/tensorflow/compiler/xla/service/cpu/ir_emitter.h
index 351c95278c..9e5595052f 100644
--- a/tensorflow/compiler/xla/service/cpu/ir_emitter.h
+++ b/tensorflow/compiler/xla/service/cpu/ir_emitter.h
@@ -18,6 +18,7 @@ limitations under the License.
#include <stddef.h>
#include <map>
+#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
@@ -30,6 +31,7 @@ limitations under the License.
#include "llvm/Target/TargetMachine.h"
#include "tensorflow/compiler/xla/service/buffer_assignment.h"
#include "tensorflow/compiler/xla/service/cpu/external_constant_pool.h"
+#include "tensorflow/compiler/xla/service/cpu/ir_function.h"
#include "tensorflow/compiler/xla/service/dfs_hlo_visitor_with_default.h"
#include "tensorflow/compiler/xla/service/hlo_computation.h"
#include "tensorflow/compiler/xla/service/hlo_instruction.h"
@@ -233,13 +235,6 @@ class IrEmitter : public DfsHloVisitorWithDefault {
// Convenience function to get the IR type matching the given shape.
llvm::Type* IrShapeType(const Shape& shape);
- // Returns an array of compute function parameter types.
- std::vector<llvm::Type*> GetComputeFunctionParams();
-
- // Get the llvm::Value* that represents the "retval" argument of the
- // computation function being emitted by this emitter.
- llvm::Argument* GetResultArgument();
-
// Get the llvm::Value* that represents the "prof_counters" argument of the
// computation function being emitted by this emitter.
llvm::Argument* GetProfileCountersArgument();
@@ -252,11 +247,6 @@ class IrEmitter : public DfsHloVisitorWithDefault {
// computation function being emitted by this emitter.
llvm::Value* GetTempBuffersArgument();
- // Emit ir to read and return the ir value for the dynamic loop bound at
- // 'offset' from the "dynamic_loop_bounds" argument of the computation
- // function being emitted by this emitter.
- llvm::Value* GetDynamicLoopBound(const int64 offset);
-
// Emits code that computes the address of the given temporary buffer to the
// function. target_shape is the shape of this temporary buffer.
// The returned Value's type is a pointer to element_type.
@@ -476,8 +466,10 @@ class IrEmitter : public DfsHloVisitorWithDefault {
thread_local_buffers_;
// The following fields track the IR emission state. According to LLVM memory
- // management rules, their memory is owned by the module.
- llvm::Function* compute_function_;
+ // management rules, their memory is owned by the module (Note that IrFunction
+ // creates the encapsulated llvm::Function s.t. it is added to the llvm
+ // module's function list).
+ std::unique_ptr<IrFunction> compute_function_;
llvm::IRBuilder<> ir_builder_;
// Maps HLOs to their index into the profile counter array.