Files
TheRock/math-libs/libhipcxx/.upstream-tests/test/cuda/atomics/atomic.ext/atomic_helpers.h
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

105 lines
3.3 KiB
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef ATOMIC_HELPERS_H
#define ATOMIC_HELPERS_H
#include <cuda/atomic>
#include <cuda/std/cassert>
#include "test_macros.h"
struct UserAtomicType
{
int i;
__host__ __device__ explicit UserAtomicType(int d = 0) noexcept
: i(d)
{}
__host__ __device__ friend bool operator==(const UserAtomicType& x, const UserAtomicType& y)
{
return x.i == y.i;
}
};
template <template <class, template <typename, typename> class, cuda::thread_scope> class TestFunctor,
template <typename, typename> class Selector,
cuda::thread_scope Scope
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600
= cuda::thread_scope_system
#endif
>
struct TestEachIntegralType
{
__host__ __device__ void operator()() const
{
TestFunctor<char, Selector, Scope>()();
TestFunctor<signed char, Selector, Scope>()();
TestFunctor<unsigned char, Selector, Scope>()();
TestFunctor<short, Selector, Scope>()();
TestFunctor<unsigned short, Selector, Scope>()();
TestFunctor<int, Selector, Scope>()();
TestFunctor<unsigned int, Selector, Scope>()();
TestFunctor<long, Selector, Scope>()();
TestFunctor<unsigned long, Selector, Scope>()();
TestFunctor<long long, Selector, Scope>()();
TestFunctor<unsigned long long, Selector, Scope>()();
TestFunctor<wchar_t, Selector, Scope>();
#ifndef _LIBCUDACXX_HAS_NO_UNICODE_CHARS
TestFunctor<char16_t, Selector, Scope>()();
TestFunctor<char32_t, Selector, Scope>()();
#endif
TestFunctor<int8_t, Selector, Scope>()();
TestFunctor<uint8_t, Selector, Scope>()();
TestFunctor<int16_t, Selector, Scope>()();
TestFunctor<uint16_t, Selector, Scope>()();
TestFunctor<int32_t, Selector, Scope>()();
TestFunctor<uint32_t, Selector, Scope>()();
TestFunctor<int64_t, Selector, Scope>()();
TestFunctor<uint64_t, Selector, Scope>()();
}
};
template <template <class, template <typename, typename> class, cuda::thread_scope> class TestFunctor,
template <typename, typename> class Selector,
cuda::thread_scope Scope
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600
= cuda::thread_scope_system
#endif
>
struct TestEachFloatingPointType
{
__host__ __device__ void operator()() const
{
TestFunctor<float, Selector, Scope>()();
TestFunctor<double, Selector, Scope>()();
}
};
template <template <class, template <typename, typename> class, cuda::thread_scope> class TestFunctor,
template <typename, typename> class Selector,
cuda::thread_scope Scope
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600
= cuda::thread_scope_system
#endif
>
struct TestEachAtomicType
{
__host__ __device__ void operator()() const
{
TestEachIntegralType<TestFunctor, Selector, Scope>()();
TestEachFloatingPointType<TestFunctor, Selector, Scope>()();
TestFunctor<UserAtomicType, Selector, Scope>()();
TestFunctor<int*, Selector, Scope>()();
TestFunctor<const int*, Selector, Scope>()();
}
};
#endif // ATOMIC_HELPER_H