Skip to content

Commit 348cfb8

Browse files
committed
Fix memory header definition
1 parent 071fce7 commit 348cfb8

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

source/module_base/module_device/memory_op.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,58 @@ struct delete_memory_op<FPTYPE, base_device::DEVICE_GPU>
146146
};
147147
#endif // __CUDA || __UT_USE_CUDA || __ROCM || __UT_USE_ROCM
148148

149+
#ifdef __DSP
150+
// Partially specialize operator for base_device::GpuDevice.
151+
template <typename FPTYPE>
152+
struct resize_memory_op<FPTYPE, base_device::DEVICE_DSP>
153+
{
154+
void operator()(const base_device::DEVICE_CPU* dev,
155+
FPTYPE*& arr,
156+
const size_t size,
157+
const char* record_in = nullptr);
158+
};
159+
160+
template <typename FPTYPE>
161+
struct set_memory_op<FPTYPE, base_device::DEVICE_DSP>
162+
{
163+
void operator()(const base_device::DEVICE_GPU* dev, FPTYPE* arr, const int var, const size_t size);
164+
};
165+
166+
template <typename FPTYPE>
167+
struct synchronize_memory_op<FPTYPE, base_device::DEVICE_CPU, base_device::DEVICE_DSP>
168+
{
169+
void operator()(const base_device::DEVICE_CPU* dev_out,
170+
const base_device::DEVICE_CPU* dev_in,
171+
FPTYPE* arr_out,
172+
const FPTYPE* arr_in,
173+
const size_t size);
174+
};
175+
template <typename FPTYPE>
176+
struct synchronize_memory_op<FPTYPE, base_device::DEVICE_DSP, base_device::DEVICE_CPU>
177+
{
178+
void operator()(const base_device::DEVICE_CPU* dev_out,
179+
const base_device::DEVICE_CPU* dev_in,
180+
FPTYPE* arr_out,
181+
const FPTYPE* arr_in,
182+
const size_t size);
183+
};
184+
template <typename FPTYPE>
185+
struct synchronize_memory_op<FPTYPE, base_device::DEVICE_DSP, base_device::DEVICE_DSP>
186+
{
187+
void operator()(const base_device::DEVICE_CPU* dev_out,
188+
const base_device::DEVICE_CPU* dev_in,
189+
FPTYPE* arr_out,
190+
const FPTYPE* arr_in,
191+
const size_t size);
192+
};
193+
194+
template <typename FPTYPE>
195+
struct delete_memory_op<FPTYPE, base_device::DEVICE_DSP>
196+
{
197+
void operator()(const base_device::DEVICE_CPU* dev, FPTYPE* arr);
198+
};
199+
#endif // __DSP
200+
149201
} // end of namespace memory
150202
} // end of namespace base_device
151203

@@ -233,5 +285,6 @@ using castmem_z2c_d2h_op = base_device::memory::
233285

234286
static base_device::DEVICE_CPU* cpu_ctx = {};
235287
static base_device::DEVICE_GPU* gpu_ctx = {};
288+
static base_device::DEVICE_DSP* gpu_ctx = {};
236289

237290
#endif // MODULE_DEVICE_MEMORY_H_

0 commit comments

Comments
 (0)