Files
TheRock/math-libs/libhipcxx/.upstream-tests/test/cuda/pipeline_group_concept.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

87 lines
3.1 KiB
C++

//===----------------------------------------------------------------------===//
//
// Part of libcu++, the C++ Standard Library for your entire system,
// 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
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: pre-sm-70
// TODO: Remove pointless comparison suppression when compiler fixes short-circuiting
#include <cuda/pipeline>
#include <cuda/std/cassert>
#include "test_macros.h"
TEST_NV_DIAG_SUPPRESS(186) // pointless comparison of unsigned integer with zero
template <typename T_size, typename T_thread_rank>
struct single_thread_test_group
{
__host__ __device__ void sync() const {}
__host__ __device__ T_size size() const
{
return 1;
}
__host__ __device__ T_thread_rank thread_rank() const
{
return 0;
}
};
template <cuda::thread_scope Scope, typename T_size, typename T_thread_rank>
__host__ __device__ void test_fully_specialized()
{
auto group = single_thread_test_group<T_size, T_thread_rank>{};
cuda::pipeline_shared_state<Scope, 1> shared_state;
auto pipe_partitioned_implicit = make_pipeline(group, &shared_state, 1);
auto pipe_partitioned_explicit_consumer = make_pipeline(group, &shared_state, cuda::pipeline_role::consumer);
auto pipe_partitioned_explicit_producer = make_pipeline(group, &shared_state, cuda::pipeline_role::producer);
auto pipe_unified = make_pipeline(group, &shared_state);
char src[2] = {1, 2};
char dst[2] = {0, 0};
pipe_unified.producer_acquire();
memcpy_async(group, &dst[0], &src[0], 1, pipe_unified);
memcpy_async(group, &dst[1], &src[1], cuda::aligned_size_t<1>(1), pipe_unified);
pipe_unified.producer_commit();
pipe_unified.consumer_wait();
assert(dst[0] == 1);
assert(dst[1] == 2);
pipe_unified.consumer_release();
}
template <cuda::thread_scope Scope, typename T_size>
__host__ __device__ void test_select_thread_rank_type()
{
test_fully_specialized<Scope, T_size, bool>();
test_fully_specialized<Scope, T_size, int8_t>();
test_fully_specialized<Scope, T_size, int16_t>();
test_fully_specialized<Scope, T_size, int32_t>();
test_fully_specialized<Scope, T_size, int64_t>();
test_fully_specialized<Scope, T_size, uint8_t>();
test_fully_specialized<Scope, T_size, uint16_t>();
test_fully_specialized<Scope, T_size, uint32_t>();
test_fully_specialized<Scope, T_size, uint64_t>();
}
template <cuda::thread_scope Scope>
__host__ __device__ void test_select_size_type()
{
test_select_thread_rank_type<Scope, bool>();
test_select_thread_rank_type<Scope, int8_t>();
test_select_thread_rank_type<Scope, int16_t>();
test_select_thread_rank_type<Scope, int32_t>();
test_select_thread_rank_type<Scope, int64_t>();
test_select_thread_rank_type<Scope, uint8_t>();
test_select_thread_rank_type<Scope, uint16_t>();
test_select_thread_rank_type<Scope, uint32_t>();
test_select_thread_rank_type<Scope, uint64_t>();
}