Skip to content

[SYCL][PI][L0] Fixes to make sure kernels and programs cannot be destroyed before they have finished execution. #2710

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

Merged
merged 9 commits into from
Nov 3, 2020

Conversation

kbsmith-intel
Copy link
Contributor

@kbsmith-intel kbsmith-intel commented Oct 29, 2020

So, here’s requirements from summary of level zero spec:

1 – cannot do zeKernelDestroy until all commands using the kernel have completed execution as measured by their event or fence being signaled.
2 – The application must destroy all kernel and build log handles created from the module before destroying the module itself (zeModuleDestroy)

So, here is a design I think will work.

1 – We want to do a piKernelRetain sometime before kernel is appended to command-list in piEnqueueKernelLaunch. The intent is that we will do a piKernelRelease once the Event that we create to be associated with the Enqueued Kernel is signaled/released. The handle of kernel to be released will be stored in the event.

2 – Event currently contains fields for CommandType and CommandData, and for the CommandType that piEnqueueKernelLaunch uses, CommandData is currently unused. So, for this case, we will set CommandData to be the Kernel, so then when the event is signaled as done, then we can use the kernel we stored in CommandData, we can do piKernelRelease(CommandData).

3 – I think in piKernelRetain, we also need to call piProgramRetain on the program that the kernel is part of, and we need piKernelRelease to call piProgramRelease. This is necessary to make sure we do not destroy the program before destroying all the kernels that may be in use from the program.

4 – in the destructor for pi_program, we need to destroy the build log before we destroy the program itself.

kbsmith-intel and others added 7 commits October 6, 2020 14:39
Pull to update my local fork
updating fork from main
update fork to sycl head
Updating fork to head of sycl.
Update to sycl head.
Copy link
Contributor

@smaslov-intel smaslov-intel left a comment

Choose a reason for hiding this comment

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

LGTM overall, see comments and also:

  1. add important design notes to description for history
  2. add a test

@kbsmith-intel
Copy link
Contributor Author

I think I have addressed all your review comments and I have added the basic design notes in the original comment. I still need to add a test, but please review the revised code while I work on adding a test. Thank you.

@romanovvlad romanovvlad merged commit b9bf9f5 into intel:sycl Nov 3, 2020
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Nov 6, 2020
* upstream/sycl:
  [SYCL] Move tests with dependencies to on-device directory (intel#2732)
  [SYCL][Test] Remove leftovers for FPGA archives (intel#2735)
  [SYCL][NFC] Extend ABI tests to cover device code (intel#2725)
  [SYCL] Fix link to ESIMD tests (intel#2736)
  Added the SYCL_INTEL_mem_channel_property extension specification (intel#2688)
  [SYCL] Add support for new FPGA loop attribute nofusion (intel#2715)
  [SYCL] Remove host-task-dependency test added to llvm-test-suite (intel#2720)
  [SYCL] Remove warning about SYCL_EXTERNAL with pointers (intel#2722)
  [SYCL] dot_product support. (intel#2609)
  [SYCL][PI][L0] Fix a problem with kernels and programs destruction while they can be used (intel#2710)
  [SYCL] Fix the check for read-only host pointer during memobj creation (intel#2697)
kbenzie pushed a commit to kbenzie/intel-llvm that referenced this pull request Feb 18, 2025
…pare_baseline

add comparing to baseline in benchmark workflow
Chenyang-L pushed a commit that referenced this pull request Feb 18, 2025
…baseline

add comparing to baseline in benchmark workflow
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