Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion csrc/atomics.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ static inline __device__ void atomAdd(int64_t *address, int64_t val) {
static inline __device__ void atomAdd(float *address, float val) {
atomicAdd(address, val);
}
#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 600 || CUDA_VERSION < 8000)
// CUDA 13.x only supports SM 70+, where native atomicAdd for double is available.
// For older CUDA versions (< 8.0) or architectures without native double atomicAdd
// (SM < 6.0), fall back to CAS-based implementation.
#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 600) && (CUDA_VERSION < 13000)
static inline __device__ void atomAdd(double *address, double val) {
AtomicAddDecimalImpl<double, sizeof(double)>()(address, val);
}
Expand Down
8 changes: 8 additions & 0 deletions setup_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ def get_extensions():
nvcc_flags = [] if nvcc_flags == "" else nvcc_flags.split(" ")
nvcc_flags += ["-O3"]
nvcc_flags += ["--expt-relaxed-constexpr"]

# CUDA 13.x may have stricter host compiler version checks,
# add --allow-unsupported-compiler to avoid build failures
# with newer or not-yet-certified host compilers.
cuda_major, _ = paddle.version.cuda_version.split(".")
if int(cuda_major) >= 13:
nvcc_flags += ["--allow-unsupported-compiler"]

extra_compile_args["nvcc"] = nvcc_flags

src = get_sources()
Expand Down