Skip to content

Commit 3d0d45b

Browse files
authored
Byshiue patch 2 (#805)
* fix: fix the problem that we do not destroy the cublaslt Desc and lead to memory leak
1 parent 9282937 commit 3d0d45b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

FasterTransformer/v3.0/fastertransformer/common.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ void cublasLtMM_withAlgo(int *res, int batchCount, int m, int n, int k,
193193
res,
194194
CtransformDesc,
195195
(findAlgo == 1 ? (&algo) : NULL), NULL, 0, stream);
196+
197+
cublasLtMatmulDescDestroy(matmulDesc);
198+
cublasLtMatrixLayoutDestroy(AtransformDesc);
199+
cublasLtMatrixLayoutDestroy(BtransformDesc);
200+
cublasLtMatrixLayoutDestroy(CtransformDesc);
196201
}
197202

198203
//for int8 IO cublasLtMM with algo
@@ -281,6 +286,11 @@ void cublasLtMM_withAlgo_int8IO(int8_t *res, int batchCount, int m, int n, int k
281286
res,
282287
CtransformDesc,
283288
(findAlgo == 1 ? (&algo) : NULL), NULL, 0, stream);
289+
290+
cublasLtMatmulDescDestroy(matmulDesc);
291+
cublasLtMatrixLayoutDestroy(AtransformDesc);
292+
cublasLtMatrixLayoutDestroy(BtransformDesc);
293+
cublasLtMatrixLayoutDestroy(CtransformDesc);
284294
}
285295

286296
template <typename T>

FasterTransformer/v3.1/fastertransformer/common.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ void cublasLtMM_withAlgo(int *res, int batchCount, int m, int n, int k,
243243
res,
244244
CtransformDesc,
245245
(findAlgo == 1 ? (&algo) : NULL), NULL, 0, stream);
246+
247+
cublasLtMatmulDescDestroy(matmulDesc);
248+
cublasLtMatrixLayoutDestroy(AtransformDesc);
249+
cublasLtMatrixLayoutDestroy(BtransformDesc);
250+
cublasLtMatrixLayoutDestroy(CtransformDesc);
246251
}
247252

248253
//for int8 IO cublasLtMM with algo
@@ -384,6 +389,11 @@ void cublasLtMM_withAlgo_int8IO(int8_t *res, int batchCount, int m, int n, int k
384389
res,
385390
CtransformDesc,
386391
(findAlgo == 1 ? (&algo) : NULL), NULL, 0, stream);
392+
393+
cublasLtMatmulDescDestroy(matmulDesc);
394+
cublasLtMatrixLayoutDestroy(AtransformDesc);
395+
cublasLtMatrixLayoutDestroy(BtransformDesc);
396+
cublasLtMatrixLayoutDestroy(CtransformDesc);
387397
}
388398

389399
template <typename T>

0 commit comments

Comments
 (0)