Skip to content
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

Feature/add python object createion for unboxing sycl event and queue #1193

Conversation

ZzEeKkAa
Copy link
Contributor

@ZzEeKkAa ZzEeKkAa commented Oct 27, 2023

Add python object creation if dpctl.SyclEvent or dpctl.SyclQueue where allocated in dpjit function.

Closes: #1181
Closes: #1182
Closes: #1183

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • If this PR is a work in progress, are you filing the PR as a draft?

@ZzEeKkAa ZzEeKkAa self-assigned this Oct 27, 2023
@ZzEeKkAa ZzEeKkAa force-pushed the feature/add_python_object_createion_for_unboxing_sycl_event_and_queue branch from 91e6a57 to cccf948 Compare October 30, 2023 19:25
@ZzEeKkAa ZzEeKkAa force-pushed the feature/add_python_object_createion_for_unboxing_sycl_event_and_queue branch from cccf948 to 45c189d Compare October 30, 2023 23:01
@ZzEeKkAa ZzEeKkAa enabled auto-merge October 31, 2023 16:14
b = func(a)

assert b is not None
assert b.sycl_queue is not None
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also be able to assert b.sycl_queue == a.sycl_queue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will fail then. I don't know how to add just one assert as expected failure

Copy link
Contributor

Choose a reason for hiding this comment

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

Why will it fail? The __eq__ of the dpctl.SyclQueue class just calls the DPCTLQueue_Equal function that should evaluate to true if the qref pointers point to the same underlying sycl::queue object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We must be more specific. It suppose to be same object. Marked test as XFAIL.


assert q is not None
assert isinstance(q, SyclQueue)
assert id(q) == id(arr.sycl_queue) # this must work after dpjit fix
Copy link
Contributor

Choose a reason for hiding this comment

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

Only the last assert is xfail right? The other asserts should pass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, is there a way to achieve it?

Copy link
Contributor

Choose a reason for hiding this comment

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

You will have to write two separate test cases.

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've been thinking about what test should actually check and updated tests a little bit. So this one is always pass, and another one is failing. Thx

@ZzEeKkAa ZzEeKkAa disabled auto-merge October 31, 2023 21:35
@ZzEeKkAa ZzEeKkAa force-pushed the feature/add_python_object_createion_for_unboxing_sycl_event_and_queue branch from 45c189d to 159c698 Compare November 1, 2023 16:56
@ZzEeKkAa ZzEeKkAa force-pushed the feature/add_python_object_createion_for_unboxing_sycl_event_and_queue branch from 57885a0 to f46e145 Compare November 1, 2023 18:12
a = dpnp.empty(10)
b = func(a)

assert a.sycl_queue == b.sycl_queue
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

@diptorupd diptorupd left a comment

Choose a reason for hiding this comment

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

Thank you!

@diptorupd diptorupd merged commit ac05c1a into main Nov 1, 2023
12 checks passed
@diptorupd diptorupd deleted the feature/add_python_object_createion_for_unboxing_sycl_event_and_queue branch November 1, 2023 18:32
github-actions bot added a commit that referenced this pull request Nov 1, 2023
…reateion_for_unboxing_sycl_event_and_queue

Feature/add python object createion for unboxing sycl event and queue ac05c1a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants