-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL] Fix one more bug in int-header generation #20706
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,11 +23,18 @@ struct Bar {}; | |
| template<typename T1> | ||
| using BarUsing = Bar<T1, float>; | ||
|
|
||
| template<typename T1, typename T2> | ||
| using BarUsing2 = Bar<Foo<T2>, T1>; | ||
|
|
||
| class Baz { | ||
| public: | ||
| using type = BarUsing<double>; | ||
| }; | ||
|
|
||
| template <typename T1, typename T2, typename T3 = BarUsing2<T1, T2>, | ||
| typename T4 = BarUsing<T2>> | ||
| struct AliasAsDefaultArg {}; | ||
|
|
||
| } // namespace ns | ||
|
|
||
| [[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 2)]] | ||
|
|
@@ -57,7 +64,25 @@ template void bar_using(ns::BarUsing<int>); | |
|
|
||
| // CHECK: template <typename T> void bar_using(ns::Bar<T, float>); | ||
|
|
||
| template<typename T1, typename T2> | ||
| [[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 2)]] | ||
| void bar_using2(ns::BarUsing2<T1, T2> Arg) {} | ||
| template void bar_using2(ns::BarUsing2<int, float>); | ||
|
|
||
| // CHECK: template <typename T1, typename T2> void bar_using2(ns::Bar<ns::Foo<T2>, T1>); | ||
|
|
||
| [[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 2)]] | ||
| void baz_type(ns::Baz::type Arg) {} | ||
|
|
||
| // CHECK: void baz_type(ns::Bar<double, float> Arg); | ||
|
|
||
| #if 0 | ||
| // This test case fails, but it is added here in advance to add a record of a | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note for reviewers: this is an additional test case that I came up with, it was not (at least yet) reported by any customer. I do have a work-in-progress patch for it, but it requires bigger changes to address. I'm adding the known failing test case right now, proceeding with the simpler patch to unblock the reporter. The extra issue that I found will be addressed in a separate PR |
||
| // known bug. | ||
| template<typename T1, typename T2> | ||
| [[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 2)]] | ||
| void alias_as_default_template_arg(ns::AliasAsDefaultArg<T1, T2> Arg) {} | ||
| template void alias_as_default_template_arg(ns::AliasAsDefaultArg<int, float>); | ||
|
|
||
| // CHECK-DISABLED: template <typename T1, typename T2> void alias_as_default_template_arg(ns::AliasAsDefaultArg<T1, T2, ns::Bar<ns::Foo<T2>, T1>, ns::Bar<T2, float>>); | ||
| #endif | ||
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.
Does that work for nested aliases? i.e. alias for alias?
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.
Just a note here. Nested alias is needed for pytorch. Please check below code from https://github.com/pytorch/pytorch/blob/a7f3b10866098c452d89cd7a30bc4ce5713b8319/aten/src/ATen/core/TensorAccessor.h#L45
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.
Yes, looking at the implementation it unwraps all aliases, I've also added a test case in 99174d6