oneapi-src / oneapi-src/unified-memory-framework

Implement 'segment_array' that allocates memory using ba_alloc

Open
#529 2 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.