Use unified helper functions for creating and destroying OpenCL buffers/mappings - and/or for re-introducing CUDA
Open
Nobody has claimed this yet.
enhancement
maintenance/cleanup
- Dominant language
- C
- Stars
- 13.6k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Many formats have variants of this:
#define CLCREATEBUFFER(_flags, _size) \
clCreateBuffer(context[gpu_id], _flags, _size, NULL, &cl_error); \
HANDLE_CLERROR(cl_error, "Error allocating GPU memory");
#define CLKERNELARG(kernel, id, arg) \
HANDLE_CLERROR(clSetKernelArg(kernel, id, sizeof(arg), &arg), \
"Error setting kernel argument");
(...)
We should have such macros in opencl_common.h and use them everywhere. They can have memory-leak detection like my debug macros for #4354 (could in fact be in place all the time, not just for debugging).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading opencl_common.h and comparing the format-specific buffer and mapping macros described in the issue. Review the debug macros from #4354 and determine the intended common interface and leak-detection behavior. Done means the relevant OpenCL paths use unified helpers, with any CUDA reintroduction scope explicitly settled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100