Skip to content

Commit 98fe67d

Browse files
committed
Finish memory_op on dsp
1 parent 2d762d9 commit 98fe67d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

source/module_base/module_device/memory_op.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
#include "module_base/memory.h"
44
#include "module_base/tool_threading.h"
5+
#ifdef __DSP
6+
#include "module_base/kernels/dsp_connector.h"
7+
#endif
58

69
#include <complex>
710
#include <cstring>
@@ -18,9 +21,17 @@ struct resize_memory_op<FPTYPE, base_device::DEVICE_CPU>
1821
{
1922
if (arr != nullptr)
2023
{
24+
#ifdef __DSP
25+
free_ht(arr);
26+
#else
2127
free(arr);
28+
#endif
2229
}
30+
#ifdef __DSP
31+
arr = (FPTYPE*)malloc_ht(sizeof(FPTYPE) * size);
32+
#else
2333
arr = (FPTYPE*)malloc(sizeof(FPTYPE) * size);
34+
#endif
2435
std::string record_string;
2536
if (record_in != nullptr)
2637
{
@@ -92,7 +103,11 @@ struct delete_memory_op<FPTYPE, base_device::DEVICE_CPU>
92103
{
93104
void operator()(const base_device::DEVICE_CPU* dev, FPTYPE* arr)
94105
{
106+
#ifdef __DSP
107+
free_ht(arr);
108+
#else
95109
free(arr);
110+
#endif
96111
}
97112
};
98113

0 commit comments

Comments
 (0)