| 203 | } |
| 204 | |
| 205 | Status 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 | |
| 233 | namespace { |
| 234 | // Print something that users can search for to definitively ascertain that XLA |
no test coverage detected