-
Notifications
You must be signed in to change notification settings - Fork 768
[SYCL-MLIR] Handle types not in the dialect but in the sycl namespace #7706
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
Conversation
Can you elaborate the description. It would help to understand the motivation for the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sycl namespace should be reserved for the sycl runtime library, in a similar way as the std namespace is reserved for the standard library. IMO the motivating example is invalid.
It kinda is, but this does not change the fact that DPC++ or even other implementations we might want to support in the future will add/remove types in the |
I think that when a new type is added to the SYCL runtime, we might want to handle it. So, IMO is better to get an assertion from the compiler that silently falling through. Having an assertion triggered forces us to make a conscious decision. For that reason I prefer to place this code under an option, disabled by default. Maybe another way to think about this is to compare it to the |
So, let's say DPC++ completely changes the implementation (we're not talking about types in the SYCL standard here) of Also, let's say we want to support other implementation in the future. Would we have to define every implementation type there also?
I'd argue implementation details are not an unexpected condition, but an irrelevant detail to us. |
How about we only do this for |
I think we can discuss this offline at this point and record here the decision the team makes. We need to draw the line in the sand and decide whether we want to implement:
As for the argument about defining new types and their impact on optimizations: we do not know at this point whether defining a type in the dialect will directly yield an optimization opportunity, however, just lowering information to the lower level from the start does not seem (to me) the preferred design direction. It is true that we can always remedy later (i.e. decide later we need a type defined in the sycl dialect because we have found an opt. opportunity), but I think is best to come up with a design sensible rule up front and follow that rule. I do not quite follow the argument about supporting a completely different implementation either. The public interface of the SYCL runtime ought to be stable, this does not mean it will not change in the future, but it does mean that the public interface cannot regress existing applications using it. Additions to the RT are possible and probably likely, an I see it as completely natural that when changes to the public interface of the RT happen we ought to also augment the SYCL dialect. I agree that the details (sycl::detail) part of the runtime should not to be relied upon by end users or other component in the compiler. I think is reasonable (and desired) that, when a new public type in the SYCL RT interface is added, and it is used the dialect will assert (so that the SYCL dialect can be augmented with the new public type). Is also reasonable to provide an option to suppress that behavior. I might be misunderstanding some points though, so let's discuss and report here once we have made a decision the team can live with. |
I think we can discuss in the meeting today and get to a compromise we can all agree on. Thanks for your comments, @whitneywhtsang, @etiotto |
Offline conversation:
Note: This is a temporal solution. Will evolve in the future. |
b691bf0
to
3c3127a
Compare
Check whether we are handling a given function beforehand by checking the argument types. Signed-off-by: Victor Perez <victor.perez@codeplay.com>
a5c627a
to
def3d9f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several suggestions left inline
Since #7706, we decided to not add types under `sycl::detail` namespace in SYCL dialect. So `sycl::detail::Boolean` is represented as llvm structure of vector type. Pointer of struct is represented as `llvm.ptr<struct<...>>`, instead of `memref<?xstruct<...>>`. Accessing element of the struct uses `llvm.getelementptr`, which produces `llvm.ptr`. If an element of the struct is `vector`, then pointer to it would be `llvm.ptr<vector>`. Pointer of SYCL type is represented as `memref<?x!sycl...>`. Accessing element of the SYCL type uses `polygeist.subindex`, which produces `memref`. If an element of the SYCL type is `vector`, e.g., `!sycl.vec`, then pointer to it would be `memref<vector>`. We need to modify some code that does vector handling, as `llvm.ptr<vector>` is possible. Signed-off-by: Tsang, Whitney <whitney.tsang@intel.com>
If a type in the
sycl
namespace, but not in theSYCL
dialect is found and the new-allow-undefined-sycl-types
is unset, fail straight away.Check the first type of a constructor call is in our dialect before generating a
sycl.constructor
call; generate asycl.call
otherwise.Also check this before trying to register
SYCLMethodOpInterface
instances.Signed-off-by: Victor Perez victor.perez@codeplay.com