-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `cuda::ptx::*` namespace (#574) * fixup `___CUDA_VPTX` -> `_CUDA_VPTX` (#664) * fixup `___CUDA_VPTX` -> `_CUDA_VPTX` * Fix warning for unused variable in branches that are constexpr disabled. --------- Co-authored-by: Allard Hendriksen <ahendriksen@nvidia.com> Co-authored-by: Wesley Maxey <71408887+wmaxey@users.noreply.github.com>
- Loading branch information
1 parent
db1312e
commit bb37c94
Showing
12 changed files
with
2,334 additions
and
30 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
libcudacxx/.upstream-tests/test/cuda/ptx/ptx.mbarrier.arrive.compile.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// 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: libcpp-has-no-threads | ||
|
||
// <cuda/ptx> | ||
|
||
#include <cuda/ptx> | ||
#include <cuda/std/utility> | ||
|
||
#include "concurrent_agents.h" | ||
#include "cuda_space_selector.h" | ||
#include "test_macros.h" | ||
|
||
template <typename ... _Ty> | ||
__device__ inline bool __unused(_Ty...) { return true; } | ||
|
||
__global__ void test_compilation() { | ||
using cuda::ptx::sem_release; | ||
using cuda::ptx::space_cluster; | ||
using cuda::ptx::space_shared; | ||
using cuda::ptx::scope_cluster; | ||
using cuda::ptx::scope_cta; | ||
|
||
__shared__ uint64_t bar; | ||
bar = 1; | ||
uint64_t state = 1; | ||
|
||
#if __cccl_ptx_isa >= 700 | ||
NV_IF_TARGET(NV_PROVIDES_SM_80, ( | ||
state = cuda::ptx::mbarrier_arrive(&bar); // 1. | ||
state = cuda::ptx::mbarrier_arrive_no_complete(&bar, 1); // 5. | ||
)); | ||
#endif // __cccl_ptx_isa >= 700 | ||
|
||
// This guard is redundant: before PTX ISA 7.8, there was no support for SM_90 | ||
#if __cccl_ptx_isa >= 780 | ||
NV_IF_TARGET(NV_PROVIDES_SM_90, ( | ||
state = cuda::ptx::mbarrier_arrive(&bar, 1); // 2. | ||
)); | ||
#endif // __cccl_ptx_isa >= 780 | ||
|
||
#if __cccl_ptx_isa >= 800 | ||
NV_IF_TARGET(NV_PROVIDES_SM_90, ( | ||
state = cuda::ptx::mbarrier_arrive(sem_release, scope_cta, space_shared, &bar); // 3a. | ||
state = cuda::ptx::mbarrier_arrive(sem_release, scope_cluster, space_shared, &bar); // 3a. | ||
|
||
state = cuda::ptx::mbarrier_arrive(sem_release, scope_cta, space_shared, &bar, 1); // 3b. | ||
state = cuda::ptx::mbarrier_arrive(sem_release, scope_cluster, space_shared, &bar, 1); // 3b. | ||
|
||
cuda::ptx::mbarrier_arrive(sem_release, scope_cluster, space_cluster, &bar); // 4a. | ||
|
||
cuda::ptx::mbarrier_arrive(sem_release, scope_cluster, space_cluster, &bar, 1); // 4b. | ||
|
||
state = cuda::ptx::mbarrier_arrive_expect_tx(sem_release, scope_cta, space_shared, &bar, 1); // 8. | ||
state = cuda::ptx::mbarrier_arrive_expect_tx(sem_release, scope_cluster, space_shared, &bar, 1); // 8. | ||
|
||
cuda::ptx::mbarrier_arrive_expect_tx(sem_release, scope_cluster, space_cluster, &bar, 1); // 9. | ||
)); | ||
#endif // __cccl_ptx_isa >= 800 | ||
__unused(bar, state); | ||
} | ||
|
||
int main(int, char**) | ||
{ | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ | |
#endif | ||
#endif | ||
|
||
#include <cuda/std/cassert> | ||
|
||
#include "test_macros.h" | ||
|
||
TEST_EXEC_CHECK_DISABLE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// -*- 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. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef _CUDA_PTX | ||
#define _CUDA_PTX | ||
|
||
#include "std/detail/__config" | ||
|
||
#include "std/detail/__pragma_push" | ||
|
||
#include "std/detail/libcxx/include/__cuda/ptx.h" | ||
|
||
#include "std/detail/__pragma_pop" | ||
|
||
#endif // _CUDA_PTX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.