From 7507956bcb7776766f7edd5b0c575d06c255e965 Mon Sep 17 00:00:00 2001 From: xiaoxiaohehe001 <49090790+xiaoxiaohehe001@users.noreply.github.com> Date: Mon, 5 Dec 2022 10:46:54 +0800 Subject: [PATCH] release_ (#48383) --- paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc | 2 ++ paddle/fluid/framework/ir/trt_multihead_matmul_fuse_pass.cc | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc b/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc index cefcca0f83..a48cfde238 100644 --- a/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc +++ b/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc @@ -931,6 +931,7 @@ int MultiHeadMatmulV2FusePass::BuildFusionV2(Graph* graph, scope->EraseVars({mul1_w->Name(), mul2_w->Name()}); scope->EraseVars({eltadd1_b->Name(), eltadd2_b->Name()}); + paddle::memory::Release(platform::CPUPlace()); auto reshape_desc = reshape2->Op(); int head_number = @@ -1398,6 +1399,7 @@ int MultiHeadMatmulV3FusePass::BuildFusionV3(Graph* graph, sizeof(float) * wq_tensor->numel()); scope->EraseVars({mul1_w->Name(), mul2_w->Name()}); + paddle::memory::Release(platform::CPUPlace()); phi::DenseTensor tmp_combined_bias_tensor; tmp_combined_bias_tensor.Resize(combined_bias_dims); diff --git a/paddle/fluid/framework/ir/trt_multihead_matmul_fuse_pass.cc b/paddle/fluid/framework/ir/trt_multihead_matmul_fuse_pass.cc index 1d17cba445..5c96c351f5 100644 --- a/paddle/fluid/framework/ir/trt_multihead_matmul_fuse_pass.cc +++ b/paddle/fluid/framework/ir/trt_multihead_matmul_fuse_pass.cc @@ -888,6 +888,7 @@ int TrtMultiHeadMatmulV2FusePass::BuildFusionV2(Graph* graph, sizeof(float) * wq_tensor->numel()); scope->EraseVars({mul1_w->Name(), mul2_w->Name()}); + paddle::memory::Release(platform::CPUPlace()); phi::DenseTensor tmp_combined_bias_tensor; tmp_combined_bias_tensor.Resize(combined_bias_dims); @@ -910,6 +911,7 @@ int TrtMultiHeadMatmulV2FusePass::BuildFusionV2(Graph* graph, sizeof(float) * bq_tensor->numel()); scope->EraseVars({eltadd1_b->Name(), eltadd2_b->Name()}); + paddle::memory::Release(platform::CPUPlace()); auto reshape_desc = reshape2->Op(); int head_number = @@ -1408,6 +1410,7 @@ int TrtMultiHeadMatmulV3FusePass::BuildFusionV3(Graph* graph, sizeof(float) * wq_tensor->numel()); scope->EraseVars({mul1_w->Name(), mul2_w->Name()}); + paddle::memory::Release(platform::CPUPlace()); phi::DenseTensor tmp_combined_bias_tensor; tmp_combined_bias_tensor.Resize(combined_bias_dims); @@ -1430,6 +1433,7 @@ int TrtMultiHeadMatmulV3FusePass::BuildFusionV3(Graph* graph, sizeof(float) * bq_tensor->numel()); scope->EraseVars({eltadd1_b->Name(), eltadd2_b->Name()}); + paddle::memory::Release(platform::CPUPlace()); auto reshape_desc = reshape2->Op(); int head_number = -- GitLab