MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CompileSingleOp

Method CompileSingleOp

tensorflow/compiler/jit/xla_compilation_cache.cc:205–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205Status XlaCompilationCache::CompileSingleOp(
206 const XlaCompiler::Options& options,
207 std::vector<XlaCompiler::Argument>& args, OpKernelContext* ctx,
208 const XlaCompiler::CompileOptions& compile_options,
209 const XlaCompiler::CompilationResult** out_compilation_result,
210 xla::LocalExecutable** out_executable) {
211 const NodeDef& def = ctx->op_kernel().def();
212 NameAttrList name;
213 name.set_name(def.op());
214 *name.mutable_attr() = def.attr();
215 // Remove the "_class" attribute from the attribute set used to create the
216 // compilation cache key. This attribute is information for the colocator
217 // and causes false uniqueness between nodes.
218 name.mutable_attr()->erase("_class");
219 auto compile_op = [&](XlaCompiler* compiler,
220 const std::vector<XlaCompiler::Argument>& args,
221 XlaCompiler::CompilationResult* result) {
222 std::vector<DataType> result_dtypes(ctx->num_outputs());
223 for (int i = 0; i < result_dtypes.size(); ++i) {
224 result_dtypes[i] = ctx->expected_output_dtype(i);
225 }
226 return compiler->CompileSingleOp(compile_options, ctx->op_kernel().def(),
227 args, result_dtypes, result);
228 };
229 return CompileImpl(options, name, args, compile_op, CompileMode::kStrict,
230 out_compilation_result, out_executable);
231}
232
233namespace {
234// Print something that users can search for to definitively ascertain that XLA

Callers 1

CompileMethod · 0.45

Calls 8

CompileImplFunction · 0.85
attrMethod · 0.80
set_nameMethod · 0.45
opMethod · 0.45
eraseMethod · 0.45
num_outputsMethod · 0.45
sizeMethod · 0.45
expected_output_dtypeMethod · 0.45

Tested by

no test coverage detected