Skip to content

[SYCL] Use checkArgCountAtLeast instead #6380

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 7, 2022

Conversation

premanandrao
Copy link
Contributor

@premanandrao premanandrao commented Jun 30, 2022

Rather than replicate the code, call existing routine checkArgCountAtLeast
for similar functionality.

Add a similar routine checkArgCountAtMost to check if a call expression's
argument count exceeds the most expected. Replace where equivalent
with calls to this routine.

@premanandrao premanandrao requested a review from a team as a code owner June 30, 2022 11:48
@premanandrao
Copy link
Contributor Author

This was a post-commit review comment from @erichkeane

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.

LGTM.

One question:

// Make sure we don't have too many arguments.
  if (NumArgs > MaxNumArgs)
    return Diag(TheCall->getEndLoc(),
                diag::err_typecheck_call_too_many_args_at_most)
           << 0 /*function call*/ << MaxNumArgs << NumArgs
           << TheCall->getSourceRange();

``

I am wondering whether we can use checkAtMostNumArgs() functionality instead for bottom one.

@premanandrao
Copy link
Contributor Author

I am wondering whether we can use checkAtMostNumArgs() functionality instead for bottom one.

That particular routine is for checking the number of arguments in an attribute, if I am not mistaken. But I could mimic checkArgCountAtLeast (in SemaChecking.cpp) and create a checkArgCountAtMost for the second check. Since this builtin would be the only one calling it, I wasn't too motivated to do that as part of this change.

@smanna12
Copy link
Contributor

But I could mimic checkArgCountAtLeast (in SemaChecking.cpp) and create a checkArgCountAtMost for the second check. Since this builtin would be the only one calling it, I wasn't too motivated to do that as part of this change.

Agreed.

smanna12
smanna12 previously approved these changes Jun 30, 2022
@premanandrao
Copy link
Contributor Author

The CUDA failure is unrelated to my changes.

erichkeane
erichkeane previously approved these changes Jun 30, 2022
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.

Adding a checkArgCountAtMost would be a nice addition, but up to you guys whether it is necessary for htis patch.

smanna12
smanna12 previously approved these changes Jul 1, 2022
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.

Thank you.

@premanandrao, could you please update PR description?

@premanandrao
Copy link
Contributor Author

@premanandrao, could you please update PR description?

Thank you, done.

smanna12
smanna12 previously approved these changes Jul 1, 2022
@premanandrao premanandrao marked this pull request as draft July 7, 2022 06:47
Rather than replicate the code, call existing routine
checkArgCountAtLeast for similar functionality.
@premanandrao
Copy link
Contributor Author

No need to review the latest force push; I did that to force testing after a rebase. (The PR is in draft status.)

@premanandrao premanandrao marked this pull request as ready for review July 7, 2022 10:21
@premanandrao
Copy link
Contributor Author

Only one test failure now: SYCL :: Assert/assert_in_simultaneous_kernels.cpp, which is unrelated to my changes.

@smanna12, could you please approve my changes again? There are no changes since you last approved it, except for an empty forced push. Thanks!

@premanandrao
Copy link
Contributor Author

@intel/llvm-gatekeepers, this is ready for a merge. Thanks!

@steffenlarsen steffenlarsen merged commit 6b8761a into intel:sycl Jul 7, 2022
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