Added new stage in life of intermediate representation.
PiperOrigin-RevId: 334719764 Change-Id: I2bdb2ab42da6a6b1249037e9726593655823cdf2
This commit is contained in:
parent
960263f58c
commit
145f6b1a17
@ -843,11 +843,16 @@ absl::Status Arguments::AllocateObjects(CLContext* context) {
|
||||
for (auto& t : objects_) {
|
||||
RETURN_IF_ERROR(
|
||||
t.second.descriptor->CreateGPUObject(context, &t.second.obj_ptr));
|
||||
t.second.descriptor->Release();
|
||||
}
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
void Arguments::ReleaseCPURepresentation() {
|
||||
for (auto& t : objects_) {
|
||||
t.second.descriptor->Release();
|
||||
}
|
||||
}
|
||||
|
||||
absl::Status Arguments::AddObjectArgs() {
|
||||
for (auto& t : objects_) {
|
||||
AddGPUResources(t.first, t.second.descriptor->GetGPUResources());
|
||||
|
@ -55,6 +55,7 @@ class Arguments {
|
||||
absl::Status Merge(Arguments&& args, const std::string& postfix);
|
||||
|
||||
absl::Status AllocateObjects(CLContext* context);
|
||||
void ReleaseCPURepresentation();
|
||||
absl::Status TransformToCLCode(
|
||||
const DeviceInfo& device_info,
|
||||
const std::map<std::string, std::string>& linkables, std::string* code);
|
||||
|
@ -182,6 +182,10 @@ absl::Status InferenceContext::InitFromGraph(
|
||||
RETURN_IF_ERROR(Compile(creation_context));
|
||||
RETURN_IF_ERROR(UpdateParams());
|
||||
|
||||
for (auto& node : nodes_) {
|
||||
node.operation->args_.ReleaseCPURepresentation();
|
||||
}
|
||||
|
||||
TuningParameters tuning_parameters;
|
||||
tuning_parameters.queue = env->profiling_queue();
|
||||
tuning_parameters.info = &env->device().info_;
|
||||
|
@ -55,6 +55,7 @@ absl::Status ExecuteGPUOperation(const std::vector<TensorFloat32>& src_cpu,
|
||||
|
||||
RETURN_IF_ERROR(operation->Compile(creation_context));
|
||||
RETURN_IF_ERROR(operation->UpdateParams());
|
||||
operation->args_.ReleaseCPURepresentation();
|
||||
RETURN_IF_ERROR(operation->AddToQueue(creation_context.queue));
|
||||
RETURN_IF_ERROR(creation_context.queue->WaitForCompletion());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user