| 122 | } |
| 123 | |
| 124 | StatusOr<std::vector<std::unique_ptr<Executable>>> InterpreterCompiler::Compile( |
| 125 | std::unique_ptr<HloModuleGroup> module_group, |
| 126 | std::vector<std::vector<se::StreamExecutor*>> stream_exec, |
| 127 | se::DeviceMemoryAllocator* device_allocator) { |
| 128 | if (module_group->empty()) { |
| 129 | return std::vector<std::unique_ptr<Executable>>(); |
| 130 | } |
| 131 | if (module_group->size() > 1) { |
| 132 | return tensorflow::errors::Unimplemented( |
| 133 | "Compilation of multiple HLO modules is not supported on Interpreter."); |
| 134 | } |
| 135 | if (stream_exec.size() != 1 || stream_exec[0].size() != 1) { |
| 136 | return tensorflow::errors::Unimplemented( |
| 137 | "Unexpected number of StreamExecutor's."); |
| 138 | } |
| 139 | auto hlo_modules = module_group->ConsumeModules(); |
| 140 | TF_ASSIGN_OR_RETURN(auto module, |
| 141 | RunHloPasses(std::move(hlo_modules[0]), stream_exec[0][0], |
| 142 | device_allocator)); |
| 143 | TF_ASSIGN_OR_RETURN( |
| 144 | auto executable, |
| 145 | RunBackend(std::move(module), stream_exec[0][0], device_allocator)); |
| 146 | std::vector<std::unique_ptr<Executable>> ret; |
| 147 | ret.push_back(std::move(executable)); |
| 148 | return std::move(ret); |
| 149 | } |
| 150 | |
| 151 | StatusOr<std::vector<std::unique_ptr<AotCompilationResult>>> |
| 152 | InterpreterCompiler::CompileAheadOfTime( |
nothing calls this directly
no test coverage detected