| 142 | } |
| 143 | |
| 144 | Status XlaCompilationCache::BuildExecutable( |
| 145 | const XlaCompiler::Options& options, |
| 146 | const XlaCompiler::CompilationResult& result, |
| 147 | std::unique_ptr<xla::LocalExecutable>* executable) { |
| 148 | VLOG(2) << "Compiling to local executable"; |
| 149 | |
| 150 | std::vector<const xla::Shape*> argument_layouts( |
| 151 | result.xla_input_shapes.size()); |
| 152 | for (int i = 0; i < result.xla_input_shapes.size(); ++i) { |
| 153 | argument_layouts[i] = &result.xla_input_shapes[i]; |
| 154 | } |
| 155 | xla::ExecutableBuildOptions build_options; |
| 156 | build_options.set_device_ordinal(options.device_ordinal != -1 |
| 157 | ? options.device_ordinal |
| 158 | : client_->default_device_ordinal()); |
| 159 | build_options.set_result_layout(result.xla_output_shape); |
| 160 | build_options.set_device_allocator(options.device_allocator.get()); |
| 161 | |
| 162 | TF_ASSIGN_OR_RETURN( |
| 163 | auto executables, |
| 164 | client_->Compile(*result.computation, argument_layouts, build_options)); |
| 165 | TF_RET_CHECK(executables.size() == 1); |
| 166 | *executable = std::move(executables[0]); |
| 167 | return Status::OK(); |
| 168 | } |
| 169 | |
| 170 | Status XlaCompilationCache::Compile( |
| 171 | const XlaCompiler::Options& options, const NameAttrList& function, |
nothing calls this directly
no test coverage detected