Skip to content

[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

Merged
merged 4 commits into from
Nov 12, 2021

Conversation

srividya-sundaram
Copy link
Contributor

@srividya-sundaram srividya-sundaram commented Nov 2, 2021

Removed CheckValueDependent from the parameter list of function bool checkAllowedSYCLInitializer(VarDecl *VD, bool CheckValueDependent = false);

Setting this value to false by default causes compiler crash during initialization of constexprs that are value dependent, because in L4143 ValueDependent will be false irrespective of Init->isValueDependent()'s value.

ValueDependent is then switched to true 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.

Copy link
Contributor

@smanna12 smanna12 left a 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?

Copy link
Contributor

@AaronBallman AaronBallman left a 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.

@premanandrao
Copy link
Contributor

premanandrao commented Nov 2, 2021

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.

Copy link
Contributor

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@smanna12 smanna12 left a 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.

Copy link
Contributor

@premanandrao premanandrao left a 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.

@dm-vodopyanov
Copy link
Contributor

@srividya-sundaram from internal discussion:
"After discussing with code owners, we feel its better to do as part of a separate PR and close the current PR."

LGTM, merging the PR.

@dm-vodopyanov dm-vodopyanov merged commit 6dcc988 into intel:sycl Nov 12, 2021
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.

6 participants