| 203 | } |
| 204 | |
| 205 | void *Allocator::nativeAlloc(const size_t bytes) { |
| 206 | cl_int err = CL_SUCCESS; |
| 207 | auto ptr = static_cast<void *>(clCreateBuffer( |
| 208 | getContext()(), CL_MEM_READ_WRITE, // NOLINT(hicpp-signed-bitwise) |
| 209 | bytes, nullptr, &err)); |
| 210 | |
| 211 | if (err != CL_SUCCESS) { |
| 212 | auto str = fmt::format("Failed to allocate device memory of size {}", |
| 213 | bytesToString(bytes)); |
| 214 | AF_ERROR(str, AF_ERR_NO_MEM); |
| 215 | } |
| 216 | |
| 217 | AF_TRACE("nativeAlloc: {} {}", bytesToString(bytes), ptr); |
| 218 | return ptr; |
| 219 | } |
| 220 | |
| 221 | void Allocator::nativeFree(void *ptr) { |
| 222 | cl_mem buffer = static_cast<cl_mem>(ptr); |
nothing calls this directly
no test coverage detected