Skip to content

[SYCL][Doc] Add sycl_ext_oneapi_register_host_memory extension spec#22324

Open
againull wants to merge 4 commits into
syclfrom
register_memory_spec
Open

[SYCL][Doc] Add sycl_ext_oneapi_register_host_memory extension spec#22324
againull wants to merge 4 commits into
syclfrom
register_memory_spec

Conversation

@againull

Copy link
Copy Markdown
Contributor

Add an experimental extension specification for registering existing host/system memory with the SYCL runtime so that it behaves like a USM host allocation: usable from device code, queryable via get_pointer_type, and faster for explicit copies. The memory is released via unregister_host_memory rather than sycl::free.

Co-Authored-By: Greg Lueck gregory.m.lueck@intel.com

Assisted-By: Claude

Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
@againull againull force-pushed the register_memory_spec branch from 74a7ce3 to 56b5bf1 Compare June 16, 2026 16:10
Add an experimental extension specification for registering existing
host/system memory with the SYCL runtime so that it behaves like a USM
host allocation: usable from device code, queryable via get_pointer_type,
and faster for explicit copies. The memory is released via
unregister_host_memory rather than sycl::free.

Co-Authored-By: Greg Lueck <gregory.m.lueck@intel.com>

Assisted-By: Claude
@againull againull force-pushed the register_memory_spec branch from 56b5bf1 to 2e23afc Compare June 16, 2026 18:28

[NOTE]
====
An implementation-provided validation or debug layer may optionally track

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: some diagnostics are intentionally optional. My current thinking is to implement overlap and invalid-unregistration checks in the UR validation layer rather than in the normal runtime path. That avoids adding registration tracking and associated overhead for all applications just to provide unified error reporting. It also gives us a single place to handle backend differences, since native backends do not necessarily behave the same way in these cases.

@againull againull marked this pull request as ready for review June 16, 2026 19:31
@againull againull requested a review from a team as a code owner June 16, 2026 19:31
@sys-ce-bb

Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated

@gmlueck gmlueck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a few more comments on some specific wording.

Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
range must additionally be writable by the application for the lifetime of
the registration.
* The range `[ptr, ptr + numBytes)` does not overlap any range that is
currently registered through this extension for the same context.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a precondition something like:

  • The memory range is one of the following storage durations: heap memory, automatic (stack), or static (global) storage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I think this may be too restrictive. I think, probably the existing first precondition that the range is valid host memory mapped into the host address space is sufficient.
For example, if I am not mistaken memory obtained via mmap() is neither heap, stack, nor static storage, but it should still be a valid candidate for registration. E.g. the upcoming update to Level Zero spec states:
Any host pointer may be passed, including heap, stack, and statically-allocated (global) storage.
Please correct me if I am wrong.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah! I was also thinking about the mmap case. Are you sure Level Zero can register such pages? I think the proposed updates to the Level Zero spec do not clearly state that this is allowed. I asked to have this clarified in the internal tracker. Let's see what the response is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thank you!

Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated

@gmlueck gmlueck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better! A couple small comments below.

Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
Comment thread sycl/doc/extensions/proposed/sycl_ext_oneapi_register_host_memory.asciidoc Outdated
cannot be registered by the implementation.

[_Note:_ This extension does not provide a query for the host page size. It can
be obtained using operating system APIs such as `+sysconf(_SC_PAGESIZE)+` on

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, One minor question, _SC_PAGESIZE looks only for host standard 4K page. what about host huge page?

@sys-ce-bb

Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants