oneapi-src / unified-memory-framework

A library for constructing allocators and memory pools. It also contains broadly useful abstractions and utilities for memory management. UMF allows users to manage multiple memory pools characterized by different attributes, allowing certain allocation types to be isolated from others and allocated using different hardware resources as required.
https://oneapi-src.github.io/unified-memory-framework/
Other
37 stars 28 forks source link

Expose memspace and policy API for managing host memory #230

Open igchor opened 9 months ago

igchor commented 9 months ago

A memspace is an ordered collection of one or more memory targets. It can represent a certain class of memory sources like all NUMA nodes in the system or contain memory targets with different properties (e.g., latency).

A memory target represents a single memory source (e.g., NUMA node) and can have certain attributes (e.g., capacity).

Memspaces to expose (should be exposed as functions or a single function accepting an enum to avoid problems with exporting variables on windows):

Memspace attributes to expose:

Memspace management API:

All memspaces should be a part of libumf (not separate libraries).

Memspace, along with a policy, can be used to create pools and providers (umfPoolCreateFromMemspace and umfMemoryProviderCreateFromMemspace). Implementation of umfPoolCreateFromMemspace should select the best-suited pool based on memspace and policy type and availability of memory pools.

Policies to expose:

Optional:

bratpiorka commented 8 months ago

@igchor @vinser52 How we should name the default memspace (one that contains all available NUMA nodes)? "host" or "default"? Should we add an additional, dram-only memspace "REGULAR" (named as in the Memkind - "Regular means general purpose memory from the NUMA nodes containing CPUs")? What about HUGETLB and KMEM_DAX?

igchor commented 8 months ago

@igchor @vinser52 How we should name the default memspace (one that contains all available NUMA nodes)? "host" or "default"? Should we add an additional, dram-only memspace "REGULAR" (named as in the Memkind - "Regular means general purpose memory from the NUMA nodes containing CPUs")? What about HUGETLB and KMEM_DAX?

I think the 'default' is fine - as was agreed on the PR.

vinser52 commented 8 months ago

Do we want to implement the same set of predefined memspaces like we have in Memkind (as kinds)? My current understanding is that kind in Memkind incapsulates memory storage and policy. So the set of memspaces in UMF will be smaller than a set of kinds. We can start from reviewing what we have in memkind and decide on naming schema for memspaces.

How we should name the default memspace (one that contains all available NUMA nodes)? "host" or "default"?

To be honest both names are not obvious or descriptive. Maybe "host_all"? choosing between "host" or "default" I prefer "default".

Should we add an additional, dram-only memspace "REGULAR" (named as in the Memkind - "Regular means general purpose memory from the NUMA nodes containing CPUs")?

I think yes, but again naming is not descriptive. Need to think about better name.

What about HUGETLB and KMEM_DAX?

Agree with @igchor about HUGETLB. Regarding KMEM_DAX, as a first step we agreed to have only predefined memspaces (so we cannot filter from DEFAULT). In general, I think we should focus on OpenMP use cases and expose memspaces needed for them.