Skip to content

[SYCL] Fix handling of structs with trailing padding in SpecConstants pass #10211

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 3 commits into from
Jul 14, 2023

Conversation

AlexeySachkov
Copy link
Contributor

@AlexeySachkov AlexeySachkov commented Jul 5, 2023

This patch fixes a regression accidentally introduced in #9874 (presumably because we didn't have the right test).

SYCL-CTS produces an LLVM IR pattern, where spec constant initializer contains less elements than there are in a spec constant type, because some of those elements are implicitly-created paddings. The patch updates the pass to handle this situation.

Note: this PR only covers a case when padding is inserted at the end of a struct.

Resolves #10129

This patch fixes a regression accidentally introduced in intel#9874
(presumably because we didn't have the right test).

SYCL-CTS produces an LLVM IR pattern, where spec constant initializer
contains less elements than there are in a spec constant type, because
some of those elements are implicitly-created paddings. The patch
updates the pass to handle this situation.

Resolves intel#10129
@AlexeySachkov AlexeySachkov requested review from a team as code owners July 5, 2023 13:15
@AlexeySachkov
Copy link
Contributor Author

@intel/sycl-language-enabling-triage: FYI

@AlexeySachkov AlexeySachkov temporarily deployed to aws July 5, 2023 14:37 — with GitHub Actions Inactive
@AlexeySachkov AlexeySachkov temporarily deployed to aws July 5, 2023 15:43 — with GitHub Actions Inactive
@asudarsa
Copy link
Contributor

asudarsa commented Jul 9, 2023

Hi @maksimsab

Can you please take a look at this PR?

Thanks

Copy link
Contributor

@KseniyaTikhomirova KseniyaTikhomirova left a comment

Choose a reason for hiding this comment

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

test sycl/test-e2e/SpecConstants/2020/non-packed-struct.cpp LGTM. compiler part is out of my expertise

@AlexeySachkov
Copy link
Contributor Author

@intel/dpcpp-tools-reviewers, @maksimsab, could you please take a look?

@maksimsab
Copy link
Contributor

Looking into it.

@maksimsab
Copy link
Contributor

@AlexeySachkov
I can see the following type case in the test: type <{ float, i32, i8, [3 x i8] }>.
Does it worth to also consider the case like this: type <{ i32, i8, [3 x i8], i8, [3 x i8] }> ? Here we have a padding not only in the end, but in the middle of the struct as well.

@AlexeySachkov
Copy link
Contributor Author

@AlexeySachkov I can see the following type case in the test: type <{ float, i32, i8, [3 x i8] }>. Does it worth to also consider the case like this: type <{ i32, i8, [3 x i8], i8, [3 x i8] }> ? Here we have a padding not only in the end, but in the middle of the struct as well.

Good point, let me add a test like this to see if there are more problems related to paddings

@AlexeySachkov
Copy link
Contributor Author

@AlexeySachkov I can see the following type case in the test: type <{ float, i32, i8, [3 x i8] }>. Does it worth to also consider the case like this: type <{ i32, i8, [3 x i8], i8, [3 x i8] }> ? Here we have a padding not only in the end, but in the middle of the struct as well.

Good point, let me add a test like this to see if there are more problems related to paddings

@maksimsab, we indeed don't support the case when padding is embedded into a structure and it causes crash on assertion. However, I would like to proceed with the current PR as-is, if possible, because it unblocks build of SYCL-CTS specialization constant tests. Apparently, the new case you have suggested is not tested by CTS and I think that it therefore should be ok to address it in a separate PR.

@AlexeySachkov AlexeySachkov changed the title [SYCL] Fix handling of non-packed structs in SpecConstants pass [SYCL] Fix handling of structs with trailing padding in SpecConstants pass Jul 14, 2023
Copy link
Contributor

@maksimsab maksimsab left a comment

Choose a reason for hiding this comment

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

LGTM

@AlexeySachkov AlexeySachkov merged commit 833a9fe into intel:sycl Jul 14, 2023
@AlexeySachkov AlexeySachkov deleted the private/asachkov/fix-10129 branch May 22, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DPC++ compiler crashes during SYCL-CTS test build.
4 participants