-
Notifications
You must be signed in to change notification settings - Fork 108
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
It is not possible to copy struct containing array member into kernel lambda [crash] #860
Comments
I can reproduce this crash on 1.9.0. The error is printed but then it crashes. Not much of a surprise that struct is not working. Best to stick to array views or maybe basic types I think. |
Structs are working normally and must work in other case hc::array_view and hc::index would not work as they are structs. Struct containing simple C++ array with few elements is not working. Same crash happens when using C++ array directly or fixed size std::array. So this struct is not working: struct S
{
int s[5];
}; But this yes: struct S
{
int s0;
int s1;
int s2;
int s3;
int s4;
}; |
If I remember correctly HCC doesn't support passing structs with array fields as kernel args. And this behavior was mentioned somewhere in docs but I can't find it anymore. Workaround are very similar to what you do (pass individual fields and rebuild the array if you need it) or use custom serializer and deserializer. |
Oh, I've found the doc. It's actually from HIP, but this chapter was removed from there because HIP has different kernel launching implementation now. Here the old version: https://github.com/ROCm-Developer-Tools/HIP/blob/91f82ce541b51ad1106a28e951b410a256e61f62/docs/markdown/hip_bugs.md#errors-related-to-no-matching-constructor And an example from tests: I think this should be mentioned somewhere in HCC docs. |
There is bug in compiler. It should not crash. I do not see any reason why they should not be supported. Imagine array with 20 elements instead of 5. Then individual fields or custom serializer/deserializer are impractical. |
2937: hip: fully fix build r=RudolfWeeber a=mkuron Fixes #2901. Fixes #2906. @KaiSzuttor I know it's an ugly workaround, but it's the best I could come up with. You can't use variadic template functions here. Workaround from https://github.com/ROCm-Developer-Tools/HIP/blob/91f82ce541b51ad1106a28e951b410a256e61f62/docs/markdown/hip_bugs.md#errors-related-to-no-matching-constructor, found via ROCm/hcc#860 Hopefully the underlying bug goes away once AMD drops HCC and uses Clang directly. Co-authored-by: Kai Szuttor <[email protected]> Co-authored-by: Michael Kuron <[email protected]> Co-authored-by: Florian Weik <[email protected]>
This prints compile errors and causes compiler to crash:
The text was updated successfully, but these errors were encountered: