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

[SYCL] Add a regression test for the crash during spec constants processing #1536

Merged
merged 1 commit into from
Apr 23, 2020

Conversation

AlexeySotkin
Copy link
Contributor

@AlexeySotkin AlexeySotkin commented Apr 16, 2020

In case a SYCL kernel captures specialization constants and more than
one accessor it crashes. I think the crash happens due to an extra
increment of KernelFuncParam, in CreateOpenCLKernelBody() method.

Signed-off-by: Alexey Sotkin alexey.sotkin@intel.com

@AlexeySotkin AlexeySotkin requested a review from kbobrovs April 16, 2020 18:34
@AlexeySotkin AlexeySotkin requested review from erichkeane, Fznamznon and a team as code owners April 16, 2020 18:34
@AlexeySotkin AlexeySotkin requested a review from s-kanaev April 16, 2020 18:34
Copy link
Contributor

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

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

Please add a clang lit test for this that validates what the IR should look like in this case.

This ends up likely being solved in the SemaSYCL rewrite but I'd like to accept some sort of this fix with some good validation tests.

@erichkeane
Copy link
Contributor

Rewrite here: #1517

@bader
Copy link
Contributor

bader commented Apr 16, 2020

Please add a clang lit test for this that validates what the IR should look like in this case.

I would suggest "rewriting" the test. I.e. removing the existing test from the runtime library project.

@AlexeySotkin
Copy link
Contributor Author

Please add a clang lit test for this that validates what the IR should look like in this case.

This ends up likely being solved in the SemaSYCL rewrite but I'd like to accept some sort of this fix with some good validation tests.

Do I really need to validate the IR if purpose of this patch is to fix a crash?

@AlexeySotkin
Copy link
Contributor Author

Please add a clang lit test for this that validates what the IR should look like in this case.

I would suggest "rewriting" the test. I.e. removing the existing test from the runtime library project.

Where exactly do you suggest to move the test?

@bader
Copy link
Contributor

bader commented Apr 17, 2020

Do I really need to validate the IR if purpose of this patch is to fix a crash?

No.

@bader
Copy link
Contributor

bader commented Apr 17, 2020

Please add a clang lit test for this that validates what the IR should look like in this case.

I would suggest "rewriting" the test. I.e. removing the existing test from the runtime library project.

Where exactly do you suggest to move the test?

You seems to fix Sema component, so it should be in clang/test/Sema*

@erichkeane
Copy link
Contributor

Please add a clang lit test for this that validates what the IR should look like in this case.
This ends up likely being solved in the SemaSYCL rewrite but I'd like to accept some sort of this fix with some good validation tests.

Do I really need to validate the IR if purpose of this patch is to fix a crash?

Yes, if the problem is that the parameters aren't being passed correctly, which causes the crash. We want our tests fine grained so that they can catch issues like this in the future while still being easy to reproduce.

@AlexeySotkin
Copy link
Contributor Author

AlexeySotkin commented Apr 20, 2020

Please add a clang lit test for this that validates what the IR should look like in this case.
This ends up likely being solved in the SemaSYCL rewrite but I'd like to accept some sort of this fix with some good validation tests.

Do I really need to validate the IR if purpose of this patch is to fix a crash?

Yes, if the problem is that the parameters aren't being passed correctly, which causes the crash. We want our tests fine grained so that they can catch issues like this in the future while still being easy to reproduce.

I think that problem is not that the parameters are being passed incorrectly. This PR fixes the crash in the Sema itself (in the same method). Without the fix I've got an out of boundary access at line 703 here

auto KFP = KernelFuncParam;
for (size_t I = 0; I < NumParams; ++KFP, ++I) {
QualType ParamType = (*KFP)->getOriginalType();
ParamDREs[I] = DeclRefExpr::Create(
S.Context, NestedNameSpecifierLoc(), SourceLocation(), *KFP,
false, DeclarationNameInfo(), ParamType, VK_LValue);
}

@AlexeySotkin AlexeySotkin force-pushed the private/ansotkin/spec-const-fix branch from e9c8acf to 4878084 Compare April 21, 2020 13:46
clang/test/SemaSYCL/spec_const_accesors.cpp Outdated Show resolved Hide resolved
clang/test/SemaSYCL/spec_const_accesors.cpp Outdated Show resolved Hide resolved
clang/test/SemaSYCL/spec_const_accesors.cpp Outdated Show resolved Hide resolved
@AlexeySotkin AlexeySotkin force-pushed the private/ansotkin/spec-const-fix branch from 4878084 to db74bf0 Compare April 22, 2020 11:41
@AlexeySotkin
Copy link
Contributor Author

Thank you all for your review. I think I have resolved all your comments with my latest commit.

@bader
Copy link
Contributor

bader commented Apr 22, 2020

Thank you all for your review. I think I have resolved all your comments with my latest commit.

Please, mark resolved comments using "Resolve conversation" button.

@AlexeySotkin AlexeySotkin force-pushed the private/ansotkin/spec-const-fix branch from db74bf0 to adc06b2 Compare April 22, 2020 13:45
erichkeane
erichkeane previously approved these changes Apr 22, 2020
bader
bader previously approved these changes Apr 22, 2020
@bader bader requested review from Fznamznon and erichkeane April 22, 2020 13:57
erichkeane
erichkeane previously approved these changes Apr 22, 2020
@bader
Copy link
Contributor

bader commented Apr 22, 2020

@AlexeySotkin, I just merged PR conflicting with these changes. Could you resolve the merge conflicts, please?

@erichkeane
Copy link
Contributor

erichkeane commented Apr 22, 2020

@AlexeySotkin, I just merged PR conflicting with these changes. Could you resolve the merge conflicts, please?

Hopefully the solution to it is simply to 'delete' the changes in this patch in SemaSYCL and make sure that the tests still pass. If not, @Fznamznon and I can help.

Fznamznon
Fznamznon previously approved these changes Apr 22, 2020
Clang used to crash in case SYCL kernel captures a specialization constant
before an accessor. The tests checks that the crash is fixed.

Signed-off-by: Alexey Sotkin <alexey.sotkin@intel.com>
@AlexeySotkin AlexeySotkin dismissed stale reviews from Fznamznon, erichkeane, and bader via 915ac0e April 23, 2020 12:59
@AlexeySotkin AlexeySotkin force-pushed the private/ansotkin/spec-const-fix branch from 3fef4c1 to 915ac0e Compare April 23, 2020 12:59
@AlexeySotkin
Copy link
Contributor Author

@AlexeySotkin, I just merged PR conflicting with these changes. Could you resolve the merge conflicts, please?

Hopefully the solution to it is simply to 'delete' the changes in this patch in SemaSYCL and make sure that the tests still pass. If not, @Fznamznon and I can help.

I have rebased my patch on top of the sycl branch. And now it seems that the test pass without my changes to the Clang.

Honestly, I don't see much sense in this PR anymore

@bader bader changed the title [SYCL] Fix crash in clang for SYCL kernels with accessors and spec constants [SYCL] Add a regression test for the crash during spec constants processing Apr 23, 2020
@Fznamznon
Copy link
Contributor

@AlexeySotkin, I just merged PR conflicting with these changes. Could you resolve the merge conflicts, please?

Hopefully the solution to it is simply to 'delete' the changes in this patch in SemaSYCL and make sure that the tests still pass. If not, @Fznamznon and I can help.

I have rebased my patch on top of the sycl branch. And now it seems that the test pass without my changes to the Clang.

Honestly, I don't see much sense in this PR anymore

We still need the test.

@erichkeane
Copy link
Contributor

I would still like to have the test, if we broke it once, I can see us breaking it again. As I mentioned in my first response, I anticipated that this would be the case.

@bader bader merged commit 7659e45 into sycl Apr 23, 2020
@bader bader deleted the private/ansotkin/spec-const-fix branch April 23, 2020 14:42
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Apr 26, 2020
…_docs

* origin/sycl:
  [XPTI][Framework] Reference implementation of the Xpti framework to be used with instrumentation in SYCL (intel#1557)
  [SYCL] Initial ABI checks implementation (intel#1528)
  [SYCL] Support connection with multiple plugins (intel#1490)
  [SYCL] Add a new header file with the reduction class definition (intel#1558)
  [SYCL] Add test for SYCL kernels with accessor and spec constant (intel#1536)
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Apr 29, 2020
…versioning

* origin/sycl:
  [XPTI][Framework] Reference implementation of the Xpti framework to be used with instrumentation in SYCL (intel#1557)
  [SYCL] Initial ABI checks implementation (intel#1528)
  [SYCL] Support connection with multiple plugins (intel#1490)
  [SYCL] Add a new header file with the reduction class definition (intel#1558)
  [SYCL] Add test for SYCL kernels with accessor and spec constant (intel#1536)
  [SYCL][CUDA] Move interop tests (intel#1570)
  [Driver][SYCL] Remove COFF object format designator for Windows device compiles (intel#1574)
  [SYCL] Fix conflicting visibility attributes (intel#1571)
  [SYCL][DOC] Update the SYCL Runtime Interface document with design details (intel#680)
  [SYCL] Improve image accessors support on a host device (intel#1502)
  [SYCL] Make queue's non-USM event ownership temporary (intel#1561)
  [SYCL] Added support of rounding modes for non-host devices (intel#1463)
  [SYCL] SemaSYCL significant refactoring (intel#1517)
  [SYCL] Support 0-dim accessor in handler::copy(accessor, accessor) (intel#1551)
bader pushed a commit to bader/llvm that referenced this pull request Jul 11, 2024
Map FlagToSRF and SRFToFlag pseudo instructions to scalar instructions.
Enable uniform analysis on G_ZEXT/G_SEXT for i1 source, as this may map
to FlagToSRF.
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.

5 participants