Skip to content

[SYCLomatic] Add explicit cast if CUDA enum type is migrated scoped type and the value is compared to a different type value. #2829

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

Open
wants to merge 8 commits into
base: SYCLomatic
Choose a base branch
from

Conversation

ShengchenJ
Copy link
Contributor

No description provided.

@ShengchenJ ShengchenJ requested a review from a team as a code owner May 13, 2025 06:10
@ShengchenJ ShengchenJ requested review from intwanghao and zhiweij1 May 13, 2025 06:10
Signed-off-by: Chen, Sheng S <[email protected]>
Signed-off-by: Chen, Sheng S <[email protected]>
@zhimingwang36 zhimingwang36 changed the title [SYCLomatic] Cast the CUDA enum type to int if the type is scoped. [SYCLomatic] Add explicit cast if CUDA enum type is migrated scoped type and the value is compared to a different type value. May 15, 2025
@ShengchenJ ShengchenJ requested a review from Copilot May 16, 2025 01:43
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new migration rule to handle explicit cast insertion for CUDA enum type comparisons and registers it in the AST traversal. The key changes include:

  • Introducing BinaryOperatorCallRule in the header and implementation files.
  • Inserting explicit cast replacements for certain enum values.
  • Registering the new rule in the AST traversal.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
clang/lib/DPCT/RulesLang/RulesLang.h Added declaration for BinaryOperatorCallRule.
clang/lib/DPCT/RulesLang/RulesLang.cpp Implemented BinaryOperatorCallRule with cast logic.
clang/lib/DPCT/ASTTraversal.cpp Registered BinaryOperatorCallRule.
Files not reviewed (1)
  • clang/test/dpct/enum_type.cu: Language not supported

if (!BO)
return;

// The migration rule covered these test type, no need to cast.
Copy link
Preview

Copilot AI May 16, 2025

Choose a reason for hiding this comment

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

[nitpick] There appears to be a typographical error in the comment. Consider revising the comment to clarify the intended meaning (e.g., "The migration rule covers these enum types so no cast is required.").

Suggested change
// The migration rule covered these test type, no need to cast.
// The migration rule covers these enum types, so no cast is required.

Copilot uses AI. Check for mistakes.

Signed-off-by: Chen, Sheng S <[email protected]>
Signed-off-by: Chen, Sheng S <[email protected]>
Signed-off-by: Chen, Sheng S <[email protected]>
Signed-off-by: Chen, Sheng S <[email protected]>
Signed-off-by: Chen, Sheng S <[email protected]>
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.

4 participants