You are browsing as a guest. Sign up (or log in) to start making projects!

3h 22m 20s logged

ID: PyTorch PR-1

I have force-pushed an updated, compile-safe implementation to address the logical and architectural edge cases across both the CPU and CUDA backends.

Core Changes & Fixes:

  • Compile-Time Branching (CPU & CUDA): Added C++17 if constexpr (std::is_integral_v<scalar_t>) branching to decouple the type dispatch loops. This completely isolates the NaN-preservation logic to floating-point types (float, double, Half, BFloat16). As a result, integral type paths completely elide the isnan guards at compile time, eliminating template instantiation errors and preserving the highly optimized native fast paths.
  • CUDA Host-to-Device Fix: Inside sign_kernel_cuda, the host-side at::_isnan utility inside the GPU_LAMBDA has been replaced with the device-safe qualified c10::isnan intrinsic. This resolves the NVCC __host__ to __device__ namespace violation completely.
  • Validation: The updated files have been verified locally. Both spin lint and lintrunner -a pass with zero code style or formatting errors, and local target compilation succeeds perfectly.

The PR is now fully production-ready and structurally sound.

0
1

Comments 0

No comments yet. Be the first!