Skip to content

[SYCL][PI][L0] Skip modules without kernel inside when creating target kernel on L0 #3614

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
May 14, 2021

Conversation

jinge90
Copy link
Contributor

@jinge90 jinge90 commented Apr 26, 2021

On L0 backend, we iterate all models in a pi_program, for each module, we call zeKernelCreate. If the call fails due to some error other than "ze invalid kernel name", the kernel creation will fail and current program will abort.
However, this logic assume that all modules in the pi_program will have some kernel inside. If we enable SYCL device library "online" link based on piProgramLink, the assumption will be broken. At that time, the pi_program will include some modules from device library without any kernel inside(they are used to resolve undefined symbol in user's image), if we call zeKernelCreate for those module, the return value is "ze invalid argument" instead of "ze invalid kernel name". Suppose under such circumstance, the pi_program includes 2 modules, mod1 for device library without any kernel and mod2 for user's device image with target kernel, we will firstly try to zeKernelCreate for mod1 and the API returns with error "ze invalid argument", then the program will abort but in fact, we can create the target kernel with mod2.
This PR will skip all modules without any kernel inside before trying to call zeKernelCreate for them, this is done by using zeModuelGetKernelNames to query the number of kernel names in module, if kernel name num is 0, we skip it.
Thanks very much.

@jinge90 jinge90 requested a review from smaslov-intel as a code owner April 26, 2021 04:01
@jinge90
Copy link
Contributor Author

jinge90 commented Apr 26, 2021

/summary:run

@jinge90 jinge90 requested a review from gmlueck April 28, 2021 01:07
@jinge90
Copy link
Contributor Author

jinge90 commented Apr 29, 2021

/summary:run

@jinge90 jinge90 requested a review from gmlueck April 29, 2021 07:32
gmlueck
gmlueck previously approved these changes Apr 29, 2021
Copy link
Contributor

@gmlueck gmlueck left a comment

Choose a reason for hiding this comment

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

LGTM

@jinge90
Copy link
Contributor Author

jinge90 commented Apr 30, 2021

/summary:run

@jinge90
Copy link
Contributor Author

jinge90 commented May 6, 2021

Hi, @smaslov-intel
Could you help to review this PR?
Thanks very much.

@jinge90
Copy link
Contributor Author

jinge90 commented May 6, 2021

/summary:run

@@ -17,16 +17,15 @@
#include <cstdarg>
#include <cstdio>
#include <cstring>
#include <level_zero/zes_api.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you move these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran clang-format to the file before uploading the patch, it should be moved by the format tool.
Thanks very much.

Copy link
Contributor

Choose a reason for hiding this comment

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

can you please put them back, perhaps using comments that shut of clang-format
it is weird to have them in the middle of STL includes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @smaslov-intel
I just reverted the unnecessary header file change, could you please help approve again?
Thanks very much.

Signed-off-by: gejin <[email protected]>
@jinge90 jinge90 requested a review from smaslov-intel May 12, 2021 01:10
smaslov-intel
smaslov-intel previously approved these changes May 12, 2021
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.

Just a NIT formatting ask

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.

4 participants