Skip to content
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

[BUG]: isfinite breaks NVRTC since 2.8.0 #3642

Closed
1 task done
leofang opened this issue Feb 1, 2025 · 3 comments · Fixed by #3644
Closed
1 task done

[BUG]: isfinite breaks NVRTC since 2.8.0 #3642

leofang opened this issue Feb 1, 2025 · 3 comments · Fixed by #3644
Assignees
Labels
bug Something isn't working right.

Comments

@leofang
Copy link
Member

leofang commented Feb 1, 2025

Is this a duplicate?

Type of Bug

Compile-time Error

Component

libcu++

Describe the bug

Based on internal discussion, __builtin_isfinite does not exist in NVRTC 12.0-12.2.

How to Reproduce

  1. Create a conda env
conda create -n my_env -y python=3.12 cuda-core cuda-version=12.0
conda activate my_env
  1. Run the follow Python script
from cuda.core.experimental import Program, Device

dev = Device(0)
dev.set_current()

code2 = r"""
#include <cuda/std/cmath>


__global__ void my_kernel(double* s) {
  unsigned int tid = threadIdx.x + blockIdx.x * blockDim.x;
  double y = s[1]; 
  if (tid == 0) {
     auto k = isfinite(y);
     if (k) {
        s[0] += 1;
     }
  }
}
"""

prog = Program(code2, code_type="c++")
mod = prog.compile(target_type="cubin", options=("-std=c++17", "-I/path/to/local/cccl/libcudacxx/include/"))
  1. Repeat steps 1 & 2 for 12.1-12.8 via
conda install -y cuda-version=12.X  # X=1,2,..., no 7

Expected behavior

Everything should work on Linux/Windows.

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

@leofang leofang added the bug Something isn't working right. label Feb 1, 2025
@github-project-automation github-project-automation bot moved this to Todo in CCCL Feb 1, 2025
@leofang leofang changed the title [BUG]: isfinite breaks NVRTC since 2.7.0 [BUG]: isfinite breaks NVRTC since 2.8.0 Feb 1, 2025
@leofang
Copy link
Member Author

leofang commented Feb 1, 2025

(Fixed the issue title; I meant to say 2.7.0 works fine but not 2.8.0 or main)

@leofang
Copy link
Member Author

leofang commented Feb 1, 2025

Notes:

  1. Try and make nvrtc on windows pass #3623 was an attempt to fix this, but it did not touch the root cause and did not work
  2. I do not understand why the NVRTC CI tests did not catch this. Seems like a gap to me.
  3. this seems to work for NVRTC on both Linux and Windows, and for all CUDA 12.x:
diff --git a/libcudacxx/include/cuda/std/__cccl/builtin.h b/libcudacxx/include/cuda/std/__cccl/builtin.h
index 3a5fda2f0..e3683fc58 100644
--- a/libcudacxx/include/cuda/std/__cccl/builtin.h
+++ b/libcudacxx/include/cuda/std/__cccl/builtin.h
@@ -244,9 +244,9 @@
 #endif // _CCCL_CHECK_BUILTIN(isfinite)
 
 // Below 11.7 nvcc treats the builtin as a host only function
-#if _CCCL_CUDACC_BELOW(11, 7)
+#if _CCCL_CUDACC_BELOW(12, 3)
 #  undef _CCCL_BUILTIN_ISFINITE
-#endif // _CCCL_CUDACC_BELOW(11, 7)
+#endif // _CCCL_CUDACC_BELOW(12, 3)
 
 #if _CCCL_CHECK_BUILTIN(builtin_isinf) || _CCCL_COMPILER(GCC)
 #  define _CCCL_BUILTIN_ISINF(...) __builtin_isinf(__VA_ARGS__)

@leofang

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants