| 14 | namespace af { |
| 15 | template<> |
| 16 | AFAPI cl_mem *array::device() const { |
| 17 | auto *mem_ptr = new cl_mem; |
| 18 | void *dptr = nullptr; |
| 19 | af_err err = af_get_device_ptr(&dptr, get()); |
| 20 | memcpy(mem_ptr, &dptr, sizeof(void *)); |
| 21 | if (err != AF_SUCCESS) { |
| 22 | throw af::exception("Failed to get cl_mem from array object"); |
| 23 | } |
| 24 | return mem_ptr; |
| 25 | } |
| 26 | } // namespace af |
nothing calls this directly
no test coverage detected