Skip to content

Conversation

@igchor
Copy link
Contributor

@igchor igchor commented Mar 10, 2025

No description provided.

@igchor igchor requested a review from a team as a code owner March 10, 2025 11:34
@igchor igchor temporarily deployed to WindowsCILock March 10, 2025 11:35 — with GitHub Actions Inactive
This patch fixes undefined behavior when freeing memory that might
still be in use. Using regular zeMemFree (as was done before this
change) is unsafe. L0 spec says that for zeMemFree, the application
must ensure the device is not referencing memory before it is freed.

SYCL sets 'indirect access' flag for every kernel. This means
that each kernel can potentially access any memory and hence it is
unsafe to free any memory allocation during kernel execution (if that
kernel was submitted at some point in time when that allocation was
alive).

This replaces the 'indirect access tracking' mechanism used in the
legacy adapter (see https://github.com/intel/llvm/blob/4c9b19bdd8b4b95b865522d583b6252bda301d98/unified-runtime/source/adapters/level_zero/context.hpp#L153)

Related clarification in the SYCL spec: KhronosGroup/SYCL-Docs#758
@igchor
Copy link
Contributor Author

igchor commented Mar 12, 2025

@intel/llvm-gatekeepers this is ready to be merged

@kbenzie kbenzie merged commit 2975d26 into intel:sycl Mar 12, 2025
31 checks passed
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.

3 participants