oneapi-src / oneapi-src/unified-memory-framework
Implement 'segment_array' that allocates memory using ba_alloc
Open
@igchor is already working on this.
Since Oct 25, 2024.
enhancement
- Dominant language
- C
- Stars
- 98
- Forks
- 48
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 6
Description
Rationale
It is needed whenever we want to allocate an array (e.g. in memspaces) using ba_alloc with a fixed-sized pool.
API Changes
The API could be something like this:
#define SEGMENT_DECLARE(type, num_elems) struct segment_#type#_#num_elems#_t { \
type elems[num_elems]; \
struct segment_t *next; \
};
#define SEGMENT(type, size) (struct segment_#type#_#num_elems#_t)
void segment_array_create(ba_alloc alloc, size_t segmentSize, size_t numSegments);
#define SEGMENT_CREATE(alloc, type, num_elements) ((SEGMENT(type, num_elements)*) segment_array_create(alloc, sizeof(type) * num_elements + 8, 1));
void segmentArrayDestroy(ba_alloc* alloc);
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.
Assessment
This issue has not been assessed yet.