Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose umfMemoryTrackerGetAllocInfo #686

Open
igchor opened this issue Aug 16, 2024 · 1 comment
Open

Expose umfMemoryTrackerGetAllocInfo #686

igchor opened this issue Aug 16, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@igchor
Copy link
Member

igchor commented Aug 16, 2024

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

@igchor igchor added the enhancement New feature or request label Aug 16, 2024
@vinser52
Copy link
Contributor

I agree with the problem description. UMF tacker has all the required information and UR can ask UMF instead of L0 and UMF should perform better than L0.
Regarding the solution, we should design the API before implementing it - need to discuss if exposing umfMemoryTrackerGetAllocInfo is the best way (perhaps yes). As a first, we need to capture all relevant use cases and their requirements, e.g. MPI needs functionality to get allocation properties. We will schedule this topic at UMF technical meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants