Skip to content

Commit

Permalink
fix clang CUDA atomics
Browse files Browse the repository at this point in the history
CUDA is exposing `atomic*_block()` function signatures even if these can
not be used by the selected architecture.
  • Loading branch information
psychocoderHPC authored and sbastrakov committed Aug 9, 2022
1 parent f27d78c commit d92f228
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions include/alpaka/atomic/AtomicUniformCudaHip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ inline namespace alpakaGlobal
}
};


# if !CLANG_CUDA_PTX_WORKAROUND
template<typename T>
struct AlpakaBuiltInAtomic<
alpaka::AtomicSub,
Expand All @@ -181,6 +181,7 @@ inline namespace alpakaGlobal
return atomicSub_block(add, value);
}
};
# endif

// Min.
template<typename T, typename THierarchy>
Expand All @@ -197,6 +198,7 @@ inline namespace alpakaGlobal
}
};

# if !CLANG_CUDA_PTX_WORKAROUND
template<typename T>
struct AlpakaBuiltInAtomic<
alpaka::AtomicMin,
Expand All @@ -210,6 +212,7 @@ inline namespace alpakaGlobal
return atomicMin_block(add, value);
}
};
# endif

// disable HIP atomicMin: see https://github.com/ROCm-Developer-Tools/hipamd/pull/40
# if(BOOST_LANG_HIP)
Expand Down Expand Up @@ -262,6 +265,7 @@ inline namespace alpakaGlobal
}
};

# if !CLANG_CUDA_PTX_WORKAROUND
template<typename T>
struct AlpakaBuiltInAtomic<
alpaka::AtomicMax,
Expand All @@ -275,6 +279,7 @@ inline namespace alpakaGlobal
return atomicMax_block(add, value);
}
};
# endif

// disable HIP atomicMax: see https://github.com/ROCm-Developer-Tools/hipamd/pull/40
# if(BOOST_LANG_HIP)
Expand Down Expand Up @@ -328,6 +333,7 @@ inline namespace alpakaGlobal
}
};

# if !CLANG_CUDA_PTX_WORKAROUND
template<typename T>
struct AlpakaBuiltInAtomic<
alpaka::AtomicExch,
Expand All @@ -341,6 +347,7 @@ inline namespace alpakaGlobal
return atomicExch_block(add, value);
}
};
# endif

// Inc.

Expand All @@ -358,6 +365,7 @@ inline namespace alpakaGlobal
}
};

# if !CLANG_CUDA_PTX_WORKAROUND
template<typename T>
struct AlpakaBuiltInAtomic<
alpaka::AtomicInc,
Expand All @@ -371,6 +379,7 @@ inline namespace alpakaGlobal
return atomicInc_block(add, value);
}
};
# endif

// Dec.

Expand All @@ -388,6 +397,7 @@ inline namespace alpakaGlobal
}
};

# if !CLANG_CUDA_PTX_WORKAROUND
template<typename T>
struct AlpakaBuiltInAtomic<
alpaka::AtomicDec,
Expand All @@ -401,6 +411,7 @@ inline namespace alpakaGlobal
return atomicDec_block(add, value);
}
};
# endif

// And.

Expand All @@ -418,6 +429,7 @@ inline namespace alpakaGlobal
}
};

# if !CLANG_CUDA_PTX_WORKAROUND
template<typename T>
struct AlpakaBuiltInAtomic<
alpaka::AtomicAnd,
Expand All @@ -431,7 +443,7 @@ inline namespace alpakaGlobal
return atomicAnd_block(add, value);
}
};

# endif

// Or.

Expand All @@ -449,6 +461,7 @@ inline namespace alpakaGlobal
}
};

# if !CLANG_CUDA_PTX_WORKAROUND
template<typename T>
struct AlpakaBuiltInAtomic<
alpaka::AtomicOr,
Expand All @@ -462,7 +475,7 @@ inline namespace alpakaGlobal
return atomicOr_block(add, value);
}
};

# endif

// Xor.

Expand All @@ -480,6 +493,7 @@ inline namespace alpakaGlobal
}
};

# if !CLANG_CUDA_PTX_WORKAROUND
template<typename T>
struct AlpakaBuiltInAtomic<
alpaka::AtomicXor,
Expand All @@ -493,6 +507,7 @@ inline namespace alpakaGlobal
return atomicXor_block(add, value);
}
};
# endif

} // namespace alpakaGlobal

Expand Down

0 comments on commit d92f228

Please sign in to comment.