-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL]Remove unwanted check for value dependency of const vars #4870
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]Remove unwanted check for value dependency of const vars #4870
Conversation
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.
Can you add a test to show the problem?
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.
+1 to needing test coverage. One thing that I'm uncertain of is: the callers that don't expect a check for value dependence are now always getting a check they didn't expect. I think that's actually an improvement, but I am wondering if we're regressing any behavior here.
I don't believe we are, @AaronBallman. There was an implicit assumption (prior to my changes in PR #2019) that this call would not be made in contexts where there was a value dependency, and my changes carried forward that assumption. This seems wrong now in hindisight, and @srividya-sundaram's fix seems okay to me in that context. But I am not sure if I too am missing something deeper. |
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.
LGTM
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.
Changes look good to me.
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.
I am good with the changes, modulo @dm-vodopyanov's comments. If the failure still reproduces after the suggested change that would be nice.
@srividya-sundaram from internal discussion: LGTM, merging the PR. |
Removed
CheckValueDependent
from the parameter list of functionbool checkAllowedSYCLInitializer(VarDecl *VD, bool CheckValueDependent = false);
Setting this value to
false
by default causes compiler crash during initialization ofconstexprs
that are value dependent, because in L4143ValueDependent
will befalse
irrespective ofInit->isValueDependent()
's value.ValueDependent
is then switched totrue
here which is incorrect.The assert in Init->isConstantInitializer(Context, false) is triggered since we never truly checked if the var is valuedependent or not.