Skip to content

Migrate std::floor to sycl::floor in device kernels #3721

Open
orrangetabby17 wants to merge 1 commit into
mainfrom
shuxin/floor
Open

Migrate std::floor to sycl::floor in device kernels #3721
orrangetabby17 wants to merge 1 commit into
mainfrom
shuxin/floor

Conversation

@orrangetabby17
Copy link
Copy Markdown

This pull request refactors several SYCL/XPU kernel files to consistently use sycl::floor instead of std::floor or floorf, and introduces the use of the at::opmath_type type trait to improve numerical precision and type safety. These changes standardize floating-point operations across the codebase, which is important for device compatibility and correctness.

Numerical precision and type safety improvements:

  • Introduction of at::opmath_type in multiple kernels (e.g., DeformConv2dKernels.cpp, PsRoiPoolKernels.cpp, RoiPoolKernels.cpp, UnaryFractionKernels.cpp, GridSampler.cpp) to ensure that mathematical operations are performed in a type-safe way.

Device compatibility and code consistency:

  • Replacement of all uses of std::floor and floorf with sycl::floor in device kernel code, ensuring compatibility with SYCL device execution.

Header and dependency updates:

  • Added #include <ATen/OpMathType.h> where necessary to support the new opmath_type usage.

ASM Difference

  • No significant difference in the asm-level between sycl::floor and std::floor.

These changes improve the reliability and maintainability of the code on SYCL devices.

@github-actions github-actions Bot added disable_e2e Disable all e2e test jobs for the PR disable_distributed Disable distributed UT test jobs for the PR labels May 21, 2026
@chuanqi129 chuanqi129 marked this pull request as draft May 21, 2026 02:35
@chuanqi129 chuanqi129 marked this pull request as ready for review May 21, 2026 02:35
@orrangetabby17 orrangetabby17 requested a review from jianyizh May 21, 2026 06:36
Comment thread src/ATen/native/xpu/sycl/DeformConv2dKernels.cpp
Comment thread src/ATen/native/xpu/sycl/DeformConv2dKernels.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disable_distributed Disable distributed UT test jobs for the PR disable_e2e Disable all e2e test jobs for the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants