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

Expose umfMemoryTrackerGetAllocInfo

Open
#686 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C
Stars
98
Forks
48
Avg merge
3d 20h
Merged PRs (30d)
6

Description

Expose a function that returns information about coarse-grain allocations, including:

  • size
  • base address

Rationale

UR validation layer uses urUSMGetMemAllocInfo to obtain information about size and base address for an allocation to do bounds checking: https://github.com/oneapi-src/unified-runtime/blob/main/source/loader/layers/validation/ur_validation_layer.cpp#L41 For L0 adapters, urUSMGetMemAllocInfo gets this information by asking the driver which is costly: https://github.com/oneapi-src/unified-runtime/blob/d61cf6680c7f620bd5092e2bb22524106fbdef63/source/adapters/level_zero/usm.cpp#L621

We should expose a function that would allow users to query this information directly from UMF.

API Changes

struct umf_alloc_info_t {
   void* baseAddr;
   size_t size;
   umf_memory_pool_handle_t hPool;
};

umf_result_t umfGetAllocInfo(void *ptr, umf_alloc_info_t* info);

Implementation details

Use umfMemoryTrackerGetAllocInfo

Meta

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.

Research direction

Start by reading the existing umfMemoryTrackerGetAllocInfo implementation and the public API conventions in the UMF source. Compare its required allocation details with the calls in source/loader/layers/validation/ur_validation_layer.cpp and source/adapters/level_zero/usm.cpp. Done means the proposed umf_alloc_info_t and umfGetAllocInfo API expose the requested size and base address, with relevant tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.