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

Method Compile

tensorflow/compiler/xla/service/service.cc:834–873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832}
833
834Status Service::Compile(const CompileRequest* arg, CompileResponse* result) {
835 VLOG(1) << "running compile request";
836 if (!arg->has_computation()) {
837 return InvalidArgument("computations may not be empty");
838 }
839 if (!arg->computation().has_host_program_shape()) {
840 return InvalidArgument("program shape may not be empty");
841 }
842
843 if (arg->execution_options().device_handles_size() > 1) {
844 return InvalidArgument(
845 "The compile request does not support multiple device handles.");
846 }
847
848 std::vector<Shape> argument_shapes;
849 argument_shapes.reserve(arg->input_shape_with_layout_size());
850 std::vector<const Shape*> argument_shape_ptrs;
851 for (const ShapeProto& shape_proto : arg->input_shape_with_layout()) {
852 argument_shapes.push_back(Shape(shape_proto));
853 argument_shape_ptrs.push_back(&argument_shapes.back());
854 }
855 TF_ASSIGN_OR_RETURN(
856 std::unique_ptr<HloModuleConfig> module_config,
857 CreateModuleConfig(ProgramShape{arg->computation().host_program_shape()},
858 argument_shape_ptrs, &arg->execution_options()));
859 VLOG(3) << "Compile created HloModuleConfig computation layout: "
860 << module_config->entry_computation_layout().ToString();
861
862 TF_ASSIGN_OR_RETURN(
863 std::unique_ptr<Executable> executable,
864 BuildExecutable(arg->computation(), std::move(module_config),
865 execute_backend_.get(),
866 execute_backend_->default_stream_executor(),
867 /*device_allocator=*/nullptr));
868
869 *result->mutable_handle() = compilation_cache_.Insert(std::move(executable));
870
871 VLOG(1) << "successfully completed 'compile' request";
872 return Status::OK();
873}
874
875Status Service::Execute(const ExecuteRequest* arg, ExecuteResponse* result) {
876 VLOG(1) << "running execute request";

Callers 1

BuildExecutablesMethod · 0.45

Calls 11

InvalidArgumentFunction · 0.85
ShapeFunction · 0.70
TF_ASSIGN_OR_RETURNFunction · 0.70
computationMethod · 0.45
reserveMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45
ToStringMethod · 0.45
getMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected