Skip to content

Commit

Permalink
[Fix](mluOpMakeFFTPlanMany): Fix memory leaks bug. (#1154)
Browse files Browse the repository at this point in the history
Co-authored-by: niyuming <[email protected]>
  • Loading branch information
aokbok and niyuming authored Nov 26, 2024
1 parent 3ad18e2 commit dfd318f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions kernels/fft/common/fft_basic_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ mluOpStatus_t fftGetQuantizeMatMulWorkspaceSize(
&return_algo_count));
CALL_CNNL(cnnlGetMatMulHeuristicResult(heuristic_result, matmul_algo,
&workspace_size));
DESTROY_CNNL_TENSOR_DESCRIPTOR(cnnl_d_desc);
CALL_CNNL(cnnlMatMulDescDestroy(matmul_desc));
CALL_CNNL(cnnlMatMulAlgoDestroy(matmul_algo));
CALL_CNNL(cnnlDestroyMatMulHeuristicResult(heuristic_result));
}

// destroy cnnl descriptor
Expand Down Expand Up @@ -397,6 +401,9 @@ mluOpStatus_t fftQuantMatMul(mluOpHandle_t handle, int m, int k, int n,
cnnl_c_desc, c_ptr, workspace, workspace_size,
cnnl_d_desc, c_ptr));
DESTROY_CNNL_TENSOR_DESCRIPTOR(cnnl_d_desc);
CALL_CNNL(cnnlMatMulDescDestroy(matmul_desc));
CALL_CNNL(cnnlMatMulAlgoDestroy(matmul_algo));
CALL_CNNL(cnnlDestroyMatMulHeuristicResult(heuristic_result));
}

// destroy cnnl descriptor
Expand Down Expand Up @@ -497,6 +504,9 @@ mluOpStatus_t fftGetBatchMatMulBcastWorkspaceSize(
DESTROY_CNNL_TENSOR_DESCRIPTOR(cnnl_a_desc);
DESTROY_CNNL_TENSOR_DESCRIPTOR(cnnl_b_desc);
DESTROY_CNNL_TENSOR_DESCRIPTOR(cnnl_c_desc);
CALL_CNNL(cnnlMatMulDescDestroy(bmm_bcast_desc));
CALL_CNNL(cnnlMatMulAlgoDestroy(algo));
CALL_CNNL(cnnlDestroyMatMulHeuristicResult(heuristic_result));

DESTROY_CNNL_HANDLE(cnnl_handle);

Expand Down Expand Up @@ -604,6 +614,9 @@ mluOpStatus_t fftBatchMatMulBcast(
DESTROY_CNNL_TENSOR_DESCRIPTOR(cnnl_a_desc);
DESTROY_CNNL_TENSOR_DESCRIPTOR(cnnl_b_desc);
DESTROY_CNNL_TENSOR_DESCRIPTOR(cnnl_c_desc);
CALL_CNNL(cnnlMatMulDescDestroy(bmm_bcast_desc));
CALL_CNNL(cnnlMatMulAlgoDestroy(algo));
CALL_CNNL(cnnlDestroyMatMulHeuristicResult(heuristic_result));

DESTROY_CNNL_HANDLE(cnnl_handle);

Expand Down

0 comments on commit dfd318f

Please sign in to comment.