Skip to content

Avoid Incorrect Boolean to Size_t Conversion #1657

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 4 commits into
base: main
Choose a base branch
from
Open

Conversation

chunhuanMeng
Copy link
Contributor

This change fixes the logical error caused by incorrect type conversion from boolean to size_t.

@etaf etaf requested a review from Copilot May 13, 2025 08:43
Copy link
Contributor

@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 pull request fixes a bug related to an incorrect conversion from a boolean to size_t in the index kernel eligibility check.

  • Corrects the type conversion on the strides(1)[1] comparison
  • Ensures the check correctly compares the numerical value against 0
Comments suppressed due to low confidence (1)

src/ATen/native/xpu/sycl/IndexKernelUtils.h:32

  • The updated conversion now correctly casts the actual stride value before comparing it to 0, thereby fixing the logical error.
static_cast<size_t>(iter.strides(1)[1]) == 0 &&

@etaf etaf requested a review from xytintel May 13, 2025 08:47
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.

2 participants