Skip to content

Fix eager compilation with signature for dppy.kernel #291

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 20 commits into from
Jun 6, 2021

Conversation

reazulhoque
Copy link
Contributor

@reazulhoque reazulhoque commented Mar 23, 2021

Closes #75

This will fix the seg-fault issue when signature was provided with dppy.kernel.

Eager compilation is still Just-In-Time compilation. Instead of the compilation happening at the call site it happens at the definition site. We have caching mechanism for already compiled kernels that takes the SYCL queue in account. This
mechanism can be potentially used to recompile a kernel that has been compiled for a different backend (Sycl queue).

Steps taken to fix this:

  • Make sure when we provide signature, that triggers the eager compilation, we go through the existing caching mechanism. If the Sycl queue is consistent we simply launch the kernel in other cases we recompile for the given queue.

Copy link
Contributor

@PokhodenkoSA PokhodenkoSA left a comment

Choose a reason for hiding this comment

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

Please fix CI on Windows.

Copy link
Contributor

@PokhodenkoSA PokhodenkoSA left a comment

Choose a reason for hiding this comment

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

Can we test AOT somehow?

@reazulhoque reazulhoque changed the title Enable AOT with signature for dppy.kernel Enable eager compilation with signature for dppy.kernel Mar 24, 2021
@reazulhoque reazulhoque changed the title Enable eager compilation with signature for dppy.kernel [WIP] Enable eager compilation with signature for dppy.kernel Apr 1, 2021
@reazulhoque reazulhoque changed the title [WIP] Enable eager compilation with signature for dppy.kernel Enable eager compilation with signature for dppy.kernel Apr 1, 2021
@PokhodenkoSA
Copy link
Contributor

@reazulhoque please merge with main. It will fix black.

Copy link
Contributor

@PokhodenkoSA PokhodenkoSA left a comment

Choose a reason for hiding this comment

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

I am continuing to review.

Copy link
Contributor

@PokhodenkoSA PokhodenkoSA left a comment

Choose a reason for hiding this comment

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

Much better. I have made remarks with useful links describing how to make better.

@@ -31,11 +32,28 @@ def filter_str(request):
return request.param


def skip_if_win():
if sys.platform in ["win32", "cygwin"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The question directs to an already answered question which suggests sys.platform.

Copy link
Contributor

Choose a reason for hiding this comment

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

platform.system() == "Windows"

@PokhodenkoSA
Copy link
Contributor

PokhodenkoSA commented Jun 2, 2021

This PR does not fix #75. Because the test uses func.specialize(..., gpu_queue) and the issue have another scenario.
@reazulhoque you should provide test like in issue to prove that the issues is fixed.

@reazulhoque
Copy link
Contributor Author

reazulhoque commented Jun 2, 2021

@PokhodenkoSA, this PR solves #75. There are multiple tests that needed to be updated, which test are you talking about when you mention func.specialize(..., gpu_queue)?

I have updated tests with signatures that will trigger eager compilation. I asked Numba team specifically if they have tests for eager compilation and they mentioned they do not. I decided to not write specific tests following that conversation.

When I add signature to @dppy.kernel in exisiting test it follows the example I have provided in #75. Tests I have updated to make sure eager compilation is working:

  1. https://github.com/IntelPython/numba-dppy/pull/291/files#diff-b7c075c42e2cbadf69e707181714af75c0c8a705a806e2e2f71345253fc7af73R56
  2. https://github.com/IntelPython/numba-dppy/pull/291/files#diff-b7c075c42e2cbadf69e707181714af75c0c8a705a806e2e2f71345253fc7af73R81
  3. https://github.com/IntelPython/numba-dppy/pull/291/files#diff-b7c075c42e2cbadf69e707181714af75c0c8a705a806e2e2f71345253fc7af73R108

@PokhodenkoSA
Copy link
Contributor

I agree with test changes. Need CI fix and use platform.system().

@PokhodenkoSA PokhodenkoSA merged commit cde375f into IntelPython:main Jun 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make sure consistent Sycl queue is being used in eager compilation case
3 participants