Skip to content

Fix gamma accuracy gap compared to scipy #1608

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

Conversation

xytintel
Copy link
Contributor

@xytintel xytintel commented Apr 24, 2025

Resolve #1163. This PR aims to resolve the gamma accuracy gap compared to scipy by adjusting two key parameters in the XPU distributions. Motivation: Misaligned key parameters can cause computation differences with CUDA, which may lead to failures in CUDA bias cases. We have decided to follow these parameters.

@EikanWang EikanWang requested a review from Copilot April 26, 2025 15:56
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 aims to resolve the gamma accuracy gap compared to scipy by adjusting two key parameters in the XPU distributions.

  • Reduced the max threads per block for the gamma kernel from 512 to 256.
  • Changed the seed parameter for the random engine in launch_gamma_kernel from 42 to 10.
Comments suppressed due to low confidence (1)

src/ATen/native/xpu/sycl/Distributions.cpp:176

  • Reducing the max_threads_per_block from 512 to 256 may affect kernel performance; please ensure this change is validated across different XPU configurations.
/*max_threads_per_block=*/256

@EikanWang
Copy link
Contributor

@xytintel , I cannot quite understand why the changes can fix the issue #1163. You need to provide an informative and detailed description.

Copy link
Contributor

@EikanWang EikanWang left a comment

Choose a reason for hiding this comment

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

Pls. provide an informative and detailed description.

@xytintel xytintel requested a review from EikanWang May 5, 2025 16:37
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.

torch._standard_gamma() has accuracy gap compared to scipy and torch.cpu
2 participants