Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- lib/python3.11/site-packages/nvidia/__init__.py +0 -0
- lib/python3.11/site-packages/nvidia/__pycache__/__init__.cpython-311.pyc +0 -0
- lib/python3.11/site-packages/nvidia/cu13/include/Openacc/cupti_openacc.h +98 -0
- lib/python3.11/site-packages/nvidia/cu13/include/Openmp/cupti_openmp.h +100 -0
- lib/python3.11/site-packages/nvidia/cu13/include/Openmp/omp-tools.h +1083 -0
- lib/python3.11/site-packages/nvidia/cu13/include/builtin_types.h +64 -0
- lib/python3.11/site-packages/nvidia/cu13/include/channel_descriptor.h +599 -0
- lib/python3.11/site-packages/nvidia/cu13/include/common_functions.h +65 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups.h +1568 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/async.h +452 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/coalesced_reduce.h +95 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/coalesced_scan.h +174 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/driver_abi.h +99 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/functional.h +212 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/helpers.h +589 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/info.h +345 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/invoke.h +189 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/memory.h +136 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/partitioning.h +160 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/reduce.h +424 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/scan.h +320 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/sync.h +281 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/memcpy_async.h +62 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/reduce.h +63 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/scan.h +63 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuComplex.h +348 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cublas.h +888 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cublasLt.h +0 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cublasXt.h +693 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cublas_api.h +0 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cublas_v2.h +475 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda.h +0 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cudaEGL.h +662 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cudaEGLTypedefs.h +79 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cudaGL.h +608 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cudaGLTypedefs.h +105 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cudaProfilerTypedefs.h +70 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cudaTypedefs.h +715 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cudaVDPAU.h +282 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cudaVDPAUTypedefs.h +81 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_awbarrier.h +280 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_awbarrier_helpers.h +365 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_awbarrier_primitives.h +109 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_bf16.h +0 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_bf16.hpp +0 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_device_runtime_api.h +915 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_egl_interop.h +645 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_fp16.h +0 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_fp16.hpp +0 -0
- lib/python3.11/site-packages/nvidia/cu13/include/cuda_fp4.h +357 -0
lib/python3.11/site-packages/nvidia/__init__.py
ADDED
|
File without changes
|
lib/python3.11/site-packages/nvidia/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (191 Bytes). View file
|
|
|
lib/python3.11/site-packages/nvidia/cu13/include/Openacc/cupti_openacc.h
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2017 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#include <cuda_stdint.h>
|
| 51 |
+
|
| 52 |
+
#if !defined(_CUPTI_OPENACC_H_)
|
| 53 |
+
#define _CUPTI_OPENACC_H_
|
| 54 |
+
|
| 55 |
+
#ifndef CUPTIAPI
|
| 56 |
+
#ifdef _WIN32
|
| 57 |
+
#define CUPTIAPI __stdcall
|
| 58 |
+
#else
|
| 59 |
+
#define CUPTIAPI
|
| 60 |
+
#endif
|
| 61 |
+
#endif
|
| 62 |
+
|
| 63 |
+
#if defined(__LP64__)
|
| 64 |
+
#define CUPTILP64 1
|
| 65 |
+
#elif defined(_WIN64)
|
| 66 |
+
#define CUPTILP64 1
|
| 67 |
+
#else
|
| 68 |
+
#undef CUPTILP64
|
| 69 |
+
#endif
|
| 70 |
+
|
| 71 |
+
#if defined(__cplusplus)
|
| 72 |
+
extern "C" {
|
| 73 |
+
#endif
|
| 74 |
+
|
| 75 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 76 |
+
#pragma GCC visibility push(default)
|
| 77 |
+
#endif
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* \brief Initialize OpenACC support
|
| 81 |
+
*
|
| 82 |
+
* \param profRegister function of type acc_prof_reg as obtained from acc_register_library
|
| 83 |
+
* \param profUnregister function of type acc_prof_reg as obtained from acc_register_library
|
| 84 |
+
* \param profLookup function of type acc_prof_lookup as obtained from acc_register_library
|
| 85 |
+
*/
|
| 86 |
+
CUptiResult CUPTIAPI
|
| 87 |
+
cuptiOpenACCInitialize(void *profRegister, void *profUnregister, void *profLookup);
|
| 88 |
+
|
| 89 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 90 |
+
#pragma GCC visibility pop
|
| 91 |
+
#endif
|
| 92 |
+
|
| 93 |
+
#if defined(__cplusplus)
|
| 94 |
+
}
|
| 95 |
+
#endif
|
| 96 |
+
|
| 97 |
+
#endif /*_CUPTI_OPENACC_H_*/
|
| 98 |
+
|
lib/python3.11/site-packages/nvidia/cu13/include/Openmp/cupti_openmp.h
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2018 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#include <cuda_stdint.h>
|
| 51 |
+
#include "Openmp/omp-tools.h"
|
| 52 |
+
|
| 53 |
+
#if !defined(_CUPTI_OPENMP_H_)
|
| 54 |
+
#define _CUPTI_OPENMP_H_
|
| 55 |
+
|
| 56 |
+
#ifndef CUPTIAPI
|
| 57 |
+
#ifdef _WIN32
|
| 58 |
+
#define CUPTIAPI __stdcall
|
| 59 |
+
#else
|
| 60 |
+
#define CUPTIAPI
|
| 61 |
+
#endif
|
| 62 |
+
#endif
|
| 63 |
+
|
| 64 |
+
#if defined(__LP64__)
|
| 65 |
+
#define CUPTILP64 1
|
| 66 |
+
#elif defined(_WIN64)
|
| 67 |
+
#define CUPTILP64 1
|
| 68 |
+
#else
|
| 69 |
+
#undef CUPTILP64
|
| 70 |
+
#endif
|
| 71 |
+
|
| 72 |
+
#if defined(__cplusplus)
|
| 73 |
+
extern "C" {
|
| 74 |
+
#endif
|
| 75 |
+
|
| 76 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 77 |
+
#pragma GCC visibility push(default)
|
| 78 |
+
#endif
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* \brief Initialize OPENMP support (deprecated, used before OpenMP 5.0)
|
| 82 |
+
*
|
| 83 |
+
*/
|
| 84 |
+
int CUPTIAPI cuptiOpenMpInitialize(ompt_function_lookup_t ompt_fn_lookup, const char *runtime_version, unsigned int ompt_version);
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* \brief Initialize OPENMP support
|
| 88 |
+
*
|
| 89 |
+
*/
|
| 90 |
+
int CUPTIAPI cuptiOpenMpInitialize_v2(ompt_function_lookup_t lookup, int initial_device_num, ompt_data_t *tool_data);
|
| 91 |
+
|
| 92 |
+
#if defined(__GNUC__) && defined(CUPTI_LIB)
|
| 93 |
+
#pragma GCC visibility pop
|
| 94 |
+
#endif
|
| 95 |
+
|
| 96 |
+
#if defined(__cplusplus)
|
| 97 |
+
}
|
| 98 |
+
#endif
|
| 99 |
+
|
| 100 |
+
#endif /*_CUPTI_OPENMP_H_*/
|
lib/python3.11/site-packages/nvidia/cu13/include/Openmp/omp-tools.h
ADDED
|
@@ -0,0 +1,1083 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* include/50/omp-tools.h.var
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
//===----------------------------------------------------------------------===//
|
| 6 |
+
//
|
| 7 |
+
// The LLVM Compiler Infrastructure
|
| 8 |
+
//
|
| 9 |
+
// This file is dual licensed under the MIT and the University of Illinois Open
|
| 10 |
+
// Source Licenses. See LICENSE.txt for details.
|
| 11 |
+
//
|
| 12 |
+
//===----------------------------------------------------------------------===//
|
| 13 |
+
|
| 14 |
+
#ifndef __OMPT__
|
| 15 |
+
#define __OMPT__
|
| 16 |
+
|
| 17 |
+
/*****************************************************************************
|
| 18 |
+
* system include files
|
| 19 |
+
*****************************************************************************/
|
| 20 |
+
|
| 21 |
+
#include <stdint.h>
|
| 22 |
+
#include <stddef.h>
|
| 23 |
+
|
| 24 |
+
/*****************************************************************************
|
| 25 |
+
* iteration macros
|
| 26 |
+
*****************************************************************************/
|
| 27 |
+
|
| 28 |
+
#define FOREACH_OMPT_INQUIRY_FN(macro) \
|
| 29 |
+
macro (ompt_enumerate_states) \
|
| 30 |
+
macro (ompt_enumerate_mutex_impls) \
|
| 31 |
+
\
|
| 32 |
+
macro (ompt_set_callback) \
|
| 33 |
+
macro (ompt_get_callback) \
|
| 34 |
+
\
|
| 35 |
+
macro (ompt_get_state) \
|
| 36 |
+
\
|
| 37 |
+
macro (ompt_get_parallel_info) \
|
| 38 |
+
macro (ompt_get_task_info) \
|
| 39 |
+
macro (ompt_get_task_memory) \
|
| 40 |
+
macro (ompt_get_thread_data) \
|
| 41 |
+
macro (ompt_get_unique_id) \
|
| 42 |
+
macro (ompt_finalize_tool) \
|
| 43 |
+
\
|
| 44 |
+
macro(ompt_get_num_procs) \
|
| 45 |
+
macro(ompt_get_num_places) \
|
| 46 |
+
macro(ompt_get_place_proc_ids) \
|
| 47 |
+
macro(ompt_get_place_num) \
|
| 48 |
+
macro(ompt_get_partition_place_nums) \
|
| 49 |
+
macro(ompt_get_proc_id) \
|
| 50 |
+
\
|
| 51 |
+
macro(ompt_get_target_info) \
|
| 52 |
+
macro(ompt_get_num_devices)
|
| 53 |
+
|
| 54 |
+
#define FOREACH_OMPT_STATE(macro) \
|
| 55 |
+
\
|
| 56 |
+
/* first available state */ \
|
| 57 |
+
macro (ompt_state_undefined, 0x102) /* undefined thread state */ \
|
| 58 |
+
\
|
| 59 |
+
/* work states (0..15) */ \
|
| 60 |
+
macro (ompt_state_work_serial, 0x000) /* working outside parallel */ \
|
| 61 |
+
macro (ompt_state_work_parallel, 0x001) /* working within parallel */ \
|
| 62 |
+
macro (ompt_state_work_reduction, 0x002) /* performing a reduction */ \
|
| 63 |
+
\
|
| 64 |
+
/* barrier wait states (16..31) */ \
|
| 65 |
+
macro (ompt_state_wait_barrier, 0x010) /* waiting at a barrier */ \
|
| 66 |
+
macro (ompt_state_wait_barrier_implicit_parallel, 0x011) \
|
| 67 |
+
/* implicit barrier at the end of parallel region */\
|
| 68 |
+
macro (ompt_state_wait_barrier_implicit_workshare, 0x012) \
|
| 69 |
+
/* implicit barrier at the end of worksharing */ \
|
| 70 |
+
macro (ompt_state_wait_barrier_implicit, 0x013) /* implicit barrier */ \
|
| 71 |
+
macro (ompt_state_wait_barrier_explicit, 0x014) /* explicit barrier */ \
|
| 72 |
+
\
|
| 73 |
+
/* task wait states (32..63) */ \
|
| 74 |
+
macro (ompt_state_wait_taskwait, 0x020) /* waiting at a taskwait */ \
|
| 75 |
+
macro (ompt_state_wait_taskgroup, 0x021) /* waiting at a taskgroup */ \
|
| 76 |
+
\
|
| 77 |
+
/* mutex wait states (64..127) */ \
|
| 78 |
+
macro (ompt_state_wait_mutex, 0x040) \
|
| 79 |
+
macro (ompt_state_wait_lock, 0x041) /* waiting for lock */ \
|
| 80 |
+
macro (ompt_state_wait_critical, 0x042) /* waiting for critical */ \
|
| 81 |
+
macro (ompt_state_wait_atomic, 0x043) /* waiting for atomic */ \
|
| 82 |
+
macro (ompt_state_wait_ordered, 0x044) /* waiting for ordered */ \
|
| 83 |
+
\
|
| 84 |
+
/* target wait states (128..255) */ \
|
| 85 |
+
macro (ompt_state_wait_target, 0x080) /* waiting for target region */ \
|
| 86 |
+
macro (ompt_state_wait_target_map, 0x081) /* waiting for target data mapping operation */ \
|
| 87 |
+
macro (ompt_state_wait_target_update, 0x082) /* waiting for target update operation */ \
|
| 88 |
+
\
|
| 89 |
+
/* misc (256..511) */ \
|
| 90 |
+
macro (ompt_state_idle, 0x100) /* waiting for work */ \
|
| 91 |
+
macro (ompt_state_overhead, 0x101) /* overhead excluding wait states */ \
|
| 92 |
+
\
|
| 93 |
+
/* implementation-specific states (512..) */
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
#define FOREACH_KMP_MUTEX_IMPL(macro) \
|
| 97 |
+
macro (kmp_mutex_impl_none, 0) /* unknown implementation */ \
|
| 98 |
+
macro (kmp_mutex_impl_spin, 1) /* based on spin */ \
|
| 99 |
+
macro (kmp_mutex_impl_queuing, 2) /* based on some fair policy */ \
|
| 100 |
+
macro (kmp_mutex_impl_speculative, 3) /* based on HW-supported speculation */
|
| 101 |
+
|
| 102 |
+
#define FOREACH_OMPT_EVENT(macro) \
|
| 103 |
+
\
|
| 104 |
+
/*--- Mandatory Events ---*/ \
|
| 105 |
+
macro (ompt_callback_thread_begin, ompt_callback_thread_begin_t, 1) /* thread begin */ \
|
| 106 |
+
macro (ompt_callback_thread_end, ompt_callback_thread_end_t, 2) /* thread end */ \
|
| 107 |
+
\
|
| 108 |
+
macro (ompt_callback_parallel_begin, ompt_callback_parallel_begin_t, 3) /* parallel begin */ \
|
| 109 |
+
macro (ompt_callback_parallel_end, ompt_callback_parallel_end_t, 4) /* parallel end */ \
|
| 110 |
+
\
|
| 111 |
+
macro (ompt_callback_task_create, ompt_callback_task_create_t, 5) /* task begin */ \
|
| 112 |
+
macro (ompt_callback_task_schedule, ompt_callback_task_schedule_t, 6) /* task schedule */ \
|
| 113 |
+
macro (ompt_callback_implicit_task, ompt_callback_implicit_task_t, 7) /* implicit task */ \
|
| 114 |
+
\
|
| 115 |
+
macro (ompt_callback_target, ompt_callback_target_t, 8) /* target */ \
|
| 116 |
+
macro (ompt_callback_target_data_op, ompt_callback_target_data_op_t, 9) /* target data op */ \
|
| 117 |
+
macro (ompt_callback_target_submit, ompt_callback_target_submit_t, 10) /* target submit */ \
|
| 118 |
+
\
|
| 119 |
+
macro (ompt_callback_control_tool, ompt_callback_control_tool_t, 11) /* control tool */ \
|
| 120 |
+
\
|
| 121 |
+
macro (ompt_callback_device_initialize, ompt_callback_device_initialize_t, 12) /* device initialize */ \
|
| 122 |
+
macro (ompt_callback_device_finalize, ompt_callback_device_finalize_t, 13) /* device finalize */ \
|
| 123 |
+
\
|
| 124 |
+
macro (ompt_callback_device_load, ompt_callback_device_load_t, 14) /* device load */ \
|
| 125 |
+
macro (ompt_callback_device_unload, ompt_callback_device_unload_t, 15) /* device unload */ \
|
| 126 |
+
\
|
| 127 |
+
/* Optional Events */ \
|
| 128 |
+
macro (ompt_callback_sync_region_wait, ompt_callback_sync_region_t, 16) /* sync region wait begin or end */ \
|
| 129 |
+
\
|
| 130 |
+
macro (ompt_callback_mutex_released, ompt_callback_mutex_t, 17) /* mutex released */ \
|
| 131 |
+
\
|
| 132 |
+
macro (ompt_callback_dependences, ompt_callback_dependences_t, 18) /* report task dependences */ \
|
| 133 |
+
macro (ompt_callback_task_dependence, ompt_callback_task_dependence_t, 19) /* report task dependence */ \
|
| 134 |
+
\
|
| 135 |
+
macro (ompt_callback_work, ompt_callback_work_t, 20) /* task at work begin or end */ \
|
| 136 |
+
\
|
| 137 |
+
macro (ompt_callback_master, ompt_callback_master_t, 21) /* task at master begin or end */ \
|
| 138 |
+
\
|
| 139 |
+
macro (ompt_callback_target_map, ompt_callback_target_map_t, 22) /* target map */ \
|
| 140 |
+
\
|
| 141 |
+
macro (ompt_callback_sync_region, ompt_callback_sync_region_t, 23) /* sync region begin or end */ \
|
| 142 |
+
\
|
| 143 |
+
macro (ompt_callback_lock_init, ompt_callback_mutex_acquire_t, 24) /* lock init */ \
|
| 144 |
+
macro (ompt_callback_lock_destroy, ompt_callback_mutex_t, 25) /* lock destroy */ \
|
| 145 |
+
\
|
| 146 |
+
macro (ompt_callback_mutex_acquire, ompt_callback_mutex_acquire_t, 26) /* mutex acquire */ \
|
| 147 |
+
macro (ompt_callback_mutex_acquired, ompt_callback_mutex_t, 27) /* mutex acquired */ \
|
| 148 |
+
\
|
| 149 |
+
macro (ompt_callback_nest_lock, ompt_callback_nest_lock_t, 28) /* nest lock */ \
|
| 150 |
+
\
|
| 151 |
+
macro (ompt_callback_flush, ompt_callback_flush_t, 29) /* after executing flush */ \
|
| 152 |
+
\
|
| 153 |
+
macro (ompt_callback_cancel, ompt_callback_cancel_t, 30) /* cancel innermost binding region */ \
|
| 154 |
+
\
|
| 155 |
+
macro (ompt_callback_reduction, ompt_callback_sync_region_t, 31) /* reduction */ \
|
| 156 |
+
\
|
| 157 |
+
macro (ompt_callback_dispatch, ompt_callback_dispatch_t, 32) /* dispatch of work */
|
| 158 |
+
|
| 159 |
+
/*****************************************************************************
|
| 160 |
+
* implementation specific types
|
| 161 |
+
*****************************************************************************/
|
| 162 |
+
|
| 163 |
+
typedef enum kmp_mutex_impl_t {
|
| 164 |
+
#define kmp_mutex_impl_macro(impl, code) impl = code,
|
| 165 |
+
FOREACH_KMP_MUTEX_IMPL(kmp_mutex_impl_macro)
|
| 166 |
+
#undef kmp_mutex_impl_macro
|
| 167 |
+
} kmp_mutex_impl_t;
|
| 168 |
+
|
| 169 |
+
/*****************************************************************************
|
| 170 |
+
* definitions generated from spec
|
| 171 |
+
*****************************************************************************/
|
| 172 |
+
|
| 173 |
+
typedef enum ompt_callbacks_t {
|
| 174 |
+
ompt_callback_thread_begin = 1,
|
| 175 |
+
ompt_callback_thread_end = 2,
|
| 176 |
+
ompt_callback_parallel_begin = 3,
|
| 177 |
+
ompt_callback_parallel_end = 4,
|
| 178 |
+
ompt_callback_task_create = 5,
|
| 179 |
+
ompt_callback_task_schedule = 6,
|
| 180 |
+
ompt_callback_implicit_task = 7,
|
| 181 |
+
ompt_callback_target = 8,
|
| 182 |
+
ompt_callback_target_data_op = 9,
|
| 183 |
+
ompt_callback_target_submit = 10,
|
| 184 |
+
ompt_callback_control_tool = 11,
|
| 185 |
+
ompt_callback_device_initialize = 12,
|
| 186 |
+
ompt_callback_device_finalize = 13,
|
| 187 |
+
ompt_callback_device_load = 14,
|
| 188 |
+
ompt_callback_device_unload = 15,
|
| 189 |
+
ompt_callback_sync_region_wait = 16,
|
| 190 |
+
ompt_callback_mutex_released = 17,
|
| 191 |
+
ompt_callback_dependences = 18,
|
| 192 |
+
ompt_callback_task_dependence = 19,
|
| 193 |
+
ompt_callback_work = 20,
|
| 194 |
+
ompt_callback_master = 21,
|
| 195 |
+
ompt_callback_target_map = 22,
|
| 196 |
+
ompt_callback_sync_region = 23,
|
| 197 |
+
ompt_callback_lock_init = 24,
|
| 198 |
+
ompt_callback_lock_destroy = 25,
|
| 199 |
+
ompt_callback_mutex_acquire = 26,
|
| 200 |
+
ompt_callback_mutex_acquired = 27,
|
| 201 |
+
ompt_callback_nest_lock = 28,
|
| 202 |
+
ompt_callback_flush = 29,
|
| 203 |
+
ompt_callback_cancel = 30,
|
| 204 |
+
ompt_callback_reduction = 31,
|
| 205 |
+
ompt_callback_dispatch = 32
|
| 206 |
+
} ompt_callbacks_t;
|
| 207 |
+
|
| 208 |
+
typedef enum ompt_record_t {
|
| 209 |
+
ompt_record_ompt = 1,
|
| 210 |
+
ompt_record_native = 2,
|
| 211 |
+
ompt_record_invalid = 3
|
| 212 |
+
} ompt_record_t;
|
| 213 |
+
|
| 214 |
+
typedef enum ompt_record_native_t {
|
| 215 |
+
ompt_record_native_info = 1,
|
| 216 |
+
ompt_record_native_event = 2
|
| 217 |
+
} ompt_record_native_t;
|
| 218 |
+
|
| 219 |
+
typedef enum ompt_set_result_t {
|
| 220 |
+
ompt_set_error = 0,
|
| 221 |
+
ompt_set_never = 1,
|
| 222 |
+
ompt_set_impossible = 2,
|
| 223 |
+
ompt_set_sometimes = 3,
|
| 224 |
+
ompt_set_sometimes_paired = 4,
|
| 225 |
+
ompt_set_always = 5
|
| 226 |
+
} ompt_set_result_t;
|
| 227 |
+
|
| 228 |
+
typedef uint64_t ompt_id_t;
|
| 229 |
+
|
| 230 |
+
typedef uint64_t ompt_device_time_t;
|
| 231 |
+
|
| 232 |
+
typedef uint64_t ompt_buffer_cursor_t;
|
| 233 |
+
|
| 234 |
+
typedef enum ompt_thread_t {
|
| 235 |
+
ompt_thread_initial = 1,
|
| 236 |
+
ompt_thread_worker = 2,
|
| 237 |
+
ompt_thread_other = 3,
|
| 238 |
+
ompt_thread_unknown = 4
|
| 239 |
+
} ompt_thread_t;
|
| 240 |
+
|
| 241 |
+
typedef enum ompt_scope_endpoint_t {
|
| 242 |
+
ompt_scope_begin = 1,
|
| 243 |
+
ompt_scope_end = 2
|
| 244 |
+
} ompt_scope_endpoint_t;
|
| 245 |
+
|
| 246 |
+
typedef enum ompt_dispatch_t {
|
| 247 |
+
ompt_dispatch_iteration = 1,
|
| 248 |
+
ompt_dispatch_section = 2
|
| 249 |
+
} ompt_dispatch_t;
|
| 250 |
+
|
| 251 |
+
typedef enum ompt_sync_region_t {
|
| 252 |
+
ompt_sync_region_barrier = 1,
|
| 253 |
+
ompt_sync_region_barrier_implicit = 2,
|
| 254 |
+
ompt_sync_region_barrier_explicit = 3,
|
| 255 |
+
ompt_sync_region_barrier_implementation = 4,
|
| 256 |
+
ompt_sync_region_taskwait = 5,
|
| 257 |
+
ompt_sync_region_taskgroup = 6,
|
| 258 |
+
ompt_sync_region_reduction = 7
|
| 259 |
+
} ompt_sync_region_t;
|
| 260 |
+
|
| 261 |
+
typedef enum ompt_target_data_op_t {
|
| 262 |
+
ompt_target_data_alloc = 1,
|
| 263 |
+
ompt_target_data_transfer_to_device = 2,
|
| 264 |
+
ompt_target_data_transfer_from_device = 3,
|
| 265 |
+
ompt_target_data_delete = 4,
|
| 266 |
+
ompt_target_data_associate = 5,
|
| 267 |
+
ompt_target_data_disassociate = 6
|
| 268 |
+
} ompt_target_data_op_t;
|
| 269 |
+
|
| 270 |
+
typedef enum ompt_work_t {
|
| 271 |
+
ompt_work_loop = 1,
|
| 272 |
+
ompt_work_sections = 2,
|
| 273 |
+
ompt_work_single_executor = 3,
|
| 274 |
+
ompt_work_single_other = 4,
|
| 275 |
+
ompt_work_workshare = 5,
|
| 276 |
+
ompt_work_distribute = 6,
|
| 277 |
+
ompt_work_taskloop = 7
|
| 278 |
+
} ompt_work_t;
|
| 279 |
+
|
| 280 |
+
typedef enum ompt_mutex_t {
|
| 281 |
+
ompt_mutex_lock = 1,
|
| 282 |
+
ompt_mutex_test_lock = 2,
|
| 283 |
+
ompt_mutex_nest_lock = 3,
|
| 284 |
+
ompt_mutex_test_nest_lock = 4,
|
| 285 |
+
ompt_mutex_critical = 5,
|
| 286 |
+
ompt_mutex_atomic = 6,
|
| 287 |
+
ompt_mutex_ordered = 7
|
| 288 |
+
} ompt_mutex_t;
|
| 289 |
+
|
| 290 |
+
typedef enum ompt_native_mon_flag_t {
|
| 291 |
+
ompt_native_data_motion_explicit = 0x01,
|
| 292 |
+
ompt_native_data_motion_implicit = 0x02,
|
| 293 |
+
ompt_native_kernel_invocation = 0x04,
|
| 294 |
+
ompt_native_kernel_execution = 0x08,
|
| 295 |
+
ompt_native_driver = 0x10,
|
| 296 |
+
ompt_native_runtime = 0x20,
|
| 297 |
+
ompt_native_overhead = 0x40,
|
| 298 |
+
ompt_native_idleness = 0x80
|
| 299 |
+
} ompt_native_mon_flag_t;
|
| 300 |
+
|
| 301 |
+
typedef enum ompt_task_flag_t {
|
| 302 |
+
ompt_task_initial = 0x00000001,
|
| 303 |
+
ompt_task_implicit = 0x00000002,
|
| 304 |
+
ompt_task_explicit = 0x00000004,
|
| 305 |
+
ompt_task_target = 0x00000008,
|
| 306 |
+
ompt_task_undeferred = 0x08000000,
|
| 307 |
+
ompt_task_untied = 0x10000000,
|
| 308 |
+
ompt_task_final = 0x20000000,
|
| 309 |
+
ompt_task_mergeable = 0x40000000,
|
| 310 |
+
ompt_task_merged = 0x80000000
|
| 311 |
+
} ompt_task_flag_t;
|
| 312 |
+
|
| 313 |
+
typedef enum ompt_task_status_t {
|
| 314 |
+
ompt_task_complete = 1,
|
| 315 |
+
ompt_task_yield = 2,
|
| 316 |
+
ompt_task_cancel = 3,
|
| 317 |
+
ompt_task_detach = 4,
|
| 318 |
+
ompt_task_early_fulfill = 5,
|
| 319 |
+
ompt_task_late_fulfill = 6,
|
| 320 |
+
ompt_task_switch = 7
|
| 321 |
+
} ompt_task_status_t;
|
| 322 |
+
|
| 323 |
+
typedef enum ompt_target_t {
|
| 324 |
+
ompt_target = 1,
|
| 325 |
+
ompt_target_enter_data = 2,
|
| 326 |
+
ompt_target_exit_data = 3,
|
| 327 |
+
ompt_target_update = 4
|
| 328 |
+
} ompt_target_t;
|
| 329 |
+
|
| 330 |
+
typedef enum ompt_parallel_flag_t {
|
| 331 |
+
ompt_parallel_invoker_program = 0x00000001,
|
| 332 |
+
ompt_parallel_invoker_runtime = 0x00000002,
|
| 333 |
+
ompt_parallel_league = 0x40000000,
|
| 334 |
+
ompt_parallel_team = 0x80000000
|
| 335 |
+
} ompt_parallel_flag_t;
|
| 336 |
+
|
| 337 |
+
typedef enum ompt_target_map_flag_t {
|
| 338 |
+
ompt_target_map_flag_to = 0x01,
|
| 339 |
+
ompt_target_map_flag_from = 0x02,
|
| 340 |
+
ompt_target_map_flag_alloc = 0x04,
|
| 341 |
+
ompt_target_map_flag_release = 0x08,
|
| 342 |
+
ompt_target_map_flag_delete = 0x10,
|
| 343 |
+
ompt_target_map_flag_implicit = 0x20
|
| 344 |
+
} ompt_target_map_flag_t;
|
| 345 |
+
|
| 346 |
+
typedef enum ompt_dependence_type_t {
|
| 347 |
+
ompt_dependence_type_in = 1,
|
| 348 |
+
ompt_dependence_type_out = 2,
|
| 349 |
+
ompt_dependence_type_inout = 3,
|
| 350 |
+
ompt_dependence_type_mutexinoutset = 4,
|
| 351 |
+
ompt_dependence_type_source = 5,
|
| 352 |
+
ompt_dependence_type_sink = 6
|
| 353 |
+
} ompt_dependence_type_t;
|
| 354 |
+
|
| 355 |
+
typedef enum ompt_cancel_flag_t {
|
| 356 |
+
ompt_cancel_parallel = 0x01,
|
| 357 |
+
ompt_cancel_sections = 0x02,
|
| 358 |
+
ompt_cancel_loop = 0x04,
|
| 359 |
+
ompt_cancel_taskgroup = 0x08,
|
| 360 |
+
ompt_cancel_activated = 0x10,
|
| 361 |
+
ompt_cancel_detected = 0x20,
|
| 362 |
+
ompt_cancel_discarded_task = 0x40
|
| 363 |
+
} ompt_cancel_flag_t;
|
| 364 |
+
|
| 365 |
+
typedef uint64_t ompt_hwid_t;
|
| 366 |
+
|
| 367 |
+
typedef uint64_t ompt_wait_id_t;
|
| 368 |
+
|
| 369 |
+
typedef enum ompt_frame_flag_t {
|
| 370 |
+
ompt_frame_runtime = 0x00,
|
| 371 |
+
ompt_frame_application = 0x01,
|
| 372 |
+
ompt_frame_cfa = 0x10,
|
| 373 |
+
ompt_frame_framepointer = 0x20,
|
| 374 |
+
ompt_frame_stackaddress = 0x30
|
| 375 |
+
} ompt_frame_flag_t;
|
| 376 |
+
|
| 377 |
+
typedef enum ompt_state_t {
|
| 378 |
+
ompt_state_work_serial = 0x000,
|
| 379 |
+
ompt_state_work_parallel = 0x001,
|
| 380 |
+
ompt_state_work_reduction = 0x002,
|
| 381 |
+
|
| 382 |
+
ompt_state_wait_barrier = 0x010,
|
| 383 |
+
ompt_state_wait_barrier_implicit_parallel = 0x011,
|
| 384 |
+
ompt_state_wait_barrier_implicit_workshare = 0x012,
|
| 385 |
+
ompt_state_wait_barrier_implicit = 0x013,
|
| 386 |
+
ompt_state_wait_barrier_explicit = 0x014,
|
| 387 |
+
|
| 388 |
+
ompt_state_wait_taskwait = 0x020,
|
| 389 |
+
ompt_state_wait_taskgroup = 0x021,
|
| 390 |
+
|
| 391 |
+
ompt_state_wait_mutex = 0x040,
|
| 392 |
+
ompt_state_wait_lock = 0x041,
|
| 393 |
+
ompt_state_wait_critical = 0x042,
|
| 394 |
+
ompt_state_wait_atomic = 0x043,
|
| 395 |
+
ompt_state_wait_ordered = 0x044,
|
| 396 |
+
|
| 397 |
+
ompt_state_wait_target = 0x080,
|
| 398 |
+
ompt_state_wait_target_map = 0x081,
|
| 399 |
+
ompt_state_wait_target_update = 0x082,
|
| 400 |
+
|
| 401 |
+
ompt_state_idle = 0x100,
|
| 402 |
+
ompt_state_overhead = 0x101,
|
| 403 |
+
ompt_state_undefined = 0x102
|
| 404 |
+
} ompt_state_t;
|
| 405 |
+
|
| 406 |
+
typedef uint64_t (*ompt_get_unique_id_t) (void);
|
| 407 |
+
|
| 408 |
+
typedef uint64_t ompd_size_t;
|
| 409 |
+
|
| 410 |
+
typedef uint64_t ompd_wait_id_t;
|
| 411 |
+
|
| 412 |
+
typedef uint64_t ompd_addr_t;
|
| 413 |
+
typedef int64_t ompd_word_t;
|
| 414 |
+
typedef uint64_t ompd_seg_t;
|
| 415 |
+
|
| 416 |
+
typedef uint64_t ompd_device_t;
|
| 417 |
+
|
| 418 |
+
typedef uint64_t ompd_thread_id_t;
|
| 419 |
+
|
| 420 |
+
typedef enum ompd_scope_t {
|
| 421 |
+
ompd_scope_global = 1,
|
| 422 |
+
ompd_scope_address_space = 2,
|
| 423 |
+
ompd_scope_thread = 3,
|
| 424 |
+
ompd_scope_parallel = 4,
|
| 425 |
+
ompd_scope_implicit_task = 5,
|
| 426 |
+
ompd_scope_task = 6
|
| 427 |
+
} ompd_scope_t;
|
| 428 |
+
|
| 429 |
+
typedef uint64_t ompd_icv_id_t;
|
| 430 |
+
|
| 431 |
+
typedef enum ompd_rc_t {
|
| 432 |
+
ompd_rc_ok = 0,
|
| 433 |
+
ompd_rc_unavailable = 1,
|
| 434 |
+
ompd_rc_stale_handle = 2,
|
| 435 |
+
ompd_rc_bad_input = 3,
|
| 436 |
+
ompd_rc_error = 4,
|
| 437 |
+
ompd_rc_unsupported = 5,
|
| 438 |
+
ompd_rc_needs_state_tracking = 6,
|
| 439 |
+
ompd_rc_incompatible = 7,
|
| 440 |
+
ompd_rc_device_read_error = 8,
|
| 441 |
+
ompd_rc_device_write_error = 9,
|
| 442 |
+
ompd_rc_nomem = 10,
|
| 443 |
+
} ompd_rc_t;
|
| 444 |
+
|
| 445 |
+
typedef void (*ompt_interface_fn_t) (void);
|
| 446 |
+
|
| 447 |
+
typedef ompt_interface_fn_t (*ompt_function_lookup_t) (
|
| 448 |
+
const char *interface_function_name
|
| 449 |
+
);
|
| 450 |
+
|
| 451 |
+
typedef union ompt_data_t {
|
| 452 |
+
uint64_t value;
|
| 453 |
+
void *ptr;
|
| 454 |
+
} ompt_data_t;
|
| 455 |
+
|
| 456 |
+
typedef struct ompt_frame_t {
|
| 457 |
+
ompt_data_t exit_frame;
|
| 458 |
+
ompt_data_t enter_frame;
|
| 459 |
+
int exit_frame_flags;
|
| 460 |
+
int enter_frame_flags;
|
| 461 |
+
} ompt_frame_t;
|
| 462 |
+
|
| 463 |
+
typedef void (*ompt_callback_t) (void);
|
| 464 |
+
|
| 465 |
+
typedef void ompt_device_t;
|
| 466 |
+
|
| 467 |
+
typedef void ompt_buffer_t;
|
| 468 |
+
|
| 469 |
+
typedef void (*ompt_callback_buffer_request_t) (
|
| 470 |
+
int device_num,
|
| 471 |
+
ompt_buffer_t **buffer,
|
| 472 |
+
size_t *bytes
|
| 473 |
+
);
|
| 474 |
+
|
| 475 |
+
typedef void (*ompt_callback_buffer_complete_t) (
|
| 476 |
+
int device_num,
|
| 477 |
+
ompt_buffer_t *buffer,
|
| 478 |
+
size_t bytes,
|
| 479 |
+
ompt_buffer_cursor_t begin,
|
| 480 |
+
int buffer_owned
|
| 481 |
+
);
|
| 482 |
+
|
| 483 |
+
typedef void (*ompt_finalize_t) (
|
| 484 |
+
ompt_data_t *tool_data
|
| 485 |
+
);
|
| 486 |
+
|
| 487 |
+
typedef int (*ompt_initialize_t) (
|
| 488 |
+
ompt_function_lookup_t lookup,
|
| 489 |
+
int initial_device_num,
|
| 490 |
+
ompt_data_t *tool_data
|
| 491 |
+
);
|
| 492 |
+
|
| 493 |
+
typedef struct ompt_start_tool_result_t {
|
| 494 |
+
ompt_initialize_t initialize;
|
| 495 |
+
ompt_finalize_t finalize;
|
| 496 |
+
ompt_data_t tool_data;
|
| 497 |
+
} ompt_start_tool_result_t;
|
| 498 |
+
|
| 499 |
+
typedef struct ompt_record_abstract_t {
|
| 500 |
+
ompt_record_native_t rclass;
|
| 501 |
+
const char *type;
|
| 502 |
+
ompt_device_time_t start_time;
|
| 503 |
+
ompt_device_time_t end_time;
|
| 504 |
+
ompt_hwid_t hwid;
|
| 505 |
+
} ompt_record_abstract_t;
|
| 506 |
+
|
| 507 |
+
typedef struct ompt_dependence_t {
|
| 508 |
+
ompt_data_t variable;
|
| 509 |
+
ompt_dependence_type_t dependence_type;
|
| 510 |
+
} ompt_dependence_t;
|
| 511 |
+
|
| 512 |
+
typedef int (*ompt_enumerate_states_t) (
|
| 513 |
+
int current_state,
|
| 514 |
+
int *next_state,
|
| 515 |
+
const char **next_state_name
|
| 516 |
+
);
|
| 517 |
+
|
| 518 |
+
typedef int (*ompt_enumerate_mutex_impls_t) (
|
| 519 |
+
int current_impl,
|
| 520 |
+
int *next_impl,
|
| 521 |
+
const char **next_impl_name
|
| 522 |
+
);
|
| 523 |
+
|
| 524 |
+
typedef ompt_set_result_t (*ompt_set_callback_t) (
|
| 525 |
+
ompt_callbacks_t event,
|
| 526 |
+
ompt_callback_t callback
|
| 527 |
+
);
|
| 528 |
+
|
| 529 |
+
typedef int (*ompt_get_callback_t) (
|
| 530 |
+
ompt_callbacks_t event,
|
| 531 |
+
ompt_callback_t *callback
|
| 532 |
+
);
|
| 533 |
+
|
| 534 |
+
typedef ompt_data_t *(*ompt_get_thread_data_t) (void);
|
| 535 |
+
|
| 536 |
+
typedef int (*ompt_get_num_procs_t) (void);
|
| 537 |
+
|
| 538 |
+
typedef int (*ompt_get_num_places_t) (void);
|
| 539 |
+
|
| 540 |
+
typedef int (*ompt_get_place_proc_ids_t) (
|
| 541 |
+
int place_num,
|
| 542 |
+
int ids_size,
|
| 543 |
+
int *ids
|
| 544 |
+
);
|
| 545 |
+
|
| 546 |
+
typedef int (*ompt_get_place_num_t) (void);
|
| 547 |
+
|
| 548 |
+
typedef int (*ompt_get_partition_place_nums_t) (
|
| 549 |
+
int place_nums_size,
|
| 550 |
+
int *place_nums
|
| 551 |
+
);
|
| 552 |
+
|
| 553 |
+
typedef int (*ompt_get_proc_id_t) (void);
|
| 554 |
+
|
| 555 |
+
typedef int (*ompt_get_state_t) (
|
| 556 |
+
ompt_wait_id_t *wait_id
|
| 557 |
+
);
|
| 558 |
+
|
| 559 |
+
typedef int (*ompt_get_parallel_info_t) (
|
| 560 |
+
int ancestor_level,
|
| 561 |
+
ompt_data_t **parallel_data,
|
| 562 |
+
int *team_size
|
| 563 |
+
);
|
| 564 |
+
|
| 565 |
+
typedef int (*ompt_get_task_info_t) (
|
| 566 |
+
int ancestor_level,
|
| 567 |
+
int *flags,
|
| 568 |
+
ompt_data_t **task_data,
|
| 569 |
+
ompt_frame_t **task_frame,
|
| 570 |
+
ompt_data_t **parallel_data,
|
| 571 |
+
int *thread_num
|
| 572 |
+
);
|
| 573 |
+
|
| 574 |
+
typedef int (*ompt_get_task_memory_t)(
|
| 575 |
+
void **addr,
|
| 576 |
+
size_t *size,
|
| 577 |
+
int block
|
| 578 |
+
);
|
| 579 |
+
|
| 580 |
+
typedef int (*ompt_get_target_info_t) (
|
| 581 |
+
uint64_t *device_num,
|
| 582 |
+
ompt_id_t *target_id,
|
| 583 |
+
ompt_id_t *host_op_id
|
| 584 |
+
);
|
| 585 |
+
|
| 586 |
+
typedef int (*ompt_get_num_devices_t) (void);
|
| 587 |
+
|
| 588 |
+
typedef void (*ompt_finalize_tool_t) (void);
|
| 589 |
+
|
| 590 |
+
typedef int (*ompt_get_device_num_procs_t) (
|
| 591 |
+
ompt_device_t *device
|
| 592 |
+
);
|
| 593 |
+
|
| 594 |
+
typedef ompt_device_time_t (*ompt_get_device_time_t) (
|
| 595 |
+
ompt_device_t *device
|
| 596 |
+
);
|
| 597 |
+
|
| 598 |
+
typedef double (*ompt_translate_time_t) (
|
| 599 |
+
ompt_device_t *device,
|
| 600 |
+
ompt_device_time_t time
|
| 601 |
+
);
|
| 602 |
+
|
| 603 |
+
typedef ompt_set_result_t (*ompt_set_trace_ompt_t) (
|
| 604 |
+
ompt_device_t *device,
|
| 605 |
+
unsigned int enable,
|
| 606 |
+
unsigned int etype
|
| 607 |
+
);
|
| 608 |
+
|
| 609 |
+
typedef ompt_set_result_t (*ompt_set_trace_native_t) (
|
| 610 |
+
ompt_device_t *device,
|
| 611 |
+
int enable,
|
| 612 |
+
int flags
|
| 613 |
+
);
|
| 614 |
+
|
| 615 |
+
typedef int (*ompt_start_trace_t) (
|
| 616 |
+
ompt_device_t *device,
|
| 617 |
+
ompt_callback_buffer_request_t request,
|
| 618 |
+
ompt_callback_buffer_complete_t complete
|
| 619 |
+
);
|
| 620 |
+
|
| 621 |
+
typedef int (*ompt_pause_trace_t) (
|
| 622 |
+
ompt_device_t *device,
|
| 623 |
+
int begin_pause
|
| 624 |
+
);
|
| 625 |
+
|
| 626 |
+
typedef int (*ompt_flush_trace_t) (
|
| 627 |
+
ompt_device_t *device
|
| 628 |
+
);
|
| 629 |
+
|
| 630 |
+
typedef int (*ompt_stop_trace_t) (
|
| 631 |
+
ompt_device_t *device
|
| 632 |
+
);
|
| 633 |
+
|
| 634 |
+
typedef int (*ompt_advance_buffer_cursor_t) (
|
| 635 |
+
ompt_device_t *device,
|
| 636 |
+
ompt_buffer_t *buffer,
|
| 637 |
+
size_t size,
|
| 638 |
+
ompt_buffer_cursor_t current,
|
| 639 |
+
ompt_buffer_cursor_t *next
|
| 640 |
+
);
|
| 641 |
+
|
| 642 |
+
typedef ompt_record_t (*ompt_get_record_type_t) (
|
| 643 |
+
ompt_buffer_t *buffer,
|
| 644 |
+
ompt_buffer_cursor_t current
|
| 645 |
+
);
|
| 646 |
+
|
| 647 |
+
typedef void *(*ompt_get_record_native_t) (
|
| 648 |
+
ompt_buffer_t *buffer,
|
| 649 |
+
ompt_buffer_cursor_t current,
|
| 650 |
+
ompt_id_t *host_op_id
|
| 651 |
+
);
|
| 652 |
+
|
| 653 |
+
typedef ompt_record_abstract_t *
|
| 654 |
+
(*ompt_get_record_abstract_t) (
|
| 655 |
+
void *native_record
|
| 656 |
+
);
|
| 657 |
+
|
| 658 |
+
typedef void (*ompt_callback_thread_begin_t) (
|
| 659 |
+
ompt_thread_t thread_type,
|
| 660 |
+
ompt_data_t *thread_data
|
| 661 |
+
);
|
| 662 |
+
|
| 663 |
+
typedef struct ompt_record_thread_begin_t {
|
| 664 |
+
ompt_thread_t thread_type;
|
| 665 |
+
} ompt_record_thread_begin_t;
|
| 666 |
+
|
| 667 |
+
typedef void (*ompt_callback_thread_end_t) (
|
| 668 |
+
ompt_data_t *thread_data
|
| 669 |
+
);
|
| 670 |
+
|
| 671 |
+
typedef void (*ompt_callback_parallel_begin_t) (
|
| 672 |
+
ompt_data_t *encountering_task_data,
|
| 673 |
+
const ompt_frame_t *encountering_task_frame,
|
| 674 |
+
ompt_data_t *parallel_data,
|
| 675 |
+
unsigned int requested_parallelism,
|
| 676 |
+
int flags,
|
| 677 |
+
const void *codeptr_ra
|
| 678 |
+
);
|
| 679 |
+
|
| 680 |
+
typedef struct ompt_record_parallel_begin_t {
|
| 681 |
+
ompt_id_t encountering_task_id;
|
| 682 |
+
ompt_id_t parallel_id;
|
| 683 |
+
unsigned int requested_parallelism;
|
| 684 |
+
int flags;
|
| 685 |
+
const void *codeptr_ra;
|
| 686 |
+
} ompt_record_parallel_begin_t;
|
| 687 |
+
|
| 688 |
+
typedef void (*ompt_callback_parallel_end_t) (
|
| 689 |
+
ompt_data_t *parallel_data,
|
| 690 |
+
ompt_data_t *encountering_task_data,
|
| 691 |
+
int flags,
|
| 692 |
+
const void *codeptr_ra
|
| 693 |
+
);
|
| 694 |
+
|
| 695 |
+
typedef struct ompt_record_parallel_end_t {
|
| 696 |
+
ompt_id_t parallel_id;
|
| 697 |
+
ompt_id_t encountering_task_id;
|
| 698 |
+
int flags;
|
| 699 |
+
const void *codeptr_ra;
|
| 700 |
+
} ompt_record_parallel_end_t;
|
| 701 |
+
|
| 702 |
+
typedef void (*ompt_callback_work_t) (
|
| 703 |
+
ompt_work_t wstype,
|
| 704 |
+
ompt_scope_endpoint_t endpoint,
|
| 705 |
+
ompt_data_t *parallel_data,
|
| 706 |
+
ompt_data_t *task_data,
|
| 707 |
+
uint64_t count,
|
| 708 |
+
const void *codeptr_ra
|
| 709 |
+
);
|
| 710 |
+
|
| 711 |
+
typedef struct ompt_record_work_t {
|
| 712 |
+
ompt_work_t wstype;
|
| 713 |
+
ompt_scope_endpoint_t endpoint;
|
| 714 |
+
ompt_id_t parallel_id;
|
| 715 |
+
ompt_id_t task_id;
|
| 716 |
+
uint64_t count;
|
| 717 |
+
const void *codeptr_ra;
|
| 718 |
+
} ompt_record_work_t;
|
| 719 |
+
|
| 720 |
+
typedef void (*ompt_callback_dispatch_t) (
|
| 721 |
+
ompt_data_t *parallel_data,
|
| 722 |
+
ompt_data_t *task_data,
|
| 723 |
+
ompt_dispatch_t kind,
|
| 724 |
+
ompt_data_t instance
|
| 725 |
+
);
|
| 726 |
+
|
| 727 |
+
typedef struct ompt_record_dispatch_t {
|
| 728 |
+
ompt_id_t parallel_id;
|
| 729 |
+
ompt_id_t task_id;
|
| 730 |
+
ompt_dispatch_t kind;
|
| 731 |
+
ompt_data_t instance;
|
| 732 |
+
} ompt_record_dispatch_t;
|
| 733 |
+
|
| 734 |
+
typedef void (*ompt_callback_task_create_t) (
|
| 735 |
+
ompt_data_t *encountering_task_data,
|
| 736 |
+
const ompt_frame_t *encountering_task_frame,
|
| 737 |
+
ompt_data_t *new_task_data,
|
| 738 |
+
int flags,
|
| 739 |
+
int has_dependences,
|
| 740 |
+
const void *codeptr_ra
|
| 741 |
+
);
|
| 742 |
+
|
| 743 |
+
typedef struct ompt_record_task_create_t {
|
| 744 |
+
ompt_id_t encountering_task_id;
|
| 745 |
+
ompt_id_t new_task_id;
|
| 746 |
+
int flags;
|
| 747 |
+
int has_dependences;
|
| 748 |
+
const void *codeptr_ra;
|
| 749 |
+
} ompt_record_task_create_t;
|
| 750 |
+
|
| 751 |
+
typedef void (*ompt_callback_dependences_t) (
|
| 752 |
+
ompt_data_t *task_data,
|
| 753 |
+
const ompt_dependence_t *deps,
|
| 754 |
+
int ndeps
|
| 755 |
+
);
|
| 756 |
+
|
| 757 |
+
typedef struct ompt_record_dependences_t {
|
| 758 |
+
ompt_id_t task_id;
|
| 759 |
+
ompt_dependence_t dep;
|
| 760 |
+
int ndeps;
|
| 761 |
+
} ompt_record_dependences_t;
|
| 762 |
+
|
| 763 |
+
typedef void (*ompt_callback_task_dependence_t) (
|
| 764 |
+
ompt_data_t *src_task_data,
|
| 765 |
+
ompt_data_t *sink_task_data
|
| 766 |
+
);
|
| 767 |
+
|
| 768 |
+
typedef struct ompt_record_task_dependence_t {
|
| 769 |
+
ompt_id_t src_task_id;
|
| 770 |
+
ompt_id_t sink_task_id;
|
| 771 |
+
} ompt_record_task_dependence_t;
|
| 772 |
+
|
| 773 |
+
typedef void (*ompt_callback_task_schedule_t) (
|
| 774 |
+
ompt_data_t *prior_task_data,
|
| 775 |
+
ompt_task_status_t prior_task_status,
|
| 776 |
+
ompt_data_t *next_task_data
|
| 777 |
+
);
|
| 778 |
+
|
| 779 |
+
typedef struct ompt_record_task_schedule_t {
|
| 780 |
+
ompt_id_t prior_task_id;
|
| 781 |
+
ompt_task_status_t prior_task_status;
|
| 782 |
+
ompt_id_t next_task_id;
|
| 783 |
+
} ompt_record_task_schedule_t;
|
| 784 |
+
|
| 785 |
+
typedef void (*ompt_callback_implicit_task_t) (
|
| 786 |
+
ompt_scope_endpoint_t endpoint,
|
| 787 |
+
ompt_data_t *parallel_data,
|
| 788 |
+
ompt_data_t *task_data,
|
| 789 |
+
unsigned int actual_parallelism,
|
| 790 |
+
unsigned int index,
|
| 791 |
+
int flags
|
| 792 |
+
);
|
| 793 |
+
|
| 794 |
+
typedef struct ompt_record_implicit_task_t {
|
| 795 |
+
ompt_scope_endpoint_t endpoint;
|
| 796 |
+
ompt_id_t parallel_id;
|
| 797 |
+
ompt_id_t task_id;
|
| 798 |
+
unsigned int actual_parallelism;
|
| 799 |
+
unsigned int index;
|
| 800 |
+
int flags;
|
| 801 |
+
} ompt_record_implicit_task_t;
|
| 802 |
+
|
| 803 |
+
typedef void (*ompt_callback_master_t) (
|
| 804 |
+
ompt_scope_endpoint_t endpoint,
|
| 805 |
+
ompt_data_t *parallel_data,
|
| 806 |
+
ompt_data_t *task_data,
|
| 807 |
+
const void *codeptr_ra
|
| 808 |
+
);
|
| 809 |
+
|
| 810 |
+
typedef struct ompt_record_master_t {
|
| 811 |
+
ompt_scope_endpoint_t endpoint;
|
| 812 |
+
ompt_id_t parallel_id;
|
| 813 |
+
ompt_id_t task_id;
|
| 814 |
+
const void *codeptr_ra;
|
| 815 |
+
} ompt_record_master_t;
|
| 816 |
+
|
| 817 |
+
typedef void (*ompt_callback_sync_region_t) (
|
| 818 |
+
ompt_sync_region_t kind,
|
| 819 |
+
ompt_scope_endpoint_t endpoint,
|
| 820 |
+
ompt_data_t *parallel_data,
|
| 821 |
+
ompt_data_t *task_data,
|
| 822 |
+
const void *codeptr_ra
|
| 823 |
+
);
|
| 824 |
+
|
| 825 |
+
typedef struct ompt_record_sync_region_t {
|
| 826 |
+
ompt_sync_region_t kind;
|
| 827 |
+
ompt_scope_endpoint_t endpoint;
|
| 828 |
+
ompt_id_t parallel_id;
|
| 829 |
+
ompt_id_t task_id;
|
| 830 |
+
const void *codeptr_ra;
|
| 831 |
+
} ompt_record_sync_region_t;
|
| 832 |
+
|
| 833 |
+
typedef void (*ompt_callback_mutex_acquire_t) (
|
| 834 |
+
ompt_mutex_t kind,
|
| 835 |
+
unsigned int hint,
|
| 836 |
+
unsigned int impl,
|
| 837 |
+
ompt_wait_id_t wait_id,
|
| 838 |
+
const void *codeptr_ra
|
| 839 |
+
);
|
| 840 |
+
|
| 841 |
+
typedef struct ompt_record_mutex_acquire_t {
|
| 842 |
+
ompt_mutex_t kind;
|
| 843 |
+
unsigned int hint;
|
| 844 |
+
unsigned int impl;
|
| 845 |
+
ompt_wait_id_t wait_id;
|
| 846 |
+
const void *codeptr_ra;
|
| 847 |
+
} ompt_record_mutex_acquire_t;
|
| 848 |
+
|
| 849 |
+
typedef void (*ompt_callback_mutex_t) (
|
| 850 |
+
ompt_mutex_t kind,
|
| 851 |
+
ompt_wait_id_t wait_id,
|
| 852 |
+
const void *codeptr_ra
|
| 853 |
+
);
|
| 854 |
+
|
| 855 |
+
typedef struct ompt_record_mutex_t {
|
| 856 |
+
ompt_mutex_t kind;
|
| 857 |
+
ompt_wait_id_t wait_id;
|
| 858 |
+
const void *codeptr_ra;
|
| 859 |
+
} ompt_record_mutex_t;
|
| 860 |
+
|
| 861 |
+
typedef void (*ompt_callback_nest_lock_t) (
|
| 862 |
+
ompt_scope_endpoint_t endpoint,
|
| 863 |
+
ompt_wait_id_t wait_id,
|
| 864 |
+
const void *codeptr_ra
|
| 865 |
+
);
|
| 866 |
+
|
| 867 |
+
typedef struct ompt_record_nest_lock_t {
|
| 868 |
+
ompt_scope_endpoint_t endpoint;
|
| 869 |
+
ompt_wait_id_t wait_id;
|
| 870 |
+
const void *codeptr_ra;
|
| 871 |
+
} ompt_record_nest_lock_t;
|
| 872 |
+
|
| 873 |
+
typedef void (*ompt_callback_flush_t) (
|
| 874 |
+
ompt_data_t *thread_data,
|
| 875 |
+
const void *codeptr_ra
|
| 876 |
+
);
|
| 877 |
+
|
| 878 |
+
typedef struct ompt_record_flush_t {
|
| 879 |
+
const void *codeptr_ra;
|
| 880 |
+
} ompt_record_flush_t;
|
| 881 |
+
|
| 882 |
+
typedef void (*ompt_callback_cancel_t) (
|
| 883 |
+
ompt_data_t *task_data,
|
| 884 |
+
int flags,
|
| 885 |
+
const void *codeptr_ra
|
| 886 |
+
);
|
| 887 |
+
|
| 888 |
+
typedef struct ompt_record_cancel_t {
|
| 889 |
+
ompt_id_t task_id;
|
| 890 |
+
int flags;
|
| 891 |
+
const void *codeptr_ra;
|
| 892 |
+
} ompt_record_cancel_t;
|
| 893 |
+
|
| 894 |
+
typedef void (*ompt_callback_device_initialize_t) (
|
| 895 |
+
int device_num,
|
| 896 |
+
const char *type,
|
| 897 |
+
ompt_device_t *device,
|
| 898 |
+
ompt_function_lookup_t lookup,
|
| 899 |
+
const char *documentation
|
| 900 |
+
);
|
| 901 |
+
|
| 902 |
+
typedef void (*ompt_callback_device_finalize_t) (
|
| 903 |
+
int device_num
|
| 904 |
+
);
|
| 905 |
+
|
| 906 |
+
typedef void (*ompt_callback_device_load_t) (
|
| 907 |
+
int device_num,
|
| 908 |
+
const char *filename,
|
| 909 |
+
int64_t offset_in_file,
|
| 910 |
+
void *vma_in_file,
|
| 911 |
+
size_t bytes,
|
| 912 |
+
void *host_addr,
|
| 913 |
+
void *device_addr,
|
| 914 |
+
uint64_t module_id
|
| 915 |
+
);
|
| 916 |
+
|
| 917 |
+
typedef void (*ompt_callback_device_unload_t) (
|
| 918 |
+
int device_num,
|
| 919 |
+
uint64_t module_id
|
| 920 |
+
);
|
| 921 |
+
|
| 922 |
+
typedef void (*ompt_callback_target_data_op_t) (
|
| 923 |
+
ompt_id_t target_id,
|
| 924 |
+
ompt_id_t host_op_id,
|
| 925 |
+
ompt_target_data_op_t optype,
|
| 926 |
+
void *src_addr,
|
| 927 |
+
int src_device_num,
|
| 928 |
+
void *dest_addr,
|
| 929 |
+
int dest_device_num,
|
| 930 |
+
size_t bytes,
|
| 931 |
+
const void *codeptr_ra
|
| 932 |
+
);
|
| 933 |
+
|
| 934 |
+
typedef struct ompt_record_target_data_op_t {
|
| 935 |
+
ompt_id_t host_op_id;
|
| 936 |
+
ompt_target_data_op_t optype;
|
| 937 |
+
void *src_addr;
|
| 938 |
+
int src_device_num;
|
| 939 |
+
void *dest_addr;
|
| 940 |
+
int dest_device_num;
|
| 941 |
+
size_t bytes;
|
| 942 |
+
ompt_device_time_t end_time;
|
| 943 |
+
const void *codeptr_ra;
|
| 944 |
+
} ompt_record_target_data_op_t;
|
| 945 |
+
|
| 946 |
+
typedef void (*ompt_callback_target_t) (
|
| 947 |
+
ompt_target_t kind,
|
| 948 |
+
ompt_scope_endpoint_t endpoint,
|
| 949 |
+
int device_num,
|
| 950 |
+
ompt_data_t *task_data,
|
| 951 |
+
ompt_id_t target_id,
|
| 952 |
+
const void *codeptr_ra
|
| 953 |
+
);
|
| 954 |
+
|
| 955 |
+
typedef struct ompt_record_target_t {
|
| 956 |
+
ompt_target_t kind;
|
| 957 |
+
ompt_scope_endpoint_t endpoint;
|
| 958 |
+
int device_num;
|
| 959 |
+
ompt_id_t task_id;
|
| 960 |
+
ompt_id_t target_id;
|
| 961 |
+
const void *codeptr_ra;
|
| 962 |
+
} ompt_record_target_t;
|
| 963 |
+
|
| 964 |
+
typedef void (*ompt_callback_target_map_t) (
|
| 965 |
+
ompt_id_t target_id,
|
| 966 |
+
unsigned int nitems,
|
| 967 |
+
void **host_addr,
|
| 968 |
+
void **device_addr,
|
| 969 |
+
size_t *bytes,
|
| 970 |
+
unsigned int *mapping_flags,
|
| 971 |
+
const void *codeptr_ra
|
| 972 |
+
);
|
| 973 |
+
|
| 974 |
+
typedef struct ompt_record_target_map_t {
|
| 975 |
+
ompt_id_t target_id;
|
| 976 |
+
unsigned int nitems;
|
| 977 |
+
void **host_addr;
|
| 978 |
+
void **device_addr;
|
| 979 |
+
size_t *bytes;
|
| 980 |
+
unsigned int *mapping_flags;
|
| 981 |
+
const void *codeptr_ra;
|
| 982 |
+
} ompt_record_target_map_t;
|
| 983 |
+
|
| 984 |
+
typedef void (*ompt_callback_target_submit_t) (
|
| 985 |
+
ompt_id_t target_id,
|
| 986 |
+
ompt_id_t host_op_id,
|
| 987 |
+
unsigned int requested_num_teams
|
| 988 |
+
);
|
| 989 |
+
|
| 990 |
+
typedef struct ompt_record_target_kernel_t {
|
| 991 |
+
ompt_id_t host_op_id;
|
| 992 |
+
unsigned int requested_num_teams;
|
| 993 |
+
unsigned int granted_num_teams;
|
| 994 |
+
ompt_device_time_t end_time;
|
| 995 |
+
} ompt_record_target_kernel_t;
|
| 996 |
+
|
| 997 |
+
typedef int (*ompt_callback_control_tool_t) (
|
| 998 |
+
uint64_t command,
|
| 999 |
+
uint64_t modifier,
|
| 1000 |
+
void *arg,
|
| 1001 |
+
const void *codeptr_ra
|
| 1002 |
+
);
|
| 1003 |
+
|
| 1004 |
+
typedef struct ompt_record_control_tool_t {
|
| 1005 |
+
uint64_t command;
|
| 1006 |
+
uint64_t modifier;
|
| 1007 |
+
const void *codeptr_ra;
|
| 1008 |
+
} ompt_record_control_tool_t;
|
| 1009 |
+
|
| 1010 |
+
typedef struct ompd_address_t {
|
| 1011 |
+
ompd_seg_t segment;
|
| 1012 |
+
ompd_addr_t address;
|
| 1013 |
+
} ompd_address_t;
|
| 1014 |
+
|
| 1015 |
+
typedef struct ompd_frame_info_t {
|
| 1016 |
+
ompd_address_t frame_address;
|
| 1017 |
+
ompd_word_t frame_flag;
|
| 1018 |
+
} ompd_frame_info_t;
|
| 1019 |
+
|
| 1020 |
+
typedef struct _ompd_aspace_handle ompd_address_space_handle_t;
|
| 1021 |
+
typedef struct _ompd_thread_handle ompd_thread_handle_t;
|
| 1022 |
+
typedef struct _ompd_parallel_handle ompd_parallel_handle_t;
|
| 1023 |
+
typedef struct _ompd_task_handle ompd_task_handle_t;
|
| 1024 |
+
|
| 1025 |
+
typedef struct _ompd_aspace_cont ompd_address_space_context_t;
|
| 1026 |
+
typedef struct _ompd_thread_cont ompd_thread_context_t;
|
| 1027 |
+
|
| 1028 |
+
typedef struct ompd_device_type_sizes_t {
|
| 1029 |
+
uint8_t sizeof_char;
|
| 1030 |
+
uint8_t sizeof_short;
|
| 1031 |
+
uint8_t sizeof_int;
|
| 1032 |
+
uint8_t sizeof_long;
|
| 1033 |
+
uint8_t sizeof_long_long;
|
| 1034 |
+
uint8_t sizeof_pointer;
|
| 1035 |
+
} ompd_device_type_sizes_t;
|
| 1036 |
+
|
| 1037 |
+
typedef struct ompt_record_ompt_t {
|
| 1038 |
+
ompt_callbacks_t type;
|
| 1039 |
+
ompt_device_time_t time;
|
| 1040 |
+
ompt_id_t thread_id;
|
| 1041 |
+
ompt_id_t target_id;
|
| 1042 |
+
union {
|
| 1043 |
+
ompt_record_thread_begin_t thread_begin;
|
| 1044 |
+
ompt_record_parallel_begin_t parallel_begin;
|
| 1045 |
+
ompt_record_parallel_end_t parallel_end;
|
| 1046 |
+
ompt_record_work_t work;
|
| 1047 |
+
ompt_record_dispatch_t dispatch;
|
| 1048 |
+
ompt_record_task_create_t task_create;
|
| 1049 |
+
ompt_record_dependences_t dependences;
|
| 1050 |
+
ompt_record_task_dependence_t task_dependence;
|
| 1051 |
+
ompt_record_task_schedule_t task_schedule;
|
| 1052 |
+
ompt_record_implicit_task_t implicit_task;
|
| 1053 |
+
ompt_record_master_t master;
|
| 1054 |
+
ompt_record_sync_region_t sync_region;
|
| 1055 |
+
ompt_record_mutex_acquire_t mutex_acquire;
|
| 1056 |
+
ompt_record_mutex_t mutex;
|
| 1057 |
+
ompt_record_nest_lock_t nest_lock;
|
| 1058 |
+
ompt_record_flush_t flush;
|
| 1059 |
+
ompt_record_cancel_t cancel;
|
| 1060 |
+
ompt_record_target_t target;
|
| 1061 |
+
ompt_record_target_data_op_t target_data_op;
|
| 1062 |
+
ompt_record_target_map_t target_map;
|
| 1063 |
+
ompt_record_target_kernel_t target_kernel;
|
| 1064 |
+
ompt_record_control_tool_t control_tool;
|
| 1065 |
+
} record;
|
| 1066 |
+
} ompt_record_ompt_t;
|
| 1067 |
+
|
| 1068 |
+
typedef ompt_record_ompt_t *(*ompt_get_record_ompt_t) (
|
| 1069 |
+
ompt_buffer_t *buffer,
|
| 1070 |
+
ompt_buffer_cursor_t current
|
| 1071 |
+
);
|
| 1072 |
+
|
| 1073 |
+
#define ompt_id_none 0
|
| 1074 |
+
#define ompt_data_none {0}
|
| 1075 |
+
#define ompt_time_none 0
|
| 1076 |
+
#define ompt_hwid_none 0
|
| 1077 |
+
#define ompt_addr_none ~0
|
| 1078 |
+
#define ompt_mutex_impl_none 0
|
| 1079 |
+
#define ompt_wait_id_none 0
|
| 1080 |
+
|
| 1081 |
+
#define ompd_segment_none 0
|
| 1082 |
+
|
| 1083 |
+
#endif /* __OMPT__ */
|
lib/python3.11/site-packages/nvidia/cu13/include/builtin_types.h
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2014 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
/*******************************************************************************
|
| 51 |
+
* *
|
| 52 |
+
* *
|
| 53 |
+
* *
|
| 54 |
+
*******************************************************************************/
|
| 55 |
+
|
| 56 |
+
#include "device_types.h"
|
| 57 |
+
#if !defined(__CUDACC_RTC__)
|
| 58 |
+
#define EXCLUDE_FROM_RTC
|
| 59 |
+
#include "driver_types.h"
|
| 60 |
+
#undef EXCLUDE_FROM_RTC
|
| 61 |
+
#endif /* !__CUDACC_RTC__ */
|
| 62 |
+
#include "surface_types.h"
|
| 63 |
+
#include "texture_types.h"
|
| 64 |
+
#include "v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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CHANNEL_DESCRIPTOR_H__)
|
| 51 |
+
#define __CHANNEL_DESCRIPTOR_H__
|
| 52 |
+
|
| 53 |
+
#if defined(__cplusplus)
|
| 54 |
+
|
| 55 |
+
/*******************************************************************************
|
| 56 |
+
* *
|
| 57 |
+
* *
|
| 58 |
+
* *
|
| 59 |
+
*******************************************************************************/
|
| 60 |
+
|
| 61 |
+
#include "cuda_runtime_api.h"
|
| 62 |
+
|
| 63 |
+
/*******************************************************************************
|
| 64 |
+
* *
|
| 65 |
+
* *
|
| 66 |
+
* *
|
| 67 |
+
*******************************************************************************/
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* \addtogroup CUDART_HIGHLEVEL
|
| 71 |
+
*
|
| 72 |
+
* @{
|
| 73 |
+
*/
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* \brief \hl Returns a channel descriptor using the specified format
|
| 77 |
+
*
|
| 78 |
+
* Returns a channel descriptor with format \p f and number of bits of each
|
| 79 |
+
* component \p x, \p y, \p z, and \p w. The ::cudaChannelFormatDesc is
|
| 80 |
+
* defined as:
|
| 81 |
+
* \code
|
| 82 |
+
struct cudaChannelFormatDesc {
|
| 83 |
+
int x, y, z, w;
|
| 84 |
+
enum cudaChannelFormatKind f;
|
| 85 |
+
};
|
| 86 |
+
* \endcode
|
| 87 |
+
*
|
| 88 |
+
* where ::cudaChannelFormatKind is one of ::cudaChannelFormatKindSigned,
|
| 89 |
+
* ::cudaChannelFormatKindUnsigned, cudaChannelFormatKindFloat,
|
| 90 |
+
* ::cudaChannelFormatKindSignedNormalized8X1, ::cudaChannelFormatKindSignedNormalized8X2,
|
| 91 |
+
* ::cudaChannelFormatKindSignedNormalized8X4,
|
| 92 |
+
* ::cudaChannelFormatKindUnsignedNormalized8X1, ::cudaChannelFormatKindUnsignedNormalized8X2,
|
| 93 |
+
* ::cudaChannelFormatKindUnsignedNormalized8X4,
|
| 94 |
+
* ::cudaChannelFormatKindSignedNormalized16X1, ::cudaChannelFormatKindSignedNormalized16X2,
|
| 95 |
+
* ::cudaChannelFormatKindSignedNormalized16X4,
|
| 96 |
+
* ::cudaChannelFormatKindUnsignedNormalized16X1, ::cudaChannelFormatKindUnsignedNormalized16X2,
|
| 97 |
+
* ::cudaChannelFormatKindUnsignedNormalized16X4,
|
| 98 |
+
* ::cudaChannelFormatKindUnsignedNormalized1010102
|
| 99 |
+
* or ::cudaChannelFormatKindNV12.
|
| 100 |
+
*
|
| 101 |
+
* The format is specified by the template specialization.
|
| 102 |
+
*
|
| 103 |
+
* The template function specializes for the following scalar types:
|
| 104 |
+
* char, signed char, unsigned char, short, unsigned short, int, unsigned int, long, unsigned long, and float.
|
| 105 |
+
* The template function specializes for the following vector types:
|
| 106 |
+
* char{1|2|4}, uchar{1|2|4}, short{1|2|4}, ushort{1|2|4}, int{1|2|4}, uint{1|2|4}, long{1|2|4}, ulong{1|2|4}, float{1|2|4}.
|
| 107 |
+
* The template function specializes for following cudaChannelFormatKind enum values:
|
| 108 |
+
* ::cudaChannelFormatKind{Uns|S}ignedNormalized{8|16}X{1|2|4},
|
| 109 |
+
* ::cudaChannelFormatKindUnsignedNormalized1010102
|
| 110 |
+
* and ::cudaChannelFormatKindNV12.
|
| 111 |
+
*
|
| 112 |
+
* Invoking the function on a type without a specialization defaults to creating a channel format of kind ::cudaChannelFormatKindNone
|
| 113 |
+
*
|
| 114 |
+
* \return
|
| 115 |
+
* Channel descriptor with format \p f
|
| 116 |
+
*
|
| 117 |
+
* \sa \ref ::cudaCreateChannelDesc(int,int,int,int,cudaChannelFormatKind) "cudaCreateChannelDesc (Low level)",
|
| 118 |
+
* ::cudaGetChannelDesc,
|
| 119 |
+
*/
|
| 120 |
+
template<class T> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void)
|
| 121 |
+
{
|
| 122 |
+
return cudaCreateChannelDesc(0, 0, 0, 0, cudaChannelFormatKindNone);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf(void)
|
| 126 |
+
{
|
| 127 |
+
int e = (int)sizeof(unsigned short) * 8;
|
| 128 |
+
|
| 129 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf1(void)
|
| 133 |
+
{
|
| 134 |
+
int e = (int)sizeof(unsigned short) * 8;
|
| 135 |
+
|
| 136 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf2(void)
|
| 140 |
+
{
|
| 141 |
+
int e = (int)sizeof(unsigned short) * 8;
|
| 142 |
+
|
| 143 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindFloat);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescHalf4(void)
|
| 147 |
+
{
|
| 148 |
+
int e = (int)sizeof(unsigned short) * 8;
|
| 149 |
+
|
| 150 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindFloat);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char>(void)
|
| 154 |
+
{
|
| 155 |
+
int e = (int)sizeof(char) * 8;
|
| 156 |
+
|
| 157 |
+
#if defined(_CHAR_UNSIGNED) || defined(__CHAR_UNSIGNED__)
|
| 158 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| 159 |
+
#else /* _CHAR_UNSIGNED || __CHAR_UNSIGNED__ */
|
| 160 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| 161 |
+
#endif /* _CHAR_UNSIGNED || __CHAR_UNSIGNED__ */
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<signed char>(void)
|
| 165 |
+
{
|
| 166 |
+
int e = (int)sizeof(signed char) * 8;
|
| 167 |
+
|
| 168 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<unsigned char>(void)
|
| 172 |
+
{
|
| 173 |
+
int e = (int)sizeof(unsigned char) * 8;
|
| 174 |
+
|
| 175 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char1>(void)
|
| 179 |
+
{
|
| 180 |
+
int e = (int)sizeof(signed char) * 8;
|
| 181 |
+
|
| 182 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uchar1>(void)
|
| 186 |
+
{
|
| 187 |
+
int e = (int)sizeof(unsigned char) * 8;
|
| 188 |
+
|
| 189 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char2>(void)
|
| 193 |
+
{
|
| 194 |
+
int e = (int)sizeof(signed char) * 8;
|
| 195 |
+
|
| 196 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uchar2>(void)
|
| 200 |
+
{
|
| 201 |
+
int e = (int)sizeof(unsigned char) * 8;
|
| 202 |
+
|
| 203 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<char4>(void)
|
| 207 |
+
{
|
| 208 |
+
int e = (int)sizeof(signed char) * 8;
|
| 209 |
+
|
| 210 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uchar4>(void)
|
| 214 |
+
{
|
| 215 |
+
int e = (int)sizeof(unsigned char) * 8;
|
| 216 |
+
|
| 217 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<short>(void)
|
| 221 |
+
{
|
| 222 |
+
int e = (int)sizeof(short) * 8;
|
| 223 |
+
|
| 224 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<unsigned short>(void)
|
| 228 |
+
{
|
| 229 |
+
int e = (int)sizeof(unsigned short) * 8;
|
| 230 |
+
|
| 231 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<short1>(void)
|
| 235 |
+
{
|
| 236 |
+
int e = (int)sizeof(short) * 8;
|
| 237 |
+
|
| 238 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ushort1>(void)
|
| 242 |
+
{
|
| 243 |
+
int e = (int)sizeof(unsigned short) * 8;
|
| 244 |
+
|
| 245 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<short2>(void)
|
| 249 |
+
{
|
| 250 |
+
int e = (int)sizeof(short) * 8;
|
| 251 |
+
|
| 252 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ushort2>(void)
|
| 256 |
+
{
|
| 257 |
+
int e = (int)sizeof(unsigned short) * 8;
|
| 258 |
+
|
| 259 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<short4>(void)
|
| 263 |
+
{
|
| 264 |
+
int e = (int)sizeof(short) * 8;
|
| 265 |
+
|
| 266 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ushort4>(void)
|
| 270 |
+
{
|
| 271 |
+
int e = (int)sizeof(unsigned short) * 8;
|
| 272 |
+
|
| 273 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<int>(void)
|
| 277 |
+
{
|
| 278 |
+
int e = (int)sizeof(int) * 8;
|
| 279 |
+
|
| 280 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<unsigned int>(void)
|
| 284 |
+
{
|
| 285 |
+
int e = (int)sizeof(unsigned int) * 8;
|
| 286 |
+
|
| 287 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<int1>(void)
|
| 291 |
+
{
|
| 292 |
+
int e = (int)sizeof(int) * 8;
|
| 293 |
+
|
| 294 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uint1>(void)
|
| 298 |
+
{
|
| 299 |
+
int e = (int)sizeof(unsigned int) * 8;
|
| 300 |
+
|
| 301 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<int2>(void)
|
| 305 |
+
{
|
| 306 |
+
int e = (int)sizeof(int) * 8;
|
| 307 |
+
|
| 308 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uint2>(void)
|
| 312 |
+
{
|
| 313 |
+
int e = (int)sizeof(unsigned int) * 8;
|
| 314 |
+
|
| 315 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<int4>(void)
|
| 319 |
+
{
|
| 320 |
+
int e = (int)sizeof(int) * 8;
|
| 321 |
+
|
| 322 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<uint4>(void)
|
| 326 |
+
{
|
| 327 |
+
int e = (int)sizeof(unsigned int) * 8;
|
| 328 |
+
|
| 329 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
#if !defined(__LP64__)
|
| 333 |
+
|
| 334 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<long>(void)
|
| 335 |
+
{
|
| 336 |
+
int e = (int)sizeof(long) * 8;
|
| 337 |
+
|
| 338 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<unsigned long>(void)
|
| 342 |
+
{
|
| 343 |
+
int e = (int)sizeof(unsigned long) * 8;
|
| 344 |
+
|
| 345 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<long1>(void)
|
| 349 |
+
{
|
| 350 |
+
int e = (int)sizeof(long) * 8;
|
| 351 |
+
|
| 352 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindSigned);
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ulong1>(void)
|
| 356 |
+
{
|
| 357 |
+
int e = (int)sizeof(unsigned long) * 8;
|
| 358 |
+
|
| 359 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindUnsigned);
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<long2>(void)
|
| 363 |
+
{
|
| 364 |
+
int e = (int)sizeof(long) * 8;
|
| 365 |
+
|
| 366 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindSigned);
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ulong2>(void)
|
| 370 |
+
{
|
| 371 |
+
int e = (int)sizeof(unsigned long) * 8;
|
| 372 |
+
|
| 373 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindUnsigned);
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
__NV_SILENCE_DEPRECATION_BEGIN
|
| 377 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<long4>(void)
|
| 378 |
+
{
|
| 379 |
+
int e = (int)sizeof(long) * 8;
|
| 380 |
+
|
| 381 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindSigned);
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<ulong4>(void)
|
| 385 |
+
{
|
| 386 |
+
int e = (int)sizeof(unsigned long) * 8;
|
| 387 |
+
|
| 388 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindUnsigned);
|
| 389 |
+
}
|
| 390 |
+
__NV_SILENCE_DEPRECATION_END
|
| 391 |
+
|
| 392 |
+
#endif /* !__LP64__ */
|
| 393 |
+
|
| 394 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<float>(void)
|
| 395 |
+
{
|
| 396 |
+
int e = (int)sizeof(float) * 8;
|
| 397 |
+
|
| 398 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<float1>(void)
|
| 402 |
+
{
|
| 403 |
+
int e = (int)sizeof(float) * 8;
|
| 404 |
+
|
| 405 |
+
return cudaCreateChannelDesc(e, 0, 0, 0, cudaChannelFormatKindFloat);
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<float2>(void)
|
| 409 |
+
{
|
| 410 |
+
int e = (int)sizeof(float) * 8;
|
| 411 |
+
|
| 412 |
+
return cudaCreateChannelDesc(e, e, 0, 0, cudaChannelFormatKindFloat);
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<float4>(void)
|
| 416 |
+
{
|
| 417 |
+
int e = (int)sizeof(float) * 8;
|
| 418 |
+
|
| 419 |
+
return cudaCreateChannelDesc(e, e, e, e, cudaChannelFormatKindFloat);
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
static __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDescNV12(void)
|
| 423 |
+
{
|
| 424 |
+
int e = (int)sizeof(char) * 8;
|
| 425 |
+
|
| 426 |
+
return cudaCreateChannelDesc(e, e, e, 0, cudaChannelFormatKindNV12);
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
template<cudaChannelFormatKind> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc(void)
|
| 430 |
+
{
|
| 431 |
+
return cudaCreateChannelDesc(0, 0, 0, 0, cudaChannelFormatKindNone);
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
/* Signed 8-bit normalized integer formats */
|
| 435 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized8X1>(void)
|
| 436 |
+
{
|
| 437 |
+
return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindSignedNormalized8X1);
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized8X2>(void)
|
| 441 |
+
{
|
| 442 |
+
return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindSignedNormalized8X2);
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized8X4>(void)
|
| 446 |
+
{
|
| 447 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindSignedNormalized8X4);
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
/* Unsigned 8-bit normalized integer formats */
|
| 451 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized8X1>(void)
|
| 452 |
+
{
|
| 453 |
+
return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindUnsignedNormalized8X1);
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized8X2>(void)
|
| 457 |
+
{
|
| 458 |
+
return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindUnsignedNormalized8X2);
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized8X4>(void)
|
| 462 |
+
{
|
| 463 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedNormalized8X4);
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
/* Signed 16-bit normalized integer formats */
|
| 467 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized16X1>(void)
|
| 468 |
+
{
|
| 469 |
+
return cudaCreateChannelDesc(16, 0, 0, 0, cudaChannelFormatKindSignedNormalized16X1);
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized16X2>(void)
|
| 473 |
+
{
|
| 474 |
+
return cudaCreateChannelDesc(16, 16, 0, 0, cudaChannelFormatKindSignedNormalized16X2);
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedNormalized16X4>(void)
|
| 478 |
+
{
|
| 479 |
+
return cudaCreateChannelDesc(16, 16, 16, 16, cudaChannelFormatKindSignedNormalized16X4);
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
/* Unsigned 16-bit normalized integer formats */
|
| 483 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized16X1>(void)
|
| 484 |
+
{
|
| 485 |
+
return cudaCreateChannelDesc(16, 0, 0, 0, cudaChannelFormatKindUnsignedNormalized16X1);
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized16X2>(void)
|
| 489 |
+
{
|
| 490 |
+
return cudaCreateChannelDesc(16, 16, 0, 0, cudaChannelFormatKindUnsignedNormalized16X2);
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized16X4>(void)
|
| 494 |
+
{
|
| 495 |
+
return cudaCreateChannelDesc(16, 16, 16, 16, cudaChannelFormatKindUnsignedNormalized16X4);
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
/* NV12 format */
|
| 499 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindNV12>(void)
|
| 500 |
+
{
|
| 501 |
+
return cudaCreateChannelDesc(8, 8, 8, 0, cudaChannelFormatKindNV12);
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
/* Int101010 format */
|
| 505 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedNormalized1010102>(void)
|
| 506 |
+
{
|
| 507 |
+
return cudaCreateChannelDesc(10, 10, 10, 2, cudaChannelFormatKindUnsignedNormalized1010102);
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
/* BC1 format */
|
| 511 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed1>(void)
|
| 512 |
+
{
|
| 513 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed1);
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
/* BC1sRGB format */
|
| 517 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed1SRGB>(void)
|
| 518 |
+
{
|
| 519 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed1SRGB);
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
/* BC2 format */
|
| 523 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed2>(void)
|
| 524 |
+
{
|
| 525 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed2);
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
/* BC2sRGB format */
|
| 529 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed2SRGB>(void)
|
| 530 |
+
{
|
| 531 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed2SRGB);
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
/* BC3 format */
|
| 535 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed3>(void)
|
| 536 |
+
{
|
| 537 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed3);
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
/* BC3sRGB format */
|
| 541 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed3SRGB>(void)
|
| 542 |
+
{
|
| 543 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed3SRGB);
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
/* BC4 unsigned format */
|
| 547 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed4>(void)
|
| 548 |
+
{
|
| 549 |
+
return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindUnsignedBlockCompressed4);
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
/* BC4 signed format */
|
| 553 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedBlockCompressed4>(void)
|
| 554 |
+
{
|
| 555 |
+
return cudaCreateChannelDesc(8, 0, 0, 0, cudaChannelFormatKindSignedBlockCompressed4);
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
/* BC5 unsigned format */
|
| 559 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed5>(void)
|
| 560 |
+
{
|
| 561 |
+
return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindUnsignedBlockCompressed5);
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
/* BC5 signed format */
|
| 565 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedBlockCompressed5>(void)
|
| 566 |
+
{
|
| 567 |
+
return cudaCreateChannelDesc(8, 8, 0, 0, cudaChannelFormatKindSignedBlockCompressed5);
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
/* BC6H unsigned format */
|
| 571 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed6H>(void)
|
| 572 |
+
{
|
| 573 |
+
return cudaCreateChannelDesc(16, 16, 16, 0, cudaChannelFormatKindUnsignedBlockCompressed6H);
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
/* BC6H signed format */
|
| 577 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindSignedBlockCompressed6H>(void)
|
| 578 |
+
{
|
| 579 |
+
return cudaCreateChannelDesc(16, 16, 16, 0, cudaChannelFormatKindSignedBlockCompressed6H);
|
| 580 |
+
}
|
| 581 |
+
|
| 582 |
+
/* BC7 format */
|
| 583 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed7>(void)
|
| 584 |
+
{
|
| 585 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed7);
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
/* BC7sRGB format */
|
| 589 |
+
template<> __inline__ __host__ cudaChannelFormatDesc cudaCreateChannelDesc<cudaChannelFormatKindUnsignedBlockCompressed7SRGB>(void)
|
| 590 |
+
{
|
| 591 |
+
return cudaCreateChannelDesc(8, 8, 8, 8, cudaChannelFormatKindUnsignedBlockCompressed7SRGB);
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
#endif /* __cplusplus */
|
| 595 |
+
|
| 596 |
+
/** @} */
|
| 597 |
+
/** @} */ /* END CUDART_TEXTURE_HL */
|
| 598 |
+
|
| 599 |
+
#endif /* !__CHANNEL_DESCRIPTOR_H__ */
|
lib/python3.11/site-packages/nvidia/cu13/include/common_functions.h
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2018 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("common_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "common_functions.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_COMMON_FUNCTIONS_H_WRAPPER__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#include "crt/common_functions.h"
|
| 61 |
+
|
| 62 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_COMMON_FUNCTIONS_H_WRAPPER__)
|
| 63 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 64 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_COMMON_FUNCTIONS_H_WRAPPER__
|
| 65 |
+
#endif
|
lib/python3.11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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef _COOPERATIVE_GROUPS_H_
|
| 51 |
+
#define _COOPERATIVE_GROUPS_H_
|
| 52 |
+
|
| 53 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 54 |
+
|
| 55 |
+
#include "cooperative_groups/details/info.h"
|
| 56 |
+
#include "cooperative_groups/details/driver_abi.h"
|
| 57 |
+
#include "cooperative_groups/details/helpers.h"
|
| 58 |
+
#include "cooperative_groups/details/memory.h"
|
| 59 |
+
|
| 60 |
+
#if defined(_CG_HAS_STL_ATOMICS)
|
| 61 |
+
#include <cuda/atomic>
|
| 62 |
+
#define _CG_THREAD_SCOPE(scope) _CG_STATIC_CONST_DECL cuda::thread_scope thread_scope = scope;
|
| 63 |
+
#else
|
| 64 |
+
#define _CG_THREAD_SCOPE(scope)
|
| 65 |
+
#endif
|
| 66 |
+
|
| 67 |
+
_CG_BEGIN_NAMESPACE
|
| 68 |
+
|
| 69 |
+
namespace details {
|
| 70 |
+
_CG_CONST_DECL unsigned int coalesced_group_id = 1;
|
| 71 |
+
_CG_CONST_DECL unsigned int _unused = 2;
|
| 72 |
+
_CG_CONST_DECL unsigned int grid_group_id = 3;
|
| 73 |
+
_CG_CONST_DECL unsigned int thread_block_id = 4;
|
| 74 |
+
_CG_CONST_DECL unsigned int multi_tile_group_id = 5;
|
| 75 |
+
_CG_CONST_DECL unsigned int cluster_group_id = 6;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* class thread_group;
|
| 80 |
+
*
|
| 81 |
+
* Generic thread group type, into which all groups are convertible.
|
| 82 |
+
* It acts as a container for all storage necessary for the derived groups,
|
| 83 |
+
* and will dispatch the API calls to the correct derived group. This means
|
| 84 |
+
* that all derived groups must implement the same interface as thread_group.
|
| 85 |
+
*/
|
| 86 |
+
class thread_group
|
| 87 |
+
{
|
| 88 |
+
protected:
|
| 89 |
+
struct group_data {
|
| 90 |
+
unsigned int _unused : 1;
|
| 91 |
+
unsigned int type : 7, : 0;
|
| 92 |
+
};
|
| 93 |
+
|
| 94 |
+
struct gg_data {
|
| 95 |
+
details::grid_workspace *gridWs;
|
| 96 |
+
};
|
| 97 |
+
|
| 98 |
+
struct tg_data {
|
| 99 |
+
unsigned int is_tiled : 1;
|
| 100 |
+
unsigned int type : 7;
|
| 101 |
+
unsigned int size : 24;
|
| 102 |
+
// packed to 4b
|
| 103 |
+
unsigned int metaGroupSize : 16;
|
| 104 |
+
unsigned int metaGroupRank : 16;
|
| 105 |
+
// packed to 8b
|
| 106 |
+
unsigned int mask;
|
| 107 |
+
// packed to 12b
|
| 108 |
+
unsigned int _res;
|
| 109 |
+
};
|
| 110 |
+
|
| 111 |
+
friend _CG_QUALIFIER thread_group tiled_partition(const thread_group& parent, unsigned int tilesz);
|
| 112 |
+
friend class thread_block;
|
| 113 |
+
|
| 114 |
+
union __align__(8) {
|
| 115 |
+
group_data group;
|
| 116 |
+
tg_data coalesced;
|
| 117 |
+
gg_data grid;
|
| 118 |
+
} _data;
|
| 119 |
+
|
| 120 |
+
_CG_QUALIFIER thread_group operator=(const thread_group& src);
|
| 121 |
+
|
| 122 |
+
_CG_QUALIFIER thread_group(unsigned int type) {
|
| 123 |
+
_data.group.type = type;
|
| 124 |
+
_data.group._unused = false;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
#ifdef _CG_CPP11_FEATURES
|
| 128 |
+
static_assert(sizeof(tg_data) <= 16, "Failed size check");
|
| 129 |
+
static_assert(sizeof(gg_data) <= 16, "Failed size check");
|
| 130 |
+
#endif
|
| 131 |
+
|
| 132 |
+
public:
|
| 133 |
+
_CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_device)
|
| 134 |
+
|
| 135 |
+
_CG_QUALIFIER unsigned long long size() const;
|
| 136 |
+
_CG_QUALIFIER unsigned long long num_threads() const;
|
| 137 |
+
_CG_QUALIFIER unsigned long long thread_rank() const;
|
| 138 |
+
_CG_QUALIFIER void sync() const;
|
| 139 |
+
_CG_QUALIFIER unsigned int get_type() const {
|
| 140 |
+
return _data.group.type;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
};
|
| 144 |
+
|
| 145 |
+
template <unsigned int TyId>
|
| 146 |
+
struct thread_group_base : public thread_group {
|
| 147 |
+
_CG_QUALIFIER thread_group_base() : thread_group(TyId) {}
|
| 148 |
+
_CG_STATIC_CONST_DECL unsigned int id = TyId;
|
| 149 |
+
};
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* class grid_group;
|
| 153 |
+
*
|
| 154 |
+
* Threads within this this group are guaranteed to be co-resident on the
|
| 155 |
+
* same device within the same launched kernel. To use this group, the kernel
|
| 156 |
+
* must have been launched with cuLaunchCooperativeKernel (or the CUDA Runtime equivalent),
|
| 157 |
+
* and the device must support it (queryable device attribute).
|
| 158 |
+
*
|
| 159 |
+
* Constructed via this_grid();
|
| 160 |
+
*/
|
| 161 |
+
class grid_group : public thread_group_base<details::grid_group_id>
|
| 162 |
+
{
|
| 163 |
+
_CG_STATIC_CONST_DECL unsigned int _group_id = details::grid_group_id;
|
| 164 |
+
friend _CG_QUALIFIER grid_group this_grid();
|
| 165 |
+
|
| 166 |
+
private:
|
| 167 |
+
_CG_QUALIFIER grid_group(details::grid_workspace *gridWs) {
|
| 168 |
+
_data.grid.gridWs = gridWs;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
public:
|
| 172 |
+
_CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_device)
|
| 173 |
+
|
| 174 |
+
_CG_QUALIFIER bool is_valid() const {
|
| 175 |
+
return (_data.grid.gridWs != NULL);
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
_CG_QUALIFIER void sync() const {
|
| 179 |
+
if (!is_valid()) {
|
| 180 |
+
_CG_ABORT();
|
| 181 |
+
}
|
| 182 |
+
details::grid::sync(&_data.grid.gridWs->barrier);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 186 |
+
using arrival_token = unsigned int;
|
| 187 |
+
|
| 188 |
+
_CG_QUALIFIER arrival_token barrier_arrive() const {
|
| 189 |
+
if (!is_valid()) {
|
| 190 |
+
_CG_ABORT();
|
| 191 |
+
}
|
| 192 |
+
return details::grid::barrier_arrive(&_data.grid.gridWs->barrier);
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
_CG_QUALIFIER void barrier_wait(arrival_token&& token) const {
|
| 196 |
+
details::grid::barrier_wait(token, &_data.grid.gridWs->barrier);
|
| 197 |
+
}
|
| 198 |
+
#endif
|
| 199 |
+
|
| 200 |
+
_CG_STATIC_QUALIFIER unsigned long long size() {
|
| 201 |
+
return details::grid::size();
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
_CG_STATIC_QUALIFIER dim3 group_dim() {
|
| 205 |
+
return details::grid::grid_dim();
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
_CG_STATIC_QUALIFIER dim3 dim_threads() {
|
| 209 |
+
return details::grid::dim_threads();
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
_CG_STATIC_QUALIFIER unsigned long long num_threads() {
|
| 213 |
+
return details::grid::num_threads();
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
_CG_STATIC_QUALIFIER dim3 thread_index() {
|
| 217 |
+
return details::grid::thread_index();
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
_CG_STATIC_QUALIFIER unsigned long long thread_rank() {
|
| 221 |
+
return details::grid::thread_rank();
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
_CG_STATIC_QUALIFIER dim3 dim_blocks() {
|
| 225 |
+
return details::grid::dim_blocks();
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
_CG_STATIC_QUALIFIER unsigned long long num_blocks() {
|
| 229 |
+
return details::grid::num_blocks();
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
_CG_STATIC_QUALIFIER dim3 block_index() {
|
| 233 |
+
return details::grid::block_index();
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
_CG_STATIC_QUALIFIER unsigned long long block_rank() {
|
| 237 |
+
return details::grid::block_rank();
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
# if defined(_CG_HAS_CLUSTER_GROUP)
|
| 241 |
+
_CG_STATIC_QUALIFIER dim3 dim_clusters() {
|
| 242 |
+
return details::grid::dim_clusters();
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
_CG_STATIC_QUALIFIER unsigned long long num_clusters() {
|
| 246 |
+
return details::grid::num_clusters();
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
_CG_STATIC_QUALIFIER dim3 cluster_index() {
|
| 250 |
+
return details::grid::cluster_index();
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
_CG_STATIC_QUALIFIER unsigned long long cluster_rank() {
|
| 254 |
+
return details::grid::cluster_rank();
|
| 255 |
+
}
|
| 256 |
+
# endif
|
| 257 |
+
};
|
| 258 |
+
|
| 259 |
+
_CG_QUALIFIER grid_group this_grid() {
|
| 260 |
+
// Load a workspace from the driver
|
| 261 |
+
grid_group gg(details::get_grid_workspace());
|
| 262 |
+
#ifdef _CG_DEBUG
|
| 263 |
+
// *all* threads must be available to synchronize
|
| 264 |
+
gg.sync();
|
| 265 |
+
#endif // _CG_DEBUG
|
| 266 |
+
return gg;
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
#if defined(_CG_HAS_CLUSTER_GROUP)
|
| 270 |
+
/**
|
| 271 |
+
* class cluster_group
|
| 272 |
+
*
|
| 273 |
+
* Every GPU kernel is executed by a grid of thread blocks. A grid can be evenly
|
| 274 |
+
* divided along all dimensions to form groups of blocks, each group of which is
|
| 275 |
+
* a block cluster. Clustered grids are subject to various restrictions and
|
| 276 |
+
* limitations. Primarily, a cluster consists of at most 8 blocks by default
|
| 277 |
+
* (although the user is allowed to opt-in to non-standard sizes,) and clustered
|
| 278 |
+
* grids are subject to additional occupancy limitations due to per-cluster
|
| 279 |
+
* hardware resource consumption. In exchange, a block cluster is guaranteed to
|
| 280 |
+
* be a cooperative group, with access to all cooperative group capabilities, as
|
| 281 |
+
* well as cluster specific capabilities and accelerations. A cluster_group
|
| 282 |
+
* represents a block cluster.
|
| 283 |
+
*
|
| 284 |
+
* Constructed via this_cluster_group();
|
| 285 |
+
*/
|
| 286 |
+
class cluster_group : public thread_group_base<details::cluster_group_id>
|
| 287 |
+
{
|
| 288 |
+
// Friends
|
| 289 |
+
friend _CG_QUALIFIER cluster_group this_cluster();
|
| 290 |
+
|
| 291 |
+
// Disable constructor
|
| 292 |
+
_CG_QUALIFIER cluster_group()
|
| 293 |
+
{
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
public:
|
| 297 |
+
//_CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_cluster)
|
| 298 |
+
|
| 299 |
+
using arrival_token = struct {};
|
| 300 |
+
|
| 301 |
+
// Functionality exposed by the group
|
| 302 |
+
_CG_STATIC_QUALIFIER void sync()
|
| 303 |
+
{
|
| 304 |
+
return details::cluster::sync();
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
_CG_STATIC_QUALIFIER arrival_token barrier_arrive()
|
| 308 |
+
{
|
| 309 |
+
details::cluster::barrier_arrive();
|
| 310 |
+
return arrival_token();
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
_CG_STATIC_QUALIFIER void barrier_wait()
|
| 314 |
+
{
|
| 315 |
+
return details::cluster::barrier_wait();
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
_CG_STATIC_QUALIFIER void barrier_wait(arrival_token&&)
|
| 319 |
+
{
|
| 320 |
+
return details::cluster::barrier_wait();
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
_CG_STATIC_QUALIFIER unsigned int query_shared_rank(const void *addr)
|
| 324 |
+
{
|
| 325 |
+
return details::cluster::query_shared_rank(addr);
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
template <typename T>
|
| 329 |
+
_CG_STATIC_QUALIFIER T* map_shared_rank(T *addr, int rank)
|
| 330 |
+
{
|
| 331 |
+
return details::cluster::map_shared_rank(addr, rank);
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
_CG_STATIC_QUALIFIER dim3 block_index()
|
| 335 |
+
{
|
| 336 |
+
return details::cluster::block_index();
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
_CG_STATIC_QUALIFIER unsigned int block_rank()
|
| 340 |
+
{
|
| 341 |
+
return details::cluster::block_rank();
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
_CG_STATIC_QUALIFIER dim3 thread_index()
|
| 345 |
+
{
|
| 346 |
+
return details::cluster::thread_index();
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
_CG_STATIC_QUALIFIER unsigned int thread_rank()
|
| 350 |
+
{
|
| 351 |
+
return details::cluster::thread_rank();
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
_CG_STATIC_QUALIFIER dim3 dim_blocks()
|
| 355 |
+
{
|
| 356 |
+
return details::cluster::dim_blocks();
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
_CG_STATIC_QUALIFIER unsigned int num_blocks()
|
| 360 |
+
{
|
| 361 |
+
return details::cluster::num_blocks();
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
_CG_STATIC_QUALIFIER dim3 dim_threads()
|
| 365 |
+
{
|
| 366 |
+
return details::cluster::dim_threads();
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
_CG_STATIC_QUALIFIER unsigned int num_threads()
|
| 370 |
+
{
|
| 371 |
+
return details::cluster::num_threads();
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
// Legacy aliases
|
| 375 |
+
_CG_STATIC_QUALIFIER unsigned int size()
|
| 376 |
+
{
|
| 377 |
+
return num_threads();
|
| 378 |
+
}
|
| 379 |
+
};
|
| 380 |
+
|
| 381 |
+
/*
|
| 382 |
+
* cluster_group this_cluster()
|
| 383 |
+
*
|
| 384 |
+
* Constructs a cluster_group
|
| 385 |
+
*/
|
| 386 |
+
_CG_QUALIFIER cluster_group this_cluster()
|
| 387 |
+
{
|
| 388 |
+
cluster_group cg;
|
| 389 |
+
#ifdef _CG_DEBUG
|
| 390 |
+
cg.sync();
|
| 391 |
+
#endif
|
| 392 |
+
return cg;
|
| 393 |
+
}
|
| 394 |
+
#endif
|
| 395 |
+
|
| 396 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 397 |
+
class thread_block;
|
| 398 |
+
template <unsigned int MaxBlockSize>
|
| 399 |
+
_CG_QUALIFIER thread_block this_thread_block(block_tile_memory<MaxBlockSize>& scratch);
|
| 400 |
+
#endif
|
| 401 |
+
|
| 402 |
+
/**
|
| 403 |
+
* class thread_block
|
| 404 |
+
*
|
| 405 |
+
* Every GPU kernel is executed by a grid of thread blocks, and threads within
|
| 406 |
+
* each block are guaranteed to reside on the same streaming multiprocessor.
|
| 407 |
+
* A thread_block represents a thread block whose dimensions are not known until runtime.
|
| 408 |
+
*
|
| 409 |
+
* Constructed via this_thread_block();
|
| 410 |
+
*/
|
| 411 |
+
class thread_block : public thread_group_base<details::thread_block_id>
|
| 412 |
+
{
|
| 413 |
+
// Friends
|
| 414 |
+
friend _CG_QUALIFIER thread_block this_thread_block();
|
| 415 |
+
friend _CG_QUALIFIER thread_group tiled_partition(const thread_group& parent, unsigned int tilesz);
|
| 416 |
+
friend _CG_QUALIFIER thread_group tiled_partition(const thread_block& parent, unsigned int tilesz);
|
| 417 |
+
|
| 418 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 419 |
+
template <unsigned int MaxBlockSize>
|
| 420 |
+
friend _CG_QUALIFIER thread_block this_thread_block(block_tile_memory<MaxBlockSize>& scratch);
|
| 421 |
+
template <unsigned int Size>
|
| 422 |
+
friend class __static_size_multi_warp_tile_base;
|
| 423 |
+
|
| 424 |
+
details::multi_warp_scratch* const tile_memory;
|
| 425 |
+
|
| 426 |
+
template <unsigned int MaxBlockSize>
|
| 427 |
+
_CG_QUALIFIER thread_block(block_tile_memory<MaxBlockSize>& scratch) :
|
| 428 |
+
tile_memory(details::get_scratch_ptr(&scratch)) {
|
| 429 |
+
#ifdef _CG_DEBUG
|
| 430 |
+
if (num_threads() > MaxBlockSize) {
|
| 431 |
+
details::abort();
|
| 432 |
+
}
|
| 433 |
+
#endif
|
| 434 |
+
|
| 435 |
+
|
| 436 |
+
#if defined(_CG_USER_PROVIDED_SHARED_MEMORY)
|
| 437 |
+
#define _CG_SKIP_BARRIER_INIT_TARGET NV_NO_TARGET
|
| 438 |
+
#else
|
| 439 |
+
#define _CG_SKIP_BARRIER_INIT_TARGET NV_PROVIDES_SM_80
|
| 440 |
+
#endif
|
| 441 |
+
NV_IF_ELSE_TARGET(
|
| 442 |
+
_CG_SKIP_BARRIER_INIT_TARGET,
|
| 443 |
+
// skip if clause
|
| 444 |
+
,
|
| 445 |
+
(tile_memory->init_barriers(thread_rank());
|
| 446 |
+
sync();)
|
| 447 |
+
)
|
| 448 |
+
}
|
| 449 |
+
#endif
|
| 450 |
+
#undef _CG_SKIP_BARRIER_INIT_TARGET
|
| 451 |
+
|
| 452 |
+
// Disable constructor
|
| 453 |
+
_CG_QUALIFIER thread_block()
|
| 454 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 455 |
+
: tile_memory(details::get_scratch_ptr(NULL))
|
| 456 |
+
#endif
|
| 457 |
+
{ }
|
| 458 |
+
|
| 459 |
+
// Internal Use
|
| 460 |
+
_CG_QUALIFIER thread_group _get_tiled_threads(unsigned int tilesz) const {
|
| 461 |
+
const bool pow2_tilesz = ((tilesz & (tilesz - 1)) == 0);
|
| 462 |
+
|
| 463 |
+
// Invalid, immediately fail
|
| 464 |
+
if (tilesz == 0 || (tilesz > 32) || !pow2_tilesz) {
|
| 465 |
+
details::abort();
|
| 466 |
+
return (thread_block());
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
unsigned int mask;
|
| 470 |
+
unsigned int base_offset = thread_rank() & (~(tilesz - 1));
|
| 471 |
+
unsigned int masklength = min((unsigned int)size() - base_offset, tilesz);
|
| 472 |
+
|
| 473 |
+
mask = (unsigned int)(-1) >> (32 - masklength);
|
| 474 |
+
mask <<= (details::laneid() & ~(tilesz - 1));
|
| 475 |
+
thread_group tile = thread_group(details::coalesced_group_id);
|
| 476 |
+
tile._data.coalesced.mask = mask;
|
| 477 |
+
tile._data.coalesced.size = __popc(mask);
|
| 478 |
+
tile._data.coalesced.metaGroupSize = (details::cta::size() + tilesz - 1) / tilesz;
|
| 479 |
+
tile._data.coalesced.metaGroupRank = details::cta::thread_rank() / tilesz;
|
| 480 |
+
tile._data.coalesced.is_tiled = true;
|
| 481 |
+
return (tile);
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
public:
|
| 485 |
+
_CG_STATIC_CONST_DECL unsigned int _group_id = details::thread_block_id;
|
| 486 |
+
_CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_block)
|
| 487 |
+
|
| 488 |
+
_CG_STATIC_QUALIFIER void sync() {
|
| 489 |
+
details::cta::sync();
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 493 |
+
struct arrival_token {};
|
| 494 |
+
|
| 495 |
+
_CG_QUALIFIER arrival_token barrier_arrive() const {
|
| 496 |
+
return arrival_token();
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
_CG_QUALIFIER void barrier_wait(arrival_token&&) const {
|
| 500 |
+
details::cta::sync();
|
| 501 |
+
}
|
| 502 |
+
#endif
|
| 503 |
+
|
| 504 |
+
_CG_STATIC_QUALIFIER unsigned int size() {
|
| 505 |
+
return details::cta::size();
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
_CG_STATIC_QUALIFIER unsigned int thread_rank() {
|
| 509 |
+
return details::cta::thread_rank();
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
// Additional functionality exposed by the group
|
| 513 |
+
_CG_STATIC_QUALIFIER dim3 group_index() {
|
| 514 |
+
return details::cta::group_index();
|
| 515 |
+
}
|
| 516 |
+
|
| 517 |
+
_CG_STATIC_QUALIFIER dim3 thread_index() {
|
| 518 |
+
return details::cta::thread_index();
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
_CG_STATIC_QUALIFIER dim3 group_dim() {
|
| 522 |
+
return details::cta::block_dim();
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
_CG_STATIC_QUALIFIER dim3 dim_threads() {
|
| 526 |
+
return details::cta::dim_threads();
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
_CG_STATIC_QUALIFIER unsigned int num_threads() {
|
| 530 |
+
return details::cta::num_threads();
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
};
|
| 534 |
+
|
| 535 |
+
/**
|
| 536 |
+
* thread_block this_thread_block()
|
| 537 |
+
*
|
| 538 |
+
* Constructs a thread_block group
|
| 539 |
+
*/
|
| 540 |
+
_CG_QUALIFIER thread_block this_thread_block()
|
| 541 |
+
{
|
| 542 |
+
return (thread_block());
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 546 |
+
template <unsigned int MaxBlockSize>
|
| 547 |
+
_CG_QUALIFIER thread_block this_thread_block(block_tile_memory<MaxBlockSize>& scratch) {
|
| 548 |
+
return (thread_block(scratch));
|
| 549 |
+
}
|
| 550 |
+
#endif
|
| 551 |
+
|
| 552 |
+
/**
|
| 553 |
+
* class coalesced_group
|
| 554 |
+
*
|
| 555 |
+
* A group representing the current set of converged threads in a warp.
|
| 556 |
+
* The size of the group is not guaranteed and it may return a group of
|
| 557 |
+
* only one thread (itself).
|
| 558 |
+
*
|
| 559 |
+
* This group exposes warp-synchronous builtins.
|
| 560 |
+
* Constructed via coalesced_threads();
|
| 561 |
+
*/
|
| 562 |
+
class coalesced_group : public thread_group_base<details::coalesced_group_id>
|
| 563 |
+
{
|
| 564 |
+
private:
|
| 565 |
+
friend _CG_QUALIFIER coalesced_group coalesced_threads();
|
| 566 |
+
friend _CG_QUALIFIER thread_group tiled_partition(const thread_group& parent, unsigned int tilesz);
|
| 567 |
+
friend _CG_QUALIFIER coalesced_group tiled_partition(const coalesced_group& parent, unsigned int tilesz);
|
| 568 |
+
friend class details::_coalesced_group_data_access;
|
| 569 |
+
|
| 570 |
+
_CG_QUALIFIER unsigned int _packLanes(unsigned laneMask) const {
|
| 571 |
+
unsigned int member_pack = 0;
|
| 572 |
+
unsigned int member_rank = 0;
|
| 573 |
+
for (int bit_idx = 0; bit_idx < 32; bit_idx++) {
|
| 574 |
+
unsigned int lane_bit = _data.coalesced.mask & (1 << bit_idx);
|
| 575 |
+
if (lane_bit) {
|
| 576 |
+
if (laneMask & lane_bit)
|
| 577 |
+
member_pack |= 1 << member_rank;
|
| 578 |
+
member_rank++;
|
| 579 |
+
}
|
| 580 |
+
}
|
| 581 |
+
return (member_pack);
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
// Internal Use
|
| 585 |
+
_CG_QUALIFIER coalesced_group _get_tiled_threads(unsigned int tilesz) const {
|
| 586 |
+
const bool pow2_tilesz = ((tilesz & (tilesz - 1)) == 0);
|
| 587 |
+
|
| 588 |
+
// Invalid, immediately fail
|
| 589 |
+
if (tilesz == 0 || (tilesz > 32) || !pow2_tilesz) {
|
| 590 |
+
details::abort();
|
| 591 |
+
return (coalesced_group(0));
|
| 592 |
+
}
|
| 593 |
+
if (size() <= tilesz) {
|
| 594 |
+
return (*this);
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
if ((_data.coalesced.is_tiled == true) && pow2_tilesz) {
|
| 598 |
+
unsigned int base_offset = (thread_rank() & (~(tilesz - 1)));
|
| 599 |
+
unsigned int masklength = min((unsigned int)size() - base_offset, tilesz);
|
| 600 |
+
unsigned int mask = (unsigned int)(-1) >> (32 - masklength);
|
| 601 |
+
|
| 602 |
+
mask <<= (details::laneid() & ~(tilesz - 1));
|
| 603 |
+
coalesced_group coalesced_tile = coalesced_group(mask);
|
| 604 |
+
coalesced_tile._data.coalesced.metaGroupSize = size() / tilesz;
|
| 605 |
+
coalesced_tile._data.coalesced.metaGroupRank = thread_rank() / tilesz;
|
| 606 |
+
coalesced_tile._data.coalesced.is_tiled = true;
|
| 607 |
+
return (coalesced_tile);
|
| 608 |
+
}
|
| 609 |
+
else if ((_data.coalesced.is_tiled == false) && pow2_tilesz) {
|
| 610 |
+
unsigned int mask = 0;
|
| 611 |
+
unsigned int member_rank = 0;
|
| 612 |
+
int seen_lanes = (thread_rank() / tilesz) * tilesz;
|
| 613 |
+
for (unsigned int bit_idx = 0; bit_idx < 32; bit_idx++) {
|
| 614 |
+
unsigned int lane_bit = _data.coalesced.mask & (1 << bit_idx);
|
| 615 |
+
if (lane_bit) {
|
| 616 |
+
if (seen_lanes <= 0 && member_rank < tilesz) {
|
| 617 |
+
mask |= lane_bit;
|
| 618 |
+
member_rank++;
|
| 619 |
+
}
|
| 620 |
+
seen_lanes--;
|
| 621 |
+
}
|
| 622 |
+
}
|
| 623 |
+
coalesced_group coalesced_tile = coalesced_group(mask);
|
| 624 |
+
// Override parent with the size of this group
|
| 625 |
+
coalesced_tile._data.coalesced.metaGroupSize = (size() + tilesz - 1) / tilesz;
|
| 626 |
+
coalesced_tile._data.coalesced.metaGroupRank = thread_rank() / tilesz;
|
| 627 |
+
return coalesced_tile;
|
| 628 |
+
}
|
| 629 |
+
else {
|
| 630 |
+
// None in _CG_VERSION 1000
|
| 631 |
+
details::abort();
|
| 632 |
+
}
|
| 633 |
+
|
| 634 |
+
return (coalesced_group(0));
|
| 635 |
+
}
|
| 636 |
+
|
| 637 |
+
protected:
|
| 638 |
+
_CG_QUALIFIER coalesced_group(unsigned int mask) {
|
| 639 |
+
_data.coalesced.mask = mask;
|
| 640 |
+
_data.coalesced.size = __popc(mask);
|
| 641 |
+
_data.coalesced.metaGroupRank = 0;
|
| 642 |
+
_data.coalesced.metaGroupSize = 1;
|
| 643 |
+
_data.coalesced.is_tiled = false;
|
| 644 |
+
}
|
| 645 |
+
|
| 646 |
+
_CG_QUALIFIER unsigned int get_mask() const {
|
| 647 |
+
return (_data.coalesced.mask);
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
public:
|
| 651 |
+
_CG_STATIC_CONST_DECL unsigned int _group_id = details::coalesced_group_id;
|
| 652 |
+
_CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_block)
|
| 653 |
+
|
| 654 |
+
_CG_QUALIFIER unsigned int num_threads() const {
|
| 655 |
+
return _data.coalesced.size;
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
_CG_QUALIFIER unsigned int size() const {
|
| 659 |
+
return num_threads();
|
| 660 |
+
}
|
| 661 |
+
|
| 662 |
+
_CG_QUALIFIER unsigned int thread_rank() const {
|
| 663 |
+
return (__popc(_data.coalesced.mask & details::lanemask32_lt()));
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
// Rank of this group in the upper level of the hierarchy
|
| 667 |
+
_CG_QUALIFIER unsigned int meta_group_rank() const {
|
| 668 |
+
return _data.coalesced.metaGroupRank;
|
| 669 |
+
}
|
| 670 |
+
|
| 671 |
+
// Total num partitions created out of all CTAs when the group was created
|
| 672 |
+
_CG_QUALIFIER unsigned int meta_group_size() const {
|
| 673 |
+
return _data.coalesced.metaGroupSize;
|
| 674 |
+
}
|
| 675 |
+
|
| 676 |
+
_CG_QUALIFIER void sync() const {
|
| 677 |
+
__syncwarp(_data.coalesced.mask);
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
#ifdef _CG_CPP11_FEATURES
|
| 681 |
+
template <typename TyElem, typename TyRet = details::remove_qual<TyElem>>
|
| 682 |
+
_CG_QUALIFIER TyRet shfl(TyElem&& elem, int srcRank) const {
|
| 683 |
+
unsigned int lane = (srcRank == 0) ? __ffs(_data.coalesced.mask) - 1 :
|
| 684 |
+
(size() == 32) ? srcRank : __fns(_data.coalesced.mask, 0, (srcRank + 1));
|
| 685 |
+
|
| 686 |
+
return details::tile::shuffle_dispatch<TyElem>::shfl(
|
| 687 |
+
_CG_STL_NAMESPACE::forward<TyElem>(elem), _data.coalesced.mask, lane, 32);
|
| 688 |
+
}
|
| 689 |
+
|
| 690 |
+
template <typename TyElem, typename TyRet = details::remove_qual<TyElem>>
|
| 691 |
+
_CG_QUALIFIER TyRet shfl_down(TyElem&& elem, unsigned int delta) const {
|
| 692 |
+
if (size() == 32) {
|
| 693 |
+
return details::tile::shuffle_dispatch<TyElem>::shfl_down(
|
| 694 |
+
_CG_STL_NAMESPACE::forward<TyElem>(elem), 0xFFFFFFFF, delta, 32);
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
unsigned int lane = __fns(_data.coalesced.mask, details::laneid(), delta + 1);
|
| 698 |
+
|
| 699 |
+
if (lane >= 32)
|
| 700 |
+
lane = details::laneid();
|
| 701 |
+
|
| 702 |
+
return details::tile::shuffle_dispatch<TyElem>::shfl(
|
| 703 |
+
_CG_STL_NAMESPACE::forward<TyElem>(elem), _data.coalesced.mask, lane, 32);
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
template <typename TyElem, typename TyRet = details::remove_qual<TyElem>>
|
| 707 |
+
_CG_QUALIFIER TyRet shfl_up(TyElem&& elem, int delta) const {
|
| 708 |
+
if (size() == 32) {
|
| 709 |
+
return details::tile::shuffle_dispatch<TyElem>::shfl_up(
|
| 710 |
+
_CG_STL_NAMESPACE::forward<TyElem>(elem), 0xFFFFFFFF, delta, 32);
|
| 711 |
+
}
|
| 712 |
+
|
| 713 |
+
unsigned lane = __fns(_data.coalesced.mask, details::laneid(), -(delta + 1));
|
| 714 |
+
if (lane >= 32)
|
| 715 |
+
lane = details::laneid();
|
| 716 |
+
|
| 717 |
+
return details::tile::shuffle_dispatch<TyElem>::shfl(
|
| 718 |
+
_CG_STL_NAMESPACE::forward<TyElem>(elem), _data.coalesced.mask, lane, 32);
|
| 719 |
+
}
|
| 720 |
+
#else
|
| 721 |
+
template <typename TyIntegral>
|
| 722 |
+
_CG_QUALIFIER TyIntegral shfl(TyIntegral var, unsigned int src_rank) const {
|
| 723 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 724 |
+
unsigned int lane = (src_rank == 0) ? __ffs(_data.coalesced.mask) - 1 :
|
| 725 |
+
(size() == 32) ? src_rank : __fns(_data.coalesced.mask, 0, (src_rank + 1));
|
| 726 |
+
return (__shfl_sync(_data.coalesced.mask, var, lane, 32));
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
template <typename TyIntegral>
|
| 730 |
+
_CG_QUALIFIER TyIntegral shfl_up(TyIntegral var, int delta) const {
|
| 731 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 732 |
+
if (size() == 32) {
|
| 733 |
+
return (__shfl_up_sync(0xFFFFFFFF, var, delta, 32));
|
| 734 |
+
}
|
| 735 |
+
unsigned lane = __fns(_data.coalesced.mask, details::laneid(), -(delta + 1));
|
| 736 |
+
if (lane >= 32) lane = details::laneid();
|
| 737 |
+
return (__shfl_sync(_data.coalesced.mask, var, lane, 32));
|
| 738 |
+
}
|
| 739 |
+
|
| 740 |
+
template <typename TyIntegral>
|
| 741 |
+
_CG_QUALIFIER TyIntegral shfl_down(TyIntegral var, int delta) const {
|
| 742 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 743 |
+
if (size() == 32) {
|
| 744 |
+
return (__shfl_down_sync(0xFFFFFFFF, var, delta, 32));
|
| 745 |
+
}
|
| 746 |
+
unsigned int lane = __fns(_data.coalesced.mask, details::laneid(), delta + 1);
|
| 747 |
+
if (lane >= 32) lane = details::laneid();
|
| 748 |
+
return (__shfl_sync(_data.coalesced.mask, var, lane, 32));
|
| 749 |
+
}
|
| 750 |
+
#endif
|
| 751 |
+
|
| 752 |
+
_CG_QUALIFIER int any(int predicate) const {
|
| 753 |
+
return (__ballot_sync(_data.coalesced.mask, predicate) != 0);
|
| 754 |
+
}
|
| 755 |
+
_CG_QUALIFIER int all(int predicate) const {
|
| 756 |
+
return (__ballot_sync(_data.coalesced.mask, predicate) == _data.coalesced.mask);
|
| 757 |
+
}
|
| 758 |
+
_CG_QUALIFIER unsigned int ballot(int predicate) const {
|
| 759 |
+
if (size() == 32) {
|
| 760 |
+
return (__ballot_sync(0xFFFFFFFF, predicate));
|
| 761 |
+
}
|
| 762 |
+
unsigned int lane_ballot = __ballot_sync(_data.coalesced.mask, predicate);
|
| 763 |
+
return (_packLanes(lane_ballot));
|
| 764 |
+
}
|
| 765 |
+
|
| 766 |
+
#ifdef _CG_HAS_MATCH_COLLECTIVE
|
| 767 |
+
|
| 768 |
+
template <typename TyIntegral>
|
| 769 |
+
_CG_QUALIFIER unsigned int match_any(TyIntegral val) const {
|
| 770 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 771 |
+
if (size() == 32) {
|
| 772 |
+
return (__match_any_sync(0xFFFFFFFF, val));
|
| 773 |
+
}
|
| 774 |
+
unsigned int lane_match = __match_any_sync(_data.coalesced.mask, val);
|
| 775 |
+
return (_packLanes(lane_match));
|
| 776 |
+
}
|
| 777 |
+
|
| 778 |
+
template <typename TyIntegral>
|
| 779 |
+
_CG_QUALIFIER unsigned int match_all(TyIntegral val, int &pred) const {
|
| 780 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 781 |
+
if (size() == 32) {
|
| 782 |
+
return (__match_all_sync(0xFFFFFFFF, val, &pred));
|
| 783 |
+
}
|
| 784 |
+
unsigned int lane_match = __match_all_sync(_data.coalesced.mask, val, &pred);
|
| 785 |
+
return (_packLanes(lane_match));
|
| 786 |
+
}
|
| 787 |
+
|
| 788 |
+
#endif /* !_CG_HAS_MATCH_COLLECTIVE */
|
| 789 |
+
|
| 790 |
+
};
|
| 791 |
+
|
| 792 |
+
_CG_QUALIFIER coalesced_group coalesced_threads()
|
| 793 |
+
{
|
| 794 |
+
return (coalesced_group(__activemask()));
|
| 795 |
+
}
|
| 796 |
+
|
| 797 |
+
namespace details {
|
| 798 |
+
template <unsigned int Size> struct verify_thread_block_tile_size;
|
| 799 |
+
template <> struct verify_thread_block_tile_size<32> { typedef void OK; };
|
| 800 |
+
template <> struct verify_thread_block_tile_size<16> { typedef void OK; };
|
| 801 |
+
template <> struct verify_thread_block_tile_size<8> { typedef void OK; };
|
| 802 |
+
template <> struct verify_thread_block_tile_size<4> { typedef void OK; };
|
| 803 |
+
template <> struct verify_thread_block_tile_size<2> { typedef void OK; };
|
| 804 |
+
template <> struct verify_thread_block_tile_size<1> { typedef void OK; };
|
| 805 |
+
|
| 806 |
+
#ifdef _CG_CPP11_FEATURES
|
| 807 |
+
template <unsigned int Size>
|
| 808 |
+
using _is_power_of_2 = _CG_STL_NAMESPACE::integral_constant<bool, (Size & (Size - 1)) == 0>;
|
| 809 |
+
|
| 810 |
+
template <unsigned int Size>
|
| 811 |
+
using _is_single_warp = _CG_STL_NAMESPACE::integral_constant<bool, Size <= 32>;
|
| 812 |
+
template <unsigned int Size>
|
| 813 |
+
using _is_multi_warp =
|
| 814 |
+
_CG_STL_NAMESPACE::integral_constant<bool, (Size > 32) && (Size <= 1024)>;
|
| 815 |
+
|
| 816 |
+
template <unsigned int Size>
|
| 817 |
+
using _is_valid_single_warp_tile =
|
| 818 |
+
_CG_STL_NAMESPACE::integral_constant<bool, _is_power_of_2<Size>::value && _is_single_warp<Size>::value>;
|
| 819 |
+
template <unsigned int Size>
|
| 820 |
+
using _is_valid_multi_warp_tile =
|
| 821 |
+
_CG_STL_NAMESPACE::integral_constant<bool, _is_power_of_2<Size>::value && _is_multi_warp<Size>::value>;
|
| 822 |
+
#else
|
| 823 |
+
template <unsigned int Size>
|
| 824 |
+
struct _is_multi_warp {
|
| 825 |
+
static const bool value = false;
|
| 826 |
+
};
|
| 827 |
+
#endif
|
| 828 |
+
}
|
| 829 |
+
|
| 830 |
+
template <unsigned int Size>
|
| 831 |
+
class __static_size_tile_base
|
| 832 |
+
{
|
| 833 |
+
protected:
|
| 834 |
+
_CG_STATIC_CONST_DECL unsigned int numThreads = Size;
|
| 835 |
+
|
| 836 |
+
public:
|
| 837 |
+
_CG_THREAD_SCOPE(cuda::thread_scope::thread_scope_block)
|
| 838 |
+
|
| 839 |
+
// Rank of thread within tile
|
| 840 |
+
_CG_STATIC_QUALIFIER unsigned int thread_rank() {
|
| 841 |
+
return (details::cta::thread_rank() & (numThreads - 1));
|
| 842 |
+
}
|
| 843 |
+
|
| 844 |
+
// Number of threads within tile
|
| 845 |
+
_CG_STATIC_CONSTEXPR_QUALIFIER unsigned int num_threads() {
|
| 846 |
+
return numThreads;
|
| 847 |
+
}
|
| 848 |
+
|
| 849 |
+
_CG_STATIC_CONSTEXPR_QUALIFIER unsigned int size() {
|
| 850 |
+
return num_threads();
|
| 851 |
+
}
|
| 852 |
+
};
|
| 853 |
+
|
| 854 |
+
template <unsigned int Size>
|
| 855 |
+
class __static_size_thread_block_tile_base : public __static_size_tile_base<Size>
|
| 856 |
+
{
|
| 857 |
+
friend class details::_coalesced_group_data_access;
|
| 858 |
+
typedef details::tile::tile_helpers<Size> th;
|
| 859 |
+
|
| 860 |
+
#ifdef _CG_CPP11_FEATURES
|
| 861 |
+
static_assert(details::_is_valid_single_warp_tile<Size>::value, "Size must be one of 1/2/4/8/16/32");
|
| 862 |
+
#else
|
| 863 |
+
typedef typename details::verify_thread_block_tile_size<Size>::OK valid;
|
| 864 |
+
#endif
|
| 865 |
+
using __static_size_tile_base<Size>::numThreads;
|
| 866 |
+
_CG_STATIC_CONST_DECL unsigned int fullMask = 0xFFFFFFFF;
|
| 867 |
+
|
| 868 |
+
protected:
|
| 869 |
+
_CG_STATIC_QUALIFIER unsigned int build_mask() {
|
| 870 |
+
unsigned int mask = fullMask;
|
| 871 |
+
if (numThreads != 32) {
|
| 872 |
+
// [0,31] representing the current active thread in the warp
|
| 873 |
+
unsigned int laneId = details::laneid();
|
| 874 |
+
// shift mask according to the partition it belongs to
|
| 875 |
+
mask = th::tileMask << (laneId & ~(th::laneMask));
|
| 876 |
+
}
|
| 877 |
+
return (mask);
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
public:
|
| 881 |
+
_CG_STATIC_CONST_DECL unsigned int _group_id = details::coalesced_group_id;
|
| 882 |
+
|
| 883 |
+
_CG_STATIC_QUALIFIER void sync() {
|
| 884 |
+
__syncwarp(build_mask());
|
| 885 |
+
}
|
| 886 |
+
|
| 887 |
+
#ifdef _CG_CPP11_FEATURES
|
| 888 |
+
// PTX supported collectives
|
| 889 |
+
template <typename TyElem, typename TyRet = details::remove_qual<TyElem>>
|
| 890 |
+
_CG_QUALIFIER TyRet shfl(TyElem&& elem, int srcRank) const {
|
| 891 |
+
return details::tile::shuffle_dispatch<TyElem>::shfl(
|
| 892 |
+
_CG_STL_NAMESPACE::forward<TyElem>(elem), build_mask(), srcRank, numThreads);
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
template <typename TyElem, typename TyRet = details::remove_qual<TyElem>>
|
| 896 |
+
_CG_QUALIFIER TyRet shfl_down(TyElem&& elem, unsigned int delta) const {
|
| 897 |
+
return details::tile::shuffle_dispatch<TyElem>::shfl_down(
|
| 898 |
+
_CG_STL_NAMESPACE::forward<TyElem>(elem), build_mask(), delta, numThreads);
|
| 899 |
+
}
|
| 900 |
+
|
| 901 |
+
template <typename TyElem, typename TyRet = details::remove_qual<TyElem>>
|
| 902 |
+
_CG_QUALIFIER TyRet shfl_up(TyElem&& elem, unsigned int delta) const {
|
| 903 |
+
return details::tile::shuffle_dispatch<TyElem>::shfl_up(
|
| 904 |
+
_CG_STL_NAMESPACE::forward<TyElem>(elem), build_mask(), delta, numThreads);
|
| 905 |
+
}
|
| 906 |
+
|
| 907 |
+
template <typename TyElem, typename TyRet = details::remove_qual<TyElem>>
|
| 908 |
+
_CG_QUALIFIER TyRet shfl_xor(TyElem&& elem, unsigned int laneMask) const {
|
| 909 |
+
return details::tile::shuffle_dispatch<TyElem>::shfl_xor(
|
| 910 |
+
_CG_STL_NAMESPACE::forward<TyElem>(elem), build_mask(), laneMask, numThreads);
|
| 911 |
+
}
|
| 912 |
+
#else
|
| 913 |
+
template <typename TyIntegral>
|
| 914 |
+
_CG_QUALIFIER TyIntegral shfl(TyIntegral var, int srcRank) const {
|
| 915 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 916 |
+
return (__shfl_sync(build_mask(), var, srcRank, numThreads));
|
| 917 |
+
}
|
| 918 |
+
|
| 919 |
+
template <typename TyIntegral>
|
| 920 |
+
_CG_QUALIFIER TyIntegral shfl_down(TyIntegral var, unsigned int delta) const {
|
| 921 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 922 |
+
return (__shfl_down_sync(build_mask(), var, delta, numThreads));
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
template <typename TyIntegral>
|
| 926 |
+
_CG_QUALIFIER TyIntegral shfl_up(TyIntegral var, unsigned int delta) const {
|
| 927 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 928 |
+
return (__shfl_up_sync(build_mask(), var, delta, numThreads));
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
template <typename TyIntegral>
|
| 932 |
+
_CG_QUALIFIER TyIntegral shfl_xor(TyIntegral var, unsigned int laneMask) const {
|
| 933 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 934 |
+
return (__shfl_xor_sync(build_mask(), var, laneMask, numThreads));
|
| 935 |
+
}
|
| 936 |
+
#endif //_CG_CPP11_FEATURES
|
| 937 |
+
|
| 938 |
+
_CG_QUALIFIER int any(int predicate) const {
|
| 939 |
+
unsigned int lane_ballot = __ballot_sync(build_mask(), predicate);
|
| 940 |
+
return (lane_ballot != 0);
|
| 941 |
+
}
|
| 942 |
+
_CG_QUALIFIER int all(int predicate) const {
|
| 943 |
+
unsigned int lane_ballot = __ballot_sync(build_mask(), predicate);
|
| 944 |
+
return (lane_ballot == build_mask());
|
| 945 |
+
}
|
| 946 |
+
_CG_QUALIFIER unsigned int ballot(int predicate) const {
|
| 947 |
+
unsigned int lane_ballot = __ballot_sync(build_mask(), predicate);
|
| 948 |
+
return (lane_ballot >> (details::laneid() & (~(th::laneMask))));
|
| 949 |
+
}
|
| 950 |
+
|
| 951 |
+
#ifdef _CG_HAS_MATCH_COLLECTIVE
|
| 952 |
+
template <typename TyIntegral>
|
| 953 |
+
_CG_QUALIFIER unsigned int match_any(TyIntegral val) const {
|
| 954 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 955 |
+
unsigned int lane_match = __match_any_sync(build_mask(), val);
|
| 956 |
+
return (lane_match >> (details::laneid() & (~(th::laneMask))));
|
| 957 |
+
}
|
| 958 |
+
|
| 959 |
+
template <typename TyIntegral>
|
| 960 |
+
_CG_QUALIFIER unsigned int match_all(TyIntegral val, int &pred) const {
|
| 961 |
+
details::assert_if_not_arithmetic<TyIntegral>();
|
| 962 |
+
unsigned int lane_match = __match_all_sync(build_mask(), val, &pred);
|
| 963 |
+
return (lane_match >> (details::laneid() & (~(th::laneMask))));
|
| 964 |
+
}
|
| 965 |
+
#endif
|
| 966 |
+
|
| 967 |
+
};
|
| 968 |
+
|
| 969 |
+
template <unsigned int Size, typename ParentT>
|
| 970 |
+
class __static_parent_thread_block_tile_base
|
| 971 |
+
{
|
| 972 |
+
public:
|
| 973 |
+
// Rank of this group in the upper level of the hierarchy
|
| 974 |
+
_CG_STATIC_QUALIFIER unsigned int meta_group_rank() {
|
| 975 |
+
return ParentT::thread_rank() / Size;
|
| 976 |
+
}
|
| 977 |
+
|
| 978 |
+
// Total num partitions created out of all CTAs when the group was created
|
| 979 |
+
_CG_STATIC_QUALIFIER unsigned int meta_group_size() {
|
| 980 |
+
return (ParentT::size() + Size - 1) / Size;
|
| 981 |
+
}
|
| 982 |
+
};
|
| 983 |
+
|
| 984 |
+
/**
|
| 985 |
+
* class thread_block_tile<unsigned int Size, ParentT = void>
|
| 986 |
+
*
|
| 987 |
+
* Statically-sized group type, representing one tile of a thread block.
|
| 988 |
+
* The only specializations currently supported are those with native
|
| 989 |
+
* hardware support (1/2/4/8/16/32)
|
| 990 |
+
*
|
| 991 |
+
* This group exposes warp-synchronous builtins.
|
| 992 |
+
* Can only be constructed via tiled_partition<Size>(ParentT&)
|
| 993 |
+
*/
|
| 994 |
+
|
| 995 |
+
template <unsigned int Size, typename ParentT = void>
|
| 996 |
+
class __single_warp_thread_block_tile :
|
| 997 |
+
public __static_size_thread_block_tile_base<Size>,
|
| 998 |
+
public __static_parent_thread_block_tile_base<Size, ParentT>
|
| 999 |
+
{
|
| 1000 |
+
typedef __static_parent_thread_block_tile_base<Size, ParentT> staticParentBaseT;
|
| 1001 |
+
friend class details::_coalesced_group_data_access;
|
| 1002 |
+
|
| 1003 |
+
protected:
|
| 1004 |
+
_CG_QUALIFIER __single_warp_thread_block_tile() { };
|
| 1005 |
+
_CG_QUALIFIER __single_warp_thread_block_tile(unsigned int, unsigned int) { };
|
| 1006 |
+
|
| 1007 |
+
_CG_STATIC_QUALIFIER unsigned int get_mask() {
|
| 1008 |
+
return __static_size_thread_block_tile_base<Size>::build_mask();
|
| 1009 |
+
}
|
| 1010 |
+
};
|
| 1011 |
+
|
| 1012 |
+
template <unsigned int Size>
|
| 1013 |
+
class __single_warp_thread_block_tile<Size, void> :
|
| 1014 |
+
public __static_size_thread_block_tile_base<Size>,
|
| 1015 |
+
public thread_group_base<details::coalesced_group_id>
|
| 1016 |
+
{
|
| 1017 |
+
_CG_STATIC_CONST_DECL unsigned int numThreads = Size;
|
| 1018 |
+
|
| 1019 |
+
template <unsigned int, typename ParentT> friend class __single_warp_thread_block_tile;
|
| 1020 |
+
friend class details::_coalesced_group_data_access;
|
| 1021 |
+
|
| 1022 |
+
typedef __static_size_thread_block_tile_base<numThreads> staticSizeBaseT;
|
| 1023 |
+
|
| 1024 |
+
protected:
|
| 1025 |
+
_CG_QUALIFIER __single_warp_thread_block_tile(unsigned int meta_group_rank = 0, unsigned int meta_group_size = 1) {
|
| 1026 |
+
_data.coalesced.mask = staticSizeBaseT::build_mask();
|
| 1027 |
+
_data.coalesced.size = numThreads;
|
| 1028 |
+
_data.coalesced.metaGroupRank = meta_group_rank;
|
| 1029 |
+
_data.coalesced.metaGroupSize = meta_group_size;
|
| 1030 |
+
_data.coalesced.is_tiled = true;
|
| 1031 |
+
}
|
| 1032 |
+
|
| 1033 |
+
_CG_QUALIFIER unsigned int get_mask() const {
|
| 1034 |
+
return (_data.coalesced.mask);
|
| 1035 |
+
}
|
| 1036 |
+
|
| 1037 |
+
public:
|
| 1038 |
+
using staticSizeBaseT::sync;
|
| 1039 |
+
using staticSizeBaseT::size;
|
| 1040 |
+
using staticSizeBaseT::num_threads;
|
| 1041 |
+
using staticSizeBaseT::thread_rank;
|
| 1042 |
+
|
| 1043 |
+
_CG_QUALIFIER unsigned int meta_group_rank() const {
|
| 1044 |
+
return _data.coalesced.metaGroupRank;
|
| 1045 |
+
}
|
| 1046 |
+
|
| 1047 |
+
_CG_QUALIFIER unsigned int meta_group_size() const {
|
| 1048 |
+
return _data.coalesced.metaGroupSize;
|
| 1049 |
+
}
|
| 1050 |
+
};
|
| 1051 |
+
|
| 1052 |
+
/**
|
| 1053 |
+
* Outer level API calls
|
| 1054 |
+
* void sync(GroupT) - see <group_type>.sync()
|
| 1055 |
+
* void thread_rank(GroupT) - see <group_type>.thread_rank()
|
| 1056 |
+
* void group_size(GroupT) - see <group_type>.size()
|
| 1057 |
+
*/
|
| 1058 |
+
template <class GroupT>
|
| 1059 |
+
_CG_QUALIFIER void sync(GroupT const &g)
|
| 1060 |
+
{
|
| 1061 |
+
g.sync();
|
| 1062 |
+
}
|
| 1063 |
+
|
| 1064 |
+
// TODO: Use a static dispatch to determine appropriate return type
|
| 1065 |
+
// C++03 is stuck with unsigned long long for now
|
| 1066 |
+
#ifdef _CG_CPP11_FEATURES
|
| 1067 |
+
template <class GroupT>
|
| 1068 |
+
_CG_QUALIFIER auto thread_rank(GroupT const& g) -> decltype(g.thread_rank()) {
|
| 1069 |
+
return g.thread_rank();
|
| 1070 |
+
}
|
| 1071 |
+
|
| 1072 |
+
|
| 1073 |
+
template <class GroupT>
|
| 1074 |
+
_CG_QUALIFIER auto group_size(GroupT const &g) -> decltype(g.num_threads()) {
|
| 1075 |
+
return g.num_threads();
|
| 1076 |
+
}
|
| 1077 |
+
#else
|
| 1078 |
+
template <class GroupT>
|
| 1079 |
+
_CG_QUALIFIER unsigned long long thread_rank(GroupT const& g) {
|
| 1080 |
+
return static_cast<unsigned long long>(g.thread_rank());
|
| 1081 |
+
}
|
| 1082 |
+
|
| 1083 |
+
|
| 1084 |
+
template <class GroupT>
|
| 1085 |
+
_CG_QUALIFIER unsigned long long group_size(GroupT const &g) {
|
| 1086 |
+
return static_cast<unsigned long long>(g.num_threads());
|
| 1087 |
+
}
|
| 1088 |
+
#endif
|
| 1089 |
+
|
| 1090 |
+
|
| 1091 |
+
/**
|
| 1092 |
+
* tiled_partition
|
| 1093 |
+
*
|
| 1094 |
+
* The tiled_partition(parent, tilesz) method is a collective operation that
|
| 1095 |
+
* partitions the parent group into a one-dimensional, row-major, tiling of subgroups.
|
| 1096 |
+
*
|
| 1097 |
+
* A total of ((size(parent)+tilesz-1)/tilesz) subgroups will
|
| 1098 |
+
* be created where threads having identical k = (thread_rank(parent)/tilesz)
|
| 1099 |
+
* will be members of the same subgroup.
|
| 1100 |
+
*
|
| 1101 |
+
* The implementation may cause the calling thread to wait until all the members
|
| 1102 |
+
* of the parent group have invoked the operation before resuming execution.
|
| 1103 |
+
*
|
| 1104 |
+
* Functionality is limited to power-of-two sized subgorup instances of at most
|
| 1105 |
+
* 32 threads. Only thread_block, thread_block_tile<>, and their subgroups can be
|
| 1106 |
+
* tiled_partition() in _CG_VERSION 1000.
|
| 1107 |
+
*/
|
| 1108 |
+
_CG_QUALIFIER thread_group tiled_partition(const thread_group& parent, unsigned int tilesz)
|
| 1109 |
+
{
|
| 1110 |
+
if (parent.get_type() == details::coalesced_group_id) {
|
| 1111 |
+
const coalesced_group *_cg = static_cast<const coalesced_group*>(&parent);
|
| 1112 |
+
return _cg->_get_tiled_threads(tilesz);
|
| 1113 |
+
}
|
| 1114 |
+
else {
|
| 1115 |
+
const thread_block *_tb = static_cast<const thread_block*>(&parent);
|
| 1116 |
+
return _tb->_get_tiled_threads(tilesz);
|
| 1117 |
+
}
|
| 1118 |
+
}
|
| 1119 |
+
|
| 1120 |
+
// Thread block type overload: returns a basic thread_group for now (may be specialized later)
|
| 1121 |
+
_CG_QUALIFIER thread_group tiled_partition(const thread_block& parent, unsigned int tilesz)
|
| 1122 |
+
{
|
| 1123 |
+
return (parent._get_tiled_threads(tilesz));
|
| 1124 |
+
}
|
| 1125 |
+
|
| 1126 |
+
// Coalesced group type overload: retains its ability to stay coalesced
|
| 1127 |
+
_CG_QUALIFIER coalesced_group tiled_partition(const coalesced_group& parent, unsigned int tilesz)
|
| 1128 |
+
{
|
| 1129 |
+
return (parent._get_tiled_threads(tilesz));
|
| 1130 |
+
}
|
| 1131 |
+
|
| 1132 |
+
namespace details {
|
| 1133 |
+
template <unsigned int Size, typename ParentT>
|
| 1134 |
+
class internal_thread_block_tile : public __single_warp_thread_block_tile<Size, ParentT> {};
|
| 1135 |
+
|
| 1136 |
+
template <unsigned int Size, typename ParentT>
|
| 1137 |
+
_CG_QUALIFIER internal_thread_block_tile<Size, ParentT> tiled_partition_internal() {
|
| 1138 |
+
return internal_thread_block_tile<Size, ParentT>();
|
| 1139 |
+
}
|
| 1140 |
+
|
| 1141 |
+
template <typename TyVal, typename GroupT, typename WarpLambda, typename InterWarpLambda>
|
| 1142 |
+
_CG_QUALIFIER TyVal multi_warp_collectives_helper(
|
| 1143 |
+
const GroupT& group,
|
| 1144 |
+
WarpLambda warp_lambda,
|
| 1145 |
+
InterWarpLambda inter_warp_lambda) {
|
| 1146 |
+
return group.template collectives_scheme<TyVal>(warp_lambda, inter_warp_lambda);
|
| 1147 |
+
}
|
| 1148 |
+
|
| 1149 |
+
template <typename T, typename GroupT>
|
| 1150 |
+
_CG_QUALIFIER T* multi_warp_scratch_location_getter(const GroupT& group, unsigned int warp_id) {
|
| 1151 |
+
return group.template get_scratch_location<T>(warp_id);
|
| 1152 |
+
}
|
| 1153 |
+
|
| 1154 |
+
template <typename GroupT>
|
| 1155 |
+
_CG_QUALIFIER details::barrier_t* multi_warp_sync_location_getter(const GroupT& group) {
|
| 1156 |
+
return group.get_sync_location();
|
| 1157 |
+
}
|
| 1158 |
+
|
| 1159 |
+
}
|
| 1160 |
+
/**
|
| 1161 |
+
* tiled_partition<tilesz>
|
| 1162 |
+
*
|
| 1163 |
+
* The tiled_partition<tilesz>(parent) method is a collective operation that
|
| 1164 |
+
* partitions the parent group into a one-dimensional, row-major, tiling of subgroups.
|
| 1165 |
+
*
|
| 1166 |
+
* A total of ((size(parent)/tilesz) subgroups will be created,
|
| 1167 |
+
* therefore the parent group size must be evenly divisible by the tilesz.
|
| 1168 |
+
* The allow parent groups are thread_block or thread_block_tile<size>.
|
| 1169 |
+
*
|
| 1170 |
+
* The implementation may cause the calling thread to wait until all the members
|
| 1171 |
+
* of the parent group have invoked the operation before resuming execution.
|
| 1172 |
+
*
|
| 1173 |
+
* Functionality is limited to native hardware sizes, 1/2/4/8/16/32.
|
| 1174 |
+
* The size(parent) must be greater than the template Size parameter
|
| 1175 |
+
* otherwise the results are undefined.
|
| 1176 |
+
*/
|
| 1177 |
+
|
| 1178 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 1179 |
+
template <unsigned int Size>
|
| 1180 |
+
class __static_size_multi_warp_tile_base : public __static_size_tile_base<Size>
|
| 1181 |
+
{
|
| 1182 |
+
static_assert(details::_is_valid_multi_warp_tile<Size>::value, "Size must be one of 64/128/256/512");
|
| 1183 |
+
|
| 1184 |
+
template <typename TyVal, typename GroupT, typename WarpLambda, typename InterWarpLambda>
|
| 1185 |
+
friend __device__ TyVal details::multi_warp_collectives_helper(
|
| 1186 |
+
const GroupT& group,
|
| 1187 |
+
WarpLambda warp_lambda,
|
| 1188 |
+
InterWarpLambda inter_warp_lambda);
|
| 1189 |
+
template <typename T, typename GroupT>
|
| 1190 |
+
friend __device__ T* details::multi_warp_scratch_location_getter(const GroupT& group, unsigned int warp_id);
|
| 1191 |
+
template <typename GroupT>
|
| 1192 |
+
friend __device__ details::barrier_t* details::multi_warp_sync_location_getter(const GroupT& group);
|
| 1193 |
+
template <unsigned int OtherSize>
|
| 1194 |
+
friend class __static_size_multi_warp_tile_base;
|
| 1195 |
+
using WarpType = details::internal_thread_block_tile<32, __static_size_multi_warp_tile_base<Size>>;
|
| 1196 |
+
using ThisType = __static_size_multi_warp_tile_base<Size>;
|
| 1197 |
+
_CG_STATIC_CONST_DECL int numWarps = Size / 32;
|
| 1198 |
+
|
| 1199 |
+
protected:
|
| 1200 |
+
details::multi_warp_scratch* const tile_memory;
|
| 1201 |
+
|
| 1202 |
+
template <typename GroupT>
|
| 1203 |
+
_CG_QUALIFIER __static_size_multi_warp_tile_base(const GroupT& g) : tile_memory(g.tile_memory) {
|
| 1204 |
+
#if !defined(_CG_USER_PROVIDED_SHARED_MEMORY)
|
| 1205 |
+
NV_IF_TARGET(NV_PROVIDES_SM_80,
|
| 1206 |
+
details::sync_warps_reset(get_sync_location(), details::cta::thread_rank());
|
| 1207 |
+
g.sync();
|
| 1208 |
+
)
|
| 1209 |
+
#endif
|
| 1210 |
+
}
|
| 1211 |
+
|
| 1212 |
+
|
| 1213 |
+
private:
|
| 1214 |
+
_CG_QUALIFIER details::barrier_t* get_sync_location() const {
|
| 1215 |
+
// Different group sizes use different barriers, all groups of a given size share one barrier.
|
| 1216 |
+
unsigned int sync_id = details::log2(Size / 64);
|
| 1217 |
+
return &tile_memory->barriers[sync_id];
|
| 1218 |
+
}
|
| 1219 |
+
|
| 1220 |
+
template <typename T>
|
| 1221 |
+
_CG_QUALIFIER T* get_scratch_location(unsigned int warp_id) const {
|
| 1222 |
+
unsigned int scratch_id = (details::cta::thread_rank() - thread_rank()) / 32 + warp_id;
|
| 1223 |
+
return reinterpret_cast<T*>(&tile_memory->communication_memory[scratch_id]);
|
| 1224 |
+
}
|
| 1225 |
+
|
| 1226 |
+
template <typename T>
|
| 1227 |
+
_CG_QUALIFIER T* get_scratch_location() const {
|
| 1228 |
+
unsigned int scratch_id = details::cta::thread_rank() / 32;
|
| 1229 |
+
return reinterpret_cast<T*>(&tile_memory->communication_memory[scratch_id]);
|
| 1230 |
+
}
|
| 1231 |
+
|
| 1232 |
+
template <typename TyVal>
|
| 1233 |
+
_CG_QUALIFIER TyVal shfl_impl(TyVal val, unsigned int src) const {
|
| 1234 |
+
unsigned int src_warp = src / 32;
|
| 1235 |
+
auto warp = details::tiled_partition_internal<32, ThisType>();
|
| 1236 |
+
details::barrier_t* sync_location = get_sync_location();
|
| 1237 |
+
|
| 1238 |
+
// Get warp slot of the source threads warp.
|
| 1239 |
+
TyVal* warp_scratch_location = get_scratch_location<TyVal>(src_warp);
|
| 1240 |
+
|
| 1241 |
+
if (warp.meta_group_rank() == src_warp) {
|
| 1242 |
+
warp.sync();
|
| 1243 |
+
// Put shuffled value into my warp slot and let my warp arrive at the barrier.
|
| 1244 |
+
if (thread_rank() == src) {
|
| 1245 |
+
*warp_scratch_location = val;
|
| 1246 |
+
}
|
| 1247 |
+
details::sync_warps_arrive(sync_location, details::cta::thread_rank(), numWarps);
|
| 1248 |
+
TyVal result = *warp_scratch_location;
|
| 1249 |
+
details::sync_warps_wait(sync_location, details::cta::thread_rank());
|
| 1250 |
+
return result;
|
| 1251 |
+
}
|
| 1252 |
+
else {
|
| 1253 |
+
// Wait for the source warp to arrive on the barrier.
|
| 1254 |
+
details::sync_warps_wait_for_specific_warp(sync_location,
|
| 1255 |
+
(details::cta::thread_rank() / 32 - warp.meta_group_rank() + src_warp));
|
| 1256 |
+
TyVal result = *warp_scratch_location;
|
| 1257 |
+
details::sync_warps(sync_location, details::cta::thread_rank(), numWarps);
|
| 1258 |
+
return result;
|
| 1259 |
+
}
|
| 1260 |
+
}
|
| 1261 |
+
|
| 1262 |
+
template <typename TyVal, typename WarpLambda, typename InterWarpLambda>
|
| 1263 |
+
_CG_QUALIFIER TyVal collectives_scheme(const WarpLambda& warp_lambda, const InterWarpLambda& inter_warp_lambda) const {
|
| 1264 |
+
static_assert(sizeof(TyVal) <= details::multi_warp_scratch::communication_size,
|
| 1265 |
+
"Collectives with tiles larger than 32 threads are limited to types smaller then 8 bytes");
|
| 1266 |
+
auto warp = details::tiled_partition_internal<32, ThisType>();
|
| 1267 |
+
details::barrier_t* sync_location = get_sync_location();
|
| 1268 |
+
TyVal* warp_scratch_location = get_scratch_location<TyVal>();
|
| 1269 |
+
|
| 1270 |
+
warp_lambda(warp, warp_scratch_location);
|
| 1271 |
+
|
| 1272 |
+
if (details::sync_warps_last_releases(sync_location, details::cta::thread_rank(), numWarps)) {
|
| 1273 |
+
auto subwarp = details::tiled_partition_internal<numWarps, decltype(warp)>();
|
| 1274 |
+
if (subwarp.meta_group_rank() == 0) {
|
| 1275 |
+
TyVal* thread_scratch_location = get_scratch_location<TyVal>(subwarp.thread_rank());
|
| 1276 |
+
inter_warp_lambda(subwarp, thread_scratch_location);
|
| 1277 |
+
}
|
| 1278 |
+
warp.sync();
|
| 1279 |
+
details::sync_warps_release(sync_location, warp.thread_rank() == 0, details::cta::thread_rank(), numWarps);
|
| 1280 |
+
}
|
| 1281 |
+
TyVal result = *warp_scratch_location;
|
| 1282 |
+
return result;
|
| 1283 |
+
}
|
| 1284 |
+
|
| 1285 |
+
public:
|
| 1286 |
+
_CG_STATIC_CONST_DECL unsigned int _group_id = details::multi_tile_group_id;
|
| 1287 |
+
|
| 1288 |
+
using __static_size_tile_base<Size>::thread_rank;
|
| 1289 |
+
|
| 1290 |
+
template <typename TyVal>
|
| 1291 |
+
_CG_QUALIFIER TyVal shfl(TyVal val, unsigned int src) const {
|
| 1292 |
+
static_assert(sizeof(TyVal) <= details::multi_warp_scratch::communication_size,
|
| 1293 |
+
"Collectives with tiles larger than 32 threads are limited to types smaller then 8 bytes");
|
| 1294 |
+
return shfl_impl(val, src);
|
| 1295 |
+
}
|
| 1296 |
+
|
| 1297 |
+
_CG_QUALIFIER void sync() const {
|
| 1298 |
+
details::sync_warps(get_sync_location(), details::cta::thread_rank(), numWarps);
|
| 1299 |
+
}
|
| 1300 |
+
|
| 1301 |
+
_CG_QUALIFIER int any(int predicate) const {
|
| 1302 |
+
auto warp_lambda = [=] (WarpType& warp, int* warp_scratch_location) {
|
| 1303 |
+
*warp_scratch_location = __any_sync(0xFFFFFFFF, predicate);
|
| 1304 |
+
};
|
| 1305 |
+
auto inter_warp_lambda =
|
| 1306 |
+
[] (details::internal_thread_block_tile<numWarps, WarpType>& subwarp, int* thread_scratch_location) {
|
| 1307 |
+
*thread_scratch_location = __any_sync(0xFFFFFFFFU >> (32 - numWarps), *thread_scratch_location);
|
| 1308 |
+
};
|
| 1309 |
+
return collectives_scheme<int>(warp_lambda, inter_warp_lambda);
|
| 1310 |
+
}
|
| 1311 |
+
|
| 1312 |
+
_CG_QUALIFIER int all(int predicate) const {
|
| 1313 |
+
auto warp_lambda = [=] (WarpType& warp, int* warp_scratch_location) {
|
| 1314 |
+
*warp_scratch_location = __all_sync(0xFFFFFFFF, predicate);
|
| 1315 |
+
};
|
| 1316 |
+
auto inter_warp_lambda =
|
| 1317 |
+
[] (details::internal_thread_block_tile<numWarps, WarpType>& subwarp, int* thread_scratch_location) {
|
| 1318 |
+
*thread_scratch_location = __all_sync(0xFFFFFFFFU >> (32 - numWarps), *thread_scratch_location);
|
| 1319 |
+
};
|
| 1320 |
+
return collectives_scheme<int>(warp_lambda, inter_warp_lambda);
|
| 1321 |
+
}
|
| 1322 |
+
};
|
| 1323 |
+
|
| 1324 |
+
|
| 1325 |
+
template <unsigned int Size, typename ParentT = void>
|
| 1326 |
+
class __multi_warp_thread_block_tile :
|
| 1327 |
+
public __static_size_multi_warp_tile_base<Size>,
|
| 1328 |
+
public __static_parent_thread_block_tile_base<Size, ParentT>
|
| 1329 |
+
{
|
| 1330 |
+
typedef __static_parent_thread_block_tile_base<Size, ParentT> staticParentBaseT;
|
| 1331 |
+
typedef __static_size_multi_warp_tile_base<Size> staticTileBaseT;
|
| 1332 |
+
protected:
|
| 1333 |
+
_CG_QUALIFIER __multi_warp_thread_block_tile(const ParentT& g) :
|
| 1334 |
+
__static_size_multi_warp_tile_base<Size>(g) {}
|
| 1335 |
+
};
|
| 1336 |
+
|
| 1337 |
+
template <unsigned int Size>
|
| 1338 |
+
class __multi_warp_thread_block_tile<Size, void> : public __static_size_multi_warp_tile_base<Size>
|
| 1339 |
+
{
|
| 1340 |
+
const unsigned int metaGroupRank;
|
| 1341 |
+
const unsigned int metaGroupSize;
|
| 1342 |
+
|
| 1343 |
+
protected:
|
| 1344 |
+
template <unsigned int OtherSize, typename ParentT>
|
| 1345 |
+
_CG_QUALIFIER __multi_warp_thread_block_tile(const __multi_warp_thread_block_tile<OtherSize, ParentT>& g) :
|
| 1346 |
+
__static_size_multi_warp_tile_base<Size>(g), metaGroupRank(g.meta_group_rank()), metaGroupSize(g.meta_group_size()) {}
|
| 1347 |
+
|
| 1348 |
+
public:
|
| 1349 |
+
_CG_QUALIFIER unsigned int meta_group_rank() const {
|
| 1350 |
+
return metaGroupRank;
|
| 1351 |
+
}
|
| 1352 |
+
|
| 1353 |
+
_CG_QUALIFIER unsigned int meta_group_size() const {
|
| 1354 |
+
return metaGroupSize;
|
| 1355 |
+
}
|
| 1356 |
+
};
|
| 1357 |
+
#endif
|
| 1358 |
+
|
| 1359 |
+
template <unsigned int Size, typename ParentT = void>
|
| 1360 |
+
class thread_block_tile;
|
| 1361 |
+
|
| 1362 |
+
namespace details {
|
| 1363 |
+
template <unsigned int Size, typename ParentT, bool IsMultiWarp>
|
| 1364 |
+
class thread_block_tile_impl;
|
| 1365 |
+
|
| 1366 |
+
template <unsigned int Size, typename ParentT>
|
| 1367 |
+
class thread_block_tile_impl<Size, ParentT, false>: public __single_warp_thread_block_tile<Size, ParentT>
|
| 1368 |
+
{
|
| 1369 |
+
protected:
|
| 1370 |
+
template <unsigned int OtherSize, typename OtherParentT, bool OtherIsMultiWarp>
|
| 1371 |
+
_CG_QUALIFIER thread_block_tile_impl(const thread_block_tile_impl<OtherSize, OtherParentT, OtherIsMultiWarp>& g) :
|
| 1372 |
+
__single_warp_thread_block_tile<Size, ParentT>(g.meta_group_rank(), g.meta_group_size()) {}
|
| 1373 |
+
|
| 1374 |
+
_CG_QUALIFIER thread_block_tile_impl(const thread_block& g) :
|
| 1375 |
+
__single_warp_thread_block_tile<Size, ParentT>() {}
|
| 1376 |
+
};
|
| 1377 |
+
|
| 1378 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 1379 |
+
template <unsigned int Size, typename ParentT>
|
| 1380 |
+
class thread_block_tile_impl<Size, ParentT, true> : public __multi_warp_thread_block_tile<Size, ParentT>
|
| 1381 |
+
{
|
| 1382 |
+
protected:
|
| 1383 |
+
template <typename GroupT>
|
| 1384 |
+
_CG_QUALIFIER thread_block_tile_impl(const GroupT& g) :
|
| 1385 |
+
__multi_warp_thread_block_tile<Size, ParentT>(g) {}
|
| 1386 |
+
};
|
| 1387 |
+
#else
|
| 1388 |
+
template <unsigned int Size, typename ParentT>
|
| 1389 |
+
class thread_block_tile_impl<Size, ParentT, true>
|
| 1390 |
+
{
|
| 1391 |
+
protected:
|
| 1392 |
+
template <typename GroupT>
|
| 1393 |
+
_CG_QUALIFIER thread_block_tile_impl(const GroupT& g) {}
|
| 1394 |
+
};
|
| 1395 |
+
#endif
|
| 1396 |
+
}
|
| 1397 |
+
|
| 1398 |
+
template <unsigned int Size, typename ParentT>
|
| 1399 |
+
class thread_block_tile : public details::thread_block_tile_impl<Size, ParentT, details::_is_multi_warp<Size>::value>
|
| 1400 |
+
{
|
| 1401 |
+
friend _CG_QUALIFIER thread_block_tile<1, void> this_thread();
|
| 1402 |
+
|
| 1403 |
+
protected:
|
| 1404 |
+
_CG_QUALIFIER thread_block_tile(const ParentT& g) :
|
| 1405 |
+
details::thread_block_tile_impl<Size, ParentT, details::_is_multi_warp<Size>::value>(g) {}
|
| 1406 |
+
|
| 1407 |
+
public:
|
| 1408 |
+
_CG_QUALIFIER operator thread_block_tile<Size, void>() const {
|
| 1409 |
+
return thread_block_tile<Size, void>(*this);
|
| 1410 |
+
}
|
| 1411 |
+
};
|
| 1412 |
+
|
| 1413 |
+
template <unsigned int Size>
|
| 1414 |
+
class thread_block_tile<Size, void> : public details::thread_block_tile_impl<Size, void, details::_is_multi_warp<Size>::value>
|
| 1415 |
+
{
|
| 1416 |
+
template <unsigned int, typename ParentT>
|
| 1417 |
+
friend class thread_block_tile;
|
| 1418 |
+
|
| 1419 |
+
protected:
|
| 1420 |
+
template <unsigned int OtherSize, typename OtherParentT>
|
| 1421 |
+
_CG_QUALIFIER thread_block_tile(const thread_block_tile<OtherSize, OtherParentT>& g) :
|
| 1422 |
+
details::thread_block_tile_impl<Size, void, details::_is_multi_warp<Size>::value>(g) {}
|
| 1423 |
+
|
| 1424 |
+
public:
|
| 1425 |
+
template <typename ParentT>
|
| 1426 |
+
_CG_QUALIFIER thread_block_tile(const thread_block_tile<Size, ParentT>& g) :
|
| 1427 |
+
details::thread_block_tile_impl<Size, void, details::_is_multi_warp<Size>::value>(g) {}
|
| 1428 |
+
};
|
| 1429 |
+
|
| 1430 |
+
namespace details {
|
| 1431 |
+
template <unsigned int Size, typename ParentT>
|
| 1432 |
+
struct tiled_partition_impl;
|
| 1433 |
+
|
| 1434 |
+
template <unsigned int Size>
|
| 1435 |
+
struct tiled_partition_impl<Size, thread_block> : public thread_block_tile<Size, thread_block> {
|
| 1436 |
+
_CG_QUALIFIER tiled_partition_impl(const thread_block& g) :
|
| 1437 |
+
thread_block_tile<Size, thread_block>(g) {}
|
| 1438 |
+
};
|
| 1439 |
+
|
| 1440 |
+
// ParentT = static thread_block_tile<ParentSize, GrandParent> specialization
|
| 1441 |
+
template <unsigned int Size, unsigned int ParentSize, typename GrandParent>
|
| 1442 |
+
struct tiled_partition_impl<Size, thread_block_tile<ParentSize, GrandParent> > :
|
| 1443 |
+
public thread_block_tile<Size, thread_block_tile<ParentSize, GrandParent> > {
|
| 1444 |
+
#ifdef _CG_CPP11_FEATURES
|
| 1445 |
+
static_assert(Size < ParentSize, "Tile size bigger or equal to the parent group size");
|
| 1446 |
+
#endif
|
| 1447 |
+
_CG_QUALIFIER tiled_partition_impl(const thread_block_tile<ParentSize, GrandParent>& g) :
|
| 1448 |
+
thread_block_tile<Size, thread_block_tile<ParentSize, GrandParent> >(g) {}
|
| 1449 |
+
};
|
| 1450 |
+
|
| 1451 |
+
}
|
| 1452 |
+
|
| 1453 |
+
template <unsigned int Size, typename ParentT>
|
| 1454 |
+
_CG_QUALIFIER thread_block_tile<Size, ParentT> tiled_partition(const ParentT& g)
|
| 1455 |
+
{
|
| 1456 |
+
return details::tiled_partition_impl<Size, ParentT>(g);
|
| 1457 |
+
}
|
| 1458 |
+
|
| 1459 |
+
/**
|
| 1460 |
+
* thread_group this_thread()
|
| 1461 |
+
*
|
| 1462 |
+
* Constructs a generic thread_group containing only the calling thread
|
| 1463 |
+
*/
|
| 1464 |
+
_CG_QUALIFIER thread_block_tile<1, void> this_thread()
|
| 1465 |
+
{
|
| 1466 |
+
// Make thread_block_tile<1, thread_block> parent of the returned group, so it will have its
|
| 1467 |
+
// meta group rank and size set to 0 and 1 respectively.
|
| 1468 |
+
return thread_block_tile<1, thread_block_tile<1, thread_block> >(this_thread_block());
|
| 1469 |
+
}
|
| 1470 |
+
|
| 1471 |
+
/**
|
| 1472 |
+
* <group_type>.sync()
|
| 1473 |
+
*
|
| 1474 |
+
* Executes a barrier across the group
|
| 1475 |
+
*
|
| 1476 |
+
* Implements both a compiler fence and an architectural fence to prevent,
|
| 1477 |
+
* memory reordering around the barrier.
|
| 1478 |
+
*/
|
| 1479 |
+
_CG_QUALIFIER void thread_group::sync() const
|
| 1480 |
+
{
|
| 1481 |
+
switch (_data.group.type) {
|
| 1482 |
+
case details::coalesced_group_id:
|
| 1483 |
+
cooperative_groups::sync(*static_cast<const coalesced_group*>(this));
|
| 1484 |
+
break;
|
| 1485 |
+
case details::thread_block_id:
|
| 1486 |
+
cooperative_groups::sync(*static_cast<const thread_block*>(this));
|
| 1487 |
+
break;
|
| 1488 |
+
case details::grid_group_id:
|
| 1489 |
+
cooperative_groups::sync(*static_cast<const grid_group*>(this));
|
| 1490 |
+
break;
|
| 1491 |
+
#if defined(_CG_HAS_CLUSTER_GROUP)
|
| 1492 |
+
case details::cluster_group_id:
|
| 1493 |
+
cooperative_groups::sync(*static_cast<const cluster_group*>(this));
|
| 1494 |
+
break;
|
| 1495 |
+
#endif
|
| 1496 |
+
default:
|
| 1497 |
+
break;
|
| 1498 |
+
}
|
| 1499 |
+
}
|
| 1500 |
+
|
| 1501 |
+
/**
|
| 1502 |
+
* <group_type>.size()
|
| 1503 |
+
*
|
| 1504 |
+
* Returns the total number of threads in the group.
|
| 1505 |
+
*/
|
| 1506 |
+
_CG_QUALIFIER unsigned long long thread_group::size() const
|
| 1507 |
+
{
|
| 1508 |
+
unsigned long long size = 0;
|
| 1509 |
+
switch (_data.group.type) {
|
| 1510 |
+
case details::coalesced_group_id:
|
| 1511 |
+
size = cooperative_groups::group_size(*static_cast<const coalesced_group*>(this));
|
| 1512 |
+
break;
|
| 1513 |
+
case details::thread_block_id:
|
| 1514 |
+
size = cooperative_groups::group_size(*static_cast<const thread_block*>(this));
|
| 1515 |
+
break;
|
| 1516 |
+
case details::grid_group_id:
|
| 1517 |
+
size = cooperative_groups::group_size(*static_cast<const grid_group*>(this));
|
| 1518 |
+
break;
|
| 1519 |
+
#if defined(_CG_HAS_CLUSTER_GROUP)
|
| 1520 |
+
case details::cluster_group_id:
|
| 1521 |
+
size = cooperative_groups::group_size(*static_cast<const cluster_group*>(this));
|
| 1522 |
+
break;
|
| 1523 |
+
#endif
|
| 1524 |
+
default:
|
| 1525 |
+
break;
|
| 1526 |
+
}
|
| 1527 |
+
return size;
|
| 1528 |
+
}
|
| 1529 |
+
|
| 1530 |
+
/**
|
| 1531 |
+
* <group_type>.thread_rank()
|
| 1532 |
+
*
|
| 1533 |
+
* Returns the linearized rank of the calling thread along the interval [0, size()).
|
| 1534 |
+
*/
|
| 1535 |
+
_CG_QUALIFIER unsigned long long thread_group::thread_rank() const
|
| 1536 |
+
{
|
| 1537 |
+
unsigned long long rank = 0;
|
| 1538 |
+
switch (_data.group.type) {
|
| 1539 |
+
case details::coalesced_group_id:
|
| 1540 |
+
rank = cooperative_groups::thread_rank(*static_cast<const coalesced_group*>(this));
|
| 1541 |
+
break;
|
| 1542 |
+
case details::thread_block_id:
|
| 1543 |
+
rank = cooperative_groups::thread_rank(*static_cast<const thread_block*>(this));
|
| 1544 |
+
break;
|
| 1545 |
+
case details::grid_group_id:
|
| 1546 |
+
rank = cooperative_groups::thread_rank(*static_cast<const grid_group*>(this));
|
| 1547 |
+
break;
|
| 1548 |
+
#if defined(_CG_HAS_CLUSTER_GROUP)
|
| 1549 |
+
case details::cluster_group_id:
|
| 1550 |
+
rank = cooperative_groups::thread_rank(*static_cast<const cluster_group*>(this));
|
| 1551 |
+
break;
|
| 1552 |
+
#endif
|
| 1553 |
+
default:
|
| 1554 |
+
break;
|
| 1555 |
+
}
|
| 1556 |
+
return rank;
|
| 1557 |
+
}
|
| 1558 |
+
|
| 1559 |
+
_CG_END_NAMESPACE
|
| 1560 |
+
|
| 1561 |
+
#include <cooperative_groups/details/partitioning.h>
|
| 1562 |
+
#if (!defined(_MSC_VER) || defined(_WIN64))
|
| 1563 |
+
# include <cooperative_groups/details/invoke.h>
|
| 1564 |
+
#endif
|
| 1565 |
+
|
| 1566 |
+
# endif /* ! (__cplusplus, __CUDACC__) */
|
| 1567 |
+
|
| 1568 |
+
#endif /* !_COOPERATIVE_GROUPS_H_ */
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/async.h
ADDED
|
@@ -0,0 +1,452 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _CG_ASYNC_H
|
| 50 |
+
#define _CG_ASYNC_H
|
| 51 |
+
|
| 52 |
+
#include "helpers.h"
|
| 53 |
+
#include "info.h"
|
| 54 |
+
|
| 55 |
+
#include <cuda_pipeline.h>
|
| 56 |
+
|
| 57 |
+
_CG_BEGIN_NAMESPACE
|
| 58 |
+
|
| 59 |
+
namespace details {
|
| 60 |
+
// Groups supported by memcpy_async
|
| 61 |
+
template <class TyGroup>
|
| 62 |
+
struct _async_copy_group_supported : public _CG_STL_NAMESPACE::false_type {};
|
| 63 |
+
|
| 64 |
+
template <unsigned int Sz, typename TyPar>
|
| 65 |
+
struct _async_copy_group_supported<cooperative_groups::thread_block_tile<Sz, TyPar>>
|
| 66 |
+
: public _CG_STL_NAMESPACE::true_type {};
|
| 67 |
+
template <>
|
| 68 |
+
struct _async_copy_group_supported<cooperative_groups::coalesced_group> : public _CG_STL_NAMESPACE::true_type {};
|
| 69 |
+
template <>
|
| 70 |
+
struct _async_copy_group_supported<cooperative_groups::thread_block> : public _CG_STL_NAMESPACE::true_type {};
|
| 71 |
+
|
| 72 |
+
template <class TyGroup>
|
| 73 |
+
using async_copy_group_supported = _async_copy_group_supported<details::remove_qual<TyGroup>>;
|
| 74 |
+
|
| 75 |
+
// Groups that require optimization
|
| 76 |
+
template <class TyGroup>
|
| 77 |
+
struct _async_copy_optimize_tile : public _CG_STL_NAMESPACE::false_type {};
|
| 78 |
+
|
| 79 |
+
template <typename TyPar>
|
| 80 |
+
struct _async_copy_optimize_tile<cooperative_groups::thread_block_tile<1, TyPar>>
|
| 81 |
+
: public _CG_STL_NAMESPACE::false_type {};
|
| 82 |
+
|
| 83 |
+
template <unsigned int Sz, typename TyPar>
|
| 84 |
+
struct _async_copy_optimize_tile<cooperative_groups::thread_block_tile<Sz, TyPar>>
|
| 85 |
+
: public _CG_STL_NAMESPACE::true_type {};
|
| 86 |
+
|
| 87 |
+
template <class TyGroup>
|
| 88 |
+
using async_copy_optimize_tile = _async_copy_optimize_tile<details::remove_qual<TyGroup>>;
|
| 89 |
+
|
| 90 |
+
// SFINAE helpers for tile optimizations
|
| 91 |
+
template <class TyGroup>
|
| 92 |
+
using enable_tile_optimization =
|
| 93 |
+
typename _CG_STL_NAMESPACE::enable_if<async_copy_optimize_tile<TyGroup>::value, void *>::type;
|
| 94 |
+
|
| 95 |
+
template <class TyGroup>
|
| 96 |
+
using disable_tile_optimization =
|
| 97 |
+
typename _CG_STL_NAMESPACE::enable_if<!async_copy_optimize_tile<TyGroup>::value, void *>::type;
|
| 98 |
+
|
| 99 |
+
// Segment for punning to aligned types
|
| 100 |
+
template <unsigned int N>
|
| 101 |
+
struct _Segment {
|
| 102 |
+
int _seg[N];
|
| 103 |
+
};
|
| 104 |
+
|
| 105 |
+
// Trivial layout guaranteed-aligned copy-async compatible segments
|
| 106 |
+
template <unsigned int N>
|
| 107 |
+
struct Segment;
|
| 108 |
+
template <>
|
| 109 |
+
struct __align__(4) Segment<1> : public _Segment<1>{};
|
| 110 |
+
template <>
|
| 111 |
+
struct __align__(8) Segment<2> : public _Segment<2>{};
|
| 112 |
+
template <>
|
| 113 |
+
struct __align__(16) Segment<4> : public _Segment<4>{};
|
| 114 |
+
|
| 115 |
+
// Interleaved element by element copies from source to dest
|
| 116 |
+
template <typename TyGroup, typename TyElem>
|
| 117 |
+
_CG_STATIC_QUALIFIER void inline_copy(TyGroup &group, TyElem *__restrict__ dst, const TyElem *__restrict__ src,
|
| 118 |
+
size_t count) {
|
| 119 |
+
const unsigned int rank = group.thread_rank();
|
| 120 |
+
const unsigned int stride = group.size();
|
| 121 |
+
|
| 122 |
+
for (size_t idx = rank; idx < count; idx += stride) {
|
| 123 |
+
dst[idx] = src[idx];
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
template <typename TyGroup, typename TyElem, enable_tile_optimization<TyGroup> = nullptr>
|
| 128 |
+
_CG_STATIC_QUALIFIER void accelerated_async_copy(TyGroup &group, TyElem *__restrict__ dst,
|
| 129 |
+
const TyElem *__restrict__ src, size_t count) {
|
| 130 |
+
static_assert(async_copy_group_supported<TyGroup>::value,
|
| 131 |
+
"Async copy is only supported for groups that represent private shared memory");
|
| 132 |
+
|
| 133 |
+
if (count == 0) {
|
| 134 |
+
return;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
const bool dstIsNotShared = !__isShared(dst);
|
| 138 |
+
const bool srcIsNotGlobal = !__isGlobal(src);
|
| 139 |
+
|
| 140 |
+
if (dstIsNotShared || srcIsNotGlobal) {
|
| 141 |
+
inline_copy(group, dst, src, count);
|
| 142 |
+
return;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
const unsigned int stride = group.size();
|
| 146 |
+
const unsigned int rank = group.thread_rank();
|
| 147 |
+
// Efficient copies require warps to operate on the same amount of work at each step.
|
| 148 |
+
// remainders are handled in a separate stage to prevent branching
|
| 149 |
+
const unsigned int subWarpMask = (stride - 1);
|
| 150 |
+
const unsigned int subwarpCopies = (subWarpMask & (unsigned int)count);
|
| 151 |
+
const unsigned int maxSubwarpRank = min(rank, subwarpCopies - 1);
|
| 152 |
+
|
| 153 |
+
const size_t warpCopies = (count & (~subWarpMask));
|
| 154 |
+
|
| 155 |
+
for (size_t idx = 0; idx < warpCopies; idx += stride) {
|
| 156 |
+
size_t _srcIdx = rank + idx;
|
| 157 |
+
size_t _dstIdx = rank + idx;
|
| 158 |
+
__pipeline_memcpy_async(dst + _dstIdx, src + _srcIdx, sizeof(TyElem));
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
if (subwarpCopies) {
|
| 162 |
+
size_t _srcIdx = warpCopies + maxSubwarpRank;
|
| 163 |
+
size_t _dstIdx = warpCopies + maxSubwarpRank;
|
| 164 |
+
__pipeline_memcpy_async(dst + _dstIdx, src + _srcIdx, sizeof(TyElem));
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
template <typename TyGroup, typename TyElem, disable_tile_optimization<TyGroup> = nullptr>
|
| 169 |
+
_CG_STATIC_QUALIFIER void accelerated_async_copy(TyGroup &group, TyElem *__restrict__ dst,
|
| 170 |
+
const TyElem *__restrict__ src, size_t count) {
|
| 171 |
+
static_assert(async_copy_group_supported<TyGroup>::value,
|
| 172 |
+
"Async copy is only supported for groups that represent private shared memory");
|
| 173 |
+
|
| 174 |
+
const bool dstIsNotShared = !__isShared(dst);
|
| 175 |
+
const bool srcIsNotGlobal = !__isGlobal(src);
|
| 176 |
+
|
| 177 |
+
if (dstIsNotShared || srcIsNotGlobal) {
|
| 178 |
+
inline_copy(group, dst, src, count);
|
| 179 |
+
return;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
unsigned int stride = group.size();
|
| 183 |
+
unsigned int rank = group.thread_rank();
|
| 184 |
+
|
| 185 |
+
for (size_t idx = rank; idx < count; idx += stride) {
|
| 186 |
+
size_t _srcIdx = idx;
|
| 187 |
+
size_t _dstIdx = idx;
|
| 188 |
+
__pipeline_memcpy_async(dst + _dstIdx, src + _srcIdx, sizeof(TyElem));
|
| 189 |
+
}
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
// Determine best possible alignment given an input and initial conditions
|
| 193 |
+
// Attempts to generate as little code as possible, most likely should only be used with 1 and 2 byte alignments
|
| 194 |
+
template <unsigned int MinAlignment, unsigned int MaxAlignment>
|
| 195 |
+
_CG_STATIC_QUALIFIER uint32_t find_best_alignment(void *__restrict__ dst, const void *__restrict__ src) {
|
| 196 |
+
// Narrowing conversion intentional
|
| 197 |
+
uint32_t base1 = (uint32_t) reinterpret_cast<uintptr_t>(src);
|
| 198 |
+
uint32_t base2 = (uint32_t) reinterpret_cast<uintptr_t>(dst);
|
| 199 |
+
|
| 200 |
+
uint32_t diff = ((base1) ^ (base2)) & (MaxAlignment - 1);
|
| 201 |
+
|
| 202 |
+
// range [MaxAlignment, alignof(elem)], step: x >> 1
|
| 203 |
+
// over range of possible alignments, choose best available out of range
|
| 204 |
+
uint32_t out = MaxAlignment;
|
| 205 |
+
#pragma unroll
|
| 206 |
+
for (uint32_t alignment = (MaxAlignment >> 1); alignment >= MinAlignment; alignment >>= 1) {
|
| 207 |
+
if (alignment & diff)
|
| 208 |
+
out = alignment;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
return out;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
// Determine best possible alignment given an input and initial conditions
|
| 215 |
+
// Attempts to generate as little code as possible, most likely should only be used with 1 and 2 byte alignments
|
| 216 |
+
template <typename TyType, typename TyGroup>
|
| 217 |
+
_CG_STATIC_QUALIFIER void copy_like(const TyGroup &group, void *__restrict__ _dst, const void *__restrict__ _src,
|
| 218 |
+
size_t count) {
|
| 219 |
+
const char *src = reinterpret_cast<const char *>(_src);
|
| 220 |
+
char *dst = reinterpret_cast<char *>(_dst);
|
| 221 |
+
|
| 222 |
+
constexpr uint32_t targetAlignment = (uint32_t)alignof(TyType);
|
| 223 |
+
|
| 224 |
+
uint32_t base = (uint32_t) reinterpret_cast<uintptr_t>(src);
|
| 225 |
+
uint32_t alignOffset = ((~base) + 1) & (targetAlignment - 1);
|
| 226 |
+
|
| 227 |
+
inline_copy(group, dst, src, alignOffset);
|
| 228 |
+
count -= alignOffset;
|
| 229 |
+
src += alignOffset;
|
| 230 |
+
dst += alignOffset;
|
| 231 |
+
|
| 232 |
+
// Copy using the best available alignment, async_copy expects n-datums, not bytes
|
| 233 |
+
size_t asyncCount = count / sizeof(TyType);
|
| 234 |
+
accelerated_async_copy(group, reinterpret_cast<TyType *>(dst), reinterpret_cast<const TyType *>(src), asyncCount);
|
| 235 |
+
asyncCount *= sizeof(TyType);
|
| 236 |
+
|
| 237 |
+
count -= asyncCount;
|
| 238 |
+
src += asyncCount;
|
| 239 |
+
dst += asyncCount;
|
| 240 |
+
inline_copy(group, dst, src, count);
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
// We must determine alignment and manually align src/dst ourselves
|
| 244 |
+
template <size_t AlignHint>
|
| 245 |
+
struct _memcpy_async_align_dispatch {
|
| 246 |
+
template <typename TyGroup>
|
| 247 |
+
_CG_STATIC_QUALIFIER void copy(TyGroup &group, void *__restrict__ dst, const void *__restrict__ src, size_t count) {
|
| 248 |
+
uint32_t alignment = find_best_alignment<AlignHint, 16>(dst, src);
|
| 249 |
+
|
| 250 |
+
// Avoid copying the extra bytes if desired copy count is smaller
|
| 251 |
+
alignment = count < alignment ? AlignHint : alignment;
|
| 252 |
+
|
| 253 |
+
switch (alignment) {
|
| 254 |
+
default:
|
| 255 |
+
case 1:
|
| 256 |
+
inline_copy(group, reinterpret_cast<char *>(dst), reinterpret_cast<const char *>(src), count);
|
| 257 |
+
break;
|
| 258 |
+
case 2:
|
| 259 |
+
inline_copy(group, reinterpret_cast<short *>(dst), reinterpret_cast<const short *>(src), count >> 1);
|
| 260 |
+
break;
|
| 261 |
+
case 4:
|
| 262 |
+
copy_like<Segment<1>>(group, dst, src, count);
|
| 263 |
+
break;
|
| 264 |
+
case 8:
|
| 265 |
+
copy_like<Segment<2>>(group, dst, src, count);
|
| 266 |
+
break;
|
| 267 |
+
case 16:
|
| 268 |
+
copy_like<Segment<4>>(group, dst, src, count);
|
| 269 |
+
break;
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
};
|
| 273 |
+
|
| 274 |
+
// Specialization for 4 byte alignments
|
| 275 |
+
template <>
|
| 276 |
+
struct _memcpy_async_align_dispatch<4> {
|
| 277 |
+
template <typename TyGroup>
|
| 278 |
+
_CG_STATIC_QUALIFIER void copy(TyGroup &group, void *__restrict__ _dst, const void *__restrict__ _src,
|
| 279 |
+
size_t count) {
|
| 280 |
+
const Segment<1> *src = reinterpret_cast<const Segment<1> *>(_src);
|
| 281 |
+
Segment<1> *dst = reinterpret_cast<Segment<1> *>(_dst);
|
| 282 |
+
|
| 283 |
+
// Dispatch straight to aligned LDGSTS calls
|
| 284 |
+
accelerated_async_copy(group, dst, src, count / sizeof(*dst));
|
| 285 |
+
}
|
| 286 |
+
};
|
| 287 |
+
|
| 288 |
+
// Specialization for 8 byte alignments
|
| 289 |
+
template <>
|
| 290 |
+
struct _memcpy_async_align_dispatch<8> {
|
| 291 |
+
template <typename TyGroup>
|
| 292 |
+
_CG_STATIC_QUALIFIER void copy(TyGroup &group, void *__restrict__ _dst, const void *__restrict__ _src,
|
| 293 |
+
size_t count) {
|
| 294 |
+
const Segment<2> *src = reinterpret_cast<const Segment<2> *>(_src);
|
| 295 |
+
Segment<2> *dst = reinterpret_cast<Segment<2> *>(_dst);
|
| 296 |
+
|
| 297 |
+
// Dispatch straight to aligned LDGSTS calls
|
| 298 |
+
accelerated_async_copy(group, dst, src, count / sizeof(*dst));
|
| 299 |
+
}
|
| 300 |
+
};
|
| 301 |
+
|
| 302 |
+
// Alignments over 16 are truncated to 16 and bypass alignment
|
| 303 |
+
// This is the highest performing memcpy available
|
| 304 |
+
template <>
|
| 305 |
+
struct _memcpy_async_align_dispatch<16> {
|
| 306 |
+
template <typename TyGroup>
|
| 307 |
+
_CG_STATIC_QUALIFIER void copy(TyGroup &group, void *__restrict__ _dst, const void *__restrict__ _src,
|
| 308 |
+
size_t count) {
|
| 309 |
+
const Segment<4> *src = reinterpret_cast<const Segment<4> *>(_src);
|
| 310 |
+
Segment<4> *dst = reinterpret_cast<Segment<4> *>(_dst);
|
| 311 |
+
|
| 312 |
+
// Dispatch straight to aligned LDGSTS calls
|
| 313 |
+
accelerated_async_copy(group, dst, src, count / sizeof(*dst));
|
| 314 |
+
}
|
| 315 |
+
};
|
| 316 |
+
|
| 317 |
+
// byte-wide API
|
| 318 |
+
template <size_t Alignment, class TyGroup>
|
| 319 |
+
_CG_STATIC_QUALIFIER void _memcpy_async_dispatch_to_aligned_copy(const TyGroup &group, void *__restrict__ _dst,
|
| 320 |
+
const void *__restrict__ _src, size_t count) {
|
| 321 |
+
static_assert(!(Alignment & (Alignment - 1)), "Known static alignment dispatch must be a power of 2");
|
| 322 |
+
details::_memcpy_async_align_dispatch<Alignment>::copy(group, _dst, _src, count);
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
// Internal dispatch APIs
|
| 326 |
+
// These deduce the alignments and sizes necessary to invoke the underlying copy engine
|
| 327 |
+
template <typename Ty>
|
| 328 |
+
using is_void = _CG_STL_NAMESPACE::is_same<Ty, void>;
|
| 329 |
+
|
| 330 |
+
template <typename Ty>
|
| 331 |
+
using enable_if_not_void = typename _CG_STL_NAMESPACE::enable_if<!is_void<Ty>::value, void *>::type;
|
| 332 |
+
|
| 333 |
+
template <typename Ty>
|
| 334 |
+
using enable_if_void = typename _CG_STL_NAMESPACE::enable_if<is_void<Ty>::value, void *>::type;
|
| 335 |
+
|
| 336 |
+
template <typename Ty>
|
| 337 |
+
using enable_if_integral =
|
| 338 |
+
typename _CG_STL_NAMESPACE::enable_if<_CG_STL_NAMESPACE::is_integral<Ty>::value, void *>::type;
|
| 339 |
+
|
| 340 |
+
// byte-wide API using aligned_sized_t
|
| 341 |
+
template <class TyGroup, template <size_t> typename Alignment, size_t Hint>
|
| 342 |
+
_CG_STATIC_QUALIFIER void _memcpy_async_bytes(const TyGroup &group, void *__restrict__ _dst,
|
| 343 |
+
const void *__restrict__ _src, const Alignment<Hint> &count) {
|
| 344 |
+
constexpr size_t _align = (Hint > 16) ? 16 : Hint;
|
| 345 |
+
|
| 346 |
+
details::_memcpy_async_dispatch_to_aligned_copy<_align>(group, _dst, _src, (size_t)count);
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
// byte-wide API using type for aligment
|
| 350 |
+
template <class TyGroup, typename TyElem, typename TySize, size_t Hint = alignof(TyElem),
|
| 351 |
+
enable_if_not_void<TyElem> = nullptr, enable_if_integral<TySize> = nullptr>
|
| 352 |
+
_CG_STATIC_QUALIFIER void _memcpy_async_bytes(const TyGroup &group, TyElem *__restrict__ _dst,
|
| 353 |
+
const TyElem *__restrict__ _src, const TySize& count) {
|
| 354 |
+
constexpr size_t _align = (Hint > 16) ? 16 : Hint;
|
| 355 |
+
|
| 356 |
+
details::_memcpy_async_dispatch_to_aligned_copy<_align>(group, _dst, _src, count);
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
// byte-wide API with full alignment deduction required
|
| 360 |
+
template <class TyGroup, typename TyElem, typename TySize, enable_if_void<TyElem> = nullptr,
|
| 361 |
+
enable_if_integral<TySize> = nullptr>
|
| 362 |
+
_CG_STATIC_QUALIFIER void _memcpy_async_bytes(const TyGroup &group, TyElem *__restrict__ _dst,
|
| 363 |
+
const TyElem *__restrict__ _src, const TySize& count) {
|
| 364 |
+
details::_memcpy_async_dispatch_to_aligned_copy<1>(group, _dst, _src, count);
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
// 1d-datum API
|
| 368 |
+
template <class TyGroup, typename TyElem, size_t Hint = alignof(TyElem)>
|
| 369 |
+
_CG_STATIC_QUALIFIER void _memcpy_async_datum(const TyGroup &group, TyElem *__restrict__ dst, const size_t dstCount,
|
| 370 |
+
const TyElem *__restrict__ src, const size_t srcCount) {
|
| 371 |
+
constexpr unsigned int _align = Hint;
|
| 372 |
+
const size_t totalCount = min(dstCount, srcCount) * sizeof(TyElem);
|
| 373 |
+
|
| 374 |
+
details::_memcpy_async_dispatch_to_aligned_copy<_align>(group, dst, src, totalCount);
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
// 1d-datum API using aligned_size_t
|
| 378 |
+
template <class TyGroup, typename TyElem, template <size_t> typename Alignment, size_t Hint>
|
| 379 |
+
_CG_STATIC_QUALIFIER void _memcpy_async_datum(const TyGroup &group, TyElem *__restrict__ dst, const Alignment<Hint> &dstCount,
|
| 380 |
+
const TyElem *__restrict__ src, const Alignment<Hint> &srcCount) {
|
| 381 |
+
constexpr unsigned int _align = Hint;
|
| 382 |
+
const size_t totalCount = min((size_t)dstCount, (size_t)srcCount) * sizeof(TyElem);
|
| 383 |
+
|
| 384 |
+
details::_memcpy_async_dispatch_to_aligned_copy<_align>(group, dst, src, totalCount);
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
} // namespace details
|
| 388 |
+
|
| 389 |
+
/*
|
| 390 |
+
* Group submit batch of async-copy to cover contiguous 1D array
|
| 391 |
+
* and commit that batch to eventually wait for completion.
|
| 392 |
+
*/
|
| 393 |
+
template <class TyGroup, typename TyElem, typename TySizeT>
|
| 394 |
+
_CG_STATIC_QUALIFIER void memcpy_async(const TyGroup &group, TyElem *__restrict__ _dst, const TyElem *__restrict__ _src,
|
| 395 |
+
const TySizeT &count) {
|
| 396 |
+
details::_memcpy_async_bytes(group, _dst, _src, count);
|
| 397 |
+
__pipeline_commit();
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
/*
|
| 401 |
+
* Group submit batch of async-copy to cover contiguous 1D array
|
| 402 |
+
* and commit that batch to eventually wait for completion.
|
| 403 |
+
* Object counts are in datum sized chunks, not bytes.
|
| 404 |
+
*/
|
| 405 |
+
template <class TyGroup, class TyElem, typename DstLayout, typename SrcLayout>
|
| 406 |
+
_CG_STATIC_QUALIFIER void memcpy_async(const TyGroup &group, TyElem *__restrict__ dst, const DstLayout &dstLayout,
|
| 407 |
+
const TyElem *__restrict__ src, const SrcLayout &srcLayout) {
|
| 408 |
+
details::_memcpy_async_datum(group, dst, dstLayout, src, srcLayout);
|
| 409 |
+
__pipeline_commit();
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
/* Group wait for prior Nth stage of memcpy_async to complete. */
|
| 413 |
+
template <unsigned int Stage, class TyGroup>
|
| 414 |
+
_CG_STATIC_QUALIFIER void wait_prior(const TyGroup &group) {
|
| 415 |
+
__pipeline_wait_prior(Stage);
|
| 416 |
+
group.sync();
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
/* Group wait all previously submitted memcpy_async to complete. */
|
| 420 |
+
template <class TyGroup>
|
| 421 |
+
_CG_STATIC_QUALIFIER void wait(const TyGroup &group) {
|
| 422 |
+
__pipeline_wait_prior(0);
|
| 423 |
+
group.sync();
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
/***************** CG APIs including pipeline are deprecated *****************/
|
| 427 |
+
|
| 428 |
+
/* Group submit batch of async-copy to cover of contiguous 1D array
|
| 429 |
+
to a pipeline and commit the batch*/
|
| 430 |
+
template <class TyGroup, class TyElem>
|
| 431 |
+
_CG_DEPRECATED _CG_STATIC_QUALIFIER void memcpy_async(TyGroup &group, TyElem *dst, size_t dstCount, const TyElem *src, size_t srcCount,
|
| 432 |
+
nvcuda::experimental::pipeline &pipe) {
|
| 433 |
+
details::_memcpy_async_datum(group, dst, dstCount, src, srcCount);
|
| 434 |
+
pipe.commit();
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
/* Group wait for prior Nth stage of memcpy_async to complete. */
|
| 438 |
+
template <unsigned int Stage, class TyGroup>
|
| 439 |
+
_CG_DEPRECATED _CG_STATIC_QUALIFIER void wait_prior(TyGroup &group, nvcuda::experimental::pipeline &pipe) {
|
| 440 |
+
pipe.wait_prior<Stage>();
|
| 441 |
+
group.sync();
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
/* Group wait for stage-S of memcpy_async to complete. */
|
| 445 |
+
template <class TyGroup>
|
| 446 |
+
_CG_DEPRECATED _CG_STATIC_QUALIFIER void wait(TyGroup &group, nvcuda::experimental::pipeline &pipe, size_t stage) {
|
| 447 |
+
pipe.wait(stage);
|
| 448 |
+
group.sync();
|
| 449 |
+
}
|
| 450 |
+
_CG_END_NAMESPACE
|
| 451 |
+
|
| 452 |
+
#endif // _CG_ASYNC_H
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/coalesced_reduce.h
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _CG_COALESCED_REDUCE_H_
|
| 50 |
+
#define _CG_COALESCED_REDUCE_H_
|
| 51 |
+
|
| 52 |
+
#include "info.h"
|
| 53 |
+
#include "helpers.h"
|
| 54 |
+
#include "cooperative_groups.h"
|
| 55 |
+
#include "partitioning.h"
|
| 56 |
+
#include "coalesced_scan.h"
|
| 57 |
+
|
| 58 |
+
_CG_BEGIN_NAMESPACE
|
| 59 |
+
|
| 60 |
+
namespace details {
|
| 61 |
+
|
| 62 |
+
template <typename TyVal, typename TyOp, unsigned int TySize, typename ParentT>
|
| 63 |
+
_CG_QUALIFIER auto coalesced_reduce(const __single_warp_thread_block_tile<TySize, ParentT>& group,
|
| 64 |
+
TyVal&& val,
|
| 65 |
+
TyOp&& op) -> decltype(op(val, val)) {
|
| 66 |
+
auto out = val;
|
| 67 |
+
for (int mask = TySize >> 1; mask > 0; mask >>= 1) {
|
| 68 |
+
out = op(out, group.shfl_xor(out, mask));
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
return out;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
template <typename TyVal, typename TyOp>
|
| 75 |
+
_CG_QUALIFIER auto coalesced_reduce(const coalesced_group& group, TyVal&& val, TyOp&& op) -> decltype(op(val, val)) {
|
| 76 |
+
if (group.size() == 32) {
|
| 77 |
+
// Full coalesced group can go through faster path by being treated as a tile of size 32
|
| 78 |
+
auto tile = details::tiled_partition_internal<32, void>();
|
| 79 |
+
return coalesced_reduce(tile, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp>(op));
|
| 80 |
+
}
|
| 81 |
+
else {
|
| 82 |
+
auto scan_result =
|
| 83 |
+
inclusive_scan_non_contiguous(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp>(op));
|
| 84 |
+
unsigned int group_mask = _coalesced_group_data_access::get_mask(group);
|
| 85 |
+
unsigned int last_thread_id = 31 - __clz(group_mask);
|
| 86 |
+
return details::tile::shuffle_dispatch<TyVal>::shfl(
|
| 87 |
+
_CG_STL_NAMESPACE::forward<TyVal>(scan_result), group_mask, last_thread_id, 32);
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
} // details
|
| 92 |
+
|
| 93 |
+
_CG_END_NAMESPACE
|
| 94 |
+
|
| 95 |
+
#endif // _CG_COALESCED_REDUCE_H_
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/coalesced_scan.h
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _CG_COALESCED_SCAN_H_
|
| 50 |
+
#define _CG_COALESCED_SCAN_H_
|
| 51 |
+
|
| 52 |
+
#include "info.h"
|
| 53 |
+
#include "helpers.h"
|
| 54 |
+
#include "cooperative_groups.h"
|
| 55 |
+
#include "partitioning.h"
|
| 56 |
+
#include "functional.h"
|
| 57 |
+
|
| 58 |
+
_CG_BEGIN_NAMESPACE
|
| 59 |
+
|
| 60 |
+
namespace details {
|
| 61 |
+
|
| 62 |
+
template <typename TyGroup, typename TyVal, typename TyOp>
|
| 63 |
+
_CG_QUALIFIER auto inclusive_scan_contiguous(const TyGroup& group, TyVal&& val, TyOp&& op) -> decltype(op(val, val)) {
|
| 64 |
+
auto out = val;
|
| 65 |
+
for (int mask = 1; mask < group.size(); mask <<= 1) {
|
| 66 |
+
auto tmp = group.shfl_up(out, mask);
|
| 67 |
+
if (mask <= group.thread_rank()) {
|
| 68 |
+
out = op(out, tmp);
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
return out;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
template <typename TyGroup, typename TyVal, typename TyOp>
|
| 76 |
+
_CG_QUALIFIER auto inclusive_scan_non_contiguous(const TyGroup& group, TyVal&& val, TyOp&& op) -> decltype(op(val, val)) {
|
| 77 |
+
const unsigned int groupSize = group.size();
|
| 78 |
+
auto out = val;
|
| 79 |
+
|
| 80 |
+
const unsigned int mask = details::_coalesced_group_data_access::get_mask(group);
|
| 81 |
+
unsigned int lanemask = details::lanemask32_lt() & mask;
|
| 82 |
+
unsigned int srcLane = details::laneid();
|
| 83 |
+
|
| 84 |
+
const unsigned int base = __ffs(mask)-1; /* lane with rank == 0 */
|
| 85 |
+
const unsigned int rank = __popc(lanemask);
|
| 86 |
+
|
| 87 |
+
for (unsigned int i = 1, j = 1; i < groupSize; i <<= 1) {
|
| 88 |
+
if (i <= rank) {
|
| 89 |
+
srcLane -= j;
|
| 90 |
+
j = i; /* maximum possible lane */
|
| 91 |
+
|
| 92 |
+
unsigned int begLane = base + rank - i; /* minimum possible lane */
|
| 93 |
+
|
| 94 |
+
/* Next source lane is in the range [ begLane .. srcLane ]
|
| 95 |
+
* If begLane < srcLane then do a binary search.
|
| 96 |
+
*/
|
| 97 |
+
while (begLane < srcLane) {
|
| 98 |
+
const unsigned int halfLane = (begLane + srcLane) >> 1;
|
| 99 |
+
const unsigned int halfMask = lanemask >> halfLane;
|
| 100 |
+
const unsigned int d = __popc(halfMask);
|
| 101 |
+
if (d < i) {
|
| 102 |
+
srcLane = halfLane - 1; /* halfLane too large */
|
| 103 |
+
}
|
| 104 |
+
else if ((i < d) || !(halfMask & 0x01)) {
|
| 105 |
+
begLane = halfLane + 1; /* halfLane too small */
|
| 106 |
+
}
|
| 107 |
+
else {
|
| 108 |
+
begLane = srcLane = halfLane; /* happen to hit */
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
auto tmp = details::tile::shuffle_dispatch<TyVal>::shfl(out, mask, srcLane, 32);
|
| 114 |
+
if (i <= rank) {
|
| 115 |
+
out = op(out, tmp);
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
return out;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
template <unsigned int TySize, typename ParentT, typename TyVal, typename TyOp>
|
| 122 |
+
_CG_QUALIFIER auto coalesced_inclusive_scan(const __single_warp_thread_block_tile<TySize, ParentT>& group,
|
| 123 |
+
TyVal&& val,
|
| 124 |
+
TyOp&& op) -> decltype(op(val, val)) {
|
| 125 |
+
return inclusive_scan_contiguous(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp>(op));
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
template <typename TyVal, typename TyOp>
|
| 129 |
+
_CG_QUALIFIER auto coalesced_inclusive_scan(const coalesced_group& group, TyVal&& val, TyOp&& op) -> decltype(op(val, val)) {
|
| 130 |
+
if (group.size() == 32) {
|
| 131 |
+
return inclusive_scan_contiguous(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp>(op));
|
| 132 |
+
}
|
| 133 |
+
else {
|
| 134 |
+
return inclusive_scan_non_contiguous(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp>(op));
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
template <bool IntegralOptimized>
|
| 139 |
+
struct scan_choose_convertion;
|
| 140 |
+
|
| 141 |
+
template<>
|
| 142 |
+
struct scan_choose_convertion<true> {
|
| 143 |
+
template <typename TyGroup, typename TyRes, typename TyVal>
|
| 144 |
+
_CG_STATIC_QUALIFIER details::remove_qual<TyVal> convert_inclusive_to_exclusive(const TyGroup& group, TyRes& result, TyVal&& val) {
|
| 145 |
+
return result - val;
|
| 146 |
+
}
|
| 147 |
+
};
|
| 148 |
+
|
| 149 |
+
template<>
|
| 150 |
+
struct scan_choose_convertion<false> {
|
| 151 |
+
template <typename TyGroup, typename TyRes, typename TyVal>
|
| 152 |
+
_CG_STATIC_QUALIFIER details::remove_qual<TyVal> convert_inclusive_to_exclusive(const TyGroup& group, TyRes& result, TyVal&& val) {
|
| 153 |
+
auto ret = group.shfl_up(result, 1);
|
| 154 |
+
if (group.thread_rank() == 0) {
|
| 155 |
+
return {};
|
| 156 |
+
}
|
| 157 |
+
else {
|
| 158 |
+
return ret;
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
};
|
| 162 |
+
|
| 163 |
+
template <typename TyGroup, typename TyRes, typename TyVal, typename TyFn>
|
| 164 |
+
_CG_QUALIFIER auto convert_inclusive_to_exclusive(const TyGroup& group, TyRes& result, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 165 |
+
using conversion = scan_choose_convertion<_CG_STL_NAMESPACE::is_same<remove_qual<TyFn>, cooperative_groups::plus<remove_qual<TyVal>>>::value
|
| 166 |
+
&& _CG_STL_NAMESPACE::is_integral<remove_qual<TyVal>>::value>;
|
| 167 |
+
return conversion::convert_inclusive_to_exclusive(group, result, _CG_STL_NAMESPACE::forward<TyVal>(val));
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
} // details
|
| 171 |
+
|
| 172 |
+
_CG_END_NAMESPACE
|
| 173 |
+
|
| 174 |
+
#endif // _CG_COALESCED_SCAN_H_
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/driver_abi.h
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _CG_DRIVER_API_H
|
| 50 |
+
#define _CG_DRIVER_API_H
|
| 51 |
+
|
| 52 |
+
#include "info.h"
|
| 53 |
+
|
| 54 |
+
_CG_BEGIN_NAMESPACE
|
| 55 |
+
|
| 56 |
+
namespace details {
|
| 57 |
+
template <unsigned int RegId>
|
| 58 |
+
_CG_QUALIFIER unsigned int load_env_reg() {
|
| 59 |
+
// Abort by default
|
| 60 |
+
_CG_ABORT();
|
| 61 |
+
return 0;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
template <unsigned int HiReg, unsigned int LoReg>
|
| 65 |
+
_CG_QUALIFIER unsigned long long load_env_reg64() {
|
| 66 |
+
unsigned long long registerLo = load_env_reg<LoReg>();
|
| 67 |
+
unsigned long long registerHi = load_env_reg<HiReg>();
|
| 68 |
+
|
| 69 |
+
return (registerHi << 32) | registerLo;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
// inline PTX for accessing registers requires an immediate for the special reg
|
| 73 |
+
# define LOAD_ENVREG(NUMBER) \
|
| 74 |
+
template <> _CG_QUALIFIER unsigned int load_env_reg<NUMBER>() { \
|
| 75 |
+
unsigned int r; \
|
| 76 |
+
asm ("mov.u32 %0, %%envreg" #NUMBER ";" : "=r"(r)); \
|
| 77 |
+
return r; \
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// Instantiate loaders for registers used
|
| 81 |
+
LOAD_ENVREG(0);
|
| 82 |
+
LOAD_ENVREG(1);
|
| 83 |
+
LOAD_ENVREG(2);
|
| 84 |
+
# undef LOAD_ENVREG
|
| 85 |
+
|
| 86 |
+
struct grid_workspace {
|
| 87 |
+
unsigned int wsSize;
|
| 88 |
+
unsigned int barrier;
|
| 89 |
+
};
|
| 90 |
+
|
| 91 |
+
_CG_QUALIFIER grid_workspace* get_grid_workspace() {
|
| 92 |
+
unsigned long long gridWsAbiAddress = load_env_reg64<1, 2>();
|
| 93 |
+
// Interpret the address from envreg 1 and 2 as the driver's grid workspace
|
| 94 |
+
return (reinterpret_cast<grid_workspace*>(gridWsAbiAddress));
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
_CG_END_NAMESPACE
|
| 98 |
+
|
| 99 |
+
#endif // _CG_DRIVER_API_H
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/functional.h
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _CG_FUNCTIONAL_H
|
| 50 |
+
#define _CG_FUNCTIONAL_H
|
| 51 |
+
|
| 52 |
+
#include "info.h"
|
| 53 |
+
#include "helpers.h"
|
| 54 |
+
|
| 55 |
+
#ifdef _CG_CPP11_FEATURES
|
| 56 |
+
#ifdef _CG_USE_CUDA_STL
|
| 57 |
+
# include <cuda/std/functional>
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
_CG_BEGIN_NAMESPACE
|
| 61 |
+
|
| 62 |
+
namespace details {
|
| 63 |
+
#ifdef _CG_USE_CUDA_STL
|
| 64 |
+
using cuda::std::plus;
|
| 65 |
+
using cuda::std::bit_and;
|
| 66 |
+
using cuda::std::bit_xor;
|
| 67 |
+
using cuda::std::bit_or;
|
| 68 |
+
#else
|
| 69 |
+
template <typename Ty> struct plus {__device__ __forceinline__ Ty operator()(Ty arg1, Ty arg2) const {return arg1 + arg2;}};
|
| 70 |
+
template <typename Ty> struct bit_and {__device__ __forceinline__ Ty operator()(Ty arg1, Ty arg2) const {return arg1 & arg2;}};
|
| 71 |
+
template <typename Ty> struct bit_xor {__device__ __forceinline__ Ty operator()(Ty arg1, Ty arg2) const {return arg1 ^ arg2;}};
|
| 72 |
+
template <typename Ty> struct bit_or {__device__ __forceinline__ Ty operator()(Ty arg1, Ty arg2) const {return arg1 | arg2;}};
|
| 73 |
+
#endif // _CG_USE_PLATFORM_STL
|
| 74 |
+
} // details
|
| 75 |
+
|
| 76 |
+
template <typename Ty>
|
| 77 |
+
struct plus : public details::plus<Ty> {};
|
| 78 |
+
|
| 79 |
+
template <typename Ty>
|
| 80 |
+
struct less {
|
| 81 |
+
__device__ __forceinline__ Ty operator()(Ty arg1, Ty arg2) const {
|
| 82 |
+
return (arg2 < arg1) ? arg2 : arg1;
|
| 83 |
+
}
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
template <typename Ty>
|
| 87 |
+
struct greater {
|
| 88 |
+
__device__ __forceinline__ Ty operator()(Ty arg1, Ty arg2) const {
|
| 89 |
+
return (arg1 < arg2) ? arg2 : arg1;
|
| 90 |
+
}
|
| 91 |
+
};
|
| 92 |
+
|
| 93 |
+
template <typename Ty>
|
| 94 |
+
struct bit_and : public details::bit_and<Ty> {};
|
| 95 |
+
|
| 96 |
+
template <typename Ty>
|
| 97 |
+
struct bit_xor : public details::bit_xor<Ty> {};
|
| 98 |
+
|
| 99 |
+
template <typename Ty>
|
| 100 |
+
struct bit_or : public details::bit_or<Ty> {};
|
| 101 |
+
|
| 102 |
+
#if defined(_CG_HAS_STL_ATOMICS)
|
| 103 |
+
namespace details {
|
| 104 |
+
template <class Ty>
|
| 105 |
+
using _atomic_is_type_supported = _CG_STL_NAMESPACE::integral_constant<bool,
|
| 106 |
+
_CG_STL_NAMESPACE::is_integral<Ty>::value && (sizeof(Ty) == 4 || sizeof(Ty) == 8)>;
|
| 107 |
+
|
| 108 |
+
template <typename TyOp> struct _atomic_op_supported : public _CG_STL_NAMESPACE::false_type {};
|
| 109 |
+
template <typename Ty> struct _atomic_op_supported<cooperative_groups::plus<Ty>> : public _atomic_is_type_supported<Ty> {};
|
| 110 |
+
template <typename Ty> struct _atomic_op_supported<cooperative_groups::less<Ty>> : public _atomic_is_type_supported<Ty> {};
|
| 111 |
+
template <typename Ty> struct _atomic_op_supported<cooperative_groups::greater<Ty>> : public _atomic_is_type_supported<Ty> {};
|
| 112 |
+
template <typename Ty> struct _atomic_op_supported<cooperative_groups::bit_and<Ty>> : public _atomic_is_type_supported<Ty> {};
|
| 113 |
+
template <typename Ty> struct _atomic_op_supported<cooperative_groups::bit_or<Ty>> : public _atomic_is_type_supported<Ty> {};
|
| 114 |
+
template <typename Ty> struct _atomic_op_supported<cooperative_groups::bit_xor<Ty>> : public _atomic_is_type_supported<Ty> {};
|
| 115 |
+
|
| 116 |
+
template<typename TyAtomic, typename TyVal, typename TyOp>
|
| 117 |
+
_CG_QUALIFIER remove_qual<TyVal> atomic_cas_fallback(TyAtomic&& atomic, TyVal&& val, TyOp&& op) {
|
| 118 |
+
auto old = atomic.load(cuda::std::memory_order_relaxed);
|
| 119 |
+
while(!atomic.compare_exchange_weak(old, op(old, val), cuda::std::memory_order_relaxed));
|
| 120 |
+
return old;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
template<typename TyOp>
|
| 124 |
+
struct op_picker;
|
| 125 |
+
|
| 126 |
+
template<typename TyVal>
|
| 127 |
+
struct op_picker<cooperative_groups::plus<TyVal>> {
|
| 128 |
+
template<typename TyAtomic>
|
| 129 |
+
_CG_STATIC_QUALIFIER TyVal atomic_update(TyAtomic& atomic, TyVal val) {
|
| 130 |
+
return atomic.fetch_add(val, cuda::std::memory_order_relaxed);
|
| 131 |
+
}
|
| 132 |
+
};
|
| 133 |
+
|
| 134 |
+
template<typename TyVal>
|
| 135 |
+
struct op_picker<cooperative_groups::less<TyVal>> {
|
| 136 |
+
template<typename TyAtomic>
|
| 137 |
+
_CG_STATIC_QUALIFIER TyVal atomic_update(TyAtomic& atomic, TyVal val) {
|
| 138 |
+
return atomic.fetch_min(val, cuda::std::memory_order_relaxed);
|
| 139 |
+
}
|
| 140 |
+
};
|
| 141 |
+
|
| 142 |
+
template<typename TyVal>
|
| 143 |
+
struct op_picker<cooperative_groups::greater<TyVal>> {
|
| 144 |
+
template<typename TyAtomic>
|
| 145 |
+
_CG_STATIC_QUALIFIER TyVal atomic_update(TyAtomic& atomic, TyVal val) {
|
| 146 |
+
return atomic.fetch_max(val, cuda::std::memory_order_relaxed);
|
| 147 |
+
}
|
| 148 |
+
};
|
| 149 |
+
|
| 150 |
+
template<typename TyVal>
|
| 151 |
+
struct op_picker<cooperative_groups::bit_and<TyVal>> {
|
| 152 |
+
template<typename TyAtomic>
|
| 153 |
+
_CG_STATIC_QUALIFIER TyVal atomic_update(TyAtomic& atomic, TyVal val) {
|
| 154 |
+
return atomic.fetch_and(val, cuda::std::memory_order_relaxed);
|
| 155 |
+
}
|
| 156 |
+
};
|
| 157 |
+
|
| 158 |
+
template<typename TyVal>
|
| 159 |
+
struct op_picker<cooperative_groups::bit_xor<TyVal>> {
|
| 160 |
+
template<typename TyAtomic>
|
| 161 |
+
_CG_STATIC_QUALIFIER TyVal atomic_update(TyAtomic& atomic, TyVal val) {
|
| 162 |
+
return atomic.fetch_xor(val, cuda::std::memory_order_relaxed);
|
| 163 |
+
}
|
| 164 |
+
};
|
| 165 |
+
|
| 166 |
+
template<typename TyVal>
|
| 167 |
+
struct op_picker<cooperative_groups::bit_or<TyVal>> {
|
| 168 |
+
template<typename TyAtomic>
|
| 169 |
+
_CG_STATIC_QUALIFIER TyVal atomic_update(TyAtomic& atomic, TyVal val) {
|
| 170 |
+
return atomic.fetch_or(val, cuda::std::memory_order_relaxed);
|
| 171 |
+
}
|
| 172 |
+
};
|
| 173 |
+
|
| 174 |
+
template<bool atomic_supported>
|
| 175 |
+
struct atomic_update_dispatch {};
|
| 176 |
+
|
| 177 |
+
template<>
|
| 178 |
+
struct atomic_update_dispatch<false> {
|
| 179 |
+
template<typename TyAtomic, typename TyVal, typename TyOp>
|
| 180 |
+
_CG_STATIC_QUALIFIER remove_qual<TyVal> atomic_update(TyAtomic& atomic, TyVal&& val, TyOp&& op) {
|
| 181 |
+
return atomic_cas_fallback(atomic, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp>(op));
|
| 182 |
+
}
|
| 183 |
+
};
|
| 184 |
+
|
| 185 |
+
template<>
|
| 186 |
+
struct atomic_update_dispatch<true> {
|
| 187 |
+
template<typename TyAtomic, typename TyVal, typename TyOp>
|
| 188 |
+
_CG_STATIC_QUALIFIER TyVal atomic_update(TyAtomic& atomic, TyVal val, TyOp&& op) {
|
| 189 |
+
using dispatch = op_picker<details::remove_qual<TyOp>>;
|
| 190 |
+
|
| 191 |
+
return dispatch::atomic_update(atomic, val);
|
| 192 |
+
}
|
| 193 |
+
};
|
| 194 |
+
|
| 195 |
+
template<typename TyAtomic, typename TyVal, typename TyOp>
|
| 196 |
+
_CG_QUALIFIER remove_qual<TyVal> atomic_update(TyAtomic& atomic, TyVal&& val, TyOp&& op) {
|
| 197 |
+
using dispatch = atomic_update_dispatch<_atomic_op_supported<details::remove_qual<TyOp>>::value>;
|
| 198 |
+
|
| 199 |
+
return dispatch::atomic_update(atomic, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp>(op));
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
template<typename TyAtomic, typename TyVal>
|
| 203 |
+
_CG_QUALIFIER void atomic_store(TyAtomic& atomic, TyVal&& val) {
|
| 204 |
+
atomic.store(val, cuda::std::memory_order_relaxed);
|
| 205 |
+
}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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2021 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _COOPERATIVE_GROUPS_HELPERS_H_
|
| 50 |
+
# define _COOPERATIVE_GROUPS_HELPERS_H_
|
| 51 |
+
|
| 52 |
+
#include "info.h"
|
| 53 |
+
#include "sync.h"
|
| 54 |
+
|
| 55 |
+
_CG_BEGIN_NAMESPACE
|
| 56 |
+
|
| 57 |
+
namespace details {
|
| 58 |
+
#ifdef _CG_CPP11_FEATURES
|
| 59 |
+
template <typename Ty> struct _is_float_or_half : public _CG_STL_NAMESPACE::is_floating_point<Ty> {};
|
| 60 |
+
# ifdef _CG_HAS_FP16_COLLECTIVE
|
| 61 |
+
template <> struct _is_float_or_half<__half> : public _CG_STL_NAMESPACE::true_type {};
|
| 62 |
+
template <> struct _is_float_or_half<__half2> : public _CG_STL_NAMESPACE::true_type {};
|
| 63 |
+
# endif
|
| 64 |
+
template <typename Ty>
|
| 65 |
+
using is_float_or_half = _is_float_or_half<typename _CG_STL_NAMESPACE::remove_cv<Ty>::type>;
|
| 66 |
+
|
| 67 |
+
// Non-STL utility templates
|
| 68 |
+
template <typename Ty>
|
| 69 |
+
using remove_qual = typename _CG_STL_NAMESPACE::remove_cv<typename _CG_STL_NAMESPACE::remove_reference<Ty>::type>::type;
|
| 70 |
+
|
| 71 |
+
template <typename TyLhs, typename TyRhs>
|
| 72 |
+
using is_op_type_same = _CG_STL_NAMESPACE::is_same<remove_qual<TyLhs>, remove_qual<TyRhs>
|
| 73 |
+
>;
|
| 74 |
+
#endif
|
| 75 |
+
|
| 76 |
+
template <typename TyTrunc>
|
| 77 |
+
_CG_STATIC_QUALIFIER TyTrunc vec3_to_linear(dim3 index, dim3 nIndex) {
|
| 78 |
+
return ((TyTrunc)index.z * nIndex.y * nIndex.x) +
|
| 79 |
+
((TyTrunc)index.y * nIndex.x) +
|
| 80 |
+
(TyTrunc)index.x;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
namespace cta {
|
| 84 |
+
|
| 85 |
+
_CG_STATIC_QUALIFIER void sync()
|
| 86 |
+
{
|
| 87 |
+
__barrier_sync(0);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
_CG_STATIC_QUALIFIER unsigned int num_threads()
|
| 91 |
+
{
|
| 92 |
+
return static_cast<unsigned int>(blockDim.x * blockDim.y * blockDim.z);
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
_CG_STATIC_QUALIFIER unsigned int thread_rank()
|
| 96 |
+
{
|
| 97 |
+
return vec3_to_linear<unsigned int>(threadIdx, blockDim);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
_CG_STATIC_QUALIFIER dim3 group_index()
|
| 101 |
+
{
|
| 102 |
+
return dim3(blockIdx.x, blockIdx.y, blockIdx.z);
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
_CG_STATIC_QUALIFIER dim3 thread_index()
|
| 106 |
+
{
|
| 107 |
+
return dim3(threadIdx.x, threadIdx.y, threadIdx.z);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
_CG_STATIC_QUALIFIER dim3 dim_threads()
|
| 111 |
+
{
|
| 112 |
+
return dim3(blockDim.x, blockDim.y, blockDim.z);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
// Legacy aliases
|
| 116 |
+
_CG_STATIC_QUALIFIER unsigned int size()
|
| 117 |
+
{
|
| 118 |
+
return num_threads();
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
_CG_STATIC_QUALIFIER dim3 block_dim()
|
| 122 |
+
{
|
| 123 |
+
return dim_threads();
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
};
|
| 127 |
+
|
| 128 |
+
class _coalesced_group_data_access {
|
| 129 |
+
public:
|
| 130 |
+
// Retrieve mask of coalesced groups and tiles
|
| 131 |
+
template <typename TyGroup>
|
| 132 |
+
_CG_STATIC_QUALIFIER unsigned int get_mask(const TyGroup &group) {
|
| 133 |
+
return group.get_mask();
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
template <typename TyGroup>
|
| 137 |
+
_CG_STATIC_QUALIFIER TyGroup construct_from_mask(unsigned int mask) {
|
| 138 |
+
return TyGroup(mask);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
template <typename TyGroup>
|
| 142 |
+
_CG_STATIC_QUALIFIER void modify_meta_group(TyGroup &group, unsigned int mgRank, unsigned int mgSize) {
|
| 143 |
+
group._data.coalesced.metaGroupRank = mgRank;
|
| 144 |
+
group._data.coalesced.metaGroupSize = mgSize;
|
| 145 |
+
}
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
namespace tile {
|
| 149 |
+
template <unsigned int TileCount, unsigned int TileMask, unsigned int LaneMask, unsigned int ShiftCount>
|
| 150 |
+
struct _tile_helpers{
|
| 151 |
+
_CG_STATIC_CONST_DECL unsigned int tileCount = TileCount;
|
| 152 |
+
_CG_STATIC_CONST_DECL unsigned int tileMask = TileMask;
|
| 153 |
+
_CG_STATIC_CONST_DECL unsigned int laneMask = LaneMask;
|
| 154 |
+
_CG_STATIC_CONST_DECL unsigned int shiftCount = ShiftCount;
|
| 155 |
+
};
|
| 156 |
+
|
| 157 |
+
template <unsigned int> struct tile_helpers;
|
| 158 |
+
template <> struct tile_helpers<32> : public _tile_helpers<1, 0xFFFFFFFF, 0x1F, 5> {};
|
| 159 |
+
template <> struct tile_helpers<16> : public _tile_helpers<2, 0x0000FFFF, 0x0F, 4> {};
|
| 160 |
+
template <> struct tile_helpers<8> : public _tile_helpers<4, 0x000000FF, 0x07, 3> {};
|
| 161 |
+
template <> struct tile_helpers<4> : public _tile_helpers<8, 0x0000000F, 0x03, 2> {};
|
| 162 |
+
template <> struct tile_helpers<2> : public _tile_helpers<16, 0x00000003, 0x01, 1> {};
|
| 163 |
+
template <> struct tile_helpers<1> : public _tile_helpers<32, 0x00000001, 0x00, 0> {};
|
| 164 |
+
|
| 165 |
+
#ifdef _CG_CPP11_FEATURES
|
| 166 |
+
namespace shfl {
|
| 167 |
+
/***********************************************************************************
|
| 168 |
+
* Recursively Sliced Shuffle
|
| 169 |
+
* Purpose:
|
| 170 |
+
* Slices an input type a number of times into integral types so that shuffles
|
| 171 |
+
* are well defined
|
| 172 |
+
* Expectations:
|
| 173 |
+
* This object *should not* be used from a reinterpret_cast pointer unless
|
| 174 |
+
* some alignment guarantees can be met. Use a memcpy to guarantee that loads
|
| 175 |
+
* from the integral types stored within are aligned and correct.
|
| 176 |
+
**********************************************************************************/
|
| 177 |
+
template <unsigned int count, bool intSized = (count <= sizeof(int))>
|
| 178 |
+
struct recursive_sliced_shuffle_helper;
|
| 179 |
+
|
| 180 |
+
template <unsigned int count>
|
| 181 |
+
struct recursive_sliced_shuffle_helper<count, true> {
|
| 182 |
+
int val;
|
| 183 |
+
|
| 184 |
+
template <typename TyFn>
|
| 185 |
+
_CG_QUALIFIER void invoke_shuffle(const TyFn &shfl) {
|
| 186 |
+
val = shfl(val);
|
| 187 |
+
}
|
| 188 |
+
};
|
| 189 |
+
|
| 190 |
+
template <unsigned int count>
|
| 191 |
+
struct recursive_sliced_shuffle_helper<count, false> {
|
| 192 |
+
int val;
|
| 193 |
+
recursive_sliced_shuffle_helper<count - sizeof(int)> next;
|
| 194 |
+
|
| 195 |
+
template <typename TyFn>
|
| 196 |
+
_CG_QUALIFIER void invoke_shuffle(const TyFn &shfl) {
|
| 197 |
+
val = shfl(val);
|
| 198 |
+
next.invoke_shuffle(shfl);
|
| 199 |
+
}
|
| 200 |
+
};
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
struct _memory_shuffle {
|
| 204 |
+
template <typename TyElem, typename TyShflFn>
|
| 205 |
+
_CG_STATIC_QUALIFIER TyElem _shfl_internal(TyElem elem, const TyShflFn& fn) {
|
| 206 |
+
static_assert(sizeof(TyElem) <= 32, "Cooperative groups collectives are limited to types smaller than 32B");
|
| 207 |
+
return TyElem{};
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
template <typename TyElem, typename TyRet = remove_qual<TyElem>>
|
| 211 |
+
_CG_STATIC_QUALIFIER TyRet shfl(TyElem&& elem, unsigned int gMask, unsigned int srcRank, unsigned int threads) {
|
| 212 |
+
auto shfl = [=](int val) -> int {
|
| 213 |
+
return 0;
|
| 214 |
+
};
|
| 215 |
+
|
| 216 |
+
return _shfl_internal<TyRet>(_CG_STL_NAMESPACE::forward<TyElem>(elem), shfl);
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
template <typename TyElem, typename TyRet = remove_qual<TyElem>>
|
| 220 |
+
_CG_STATIC_QUALIFIER TyRet shfl_down(TyElem&& elem, unsigned int gMask, unsigned int delta, unsigned int threads) {
|
| 221 |
+
auto shfl = [=](int val) -> int {
|
| 222 |
+
return 0;
|
| 223 |
+
};
|
| 224 |
+
|
| 225 |
+
return _shfl_internal<TyRet>(_CG_STL_NAMESPACE::forward<TyElem>(elem), shfl);
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
template <typename TyElem, typename TyRet = remove_qual<TyElem>>
|
| 229 |
+
_CG_STATIC_QUALIFIER TyRet shfl_up(TyElem&& elem, unsigned int gMask, unsigned int delta, unsigned int threads) {
|
| 230 |
+
auto shfl = [=](int val) -> int {
|
| 231 |
+
return 0;
|
| 232 |
+
};
|
| 233 |
+
|
| 234 |
+
return _shfl_internal<TyRet>(_CG_STL_NAMESPACE::forward<TyElem>(elem), shfl);
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
template <typename TyElem, typename TyRet = remove_qual<TyElem>>
|
| 238 |
+
_CG_STATIC_QUALIFIER TyRet shfl_xor(TyElem&& elem, unsigned int gMask, unsigned int lMask, unsigned int threads) {
|
| 239 |
+
auto shfl = [=](int val) -> int {
|
| 240 |
+
return 0;
|
| 241 |
+
};
|
| 242 |
+
|
| 243 |
+
return _shfl_internal<TyRet>(_CG_STL_NAMESPACE::forward<TyElem>(elem), shfl);
|
| 244 |
+
}
|
| 245 |
+
};
|
| 246 |
+
|
| 247 |
+
/***********************************************************************************
|
| 248 |
+
* Intrinsic Device Function Shuffle
|
| 249 |
+
* Purpose:
|
| 250 |
+
* Uses a shuffle helper that has characteristics best suited for moving
|
| 251 |
+
* elements between threads
|
| 252 |
+
* Expectations:
|
| 253 |
+
* Object given will be forced into an l-value type so that it can be used
|
| 254 |
+
* with a helper structure that reinterprets the data into intrinsic compatible
|
| 255 |
+
* types
|
| 256 |
+
* Notes:
|
| 257 |
+
* !! TyRet is required so that objects are returned by value and not as
|
| 258 |
+
* dangling references depending on the value category of the passed object
|
| 259 |
+
**********************************************************************************/
|
| 260 |
+
struct _intrinsic_compat_shuffle {
|
| 261 |
+
template <unsigned int count>
|
| 262 |
+
using shfl_helper = shfl::recursive_sliced_shuffle_helper<count>;
|
| 263 |
+
|
| 264 |
+
template <typename TyElem, typename TyShflFn>
|
| 265 |
+
_CG_STATIC_QUALIFIER TyElem _shfl_internal(TyElem elem, const TyShflFn& fn) {
|
| 266 |
+
static_assert(__is_trivially_copyable(TyElem), "Type is not compatible with device shuffle");
|
| 267 |
+
shfl_helper<sizeof(TyElem)> helper;
|
| 268 |
+
memcpy(&helper, &elem, sizeof(TyElem));
|
| 269 |
+
helper.invoke_shuffle(fn);
|
| 270 |
+
memcpy(&elem, &helper, sizeof(TyElem));
|
| 271 |
+
return elem;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
template <typename TyElem, typename TyRet = remove_qual<TyElem>>
|
| 275 |
+
_CG_STATIC_QUALIFIER TyRet shfl(TyElem&& elem, unsigned int gMask, unsigned int srcRank, unsigned int threads) {
|
| 276 |
+
auto shfl = [=](int val) -> int {
|
| 277 |
+
return __shfl_sync(gMask, val, srcRank, threads);
|
| 278 |
+
};
|
| 279 |
+
|
| 280 |
+
return _shfl_internal<TyRet>(_CG_STL_NAMESPACE::forward<TyElem>(elem), shfl);
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
template <typename TyElem, typename TyRet = remove_qual<TyElem>>
|
| 284 |
+
_CG_STATIC_QUALIFIER TyRet shfl_down(TyElem&& elem, unsigned int gMask, unsigned int delta, unsigned int threads) {
|
| 285 |
+
auto shfl = [=](int val) -> int {
|
| 286 |
+
return __shfl_down_sync(gMask, val, delta, threads);
|
| 287 |
+
};
|
| 288 |
+
|
| 289 |
+
return _shfl_internal<TyRet>(_CG_STL_NAMESPACE::forward<TyElem>(elem), shfl);
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
template <typename TyElem, typename TyRet = remove_qual<TyElem>>
|
| 293 |
+
_CG_STATIC_QUALIFIER TyRet shfl_up(TyElem&& elem, unsigned int gMask, unsigned int delta, unsigned int threads) {
|
| 294 |
+
auto shfl = [=](int val) -> int {
|
| 295 |
+
return __shfl_up_sync(gMask, val, delta, threads);
|
| 296 |
+
};
|
| 297 |
+
|
| 298 |
+
return _shfl_internal<TyRet>(_CG_STL_NAMESPACE::forward<TyElem>(elem), shfl);
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
template <typename TyElem, typename TyRet = remove_qual<TyElem>>
|
| 302 |
+
_CG_STATIC_QUALIFIER TyRet shfl_xor(TyElem&& elem, unsigned int gMask, unsigned int lMask, unsigned int threads) {
|
| 303 |
+
auto shfl = [=](int val) -> int {
|
| 304 |
+
return __shfl_xor_sync(gMask, val, lMask, threads);
|
| 305 |
+
};
|
| 306 |
+
|
| 307 |
+
return _shfl_internal<TyRet>(_CG_STL_NAMESPACE::forward<TyElem>(elem), shfl);
|
| 308 |
+
}
|
| 309 |
+
};
|
| 310 |
+
|
| 311 |
+
struct _native_shuffle {
|
| 312 |
+
template <typename TyElem>
|
| 313 |
+
_CG_STATIC_QUALIFIER TyElem shfl(
|
| 314 |
+
TyElem elem, unsigned int gMask, unsigned int srcRank, unsigned int threads) {
|
| 315 |
+
return static_cast<TyElem>(__shfl_sync(gMask, elem, srcRank, threads));
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
template <typename TyElem>
|
| 319 |
+
_CG_STATIC_QUALIFIER TyElem shfl_down(
|
| 320 |
+
TyElem elem, unsigned int gMask, unsigned int delta, unsigned int threads) {
|
| 321 |
+
return static_cast<TyElem>(__shfl_down_sync(gMask, elem, delta, threads));
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
template <typename TyElem>
|
| 325 |
+
_CG_STATIC_QUALIFIER TyElem shfl_up(
|
| 326 |
+
TyElem elem, unsigned int gMask, unsigned int delta, unsigned int threads) {
|
| 327 |
+
return static_cast<TyElem>(__shfl_up_sync(gMask, elem, delta, threads));
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
template <typename TyElem>
|
| 331 |
+
_CG_STATIC_QUALIFIER TyElem shfl_xor(
|
| 332 |
+
TyElem elem, unsigned int gMask, unsigned int lMask, unsigned int threads) {
|
| 333 |
+
return static_cast<TyElem>(__shfl_xor_sync(gMask, elem, lMask, threads));
|
| 334 |
+
}
|
| 335 |
+
};
|
| 336 |
+
|
| 337 |
+
// Almost all arithmetic types are supported by native shuffle
|
| 338 |
+
// Vector types are the exception
|
| 339 |
+
template <typename TyElem>
|
| 340 |
+
using use_native_shuffle = _CG_STL_NAMESPACE::integral_constant<
|
| 341 |
+
bool,
|
| 342 |
+
_CG_STL_NAMESPACE::is_integral<
|
| 343 |
+
remove_qual<TyElem>>::value ||
|
| 344 |
+
details::is_float_or_half<
|
| 345 |
+
remove_qual<TyElem>>::value
|
| 346 |
+
>;
|
| 347 |
+
|
| 348 |
+
constexpr unsigned long long _MemoryShuffleCutoff = 32;
|
| 349 |
+
|
| 350 |
+
template <typename TyElem,
|
| 351 |
+
bool IsNative = use_native_shuffle<TyElem>::value,
|
| 352 |
+
bool InMem = (sizeof(TyElem) > _MemoryShuffleCutoff)>
|
| 353 |
+
struct shuffle_dispatch;
|
| 354 |
+
|
| 355 |
+
template <typename TyElem>
|
| 356 |
+
struct shuffle_dispatch<TyElem, true, false> : public _native_shuffle {};
|
| 357 |
+
|
| 358 |
+
template <typename TyElem>
|
| 359 |
+
struct shuffle_dispatch<TyElem, false, false> : public _intrinsic_compat_shuffle {};
|
| 360 |
+
|
| 361 |
+
template <typename TyElem>
|
| 362 |
+
struct shuffle_dispatch<TyElem, false, true> : public _memory_shuffle {};
|
| 363 |
+
|
| 364 |
+
#endif //_CG_CPP11_FEATURES
|
| 365 |
+
};
|
| 366 |
+
|
| 367 |
+
namespace grid {
|
| 368 |
+
_CG_STATIC_QUALIFIER unsigned int barrier_arrive(unsigned int *bar) {
|
| 369 |
+
return details::sync_grids_arrive(bar);
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
_CG_STATIC_QUALIFIER void barrier_wait(unsigned int token, unsigned int *bar) {
|
| 373 |
+
details::sync_grids_wait(token, bar);
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
_CG_STATIC_QUALIFIER void sync(unsigned int *bar) {
|
| 377 |
+
unsigned int token = details::sync_grids_arrive(bar);
|
| 378 |
+
details::sync_grids_wait(token, bar);
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
_CG_STATIC_QUALIFIER unsigned long long num_blocks()
|
| 382 |
+
{
|
| 383 |
+
// grid.y * grid.z -> [max(65535) * max(65535)] fits within 4b, promote after multiplication
|
| 384 |
+
// grid.x * (grid.y * grid.z) -> [max(2^31-1) * max(65535 * 65535)] exceeds 4b, promote before multiplication
|
| 385 |
+
return (unsigned long long)gridDim.x * (gridDim.y * gridDim.z);
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
_CG_STATIC_QUALIFIER unsigned long long num_threads()
|
| 389 |
+
{
|
| 390 |
+
return num_blocks() * cta::num_threads();
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
_CG_STATIC_QUALIFIER unsigned long long block_rank()
|
| 394 |
+
{
|
| 395 |
+
return vec3_to_linear<unsigned long long>(blockIdx, gridDim);
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
_CG_STATIC_QUALIFIER unsigned long long thread_rank()
|
| 399 |
+
{
|
| 400 |
+
return block_rank() * cta::num_threads() + cta::thread_rank();
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
_CG_STATIC_QUALIFIER dim3 dim_blocks()
|
| 404 |
+
{
|
| 405 |
+
return dim3(gridDim.x, gridDim.y, gridDim.z);
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
_CG_STATIC_QUALIFIER dim3 block_index()
|
| 409 |
+
{
|
| 410 |
+
return dim3(blockIdx.x, blockIdx.y, blockIdx.z);
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
_CG_STATIC_QUALIFIER dim3 dim_threads()
|
| 414 |
+
{
|
| 415 |
+
return dim3(gridDim.x * blockDim.x, gridDim.y * blockDim.y, gridDim.z * blockDim.z);
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
_CG_STATIC_QUALIFIER dim3 thread_index()
|
| 419 |
+
{
|
| 420 |
+
return dim3(blockIdx.x * blockDim.x + threadIdx.x,
|
| 421 |
+
blockIdx.y * blockDim.y + threadIdx.y,
|
| 422 |
+
blockIdx.z * blockDim.z + threadIdx.z);
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
#if defined(_CG_HAS_CLUSTER_GROUP)
|
| 426 |
+
_CG_STATIC_QUALIFIER dim3 dim_clusters() {
|
| 427 |
+
return __clusterGridDimInClusters();
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
_CG_STATIC_QUALIFIER unsigned long long num_clusters() {
|
| 431 |
+
const dim3 dimClusters = dim_clusters();
|
| 432 |
+
return dimClusters.x * dimClusters.y * dimClusters.z;
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
_CG_STATIC_QUALIFIER dim3 cluster_index() {
|
| 436 |
+
return __clusterIdx();
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
_CG_STATIC_QUALIFIER unsigned long long cluster_rank() {
|
| 440 |
+
return vec3_to_linear<unsigned long long>(cluster_index(), dim_clusters());
|
| 441 |
+
}
|
| 442 |
+
#endif
|
| 443 |
+
|
| 444 |
+
// Legacy aliases
|
| 445 |
+
_CG_STATIC_QUALIFIER unsigned long long size()
|
| 446 |
+
{
|
| 447 |
+
return num_threads();
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
_CG_STATIC_QUALIFIER dim3 grid_dim()
|
| 451 |
+
{
|
| 452 |
+
return dim_blocks();
|
| 453 |
+
}
|
| 454 |
+
};
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
#if defined(_CG_HAS_CLUSTER_GROUP)
|
| 458 |
+
namespace cluster {
|
| 459 |
+
|
| 460 |
+
_CG_STATIC_QUALIFIER bool isReal()
|
| 461 |
+
{
|
| 462 |
+
return __clusterDimIsSpecified();
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
_CG_STATIC_QUALIFIER void barrier_arrive()
|
| 466 |
+
{
|
| 467 |
+
__cluster_barrier_arrive();
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
_CG_STATIC_QUALIFIER void barrier_wait()
|
| 471 |
+
{
|
| 472 |
+
__cluster_barrier_wait();
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
_CG_STATIC_QUALIFIER void sync()
|
| 476 |
+
{
|
| 477 |
+
barrier_arrive();
|
| 478 |
+
barrier_wait();
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
_CG_STATIC_QUALIFIER unsigned int query_shared_rank(const void *addr)
|
| 482 |
+
{
|
| 483 |
+
return __cluster_query_shared_rank(addr);
|
| 484 |
+
}
|
| 485 |
+
|
| 486 |
+
template <typename T>
|
| 487 |
+
_CG_STATIC_QUALIFIER T* map_shared_rank(T *addr, int rank)
|
| 488 |
+
{
|
| 489 |
+
return static_cast<T*>(__cluster_map_shared_rank(addr, rank));
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
_CG_STATIC_QUALIFIER dim3 block_index()
|
| 493 |
+
{
|
| 494 |
+
return __clusterRelativeBlockIdx();
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
_CG_STATIC_QUALIFIER unsigned int block_rank()
|
| 498 |
+
{
|
| 499 |
+
return __clusterRelativeBlockRank();
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
_CG_STATIC_QUALIFIER dim3 thread_index()
|
| 503 |
+
{
|
| 504 |
+
const dim3 blockIndex = block_index();
|
| 505 |
+
return dim3(blockIndex.x * blockDim.x + threadIdx.x,
|
| 506 |
+
blockIndex.y * blockDim.y + threadIdx.y,
|
| 507 |
+
blockIndex.z * blockDim.z + threadIdx.z);
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
_CG_STATIC_QUALIFIER unsigned int thread_rank()
|
| 511 |
+
{
|
| 512 |
+
return block_rank() * cta::num_threads() + cta::thread_rank();
|
| 513 |
+
}
|
| 514 |
+
|
| 515 |
+
_CG_STATIC_QUALIFIER dim3 dim_blocks()
|
| 516 |
+
{
|
| 517 |
+
return __clusterDim();
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
_CG_STATIC_QUALIFIER unsigned int num_blocks()
|
| 521 |
+
{
|
| 522 |
+
return __clusterSizeInBlocks();
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
_CG_STATIC_QUALIFIER dim3 dim_threads()
|
| 526 |
+
{
|
| 527 |
+
const dim3 dimBlocks = dim_blocks();
|
| 528 |
+
const unsigned int x = dimBlocks.x * blockDim.x;
|
| 529 |
+
const unsigned int y = dimBlocks.y * blockDim.y;
|
| 530 |
+
const unsigned int z = dimBlocks.z * blockDim.z;
|
| 531 |
+
return dim3(x, y, z);
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
_CG_STATIC_QUALIFIER unsigned int num_threads()
|
| 535 |
+
{
|
| 536 |
+
return num_blocks() * cta::num_threads();
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
};
|
| 540 |
+
#endif
|
| 541 |
+
|
| 542 |
+
_CG_STATIC_QUALIFIER unsigned int laneid()
|
| 543 |
+
{
|
| 544 |
+
unsigned int laneid;
|
| 545 |
+
asm ("mov.u32 %0, %%laneid;" : "=r"(laneid));
|
| 546 |
+
return laneid;
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
_CG_STATIC_QUALIFIER unsigned int lanemask32_eq()
|
| 550 |
+
{
|
| 551 |
+
unsigned int lanemask32_eq;
|
| 552 |
+
asm ("mov.u32 %0, %%lanemask_eq;" : "=r"(lanemask32_eq));
|
| 553 |
+
return (lanemask32_eq);
|
| 554 |
+
}
|
| 555 |
+
|
| 556 |
+
_CG_STATIC_QUALIFIER unsigned int lanemask32_lt()
|
| 557 |
+
{
|
| 558 |
+
unsigned int lanemask32_lt;
|
| 559 |
+
asm ("mov.u32 %0, %%lanemask_lt;" : "=r"(lanemask32_lt));
|
| 560 |
+
return (lanemask32_lt);
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
_CG_STATIC_QUALIFIER void abort()
|
| 564 |
+
{
|
| 565 |
+
_CG_ABORT();
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
template <typename Ty>
|
| 569 |
+
_CG_QUALIFIER void assert_if_not_arithmetic() {
|
| 570 |
+
#ifdef _CG_CPP11_FEATURES
|
| 571 |
+
static_assert(
|
| 572 |
+
_CG_STL_NAMESPACE::is_integral<Ty>::value ||
|
| 573 |
+
details::is_float_or_half<Ty>::value,
|
| 574 |
+
"Error: Ty is neither integer or float"
|
| 575 |
+
);
|
| 576 |
+
#endif //_CG_CPP11_FEATURES
|
| 577 |
+
}
|
| 578 |
+
|
| 579 |
+
#ifdef _CG_CPP11_FEATURES
|
| 580 |
+
_CG_STATIC_QUALIFIER constexpr unsigned int log2(unsigned int x) {
|
| 581 |
+
return x == 1 ? 0 : 1 + log2(x / 2);
|
| 582 |
+
}
|
| 583 |
+
#endif //_CG_CPP11_FEATURES
|
| 584 |
+
|
| 585 |
+
}; // !Namespace internal
|
| 586 |
+
|
| 587 |
+
_CG_END_NAMESPACE
|
| 588 |
+
|
| 589 |
+
#endif /* !_COOPERATIVE_GROUPS_HELPERS_H_ */
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/info.h
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2021 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
#include <nv/target>
|
| 51 |
+
|
| 52 |
+
#ifndef _CG_INFO_H_
|
| 53 |
+
#define _CG_INFO_H_
|
| 54 |
+
/*
|
| 55 |
+
** Define: _CG_VERSION
|
| 56 |
+
*/
|
| 57 |
+
#define _CG_VERSION 1000
|
| 58 |
+
|
| 59 |
+
/*
|
| 60 |
+
** Define: _CG_ABI_VERSION
|
| 61 |
+
*/
|
| 62 |
+
#ifndef _CG_ABI_VERSION
|
| 63 |
+
# define _CG_ABI_VERSION 1
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
/*
|
| 67 |
+
** Define: _CG_ABI_EXPERIMENTAL
|
| 68 |
+
** Desc: If enabled, sets all features enabled (ABI-breaking or experimental)
|
| 69 |
+
*/
|
| 70 |
+
#if defined(_CG_ABI_EXPERIMENTAL)
|
| 71 |
+
#endif
|
| 72 |
+
|
| 73 |
+
#define _CG_CONCAT_INNER(x, y) x ## y
|
| 74 |
+
#define _CG_CONCAT_OUTER(x, y) _CG_CONCAT_INNER(x, y)
|
| 75 |
+
#define _CG_NAMESPACE _CG_CONCAT_OUTER(__v, _CG_ABI_VERSION)
|
| 76 |
+
|
| 77 |
+
#define _CG_BEGIN_NAMESPACE \
|
| 78 |
+
namespace cooperative_groups { namespace _CG_NAMESPACE {
|
| 79 |
+
#define _CG_END_NAMESPACE \
|
| 80 |
+
}; using namespace _CG_NAMESPACE; };
|
| 81 |
+
|
| 82 |
+
#if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_MSC_VER) && (_MSC_VER >= 1900))
|
| 83 |
+
# define _CG_CPP11_FEATURES
|
| 84 |
+
#endif
|
| 85 |
+
|
| 86 |
+
#if !defined(_CG_QUALIFIER)
|
| 87 |
+
# define _CG_QUALIFIER __forceinline__ __device__
|
| 88 |
+
#endif
|
| 89 |
+
#if !defined(_CG_STATIC_QUALIFIER)
|
| 90 |
+
# define _CG_STATIC_QUALIFIER static __forceinline__ __device__
|
| 91 |
+
#endif
|
| 92 |
+
#if !defined(_CG_CONSTEXPR_QUALIFIER)
|
| 93 |
+
# if defined(_CG_CPP11_FEATURES)
|
| 94 |
+
# define _CG_CONSTEXPR_QUALIFIER constexpr __forceinline__ __device__
|
| 95 |
+
# else
|
| 96 |
+
# define _CG_CONSTEXPR_QUALIFIER _CG_QUALIFIER
|
| 97 |
+
# endif
|
| 98 |
+
#endif
|
| 99 |
+
#if !defined(_CG_STATIC_CONSTEXPR_QUALIFIER)
|
| 100 |
+
# if defined(_CG_CPP11_FEATURES)
|
| 101 |
+
# define _CG_STATIC_CONSTEXPR_QUALIFIER static constexpr __forceinline__ __device__
|
| 102 |
+
# else
|
| 103 |
+
# define _CG_STATIC_CONSTEXPR_QUALIFIER _CG_STATIC_QUALIFIER
|
| 104 |
+
# endif
|
| 105 |
+
#endif
|
| 106 |
+
|
| 107 |
+
#if defined(_MSC_VER)
|
| 108 |
+
# define _CG_DEPRECATED __declspec(deprecated)
|
| 109 |
+
#else
|
| 110 |
+
# define _CG_DEPRECATED __attribute__((deprecated))
|
| 111 |
+
#endif
|
| 112 |
+
|
| 113 |
+
#if defined(__CUDA_MINIMUM_ARCH__)
|
| 114 |
+
# define _CG_CUDA_ARCH __CUDA_MINIMUM_ARCH__
|
| 115 |
+
#elif defined(__CUDA_ARCH__)
|
| 116 |
+
# define _CG_CUDA_ARCH __CUDA_ARCH__
|
| 117 |
+
#endif
|
| 118 |
+
|
| 119 |
+
#if (_CG_CUDA_ARCH >= 600) || !defined(_CG_CUDA_ARCH)
|
| 120 |
+
# define _CG_HAS_GRID_GROUP
|
| 121 |
+
#endif
|
| 122 |
+
#if (_CG_CUDA_ARCH >= 600) || !defined(_CG_CUDA_ARCH)
|
| 123 |
+
# define _CG_HAS_MULTI_GRID_GROUP
|
| 124 |
+
#endif
|
| 125 |
+
#if (_CG_CUDA_ARCH >= 700) || !defined(_CG_CUDA_ARCH)
|
| 126 |
+
# define _CG_HAS_MATCH_COLLECTIVE
|
| 127 |
+
#endif
|
| 128 |
+
|
| 129 |
+
#if ((_CG_CUDA_ARCH >= 800) || !defined(_CG_CUDA_ARCH)) && !defined(_CG_USER_PROVIDED_SHARED_MEMORY)
|
| 130 |
+
# define _CG_HAS_RESERVED_SHARED
|
| 131 |
+
#endif
|
| 132 |
+
|
| 133 |
+
#if ((_CG_CUDA_ARCH >= 900) || !defined(_CG_CUDA_ARCH)) && \
|
| 134 |
+
(defined(__NVCC__) || defined(__CUDACC_RTC__) || defined(_CG_CLUSTER_INTRINSICS_AVAILABLE)) && \
|
| 135 |
+
defined(_CG_CPP11_FEATURES)
|
| 136 |
+
# define _CG_HAS_CLUSTER_GROUP
|
| 137 |
+
#endif
|
| 138 |
+
|
| 139 |
+
#if (_CG_CUDA_ARCH >= 900) || !defined(_CG_CUDA_ARCH)
|
| 140 |
+
# define _CG_HAS_INSTR_ELECT
|
| 141 |
+
#endif
|
| 142 |
+
|
| 143 |
+
// Has __half and __half2
|
| 144 |
+
// Only usable if you include the cuda_fp16.h extension, and
|
| 145 |
+
// _before_ including cooperative_groups.h
|
| 146 |
+
#ifdef __CUDA_FP16_TYPES_EXIST__
|
| 147 |
+
# define _CG_HAS_FP16_COLLECTIVE
|
| 148 |
+
#endif
|
| 149 |
+
|
| 150 |
+
// Include libcu++ where supported.
|
| 151 |
+
#if defined(_CG_CPP11_FEATURES) && !defined(__ibmxl__) && (!defined(_MSC_VER) || defined(_WIN64)) && \
|
| 152 |
+
!defined(_CG_LIMIT_INCLUDED_DEPENDENCIES)
|
| 153 |
+
# define _CG_USE_CUDA_STL
|
| 154 |
+
#else
|
| 155 |
+
# define _CG_USE_OWN_TRAITS
|
| 156 |
+
#endif
|
| 157 |
+
|
| 158 |
+
#if defined(_CG_USE_CUDA_STL) && !defined(__QNX__) && (!defined(__CUDA_ARCH__) || \
|
| 159 |
+
((!defined(_MSC_VER) && __CUDA_ARCH__ >= 600) || (defined(_MSC_VER) && __CUDA_ARCH__ >= 700)))
|
| 160 |
+
# define _CG_HAS_STL_ATOMICS
|
| 161 |
+
#endif
|
| 162 |
+
|
| 163 |
+
#ifdef _CG_CPP11_FEATURES
|
| 164 |
+
// Use cuda::std:: for type_traits
|
| 165 |
+
# if defined(_CG_USE_CUDA_STL)
|
| 166 |
+
# define _CG_STL_NAMESPACE cuda::std
|
| 167 |
+
# include <cuda/std/type_traits>
|
| 168 |
+
// Use CG's implementation of type traits
|
| 169 |
+
# else
|
| 170 |
+
# define _CG_STL_NAMESPACE cooperative_groups::details::templates
|
| 171 |
+
# endif
|
| 172 |
+
#endif
|
| 173 |
+
|
| 174 |
+
#ifdef _CG_CPP11_FEATURES
|
| 175 |
+
# define _CG_STATIC_CONST_DECL static constexpr
|
| 176 |
+
# define _CG_CONST_DECL constexpr
|
| 177 |
+
#else
|
| 178 |
+
# define _CG_STATIC_CONST_DECL static const
|
| 179 |
+
# define _CG_CONST_DECL const
|
| 180 |
+
#endif
|
| 181 |
+
|
| 182 |
+
#if (defined(_MSC_VER) && !defined(_WIN64)) || defined(__arm__)
|
| 183 |
+
# define _CG_ASM_PTR_CONSTRAINT "r"
|
| 184 |
+
#else
|
| 185 |
+
# define _CG_ASM_PTR_CONSTRAINT "l"
|
| 186 |
+
#endif
|
| 187 |
+
|
| 188 |
+
/*
|
| 189 |
+
** Define: CG_DEBUG
|
| 190 |
+
** What: Enables various runtime safety checks
|
| 191 |
+
*/
|
| 192 |
+
#if defined(__CUDACC_DEBUG__) && defined(CG_DEBUG) && !defined(NDEBUG)
|
| 193 |
+
# define _CG_DEBUG
|
| 194 |
+
#endif
|
| 195 |
+
|
| 196 |
+
#if defined(_CG_DEBUG)
|
| 197 |
+
# include <assert.h>
|
| 198 |
+
# define _CG_ASSERT(x) assert((x));
|
| 199 |
+
# define _CG_ABORT() assert(0);
|
| 200 |
+
#else
|
| 201 |
+
# define _CG_ASSERT(x)
|
| 202 |
+
# define _CG_ABORT() __trap();
|
| 203 |
+
#endif
|
| 204 |
+
|
| 205 |
+
_CG_BEGIN_NAMESPACE
|
| 206 |
+
|
| 207 |
+
namespace details {
|
| 208 |
+
_CG_STATIC_CONST_DECL unsigned int default_max_block_size = 1024;
|
| 209 |
+
|
| 210 |
+
#if defined(_CG_CPP11_FEATURES) && !defined(_CG_USE_CUDA_STL)
|
| 211 |
+
namespace templates {
|
| 212 |
+
|
| 213 |
+
/**
|
| 214 |
+
* Integral constants
|
| 215 |
+
**/
|
| 216 |
+
template <typename Ty, Ty Val>
|
| 217 |
+
struct integral_constant {
|
| 218 |
+
static constexpr Ty value = Val;
|
| 219 |
+
typedef Ty type;
|
| 220 |
+
|
| 221 |
+
_CG_QUALIFIER constexpr operator type() const noexcept { return value; }
|
| 222 |
+
_CG_QUALIFIER constexpr type operator()() const noexcept { return value; }
|
| 223 |
+
};
|
| 224 |
+
|
| 225 |
+
typedef integral_constant<bool, true> true_type;
|
| 226 |
+
typedef integral_constant<bool, false> false_type;
|
| 227 |
+
|
| 228 |
+
/**
|
| 229 |
+
* CV Qualifiers
|
| 230 |
+
**/
|
| 231 |
+
template <class Ty> struct is_lvalue_reference : public details::templates::false_type {};
|
| 232 |
+
template <class Ty> struct is_lvalue_reference<Ty&> : public details::templates::true_type {};
|
| 233 |
+
|
| 234 |
+
template <class Ty> struct remove_reference {typedef Ty type;};
|
| 235 |
+
template <class Ty> struct remove_reference<Ty&> {typedef Ty type;};
|
| 236 |
+
template <class Ty> struct remove_reference<Ty&&> {typedef Ty type;};
|
| 237 |
+
|
| 238 |
+
template <class Ty>
|
| 239 |
+
using remove_reference_t = typename details::templates::remove_reference<Ty>::type;
|
| 240 |
+
|
| 241 |
+
template <class Ty> struct remove_const {typedef Ty type;};
|
| 242 |
+
template <class Ty> struct remove_const<const Ty> {typedef Ty type;};
|
| 243 |
+
|
| 244 |
+
template <class Ty> struct remove_volatile {typedef Ty type;};
|
| 245 |
+
template <class Ty> struct remove_volatile<volatile Ty> {typedef Ty type;};
|
| 246 |
+
|
| 247 |
+
template <class Ty> struct remove_cv {typedef typename details::templates::remove_volatile<typename details::templates::remove_const<Ty>::type>::type type;};
|
| 248 |
+
|
| 249 |
+
template <class Ty>
|
| 250 |
+
using remove_cv_t = typename details::templates::remove_cv<Ty>::type;
|
| 251 |
+
|
| 252 |
+
template <class Ty>
|
| 253 |
+
_CG_QUALIFIER Ty&& forward(remove_reference_t<Ty> &t) noexcept {
|
| 254 |
+
return static_cast<Ty&&>(t);
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
template <class Ty>
|
| 258 |
+
_CG_QUALIFIER Ty&& forward(remove_reference_t<Ty> &&t) noexcept {
|
| 259 |
+
static_assert(!details::templates::is_lvalue_reference<Ty>::value, "Forwarding an rvalue as an lvalue is not allowed.");
|
| 260 |
+
return static_cast<Ty&&>(t);
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
/**
|
| 264 |
+
* is_integral
|
| 265 |
+
**/
|
| 266 |
+
template <class Ty> struct _is_integral : public details::templates::false_type {};
|
| 267 |
+
template <> struct _is_integral<bool> : public details::templates::true_type {};
|
| 268 |
+
template <> struct _is_integral<char> : public details::templates::true_type {};
|
| 269 |
+
template <> struct _is_integral<unsigned char> : public details::templates::true_type {};
|
| 270 |
+
template <> struct _is_integral<short> : public details::templates::true_type {};
|
| 271 |
+
template <> struct _is_integral<unsigned short> : public details::templates::true_type {};
|
| 272 |
+
template <> struct _is_integral<int> : public details::templates::true_type {};
|
| 273 |
+
template <> struct _is_integral<unsigned int> : public details::templates::true_type {};
|
| 274 |
+
template <> struct _is_integral<long> : public details::templates::true_type {};
|
| 275 |
+
template <> struct _is_integral<long long> : public details::templates::true_type {};
|
| 276 |
+
template <> struct _is_integral<unsigned long> : public details::templates::true_type {};
|
| 277 |
+
template <> struct _is_integral<unsigned long long> : public details::templates::true_type {};
|
| 278 |
+
//Vector type support?
|
| 279 |
+
|
| 280 |
+
template <typename Ty>
|
| 281 |
+
struct is_integral : public details::templates::_is_integral<typename details::templates::remove_cv<Ty>::type> {};
|
| 282 |
+
|
| 283 |
+
/**
|
| 284 |
+
* is_floating_point
|
| 285 |
+
**/
|
| 286 |
+
template <class Ty> struct _is_floating_point : public details::templates::false_type {};
|
| 287 |
+
template <> struct _is_floating_point<float> : public details::templates::true_type {};
|
| 288 |
+
template <> struct _is_floating_point<double> : public details::templates::true_type {};
|
| 289 |
+
template <> struct _is_floating_point<long double> : public details::templates::true_type {};
|
| 290 |
+
# ifdef __CUDA_FP16_TYPES_EXIST__
|
| 291 |
+
template <> struct _is_floating_point<__half> : public details::templates::true_type {};
|
| 292 |
+
template <> struct _is_floating_point<__half2> : public details::templates::true_type {};
|
| 293 |
+
# endif
|
| 294 |
+
//Vector type support?
|
| 295 |
+
|
| 296 |
+
template <typename Ty>
|
| 297 |
+
struct is_floating_point : public details::templates::_is_floating_point<typename details::templates::remove_cv<Ty>::type> {};
|
| 298 |
+
|
| 299 |
+
template <class T>
|
| 300 |
+
struct is_arithmetic : details::templates::integral_constant<
|
| 301 |
+
bool,
|
| 302 |
+
details::templates::is_integral<T>::value ||
|
| 303 |
+
details::templates::is_floating_point<T>::value> {};
|
| 304 |
+
|
| 305 |
+
template <typename Ty, bool = details::templates::is_arithmetic<Ty>::value>
|
| 306 |
+
struct _is_unsigned : details::templates::integral_constant<bool, Ty(0) < Ty(-1)> {};
|
| 307 |
+
|
| 308 |
+
template <typename Ty>
|
| 309 |
+
struct _is_unsigned<Ty,false> : details::templates::false_type {};
|
| 310 |
+
|
| 311 |
+
template <typename Ty>
|
| 312 |
+
struct is_unsigned : _is_unsigned<typename details::templates::remove_cv<Ty>::type> {};
|
| 313 |
+
|
| 314 |
+
template <typename Ty> struct _is_pointer : public details::templates::false_type {};
|
| 315 |
+
template <typename Ty> struct _is_pointer<Ty*> : public details::templates::true_type {};
|
| 316 |
+
|
| 317 |
+
template <typename Ty>
|
| 318 |
+
struct is_pointer : _is_pointer<typename details::templates::remove_cv<Ty>::type> {};
|
| 319 |
+
|
| 320 |
+
/**
|
| 321 |
+
* programmatic type traits
|
| 322 |
+
**/
|
| 323 |
+
template<bool B, class Ty = void>
|
| 324 |
+
struct enable_if {};
|
| 325 |
+
|
| 326 |
+
template<class Ty>
|
| 327 |
+
struct enable_if<true, Ty> { typedef Ty type; };
|
| 328 |
+
|
| 329 |
+
template<bool Cond, typename Ty = void>
|
| 330 |
+
using enable_if_t = typename details::templates::enable_if<Cond, Ty>::type;
|
| 331 |
+
|
| 332 |
+
template<class Ty1, class Ty2>
|
| 333 |
+
struct is_same : details::templates::false_type {};
|
| 334 |
+
|
| 335 |
+
template<class Ty>
|
| 336 |
+
struct is_same<Ty, Ty> : details::templates::true_type {};
|
| 337 |
+
|
| 338 |
+
} // templates
|
| 339 |
+
#endif // _CG_CPP11_FEATURES
|
| 340 |
+
|
| 341 |
+
} // details
|
| 342 |
+
_CG_END_NAMESPACE
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
#endif // _CG_INFO_H_
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/invoke.h
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2022 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef _CG_INVOKE_H
|
| 51 |
+
#define _CG_INVOKE_H
|
| 52 |
+
|
| 53 |
+
#include "info.h"
|
| 54 |
+
#include "helpers.h"
|
| 55 |
+
|
| 56 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 57 |
+
|
| 58 |
+
_CG_BEGIN_NAMESPACE
|
| 59 |
+
|
| 60 |
+
namespace details {
|
| 61 |
+
|
| 62 |
+
template <typename Group>
|
| 63 |
+
struct _elect_group_supported : _CG_STL_NAMESPACE::false_type {};
|
| 64 |
+
#ifdef _CG_HAS_INSTR_ELECT
|
| 65 |
+
template<>
|
| 66 |
+
struct _elect_group_supported<coalesced_group> : _CG_STL_NAMESPACE::true_type {};
|
| 67 |
+
template<unsigned int Size, typename Parent>
|
| 68 |
+
struct _elect_group_supported<thread_block_tile<Size, Parent>> :
|
| 69 |
+
_CG_STL_NAMESPACE::integral_constant<bool, (Size <= 32)> {};
|
| 70 |
+
#endif
|
| 71 |
+
|
| 72 |
+
template <typename Group>
|
| 73 |
+
struct elect_group_supported : public _elect_group_supported<details::remove_qual<Group>> {};
|
| 74 |
+
|
| 75 |
+
template<typename Group>
|
| 76 |
+
_CG_STATIC_QUALIFIER bool elect_one(const Group& group, unsigned int mask, unsigned int& leader_lane) {
|
| 77 |
+
int is_leader = 0;
|
| 78 |
+
#ifdef _CG_HAS_INSTR_ELECT
|
| 79 |
+
asm("{\n\t"
|
| 80 |
+
" .reg .pred p;\n\t"
|
| 81 |
+
" elect.sync %0|p, %2;\n\t"
|
| 82 |
+
" @p mov.s32 %1, 1;\n\t"
|
| 83 |
+
"}"
|
| 84 |
+
: "+r"(leader_lane), "+r"(is_leader) : "r" (mask));
|
| 85 |
+
#endif
|
| 86 |
+
return is_leader;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
template<bool UseElect>
|
| 90 |
+
struct invoke_one_impl {};
|
| 91 |
+
|
| 92 |
+
template<>
|
| 93 |
+
struct invoke_one_impl<true> {
|
| 94 |
+
template<typename Group, typename Fn, typename... Args>
|
| 95 |
+
_CG_STATIC_QUALIFIER void invoke_one(const Group& group, Fn&& fn, Args&&... args) {
|
| 96 |
+
auto mask = details::_coalesced_group_data_access::get_mask(group);
|
| 97 |
+
unsigned int leader_lane = 0;
|
| 98 |
+
|
| 99 |
+
if (elect_one(group, mask, leader_lane)) {
|
| 100 |
+
_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
template<typename Group, typename Fn, typename... Args>
|
| 105 |
+
_CG_STATIC_QUALIFIER auto invoke_one_broadcast(const Group& group, Fn&& fn, Args&&... args)
|
| 106 |
+
-> typename _CG_STL_NAMESPACE::remove_reference<
|
| 107 |
+
decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...))>::type {
|
| 108 |
+
|
| 109 |
+
using ResultType = decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...));
|
| 110 |
+
details::remove_qual<ResultType> result;
|
| 111 |
+
auto mask = details::_coalesced_group_data_access::get_mask(group);
|
| 112 |
+
unsigned int leader_lane = 0;
|
| 113 |
+
|
| 114 |
+
if (elect_one(group, mask, leader_lane)) {
|
| 115 |
+
result = _CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
// Need to use low level api instead of group.shfl, because elect_one returns lane id, not group rank.
|
| 119 |
+
return tile::shuffle_dispatch<ResultType>::shfl(result, mask, leader_lane, 32);
|
| 120 |
+
}
|
| 121 |
+
};
|
| 122 |
+
|
| 123 |
+
template<>
|
| 124 |
+
struct invoke_one_impl<false> {
|
| 125 |
+
template<typename Group, typename Fn, typename... Args>
|
| 126 |
+
_CG_STATIC_QUALIFIER void invoke_one(const Group& group, Fn&& fn, Args&&... args) {
|
| 127 |
+
if (group.thread_rank() == 0) {
|
| 128 |
+
_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
template<typename Group, typename Fn, typename... Args>
|
| 133 |
+
_CG_STATIC_QUALIFIER auto invoke_one_broadcast(const Group& group, Fn&& fn, Args&&... args)
|
| 134 |
+
-> typename _CG_STL_NAMESPACE::remove_reference<
|
| 135 |
+
decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...))>::type {
|
| 136 |
+
|
| 137 |
+
using ResultType = decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...));
|
| 138 |
+
details::remove_qual<ResultType> result;
|
| 139 |
+
|
| 140 |
+
if (group.thread_rank() == 0) {
|
| 141 |
+
result = _CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
return group.shfl(result, 0);
|
| 145 |
+
}
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
}; // namespace details
|
| 150 |
+
|
| 151 |
+
template<typename Group, typename Fn, typename... Args>
|
| 152 |
+
_CG_QUALIFIER void invoke_one(const Group& group, Fn&& fn, Args&&... args) {
|
| 153 |
+
using impl = details::invoke_one_impl<details::elect_group_supported<Group>::value>;
|
| 154 |
+
impl::invoke_one(group, _CG_STL_NAMESPACE::forward<Fn>(fn), _CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
template<typename Fn, typename... Args>
|
| 158 |
+
_CG_QUALIFIER auto invoke_one_broadcast(const coalesced_group& group, Fn&& fn, Args&&... args)
|
| 159 |
+
-> typename _CG_STL_NAMESPACE::remove_reference<
|
| 160 |
+
decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...))>::type {
|
| 161 |
+
|
| 162 |
+
using ResultType = decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...));
|
| 163 |
+
static_assert(!_CG_STL_NAMESPACE::is_same<ResultType, void>::value,
|
| 164 |
+
"For invocables returning void invoke_one should be used instead");
|
| 165 |
+
using impl = details::invoke_one_impl<details::elect_group_supported<coalesced_group>::value>;
|
| 166 |
+
return impl::invoke_one_broadcast(group,
|
| 167 |
+
_CG_STL_NAMESPACE::forward<Fn>(fn),
|
| 168 |
+
_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
template<unsigned int Size, typename Parent, typename Fn, typename... Args>
|
| 172 |
+
_CG_QUALIFIER auto invoke_one_broadcast(const thread_block_tile<Size, Parent>& group, Fn&& fn, Args&&... args)
|
| 173 |
+
-> typename _CG_STL_NAMESPACE::remove_reference<
|
| 174 |
+
decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...))>::type {
|
| 175 |
+
|
| 176 |
+
using ResultType = decltype(_CG_STL_NAMESPACE::forward<Fn>(fn)(_CG_STL_NAMESPACE::forward<Args>(args)...));
|
| 177 |
+
static_assert(!_CG_STL_NAMESPACE::is_same<ResultType, void>::value,
|
| 178 |
+
"For invocables returning void invoke_one should be used instead");
|
| 179 |
+
using impl = details::invoke_one_impl<details::elect_group_supported<thread_block_tile<Size, Parent>>::value>;
|
| 180 |
+
return impl::invoke_one_broadcast(group,
|
| 181 |
+
_CG_STL_NAMESPACE::forward<Fn>(fn),
|
| 182 |
+
_CG_STL_NAMESPACE::forward<Args>(args)...);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
_CG_END_NAMESPACE
|
| 186 |
+
|
| 187 |
+
#endif //_CG_CPP11_FEATURES
|
| 188 |
+
|
| 189 |
+
#endif // _CG_INVOKE_H
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/memory.h
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2022 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _COOPERATIVE_GROUPS_MEMORY_H_
|
| 50 |
+
# define _COOPERATIVE_GROUPS_MEMORY_H_
|
| 51 |
+
|
| 52 |
+
#include "info.h"
|
| 53 |
+
|
| 54 |
+
_CG_BEGIN_NAMESPACE
|
| 55 |
+
|
| 56 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 57 |
+
namespace details {
|
| 58 |
+
_CG_STATIC_CONST_DECL int scratch_num_reserved_bytes = 12;
|
| 59 |
+
|
| 60 |
+
// Should only be called for SM80+
|
| 61 |
+
_CG_STATIC_QUALIFIER void* reserved_shared_ptr()
|
| 62 |
+
{
|
| 63 |
+
unsigned long long ptr = 0;
|
| 64 |
+
NV_IF_TARGET(NV_PROVIDES_SM_80,
|
| 65 |
+
(asm ("{\n\t"
|
| 66 |
+
" .reg .u32 start;\n\t"
|
| 67 |
+
" .reg .u64 extended;\n\t"
|
| 68 |
+
" mov.u32 start, %%reserved_smem_offset_1;\n\t"
|
| 69 |
+
" cvt.u64.u32 extended, start;\n\t"
|
| 70 |
+
" cvta.shared.u64 %0, extended;\n\t"
|
| 71 |
+
"}"
|
| 72 |
+
: "=l"(ptr));)
|
| 73 |
+
)
|
| 74 |
+
return reinterpret_cast<void*>(ptr);
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
struct multi_warp_scratch {
|
| 78 |
+
// One barrier per possible size of the group.
|
| 79 |
+
_CG_STATIC_CONST_DECL unsigned int memory_barriers_count = 5;
|
| 80 |
+
_CG_STATIC_CONST_DECL size_t sync_memory_size = memory_barriers_count * sizeof(barrier_t);
|
| 81 |
+
|
| 82 |
+
using communication_type = unsigned long long;
|
| 83 |
+
_CG_STATIC_CONST_DECL size_t communication_size = sizeof(communication_type);
|
| 84 |
+
|
| 85 |
+
// Layout of the scratch space:
|
| 86 |
+
barrier_t barriers[memory_barriers_count];
|
| 87 |
+
char reserved[scratch_num_reserved_bytes]; // Reserve 12 bytes for future use
|
| 88 |
+
communication_type communication_memory[default_max_block_size / 32];
|
| 89 |
+
|
| 90 |
+
_CG_STATIC_CONSTEXPR_QUALIFIER unsigned int scratch_size_needed(unsigned int max_block_size) {
|
| 91 |
+
// One slot of collectives memory per warp.
|
| 92 |
+
return scratch_num_reserved_bytes + (unsigned int)sync_memory_size + max_block_size / 32 * (unsigned int)communication_size;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
_CG_QUALIFIER void init_barriers(unsigned int thread_rank) {
|
| 96 |
+
if (thread_rank < memory_barriers_count) {
|
| 97 |
+
barriers[thread_rank] = 0;
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
};
|
| 101 |
+
|
| 102 |
+
#if defined(_CG_HAS_RESERVED_SHARED)
|
| 103 |
+
// CG can expect at least 288 bytes available in reserved shared
|
| 104 |
+
static_assert(sizeof(multi_warp_scratch) <= 288, "multi-warp scratch size is too large");
|
| 105 |
+
#endif
|
| 106 |
+
|
| 107 |
+
// Make sure the structure can fit into the user provided memory
|
| 108 |
+
static_assert(sizeof(multi_warp_scratch) <= multi_warp_scratch::scratch_size_needed(default_max_block_size),
|
| 109 |
+
"multi-warp scratch size is too large");
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
_CG_QUALIFIER multi_warp_scratch* get_scratch_ptr(void* user_scratch) {
|
| 113 |
+
void *ptr;
|
| 114 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80,
|
| 115 |
+
(ptr = reserved_shared_ptr();)
|
| 116 |
+
,
|
| 117 |
+
(ptr = user_scratch;)
|
| 118 |
+
)
|
| 119 |
+
return static_cast<multi_warp_scratch*>(ptr);
|
| 120 |
+
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
template <unsigned int MaxBlockSize = details::default_max_block_size>
|
| 126 |
+
struct __align__(details::multi_warp_scratch::communication_size) block_tile_memory {
|
| 127 |
+
private:
|
| 128 |
+
#if !defined(_CG_HAS_RESERVED_SHARED)
|
| 129 |
+
char scratch[details::multi_warp_scratch::scratch_size_needed(MaxBlockSize)];
|
| 130 |
+
#endif
|
| 131 |
+
};
|
| 132 |
+
#endif
|
| 133 |
+
|
| 134 |
+
_CG_END_NAMESPACE
|
| 135 |
+
|
| 136 |
+
#endif /* !_COOPERATIVE_GROUPS_MEMORY_H_ */
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/partitioning.h
ADDED
|
@@ -0,0 +1,160 @@
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3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef _CG_PARTITIONING_H
|
| 51 |
+
#define _CG_PARTITIONING_H
|
| 52 |
+
|
| 53 |
+
#include "info.h"
|
| 54 |
+
#include "helpers.h"
|
| 55 |
+
|
| 56 |
+
_CG_BEGIN_NAMESPACE
|
| 57 |
+
|
| 58 |
+
namespace details {
|
| 59 |
+
|
| 60 |
+
template <typename TyGroup>
|
| 61 |
+
_CG_STATIC_QUALIFIER coalesced_group _binary_partition(const TyGroup &tile, bool pred) {
|
| 62 |
+
const unsigned int fullMask = ~0u;
|
| 63 |
+
|
| 64 |
+
unsigned int thisMask = _coalesced_group_data_access::get_mask(tile);
|
| 65 |
+
unsigned int predMask = pred ? 0 : fullMask;
|
| 66 |
+
unsigned int setMask = __ballot_sync(thisMask, pred);
|
| 67 |
+
|
| 68 |
+
if (setMask == thisMask || setMask == 0) {
|
| 69 |
+
coalesced_group subTile = _coalesced_group_data_access::construct_from_mask<coalesced_group>(thisMask);
|
| 70 |
+
_coalesced_group_data_access::modify_meta_group(subTile, 0, 1);
|
| 71 |
+
return subTile;
|
| 72 |
+
}
|
| 73 |
+
else {
|
| 74 |
+
unsigned int subMask = thisMask & (setMask ^ predMask);
|
| 75 |
+
coalesced_group subTile = _coalesced_group_data_access::construct_from_mask<coalesced_group>(subMask);
|
| 76 |
+
_coalesced_group_data_access::modify_meta_group(subTile, pred, 2);
|
| 77 |
+
return subTile;
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
#if defined(_CG_HAS_MATCH_COLLECTIVE) && defined(_CG_CPP11_FEATURES)
|
| 82 |
+
template <typename TyPredicate>
|
| 83 |
+
struct _labeled_partition_dispatch {
|
| 84 |
+
template <typename TyGroup>
|
| 85 |
+
_CG_QUALIFIER coalesced_group operator()(const TyGroup &tile, TyPredicate pred) {
|
| 86 |
+
unsigned int thisMask = _coalesced_group_data_access::get_mask(tile);
|
| 87 |
+
unsigned int subMask = __match_any_sync(thisMask, pred);
|
| 88 |
+
unsigned int laneId = details::laneid();
|
| 89 |
+
|
| 90 |
+
coalesced_group subTile = _coalesced_group_data_access::construct_from_mask<coalesced_group>(subMask);
|
| 91 |
+
|
| 92 |
+
int leaderLaneId = __ffs(subMask) - 1;
|
| 93 |
+
bool isLeader = leaderLaneId == laneId;
|
| 94 |
+
unsigned int leaderMask = __ballot_sync(thisMask, isLeader);
|
| 95 |
+
|
| 96 |
+
// Count leaders with lower laneid, that will be the meta rank of this tile
|
| 97 |
+
unsigned int tileRank = __popc(leaderMask & ((1 << leaderLaneId) - 1));
|
| 98 |
+
|
| 99 |
+
_coalesced_group_data_access::modify_meta_group(subTile, tileRank, __popc(leaderMask));
|
| 100 |
+
|
| 101 |
+
return subTile;
|
| 102 |
+
}
|
| 103 |
+
};
|
| 104 |
+
|
| 105 |
+
template <>
|
| 106 |
+
struct _labeled_partition_dispatch<bool> {
|
| 107 |
+
template <typename TyGroup>
|
| 108 |
+
_CG_QUALIFIER coalesced_group operator()(const TyGroup &tile, bool pred) {
|
| 109 |
+
return _binary_partition(tile, pred);
|
| 110 |
+
}
|
| 111 |
+
};
|
| 112 |
+
|
| 113 |
+
template <typename TyPredicate>
|
| 114 |
+
struct _labeled_partition_dispatch<TyPredicate*> {
|
| 115 |
+
template <typename TyGroup>
|
| 116 |
+
_CG_QUALIFIER coalesced_group operator()(const TyGroup &tile, TyPredicate* pred) {
|
| 117 |
+
auto impl = _labeled_partition_dispatch<unsigned long long>();
|
| 118 |
+
return impl(tile, reinterpret_cast<unsigned long long>(pred));
|
| 119 |
+
}
|
| 120 |
+
};
|
| 121 |
+
#endif
|
| 122 |
+
}; // namespace details
|
| 123 |
+
|
| 124 |
+
_CG_STATIC_QUALIFIER coalesced_group binary_partition(const coalesced_group &tile, bool pred) {
|
| 125 |
+
return details::_binary_partition(tile, pred);
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
template <unsigned int Size, typename ParentT>
|
| 129 |
+
_CG_STATIC_QUALIFIER coalesced_group binary_partition(const thread_block_tile<Size, ParentT> &tile, bool pred) {
|
| 130 |
+
#ifdef _CG_CPP11_FEATURES
|
| 131 |
+
static_assert(Size <= 32, "Binary partition is available only for tiles of size smaller or equal to 32");
|
| 132 |
+
#endif
|
| 133 |
+
return details::_binary_partition(tile, pred);
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
#if defined(_CG_HAS_MATCH_COLLECTIVE) && defined(_CG_CPP11_FEATURES)
|
| 138 |
+
template <typename TyPredicate>
|
| 139 |
+
_CG_STATIC_QUALIFIER coalesced_group labeled_partition(const coalesced_group &tile, TyPredicate pred) {
|
| 140 |
+
static_assert(_CG_STL_NAMESPACE::is_integral<TyPredicate>::value ||
|
| 141 |
+
_CG_STL_NAMESPACE::is_pointer<TyPredicate>::value,
|
| 142 |
+
"labeled_partition predicate must be an integral or pointer type");
|
| 143 |
+
auto dispatch = details::_labeled_partition_dispatch<details::remove_qual<TyPredicate>>();
|
| 144 |
+
return dispatch(tile, pred);
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
template <typename TyPredicate, unsigned int Size, typename ParentT>
|
| 148 |
+
_CG_STATIC_QUALIFIER coalesced_group labeled_partition(const thread_block_tile<Size, ParentT> &tile, TyPredicate pred) {
|
| 149 |
+
static_assert(_CG_STL_NAMESPACE::is_integral<TyPredicate>::value ||
|
| 150 |
+
_CG_STL_NAMESPACE::is_pointer<TyPredicate>::value,
|
| 151 |
+
"labeled_partition predicate must be an integral or pointer type");
|
| 152 |
+
static_assert(Size <= 32, "Labeled partition is available only for tiles of size smaller or equal to 32");
|
| 153 |
+
auto dispatch = details::_labeled_partition_dispatch<details::remove_qual<TyPredicate>>();
|
| 154 |
+
return dispatch(tile, pred);
|
| 155 |
+
}
|
| 156 |
+
#endif
|
| 157 |
+
|
| 158 |
+
_CG_END_NAMESPACE
|
| 159 |
+
|
| 160 |
+
#endif // _CG_PARTITIONING_H
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/reduce.h
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _CG_REDUCE_H_
|
| 50 |
+
#define _CG_REDUCE_H_
|
| 51 |
+
|
| 52 |
+
#include "info.h"
|
| 53 |
+
#include "helpers.h"
|
| 54 |
+
#include "coalesced_reduce.h"
|
| 55 |
+
#include "functional.h"
|
| 56 |
+
#include "cooperative_groups.h"
|
| 57 |
+
|
| 58 |
+
_CG_BEGIN_NAMESPACE
|
| 59 |
+
|
| 60 |
+
namespace details {
|
| 61 |
+
|
| 62 |
+
template <class Ty>
|
| 63 |
+
using _redux_is_add_supported = _CG_STL_NAMESPACE::integral_constant<
|
| 64 |
+
bool,
|
| 65 |
+
_CG_STL_NAMESPACE::is_integral<Ty>::value && (sizeof(Ty) <= 4)>;
|
| 66 |
+
|
| 67 |
+
template <class Ty>
|
| 68 |
+
using redux_is_add_supported = _redux_is_add_supported<Ty>;
|
| 69 |
+
|
| 70 |
+
// A specialization for 64 bit logical operations is possible
|
| 71 |
+
// but for now only accelerate 32 bit bitwise ops
|
| 72 |
+
template <class Ty>
|
| 73 |
+
using redux_is_logical_supported = redux_is_add_supported<Ty>;
|
| 74 |
+
|
| 75 |
+
// Base operator support case
|
| 76 |
+
template <class TyOp, class Ty> struct _redux_op_supported : public _CG_STL_NAMESPACE::false_type {};
|
| 77 |
+
template <class Ty> struct _redux_op_supported<cooperative_groups::plus<Ty>, Ty> : public redux_is_add_supported<Ty> {};
|
| 78 |
+
template <class Ty> struct _redux_op_supported<cooperative_groups::less<Ty>, Ty> : public redux_is_add_supported<Ty> {};
|
| 79 |
+
template <class Ty> struct _redux_op_supported<cooperative_groups::greater<Ty>, Ty> : public redux_is_add_supported<Ty> {};
|
| 80 |
+
template <class Ty> struct _redux_op_supported<cooperative_groups::bit_and<Ty>, Ty> : public redux_is_logical_supported<Ty> {};
|
| 81 |
+
template <class Ty> struct _redux_op_supported<cooperative_groups::bit_or<Ty>, Ty> : public redux_is_logical_supported<Ty> {};
|
| 82 |
+
template <class Ty> struct _redux_op_supported<cooperative_groups::bit_xor<Ty>, Ty> : public redux_is_logical_supported<Ty> {};
|
| 83 |
+
|
| 84 |
+
template <class Ty, template <class> class TyOp>
|
| 85 |
+
using redux_op_supported = _redux_op_supported<
|
| 86 |
+
typename details::remove_qual<TyOp<Ty>>,
|
| 87 |
+
Ty>;
|
| 88 |
+
|
| 89 |
+
// Groups smaller than 16 actually have worse performance characteristics when used with redux
|
| 90 |
+
// tiles of size 16 and 32 perform the same or better and have better code generation profiles
|
| 91 |
+
template <class TyGroup> struct _redux_group_optimized : public _CG_STL_NAMESPACE::false_type {};
|
| 92 |
+
|
| 93 |
+
template <unsigned int Sz, typename TyPar>
|
| 94 |
+
struct _redux_group_optimized<cooperative_groups::thread_block_tile<Sz, TyPar>> : public _CG_STL_NAMESPACE::integral_constant<
|
| 95 |
+
bool,
|
| 96 |
+
(Sz >= 16)> {};
|
| 97 |
+
template <unsigned int Sz, typename TyPar>
|
| 98 |
+
struct _redux_group_optimized<internal_thread_block_tile<Sz, TyPar>> : public _CG_STL_NAMESPACE::integral_constant<
|
| 99 |
+
bool,
|
| 100 |
+
(Sz >= 16)> {};
|
| 101 |
+
template <>
|
| 102 |
+
struct _redux_group_optimized<cooperative_groups::coalesced_group> : public _CG_STL_NAMESPACE::true_type {};
|
| 103 |
+
|
| 104 |
+
template <typename TyGroup>
|
| 105 |
+
using redux_group_optimized = _redux_group_optimized<details::remove_qual<TyGroup>>;
|
| 106 |
+
|
| 107 |
+
template <template <class> class TyOp>
|
| 108 |
+
_CG_STATIC_QUALIFIER int pick_redux(int mask, int val);
|
| 109 |
+
template <template <class> class TyOp>
|
| 110 |
+
_CG_STATIC_QUALIFIER unsigned int pick_redux(int mask, unsigned int val);
|
| 111 |
+
|
| 112 |
+
template <> _CG_QUALIFIER int pick_redux<cooperative_groups::plus>(int mask, int val) {
|
| 113 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return __reduce_add_sync(mask, val);), return 0;)
|
| 114 |
+
}
|
| 115 |
+
template <> _CG_QUALIFIER int pick_redux<cooperative_groups::less>(int mask, int val) {
|
| 116 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return __reduce_min_sync(mask, val);), return 0;)
|
| 117 |
+
}
|
| 118 |
+
template <> _CG_QUALIFIER int pick_redux<cooperative_groups::greater>(int mask, int val) {
|
| 119 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return __reduce_max_sync(mask, val);), return 0;)
|
| 120 |
+
}
|
| 121 |
+
template <> _CG_QUALIFIER int pick_redux<cooperative_groups::bit_and>(int mask, int val) {
|
| 122 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return static_cast<int>(__reduce_and_sync(mask, val));), return 0;)
|
| 123 |
+
}
|
| 124 |
+
template <> _CG_QUALIFIER int pick_redux<cooperative_groups::bit_xor>(int mask, int val) {
|
| 125 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return static_cast<int>(__reduce_xor_sync(mask, val));), return 0;)
|
| 126 |
+
}
|
| 127 |
+
template <> _CG_QUALIFIER int pick_redux<cooperative_groups::bit_or>(int mask, int val) {
|
| 128 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return static_cast<int>(__reduce_or_sync(mask, val));), return 0;)
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
template <> _CG_QUALIFIER unsigned int pick_redux<cooperative_groups::plus>(int mask, unsigned int val) {
|
| 132 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return __reduce_add_sync(mask, val);), return 0;)
|
| 133 |
+
}
|
| 134 |
+
template <> _CG_QUALIFIER unsigned int pick_redux<cooperative_groups::less>(int mask, unsigned int val) {
|
| 135 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return __reduce_min_sync(mask, val);), return 0;)
|
| 136 |
+
}
|
| 137 |
+
template <> _CG_QUALIFIER unsigned int pick_redux<cooperative_groups::greater>(int mask, unsigned int val) {
|
| 138 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return __reduce_max_sync(mask, val);), return 0;)
|
| 139 |
+
}
|
| 140 |
+
template <> _CG_QUALIFIER unsigned int pick_redux<cooperative_groups::bit_and>(int mask, unsigned int val) {
|
| 141 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return __reduce_and_sync(mask, val);), return 0;)
|
| 142 |
+
}
|
| 143 |
+
template <> _CG_QUALIFIER unsigned int pick_redux<cooperative_groups::bit_xor>(int mask, unsigned int val) {
|
| 144 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return __reduce_xor_sync(mask, val);), return 0;)
|
| 145 |
+
}
|
| 146 |
+
template <> _CG_QUALIFIER unsigned int pick_redux<cooperative_groups::bit_or>(int mask, unsigned int val) {
|
| 147 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80, (return __reduce_or_sync(mask, val);), return 0;)
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
template <typename TyVal, bool = _CG_STL_NAMESPACE::is_unsigned<TyVal>::value>
|
| 151 |
+
struct _accelerated_op;
|
| 152 |
+
|
| 153 |
+
// Signed type redux intrinsic dispatch
|
| 154 |
+
template <typename TyVal>
|
| 155 |
+
struct _accelerated_op<TyVal, false> {
|
| 156 |
+
template <template <class> class TyOp>
|
| 157 |
+
_CG_STATIC_QUALIFIER TyVal redux(int mask, TyVal val) {
|
| 158 |
+
return static_cast<TyVal>(pick_redux<TyOp>(mask, static_cast<int>(val)));
|
| 159 |
+
}
|
| 160 |
+
};
|
| 161 |
+
|
| 162 |
+
// Unsigned type redux intrinsic dispatch
|
| 163 |
+
template <typename TyVal>
|
| 164 |
+
struct _accelerated_op<TyVal, true> {
|
| 165 |
+
template <template <class> class TyOp>
|
| 166 |
+
_CG_STATIC_QUALIFIER TyVal redux(int mask, TyVal val) {
|
| 167 |
+
return static_cast<TyVal>(pick_redux<TyOp>(mask, static_cast<unsigned int>(val)));
|
| 168 |
+
}
|
| 169 |
+
};
|
| 170 |
+
|
| 171 |
+
template <typename TyVal>
|
| 172 |
+
using accelerated_op = _accelerated_op<TyVal>;
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
template <typename TyVal, typename TyFnInput, typename TyGroup>
|
| 176 |
+
class _redux_dispatch {
|
| 177 |
+
template <class Ty, template <class> class TyOp>
|
| 178 |
+
using _redux_is_usable = _CG_STL_NAMESPACE::integral_constant<bool,
|
| 179 |
+
redux_op_supported<Ty, TyOp>::value &&
|
| 180 |
+
redux_group_optimized<TyGroup>::value>;
|
| 181 |
+
|
| 182 |
+
template <class Ty, template <class> class TyOp>
|
| 183 |
+
using redux_is_usable = typename _CG_STL_NAMESPACE::enable_if<_redux_is_usable<Ty, TyOp>::value, void>::type*;
|
| 184 |
+
|
| 185 |
+
template <class Ty, template <class> class TyOp>
|
| 186 |
+
using redux_is_not_usable = typename _CG_STL_NAMESPACE::enable_if<!_redux_is_usable<Ty, TyOp>::value, void>::type*;
|
| 187 |
+
|
| 188 |
+
public:
|
| 189 |
+
// Dispatch to redux if the combination of op and args are supported
|
| 190 |
+
template<
|
| 191 |
+
template <class> class TyOp,
|
| 192 |
+
redux_is_usable<TyFnInput, TyOp> = nullptr>
|
| 193 |
+
_CG_STATIC_QUALIFIER auto reduce(const TyGroup& group, TyVal&& val, TyOp<TyFnInput>&& op) -> decltype(op(val, val)) {
|
| 194 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80,
|
| 195 |
+
// Retrieve the mask for the group and dispatch to redux
|
| 196 |
+
return accelerated_op<TyFnInput>::template redux<TyOp>(_coalesced_group_data_access::get_mask(group), _CG_STL_NAMESPACE::forward<TyVal>(val));
|
| 197 |
+
,
|
| 198 |
+
// Arch does not support redux, fallback to shuffles
|
| 199 |
+
return coalesced_reduce(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp<TyFnInput>>(op));
|
| 200 |
+
)
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
template<
|
| 204 |
+
template <class> class TyOp,
|
| 205 |
+
redux_is_usable<TyFnInput, TyOp> = nullptr>
|
| 206 |
+
_CG_STATIC_QUALIFIER auto reduce(const TyGroup& group, TyVal&& val, TyOp<TyFnInput>& op) -> decltype(op(val, val)) {
|
| 207 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_80,
|
| 208 |
+
// Retrieve the mask for the group and dispatch to redux
|
| 209 |
+
return accelerated_op<TyFnInput>::template redux<TyOp>(_coalesced_group_data_access::get_mask(group), _CG_STL_NAMESPACE::forward<TyVal>(val));
|
| 210 |
+
,
|
| 211 |
+
// Arch does not support redux, fallback to shuffles
|
| 212 |
+
return coalesced_reduce(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp<TyFnInput>>(op));
|
| 213 |
+
)
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
// Fallback shuffle sync reduction
|
| 217 |
+
template <
|
| 218 |
+
template <class> class TyOp,
|
| 219 |
+
redux_is_not_usable<TyFnInput, TyOp> = nullptr>
|
| 220 |
+
_CG_STATIC_QUALIFIER auto reduce(const TyGroup& group, TyVal&& val, TyOp<TyFnInput>&& op) -> decltype(op(val, val)) {
|
| 221 |
+
//Dispatch to fallback shuffle sync accelerated reduction
|
| 222 |
+
return coalesced_reduce(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp<TyFnInput>>(op));
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
};
|
| 226 |
+
|
| 227 |
+
// Group support for reduce.
|
| 228 |
+
template <class TyGroup> struct _reduce_group_supported : public _CG_STL_NAMESPACE::false_type {};
|
| 229 |
+
|
| 230 |
+
template <unsigned int Sz, typename TyPar>
|
| 231 |
+
struct _reduce_group_supported<cooperative_groups::thread_block_tile<Sz, TyPar>> : public _CG_STL_NAMESPACE::true_type {};
|
| 232 |
+
template <unsigned int Sz, typename TyPar>
|
| 233 |
+
struct _reduce_group_supported<internal_thread_block_tile<Sz, TyPar>> : public _CG_STL_NAMESPACE::true_type {};
|
| 234 |
+
template <>
|
| 235 |
+
struct _reduce_group_supported<cooperative_groups::coalesced_group> : public _CG_STL_NAMESPACE::true_type {};
|
| 236 |
+
|
| 237 |
+
template <typename TyGroup>
|
| 238 |
+
using reduce_group_supported = _reduce_group_supported<details::remove_qual<TyGroup>>;
|
| 239 |
+
|
| 240 |
+
template <typename TyVal, typename TyFnInput, template <class> class TyOp, typename TyGroup>
|
| 241 |
+
_CG_QUALIFIER auto reduce(const TyGroup& group, TyVal&& val, TyOp<TyFnInput>&& op) -> decltype(op(val, val)) {
|
| 242 |
+
static_assert(details::is_op_type_same<TyFnInput, TyVal>::value, "Operator and argument types differ");
|
| 243 |
+
|
| 244 |
+
using dispatch = details::_redux_dispatch<TyVal, TyFnInput, TyGroup>;
|
| 245 |
+
return dispatch::reduce(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp<TyFnInput>>(op));
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
template <typename TyVal, typename TyFnInput, template <class> class TyOp, typename TyGroup>
|
| 249 |
+
_CG_QUALIFIER auto reduce(const TyGroup& group, TyVal&& val, TyOp<TyFnInput>& op) -> decltype(op(val, val)) {
|
| 250 |
+
static_assert(details::is_op_type_same<TyFnInput, TyVal>::value, "Operator and argument types differ");
|
| 251 |
+
|
| 252 |
+
using dispatch = details::_redux_dispatch<TyVal, TyFnInput, TyGroup>;
|
| 253 |
+
return dispatch::reduce(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp<TyFnInput>>(op));
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
template <typename TyVal, typename TyOp, typename TyGroup>
|
| 258 |
+
_CG_QUALIFIER auto reduce(const TyGroup& group, TyVal&& val, TyOp&& op) -> decltype(op(val, val)) {
|
| 259 |
+
return details::coalesced_reduce(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyOp>(op));
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
template <unsigned int GroupId>
|
| 263 |
+
struct tile_reduce_dispatch;
|
| 264 |
+
|
| 265 |
+
template <>
|
| 266 |
+
struct tile_reduce_dispatch<details::coalesced_group_id> {
|
| 267 |
+
template <typename TyGroup, typename TyVal, typename TyFn>
|
| 268 |
+
_CG_STATIC_QUALIFIER auto reduce(const TyGroup& group, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 269 |
+
return details::reduce(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 270 |
+
}
|
| 271 |
+
};
|
| 272 |
+
|
| 273 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 274 |
+
template <>
|
| 275 |
+
struct tile_reduce_dispatch<details::multi_tile_group_id> {
|
| 276 |
+
template <unsigned int Size, typename ParentT, typename TyVal, typename TyFn>
|
| 277 |
+
_CG_STATIC_QUALIFIER auto reduce(const thread_block_tile<Size, ParentT>& group, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 278 |
+
using warpType = details::internal_thread_block_tile<32, __static_size_multi_warp_tile_base<Size>>;
|
| 279 |
+
using TyRet = details::remove_qual<TyVal>;
|
| 280 |
+
const unsigned int num_warps = Size / 32;
|
| 281 |
+
|
| 282 |
+
auto warp_lambda = [&] (const warpType& warp, TyRet* warp_scratch_location) {
|
| 283 |
+
*warp_scratch_location =
|
| 284 |
+
details::reduce(warp, _CG_STL_NAMESPACE::forward<TyVal>(val), op);
|
| 285 |
+
};
|
| 286 |
+
auto inter_warp_lambda =
|
| 287 |
+
[&] (const details::internal_thread_block_tile<num_warps, warpType>& subwarp, TyRet* thread_scratch_location) {
|
| 288 |
+
*thread_scratch_location =
|
| 289 |
+
details::reduce(subwarp, *thread_scratch_location, _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 290 |
+
};
|
| 291 |
+
return details::multi_warp_collectives_helper<TyRet>(group, warp_lambda, inter_warp_lambda);
|
| 292 |
+
}
|
| 293 |
+
};
|
| 294 |
+
|
| 295 |
+
template <unsigned int GroupId>
|
| 296 |
+
struct tile_async_reduce_dispatch;
|
| 297 |
+
|
| 298 |
+
template <>
|
| 299 |
+
struct tile_async_reduce_dispatch<details::coalesced_group_id> {
|
| 300 |
+
template <typename GroupT, typename TyDst, typename TyVal, typename TyFn, typename TyResHandler>
|
| 301 |
+
_CG_STATIC_QUALIFIER void reduce(const GroupT& group, TyDst& dst, TyVal&& val, TyFn&& op, TyResHandler& res_handler) {
|
| 302 |
+
// Do regular, in group reduction
|
| 303 |
+
auto result = details::reduce(group, _CG_STL_NAMESPACE::forward<TyVal>(val), op);
|
| 304 |
+
|
| 305 |
+
// One thread stores/updates the destination
|
| 306 |
+
if (group.thread_rank() == 0) {
|
| 307 |
+
res_handler(result);
|
| 308 |
+
}
|
| 309 |
+
}
|
| 310 |
+
};
|
| 311 |
+
|
| 312 |
+
template <>
|
| 313 |
+
struct tile_async_reduce_dispatch<details::multi_tile_group_id> {
|
| 314 |
+
template <unsigned int TySize, typename ParentT, typename TyDst, typename TyInputVal, typename TyFn, typename TyResHandler>
|
| 315 |
+
_CG_STATIC_QUALIFIER void reduce(const thread_block_tile<TySize, ParentT>& group, TyDst& dst, TyInputVal&& val, TyFn&& op, TyResHandler& res_handler) {
|
| 316 |
+
using TyVal = remove_qual<TyInputVal>;
|
| 317 |
+
const unsigned int num_warps = TySize / 32;
|
| 318 |
+
details::barrier_t* sync_location = multi_warp_sync_location_getter(group);
|
| 319 |
+
auto warp_scratch_location = multi_warp_scratch_location_getter<TyVal>(group, group.thread_rank() / 32);
|
| 320 |
+
|
| 321 |
+
// Do in warp reduce
|
| 322 |
+
auto warp = details::tiled_partition_internal<32, thread_block_tile<TySize, ParentT>>();
|
| 323 |
+
*warp_scratch_location = details::reduce(warp, _CG_STL_NAMESPACE::forward<TyInputVal>(val), op);
|
| 324 |
+
|
| 325 |
+
// Tile of size num_warps from the last warp to arrive does final reduction step
|
| 326 |
+
if (details::sync_warps_last_releases(sync_location, details::cta::thread_rank(), num_warps)) {
|
| 327 |
+
auto subwarp = details::tiled_partition_internal<num_warps, decltype(warp)>();
|
| 328 |
+
if (subwarp.meta_group_rank() == 0) {
|
| 329 |
+
auto thread_scratch_location = multi_warp_scratch_location_getter<TyVal>(group, subwarp.thread_rank());
|
| 330 |
+
auto thread_val = *thread_scratch_location;
|
| 331 |
+
// Release other warps, we read their contribution already.
|
| 332 |
+
subwarp.sync();
|
| 333 |
+
details::sync_warps_release(sync_location, subwarp.thread_rank() == 0, details::cta::thread_rank(), num_warps);
|
| 334 |
+
TyVal result = details::reduce(subwarp, thread_val, op);
|
| 335 |
+
// One thread stores the result or updates the atomic
|
| 336 |
+
if (subwarp.thread_rank() == 0) {
|
| 337 |
+
res_handler(result);
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
warp.sync();
|
| 341 |
+
}
|
| 342 |
+
}
|
| 343 |
+
};
|
| 344 |
+
#endif
|
| 345 |
+
|
| 346 |
+
template <typename TyGroup, typename TyInputVal, typename TyRetVal>
|
| 347 |
+
_CG_QUALIFIER void check_reduce_params() {
|
| 348 |
+
static_assert(details::is_op_type_same<TyInputVal, TyRetVal>::value, "Operator input and output types differ");
|
| 349 |
+
static_assert(details::reduce_group_supported<TyGroup>::value, "This group does not exclusively represent a tile");
|
| 350 |
+
};
|
| 351 |
+
|
| 352 |
+
template <typename TyGroup, typename TyDstVal, typename TyInputVal, typename TyRetVal>
|
| 353 |
+
_CG_QUALIFIER void check_async_reduce_params() {
|
| 354 |
+
check_reduce_params<TyGroup, TyInputVal, TyRetVal>();
|
| 355 |
+
static_assert(details::is_op_type_same<TyDstVal, TyInputVal>::value, "Destination and input types differ");
|
| 356 |
+
}
|
| 357 |
+
} // details
|
| 358 |
+
|
| 359 |
+
template <typename TyGroup, typename TyVal, typename TyFn>
|
| 360 |
+
_CG_QUALIFIER auto reduce(const TyGroup& group, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 361 |
+
details::check_reduce_params<TyGroup, details::remove_qual<TyVal>, decltype(op(val, val))>();
|
| 362 |
+
|
| 363 |
+
using dispatch = details::tile_reduce_dispatch<TyGroup::_group_id>;
|
| 364 |
+
return dispatch::reduce(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 368 |
+
|
| 369 |
+
# if defined(_CG_HAS_STL_ATOMICS)
|
| 370 |
+
template<typename TyGroup, typename TyVal, cuda::thread_scope Sco, typename TyInputVal, typename TyFn>
|
| 371 |
+
void _CG_QUALIFIER reduce_update_async(const TyGroup& group, cuda::atomic<TyVal, Sco>& dst, TyInputVal&& val, TyFn&& op) {
|
| 372 |
+
details::check_async_reduce_params<TyGroup, TyVal, details::remove_qual<TyInputVal>, decltype(op(val, val))>();
|
| 373 |
+
auto update_lambda = [&] (TyVal& result) {
|
| 374 |
+
details::atomic_update(dst, result, op);
|
| 375 |
+
};
|
| 376 |
+
using dispatch = details::tile_async_reduce_dispatch<TyGroup::_group_id>;
|
| 377 |
+
dispatch::reduce(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op), update_lambda);
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
template<typename TyGroup, typename TyVal, cuda::thread_scope Sco, typename TyInputVal, typename TyFn>
|
| 381 |
+
void _CG_QUALIFIER reduce_update_async(const TyGroup& group, const cuda::atomic_ref<TyVal, Sco>& dst, TyInputVal&& val, TyFn&& op) {
|
| 382 |
+
details::check_async_reduce_params<TyGroup, TyVal, details::remove_qual<TyInputVal>, decltype(op(val, val))>();
|
| 383 |
+
auto update_lambda = [&] (TyVal& result) {
|
| 384 |
+
details::atomic_update(dst, result, op);
|
| 385 |
+
};
|
| 386 |
+
using dispatch = details::tile_async_reduce_dispatch<TyGroup::_group_id>;
|
| 387 |
+
dispatch::reduce(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op), update_lambda);
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
template<typename TyGroup, typename TyVal, cuda::thread_scope Sco, typename TyInputVal, typename TyFn>
|
| 391 |
+
void _CG_QUALIFIER reduce_store_async(const TyGroup& group, cuda::atomic<TyVal, Sco>& dst, TyInputVal&& val, TyFn&& op) {
|
| 392 |
+
details::check_async_reduce_params<TyGroup, TyVal, details::remove_qual<TyInputVal>, decltype(op(val, val))>();
|
| 393 |
+
auto store_lambda = [&] (TyVal& result) {
|
| 394 |
+
details::atomic_store(dst, result);
|
| 395 |
+
};
|
| 396 |
+
using dispatch = details::tile_async_reduce_dispatch<TyGroup::_group_id>;
|
| 397 |
+
dispatch::reduce(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op), store_lambda);
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
template<typename TyGroup, typename TyVal, cuda::thread_scope Sco, typename TyInputVal, typename TyFn>
|
| 401 |
+
void _CG_QUALIFIER reduce_store_async(const TyGroup& group, const cuda::atomic_ref<TyVal, Sco>& dst, TyInputVal&& val, TyFn&& op) {
|
| 402 |
+
details::check_async_reduce_params<TyGroup, TyVal, details::remove_qual<TyInputVal>, decltype(op(val, val))>();
|
| 403 |
+
auto store_lambda = [&] (TyVal& result) {
|
| 404 |
+
details::atomic_store(dst, result);
|
| 405 |
+
};
|
| 406 |
+
using dispatch = details::tile_async_reduce_dispatch<TyGroup::_group_id>;
|
| 407 |
+
dispatch::reduce(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op), store_lambda);
|
| 408 |
+
}
|
| 409 |
+
# endif
|
| 410 |
+
|
| 411 |
+
template<typename TyGroup, typename TyVal, typename TyInputVal, typename TyFn>
|
| 412 |
+
void _CG_QUALIFIER reduce_store_async(const TyGroup& group, TyVal* dst, TyInputVal&& val, TyFn&& op) {
|
| 413 |
+
details::check_async_reduce_params<TyGroup, TyVal, details::remove_qual<TyInputVal>, decltype(op(val, val))>();
|
| 414 |
+
auto store_lambda = [&] (TyVal& result) {
|
| 415 |
+
*dst = result;
|
| 416 |
+
};
|
| 417 |
+
using dispatch = details::tile_async_reduce_dispatch<TyGroup::_group_id>;
|
| 418 |
+
dispatch::reduce(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op), store_lambda);
|
| 419 |
+
}
|
| 420 |
+
#endif
|
| 421 |
+
|
| 422 |
+
_CG_END_NAMESPACE
|
| 423 |
+
|
| 424 |
+
#endif // _CG_REDUCE_H_
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/scan.h
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _CG_SCAN_H_
|
| 50 |
+
#define _CG_SCAN_H_
|
| 51 |
+
|
| 52 |
+
#include "info.h"
|
| 53 |
+
#include "helpers.h"
|
| 54 |
+
#include "functional.h"
|
| 55 |
+
#include "coalesced_scan.h"
|
| 56 |
+
|
| 57 |
+
_CG_BEGIN_NAMESPACE
|
| 58 |
+
|
| 59 |
+
namespace details {
|
| 60 |
+
|
| 61 |
+
// Group support for scan.
|
| 62 |
+
template <class TyGroup> struct _scan_group_supported : public _CG_STL_NAMESPACE::false_type {};
|
| 63 |
+
|
| 64 |
+
template <unsigned int Sz, typename TyPar>
|
| 65 |
+
struct _scan_group_supported<cooperative_groups::thread_block_tile<Sz, TyPar>> : public _CG_STL_NAMESPACE::true_type {};
|
| 66 |
+
template <unsigned int Sz, typename TyPar>
|
| 67 |
+
struct _scan_group_supported<internal_thread_block_tile<Sz, TyPar>> : public _CG_STL_NAMESPACE::true_type {};
|
| 68 |
+
template <>
|
| 69 |
+
struct _scan_group_supported<cooperative_groups::coalesced_group> : public _CG_STL_NAMESPACE::true_type {};
|
| 70 |
+
|
| 71 |
+
template <typename TyGroup>
|
| 72 |
+
using scan_group_supported = _scan_group_supported<details::remove_qual<TyGroup>>;
|
| 73 |
+
|
| 74 |
+
template <bool IsIntegralPlus>
|
| 75 |
+
struct integral_optimized_scan;
|
| 76 |
+
|
| 77 |
+
enum class ScanType { exclusive, inclusive };
|
| 78 |
+
|
| 79 |
+
template <unsigned int GroupId, ScanType TyScan>
|
| 80 |
+
struct scan_dispatch;
|
| 81 |
+
|
| 82 |
+
template <ScanType TyScan>
|
| 83 |
+
struct scan_dispatch<details::coalesced_group_id, TyScan> {
|
| 84 |
+
template <typename TyGroup, typename TyVal, typename TyFn>
|
| 85 |
+
_CG_STATIC_QUALIFIER auto scan(const TyGroup& group, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 86 |
+
auto scan_result = coalesced_inclusive_scan(group, val, op);
|
| 87 |
+
if (TyScan == ScanType::exclusive) {
|
| 88 |
+
scan_result = convert_inclusive_to_exclusive(group,
|
| 89 |
+
scan_result,
|
| 90 |
+
_CG_STL_NAMESPACE::forward<TyVal>(val),
|
| 91 |
+
_CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 92 |
+
}
|
| 93 |
+
return scan_result;
|
| 94 |
+
}
|
| 95 |
+
};
|
| 96 |
+
|
| 97 |
+
#if defined(_CG_CPP11_FEATURES)
|
| 98 |
+
template <ScanType TyScan>
|
| 99 |
+
struct scan_dispatch<details::multi_tile_group_id, TyScan> {
|
| 100 |
+
template <unsigned int Size, typename ParentT, typename TyVal, typename TyFn>
|
| 101 |
+
_CG_STATIC_QUALIFIER auto scan(const thread_block_tile<Size, ParentT>& group, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 102 |
+
using warpType = details::internal_thread_block_tile<32, __static_size_multi_warp_tile_base<Size>>;
|
| 103 |
+
using TyRet = details::remove_qual<TyVal>;
|
| 104 |
+
const unsigned int num_warps = Size / 32;
|
| 105 |
+
// In warp scan result, calculated in warp_lambda
|
| 106 |
+
TyRet warp_scan;
|
| 107 |
+
|
| 108 |
+
// In warp scan, put sum in the warp_scratch_location
|
| 109 |
+
auto warp_lambda = [&] (const warpType& warp, TyRet* warp_scratch_location) {
|
| 110 |
+
warp_scan =
|
| 111 |
+
details::coalesced_inclusive_scan(warp, _CG_STL_NAMESPACE::forward<TyVal>(val), op);
|
| 112 |
+
if (warp.thread_rank() + 1 == warp.size()) {
|
| 113 |
+
*warp_scratch_location = warp_scan;
|
| 114 |
+
}
|
| 115 |
+
if (TyScan == ScanType::exclusive) {
|
| 116 |
+
warp_scan = warp.shfl_up(warp_scan, 1);
|
| 117 |
+
}
|
| 118 |
+
};
|
| 119 |
+
|
| 120 |
+
// Tile of size num_warps performing the final scan part (exclusive scan of warp sums), other threads will add it
|
| 121 |
+
// to its in-warp scan result
|
| 122 |
+
auto inter_warp_lambda =
|
| 123 |
+
[&] (const details::internal_thread_block_tile<num_warps, warpType>& subwarp, TyRet* thread_scratch_location) {
|
| 124 |
+
auto thread_val = *thread_scratch_location;
|
| 125 |
+
auto result = coalesced_inclusive_scan(subwarp, thread_val, op);
|
| 126 |
+
*thread_scratch_location = convert_inclusive_to_exclusive(subwarp, result, thread_val, op);
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
TyRet previous_warps_sum = details::multi_warp_collectives_helper<TyRet>(group, warp_lambda, inter_warp_lambda);
|
| 130 |
+
if (TyScan == ScanType::exclusive && warpType::thread_rank() == 0) {
|
| 131 |
+
return previous_warps_sum;
|
| 132 |
+
}
|
| 133 |
+
if (warpType::meta_group_rank() == 0) {
|
| 134 |
+
return warp_scan;
|
| 135 |
+
}
|
| 136 |
+
else {
|
| 137 |
+
return op(warp_scan, previous_warps_sum);
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
};
|
| 141 |
+
|
| 142 |
+
#if defined(_CG_HAS_STL_ATOMICS)
|
| 143 |
+
template <unsigned int GroupId, ScanType TyScan>
|
| 144 |
+
struct scan_update_dispatch;
|
| 145 |
+
|
| 146 |
+
template <ScanType TyScan>
|
| 147 |
+
struct scan_update_dispatch<details::coalesced_group_id, TyScan> {
|
| 148 |
+
template <typename TyGroup, typename TyAtomic, typename TyVal, typename TyFn>
|
| 149 |
+
_CG_STATIC_QUALIFIER auto scan(const TyGroup& group, TyAtomic& dst, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 150 |
+
details::remove_qual<TyVal> old;
|
| 151 |
+
|
| 152 |
+
// Do regular in group scan
|
| 153 |
+
auto scan_result = details::coalesced_inclusive_scan(group, val, op);
|
| 154 |
+
|
| 155 |
+
// Last thread updates the atomic and distributes its old value to other threads
|
| 156 |
+
if (group.thread_rank() == group.size() - 1) {
|
| 157 |
+
old = atomic_update(dst, scan_result, _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 158 |
+
}
|
| 159 |
+
old = group.shfl(old, group.size() - 1);
|
| 160 |
+
if (TyScan == ScanType::exclusive) {
|
| 161 |
+
scan_result = convert_inclusive_to_exclusive(group, scan_result, _CG_STL_NAMESPACE::forward<TyVal>(val), op);
|
| 162 |
+
}
|
| 163 |
+
scan_result = op(old, scan_result);
|
| 164 |
+
return scan_result;
|
| 165 |
+
}
|
| 166 |
+
};
|
| 167 |
+
|
| 168 |
+
template <ScanType TyScan>
|
| 169 |
+
struct scan_update_dispatch<details::multi_tile_group_id, TyScan> {
|
| 170 |
+
template <unsigned int Size, typename ParentT, typename TyAtomic, typename TyVal, typename TyFn>
|
| 171 |
+
_CG_STATIC_QUALIFIER auto scan(const thread_block_tile<Size, ParentT>& group, TyAtomic& dst, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 172 |
+
using warpType = details::internal_thread_block_tile<32, __static_size_multi_warp_tile_base<Size>>;
|
| 173 |
+
using TyRet = details::remove_qual<TyVal>;
|
| 174 |
+
const unsigned int num_warps = Size / 32;
|
| 175 |
+
// In warp scan result, calculated in warp_lambda
|
| 176 |
+
TyRet warp_scan;
|
| 177 |
+
|
| 178 |
+
// In warp scan, put sum in the warp_scratch_location
|
| 179 |
+
auto warp_lambda = [&] (const warpType& warp, TyRet* warp_scratch_location) {
|
| 180 |
+
warp_scan =
|
| 181 |
+
details::coalesced_inclusive_scan(warp, _CG_STL_NAMESPACE::forward<TyVal>(val), op);
|
| 182 |
+
if (warp.thread_rank() + 1 == warp.size()) {
|
| 183 |
+
*warp_scratch_location = warp_scan;
|
| 184 |
+
}
|
| 185 |
+
if (TyScan == ScanType::exclusive) {
|
| 186 |
+
warp_scan = warp.shfl_up(warp_scan, 1);
|
| 187 |
+
}
|
| 188 |
+
};
|
| 189 |
+
|
| 190 |
+
// Tile of size num_warps performing the final scan part (exclusive scan of warp sums), other threads will add it
|
| 191 |
+
// to its in-warp scan result
|
| 192 |
+
auto inter_warp_lambda =
|
| 193 |
+
[&] (const details::internal_thread_block_tile<num_warps, warpType>& subwarp, TyRet* thread_scratch_location) {
|
| 194 |
+
auto thread_val = *thread_scratch_location;
|
| 195 |
+
auto scan_result = details::coalesced_inclusive_scan(subwarp, thread_val, op);
|
| 196 |
+
TyRet offset;
|
| 197 |
+
// Single thread does the atomic update with sum of all contributions and reads the old value.
|
| 198 |
+
if (subwarp.thread_rank() == subwarp.size() - 1) {
|
| 199 |
+
offset = details::atomic_update(dst, scan_result, op);
|
| 200 |
+
}
|
| 201 |
+
offset = subwarp.shfl(offset, subwarp.size() - 1);
|
| 202 |
+
scan_result = convert_inclusive_to_exclusive(subwarp, scan_result, thread_val, op);
|
| 203 |
+
// Add offset read from the atomic to the scanned warp sum.
|
| 204 |
+
// Skipping first thread, since it got defautly constructed value from the conversion,
|
| 205 |
+
// it should just return the offset received from the thread that did the atomic update.
|
| 206 |
+
if (subwarp.thread_rank() != 0) {
|
| 207 |
+
offset = op(scan_result, offset);
|
| 208 |
+
}
|
| 209 |
+
*thread_scratch_location = offset;
|
| 210 |
+
};
|
| 211 |
+
|
| 212 |
+
TyRet previous_warps_sum = details::multi_warp_collectives_helper<TyRet>(group, warp_lambda, inter_warp_lambda);
|
| 213 |
+
if (TyScan == ScanType::exclusive && warpType::thread_rank() == 0) {
|
| 214 |
+
return previous_warps_sum;
|
| 215 |
+
}
|
| 216 |
+
return op(warp_scan, previous_warps_sum);
|
| 217 |
+
}
|
| 218 |
+
};
|
| 219 |
+
#endif
|
| 220 |
+
#endif
|
| 221 |
+
|
| 222 |
+
template <typename TyGroup, typename TyInputVal, typename TyRetVal>
|
| 223 |
+
_CG_QUALIFIER void check_scan_params() {
|
| 224 |
+
static_assert(details::is_op_type_same<TyInputVal, TyRetVal>::value, "Operator input and output types differ");
|
| 225 |
+
static_assert(details::scan_group_supported<TyGroup>::value, "This group does not exclusively represent a tile");
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
#if defined(_CG_HAS_STL_ATOMICS)
|
| 229 |
+
template <typename TyGroup, typename TyDstVal, typename TyInputVal, typename TyRetVal>
|
| 230 |
+
_CG_QUALIFIER void check_scan_update_params() {
|
| 231 |
+
check_scan_params<TyGroup, TyInputVal, TyRetVal>();
|
| 232 |
+
static_assert(details::is_op_type_same<TyDstVal, TyInputVal>::value, "Destination and input types differ");
|
| 233 |
+
}
|
| 234 |
+
#endif
|
| 235 |
+
|
| 236 |
+
} // details
|
| 237 |
+
|
| 238 |
+
template <typename TyGroup, typename TyVal, typename TyFn>
|
| 239 |
+
_CG_QUALIFIER auto inclusive_scan(const TyGroup& group, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 240 |
+
details::check_scan_params<TyGroup, TyVal, decltype(op(val, val))>();
|
| 241 |
+
|
| 242 |
+
using dispatch = details::scan_dispatch<TyGroup::_group_id, details::ScanType::inclusive>;
|
| 243 |
+
return dispatch::scan(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
template <typename TyGroup, typename TyVal>
|
| 247 |
+
_CG_QUALIFIER details::remove_qual<TyVal> inclusive_scan(const TyGroup& group, TyVal&& val) {
|
| 248 |
+
return inclusive_scan(group, _CG_STL_NAMESPACE::forward<TyVal>(val), cooperative_groups::plus<details::remove_qual<TyVal>>());
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
template <typename TyGroup, typename TyVal, typename TyFn>
|
| 252 |
+
_CG_QUALIFIER auto exclusive_scan(const TyGroup& group, TyVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 253 |
+
details::check_scan_params<TyGroup, TyVal, decltype(op(val, val))>();
|
| 254 |
+
|
| 255 |
+
using dispatch = details::scan_dispatch<TyGroup::_group_id, details::ScanType::exclusive>;
|
| 256 |
+
return dispatch::scan(group, _CG_STL_NAMESPACE::forward<TyVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
template <typename TyGroup, typename TyVal>
|
| 260 |
+
_CG_QUALIFIER details::remove_qual<TyVal> exclusive_scan(const TyGroup& group, TyVal&& val) {
|
| 261 |
+
return exclusive_scan(group, _CG_STL_NAMESPACE::forward<TyVal>(val), cooperative_groups::plus<details::remove_qual<TyVal>>());
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
#if defined(_CG_HAS_STL_ATOMICS)
|
| 265 |
+
template<typename TyGroup, typename TyVal, typename TyInputVal, cuda::thread_scope Sco, typename TyFn>
|
| 266 |
+
_CG_QUALIFIER auto inclusive_scan_update(const TyGroup& group, cuda::atomic<TyVal, Sco>& dst, TyInputVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 267 |
+
details::check_scan_update_params<TyGroup, TyVal, details::remove_qual<TyInputVal>, decltype(op(val, val))>();
|
| 268 |
+
|
| 269 |
+
using dispatch = details::scan_update_dispatch<TyGroup::_group_id, details::ScanType::inclusive>;
|
| 270 |
+
return dispatch::scan(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
template<typename TyGroup, typename TyVal, typename TyInputVal, cuda::thread_scope Sco>
|
| 274 |
+
_CG_QUALIFIER TyVal inclusive_scan_update(const TyGroup& group, cuda::atomic<TyVal, Sco> & dst, TyInputVal&& val) {
|
| 275 |
+
return inclusive_scan_update(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), cooperative_groups::plus<TyVal>());
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
template<typename TyGroup, typename TyVal, typename TyInputVal, cuda::thread_scope Sco, typename TyFn>
|
| 279 |
+
_CG_QUALIFIER auto exclusive_scan_update(const TyGroup& group, cuda::atomic<TyVal, Sco>& dst, TyInputVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 280 |
+
details::check_scan_update_params<TyGroup, TyVal, details::remove_qual<TyInputVal>, decltype(op(val, val))>();
|
| 281 |
+
|
| 282 |
+
using dispatch = details::scan_update_dispatch<TyGroup::_group_id, details::ScanType::exclusive>;
|
| 283 |
+
return dispatch::scan(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
template<typename TyGroup, typename TyVal, typename TyInputVal, cuda::thread_scope Sco>
|
| 287 |
+
_CG_QUALIFIER TyVal exclusive_scan_update(const TyGroup& group, cuda::atomic<TyVal, Sco>& dst, TyInputVal&& val) {
|
| 288 |
+
return exclusive_scan_update(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), cooperative_groups::plus<TyVal>());
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
template<typename TyGroup, typename TyVal, typename TyInputVal, cuda::thread_scope Sco, typename TyFn>
|
| 292 |
+
_CG_QUALIFIER auto inclusive_scan_update(const TyGroup& group, const cuda::atomic_ref<TyVal, Sco>& dst, TyInputVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 293 |
+
details::check_scan_update_params<TyGroup, TyVal, details::remove_qual<TyInputVal>, decltype(op(val, val))>();
|
| 294 |
+
|
| 295 |
+
using dispatch = details::scan_update_dispatch<TyGroup::_group_id, details::ScanType::inclusive>;
|
| 296 |
+
return dispatch::scan(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
template<typename TyGroup, typename TyVal, typename TyInputVal, cuda::thread_scope Sco>
|
| 300 |
+
_CG_QUALIFIER TyVal inclusive_scan_update(const TyGroup& group, const cuda::atomic_ref<TyVal, Sco> & dst, TyInputVal&& val) {
|
| 301 |
+
return inclusive_scan_update(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), cooperative_groups::plus<TyVal>());
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
template<typename TyGroup, typename TyVal, typename TyInputVal, cuda::thread_scope Sco, typename TyFn>
|
| 305 |
+
_CG_QUALIFIER auto exclusive_scan_update(const TyGroup& group, const cuda::atomic_ref<TyVal, Sco>& dst, TyInputVal&& val, TyFn&& op) -> decltype(op(val, val)) {
|
| 306 |
+
details::check_scan_update_params<TyGroup, TyVal, details::remove_qual<TyInputVal>, decltype(op(val, val))>();
|
| 307 |
+
|
| 308 |
+
using dispatch = details::scan_update_dispatch<TyGroup::_group_id, details::ScanType::exclusive>;
|
| 309 |
+
return dispatch::scan(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), _CG_STL_NAMESPACE::forward<TyFn>(op));
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
template<typename TyGroup, typename TyVal, typename TyInputVal, cuda::thread_scope Sco>
|
| 313 |
+
_CG_QUALIFIER TyVal exclusive_scan_update(const TyGroup& group, const cuda::atomic_ref<TyVal, Sco>& dst, TyInputVal&& val) {
|
| 314 |
+
return exclusive_scan_update(group, dst, _CG_STL_NAMESPACE::forward<TyInputVal>(val), cooperative_groups::plus<TyVal>());
|
| 315 |
+
}
|
| 316 |
+
#endif
|
| 317 |
+
|
| 318 |
+
_CG_END_NAMESPACE
|
| 319 |
+
|
| 320 |
+
#endif // _CG_SCAN_H_
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/details/sync.h
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _CG_GRID_H
|
| 50 |
+
#define _CG_GRID_H
|
| 51 |
+
|
| 52 |
+
#include "info.h"
|
| 53 |
+
|
| 54 |
+
_CG_BEGIN_NAMESPACE
|
| 55 |
+
|
| 56 |
+
namespace details
|
| 57 |
+
{
|
| 58 |
+
typedef unsigned int barrier_t;
|
| 59 |
+
|
| 60 |
+
_CG_STATIC_QUALIFIER bool bar_has_flipped(unsigned int old_arrive, unsigned int current_arrive) {
|
| 61 |
+
return (((old_arrive ^ current_arrive) & 0x80000000) != 0);
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
_CG_STATIC_QUALIFIER bool is_cta_master() {
|
| 65 |
+
return (threadIdx.x + threadIdx.y + threadIdx.z == 0);
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
_CG_STATIC_QUALIFIER unsigned int sync_grids_arrive(volatile barrier_t *arrived) {
|
| 69 |
+
unsigned int oldArrive = 0;
|
| 70 |
+
|
| 71 |
+
__barrier_sync(0);
|
| 72 |
+
|
| 73 |
+
if (is_cta_master()) {
|
| 74 |
+
unsigned int expected = gridDim.x * gridDim.y * gridDim.z;
|
| 75 |
+
bool gpu_master = (blockIdx.x + blockIdx.y + blockIdx.z == 0);
|
| 76 |
+
unsigned int nb = 1;
|
| 77 |
+
|
| 78 |
+
if (gpu_master) {
|
| 79 |
+
nb = 0x80000000 - (expected - 1);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_70,
|
| 83 |
+
// Barrier update with release; polling with acquire
|
| 84 |
+
asm volatile("atom.add.release.gpu.u32 %0,[%1],%2;" : "=r"(oldArrive) : _CG_ASM_PTR_CONSTRAINT((unsigned int*)arrived), "r"(nb) : "memory");
|
| 85 |
+
,
|
| 86 |
+
// Fence; barrier update; volatile polling; fence
|
| 87 |
+
__threadfence();
|
| 88 |
+
oldArrive = atomicAdd((unsigned int*)arrived, nb);
|
| 89 |
+
);
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
return oldArrive;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
_CG_STATIC_QUALIFIER void sync_grids_wait(unsigned int oldArrive, volatile barrier_t *arrived) {
|
| 97 |
+
if (is_cta_master()) {
|
| 98 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_70,
|
| 99 |
+
unsigned int current_arrive;
|
| 100 |
+
do {
|
| 101 |
+
asm volatile("ld.acquire.gpu.u32 %0,[%1];" : "=r"(current_arrive) : _CG_ASM_PTR_CONSTRAINT((unsigned int *)arrived) : "memory");
|
| 102 |
+
} while (!bar_has_flipped(oldArrive, current_arrive));
|
| 103 |
+
,
|
| 104 |
+
while (!bar_has_flipped(oldArrive, *arrived));
|
| 105 |
+
__threadfence();
|
| 106 |
+
);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
__barrier_sync(0);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
/* - Multi warp groups synchronization routines - */
|
| 113 |
+
|
| 114 |
+
#ifdef _CG_CPP11_FEATURES
|
| 115 |
+
// Need both acquire and release for the last warp, since it won't be able to acquire with red.and
|
| 116 |
+
_CG_STATIC_QUALIFIER unsigned int atom_or_acq_rel_cta(unsigned int *addr, unsigned int val) {
|
| 117 |
+
unsigned int old;
|
| 118 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_70,
|
| 119 |
+
(asm volatile("atom.or.acq_rel.cta.b32 %0,[%1],%2;" : "=r"(old) : _CG_ASM_PTR_CONSTRAINT(addr), "r"(val) : "memory");)
|
| 120 |
+
,
|
| 121 |
+
(__threadfence_block();
|
| 122 |
+
old = atomicOr(addr, val);)
|
| 123 |
+
);
|
| 124 |
+
return old;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
// Special case where barrier is arrived, but not waited on
|
| 128 |
+
_CG_STATIC_QUALIFIER void red_or_release_cta(unsigned int *addr, unsigned int val) {
|
| 129 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_70,
|
| 130 |
+
(asm volatile("red.or.release.cta.b32 [%0],%1;" :: _CG_ASM_PTR_CONSTRAINT(addr), "r"(val) : "memory");)
|
| 131 |
+
,
|
| 132 |
+
(__threadfence_block();
|
| 133 |
+
atomicOr(addr, val);)
|
| 134 |
+
);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
// Usually called by last arriving warp to released other warps, can be relaxed, since or was already acq_rel
|
| 138 |
+
_CG_STATIC_QUALIFIER void red_and_relaxed_cta(unsigned int *addr, unsigned int val) {
|
| 139 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_70,
|
| 140 |
+
(asm volatile("red.and.relaxed.cta.b32 [%0],%1;" :: _CG_ASM_PTR_CONSTRAINT(addr), "r"(val) : "memory");)
|
| 141 |
+
,
|
| 142 |
+
(atomicAnd(addr, val);)
|
| 143 |
+
);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
// Special case of release, where last warp was doing extra work before releasing others, need to be release
|
| 147 |
+
// to ensure that extra work is visible
|
| 148 |
+
_CG_STATIC_QUALIFIER void red_and_release_cta(unsigned int *addr, unsigned int val) {
|
| 149 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_70,
|
| 150 |
+
(asm volatile("red.and.release.cta.b32 [%0],%1;" :: _CG_ASM_PTR_CONSTRAINT(addr), "r"(val) : "memory");)
|
| 151 |
+
,
|
| 152 |
+
(__threadfence_block();
|
| 153 |
+
atomicAnd(addr, val);)
|
| 154 |
+
);
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
// Read the barrier, acquire to ensure all memory operations following the sync are correctly performed after it is released
|
| 158 |
+
_CG_STATIC_QUALIFIER unsigned int ld_acquire_cta(unsigned int *addr) {
|
| 159 |
+
unsigned int val;
|
| 160 |
+
NV_IF_ELSE_TARGET(NV_PROVIDES_SM_70,
|
| 161 |
+
(asm volatile("ld.acquire.cta.u32 %0,[%1];" : "=r"(val) : _CG_ASM_PTR_CONSTRAINT(addr) : "memory");)
|
| 162 |
+
,
|
| 163 |
+
(val = *((volatile unsigned int*) addr);
|
| 164 |
+
__threadfence_block();)
|
| 165 |
+
);
|
| 166 |
+
return val;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
// Get synchronization bit mask of my thread_block_tile of size num_warps. Thread ranks 0..31 have the first bit assigned to them,
|
| 170 |
+
// thread ranks 32..63 second etc
|
| 171 |
+
// Bit masks are unique for each group, groups of the same size will have the same number of bits set, but on different positions
|
| 172 |
+
_CG_STATIC_QUALIFIER unsigned int get_group_mask(unsigned int thread_rank, unsigned int num_warps) {
|
| 173 |
+
return num_warps == 32 ? ~0 : ((1 << num_warps) - 1) << (num_warps * (thread_rank / (num_warps * 32)));
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
_CG_STATIC_QUALIFIER void barrier_wait(barrier_t *arrived, unsigned int warp_bit) {
|
| 177 |
+
while(ld_acquire_cta(arrived) & warp_bit);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
// Default blocking sync.
|
| 181 |
+
_CG_STATIC_QUALIFIER void sync_warps(barrier_t *arrived, unsigned int thread_rank, unsigned int num_warps) {
|
| 182 |
+
unsigned int warp_id = thread_rank / 32;
|
| 183 |
+
bool warp_master = (thread_rank % 32 == 0);
|
| 184 |
+
unsigned int warp_bit = 1 << warp_id;
|
| 185 |
+
unsigned int group_mask = get_group_mask(thread_rank, num_warps);
|
| 186 |
+
|
| 187 |
+
__syncwarp(0xFFFFFFFF);
|
| 188 |
+
|
| 189 |
+
if (warp_master) {
|
| 190 |
+
unsigned int old = atom_or_acq_rel_cta(arrived, warp_bit);
|
| 191 |
+
if (((old | warp_bit) & group_mask) == group_mask) {
|
| 192 |
+
red_and_relaxed_cta(arrived, ~group_mask);
|
| 193 |
+
}
|
| 194 |
+
else {
|
| 195 |
+
barrier_wait(arrived, warp_bit);
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
__syncwarp(0xFFFFFFFF);
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
// Blocking sync, except the last arriving warp, that releases other warps, returns to do other stuff first.
|
| 203 |
+
// Warp returning true from this function needs to call sync_warps_release.
|
| 204 |
+
_CG_STATIC_QUALIFIER bool sync_warps_last_releases(barrier_t *arrived, unsigned int thread_rank, unsigned int num_warps) {
|
| 205 |
+
unsigned int warp_id = thread_rank / 32;
|
| 206 |
+
bool warp_master = (thread_rank % 32 == 0);
|
| 207 |
+
unsigned int warp_bit = 1 << warp_id;
|
| 208 |
+
unsigned int group_mask = get_group_mask(thread_rank, num_warps);
|
| 209 |
+
|
| 210 |
+
__syncwarp(0xFFFFFFFF);
|
| 211 |
+
|
| 212 |
+
unsigned int old = 0;
|
| 213 |
+
if (warp_master) {
|
| 214 |
+
old = atom_or_acq_rel_cta(arrived, warp_bit);
|
| 215 |
+
}
|
| 216 |
+
old = __shfl_sync(0xFFFFFFFF, old, 0);
|
| 217 |
+
if (((old | warp_bit) & group_mask) == group_mask) {
|
| 218 |
+
return true;
|
| 219 |
+
}
|
| 220 |
+
barrier_wait(arrived, warp_bit);
|
| 221 |
+
|
| 222 |
+
return false;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
// Release my group from the barrier.
|
| 226 |
+
_CG_STATIC_QUALIFIER void sync_warps_release(barrier_t *arrived, bool is_master, unsigned int thread_rank, unsigned int num_warps) {
|
| 227 |
+
unsigned int group_mask = get_group_mask(thread_rank, num_warps);
|
| 228 |
+
if (is_master) {
|
| 229 |
+
red_and_release_cta(arrived, ~group_mask);
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
// Arrive at my group barrier, but don't block or release the barrier, even if every one arrives.
|
| 234 |
+
// sync_warps_release needs to be called by some warp after this one to reset the barrier.
|
| 235 |
+
_CG_STATIC_QUALIFIER void sync_warps_arrive(barrier_t *arrived, unsigned int thread_rank, unsigned int num_warps) {
|
| 236 |
+
unsigned int warp_id = thread_rank / 32;
|
| 237 |
+
bool warp_master = (thread_rank % 32 == 0);
|
| 238 |
+
unsigned int warp_bit = 1 << warp_id;
|
| 239 |
+
unsigned int group_mask = get_group_mask(thread_rank, num_warps);
|
| 240 |
+
|
| 241 |
+
__syncwarp(0xFFFFFFFF);
|
| 242 |
+
|
| 243 |
+
if (warp_master) {
|
| 244 |
+
red_or_release_cta(arrived, warp_bit);
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
// Wait for my warp to be released from the barrier. Warp must have arrived first.
|
| 249 |
+
_CG_STATIC_QUALIFIER void sync_warps_wait(barrier_t *arrived, unsigned int thread_rank) {
|
| 250 |
+
unsigned int warp_id = thread_rank / 32;
|
| 251 |
+
unsigned int warp_bit = 1 << warp_id;
|
| 252 |
+
|
| 253 |
+
barrier_wait(arrived, warp_bit);
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
// Wait for specific warp to arrive at the barrier
|
| 257 |
+
_CG_QUALIFIER void sync_warps_wait_for_specific_warp(barrier_t *arrived, unsigned int wait_warp_id) {
|
| 258 |
+
unsigned int wait_mask = 1 << wait_warp_id;
|
| 259 |
+
while((ld_acquire_cta(arrived) & wait_mask) != wait_mask);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
// Initialize the bit corresponding to my warp in the barrier
|
| 263 |
+
_CG_QUALIFIER void sync_warps_reset(barrier_t *arrived, unsigned int thread_rank) {
|
| 264 |
+
unsigned int warp_id = thread_rank / 32;
|
| 265 |
+
unsigned int warp_bit = 1 << warp_id;
|
| 266 |
+
|
| 267 |
+
__syncwarp(0xFFFFFFFF);
|
| 268 |
+
|
| 269 |
+
if (thread_rank % 32 == 0) {
|
| 270 |
+
red_and_release_cta(arrived, ~warp_bit);
|
| 271 |
+
}
|
| 272 |
+
// No need to sync after the atomic, there will be a sync of the group that is being partitioned right after this.
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
#endif
|
| 276 |
+
|
| 277 |
+
} // details
|
| 278 |
+
|
| 279 |
+
_CG_END_NAMESPACE
|
| 280 |
+
|
| 281 |
+
#endif // _CG_GRID_H
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/memcpy_async.h
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _COOPERATIVE_GROUPS_MEMCPY_ASYNC
|
| 50 |
+
#define _COOPERATIVE_GROUPS_MEMCPY_ASYNC
|
| 51 |
+
|
| 52 |
+
#include "../cooperative_groups.h"
|
| 53 |
+
#include "details/info.h"
|
| 54 |
+
|
| 55 |
+
#ifdef _CG_CPP11_FEATURES
|
| 56 |
+
# include "details/async.h"
|
| 57 |
+
#else
|
| 58 |
+
# error This file requires compiler support for the ISO C++ 2011 standard. This support must be enabled with the \
|
| 59 |
+
-std=c++11 compiler option.
|
| 60 |
+
#endif
|
| 61 |
+
|
| 62 |
+
#endif // _COOPERATIVE_GROUPS_MEMCPY_ASYNC
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/reduce.h
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _COOPERATIVE_GROUPS_REDUCE_H
|
| 50 |
+
#define _COOPERATIVE_GROUPS_REDUCE_H
|
| 51 |
+
|
| 52 |
+
#include "../cooperative_groups.h"
|
| 53 |
+
#include "details/info.h"
|
| 54 |
+
|
| 55 |
+
#ifdef _CG_CPP11_FEATURES
|
| 56 |
+
# include "details/reduce.h"
|
| 57 |
+
#else
|
| 58 |
+
# error This file requires compiler support for the ISO C++ 2011 standard. This support must be enabled with the \
|
| 59 |
+
-std=c++11 compiler option.
|
| 60 |
+
#endif
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
#endif //_COOPERATIVE_GROUPS_REDUCE_H
|
lib/python3.11/site-packages/nvidia/cu13/include/cooperative_groups/scan.h
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
|
| 2 |
+
*
|
| 3 |
+
* NOTICE TO LICENSEE:
|
| 4 |
+
*
|
| 5 |
+
* The source code and/or documentation ("Licensed Deliverables") are
|
| 6 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 7 |
+
* international Copyright laws.
|
| 8 |
+
*
|
| 9 |
+
* The Licensed Deliverables contained herein are PROPRIETARY and
|
| 10 |
+
* CONFIDENTIAL to NVIDIA and are being provided under the terms and
|
| 11 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 12 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 13 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 14 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 15 |
+
* of the Licensed Deliverables to any third party without the express
|
| 16 |
+
* written consent of NVIDIA is prohibited.
|
| 17 |
+
*
|
| 18 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 19 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 20 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
|
| 21 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 22 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 23 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 24 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 25 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 26 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 27 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 28 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 29 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 30 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 31 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 32 |
+
*
|
| 33 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 34 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 35 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 36 |
+
* computer software documentation" as such terms are used in 48
|
| 37 |
+
* C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
|
| 38 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 39 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 40 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 41 |
+
* only those rights set forth herein.
|
| 42 |
+
*
|
| 43 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 44 |
+
* software must include, in the user documentation and internal
|
| 45 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 46 |
+
* Users Notice.
|
| 47 |
+
*/
|
| 48 |
+
|
| 49 |
+
#ifndef _COOPERATIVE_GROUPS_SCAN_H
|
| 50 |
+
#define _COOPERATIVE_GROUPS_SCAN_H
|
| 51 |
+
|
| 52 |
+
#include "../cooperative_groups.h"
|
| 53 |
+
#include "details/info.h"
|
| 54 |
+
|
| 55 |
+
#ifdef _CG_CPP11_FEATURES
|
| 56 |
+
# include "details/scan.h"
|
| 57 |
+
#else
|
| 58 |
+
# error This file requires compiler support for the ISO C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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2012 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(CU_COMPLEX_H_)
|
| 51 |
+
#define CU_COMPLEX_H_
|
| 52 |
+
|
| 53 |
+
#if !defined(__CUDACC_RTC__)
|
| 54 |
+
#if defined(__GNUC__)
|
| 55 |
+
#if defined(__clang__) || (!defined(__PGIC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)))
|
| 56 |
+
#pragma GCC diagnostic ignored "-Wunused-function"
|
| 57 |
+
#endif
|
| 58 |
+
#endif
|
| 59 |
+
#endif
|
| 60 |
+
|
| 61 |
+
/* When trying to include C header file in C++ Code extern "C" is required
|
| 62 |
+
* But the Standard QNX headers already have ifdef extern in them when compiling C++ Code
|
| 63 |
+
* extern "C" cannot be nested
|
| 64 |
+
* Hence keep the header out of extern "C" block
|
| 65 |
+
*/
|
| 66 |
+
|
| 67 |
+
#if !defined(__CUDACC__)
|
| 68 |
+
#include <math.h> /* import fabsf, sqrt */
|
| 69 |
+
#endif /* !defined(__CUDACC__) */
|
| 70 |
+
|
| 71 |
+
#if defined(__cplusplus)
|
| 72 |
+
extern "C" {
|
| 73 |
+
#endif /* __cplusplus */
|
| 74 |
+
|
| 75 |
+
#include "vector_types.h"
|
| 76 |
+
|
| 77 |
+
typedef float2 cuFloatComplex;
|
| 78 |
+
|
| 79 |
+
__host__ __device__ static __inline__ float cuCrealf (cuFloatComplex x)
|
| 80 |
+
{
|
| 81 |
+
return x.x;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
__host__ __device__ static __inline__ float cuCimagf (cuFloatComplex x)
|
| 85 |
+
{
|
| 86 |
+
return x.y;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
__host__ __device__ static __inline__ cuFloatComplex make_cuFloatComplex
|
| 90 |
+
(float r, float i)
|
| 91 |
+
{
|
| 92 |
+
cuFloatComplex res;
|
| 93 |
+
res.x = r;
|
| 94 |
+
res.y = i;
|
| 95 |
+
return res;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
__host__ __device__ static __inline__ cuFloatComplex cuConjf (cuFloatComplex x)
|
| 99 |
+
{
|
| 100 |
+
return make_cuFloatComplex (cuCrealf(x), -cuCimagf(x));
|
| 101 |
+
}
|
| 102 |
+
__host__ __device__ static __inline__ cuFloatComplex cuCaddf (cuFloatComplex x,
|
| 103 |
+
cuFloatComplex y)
|
| 104 |
+
{
|
| 105 |
+
return make_cuFloatComplex (cuCrealf(x) + cuCrealf(y),
|
| 106 |
+
cuCimagf(x) + cuCimagf(y));
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
__host__ __device__ static __inline__ cuFloatComplex cuCsubf (cuFloatComplex x,
|
| 110 |
+
cuFloatComplex y)
|
| 111 |
+
{
|
| 112 |
+
return make_cuFloatComplex (cuCrealf(x) - cuCrealf(y),
|
| 113 |
+
cuCimagf(x) - cuCimagf(y));
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/* This implementation could suffer from intermediate overflow even though
|
| 117 |
+
* the final result would be in range. However, various implementations do
|
| 118 |
+
* not guard against this (presumably to avoid losing performance), so we
|
| 119 |
+
* don't do it either to stay competitive.
|
| 120 |
+
*/
|
| 121 |
+
__host__ __device__ static __inline__ cuFloatComplex cuCmulf (cuFloatComplex x,
|
| 122 |
+
cuFloatComplex y)
|
| 123 |
+
{
|
| 124 |
+
cuFloatComplex prod;
|
| 125 |
+
prod = make_cuFloatComplex ((cuCrealf(x) * cuCrealf(y)) -
|
| 126 |
+
(cuCimagf(x) * cuCimagf(y)),
|
| 127 |
+
(cuCrealf(x) * cuCimagf(y)) +
|
| 128 |
+
(cuCimagf(x) * cuCrealf(y)));
|
| 129 |
+
return prod;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/* This implementation guards against intermediate underflow and overflow
|
| 133 |
+
* by scaling. Such guarded implementations are usually the default for
|
| 134 |
+
* complex library implementations, with some also offering an unguarded,
|
| 135 |
+
* faster version.
|
| 136 |
+
*/
|
| 137 |
+
__host__ __device__ static __inline__ cuFloatComplex cuCdivf (cuFloatComplex x,
|
| 138 |
+
cuFloatComplex y)
|
| 139 |
+
{
|
| 140 |
+
cuFloatComplex quot;
|
| 141 |
+
float s = fabsf(cuCrealf(y)) + fabsf(cuCimagf(y));
|
| 142 |
+
float oos = 1.0f / s;
|
| 143 |
+
float ars = cuCrealf(x) * oos;
|
| 144 |
+
float ais = cuCimagf(x) * oos;
|
| 145 |
+
float brs = cuCrealf(y) * oos;
|
| 146 |
+
float bis = cuCimagf(y) * oos;
|
| 147 |
+
s = (brs * brs) + (bis * bis);
|
| 148 |
+
oos = 1.0f / s;
|
| 149 |
+
quot = make_cuFloatComplex (((ars * brs) + (ais * bis)) * oos,
|
| 150 |
+
((ais * brs) - (ars * bis)) * oos);
|
| 151 |
+
return quot;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
/*
|
| 155 |
+
* We would like to call hypotf(), but it's not available on all platforms.
|
| 156 |
+
* This discrete implementation guards against intermediate underflow and
|
| 157 |
+
* overflow by scaling. Otherwise we would lose half the exponent range.
|
| 158 |
+
* There are various ways of doing guarded computation. For now chose the
|
| 159 |
+
* simplest and fastest solution, however this may suffer from inaccuracies
|
| 160 |
+
* if sqrt and division are not IEEE compliant.
|
| 161 |
+
*/
|
| 162 |
+
__host__ __device__ static __inline__ float cuCabsf (cuFloatComplex x)
|
| 163 |
+
{
|
| 164 |
+
float a = cuCrealf(x);
|
| 165 |
+
float b = cuCimagf(x);
|
| 166 |
+
float v, w, t;
|
| 167 |
+
a = fabsf(a);
|
| 168 |
+
b = fabsf(b);
|
| 169 |
+
if (a > b) {
|
| 170 |
+
v = a;
|
| 171 |
+
w = b;
|
| 172 |
+
} else {
|
| 173 |
+
v = b;
|
| 174 |
+
w = a;
|
| 175 |
+
}
|
| 176 |
+
t = w / v;
|
| 177 |
+
t = 1.0f + t * t;
|
| 178 |
+
t = v * sqrtf(t);
|
| 179 |
+
if ((v == 0.0f) || (v > 3.402823466e38f) || (w > 3.402823466e38f)) {
|
| 180 |
+
t = v + w;
|
| 181 |
+
}
|
| 182 |
+
return t;
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
/* Double precision */
|
| 186 |
+
typedef double2 cuDoubleComplex;
|
| 187 |
+
|
| 188 |
+
__host__ __device__ static __inline__ double cuCreal (cuDoubleComplex x)
|
| 189 |
+
{
|
| 190 |
+
return x.x;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
__host__ __device__ static __inline__ double cuCimag (cuDoubleComplex x)
|
| 194 |
+
{
|
| 195 |
+
return x.y;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
__host__ __device__ static __inline__ cuDoubleComplex make_cuDoubleComplex
|
| 199 |
+
(double r, double i)
|
| 200 |
+
{
|
| 201 |
+
cuDoubleComplex res;
|
| 202 |
+
res.x = r;
|
| 203 |
+
res.y = i;
|
| 204 |
+
return res;
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
__host__ __device__ static __inline__ cuDoubleComplex cuConj(cuDoubleComplex x)
|
| 208 |
+
{
|
| 209 |
+
return make_cuDoubleComplex (cuCreal(x), -cuCimag(x));
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
__host__ __device__ static __inline__ cuDoubleComplex cuCadd(cuDoubleComplex x,
|
| 213 |
+
cuDoubleComplex y)
|
| 214 |
+
{
|
| 215 |
+
return make_cuDoubleComplex (cuCreal(x) + cuCreal(y),
|
| 216 |
+
cuCimag(x) + cuCimag(y));
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
__host__ __device__ static __inline__ cuDoubleComplex cuCsub(cuDoubleComplex x,
|
| 220 |
+
cuDoubleComplex y)
|
| 221 |
+
{
|
| 222 |
+
return make_cuDoubleComplex (cuCreal(x) - cuCreal(y),
|
| 223 |
+
cuCimag(x) - cuCimag(y));
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
/* This implementation could suffer from intermediate overflow even though
|
| 227 |
+
* the final result would be in range. However, various implementations do
|
| 228 |
+
* not guard against this (presumably to avoid losing performance), so we
|
| 229 |
+
* don't do it either to stay competitive.
|
| 230 |
+
*/
|
| 231 |
+
__host__ __device__ static __inline__ cuDoubleComplex cuCmul(cuDoubleComplex x,
|
| 232 |
+
cuDoubleComplex y)
|
| 233 |
+
{
|
| 234 |
+
cuDoubleComplex prod;
|
| 235 |
+
prod = make_cuDoubleComplex ((cuCreal(x) * cuCreal(y)) -
|
| 236 |
+
(cuCimag(x) * cuCimag(y)),
|
| 237 |
+
(cuCreal(x) * cuCimag(y)) +
|
| 238 |
+
(cuCimag(x) * cuCreal(y)));
|
| 239 |
+
return prod;
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
/* This implementation guards against intermediate underflow and overflow
|
| 243 |
+
* by scaling. Such guarded implementations are usually the default for
|
| 244 |
+
* complex library implementations, with some also offering an unguarded,
|
| 245 |
+
* faster version.
|
| 246 |
+
*/
|
| 247 |
+
__host__ __device__ static __inline__ cuDoubleComplex cuCdiv(cuDoubleComplex x,
|
| 248 |
+
cuDoubleComplex y)
|
| 249 |
+
{
|
| 250 |
+
cuDoubleComplex quot;
|
| 251 |
+
double s = (fabs(cuCreal(y))) + (fabs(cuCimag(y)));
|
| 252 |
+
double oos = 1.0 / s;
|
| 253 |
+
double ars = cuCreal(x) * oos;
|
| 254 |
+
double ais = cuCimag(x) * oos;
|
| 255 |
+
double brs = cuCreal(y) * oos;
|
| 256 |
+
double bis = cuCimag(y) * oos;
|
| 257 |
+
s = (brs * brs) + (bis * bis);
|
| 258 |
+
oos = 1.0 / s;
|
| 259 |
+
quot = make_cuDoubleComplex (((ars * brs) + (ais * bis)) * oos,
|
| 260 |
+
((ais * brs) - (ars * bis)) * oos);
|
| 261 |
+
return quot;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
/* This implementation guards against intermediate underflow and overflow
|
| 265 |
+
* by scaling. Otherwise we would lose half the exponent range. There are
|
| 266 |
+
* various ways of doing guarded computation. For now chose the simplest
|
| 267 |
+
* and fastest solution, however this may suffer from inaccuracies if sqrt
|
| 268 |
+
* and division are not IEEE compliant.
|
| 269 |
+
*/
|
| 270 |
+
__host__ __device__ static __inline__ double cuCabs (cuDoubleComplex x)
|
| 271 |
+
{
|
| 272 |
+
double a = cuCreal(x);
|
| 273 |
+
double b = cuCimag(x);
|
| 274 |
+
double v, w, t;
|
| 275 |
+
a = fabs(a);
|
| 276 |
+
b = fabs(b);
|
| 277 |
+
if (a > b) {
|
| 278 |
+
v = a;
|
| 279 |
+
w = b;
|
| 280 |
+
} else {
|
| 281 |
+
v = b;
|
| 282 |
+
w = a;
|
| 283 |
+
}
|
| 284 |
+
t = w / v;
|
| 285 |
+
t = 1.0 + t * t;
|
| 286 |
+
t = v * sqrt(t);
|
| 287 |
+
if ((v == 0.0) ||
|
| 288 |
+
(v > 1.79769313486231570e+308) || (w > 1.79769313486231570e+308)) {
|
| 289 |
+
t = v + w;
|
| 290 |
+
}
|
| 291 |
+
return t;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
#if defined(__cplusplus)
|
| 295 |
+
}
|
| 296 |
+
#endif /* __cplusplus */
|
| 297 |
+
|
| 298 |
+
/* aliases */
|
| 299 |
+
typedef cuFloatComplex cuComplex;
|
| 300 |
+
__host__ __device__ static __inline__ cuComplex make_cuComplex (float x,
|
| 301 |
+
float y)
|
| 302 |
+
{
|
| 303 |
+
return make_cuFloatComplex (x, y);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
/* float-to-double promotion */
|
| 307 |
+
__host__ __device__ static __inline__ cuDoubleComplex cuComplexFloatToDouble
|
| 308 |
+
(cuFloatComplex c)
|
| 309 |
+
{
|
| 310 |
+
return make_cuDoubleComplex ((double)cuCrealf(c), (double)cuCimagf(c));
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
__host__ __device__ static __inline__ cuFloatComplex cuComplexDoubleToFloat
|
| 314 |
+
(cuDoubleComplex c)
|
| 315 |
+
{
|
| 316 |
+
return make_cuFloatComplex ((float)cuCreal(c), (float)cuCimag(c));
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
__host__ __device__ static __inline__ cuComplex cuCfmaf( cuComplex x, cuComplex y, cuComplex d)
|
| 321 |
+
{
|
| 322 |
+
float real_res;
|
| 323 |
+
float imag_res;
|
| 324 |
+
|
| 325 |
+
real_res = (cuCrealf(x) * cuCrealf(y)) + cuCrealf(d);
|
| 326 |
+
imag_res = (cuCrealf(x) * cuCimagf(y)) + cuCimagf(d);
|
| 327 |
+
|
| 328 |
+
real_res = -(cuCimagf(x) * cuCimagf(y)) + real_res;
|
| 329 |
+
imag_res = (cuCimagf(x) * cuCrealf(y)) + imag_res;
|
| 330 |
+
|
| 331 |
+
return make_cuComplex(real_res, imag_res);
|
| 332 |
+
}
|
| 333 |
+
|
| 334 |
+
__host__ __device__ static __inline__ cuDoubleComplex cuCfma( cuDoubleComplex x, cuDoubleComplex y, cuDoubleComplex d)
|
| 335 |
+
{
|
| 336 |
+
double real_res;
|
| 337 |
+
double imag_res;
|
| 338 |
+
|
| 339 |
+
real_res = (cuCreal(x) * cuCreal(y)) + cuCreal(d);
|
| 340 |
+
imag_res = (cuCreal(x) * cuCimag(y)) + cuCimag(d);
|
| 341 |
+
|
| 342 |
+
real_res = -(cuCimag(x) * cuCimag(y)) + real_res;
|
| 343 |
+
imag_res = (cuCimag(x) * cuCreal(y)) + imag_res;
|
| 344 |
+
|
| 345 |
+
return make_cuDoubleComplex(real_res, imag_res);
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
#endif /* !defined(CU_COMPLEX_H_) */
|
lib/python3.11/site-packages/nvidia/cu13/include/cublas.h
ADDED
|
@@ -0,0 +1,888 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
/*
|
| 51 |
+
* This is the public header file for the CUBLAS library, defining the API
|
| 52 |
+
*
|
| 53 |
+
* CUBLAS is an implementation of BLAS (Basic Linear Algebra Subroutines)
|
| 54 |
+
* on top of the CUDA runtime.
|
| 55 |
+
*/
|
| 56 |
+
|
| 57 |
+
#if !defined(CUBLAS_H_)
|
| 58 |
+
#define CUBLAS_H_
|
| 59 |
+
|
| 60 |
+
#if defined(CUBLAS_V2_H_)
|
| 61 |
+
#error "It is an error to include both cublas.h and cublas_v2.h"
|
| 62 |
+
#endif
|
| 63 |
+
|
| 64 |
+
#include <cuda_runtime.h>
|
| 65 |
+
|
| 66 |
+
#ifndef CUBLASWINAPI
|
| 67 |
+
#ifdef _WIN32
|
| 68 |
+
#define CUBLASWINAPI __stdcall
|
| 69 |
+
#else
|
| 70 |
+
#define CUBLASWINAPI
|
| 71 |
+
#endif
|
| 72 |
+
#endif
|
| 73 |
+
|
| 74 |
+
#ifndef CUBLASAPI
|
| 75 |
+
#define CUBLASAPI
|
| 76 |
+
#endif
|
| 77 |
+
|
| 78 |
+
#include "cublas_api.h"
|
| 79 |
+
|
| 80 |
+
#if defined(__cplusplus)
|
| 81 |
+
extern "C" {
|
| 82 |
+
#endif
|
| 83 |
+
|
| 84 |
+
/* CUBLAS data types */
|
| 85 |
+
#define cublasStatus cublasStatus_t
|
| 86 |
+
|
| 87 |
+
cublasStatus CUBLASWINAPI cublasInit(void);
|
| 88 |
+
cublasStatus CUBLASWINAPI cublasShutdown(void);
|
| 89 |
+
cublasStatus CUBLASWINAPI cublasGetError(void);
|
| 90 |
+
|
| 91 |
+
cublasStatus CUBLASWINAPI cublasGetVersion(int* version);
|
| 92 |
+
cublasStatus CUBLASWINAPI cublasAlloc(int n, int elemSize, void** devicePtr);
|
| 93 |
+
|
| 94 |
+
cublasStatus CUBLASWINAPI cublasFree(void* devicePtr);
|
| 95 |
+
|
| 96 |
+
cublasStatus CUBLASWINAPI cublasSetKernelStream(cudaStream_t stream);
|
| 97 |
+
|
| 98 |
+
/* ---------------- CUBLAS BLAS1 functions ---------------- */
|
| 99 |
+
/* NRM2 */
|
| 100 |
+
float CUBLASWINAPI cublasSnrm2(int n, const float* x, int incx);
|
| 101 |
+
double CUBLASWINAPI cublasDnrm2(int n, const double* x, int incx);
|
| 102 |
+
float CUBLASWINAPI cublasScnrm2(int n, const cuComplex* x, int incx);
|
| 103 |
+
double CUBLASWINAPI cublasDznrm2(int n, const cuDoubleComplex* x, int incx);
|
| 104 |
+
/*------------------------------------------------------------------------*/
|
| 105 |
+
/* DOT */
|
| 106 |
+
float CUBLASWINAPI cublasSdot(int n, const float* x, int incx, const float* y, int incy);
|
| 107 |
+
double CUBLASWINAPI cublasDdot(int n, const double* x, int incx, const double* y, int incy);
|
| 108 |
+
cuComplex CUBLASWINAPI cublasCdotu(int n, const cuComplex* x, int incx, const cuComplex* y, int incy);
|
| 109 |
+
cuComplex CUBLASWINAPI cublasCdotc(int n, const cuComplex* x, int incx, const cuComplex* y, int incy);
|
| 110 |
+
cuDoubleComplex CUBLASWINAPI cublasZdotu(int n, const cuDoubleComplex* x, int incx, const cuDoubleComplex* y, int incy);
|
| 111 |
+
cuDoubleComplex CUBLASWINAPI cublasZdotc(int n, const cuDoubleComplex* x, int incx, const cuDoubleComplex* y, int incy);
|
| 112 |
+
/*------------------------------------------------------------------------*/
|
| 113 |
+
/* SCAL */
|
| 114 |
+
void CUBLASWINAPI cublasSscal(int n, float alpha, float* x, int incx);
|
| 115 |
+
void CUBLASWINAPI cublasDscal(int n, double alpha, double* x, int incx);
|
| 116 |
+
void CUBLASWINAPI cublasCscal(int n, cuComplex alpha, cuComplex* x, int incx);
|
| 117 |
+
void CUBLASWINAPI cublasZscal(int n, cuDoubleComplex alpha, cuDoubleComplex* x, int incx);
|
| 118 |
+
|
| 119 |
+
void CUBLASWINAPI cublasCsscal(int n, float alpha, cuComplex* x, int incx);
|
| 120 |
+
void CUBLASWINAPI cublasZdscal(int n, double alpha, cuDoubleComplex* x, int incx);
|
| 121 |
+
/*------------------------------------------------------------------------*/
|
| 122 |
+
/* AXPY */
|
| 123 |
+
void CUBLASWINAPI cublasSaxpy(int n, float alpha, const float* x, int incx, float* y, int incy);
|
| 124 |
+
void CUBLASWINAPI cublasDaxpy(int n, double alpha, const double* x, int incx, double* y, int incy);
|
| 125 |
+
void CUBLASWINAPI cublasCaxpy(int n, cuComplex alpha, const cuComplex* x, int incx, cuComplex* y, int incy);
|
| 126 |
+
void CUBLASWINAPI
|
| 127 |
+
cublasZaxpy(int n, cuDoubleComplex alpha, const cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy);
|
| 128 |
+
/*------------------------------------------------------------------------*/
|
| 129 |
+
/* COPY */
|
| 130 |
+
void CUBLASWINAPI cublasScopy(int n, const float* x, int incx, float* y, int incy);
|
| 131 |
+
void CUBLASWINAPI cublasDcopy(int n, const double* x, int incx, double* y, int incy);
|
| 132 |
+
void CUBLASWINAPI cublasCcopy(int n, const cuComplex* x, int incx, cuComplex* y, int incy);
|
| 133 |
+
void CUBLASWINAPI cublasZcopy(int n, const cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy);
|
| 134 |
+
/*------------------------------------------------------------------------*/
|
| 135 |
+
/* SWAP */
|
| 136 |
+
void CUBLASWINAPI cublasSswap(int n, float* x, int incx, float* y, int incy);
|
| 137 |
+
void CUBLASWINAPI cublasDswap(int n, double* x, int incx, double* y, int incy);
|
| 138 |
+
void CUBLASWINAPI cublasCswap(int n, cuComplex* x, int incx, cuComplex* y, int incy);
|
| 139 |
+
void CUBLASWINAPI cublasZswap(int n, cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy);
|
| 140 |
+
/*------------------------------------------------------------------------*/
|
| 141 |
+
/* AMAX */
|
| 142 |
+
int CUBLASWINAPI cublasIsamax(int n, const float* x, int incx);
|
| 143 |
+
int CUBLASWINAPI cublasIdamax(int n, const double* x, int incx);
|
| 144 |
+
int CUBLASWINAPI cublasIcamax(int n, const cuComplex* x, int incx);
|
| 145 |
+
int CUBLASWINAPI cublasIzamax(int n, const cuDoubleComplex* x, int incx);
|
| 146 |
+
/*------------------------------------------------------------------------*/
|
| 147 |
+
/* AMIN */
|
| 148 |
+
int CUBLASWINAPI cublasIsamin(int n, const float* x, int incx);
|
| 149 |
+
int CUBLASWINAPI cublasIdamin(int n, const double* x, int incx);
|
| 150 |
+
|
| 151 |
+
int CUBLASWINAPI cublasIcamin(int n, const cuComplex* x, int incx);
|
| 152 |
+
int CUBLASWINAPI cublasIzamin(int n, const cuDoubleComplex* x, int incx);
|
| 153 |
+
/*------------------------------------------------------------------------*/
|
| 154 |
+
/* ASUM */
|
| 155 |
+
float CUBLASWINAPI cublasSasum(int n, const float* x, int incx);
|
| 156 |
+
double CUBLASWINAPI cublasDasum(int n, const double* x, int incx);
|
| 157 |
+
float CUBLASWINAPI cublasScasum(int n, const cuComplex* x, int incx);
|
| 158 |
+
double CUBLASWINAPI cublasDzasum(int n, const cuDoubleComplex* x, int incx);
|
| 159 |
+
/*------------------------------------------------------------------------*/
|
| 160 |
+
/* ROT */
|
| 161 |
+
void CUBLASWINAPI cublasSrot(int n, float* x, int incx, float* y, int incy, float sc, float ss);
|
| 162 |
+
void CUBLASWINAPI cublasDrot(int n, double* x, int incx, double* y, int incy, double sc, double ss);
|
| 163 |
+
void CUBLASWINAPI cublasCrot(int n, cuComplex* x, int incx, cuComplex* y, int incy, float c, cuComplex s);
|
| 164 |
+
void CUBLASWINAPI
|
| 165 |
+
cublasZrot(int n, cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy, double sc, cuDoubleComplex cs);
|
| 166 |
+
void CUBLASWINAPI cublasCsrot(int n, cuComplex* x, int incx, cuComplex* y, int incy, float c, float s);
|
| 167 |
+
void CUBLASWINAPI cublasZdrot(int n, cuDoubleComplex* x, int incx, cuDoubleComplex* y, int incy, double c, double s);
|
| 168 |
+
/*------------------------------------------------------------------------*/
|
| 169 |
+
/* ROTG */
|
| 170 |
+
void CUBLASWINAPI cublasSrotg(float* sa, float* sb, float* sc, float* ss);
|
| 171 |
+
void CUBLASWINAPI cublasDrotg(double* sa, double* sb, double* sc, double* ss);
|
| 172 |
+
void CUBLASWINAPI cublasCrotg(cuComplex* ca, cuComplex cb, float* sc, cuComplex* cs);
|
| 173 |
+
void CUBLASWINAPI cublasZrotg(cuDoubleComplex* ca, cuDoubleComplex cb, double* sc, cuDoubleComplex* cs);
|
| 174 |
+
/*------------------------------------------------------------------------*/
|
| 175 |
+
/* ROTM */
|
| 176 |
+
void CUBLASWINAPI cublasSrotm(int n, float* x, int incx, float* y, int incy, const float* sparam);
|
| 177 |
+
void CUBLASWINAPI cublasDrotm(int n, double* x, int incx, double* y, int incy, const double* sparam);
|
| 178 |
+
/*------------------------------------------------------------------------*/
|
| 179 |
+
/* ROTMG */
|
| 180 |
+
void CUBLASWINAPI cublasSrotmg(float* sd1, float* sd2, float* sx1, const float* sy1, float* sparam);
|
| 181 |
+
void CUBLASWINAPI cublasDrotmg(double* sd1, double* sd2, double* sx1, const double* sy1, double* sparam);
|
| 182 |
+
|
| 183 |
+
/* --------------- CUBLAS BLAS2 functions ---------------- */
|
| 184 |
+
/* GEMV */
|
| 185 |
+
void CUBLASWINAPI cublasSgemv(char trans,
|
| 186 |
+
int m,
|
| 187 |
+
int n,
|
| 188 |
+
float alpha,
|
| 189 |
+
const float* A,
|
| 190 |
+
int lda,
|
| 191 |
+
const float* x,
|
| 192 |
+
int incx,
|
| 193 |
+
float beta,
|
| 194 |
+
float* y,
|
| 195 |
+
int incy);
|
| 196 |
+
void CUBLASWINAPI cublasDgemv(char trans,
|
| 197 |
+
int m,
|
| 198 |
+
int n,
|
| 199 |
+
double alpha,
|
| 200 |
+
const double* A,
|
| 201 |
+
int lda,
|
| 202 |
+
const double* x,
|
| 203 |
+
int incx,
|
| 204 |
+
double beta,
|
| 205 |
+
double* y,
|
| 206 |
+
int incy);
|
| 207 |
+
void CUBLASWINAPI cublasCgemv(char trans,
|
| 208 |
+
int m,
|
| 209 |
+
int n,
|
| 210 |
+
cuComplex alpha,
|
| 211 |
+
const cuComplex* A,
|
| 212 |
+
int lda,
|
| 213 |
+
const cuComplex* x,
|
| 214 |
+
int incx,
|
| 215 |
+
cuComplex beta,
|
| 216 |
+
cuComplex* y,
|
| 217 |
+
int incy);
|
| 218 |
+
void CUBLASWINAPI cublasZgemv(char trans,
|
| 219 |
+
int m,
|
| 220 |
+
int n,
|
| 221 |
+
cuDoubleComplex alpha,
|
| 222 |
+
const cuDoubleComplex* A,
|
| 223 |
+
int lda,
|
| 224 |
+
const cuDoubleComplex* x,
|
| 225 |
+
int incx,
|
| 226 |
+
cuDoubleComplex beta,
|
| 227 |
+
cuDoubleComplex* y,
|
| 228 |
+
int incy);
|
| 229 |
+
/*------------------------------------------------------------------------*/
|
| 230 |
+
/* GBMV */
|
| 231 |
+
void CUBLASWINAPI cublasSgbmv(char trans,
|
| 232 |
+
int m,
|
| 233 |
+
int n,
|
| 234 |
+
int kl,
|
| 235 |
+
int ku,
|
| 236 |
+
float alpha,
|
| 237 |
+
const float* A,
|
| 238 |
+
int lda,
|
| 239 |
+
const float* x,
|
| 240 |
+
int incx,
|
| 241 |
+
float beta,
|
| 242 |
+
float* y,
|
| 243 |
+
int incy);
|
| 244 |
+
void CUBLASWINAPI cublasDgbmv(char trans,
|
| 245 |
+
int m,
|
| 246 |
+
int n,
|
| 247 |
+
int kl,
|
| 248 |
+
int ku,
|
| 249 |
+
double alpha,
|
| 250 |
+
const double* A,
|
| 251 |
+
int lda,
|
| 252 |
+
const double* x,
|
| 253 |
+
int incx,
|
| 254 |
+
double beta,
|
| 255 |
+
double* y,
|
| 256 |
+
int incy);
|
| 257 |
+
void CUBLASWINAPI cublasCgbmv(char trans,
|
| 258 |
+
int m,
|
| 259 |
+
int n,
|
| 260 |
+
int kl,
|
| 261 |
+
int ku,
|
| 262 |
+
cuComplex alpha,
|
| 263 |
+
const cuComplex* A,
|
| 264 |
+
int lda,
|
| 265 |
+
const cuComplex* x,
|
| 266 |
+
int incx,
|
| 267 |
+
cuComplex beta,
|
| 268 |
+
cuComplex* y,
|
| 269 |
+
int incy);
|
| 270 |
+
void CUBLASWINAPI cublasZgbmv(char trans,
|
| 271 |
+
int m,
|
| 272 |
+
int n,
|
| 273 |
+
int kl,
|
| 274 |
+
int ku,
|
| 275 |
+
cuDoubleComplex alpha,
|
| 276 |
+
const cuDoubleComplex* A,
|
| 277 |
+
int lda,
|
| 278 |
+
const cuDoubleComplex* x,
|
| 279 |
+
int incx,
|
| 280 |
+
cuDoubleComplex beta,
|
| 281 |
+
cuDoubleComplex* y,
|
| 282 |
+
int incy);
|
| 283 |
+
/*------------------------------------------------------------------------*/
|
| 284 |
+
/* TRMV */
|
| 285 |
+
void CUBLASWINAPI cublasStrmv(char uplo, char trans, char diag, int n, const float* A, int lda, float* x, int incx);
|
| 286 |
+
void CUBLASWINAPI cublasDtrmv(char uplo, char trans, char diag, int n, const double* A, int lda, double* x, int incx);
|
| 287 |
+
void CUBLASWINAPI
|
| 288 |
+
cublasCtrmv(char uplo, char trans, char diag, int n, const cuComplex* A, int lda, cuComplex* x, int incx);
|
| 289 |
+
void CUBLASWINAPI
|
| 290 |
+
cublasZtrmv(char uplo, char trans, char diag, int n, const cuDoubleComplex* A, int lda, cuDoubleComplex* x, int incx);
|
| 291 |
+
/*------------------------------------------------------------------------*/
|
| 292 |
+
/* TBMV */
|
| 293 |
+
void CUBLASWINAPI
|
| 294 |
+
cublasStbmv(char uplo, char trans, char diag, int n, int k, const float* A, int lda, float* x, int incx);
|
| 295 |
+
void CUBLASWINAPI
|
| 296 |
+
cublasDtbmv(char uplo, char trans, char diag, int n, int k, const double* A, int lda, double* x, int incx);
|
| 297 |
+
void CUBLASWINAPI
|
| 298 |
+
cublasCtbmv(char uplo, char trans, char diag, int n, int k, const cuComplex* A, int lda, cuComplex* x, int incx);
|
| 299 |
+
void CUBLASWINAPI cublasZtbmv(
|
| 300 |
+
char uplo, char trans, char diag, int n, int k, const cuDoubleComplex* A, int lda, cuDoubleComplex* x, int incx);
|
| 301 |
+
/*------------------------------------------------------------------------*/
|
| 302 |
+
/* TPMV */
|
| 303 |
+
void CUBLASWINAPI cublasStpmv(char uplo, char trans, char diag, int n, const float* AP, float* x, int incx);
|
| 304 |
+
|
| 305 |
+
void CUBLASWINAPI cublasDtpmv(char uplo, char trans, char diag, int n, const double* AP, double* x, int incx);
|
| 306 |
+
|
| 307 |
+
void CUBLASWINAPI cublasCtpmv(char uplo, char trans, char diag, int n, const cuComplex* AP, cuComplex* x, int incx);
|
| 308 |
+
|
| 309 |
+
void CUBLASWINAPI
|
| 310 |
+
cublasZtpmv(char uplo, char trans, char diag, int n, const cuDoubleComplex* AP, cuDoubleComplex* x, int incx);
|
| 311 |
+
/*------------------------------------------------------------------------*/
|
| 312 |
+
/* TRSV */
|
| 313 |
+
void CUBLASWINAPI cublasStrsv(char uplo, char trans, char diag, int n, const float* A, int lda, float* x, int incx);
|
| 314 |
+
|
| 315 |
+
void CUBLASWINAPI cublasDtrsv(char uplo, char trans, char diag, int n, const double* A, int lda, double* x, int incx);
|
| 316 |
+
|
| 317 |
+
void CUBLASWINAPI
|
| 318 |
+
cublasCtrsv(char uplo, char trans, char diag, int n, const cuComplex* A, int lda, cuComplex* x, int incx);
|
| 319 |
+
|
| 320 |
+
void CUBLASWINAPI
|
| 321 |
+
cublasZtrsv(char uplo, char trans, char diag, int n, const cuDoubleComplex* A, int lda, cuDoubleComplex* x, int incx);
|
| 322 |
+
/*------------------------------------------------------------------------*/
|
| 323 |
+
/* TPSV */
|
| 324 |
+
void CUBLASWINAPI cublasStpsv(char uplo, char trans, char diag, int n, const float* AP, float* x, int incx);
|
| 325 |
+
|
| 326 |
+
void CUBLASWINAPI cublasDtpsv(char uplo, char trans, char diag, int n, const double* AP, double* x, int incx);
|
| 327 |
+
|
| 328 |
+
void CUBLASWINAPI cublasCtpsv(char uplo, char trans, char diag, int n, const cuComplex* AP, cuComplex* x, int incx);
|
| 329 |
+
|
| 330 |
+
void CUBLASWINAPI
|
| 331 |
+
cublasZtpsv(char uplo, char trans, char diag, int n, const cuDoubleComplex* AP, cuDoubleComplex* x, int incx);
|
| 332 |
+
/*------------------------------------------------------------------------*/
|
| 333 |
+
/* TBSV */
|
| 334 |
+
void CUBLASWINAPI
|
| 335 |
+
cublasStbsv(char uplo, char trans, char diag, int n, int k, const float* A, int lda, float* x, int incx);
|
| 336 |
+
|
| 337 |
+
void CUBLASWINAPI
|
| 338 |
+
cublasDtbsv(char uplo, char trans, char diag, int n, int k, const double* A, int lda, double* x, int incx);
|
| 339 |
+
void CUBLASWINAPI
|
| 340 |
+
cublasCtbsv(char uplo, char trans, char diag, int n, int k, const cuComplex* A, int lda, cuComplex* x, int incx);
|
| 341 |
+
|
| 342 |
+
void CUBLASWINAPI cublasZtbsv(
|
| 343 |
+
char uplo, char trans, char diag, int n, int k, const cuDoubleComplex* A, int lda, cuDoubleComplex* x, int incx);
|
| 344 |
+
/*------------------------------------------------------------------------*/
|
| 345 |
+
/* SYMV/HEMV */
|
| 346 |
+
void CUBLASWINAPI cublasSsymv(
|
| 347 |
+
char uplo, int n, float alpha, const float* A, int lda, const float* x, int incx, float beta, float* y, int incy);
|
| 348 |
+
void CUBLASWINAPI cublasDsymv(char uplo,
|
| 349 |
+
int n,
|
| 350 |
+
double alpha,
|
| 351 |
+
const double* A,
|
| 352 |
+
int lda,
|
| 353 |
+
const double* x,
|
| 354 |
+
int incx,
|
| 355 |
+
double beta,
|
| 356 |
+
double* y,
|
| 357 |
+
int incy);
|
| 358 |
+
void CUBLASWINAPI cublasChemv(char uplo,
|
| 359 |
+
int n,
|
| 360 |
+
cuComplex alpha,
|
| 361 |
+
const cuComplex* A,
|
| 362 |
+
int lda,
|
| 363 |
+
const cuComplex* x,
|
| 364 |
+
int incx,
|
| 365 |
+
cuComplex beta,
|
| 366 |
+
cuComplex* y,
|
| 367 |
+
int incy);
|
| 368 |
+
void CUBLASWINAPI cublasZhemv(char uplo,
|
| 369 |
+
int n,
|
| 370 |
+
cuDoubleComplex alpha,
|
| 371 |
+
const cuDoubleComplex* A,
|
| 372 |
+
int lda,
|
| 373 |
+
const cuDoubleComplex* x,
|
| 374 |
+
int incx,
|
| 375 |
+
cuDoubleComplex beta,
|
| 376 |
+
cuDoubleComplex* y,
|
| 377 |
+
int incy);
|
| 378 |
+
/*------------------------------------------------------------------------*/
|
| 379 |
+
/* SBMV/HBMV */
|
| 380 |
+
void CUBLASWINAPI cublasSsbmv(char uplo,
|
| 381 |
+
int n,
|
| 382 |
+
int k,
|
| 383 |
+
float alpha,
|
| 384 |
+
const float* A,
|
| 385 |
+
int lda,
|
| 386 |
+
const float* x,
|
| 387 |
+
int incx,
|
| 388 |
+
float beta,
|
| 389 |
+
float* y,
|
| 390 |
+
int incy);
|
| 391 |
+
void CUBLASWINAPI cublasDsbmv(char uplo,
|
| 392 |
+
int n,
|
| 393 |
+
int k,
|
| 394 |
+
double alpha,
|
| 395 |
+
const double* A,
|
| 396 |
+
int lda,
|
| 397 |
+
const double* x,
|
| 398 |
+
int incx,
|
| 399 |
+
double beta,
|
| 400 |
+
double* y,
|
| 401 |
+
int incy);
|
| 402 |
+
void CUBLASWINAPI cublasChbmv(char uplo,
|
| 403 |
+
int n,
|
| 404 |
+
int k,
|
| 405 |
+
cuComplex alpha,
|
| 406 |
+
const cuComplex* A,
|
| 407 |
+
int lda,
|
| 408 |
+
const cuComplex* x,
|
| 409 |
+
int incx,
|
| 410 |
+
cuComplex beta,
|
| 411 |
+
cuComplex* y,
|
| 412 |
+
int incy);
|
| 413 |
+
void CUBLASWINAPI cublasZhbmv(char uplo,
|
| 414 |
+
int n,
|
| 415 |
+
int k,
|
| 416 |
+
cuDoubleComplex alpha,
|
| 417 |
+
const cuDoubleComplex* A,
|
| 418 |
+
int lda,
|
| 419 |
+
const cuDoubleComplex* x,
|
| 420 |
+
int incx,
|
| 421 |
+
cuDoubleComplex beta,
|
| 422 |
+
cuDoubleComplex* y,
|
| 423 |
+
int incy);
|
| 424 |
+
/*------------------------------------------------------------------------*/
|
| 425 |
+
/* SPMV/HPMV */
|
| 426 |
+
void CUBLASWINAPI
|
| 427 |
+
cublasSspmv(char uplo, int n, float alpha, const float* AP, const float* x, int incx, float beta, float* y, int incy);
|
| 428 |
+
void CUBLASWINAPI cublasDspmv(
|
| 429 |
+
char uplo, int n, double alpha, const double* AP, const double* x, int incx, double beta, double* y, int incy);
|
| 430 |
+
void CUBLASWINAPI cublasChpmv(char uplo,
|
| 431 |
+
int n,
|
| 432 |
+
cuComplex alpha,
|
| 433 |
+
const cuComplex* AP,
|
| 434 |
+
const cuComplex* x,
|
| 435 |
+
int incx,
|
| 436 |
+
cuComplex beta,
|
| 437 |
+
cuComplex* y,
|
| 438 |
+
int incy);
|
| 439 |
+
void CUBLASWINAPI cublasZhpmv(char uplo,
|
| 440 |
+
int n,
|
| 441 |
+
cuDoubleComplex alpha,
|
| 442 |
+
const cuDoubleComplex* AP,
|
| 443 |
+
const cuDoubleComplex* x,
|
| 444 |
+
int incx,
|
| 445 |
+
cuDoubleComplex beta,
|
| 446 |
+
cuDoubleComplex* y,
|
| 447 |
+
int incy);
|
| 448 |
+
|
| 449 |
+
/*------------------------------------------------------------------------*/
|
| 450 |
+
/* GER */
|
| 451 |
+
void CUBLASWINAPI
|
| 452 |
+
cublasSger(int m, int n, float alpha, const float* x, int incx, const float* y, int incy, float* A, int lda);
|
| 453 |
+
void CUBLASWINAPI
|
| 454 |
+
cublasDger(int m, int n, double alpha, const double* x, int incx, const double* y, int incy, double* A, int lda);
|
| 455 |
+
|
| 456 |
+
void CUBLASWINAPI cublasCgeru(
|
| 457 |
+
int m, int n, cuComplex alpha, const cuComplex* x, int incx, const cuComplex* y, int incy, cuComplex* A, int lda);
|
| 458 |
+
void CUBLASWINAPI cublasCgerc(
|
| 459 |
+
int m, int n, cuComplex alpha, const cuComplex* x, int incx, const cuComplex* y, int incy, cuComplex* A, int lda);
|
| 460 |
+
void CUBLASWINAPI cublasZgeru(int m,
|
| 461 |
+
int n,
|
| 462 |
+
cuDoubleComplex alpha,
|
| 463 |
+
const cuDoubleComplex* x,
|
| 464 |
+
int incx,
|
| 465 |
+
const cuDoubleComplex* y,
|
| 466 |
+
int incy,
|
| 467 |
+
cuDoubleComplex* A,
|
| 468 |
+
int lda);
|
| 469 |
+
void CUBLASWINAPI cublasZgerc(int m,
|
| 470 |
+
int n,
|
| 471 |
+
cuDoubleComplex alpha,
|
| 472 |
+
const cuDoubleComplex* x,
|
| 473 |
+
int incx,
|
| 474 |
+
const cuDoubleComplex* y,
|
| 475 |
+
int incy,
|
| 476 |
+
cuDoubleComplex* A,
|
| 477 |
+
int lda);
|
| 478 |
+
/*------------------------------------------------------------------------*/
|
| 479 |
+
/* SYR/HER */
|
| 480 |
+
void CUBLASWINAPI cublasSsyr(char uplo, int n, float alpha, const float* x, int incx, float* A, int lda);
|
| 481 |
+
void CUBLASWINAPI cublasDsyr(char uplo, int n, double alpha, const double* x, int incx, double* A, int lda);
|
| 482 |
+
|
| 483 |
+
void CUBLASWINAPI cublasCher(char uplo, int n, float alpha, const cuComplex* x, int incx, cuComplex* A, int lda);
|
| 484 |
+
void CUBLASWINAPI
|
| 485 |
+
cublasZher(char uplo, int n, double alpha, const cuDoubleComplex* x, int incx, cuDoubleComplex* A, int lda);
|
| 486 |
+
|
| 487 |
+
/*------------------------------------------------------------------------*/
|
| 488 |
+
/* SPR/HPR */
|
| 489 |
+
void CUBLASWINAPI cublasSspr(char uplo, int n, float alpha, const float* x, int incx, float* AP);
|
| 490 |
+
void CUBLASWINAPI cublasDspr(char uplo, int n, double alpha, const double* x, int incx, double* AP);
|
| 491 |
+
void CUBLASWINAPI cublasChpr(char uplo, int n, float alpha, const cuComplex* x, int incx, cuComplex* AP);
|
| 492 |
+
void CUBLASWINAPI cublasZhpr(char uplo, int n, double alpha, const cuDoubleComplex* x, int incx, cuDoubleComplex* AP);
|
| 493 |
+
/*------------------------------------------------------------------------*/
|
| 494 |
+
/* SYR2/HER2 */
|
| 495 |
+
void CUBLASWINAPI
|
| 496 |
+
cublasSsyr2(char uplo, int n, float alpha, const float* x, int incx, const float* y, int incy, float* A, int lda);
|
| 497 |
+
void CUBLASWINAPI
|
| 498 |
+
cublasDsyr2(char uplo, int n, double alpha, const double* x, int incx, const double* y, int incy, double* A, int lda);
|
| 499 |
+
void CUBLASWINAPI cublasCher2(char uplo,
|
| 500 |
+
int n,
|
| 501 |
+
cuComplex alpha,
|
| 502 |
+
const cuComplex* x,
|
| 503 |
+
int incx,
|
| 504 |
+
const cuComplex* y,
|
| 505 |
+
int incy,
|
| 506 |
+
cuComplex* A,
|
| 507 |
+
int lda);
|
| 508 |
+
void CUBLASWINAPI cublasZher2(char uplo,
|
| 509 |
+
int n,
|
| 510 |
+
cuDoubleComplex alpha,
|
| 511 |
+
const cuDoubleComplex* x,
|
| 512 |
+
int incx,
|
| 513 |
+
const cuDoubleComplex* y,
|
| 514 |
+
int incy,
|
| 515 |
+
cuDoubleComplex* A,
|
| 516 |
+
int lda);
|
| 517 |
+
|
| 518 |
+
/*------------------------------------------------------------------------*/
|
| 519 |
+
/* SPR2/HPR2 */
|
| 520 |
+
void CUBLASWINAPI
|
| 521 |
+
cublasSspr2(char uplo, int n, float alpha, const float* x, int incx, const float* y, int incy, float* AP);
|
| 522 |
+
void CUBLASWINAPI
|
| 523 |
+
cublasDspr2(char uplo, int n, double alpha, const double* x, int incx, const double* y, int incy, double* AP);
|
| 524 |
+
void CUBLASWINAPI cublasChpr2(
|
| 525 |
+
char uplo, int n, cuComplex alpha, const cuComplex* x, int incx, const cuComplex* y, int incy, cuComplex* AP);
|
| 526 |
+
void CUBLASWINAPI cublasZhpr2(char uplo,
|
| 527 |
+
int n,
|
| 528 |
+
cuDoubleComplex alpha,
|
| 529 |
+
const cuDoubleComplex* x,
|
| 530 |
+
int incx,
|
| 531 |
+
const cuDoubleComplex* y,
|
| 532 |
+
int incy,
|
| 533 |
+
cuDoubleComplex* AP);
|
| 534 |
+
/* ------------------------BLAS3 Functions ------------------------------- */
|
| 535 |
+
/* GEMM */
|
| 536 |
+
void CUBLASWINAPI cublasSgemm(char transa,
|
| 537 |
+
char transb,
|
| 538 |
+
int m,
|
| 539 |
+
int n,
|
| 540 |
+
int k,
|
| 541 |
+
float alpha,
|
| 542 |
+
const float* A,
|
| 543 |
+
int lda,
|
| 544 |
+
const float* B,
|
| 545 |
+
int ldb,
|
| 546 |
+
float beta,
|
| 547 |
+
float* C,
|
| 548 |
+
int ldc);
|
| 549 |
+
void CUBLASWINAPI cublasDgemm(char transa,
|
| 550 |
+
char transb,
|
| 551 |
+
int m,
|
| 552 |
+
int n,
|
| 553 |
+
int k,
|
| 554 |
+
double alpha,
|
| 555 |
+
const double* A,
|
| 556 |
+
int lda,
|
| 557 |
+
const double* B,
|
| 558 |
+
int ldb,
|
| 559 |
+
double beta,
|
| 560 |
+
double* C,
|
| 561 |
+
int ldc);
|
| 562 |
+
void CUBLASWINAPI cublasCgemm(char transa,
|
| 563 |
+
char transb,
|
| 564 |
+
int m,
|
| 565 |
+
int n,
|
| 566 |
+
int k,
|
| 567 |
+
cuComplex alpha,
|
| 568 |
+
const cuComplex* A,
|
| 569 |
+
int lda,
|
| 570 |
+
const cuComplex* B,
|
| 571 |
+
int ldb,
|
| 572 |
+
cuComplex beta,
|
| 573 |
+
cuComplex* C,
|
| 574 |
+
int ldc);
|
| 575 |
+
void CUBLASWINAPI cublasZgemm(char transa,
|
| 576 |
+
char transb,
|
| 577 |
+
int m,
|
| 578 |
+
int n,
|
| 579 |
+
int k,
|
| 580 |
+
cuDoubleComplex alpha,
|
| 581 |
+
const cuDoubleComplex* A,
|
| 582 |
+
int lda,
|
| 583 |
+
const cuDoubleComplex* B,
|
| 584 |
+
int ldb,
|
| 585 |
+
cuDoubleComplex beta,
|
| 586 |
+
cuDoubleComplex* C,
|
| 587 |
+
int ldc);
|
| 588 |
+
/* -------------------------------------------------------*/
|
| 589 |
+
/* SYRK */
|
| 590 |
+
void CUBLASWINAPI
|
| 591 |
+
cublasSsyrk(char uplo, char trans, int n, int k, float alpha, const float* A, int lda, float beta, float* C, int ldc);
|
| 592 |
+
void CUBLASWINAPI cublasDsyrk(
|
| 593 |
+
char uplo, char trans, int n, int k, double alpha, const double* A, int lda, double beta, double* C, int ldc);
|
| 594 |
+
|
| 595 |
+
void CUBLASWINAPI cublasCsyrk(char uplo,
|
| 596 |
+
char trans,
|
| 597 |
+
int n,
|
| 598 |
+
int k,
|
| 599 |
+
cuComplex alpha,
|
| 600 |
+
const cuComplex* A,
|
| 601 |
+
int lda,
|
| 602 |
+
cuComplex beta,
|
| 603 |
+
cuComplex* C,
|
| 604 |
+
int ldc);
|
| 605 |
+
void CUBLASWINAPI cublasZsyrk(char uplo,
|
| 606 |
+
char trans,
|
| 607 |
+
int n,
|
| 608 |
+
int k,
|
| 609 |
+
cuDoubleComplex alpha,
|
| 610 |
+
const cuDoubleComplex* A,
|
| 611 |
+
int lda,
|
| 612 |
+
cuDoubleComplex beta,
|
| 613 |
+
cuDoubleComplex* C,
|
| 614 |
+
int ldc);
|
| 615 |
+
/* ------------------------------------------------------- */
|
| 616 |
+
/* HERK */
|
| 617 |
+
void CUBLASWINAPI cublasCherk(
|
| 618 |
+
char uplo, char trans, int n, int k, float alpha, const cuComplex* A, int lda, float beta, cuComplex* C, int ldc);
|
| 619 |
+
void CUBLASWINAPI cublasZherk(char uplo,
|
| 620 |
+
char trans,
|
| 621 |
+
int n,
|
| 622 |
+
int k,
|
| 623 |
+
double alpha,
|
| 624 |
+
const cuDoubleComplex* A,
|
| 625 |
+
int lda,
|
| 626 |
+
double beta,
|
| 627 |
+
cuDoubleComplex* C,
|
| 628 |
+
int ldc);
|
| 629 |
+
/* ------------------------------------------------------- */
|
| 630 |
+
/* SYR2K */
|
| 631 |
+
void CUBLASWINAPI cublasSsyr2k(char uplo,
|
| 632 |
+
char trans,
|
| 633 |
+
int n,
|
| 634 |
+
int k,
|
| 635 |
+
float alpha,
|
| 636 |
+
const float* A,
|
| 637 |
+
int lda,
|
| 638 |
+
const float* B,
|
| 639 |
+
int ldb,
|
| 640 |
+
float beta,
|
| 641 |
+
float* C,
|
| 642 |
+
int ldc);
|
| 643 |
+
|
| 644 |
+
void CUBLASWINAPI cublasDsyr2k(char uplo,
|
| 645 |
+
char trans,
|
| 646 |
+
int n,
|
| 647 |
+
int k,
|
| 648 |
+
double alpha,
|
| 649 |
+
const double* A,
|
| 650 |
+
int lda,
|
| 651 |
+
const double* B,
|
| 652 |
+
int ldb,
|
| 653 |
+
double beta,
|
| 654 |
+
double* C,
|
| 655 |
+
int ldc);
|
| 656 |
+
void CUBLASWINAPI cublasCsyr2k(char uplo,
|
| 657 |
+
char trans,
|
| 658 |
+
int n,
|
| 659 |
+
int k,
|
| 660 |
+
cuComplex alpha,
|
| 661 |
+
const cuComplex* A,
|
| 662 |
+
int lda,
|
| 663 |
+
const cuComplex* B,
|
| 664 |
+
int ldb,
|
| 665 |
+
cuComplex beta,
|
| 666 |
+
cuComplex* C,
|
| 667 |
+
int ldc);
|
| 668 |
+
|
| 669 |
+
void CUBLASWINAPI cublasZsyr2k(char uplo,
|
| 670 |
+
char trans,
|
| 671 |
+
int n,
|
| 672 |
+
int k,
|
| 673 |
+
cuDoubleComplex alpha,
|
| 674 |
+
const cuDoubleComplex* A,
|
| 675 |
+
int lda,
|
| 676 |
+
const cuDoubleComplex* B,
|
| 677 |
+
int ldb,
|
| 678 |
+
cuDoubleComplex beta,
|
| 679 |
+
cuDoubleComplex* C,
|
| 680 |
+
int ldc);
|
| 681 |
+
/* ------------------------------------------------------- */
|
| 682 |
+
/* HER2K */
|
| 683 |
+
void CUBLASWINAPI cublasCher2k(char uplo,
|
| 684 |
+
char trans,
|
| 685 |
+
int n,
|
| 686 |
+
int k,
|
| 687 |
+
cuComplex alpha,
|
| 688 |
+
const cuComplex* A,
|
| 689 |
+
int lda,
|
| 690 |
+
const cuComplex* B,
|
| 691 |
+
int ldb,
|
| 692 |
+
float beta,
|
| 693 |
+
cuComplex* C,
|
| 694 |
+
int ldc);
|
| 695 |
+
|
| 696 |
+
void CUBLASWINAPI cublasZher2k(char uplo,
|
| 697 |
+
char trans,
|
| 698 |
+
int n,
|
| 699 |
+
int k,
|
| 700 |
+
cuDoubleComplex alpha,
|
| 701 |
+
const cuDoubleComplex* A,
|
| 702 |
+
int lda,
|
| 703 |
+
const cuDoubleComplex* B,
|
| 704 |
+
int ldb,
|
| 705 |
+
double beta,
|
| 706 |
+
cuDoubleComplex* C,
|
| 707 |
+
int ldc);
|
| 708 |
+
|
| 709 |
+
/*------------------------------------------------------------------------*/
|
| 710 |
+
/* SYMM*/
|
| 711 |
+
void CUBLASWINAPI cublasSsymm(char side,
|
| 712 |
+
char uplo,
|
| 713 |
+
int m,
|
| 714 |
+
int n,
|
| 715 |
+
float alpha,
|
| 716 |
+
const float* A,
|
| 717 |
+
int lda,
|
| 718 |
+
const float* B,
|
| 719 |
+
int ldb,
|
| 720 |
+
float beta,
|
| 721 |
+
float* C,
|
| 722 |
+
int ldc);
|
| 723 |
+
void CUBLASWINAPI cublasDsymm(char side,
|
| 724 |
+
char uplo,
|
| 725 |
+
int m,
|
| 726 |
+
int n,
|
| 727 |
+
double alpha,
|
| 728 |
+
const double* A,
|
| 729 |
+
int lda,
|
| 730 |
+
const double* B,
|
| 731 |
+
int ldb,
|
| 732 |
+
double beta,
|
| 733 |
+
double* C,
|
| 734 |
+
int ldc);
|
| 735 |
+
|
| 736 |
+
void CUBLASWINAPI cublasCsymm(char side,
|
| 737 |
+
char uplo,
|
| 738 |
+
int m,
|
| 739 |
+
int n,
|
| 740 |
+
cuComplex alpha,
|
| 741 |
+
const cuComplex* A,
|
| 742 |
+
int lda,
|
| 743 |
+
const cuComplex* B,
|
| 744 |
+
int ldb,
|
| 745 |
+
cuComplex beta,
|
| 746 |
+
cuComplex* C,
|
| 747 |
+
int ldc);
|
| 748 |
+
|
| 749 |
+
void CUBLASWINAPI cublasZsymm(char side,
|
| 750 |
+
char uplo,
|
| 751 |
+
int m,
|
| 752 |
+
int n,
|
| 753 |
+
cuDoubleComplex alpha,
|
| 754 |
+
const cuDoubleComplex* A,
|
| 755 |
+
int lda,
|
| 756 |
+
const cuDoubleComplex* B,
|
| 757 |
+
int ldb,
|
| 758 |
+
cuDoubleComplex beta,
|
| 759 |
+
cuDoubleComplex* C,
|
| 760 |
+
int ldc);
|
| 761 |
+
/*------------------------------------------------------------------------*/
|
| 762 |
+
/* HEMM*/
|
| 763 |
+
void CUBLASWINAPI cublasChemm(char side,
|
| 764 |
+
char uplo,
|
| 765 |
+
int m,
|
| 766 |
+
int n,
|
| 767 |
+
cuComplex alpha,
|
| 768 |
+
const cuComplex* A,
|
| 769 |
+
int lda,
|
| 770 |
+
const cuComplex* B,
|
| 771 |
+
int ldb,
|
| 772 |
+
cuComplex beta,
|
| 773 |
+
cuComplex* C,
|
| 774 |
+
int ldc);
|
| 775 |
+
void CUBLASWINAPI cublasZhemm(char side,
|
| 776 |
+
char uplo,
|
| 777 |
+
int m,
|
| 778 |
+
int n,
|
| 779 |
+
cuDoubleComplex alpha,
|
| 780 |
+
const cuDoubleComplex* A,
|
| 781 |
+
int lda,
|
| 782 |
+
const cuDoubleComplex* B,
|
| 783 |
+
int ldb,
|
| 784 |
+
cuDoubleComplex beta,
|
| 785 |
+
cuDoubleComplex* C,
|
| 786 |
+
int ldc);
|
| 787 |
+
|
| 788 |
+
/*------------------------------------------------------------------------*/
|
| 789 |
+
/* TRSM*/
|
| 790 |
+
void CUBLASWINAPI cublasStrsm(char side,
|
| 791 |
+
char uplo,
|
| 792 |
+
char transa,
|
| 793 |
+
char diag,
|
| 794 |
+
int m,
|
| 795 |
+
int n,
|
| 796 |
+
float alpha,
|
| 797 |
+
const float* A,
|
| 798 |
+
int lda,
|
| 799 |
+
float* B,
|
| 800 |
+
int ldb);
|
| 801 |
+
|
| 802 |
+
void CUBLASWINAPI cublasDtrsm(char side,
|
| 803 |
+
char uplo,
|
| 804 |
+
char transa,
|
| 805 |
+
char diag,
|
| 806 |
+
int m,
|
| 807 |
+
int n,
|
| 808 |
+
double alpha,
|
| 809 |
+
const double* A,
|
| 810 |
+
int lda,
|
| 811 |
+
double* B,
|
| 812 |
+
int ldb);
|
| 813 |
+
|
| 814 |
+
void CUBLASWINAPI cublasCtrsm(char side,
|
| 815 |
+
char uplo,
|
| 816 |
+
char transa,
|
| 817 |
+
char diag,
|
| 818 |
+
int m,
|
| 819 |
+
int n,
|
| 820 |
+
cuComplex alpha,
|
| 821 |
+
const cuComplex* A,
|
| 822 |
+
int lda,
|
| 823 |
+
cuComplex* B,
|
| 824 |
+
int ldb);
|
| 825 |
+
|
| 826 |
+
void CUBLASWINAPI cublasZtrsm(char side,
|
| 827 |
+
char uplo,
|
| 828 |
+
char transa,
|
| 829 |
+
char diag,
|
| 830 |
+
int m,
|
| 831 |
+
int n,
|
| 832 |
+
cuDoubleComplex alpha,
|
| 833 |
+
const cuDoubleComplex* A,
|
| 834 |
+
int lda,
|
| 835 |
+
cuDoubleComplex* B,
|
| 836 |
+
int ldb);
|
| 837 |
+
/*------------------------------------------------------------------------*/
|
| 838 |
+
/* TRMM*/
|
| 839 |
+
void CUBLASWINAPI cublasStrmm(char side,
|
| 840 |
+
char uplo,
|
| 841 |
+
char transa,
|
| 842 |
+
char diag,
|
| 843 |
+
int m,
|
| 844 |
+
int n,
|
| 845 |
+
float alpha,
|
| 846 |
+
const float* A,
|
| 847 |
+
int lda,
|
| 848 |
+
float* B,
|
| 849 |
+
int ldb);
|
| 850 |
+
void CUBLASWINAPI cublasDtrmm(char side,
|
| 851 |
+
char uplo,
|
| 852 |
+
char transa,
|
| 853 |
+
char diag,
|
| 854 |
+
int m,
|
| 855 |
+
int n,
|
| 856 |
+
double alpha,
|
| 857 |
+
const double* A,
|
| 858 |
+
int lda,
|
| 859 |
+
double* B,
|
| 860 |
+
int ldb);
|
| 861 |
+
void CUBLASWINAPI cublasCtrmm(char side,
|
| 862 |
+
char uplo,
|
| 863 |
+
char transa,
|
| 864 |
+
char diag,
|
| 865 |
+
int m,
|
| 866 |
+
int n,
|
| 867 |
+
cuComplex alpha,
|
| 868 |
+
const cuComplex* A,
|
| 869 |
+
int lda,
|
| 870 |
+
cuComplex* B,
|
| 871 |
+
int ldb);
|
| 872 |
+
void CUBLASWINAPI cublasZtrmm(char side,
|
| 873 |
+
char uplo,
|
| 874 |
+
char transa,
|
| 875 |
+
char diag,
|
| 876 |
+
int m,
|
| 877 |
+
int n,
|
| 878 |
+
cuDoubleComplex alpha,
|
| 879 |
+
const cuDoubleComplex* A,
|
| 880 |
+
int lda,
|
| 881 |
+
cuDoubleComplex* B,
|
| 882 |
+
int ldb);
|
| 883 |
+
|
| 884 |
+
#if defined(__cplusplus)
|
| 885 |
+
}
|
| 886 |
+
#endif /* __cplusplus */
|
| 887 |
+
|
| 888 |
+
#endif /* !defined(CUBLAS_H_) */
|
lib/python3.11/site-packages/nvidia/cu13/include/cublasLt.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lib/python3.11/site-packages/nvidia/cu13/include/cublasXt.h
ADDED
|
@@ -0,0 +1,693 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2019 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
/* cublasXt : Host API, Out of Core and Multi-GPU BLAS Library
|
| 51 |
+
|
| 52 |
+
*/
|
| 53 |
+
|
| 54 |
+
#if !defined(CUBLAS_XT_H_)
|
| 55 |
+
#define CUBLAS_XT_H_
|
| 56 |
+
|
| 57 |
+
#include "driver_types.h"
|
| 58 |
+
#include "cuComplex.h" /* import complex data type */
|
| 59 |
+
|
| 60 |
+
#include "cublas_v2.h"
|
| 61 |
+
|
| 62 |
+
#if defined(__cplusplus)
|
| 63 |
+
extern "C" {
|
| 64 |
+
#endif /* __cplusplus */
|
| 65 |
+
|
| 66 |
+
struct cublasXtContext;
|
| 67 |
+
typedef struct cublasXtContext* cublasXtHandle_t;
|
| 68 |
+
|
| 69 |
+
cublasStatus_t CUBLASWINAPI cublasXtCreate(cublasXtHandle_t* handle);
|
| 70 |
+
cublasStatus_t CUBLASWINAPI cublasXtDestroy(cublasXtHandle_t handle);
|
| 71 |
+
cublasStatus_t CUBLASWINAPI cublasXtGetNumBoards(int nbDevices, int deviceId[], int* nbBoards);
|
| 72 |
+
cublasStatus_t CUBLASWINAPI cublasXtMaxBoards(int* nbGpuBoards);
|
| 73 |
+
/* This routine selects the Gpus that the user want to use for CUBLAS-XT */
|
| 74 |
+
cublasStatus_t CUBLASWINAPI cublasXtDeviceSelect(cublasXtHandle_t handle, int nbDevices, int deviceId[]);
|
| 75 |
+
|
| 76 |
+
/* This routine allows to change the dimension of the tiles ( blockDim x blockDim ) */
|
| 77 |
+
cublasStatus_t CUBLASWINAPI cublasXtSetBlockDim(cublasXtHandle_t handle, int blockDim);
|
| 78 |
+
cublasStatus_t CUBLASWINAPI cublasXtGetBlockDim(cublasXtHandle_t handle, int* blockDim);
|
| 79 |
+
|
| 80 |
+
typedef enum { CUBLASXT_PINNING_DISABLED = 0, CUBLASXT_PINNING_ENABLED = 1 } cublasXtPinnedMemMode_t;
|
| 81 |
+
/* This routine allows to CUBLAS-XT to pin the Host memory if it find out that some of the matrix passed
|
| 82 |
+
are not pinned : Pinning/Unpinning the Host memory is still a costly operation
|
| 83 |
+
It is better if the user controls the memory on its own (by pinning/unpinning oly when necessary)
|
| 84 |
+
*/
|
| 85 |
+
cublasStatus_t CUBLASWINAPI cublasXtGetPinningMemMode(cublasXtHandle_t handle, cublasXtPinnedMemMode_t* mode);
|
| 86 |
+
cublasStatus_t CUBLASWINAPI cublasXtSetPinningMemMode(cublasXtHandle_t handle, cublasXtPinnedMemMode_t mode);
|
| 87 |
+
|
| 88 |
+
/* This routines is to provide a CPU Blas routines, used for too small sizes or hybrid computation */
|
| 89 |
+
typedef enum {
|
| 90 |
+
CUBLASXT_FLOAT = 0,
|
| 91 |
+
CUBLASXT_DOUBLE = 1,
|
| 92 |
+
CUBLASXT_COMPLEX = 2,
|
| 93 |
+
CUBLASXT_DOUBLECOMPLEX = 3,
|
| 94 |
+
} cublasXtOpType_t;
|
| 95 |
+
|
| 96 |
+
typedef enum {
|
| 97 |
+
CUBLASXT_GEMM = 0,
|
| 98 |
+
CUBLASXT_SYRK = 1,
|
| 99 |
+
CUBLASXT_HERK = 2,
|
| 100 |
+
CUBLASXT_SYMM = 3,
|
| 101 |
+
CUBLASXT_HEMM = 4,
|
| 102 |
+
CUBLASXT_TRSM = 5,
|
| 103 |
+
CUBLASXT_SYR2K = 6,
|
| 104 |
+
CUBLASXT_HER2K = 7,
|
| 105 |
+
|
| 106 |
+
CUBLASXT_SPMM = 8,
|
| 107 |
+
CUBLASXT_SYRKX = 9,
|
| 108 |
+
CUBLASXT_HERKX = 10,
|
| 109 |
+
CUBLASXT_TRMM = 11,
|
| 110 |
+
CUBLASXT_ROUTINE_MAX = 12,
|
| 111 |
+
} cublasXtBlasOp_t;
|
| 112 |
+
|
| 113 |
+
/* Currently only 32-bit integer BLAS routines are supported */
|
| 114 |
+
cublasStatus_t CUBLASWINAPI cublasXtSetCpuRoutine(cublasXtHandle_t handle,
|
| 115 |
+
cublasXtBlasOp_t blasOp,
|
| 116 |
+
cublasXtOpType_t type,
|
| 117 |
+
void* blasFunctor);
|
| 118 |
+
|
| 119 |
+
/* Specified the percentage of work that should done by the CPU, default is 0 (no work) */
|
| 120 |
+
cublasStatus_t CUBLASWINAPI cublasXtSetCpuRatio(cublasXtHandle_t handle,
|
| 121 |
+
cublasXtBlasOp_t blasOp,
|
| 122 |
+
cublasXtOpType_t type,
|
| 123 |
+
float ratio);
|
| 124 |
+
|
| 125 |
+
/* GEMM */
|
| 126 |
+
cublasStatus_t CUBLASWINAPI cublasXtSgemm(cublasXtHandle_t handle,
|
| 127 |
+
cublasOperation_t transa,
|
| 128 |
+
cublasOperation_t transb,
|
| 129 |
+
size_t m,
|
| 130 |
+
size_t n,
|
| 131 |
+
size_t k,
|
| 132 |
+
const float* alpha,
|
| 133 |
+
const float* A,
|
| 134 |
+
size_t lda,
|
| 135 |
+
const float* B,
|
| 136 |
+
size_t ldb,
|
| 137 |
+
const float* beta,
|
| 138 |
+
float* C,
|
| 139 |
+
size_t ldc);
|
| 140 |
+
|
| 141 |
+
cublasStatus_t CUBLASWINAPI cublasXtDgemm(cublasXtHandle_t handle,
|
| 142 |
+
cublasOperation_t transa,
|
| 143 |
+
cublasOperation_t transb,
|
| 144 |
+
size_t m,
|
| 145 |
+
size_t n,
|
| 146 |
+
size_t k,
|
| 147 |
+
const double* alpha,
|
| 148 |
+
const double* A,
|
| 149 |
+
size_t lda,
|
| 150 |
+
const double* B,
|
| 151 |
+
size_t ldb,
|
| 152 |
+
const double* beta,
|
| 153 |
+
double* C,
|
| 154 |
+
size_t ldc);
|
| 155 |
+
|
| 156 |
+
cublasStatus_t CUBLASWINAPI cublasXtCgemm(cublasXtHandle_t handle,
|
| 157 |
+
cublasOperation_t transa,
|
| 158 |
+
cublasOperation_t transb,
|
| 159 |
+
size_t m,
|
| 160 |
+
size_t n,
|
| 161 |
+
size_t k,
|
| 162 |
+
const cuComplex* alpha,
|
| 163 |
+
const cuComplex* A,
|
| 164 |
+
size_t lda,
|
| 165 |
+
const cuComplex* B,
|
| 166 |
+
size_t ldb,
|
| 167 |
+
const cuComplex* beta,
|
| 168 |
+
cuComplex* C,
|
| 169 |
+
size_t ldc);
|
| 170 |
+
|
| 171 |
+
cublasStatus_t CUBLASWINAPI cublasXtZgemm(cublasXtHandle_t handle,
|
| 172 |
+
cublasOperation_t transa,
|
| 173 |
+
cublasOperation_t transb,
|
| 174 |
+
size_t m,
|
| 175 |
+
size_t n,
|
| 176 |
+
size_t k,
|
| 177 |
+
const cuDoubleComplex* alpha,
|
| 178 |
+
const cuDoubleComplex* A,
|
| 179 |
+
size_t lda,
|
| 180 |
+
const cuDoubleComplex* B,
|
| 181 |
+
size_t ldb,
|
| 182 |
+
const cuDoubleComplex* beta,
|
| 183 |
+
cuDoubleComplex* C,
|
| 184 |
+
size_t ldc);
|
| 185 |
+
/* ------------------------------------------------------- */
|
| 186 |
+
/* SYRK */
|
| 187 |
+
cublasStatus_t CUBLASWINAPI cublasXtSsyrk(cublasXtHandle_t handle,
|
| 188 |
+
cublasFillMode_t uplo,
|
| 189 |
+
cublasOperation_t trans,
|
| 190 |
+
size_t n,
|
| 191 |
+
size_t k,
|
| 192 |
+
const float* alpha,
|
| 193 |
+
const float* A,
|
| 194 |
+
size_t lda,
|
| 195 |
+
const float* beta,
|
| 196 |
+
float* C,
|
| 197 |
+
size_t ldc);
|
| 198 |
+
|
| 199 |
+
cublasStatus_t CUBLASWINAPI cublasXtDsyrk(cublasXtHandle_t handle,
|
| 200 |
+
cublasFillMode_t uplo,
|
| 201 |
+
cublasOperation_t trans,
|
| 202 |
+
size_t n,
|
| 203 |
+
size_t k,
|
| 204 |
+
const double* alpha,
|
| 205 |
+
const double* A,
|
| 206 |
+
size_t lda,
|
| 207 |
+
const double* beta,
|
| 208 |
+
double* C,
|
| 209 |
+
size_t ldc);
|
| 210 |
+
|
| 211 |
+
cublasStatus_t CUBLASWINAPI cublasXtCsyrk(cublasXtHandle_t handle,
|
| 212 |
+
cublasFillMode_t uplo,
|
| 213 |
+
cublasOperation_t trans,
|
| 214 |
+
size_t n,
|
| 215 |
+
size_t k,
|
| 216 |
+
const cuComplex* alpha,
|
| 217 |
+
const cuComplex* A,
|
| 218 |
+
size_t lda,
|
| 219 |
+
const cuComplex* beta,
|
| 220 |
+
cuComplex* C,
|
| 221 |
+
size_t ldc);
|
| 222 |
+
|
| 223 |
+
cublasStatus_t CUBLASWINAPI cublasXtZsyrk(cublasXtHandle_t handle,
|
| 224 |
+
cublasFillMode_t uplo,
|
| 225 |
+
cublasOperation_t trans,
|
| 226 |
+
size_t n,
|
| 227 |
+
size_t k,
|
| 228 |
+
const cuDoubleComplex* alpha,
|
| 229 |
+
const cuDoubleComplex* A,
|
| 230 |
+
size_t lda,
|
| 231 |
+
const cuDoubleComplex* beta,
|
| 232 |
+
cuDoubleComplex* C,
|
| 233 |
+
size_t ldc);
|
| 234 |
+
/* -------------------------------------------------------------------- */
|
| 235 |
+
/* HERK */
|
| 236 |
+
cublasStatus_t CUBLASWINAPI cublasXtCherk(cublasXtHandle_t handle,
|
| 237 |
+
cublasFillMode_t uplo,
|
| 238 |
+
cublasOperation_t trans,
|
| 239 |
+
size_t n,
|
| 240 |
+
size_t k,
|
| 241 |
+
const float* alpha,
|
| 242 |
+
const cuComplex* A,
|
| 243 |
+
size_t lda,
|
| 244 |
+
const float* beta,
|
| 245 |
+
cuComplex* C,
|
| 246 |
+
size_t ldc);
|
| 247 |
+
|
| 248 |
+
cublasStatus_t CUBLASWINAPI cublasXtZherk(cublasXtHandle_t handle,
|
| 249 |
+
cublasFillMode_t uplo,
|
| 250 |
+
cublasOperation_t trans,
|
| 251 |
+
size_t n,
|
| 252 |
+
size_t k,
|
| 253 |
+
const double* alpha,
|
| 254 |
+
const cuDoubleComplex* A,
|
| 255 |
+
size_t lda,
|
| 256 |
+
const double* beta,
|
| 257 |
+
cuDoubleComplex* C,
|
| 258 |
+
size_t ldc);
|
| 259 |
+
/* -------------------------------------------------------------------- */
|
| 260 |
+
/* SYR2K */
|
| 261 |
+
cublasStatus_t CUBLASWINAPI cublasXtSsyr2k(cublasXtHandle_t handle,
|
| 262 |
+
cublasFillMode_t uplo,
|
| 263 |
+
cublasOperation_t trans,
|
| 264 |
+
size_t n,
|
| 265 |
+
size_t k,
|
| 266 |
+
const float* alpha,
|
| 267 |
+
const float* A,
|
| 268 |
+
size_t lda,
|
| 269 |
+
const float* B,
|
| 270 |
+
size_t ldb,
|
| 271 |
+
const float* beta,
|
| 272 |
+
float* C,
|
| 273 |
+
size_t ldc);
|
| 274 |
+
|
| 275 |
+
cublasStatus_t CUBLASWINAPI cublasXtDsyr2k(cublasXtHandle_t handle,
|
| 276 |
+
cublasFillMode_t uplo,
|
| 277 |
+
cublasOperation_t trans,
|
| 278 |
+
size_t n,
|
| 279 |
+
size_t k,
|
| 280 |
+
const double* alpha,
|
| 281 |
+
const double* A,
|
| 282 |
+
size_t lda,
|
| 283 |
+
const double* B,
|
| 284 |
+
size_t ldb,
|
| 285 |
+
const double* beta,
|
| 286 |
+
double* C,
|
| 287 |
+
size_t ldc);
|
| 288 |
+
|
| 289 |
+
cublasStatus_t CUBLASWINAPI cublasXtCsyr2k(cublasXtHandle_t handle,
|
| 290 |
+
cublasFillMode_t uplo,
|
| 291 |
+
cublasOperation_t trans,
|
| 292 |
+
size_t n,
|
| 293 |
+
size_t k,
|
| 294 |
+
const cuComplex* alpha,
|
| 295 |
+
const cuComplex* A,
|
| 296 |
+
size_t lda,
|
| 297 |
+
const cuComplex* B,
|
| 298 |
+
size_t ldb,
|
| 299 |
+
const cuComplex* beta,
|
| 300 |
+
cuComplex* C,
|
| 301 |
+
size_t ldc);
|
| 302 |
+
|
| 303 |
+
cublasStatus_t CUBLASWINAPI cublasXtZsyr2k(cublasXtHandle_t handle,
|
| 304 |
+
cublasFillMode_t uplo,
|
| 305 |
+
cublasOperation_t trans,
|
| 306 |
+
size_t n,
|
| 307 |
+
size_t k,
|
| 308 |
+
const cuDoubleComplex* alpha,
|
| 309 |
+
const cuDoubleComplex* A,
|
| 310 |
+
size_t lda,
|
| 311 |
+
const cuDoubleComplex* B,
|
| 312 |
+
size_t ldb,
|
| 313 |
+
const cuDoubleComplex* beta,
|
| 314 |
+
cuDoubleComplex* C,
|
| 315 |
+
size_t ldc);
|
| 316 |
+
/* -------------------------------------------------------------------- */
|
| 317 |
+
/* HERKX : variant extension of HERK */
|
| 318 |
+
cublasStatus_t CUBLASWINAPI cublasXtCherkx(cublasXtHandle_t handle,
|
| 319 |
+
cublasFillMode_t uplo,
|
| 320 |
+
cublasOperation_t trans,
|
| 321 |
+
size_t n,
|
| 322 |
+
size_t k,
|
| 323 |
+
const cuComplex* alpha,
|
| 324 |
+
const cuComplex* A,
|
| 325 |
+
size_t lda,
|
| 326 |
+
const cuComplex* B,
|
| 327 |
+
size_t ldb,
|
| 328 |
+
const float* beta,
|
| 329 |
+
cuComplex* C,
|
| 330 |
+
size_t ldc);
|
| 331 |
+
|
| 332 |
+
cublasStatus_t CUBLASWINAPI cublasXtZherkx(cublasXtHandle_t handle,
|
| 333 |
+
cublasFillMode_t uplo,
|
| 334 |
+
cublasOperation_t trans,
|
| 335 |
+
size_t n,
|
| 336 |
+
size_t k,
|
| 337 |
+
const cuDoubleComplex* alpha,
|
| 338 |
+
const cuDoubleComplex* A,
|
| 339 |
+
size_t lda,
|
| 340 |
+
const cuDoubleComplex* B,
|
| 341 |
+
size_t ldb,
|
| 342 |
+
const double* beta,
|
| 343 |
+
cuDoubleComplex* C,
|
| 344 |
+
size_t ldc);
|
| 345 |
+
|
| 346 |
+
/* -------------------------------------------------------------------- */
|
| 347 |
+
/* TRSM */
|
| 348 |
+
cublasStatus_t CUBLASWINAPI cublasXtStrsm(cublasXtHandle_t handle,
|
| 349 |
+
cublasSideMode_t side,
|
| 350 |
+
cublasFillMode_t uplo,
|
| 351 |
+
cublasOperation_t trans,
|
| 352 |
+
cublasDiagType_t diag,
|
| 353 |
+
size_t m,
|
| 354 |
+
size_t n,
|
| 355 |
+
const float* alpha,
|
| 356 |
+
const float* A,
|
| 357 |
+
size_t lda,
|
| 358 |
+
float* B,
|
| 359 |
+
size_t ldb);
|
| 360 |
+
|
| 361 |
+
cublasStatus_t CUBLASWINAPI cublasXtDtrsm(cublasXtHandle_t handle,
|
| 362 |
+
cublasSideMode_t side,
|
| 363 |
+
cublasFillMode_t uplo,
|
| 364 |
+
cublasOperation_t trans,
|
| 365 |
+
cublasDiagType_t diag,
|
| 366 |
+
size_t m,
|
| 367 |
+
size_t n,
|
| 368 |
+
const double* alpha,
|
| 369 |
+
const double* A,
|
| 370 |
+
size_t lda,
|
| 371 |
+
double* B,
|
| 372 |
+
size_t ldb);
|
| 373 |
+
|
| 374 |
+
cublasStatus_t CUBLASWINAPI cublasXtCtrsm(cublasXtHandle_t handle,
|
| 375 |
+
cublasSideMode_t side,
|
| 376 |
+
cublasFillMode_t uplo,
|
| 377 |
+
cublasOperation_t trans,
|
| 378 |
+
cublasDiagType_t diag,
|
| 379 |
+
size_t m,
|
| 380 |
+
size_t n,
|
| 381 |
+
const cuComplex* alpha,
|
| 382 |
+
const cuComplex* A,
|
| 383 |
+
size_t lda,
|
| 384 |
+
cuComplex* B,
|
| 385 |
+
size_t ldb);
|
| 386 |
+
|
| 387 |
+
cublasStatus_t CUBLASWINAPI cublasXtZtrsm(cublasXtHandle_t handle,
|
| 388 |
+
cublasSideMode_t side,
|
| 389 |
+
cublasFillMode_t uplo,
|
| 390 |
+
cublasOperation_t trans,
|
| 391 |
+
cublasDiagType_t diag,
|
| 392 |
+
size_t m,
|
| 393 |
+
size_t n,
|
| 394 |
+
const cuDoubleComplex* alpha,
|
| 395 |
+
const cuDoubleComplex* A,
|
| 396 |
+
size_t lda,
|
| 397 |
+
cuDoubleComplex* B,
|
| 398 |
+
size_t ldb);
|
| 399 |
+
/* -------------------------------------------------------------------- */
|
| 400 |
+
/* SYMM : Symmetric Multiply Matrix*/
|
| 401 |
+
cublasStatus_t CUBLASWINAPI cublasXtSsymm(cublasXtHandle_t handle,
|
| 402 |
+
cublasSideMode_t side,
|
| 403 |
+
cublasFillMode_t uplo,
|
| 404 |
+
size_t m,
|
| 405 |
+
size_t n,
|
| 406 |
+
const float* alpha,
|
| 407 |
+
const float* A,
|
| 408 |
+
size_t lda,
|
| 409 |
+
const float* B,
|
| 410 |
+
size_t ldb,
|
| 411 |
+
const float* beta,
|
| 412 |
+
float* C,
|
| 413 |
+
size_t ldc);
|
| 414 |
+
|
| 415 |
+
cublasStatus_t CUBLASWINAPI cublasXtDsymm(cublasXtHandle_t handle,
|
| 416 |
+
cublasSideMode_t side,
|
| 417 |
+
cublasFillMode_t uplo,
|
| 418 |
+
size_t m,
|
| 419 |
+
size_t n,
|
| 420 |
+
const double* alpha,
|
| 421 |
+
const double* A,
|
| 422 |
+
size_t lda,
|
| 423 |
+
const double* B,
|
| 424 |
+
size_t ldb,
|
| 425 |
+
const double* beta,
|
| 426 |
+
double* C,
|
| 427 |
+
size_t ldc);
|
| 428 |
+
|
| 429 |
+
cublasStatus_t CUBLASWINAPI cublasXtCsymm(cublasXtHandle_t handle,
|
| 430 |
+
cublasSideMode_t side,
|
| 431 |
+
cublasFillMode_t uplo,
|
| 432 |
+
size_t m,
|
| 433 |
+
size_t n,
|
| 434 |
+
const cuComplex* alpha,
|
| 435 |
+
const cuComplex* A,
|
| 436 |
+
size_t lda,
|
| 437 |
+
const cuComplex* B,
|
| 438 |
+
size_t ldb,
|
| 439 |
+
const cuComplex* beta,
|
| 440 |
+
cuComplex* C,
|
| 441 |
+
size_t ldc);
|
| 442 |
+
|
| 443 |
+
cublasStatus_t CUBLASWINAPI cublasXtZsymm(cublasXtHandle_t handle,
|
| 444 |
+
cublasSideMode_t side,
|
| 445 |
+
cublasFillMode_t uplo,
|
| 446 |
+
size_t m,
|
| 447 |
+
size_t n,
|
| 448 |
+
const cuDoubleComplex* alpha,
|
| 449 |
+
const cuDoubleComplex* A,
|
| 450 |
+
size_t lda,
|
| 451 |
+
const cuDoubleComplex* B,
|
| 452 |
+
size_t ldb,
|
| 453 |
+
const cuDoubleComplex* beta,
|
| 454 |
+
cuDoubleComplex* C,
|
| 455 |
+
size_t ldc);
|
| 456 |
+
/* -------------------------------------------------------------------- */
|
| 457 |
+
/* HEMM : Hermitian Matrix Multiply */
|
| 458 |
+
cublasStatus_t CUBLASWINAPI cublasXtChemm(cublasXtHandle_t handle,
|
| 459 |
+
cublasSideMode_t side,
|
| 460 |
+
cublasFillMode_t uplo,
|
| 461 |
+
size_t m,
|
| 462 |
+
size_t n,
|
| 463 |
+
const cuComplex* alpha,
|
| 464 |
+
const cuComplex* A,
|
| 465 |
+
size_t lda,
|
| 466 |
+
const cuComplex* B,
|
| 467 |
+
size_t ldb,
|
| 468 |
+
const cuComplex* beta,
|
| 469 |
+
cuComplex* C,
|
| 470 |
+
size_t ldc);
|
| 471 |
+
|
| 472 |
+
cublasStatus_t CUBLASWINAPI cublasXtZhemm(cublasXtHandle_t handle,
|
| 473 |
+
cublasSideMode_t side,
|
| 474 |
+
cublasFillMode_t uplo,
|
| 475 |
+
size_t m,
|
| 476 |
+
size_t n,
|
| 477 |
+
const cuDoubleComplex* alpha,
|
| 478 |
+
const cuDoubleComplex* A,
|
| 479 |
+
size_t lda,
|
| 480 |
+
const cuDoubleComplex* B,
|
| 481 |
+
size_t ldb,
|
| 482 |
+
const cuDoubleComplex* beta,
|
| 483 |
+
cuDoubleComplex* C,
|
| 484 |
+
size_t ldc);
|
| 485 |
+
|
| 486 |
+
/* -------------------------------------------------------------------- */
|
| 487 |
+
/* SYRKX : variant extension of SYRK */
|
| 488 |
+
cublasStatus_t CUBLASWINAPI cublasXtSsyrkx(cublasXtHandle_t handle,
|
| 489 |
+
cublasFillMode_t uplo,
|
| 490 |
+
cublasOperation_t trans,
|
| 491 |
+
size_t n,
|
| 492 |
+
size_t k,
|
| 493 |
+
const float* alpha,
|
| 494 |
+
const float* A,
|
| 495 |
+
size_t lda,
|
| 496 |
+
const float* B,
|
| 497 |
+
size_t ldb,
|
| 498 |
+
const float* beta,
|
| 499 |
+
float* C,
|
| 500 |
+
size_t ldc);
|
| 501 |
+
|
| 502 |
+
cublasStatus_t CUBLASWINAPI cublasXtDsyrkx(cublasXtHandle_t handle,
|
| 503 |
+
cublasFillMode_t uplo,
|
| 504 |
+
cublasOperation_t trans,
|
| 505 |
+
size_t n,
|
| 506 |
+
size_t k,
|
| 507 |
+
const double* alpha,
|
| 508 |
+
const double* A,
|
| 509 |
+
size_t lda,
|
| 510 |
+
const double* B,
|
| 511 |
+
size_t ldb,
|
| 512 |
+
const double* beta,
|
| 513 |
+
double* C,
|
| 514 |
+
size_t ldc);
|
| 515 |
+
|
| 516 |
+
cublasStatus_t CUBLASWINAPI cublasXtCsyrkx(cublasXtHandle_t handle,
|
| 517 |
+
cublasFillMode_t uplo,
|
| 518 |
+
cublasOperation_t trans,
|
| 519 |
+
size_t n,
|
| 520 |
+
size_t k,
|
| 521 |
+
const cuComplex* alpha,
|
| 522 |
+
const cuComplex* A,
|
| 523 |
+
size_t lda,
|
| 524 |
+
const cuComplex* B,
|
| 525 |
+
size_t ldb,
|
| 526 |
+
const cuComplex* beta,
|
| 527 |
+
cuComplex* C,
|
| 528 |
+
size_t ldc);
|
| 529 |
+
|
| 530 |
+
cublasStatus_t CUBLASWINAPI cublasXtZsyrkx(cublasXtHandle_t handle,
|
| 531 |
+
cublasFillMode_t uplo,
|
| 532 |
+
cublasOperation_t trans,
|
| 533 |
+
size_t n,
|
| 534 |
+
size_t k,
|
| 535 |
+
const cuDoubleComplex* alpha,
|
| 536 |
+
const cuDoubleComplex* A,
|
| 537 |
+
size_t lda,
|
| 538 |
+
const cuDoubleComplex* B,
|
| 539 |
+
size_t ldb,
|
| 540 |
+
const cuDoubleComplex* beta,
|
| 541 |
+
cuDoubleComplex* C,
|
| 542 |
+
size_t ldc);
|
| 543 |
+
/* -------------------------------------------------------------------- */
|
| 544 |
+
/* HER2K : variant extension of HERK */
|
| 545 |
+
cublasStatus_t CUBLASWINAPI cublasXtCher2k(cublasXtHandle_t handle,
|
| 546 |
+
cublasFillMode_t uplo,
|
| 547 |
+
cublasOperation_t trans,
|
| 548 |
+
size_t n,
|
| 549 |
+
size_t k,
|
| 550 |
+
const cuComplex* alpha,
|
| 551 |
+
const cuComplex* A,
|
| 552 |
+
size_t lda,
|
| 553 |
+
const cuComplex* B,
|
| 554 |
+
size_t ldb,
|
| 555 |
+
const float* beta,
|
| 556 |
+
cuComplex* C,
|
| 557 |
+
size_t ldc);
|
| 558 |
+
|
| 559 |
+
cublasStatus_t CUBLASWINAPI cublasXtZher2k(cublasXtHandle_t handle,
|
| 560 |
+
cublasFillMode_t uplo,
|
| 561 |
+
cublasOperation_t trans,
|
| 562 |
+
size_t n,
|
| 563 |
+
size_t k,
|
| 564 |
+
const cuDoubleComplex* alpha,
|
| 565 |
+
const cuDoubleComplex* A,
|
| 566 |
+
size_t lda,
|
| 567 |
+
const cuDoubleComplex* B,
|
| 568 |
+
size_t ldb,
|
| 569 |
+
const double* beta,
|
| 570 |
+
cuDoubleComplex* C,
|
| 571 |
+
size_t ldc);
|
| 572 |
+
|
| 573 |
+
/* -------------------------------------------------------------------- */
|
| 574 |
+
/* SPMM : Symmetric Packed Multiply Matrix*/
|
| 575 |
+
cublasStatus_t CUBLASWINAPI cublasXtSspmm(cublasXtHandle_t handle,
|
| 576 |
+
cublasSideMode_t side,
|
| 577 |
+
cublasFillMode_t uplo,
|
| 578 |
+
size_t m,
|
| 579 |
+
size_t n,
|
| 580 |
+
const float* alpha,
|
| 581 |
+
const float* AP,
|
| 582 |
+
const float* B,
|
| 583 |
+
size_t ldb,
|
| 584 |
+
const float* beta,
|
| 585 |
+
float* C,
|
| 586 |
+
size_t ldc);
|
| 587 |
+
|
| 588 |
+
cublasStatus_t CUBLASWINAPI cublasXtDspmm(cublasXtHandle_t handle,
|
| 589 |
+
cublasSideMode_t side,
|
| 590 |
+
cublasFillMode_t uplo,
|
| 591 |
+
size_t m,
|
| 592 |
+
size_t n,
|
| 593 |
+
const double* alpha,
|
| 594 |
+
const double* AP,
|
| 595 |
+
const double* B,
|
| 596 |
+
size_t ldb,
|
| 597 |
+
const double* beta,
|
| 598 |
+
double* C,
|
| 599 |
+
size_t ldc);
|
| 600 |
+
|
| 601 |
+
cublasStatus_t CUBLASWINAPI cublasXtCspmm(cublasXtHandle_t handle,
|
| 602 |
+
cublasSideMode_t side,
|
| 603 |
+
cublasFillMode_t uplo,
|
| 604 |
+
size_t m,
|
| 605 |
+
size_t n,
|
| 606 |
+
const cuComplex* alpha,
|
| 607 |
+
const cuComplex* AP,
|
| 608 |
+
const cuComplex* B,
|
| 609 |
+
size_t ldb,
|
| 610 |
+
const cuComplex* beta,
|
| 611 |
+
cuComplex* C,
|
| 612 |
+
size_t ldc);
|
| 613 |
+
|
| 614 |
+
cublasStatus_t CUBLASWINAPI cublasXtZspmm(cublasXtHandle_t handle,
|
| 615 |
+
cublasSideMode_t side,
|
| 616 |
+
cublasFillMode_t uplo,
|
| 617 |
+
size_t m,
|
| 618 |
+
size_t n,
|
| 619 |
+
const cuDoubleComplex* alpha,
|
| 620 |
+
const cuDoubleComplex* AP,
|
| 621 |
+
const cuDoubleComplex* B,
|
| 622 |
+
size_t ldb,
|
| 623 |
+
const cuDoubleComplex* beta,
|
| 624 |
+
cuDoubleComplex* C,
|
| 625 |
+
size_t ldc);
|
| 626 |
+
|
| 627 |
+
/* -------------------------------------------------------------------- */
|
| 628 |
+
/* TRMM */
|
| 629 |
+
cublasStatus_t CUBLASWINAPI cublasXtStrmm(cublasXtHandle_t handle,
|
| 630 |
+
cublasSideMode_t side,
|
| 631 |
+
cublasFillMode_t uplo,
|
| 632 |
+
cublasOperation_t trans,
|
| 633 |
+
cublasDiagType_t diag,
|
| 634 |
+
size_t m,
|
| 635 |
+
size_t n,
|
| 636 |
+
const float* alpha,
|
| 637 |
+
const float* A,
|
| 638 |
+
size_t lda,
|
| 639 |
+
const float* B,
|
| 640 |
+
size_t ldb,
|
| 641 |
+
float* C,
|
| 642 |
+
size_t ldc);
|
| 643 |
+
|
| 644 |
+
cublasStatus_t CUBLASWINAPI cublasXtDtrmm(cublasXtHandle_t handle,
|
| 645 |
+
cublasSideMode_t side,
|
| 646 |
+
cublasFillMode_t uplo,
|
| 647 |
+
cublasOperation_t trans,
|
| 648 |
+
cublasDiagType_t diag,
|
| 649 |
+
size_t m,
|
| 650 |
+
size_t n,
|
| 651 |
+
const double* alpha,
|
| 652 |
+
const double* A,
|
| 653 |
+
size_t lda,
|
| 654 |
+
const double* B,
|
| 655 |
+
size_t ldb,
|
| 656 |
+
double* C,
|
| 657 |
+
size_t ldc);
|
| 658 |
+
|
| 659 |
+
cublasStatus_t CUBLASWINAPI cublasXtCtrmm(cublasXtHandle_t handle,
|
| 660 |
+
cublasSideMode_t side,
|
| 661 |
+
cublasFillMode_t uplo,
|
| 662 |
+
cublasOperation_t trans,
|
| 663 |
+
cublasDiagType_t diag,
|
| 664 |
+
size_t m,
|
| 665 |
+
size_t n,
|
| 666 |
+
const cuComplex* alpha,
|
| 667 |
+
const cuComplex* A,
|
| 668 |
+
size_t lda,
|
| 669 |
+
const cuComplex* B,
|
| 670 |
+
size_t ldb,
|
| 671 |
+
cuComplex* C,
|
| 672 |
+
size_t ldc);
|
| 673 |
+
|
| 674 |
+
cublasStatus_t CUBLASWINAPI cublasXtZtrmm(cublasXtHandle_t handle,
|
| 675 |
+
cublasSideMode_t side,
|
| 676 |
+
cublasFillMode_t uplo,
|
| 677 |
+
cublasOperation_t trans,
|
| 678 |
+
cublasDiagType_t diag,
|
| 679 |
+
size_t m,
|
| 680 |
+
size_t n,
|
| 681 |
+
const cuDoubleComplex* alpha,
|
| 682 |
+
const cuDoubleComplex* A,
|
| 683 |
+
size_t lda,
|
| 684 |
+
const cuDoubleComplex* B,
|
| 685 |
+
size_t ldb,
|
| 686 |
+
cuDoubleComplex* C,
|
| 687 |
+
size_t ldc);
|
| 688 |
+
|
| 689 |
+
#if defined(__cplusplus)
|
| 690 |
+
}
|
| 691 |
+
#endif /* __cplusplus */
|
| 692 |
+
|
| 693 |
+
#endif /* !defined(CUBLAS_XT_H_) */
|
lib/python3.11/site-packages/nvidia/cu13/include/cublas_api.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|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DIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
/*
|
| 51 |
+
* This is the public header file for the new CUBLAS library API, it mapped the generic
|
| 52 |
+
* Cublas name functions to the actual _v2 implementations.
|
| 53 |
+
*/
|
| 54 |
+
|
| 55 |
+
#if !defined(CUBLAS_V2_H_)
|
| 56 |
+
#define CUBLAS_V2_H_
|
| 57 |
+
|
| 58 |
+
#if defined(CUBLAS_H_)
|
| 59 |
+
#error "It is an error to include both cublas.h and cublas_v2.h"
|
| 60 |
+
#endif
|
| 61 |
+
|
| 62 |
+
#ifndef CUBLASAPI
|
| 63 |
+
#define CUBLASAPI
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
#include "cublas_api.h"
|
| 67 |
+
|
| 68 |
+
#define cublasCreate cublasCreate_v2
|
| 69 |
+
#define cublasDestroy cublasDestroy_v2
|
| 70 |
+
#define cublasGetVersion cublasGetVersion_v2
|
| 71 |
+
#define cublasSetWorkspace cublasSetWorkspace_v2
|
| 72 |
+
#define cublasSetStream cublasSetStream_v2
|
| 73 |
+
#define cublasGetStream cublasGetStream_v2
|
| 74 |
+
#define cublasGetPointerMode cublasGetPointerMode_v2
|
| 75 |
+
#define cublasSetPointerMode cublasSetPointerMode_v2
|
| 76 |
+
|
| 77 |
+
/* 32-bit integer */
|
| 78 |
+
|
| 79 |
+
/* Blas1 Routines */
|
| 80 |
+
|
| 81 |
+
#define cublasSnrm2 cublasSnrm2_v2
|
| 82 |
+
#define cublasDnrm2 cublasDnrm2_v2
|
| 83 |
+
#define cublasScnrm2 cublasScnrm2_v2
|
| 84 |
+
#define cublasDznrm2 cublasDznrm2_v2
|
| 85 |
+
|
| 86 |
+
#define cublasSdot cublasSdot_v2
|
| 87 |
+
#define cublasDdot cublasDdot_v2
|
| 88 |
+
#define cublasCdotu cublasCdotu_v2
|
| 89 |
+
#define cublasCdotc cublasCdotc_v2
|
| 90 |
+
#define cublasZdotu cublasZdotu_v2
|
| 91 |
+
#define cublasZdotc cublasZdotc_v2
|
| 92 |
+
|
| 93 |
+
#define cublasSscal cublasSscal_v2
|
| 94 |
+
#define cublasDscal cublasDscal_v2
|
| 95 |
+
#define cublasCscal cublasCscal_v2
|
| 96 |
+
#define cublasCsscal cublasCsscal_v2
|
| 97 |
+
#define cublasZscal cublasZscal_v2
|
| 98 |
+
#define cublasZdscal cublasZdscal_v2
|
| 99 |
+
|
| 100 |
+
#define cublasSaxpy cublasSaxpy_v2
|
| 101 |
+
#define cublasDaxpy cublasDaxpy_v2
|
| 102 |
+
#define cublasCaxpy cublasCaxpy_v2
|
| 103 |
+
#define cublasZaxpy cublasZaxpy_v2
|
| 104 |
+
|
| 105 |
+
#define cublasScopy cublasScopy_v2
|
| 106 |
+
#define cublasDcopy cublasDcopy_v2
|
| 107 |
+
#define cublasCcopy cublasCcopy_v2
|
| 108 |
+
#define cublasZcopy cublasZcopy_v2
|
| 109 |
+
|
| 110 |
+
#define cublasSswap cublasSswap_v2
|
| 111 |
+
#define cublasDswap cublasDswap_v2
|
| 112 |
+
#define cublasCswap cublasCswap_v2
|
| 113 |
+
#define cublasZswap cublasZswap_v2
|
| 114 |
+
|
| 115 |
+
#define cublasIsamax cublasIsamax_v2
|
| 116 |
+
#define cublasIdamax cublasIdamax_v2
|
| 117 |
+
#define cublasIcamax cublasIcamax_v2
|
| 118 |
+
#define cublasIzamax cublasIzamax_v2
|
| 119 |
+
|
| 120 |
+
#define cublasIsamin cublasIsamin_v2
|
| 121 |
+
#define cublasIdamin cublasIdamin_v2
|
| 122 |
+
#define cublasIcamin cublasIcamin_v2
|
| 123 |
+
#define cublasIzamin cublasIzamin_v2
|
| 124 |
+
|
| 125 |
+
#define cublasSasum cublasSasum_v2
|
| 126 |
+
#define cublasDasum cublasDasum_v2
|
| 127 |
+
#define cublasScasum cublasScasum_v2
|
| 128 |
+
#define cublasDzasum cublasDzasum_v2
|
| 129 |
+
|
| 130 |
+
#define cublasSrot cublasSrot_v2
|
| 131 |
+
#define cublasDrot cublasDrot_v2
|
| 132 |
+
#define cublasCrot cublasCrot_v2
|
| 133 |
+
#define cublasCsrot cublasCsrot_v2
|
| 134 |
+
#define cublasZrot cublasZrot_v2
|
| 135 |
+
#define cublasZdrot cublasZdrot_v2
|
| 136 |
+
|
| 137 |
+
#define cublasSrotg cublasSrotg_v2
|
| 138 |
+
#define cublasDrotg cublasDrotg_v2
|
| 139 |
+
#define cublasCrotg cublasCrotg_v2
|
| 140 |
+
#define cublasZrotg cublasZrotg_v2
|
| 141 |
+
|
| 142 |
+
#define cublasSrotm cublasSrotm_v2
|
| 143 |
+
#define cublasDrotm cublasDrotm_v2
|
| 144 |
+
|
| 145 |
+
#define cublasSrotmg cublasSrotmg_v2
|
| 146 |
+
#define cublasDrotmg cublasDrotmg_v2
|
| 147 |
+
|
| 148 |
+
/* Blas2 Routines */
|
| 149 |
+
|
| 150 |
+
#define cublasSgemv cublasSgemv_v2
|
| 151 |
+
#define cublasDgemv cublasDgemv_v2
|
| 152 |
+
#define cublasCgemv cublasCgemv_v2
|
| 153 |
+
#define cublasZgemv cublasZgemv_v2
|
| 154 |
+
|
| 155 |
+
#define cublasSgbmv cublasSgbmv_v2
|
| 156 |
+
#define cublasDgbmv cublasDgbmv_v2
|
| 157 |
+
#define cublasCgbmv cublasCgbmv_v2
|
| 158 |
+
#define cublasZgbmv cublasZgbmv_v2
|
| 159 |
+
|
| 160 |
+
#define cublasStrmv cublasStrmv_v2
|
| 161 |
+
#define cublasDtrmv cublasDtrmv_v2
|
| 162 |
+
#define cublasCtrmv cublasCtrmv_v2
|
| 163 |
+
#define cublasZtrmv cublasZtrmv_v2
|
| 164 |
+
|
| 165 |
+
#define cublasStbmv cublasStbmv_v2
|
| 166 |
+
#define cublasDtbmv cublasDtbmv_v2
|
| 167 |
+
#define cublasCtbmv cublasCtbmv_v2
|
| 168 |
+
#define cublasZtbmv cublasZtbmv_v2
|
| 169 |
+
|
| 170 |
+
#define cublasStpmv cublasStpmv_v2
|
| 171 |
+
#define cublasDtpmv cublasDtpmv_v2
|
| 172 |
+
#define cublasCtpmv cublasCtpmv_v2
|
| 173 |
+
#define cublasZtpmv cublasZtpmv_v2
|
| 174 |
+
|
| 175 |
+
#define cublasStrsv cublasStrsv_v2
|
| 176 |
+
#define cublasDtrsv cublasDtrsv_v2
|
| 177 |
+
#define cublasCtrsv cublasCtrsv_v2
|
| 178 |
+
#define cublasZtrsv cublasZtrsv_v2
|
| 179 |
+
|
| 180 |
+
#define cublasStpsv cublasStpsv_v2
|
| 181 |
+
#define cublasDtpsv cublasDtpsv_v2
|
| 182 |
+
#define cublasCtpsv cublasCtpsv_v2
|
| 183 |
+
#define cublasZtpsv cublasZtpsv_v2
|
| 184 |
+
|
| 185 |
+
#define cublasStbsv cublasStbsv_v2
|
| 186 |
+
#define cublasDtbsv cublasDtbsv_v2
|
| 187 |
+
#define cublasCtbsv cublasCtbsv_v2
|
| 188 |
+
#define cublasZtbsv cublasZtbsv_v2
|
| 189 |
+
|
| 190 |
+
#define cublasSsymv cublasSsymv_v2
|
| 191 |
+
#define cublasDsymv cublasDsymv_v2
|
| 192 |
+
#define cublasCsymv cublasCsymv_v2
|
| 193 |
+
#define cublasZsymv cublasZsymv_v2
|
| 194 |
+
#define cublasChemv cublasChemv_v2
|
| 195 |
+
#define cublasZhemv cublasZhemv_v2
|
| 196 |
+
|
| 197 |
+
#define cublasSsbmv cublasSsbmv_v2
|
| 198 |
+
#define cublasDsbmv cublasDsbmv_v2
|
| 199 |
+
#define cublasChbmv cublasChbmv_v2
|
| 200 |
+
#define cublasZhbmv cublasZhbmv_v2
|
| 201 |
+
|
| 202 |
+
#define cublasSspmv cublasSspmv_v2
|
| 203 |
+
#define cublasDspmv cublasDspmv_v2
|
| 204 |
+
#define cublasChpmv cublasChpmv_v2
|
| 205 |
+
#define cublasZhpmv cublasZhpmv_v2
|
| 206 |
+
|
| 207 |
+
#define cublasSger cublasSger_v2
|
| 208 |
+
#define cublasDger cublasDger_v2
|
| 209 |
+
#define cublasCgeru cublasCgeru_v2
|
| 210 |
+
#define cublasCgerc cublasCgerc_v2
|
| 211 |
+
#define cublasZgeru cublasZgeru_v2
|
| 212 |
+
#define cublasZgerc cublasZgerc_v2
|
| 213 |
+
|
| 214 |
+
#define cublasSsyr cublasSsyr_v2
|
| 215 |
+
#define cublasDsyr cublasDsyr_v2
|
| 216 |
+
#define cublasCsyr cublasCsyr_v2
|
| 217 |
+
#define cublasZsyr cublasZsyr_v2
|
| 218 |
+
#define cublasCher cublasCher_v2
|
| 219 |
+
#define cublasZher cublasZher_v2
|
| 220 |
+
|
| 221 |
+
#define cublasSspr cublasSspr_v2
|
| 222 |
+
#define cublasDspr cublasDspr_v2
|
| 223 |
+
#define cublasChpr cublasChpr_v2
|
| 224 |
+
#define cublasZhpr cublasZhpr_v2
|
| 225 |
+
|
| 226 |
+
#define cublasSsyr2 cublasSsyr2_v2
|
| 227 |
+
#define cublasDsyr2 cublasDsyr2_v2
|
| 228 |
+
#define cublasCsyr2 cublasCsyr2_v2
|
| 229 |
+
#define cublasZsyr2 cublasZsyr2_v2
|
| 230 |
+
#define cublasCher2 cublasCher2_v2
|
| 231 |
+
#define cublasZher2 cublasZher2_v2
|
| 232 |
+
|
| 233 |
+
#define cublasSspr2 cublasSspr2_v2
|
| 234 |
+
#define cublasDspr2 cublasDspr2_v2
|
| 235 |
+
#define cublasChpr2 cublasChpr2_v2
|
| 236 |
+
#define cublasZhpr2 cublasZhpr2_v2
|
| 237 |
+
|
| 238 |
+
/* Blas3 Routines */
|
| 239 |
+
|
| 240 |
+
#define cublasSgemm cublasSgemm_v2
|
| 241 |
+
#define cublasDgemm cublasDgemm_v2
|
| 242 |
+
#define cublasCgemm cublasCgemm_v2
|
| 243 |
+
#define cublasZgemm cublasZgemm_v2
|
| 244 |
+
|
| 245 |
+
#define cublasSsyrk cublasSsyrk_v2
|
| 246 |
+
#define cublasDsyrk cublasDsyrk_v2
|
| 247 |
+
#define cublasCsyrk cublasCsyrk_v2
|
| 248 |
+
#define cublasZsyrk cublasZsyrk_v2
|
| 249 |
+
#define cublasCherk cublasCherk_v2
|
| 250 |
+
#define cublasZherk cublasZherk_v2
|
| 251 |
+
|
| 252 |
+
#define cublasSsyr2k cublasSsyr2k_v2
|
| 253 |
+
#define cublasDsyr2k cublasDsyr2k_v2
|
| 254 |
+
#define cublasCsyr2k cublasCsyr2k_v2
|
| 255 |
+
#define cublasZsyr2k cublasZsyr2k_v2
|
| 256 |
+
#define cublasCher2k cublasCher2k_v2
|
| 257 |
+
#define cublasZher2k cublasZher2k_v2
|
| 258 |
+
|
| 259 |
+
#define cublasSsymm cublasSsymm_v2
|
| 260 |
+
#define cublasDsymm cublasDsymm_v2
|
| 261 |
+
#define cublasCsymm cublasCsymm_v2
|
| 262 |
+
#define cublasZsymm cublasZsymm_v2
|
| 263 |
+
#define cublasChemm cublasChemm_v2
|
| 264 |
+
#define cublasZhemm cublasZhemm_v2
|
| 265 |
+
|
| 266 |
+
#define cublasStrsm cublasStrsm_v2
|
| 267 |
+
#define cublasDtrsm cublasDtrsm_v2
|
| 268 |
+
#define cublasCtrsm cublasCtrsm_v2
|
| 269 |
+
#define cublasZtrsm cublasZtrsm_v2
|
| 270 |
+
|
| 271 |
+
#define cublasStrmm cublasStrmm_v2
|
| 272 |
+
#define cublasDtrmm cublasDtrmm_v2
|
| 273 |
+
#define cublasCtrmm cublasCtrmm_v2
|
| 274 |
+
#define cublasZtrmm cublasZtrmm_v2
|
| 275 |
+
|
| 276 |
+
/* 64-bit integer */
|
| 277 |
+
|
| 278 |
+
/* Blas1 Routines */
|
| 279 |
+
|
| 280 |
+
#define cublasSnrm2_64 cublasSnrm2_v2_64
|
| 281 |
+
#define cublasDnrm2_64 cublasDnrm2_v2_64
|
| 282 |
+
#define cublasScnrm2_64 cublasScnrm2_v2_64
|
| 283 |
+
#define cublasDznrm2_64 cublasDznrm2_v2_64
|
| 284 |
+
|
| 285 |
+
#define cublasSdot_64 cublasSdot_v2_64
|
| 286 |
+
#define cublasDdot_64 cublasDdot_v2_64
|
| 287 |
+
#define cublasCdotu_64 cublasCdotu_v2_64
|
| 288 |
+
#define cublasCdotc_64 cublasCdotc_v2_64
|
| 289 |
+
#define cublasZdotu_64 cublasZdotu_v2_64
|
| 290 |
+
#define cublasZdotc_64 cublasZdotc_v2_64
|
| 291 |
+
|
| 292 |
+
#define cublasSscal_64 cublasSscal_v2_64
|
| 293 |
+
#define cublasDscal_64 cublasDscal_v2_64
|
| 294 |
+
#define cublasCscal_64 cublasCscal_v2_64
|
| 295 |
+
#define cublasCsscal_64 cublasCsscal_v2_64
|
| 296 |
+
#define cublasZscal_64 cublasZscal_v2_64
|
| 297 |
+
#define cublasZdscal_64 cublasZdscal_v2_64
|
| 298 |
+
|
| 299 |
+
#define cublasSaxpy_64 cublasSaxpy_v2_64
|
| 300 |
+
#define cublasDaxpy_64 cublasDaxpy_v2_64
|
| 301 |
+
#define cublasCaxpy_64 cublasCaxpy_v2_64
|
| 302 |
+
#define cublasZaxpy_64 cublasZaxpy_v2_64
|
| 303 |
+
|
| 304 |
+
#define cublasScopy_64 cublasScopy_v2_64
|
| 305 |
+
#define cublasDcopy_64 cublasDcopy_v2_64
|
| 306 |
+
#define cublasCcopy_64 cublasCcopy_v2_64
|
| 307 |
+
#define cublasZcopy_64 cublasZcopy_v2_64
|
| 308 |
+
|
| 309 |
+
#define cublasSswap_64 cublasSswap_v2_64
|
| 310 |
+
#define cublasDswap_64 cublasDswap_v2_64
|
| 311 |
+
#define cublasCswap_64 cublasCswap_v2_64
|
| 312 |
+
#define cublasZswap_64 cublasZswap_v2_64
|
| 313 |
+
|
| 314 |
+
#define cublasIsamax_64 cublasIsamax_v2_64
|
| 315 |
+
#define cublasIdamax_64 cublasIdamax_v2_64
|
| 316 |
+
#define cublasIcamax_64 cublasIcamax_v2_64
|
| 317 |
+
#define cublasIzamax_64 cublasIzamax_v2_64
|
| 318 |
+
|
| 319 |
+
#define cublasIsamin_64 cublasIsamin_v2_64
|
| 320 |
+
#define cublasIdamin_64 cublasIdamin_v2_64
|
| 321 |
+
#define cublasIcamin_64 cublasIcamin_v2_64
|
| 322 |
+
#define cublasIzamin_64 cublasIzamin_v2_64
|
| 323 |
+
|
| 324 |
+
#define cublasSasum_64 cublasSasum_v2_64
|
| 325 |
+
#define cublasDasum_64 cublasDasum_v2_64
|
| 326 |
+
#define cublasScasum_64 cublasScasum_v2_64
|
| 327 |
+
#define cublasDzasum_64 cublasDzasum_v2_64
|
| 328 |
+
|
| 329 |
+
#define cublasSrot_64 cublasSrot_v2_64
|
| 330 |
+
#define cublasDrot_64 cublasDrot_v2_64
|
| 331 |
+
#define cublasCrot_64 cublasCrot_v2_64
|
| 332 |
+
#define cublasCsrot_64 cublasCsrot_v2_64
|
| 333 |
+
#define cublasZrot_64 cublasZrot_v2_64
|
| 334 |
+
#define cublasZdrot_64 cublasZdrot_v2_64
|
| 335 |
+
|
| 336 |
+
#define cublasSrotg_64 cublasSrotg_v2_64
|
| 337 |
+
#define cublasDrotg_64 cublasDrotg_v2_64
|
| 338 |
+
#define cublasCrotg_64 cublasCrotg_v2_64
|
| 339 |
+
#define cublasZrotg_64 cublasZrotg_v2_64
|
| 340 |
+
|
| 341 |
+
#define cublasSrotm_64 cublasSrotm_v2_64
|
| 342 |
+
#define cublasDrotm_64 cublasDrotm_v2_64
|
| 343 |
+
|
| 344 |
+
#define cublasSrotmg_64 cublasSrotmg_v2_64
|
| 345 |
+
#define cublasDrotmg_64 cublasDrotmg_v2_64
|
| 346 |
+
|
| 347 |
+
/* Blas2 Routines */
|
| 348 |
+
|
| 349 |
+
#define cublasSgemv_64 cublasSgemv_v2_64
|
| 350 |
+
#define cublasDgemv_64 cublasDgemv_v2_64
|
| 351 |
+
#define cublasCgemv_64 cublasCgemv_v2_64
|
| 352 |
+
#define cublasZgemv_64 cublasZgemv_v2_64
|
| 353 |
+
|
| 354 |
+
#define cublasSgbmv_64 cublasSgbmv_v2_64
|
| 355 |
+
#define cublasDgbmv_64 cublasDgbmv_v2_64
|
| 356 |
+
#define cublasCgbmv_64 cublasCgbmv_v2_64
|
| 357 |
+
#define cublasZgbmv_64 cublasZgbmv_v2_64
|
| 358 |
+
|
| 359 |
+
#define cublasStrmv_64 cublasStrmv_v2_64
|
| 360 |
+
#define cublasDtrmv_64 cublasDtrmv_v2_64
|
| 361 |
+
#define cublasCtrmv_64 cublasCtrmv_v2_64
|
| 362 |
+
#define cublasZtrmv_64 cublasZtrmv_v2_64
|
| 363 |
+
|
| 364 |
+
#define cublasStbmv_64 cublasStbmv_v2_64
|
| 365 |
+
#define cublasDtbmv_64 cublasDtbmv_v2_64
|
| 366 |
+
#define cublasCtbmv_64 cublasCtbmv_v2_64
|
| 367 |
+
#define cublasZtbmv_64 cublasZtbmv_v2_64
|
| 368 |
+
|
| 369 |
+
#define cublasStpmv_64 cublasStpmv_v2_64
|
| 370 |
+
#define cublasDtpmv_64 cublasDtpmv_v2_64
|
| 371 |
+
#define cublasCtpmv_64 cublasCtpmv_v2_64
|
| 372 |
+
#define cublasZtpmv_64 cublasZtpmv_v2_64
|
| 373 |
+
|
| 374 |
+
#define cublasStrsv_64 cublasStrsv_v2_64
|
| 375 |
+
#define cublasDtrsv_64 cublasDtrsv_v2_64
|
| 376 |
+
#define cublasCtrsv_64 cublasCtrsv_v2_64
|
| 377 |
+
#define cublasZtrsv_64 cublasZtrsv_v2_64
|
| 378 |
+
|
| 379 |
+
#define cublasStpsv_64 cublasStpsv_v2_64
|
| 380 |
+
#define cublasDtpsv_64 cublasDtpsv_v2_64
|
| 381 |
+
#define cublasCtpsv_64 cublasCtpsv_v2_64
|
| 382 |
+
#define cublasZtpsv_64 cublasZtpsv_v2_64
|
| 383 |
+
|
| 384 |
+
#define cublasStbsv_64 cublasStbsv_v2_64
|
| 385 |
+
#define cublasDtbsv_64 cublasDtbsv_v2_64
|
| 386 |
+
#define cublasCtbsv_64 cublasCtbsv_v2_64
|
| 387 |
+
#define cublasZtbsv_64 cublasZtbsv_v2_64
|
| 388 |
+
|
| 389 |
+
#define cublasSsymv_64 cublasSsymv_v2_64
|
| 390 |
+
#define cublasDsymv_64 cublasDsymv_v2_64
|
| 391 |
+
#define cublasCsymv_64 cublasCsymv_v2_64
|
| 392 |
+
#define cublasZsymv_64 cublasZsymv_v2_64
|
| 393 |
+
#define cublasChemv_64 cublasChemv_v2_64
|
| 394 |
+
#define cublasZhemv_64 cublasZhemv_v2_64
|
| 395 |
+
|
| 396 |
+
#define cublasSsbmv_64 cublasSsbmv_v2_64
|
| 397 |
+
#define cublasDsbmv_64 cublasDsbmv_v2_64
|
| 398 |
+
#define cublasChbmv_64 cublasChbmv_v2_64
|
| 399 |
+
#define cublasZhbmv_64 cublasZhbmv_v2_64
|
| 400 |
+
|
| 401 |
+
#define cublasSspmv_64 cublasSspmv_v2_64
|
| 402 |
+
#define cublasDspmv_64 cublasDspmv_v2_64
|
| 403 |
+
#define cublasChpmv_64 cublasChpmv_v2_64
|
| 404 |
+
#define cublasZhpmv_64 cublasZhpmv_v2_64
|
| 405 |
+
|
| 406 |
+
#define cublasSger_64 cublasSger_v2_64
|
| 407 |
+
#define cublasDger_64 cublasDger_v2_64
|
| 408 |
+
#define cublasCgeru_64 cublasCgeru_v2_64
|
| 409 |
+
#define cublasCgerc_64 cublasCgerc_v2_64
|
| 410 |
+
#define cublasZgeru_64 cublasZgeru_v2_64
|
| 411 |
+
#define cublasZgerc_64 cublasZgerc_v2_64
|
| 412 |
+
|
| 413 |
+
#define cublasSsyr_64 cublasSsyr_v2_64
|
| 414 |
+
#define cublasDsyr_64 cublasDsyr_v2_64
|
| 415 |
+
#define cublasCsyr_64 cublasCsyr_v2_64
|
| 416 |
+
#define cublasZsyr_64 cublasZsyr_v2_64
|
| 417 |
+
#define cublasCher_64 cublasCher_v2_64
|
| 418 |
+
#define cublasZher_64 cublasZher_v2_64
|
| 419 |
+
|
| 420 |
+
#define cublasSspr_64 cublasSspr_v2_64
|
| 421 |
+
#define cublasDspr_64 cublasDspr_v2_64
|
| 422 |
+
#define cublasChpr_64 cublasChpr_v2_64
|
| 423 |
+
#define cublasZhpr_64 cublasZhpr_v2_64
|
| 424 |
+
|
| 425 |
+
#define cublasSsyr2_64 cublasSsyr2_v2_64
|
| 426 |
+
#define cublasDsyr2_64 cublasDsyr2_v2_64
|
| 427 |
+
#define cublasCsyr2_64 cublasCsyr2_v2_64
|
| 428 |
+
#define cublasZsyr2_64 cublasZsyr2_v2_64
|
| 429 |
+
#define cublasCher2_64 cublasCher2_v2_64
|
| 430 |
+
#define cublasZher2_64 cublasZher2_v2_64
|
| 431 |
+
|
| 432 |
+
#define cublasSspr2_64 cublasSspr2_v2_64
|
| 433 |
+
#define cublasDspr2_64 cublasDspr2_v2_64
|
| 434 |
+
#define cublasChpr2_64 cublasChpr2_v2_64
|
| 435 |
+
#define cublasZhpr2_64 cublasZhpr2_v2_64
|
| 436 |
+
|
| 437 |
+
/* Blas3 Routines */
|
| 438 |
+
|
| 439 |
+
#define cublasSgemm_64 cublasSgemm_v2_64
|
| 440 |
+
#define cublasDgemm_64 cublasDgemm_v2_64
|
| 441 |
+
#define cublasCgemm_64 cublasCgemm_v2_64
|
| 442 |
+
#define cublasZgemm_64 cublasZgemm_v2_64
|
| 443 |
+
|
| 444 |
+
#define cublasSsyrk_64 cublasSsyrk_v2_64
|
| 445 |
+
#define cublasDsyrk_64 cublasDsyrk_v2_64
|
| 446 |
+
#define cublasCsyrk_64 cublasCsyrk_v2_64
|
| 447 |
+
#define cublasZsyrk_64 cublasZsyrk_v2_64
|
| 448 |
+
#define cublasCherk_64 cublasCherk_v2_64
|
| 449 |
+
#define cublasZherk_64 cublasZherk_v2_64
|
| 450 |
+
|
| 451 |
+
#define cublasSsyr2k_64 cublasSsyr2k_v2_64
|
| 452 |
+
#define cublasDsyr2k_64 cublasDsyr2k_v2_64
|
| 453 |
+
#define cublasCsyr2k_64 cublasCsyr2k_v2_64
|
| 454 |
+
#define cublasZsyr2k_64 cublasZsyr2k_v2_64
|
| 455 |
+
#define cublasCher2k_64 cublasCher2k_v2_64
|
| 456 |
+
#define cublasZher2k_64 cublasZher2k_v2_64
|
| 457 |
+
|
| 458 |
+
#define cublasSsymm_64 cublasSsymm_v2_64
|
| 459 |
+
#define cublasDsymm_64 cublasDsymm_v2_64
|
| 460 |
+
#define cublasCsymm_64 cublasCsymm_v2_64
|
| 461 |
+
#define cublasZsymm_64 cublasZsymm_v2_64
|
| 462 |
+
#define cublasChemm_64 cublasChemm_v2_64
|
| 463 |
+
#define cublasZhemm_64 cublasZhemm_v2_64
|
| 464 |
+
|
| 465 |
+
#define cublasStrsm_64 cublasStrsm_v2_64
|
| 466 |
+
#define cublasDtrsm_64 cublasDtrsm_v2_64
|
| 467 |
+
#define cublasCtrsm_64 cublasCtrsm_v2_64
|
| 468 |
+
#define cublasZtrsm_64 cublasZtrsm_v2_64
|
| 469 |
+
|
| 470 |
+
#define cublasStrmm_64 cublasStrmm_v2_64
|
| 471 |
+
#define cublasDtrmm_64 cublasDtrmm_v2_64
|
| 472 |
+
#define cublasCtrmm_64 cublasCtrmm_v2_64
|
| 473 |
+
#define cublasZtrmm_64 cublasZtrmm_v2_64
|
| 474 |
+
|
| 475 |
+
#endif /* !defined(CUBLAS_V2_H_) */
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lib/python3.11/site-packages/nvidia/cu13/include/cudaEGL.h
ADDED
|
@@ -0,0 +1,662 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2014 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef CUDAEGL_H
|
| 51 |
+
#define CUDAEGL_H
|
| 52 |
+
|
| 53 |
+
#include "cuda.h"
|
| 54 |
+
#include "EGL/egl.h"
|
| 55 |
+
#include "EGL/eglext.h"
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
#ifdef CUDA_FORCE_API_VERSION
|
| 59 |
+
#error "CUDA_FORCE_API_VERSION is no longer supported."
|
| 60 |
+
#endif
|
| 61 |
+
|
| 62 |
+
#ifdef __cplusplus
|
| 63 |
+
extern "C" {
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
/**
|
| 67 |
+
* \addtogroup CUDA_TYPES
|
| 68 |
+
* @{
|
| 69 |
+
*/
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Maximum number of planes per frame
|
| 73 |
+
*/
|
| 74 |
+
#define MAX_PLANES 3
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* CUDA EglFrame type - array or pointer
|
| 78 |
+
*/
|
| 79 |
+
typedef enum CUeglFrameType_enum {
|
| 80 |
+
CU_EGL_FRAME_TYPE_ARRAY = 0, /**< Frame type CUDA array */
|
| 81 |
+
CU_EGL_FRAME_TYPE_PITCH = 1, /**< Frame type pointer */
|
| 82 |
+
} CUeglFrameType;
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* Indicates that timeout for ::cuEGLStreamConsumerAcquireFrame is infinite.
|
| 86 |
+
*/
|
| 87 |
+
#define CUDA_EGL_INFINITE_TIMEOUT 0xFFFFFFFF
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Resource location flags- sysmem or vidmem
|
| 91 |
+
*
|
| 92 |
+
* For CUDA context on iGPU, since video and system memory are equivalent -
|
| 93 |
+
* these flags will not have an effect on the execution.
|
| 94 |
+
*
|
| 95 |
+
* For CUDA context on dGPU, applications can use the flag ::CUeglResourceLocationFlags
|
| 96 |
+
* to give a hint about the desired location.
|
| 97 |
+
*
|
| 98 |
+
* ::CU_EGL_RESOURCE_LOCATION_SYSMEM - the frame data is made resident on the system memory
|
| 99 |
+
* to be accessed by CUDA.
|
| 100 |
+
*
|
| 101 |
+
* ::CU_EGL_RESOURCE_LOCATION_VIDMEM - the frame data is made resident on the dedicated
|
| 102 |
+
* video memory to be accessed by CUDA.
|
| 103 |
+
*
|
| 104 |
+
* There may be an additional latency due to new allocation and data migration,
|
| 105 |
+
* if the frame is produced on a different memory.
|
| 106 |
+
|
| 107 |
+
*/
|
| 108 |
+
typedef enum CUeglResourceLocationFlags_enum {
|
| 109 |
+
CU_EGL_RESOURCE_LOCATION_SYSMEM = 0x00, /**< Resource location sysmem */
|
| 110 |
+
CU_EGL_RESOURCE_LOCATION_VIDMEM = 0x01 /**< Resource location vidmem */
|
| 111 |
+
} CUeglResourceLocationFlags;
|
| 112 |
+
|
| 113 |
+
/**
|
| 114 |
+
* CUDA EGL Color Format - The different planar and multiplanar formats currently supported for CUDA_EGL interops.
|
| 115 |
+
* Three channel formats are currently not supported for ::CU_EGL_FRAME_TYPE_ARRAY
|
| 116 |
+
*/
|
| 117 |
+
typedef enum CUeglColorFormat_enum {
|
| 118 |
+
CU_EGL_COLOR_FORMAT_YUV420_PLANAR = 0x00, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 119 |
+
CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR = 0x01, /**< Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV420Planar. */
|
| 120 |
+
CU_EGL_COLOR_FORMAT_YUV422_PLANAR = 0x02, /**< Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 121 |
+
CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR = 0x03, /**< Y, UV in two surfaces with VU byte ordering, width, height ratio same as YUV422Planar. */
|
| 122 |
+
CU_EGL_COLOR_FORMAT_RGB = 0x04, /**< R/G/B three channels in one surface with BGR byte ordering. Only pitch linear format supported. */
|
| 123 |
+
CU_EGL_COLOR_FORMAT_BGR = 0x05, /**< R/G/B three channels in one surface with RGB byte ordering. Only pitch linear format supported. */
|
| 124 |
+
CU_EGL_COLOR_FORMAT_ARGB = 0x06, /**< R/G/B/A four channels in one surface with BGRA byte ordering. */
|
| 125 |
+
CU_EGL_COLOR_FORMAT_RGBA = 0x07, /**< R/G/B/A four channels in one surface with ABGR byte ordering. */
|
| 126 |
+
CU_EGL_COLOR_FORMAT_L = 0x08, /**< single luminance channel in one surface. */
|
| 127 |
+
CU_EGL_COLOR_FORMAT_R = 0x09, /**< single color channel in one surface. */
|
| 128 |
+
CU_EGL_COLOR_FORMAT_YUV444_PLANAR = 0x0A, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. */
|
| 129 |
+
CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR = 0x0B, /**< Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV444Planar. */
|
| 130 |
+
CU_EGL_COLOR_FORMAT_YUYV_422 = 0x0C, /**< Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 131 |
+
CU_EGL_COLOR_FORMAT_UYVY_422 = 0x0D, /**< Y, U, V in one surface, interleaved as YUYV in one channel. */
|
| 132 |
+
CU_EGL_COLOR_FORMAT_ABGR = 0x0E, /**< R/G/B/A four channels in one surface with RGBA byte ordering. */
|
| 133 |
+
CU_EGL_COLOR_FORMAT_BGRA = 0x0F, /**< R/G/B/A four channels in one surface with ARGB byte ordering. */
|
| 134 |
+
CU_EGL_COLOR_FORMAT_A = 0x10, /**< Alpha color format - one channel in one surface. */
|
| 135 |
+
CU_EGL_COLOR_FORMAT_RG = 0x11, /**< R/G color format - two channels in one surface with GR byte ordering */
|
| 136 |
+
CU_EGL_COLOR_FORMAT_AYUV = 0x12, /**< Y, U, V, A four channels in one surface, interleaved as VUYA. */
|
| 137 |
+
CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR = 0x13, /**< Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 138 |
+
CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR = 0x14, /**< Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 139 |
+
CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR = 0x15, /**< Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 140 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR = 0x16, /**< Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 141 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR = 0x17, /**< Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 142 |
+
CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR = 0x18, /**< Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 143 |
+
CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR = 0x19, /**< Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 144 |
+
CU_EGL_COLOR_FORMAT_VYUY_ER = 0x1A, /**< Extended Range Y, U, V in one surface, interleaved as YVYU in one channel. */
|
| 145 |
+
CU_EGL_COLOR_FORMAT_UYVY_ER = 0x1B, /**< Extended Range Y, U, V in one surface, interleaved as YUYV in one channel. */
|
| 146 |
+
CU_EGL_COLOR_FORMAT_YUYV_ER = 0x1C, /**< Extended Range Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 147 |
+
CU_EGL_COLOR_FORMAT_YVYU_ER = 0x1D, /**< Extended Range Y, U, V in one surface, interleaved as VYUY in one channel. */
|
| 148 |
+
CU_EGL_COLOR_FORMAT_YUV_ER = 0x1E, /**< Extended Range Y, U, V three channels in one surface, interleaved as VUY. Only pitch linear format supported. */
|
| 149 |
+
CU_EGL_COLOR_FORMAT_YUVA_ER = 0x1F, /**< Extended Range Y, U, V, A four channels in one surface, interleaved as AVUY. */
|
| 150 |
+
CU_EGL_COLOR_FORMAT_AYUV_ER = 0x20, /**< Extended Range Y, U, V, A four channels in one surface, interleaved as VUYA. */
|
| 151 |
+
CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER = 0x21, /**< Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V height = Y height. */
|
| 152 |
+
CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER = 0x22, /**< Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 153 |
+
CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER = 0x23, /**< Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 154 |
+
CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER = 0x24, /**< Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 155 |
+
CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER = 0x25, /**< Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 156 |
+
CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER = 0x26, /**< Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 157 |
+
CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER = 0x27, /**< Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V height = Y height. */
|
| 158 |
+
CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER = 0x28, /**< Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 159 |
+
CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER = 0x29, /**< Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 160 |
+
CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER = 0x2A, /**< Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 161 |
+
CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER = 0x2B, /**< Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 162 |
+
CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER = 0x2C, /**< Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 163 |
+
CU_EGL_COLOR_FORMAT_BAYER_RGGB = 0x2D, /**< Bayer format - one channel in one surface with interleaved RGGB ordering. */
|
| 164 |
+
CU_EGL_COLOR_FORMAT_BAYER_BGGR = 0x2E, /**< Bayer format - one channel in one surface with interleaved BGGR ordering. */
|
| 165 |
+
CU_EGL_COLOR_FORMAT_BAYER_GRBG = 0x2F, /**< Bayer format - one channel in one surface with interleaved GRBG ordering. */
|
| 166 |
+
CU_EGL_COLOR_FORMAT_BAYER_GBRG = 0x30, /**< Bayer format - one channel in one surface with interleaved GBRG ordering. */
|
| 167 |
+
CU_EGL_COLOR_FORMAT_BAYER10_RGGB = 0x31, /**< Bayer10 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 168 |
+
CU_EGL_COLOR_FORMAT_BAYER10_BGGR = 0x32, /**< Bayer10 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 169 |
+
CU_EGL_COLOR_FORMAT_BAYER10_GRBG = 0x33, /**< Bayer10 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 170 |
+
CU_EGL_COLOR_FORMAT_BAYER10_GBRG = 0x34, /**< Bayer10 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 171 |
+
CU_EGL_COLOR_FORMAT_BAYER12_RGGB = 0x35, /**< Bayer12 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 172 |
+
CU_EGL_COLOR_FORMAT_BAYER12_BGGR = 0x36, /**< Bayer12 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 173 |
+
CU_EGL_COLOR_FORMAT_BAYER12_GRBG = 0x37, /**< Bayer12 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 174 |
+
CU_EGL_COLOR_FORMAT_BAYER12_GBRG = 0x38, /**< Bayer12 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 175 |
+
CU_EGL_COLOR_FORMAT_BAYER14_RGGB = 0x39, /**< Bayer14 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 14 bits used 2 bits No-op. */
|
| 176 |
+
CU_EGL_COLOR_FORMAT_BAYER14_BGGR = 0x3A, /**< Bayer14 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 14 bits used 2 bits No-op. */
|
| 177 |
+
CU_EGL_COLOR_FORMAT_BAYER14_GRBG = 0x3B, /**< Bayer14 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 14 bits used 2 bits No-op. */
|
| 178 |
+
CU_EGL_COLOR_FORMAT_BAYER14_GBRG = 0x3C, /**< Bayer14 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 14 bits used 2 bits No-op. */
|
| 179 |
+
CU_EGL_COLOR_FORMAT_BAYER20_RGGB = 0x3D, /**< Bayer20 format - one channel in one surface with interleaved RGGB ordering. Out of 32 bits, 20 bits used 12 bits No-op. */
|
| 180 |
+
CU_EGL_COLOR_FORMAT_BAYER20_BGGR = 0x3E, /**< Bayer20 format - one channel in one surface with interleaved BGGR ordering. Out of 32 bits, 20 bits used 12 bits No-op. */
|
| 181 |
+
CU_EGL_COLOR_FORMAT_BAYER20_GRBG = 0x3F, /**< Bayer20 format - one channel in one surface with interleaved GRBG ordering. Out of 32 bits, 20 bits used 12 bits No-op. */
|
| 182 |
+
CU_EGL_COLOR_FORMAT_BAYER20_GBRG = 0x40, /**< Bayer20 format - one channel in one surface with interleaved GBRG ordering. Out of 32 bits, 20 bits used 12 bits No-op. */
|
| 183 |
+
CU_EGL_COLOR_FORMAT_YVU444_PLANAR = 0x41, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. */
|
| 184 |
+
CU_EGL_COLOR_FORMAT_YVU422_PLANAR = 0x42, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 185 |
+
CU_EGL_COLOR_FORMAT_YVU420_PLANAR = 0x43, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 186 |
+
CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB = 0x44, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved RGGB ordering and mapped to opaque integer datatype. */
|
| 187 |
+
CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR = 0x45, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved BGGR ordering and mapped to opaque integer datatype. */
|
| 188 |
+
CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG = 0x46, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GRBG ordering and mapped to opaque integer datatype. */
|
| 189 |
+
CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG = 0x47, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GBRG ordering and mapped to opaque integer datatype. */
|
| 190 |
+
CU_EGL_COLOR_FORMAT_BAYER_BCCR = 0x48, /**< Bayer format - one channel in one surface with interleaved BCCR ordering. */
|
| 191 |
+
CU_EGL_COLOR_FORMAT_BAYER_RCCB = 0x49, /**< Bayer format - one channel in one surface with interleaved RCCB ordering. */
|
| 192 |
+
CU_EGL_COLOR_FORMAT_BAYER_CRBC = 0x4A, /**< Bayer format - one channel in one surface with interleaved CRBC ordering. */
|
| 193 |
+
CU_EGL_COLOR_FORMAT_BAYER_CBRC = 0x4B, /**< Bayer format - one channel in one surface with interleaved CBRC ordering. */
|
| 194 |
+
CU_EGL_COLOR_FORMAT_BAYER10_CCCC = 0x4C, /**< Bayer10 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 195 |
+
CU_EGL_COLOR_FORMAT_BAYER12_BCCR = 0x4D, /**< Bayer12 format - one channel in one surface with interleaved BCCR ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 196 |
+
CU_EGL_COLOR_FORMAT_BAYER12_RCCB = 0x4E, /**< Bayer12 format - one channel in one surface with interleaved RCCB ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 197 |
+
CU_EGL_COLOR_FORMAT_BAYER12_CRBC = 0x4F, /**< Bayer12 format - one channel in one surface with interleaved CRBC ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 198 |
+
CU_EGL_COLOR_FORMAT_BAYER12_CBRC = 0x50, /**< Bayer12 format - one channel in one surface with interleaved CBRC ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 199 |
+
CU_EGL_COLOR_FORMAT_BAYER12_CCCC = 0x51, /**< Bayer12 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 200 |
+
CU_EGL_COLOR_FORMAT_Y = 0x52, /**< Color format for single Y plane. */
|
| 201 |
+
CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 = 0x53, /**< Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 202 |
+
CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 = 0x54, /**< Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 203 |
+
CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 = 0x55, /**< Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height= 1/2 Y height. */
|
| 204 |
+
CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 = 0x56, /**< Y, V, U each in a separate surface, U/V width = 1/2 Y width, U/V height
|
| 205 |
+
= 1/2 Y height. */
|
| 206 |
+
CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 = 0x57, /**< Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 207 |
+
CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 = 0x58, /**< Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 208 |
+
CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 = 0x59, /**< Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height
|
| 209 |
+
= 1/2 Y height. */
|
| 210 |
+
CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709 = 0x5A, /**< Y, V, U each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 211 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 = 0x5B, /**< Y10, V10U10 in two surfaces (VU as one surface), U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 212 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 = 0x5C, /**< Y10, V10U10 in two surfaces (VU as one surface), U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 213 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 = 0x5D, /**< Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. */
|
| 214 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR = 0x5E, /**< Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. */
|
| 215 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709 = 0x5F, /**< Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. */
|
| 216 |
+
CU_EGL_COLOR_FORMAT_Y_ER = 0x60, /**< Extended Range Color format for single Y plane. */
|
| 217 |
+
CU_EGL_COLOR_FORMAT_Y_709_ER = 0x61, /**< Extended Range Color format for single Y plane. */
|
| 218 |
+
CU_EGL_COLOR_FORMAT_Y10_ER = 0x62, /**< Extended Range Color format for single Y10 plane. */
|
| 219 |
+
CU_EGL_COLOR_FORMAT_Y10_709_ER = 0x63, /**< Extended Range Color format for single Y10 plane. */
|
| 220 |
+
CU_EGL_COLOR_FORMAT_Y12_ER = 0x64, /**< Extended Range Color format for single Y12 plane. */
|
| 221 |
+
CU_EGL_COLOR_FORMAT_Y12_709_ER = 0x65, /**< Extended Range Color format for single Y12 plane. */
|
| 222 |
+
CU_EGL_COLOR_FORMAT_YUVA = 0x66, /**< Y, U, V, A four channels in one surface, interleaved as AVUY. */
|
| 223 |
+
CU_EGL_COLOR_FORMAT_YUV = 0x67, /**< Y, U, V three channels in one surface, interleaved as VUY. Only pitch linear format supported. */
|
| 224 |
+
CU_EGL_COLOR_FORMAT_YVYU = 0x68, /**< Y, U, V in one surface, interleaved as YVYU in one channel. */
|
| 225 |
+
CU_EGL_COLOR_FORMAT_VYUY = 0x69, /**< Y, U, V in one surface, interleaved as VYUY in one channel. */
|
| 226 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER = 0x6A, /**< Extended Range Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 227 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER = 0x6B, /**< Extended Range Y10, V10U10 in two surfaces(VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 228 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER = 0x6C, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */
|
| 229 |
+
CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER = 0x6D, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */
|
| 230 |
+
CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER = 0x6E, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 231 |
+
CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER = 0x6F, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 232 |
+
CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER = 0x70, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */
|
| 233 |
+
CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER = 0x71, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */
|
| 234 |
+
CU_EGL_COLOR_FORMAT_UYVY_709 = 0x72, /**< Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 235 |
+
CU_EGL_COLOR_FORMAT_UYVY_709_ER = 0x73, /**< Extended Range Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 236 |
+
CU_EGL_COLOR_FORMAT_UYVY_2020 = 0x74, /**< Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 237 |
+
CU_EGL_COLOR_FORMAT_MAX
|
| 238 |
+
} CUeglColorFormat;
|
| 239 |
+
|
| 240 |
+
/**
|
| 241 |
+
* CUDA EGLFrame structure Descriptor - structure defining one frame of EGL.
|
| 242 |
+
*
|
| 243 |
+
* Each frame may contain one or more planes depending on whether the surface * is Multiplanar or not.
|
| 244 |
+
*/
|
| 245 |
+
typedef struct CUeglFrame_st {
|
| 246 |
+
union {
|
| 247 |
+
CUarray pArray[MAX_PLANES]; /**< Array of CUarray corresponding to each plane*/
|
| 248 |
+
void* pPitch[MAX_PLANES]; /**< Array of Pointers corresponding to each plane*/
|
| 249 |
+
} frame;
|
| 250 |
+
unsigned int width; /**< Width of first plane */
|
| 251 |
+
unsigned int height; /**< Height of first plane */
|
| 252 |
+
unsigned int depth; /**< Depth of first plane */
|
| 253 |
+
unsigned int pitch; /**< Pitch of first plane */
|
| 254 |
+
unsigned int planeCount; /**< Number of planes */
|
| 255 |
+
unsigned int numChannels; /**< Number of channels for the plane */
|
| 256 |
+
CUeglFrameType frameType; /**< Array or Pitch */
|
| 257 |
+
CUeglColorFormat eglColorFormat; /**< CUDA EGL Color Format*/
|
| 258 |
+
CUarray_format cuFormat; /**< CUDA Array Format*/
|
| 259 |
+
} CUeglFrame_v1;
|
| 260 |
+
typedef CUeglFrame_v1 CUeglFrame;
|
| 261 |
+
|
| 262 |
+
/**
|
| 263 |
+
* CUDA EGLSream Connection
|
| 264 |
+
*/
|
| 265 |
+
typedef struct CUeglStreamConnection_st* CUeglStreamConnection;
|
| 266 |
+
|
| 267 |
+
/** @} */ /* END CUDA_TYPES */
|
| 268 |
+
|
| 269 |
+
/**
|
| 270 |
+
* \file cudaEGL.h
|
| 271 |
+
* \brief Header file for the EGL interoperability functions of the
|
| 272 |
+
* low-level CUDA driver application programming interface.
|
| 273 |
+
*/
|
| 274 |
+
|
| 275 |
+
/**
|
| 276 |
+
* \defgroup CUDA_EGL EGL Interoperability
|
| 277 |
+
* \ingroup CUDA_DRIVER
|
| 278 |
+
*
|
| 279 |
+
* ___MANBRIEF___ EGL interoperability functions of the low-level CUDA
|
| 280 |
+
* driver API (___CURRENT_FILE___) ___ENDMANBRIEF___
|
| 281 |
+
*
|
| 282 |
+
* This section describes the EGL interoperability functions of the
|
| 283 |
+
* low-level CUDA driver application programming interface.
|
| 284 |
+
*
|
| 285 |
+
* @{
|
| 286 |
+
*/
|
| 287 |
+
|
| 288 |
+
/**
|
| 289 |
+
* \brief Registers an EGL image
|
| 290 |
+
*
|
| 291 |
+
* Registers the EGLImageKHR specified by \p image for access by
|
| 292 |
+
* CUDA. A handle to the registered object is returned as \p pCudaResource.
|
| 293 |
+
* Additional Mapping/Unmapping is not required for the registered resource and
|
| 294 |
+
* ::cuGraphicsResourceGetMappedEglFrame can be directly called on the \p pCudaResource.
|
| 295 |
+
*
|
| 296 |
+
* The application will be responsible for synchronizing access to shared objects.
|
| 297 |
+
* The application must ensure that any pending operation which access the objects have completed
|
| 298 |
+
* before passing control to CUDA. This may be accomplished by issuing and waiting for
|
| 299 |
+
* glFinish command on all GLcontexts (for OpenGL and likewise for other APIs).
|
| 300 |
+
* The application will be also responsible for ensuring that any pending operation on the
|
| 301 |
+
* registered CUDA resource has completed prior to executing subsequent commands in other APIs
|
| 302 |
+
* accesing the same memory objects.
|
| 303 |
+
* This can be accomplished by calling cuCtxSynchronize or cuEventSynchronize (preferably).
|
| 304 |
+
*
|
| 305 |
+
* The surface's intended usage is specified using \p flags, as follows:
|
| 306 |
+
*
|
| 307 |
+
* - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE: Specifies no hints about how this
|
| 308 |
+
* resource will be used. It is therefore assumed that this resource will be
|
| 309 |
+
* read from and written to by CUDA. This is the default value.
|
| 310 |
+
* - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY: Specifies that CUDA
|
| 311 |
+
* will not write to this resource.
|
| 312 |
+
* - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD: Specifies that
|
| 313 |
+
* CUDA will not read from this resource and will write over the
|
| 314 |
+
* entire contents of the resource, so none of the data previously
|
| 315 |
+
* stored in the resource will be preserved.
|
| 316 |
+
*
|
| 317 |
+
* The EGLImageKHR is an object which can be used to create EGLImage target resource. It is defined as a void pointer.
|
| 318 |
+
* typedef void* EGLImageKHR
|
| 319 |
+
*
|
| 320 |
+
* \param pCudaResource - Pointer to the returned object handle
|
| 321 |
+
* \param image - An EGLImageKHR image which can be used to create target resource.
|
| 322 |
+
* \param flags - Map flags
|
| 323 |
+
*
|
| 324 |
+
* \return
|
| 325 |
+
* ::CUDA_SUCCESS,
|
| 326 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 327 |
+
* ::CUDA_ERROR_ALREADY_MAPPED,
|
| 328 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 329 |
+
*
|
| 330 |
+
* \sa ::cuGraphicsEGLRegisterImage, ::cuGraphicsUnregisterResource,
|
| 331 |
+
* ::cuGraphicsResourceSetMapFlags, ::cuGraphicsMapResources,
|
| 332 |
+
* ::cuGraphicsUnmapResources,
|
| 333 |
+
* ::cudaGraphicsEGLRegisterImage
|
| 334 |
+
*/
|
| 335 |
+
CUresult CUDAAPI cuGraphicsEGLRegisterImage(CUgraphicsResource *pCudaResource, EGLImageKHR image, unsigned int flags);
|
| 336 |
+
|
| 337 |
+
/**
|
| 338 |
+
* \brief Connect CUDA to EGLStream as a consumer.
|
| 339 |
+
*
|
| 340 |
+
* Connect CUDA as a consumer to EGLStreamKHR specified by \p stream.
|
| 341 |
+
*
|
| 342 |
+
* The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one
|
| 343 |
+
* API to another.
|
| 344 |
+
*
|
| 345 |
+
* \param conn - Pointer to the returned connection handle
|
| 346 |
+
* \param stream - EGLStreamKHR handle
|
| 347 |
+
*
|
| 348 |
+
* \return
|
| 349 |
+
* ::CUDA_SUCCESS,
|
| 350 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 351 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 352 |
+
*
|
| 353 |
+
* \sa ::cuEGLStreamConsumerConnect, ::cuEGLStreamConsumerDisconnect,
|
| 354 |
+
* ::cuEGLStreamConsumerAcquireFrame, ::cuEGLStreamConsumerReleaseFrame,
|
| 355 |
+
* ::cudaEGLStreamConsumerConnect
|
| 356 |
+
*/
|
| 357 |
+
CUresult CUDAAPI cuEGLStreamConsumerConnect(CUeglStreamConnection *conn, EGLStreamKHR stream);
|
| 358 |
+
|
| 359 |
+
/**
|
| 360 |
+
* \brief Connect CUDA to EGLStream as a consumer with given flags.
|
| 361 |
+
*
|
| 362 |
+
* Connect CUDA as a consumer to EGLStreamKHR specified by \p stream with specified \p flags defined by CUeglResourceLocationFlags.
|
| 363 |
+
*
|
| 364 |
+
* The flags specify whether the consumer wants to access frames from system memory or video memory.
|
| 365 |
+
* Default is ::CU_EGL_RESOURCE_LOCATION_VIDMEM.
|
| 366 |
+
*
|
| 367 |
+
* \param conn - Pointer to the returned connection handle
|
| 368 |
+
* \param stream - EGLStreamKHR handle
|
| 369 |
+
* \param flags - Flags denote intended location - system or video.
|
| 370 |
+
*
|
| 371 |
+
* \return
|
| 372 |
+
* ::CUDA_SUCCESS,
|
| 373 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 374 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 375 |
+
*
|
| 376 |
+
* \sa ::cuEGLStreamConsumerConnect, ::cuEGLStreamConsumerDisconnect,
|
| 377 |
+
* ::cuEGLStreamConsumerAcquireFrame, ::cuEGLStreamConsumerReleaseFrame,
|
| 378 |
+
* ::cudaEGLStreamConsumerConnectWithFlags
|
| 379 |
+
*/
|
| 380 |
+
|
| 381 |
+
CUresult CUDAAPI cuEGLStreamConsumerConnectWithFlags(CUeglStreamConnection *conn, EGLStreamKHR stream, unsigned int flags);
|
| 382 |
+
|
| 383 |
+
/**
|
| 384 |
+
* \brief Disconnect CUDA as a consumer to EGLStream .
|
| 385 |
+
*
|
| 386 |
+
* Disconnect CUDA as a consumer to EGLStreamKHR.
|
| 387 |
+
*
|
| 388 |
+
* \param conn - Conection to disconnect.
|
| 389 |
+
*
|
| 390 |
+
* \return
|
| 391 |
+
* ::CUDA_SUCCESS,
|
| 392 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 393 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 394 |
+
*
|
| 395 |
+
* \sa ::cuEGLStreamConsumerConnect, ::cuEGLStreamConsumerDisconnect,
|
| 396 |
+
* ::cuEGLStreamConsumerAcquireFrame, ::cuEGLStreamConsumerReleaseFrame,
|
| 397 |
+
* ::cudaEGLStreamConsumerDisconnect
|
| 398 |
+
*/
|
| 399 |
+
CUresult CUDAAPI cuEGLStreamConsumerDisconnect(CUeglStreamConnection *conn);
|
| 400 |
+
|
| 401 |
+
/**
|
| 402 |
+
* \brief Acquire an image frame from the EGLStream with CUDA as a consumer.
|
| 403 |
+
*
|
| 404 |
+
* Acquire an image frame from EGLStreamKHR. This API can also acquire an old frame presented
|
| 405 |
+
* by the producer unless explicitly disabled by setting EGL_SUPPORT_REUSE_NV flag to EGL_FALSE
|
| 406 |
+
* during stream initialization. By default, EGLStream is created with this flag set to EGL_TRUE.
|
| 407 |
+
* ::cuGraphicsResourceGetMappedEglFrame can be called on \p pCudaResource to get
|
| 408 |
+
* ::CUeglFrame.
|
| 409 |
+
*
|
| 410 |
+
* \param conn - Connection on which to acquire
|
| 411 |
+
* \param pCudaResource - CUDA resource on which the stream frame will be mapped for use.
|
| 412 |
+
* \param pStream - CUDA stream for synchronization and any data migrations
|
| 413 |
+
* implied by ::CUeglResourceLocationFlags.
|
| 414 |
+
* \param timeout - Desired timeout in usec for a new frame to be acquired.
|
| 415 |
+
* If set as ::CUDA_EGL_INFINITE_TIMEOUT, acquire waits infinitely.
|
| 416 |
+
* After timeout occurs CUDA consumer tries to acquire an old frame
|
| 417 |
+
* if available and EGL_SUPPORT_REUSE_NV flag is set.
|
| 418 |
+
*
|
| 419 |
+
* \return
|
| 420 |
+
* ::CUDA_SUCCESS,
|
| 421 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 422 |
+
* ::CUDA_ERROR_LAUNCH_TIMEOUT,
|
| 423 |
+
*
|
| 424 |
+
* \sa ::cuEGLStreamConsumerConnect, ::cuEGLStreamConsumerDisconnect,
|
| 425 |
+
* ::cuEGLStreamConsumerAcquireFrame, ::cuEGLStreamConsumerReleaseFrame,
|
| 426 |
+
* ::cudaEGLStreamConsumerAcquireFrame
|
| 427 |
+
*/
|
| 428 |
+
CUresult CUDAAPI cuEGLStreamConsumerAcquireFrame(CUeglStreamConnection *conn,
|
| 429 |
+
CUgraphicsResource *pCudaResource, CUstream *pStream, unsigned int timeout);
|
| 430 |
+
/**
|
| 431 |
+
* \brief Releases the last frame acquired from the EGLStream.
|
| 432 |
+
*
|
| 433 |
+
* Release the acquired image frame specified by \p pCudaResource to EGLStreamKHR.
|
| 434 |
+
* If EGL_SUPPORT_REUSE_NV flag is set to EGL_TRUE, at the time of EGL creation
|
| 435 |
+
* this API doesn't release the last frame acquired on the EGLStream.
|
| 436 |
+
* By default, EGLStream is created with this flag set to EGL_TRUE.
|
| 437 |
+
*
|
| 438 |
+
* \param conn - Connection on which to release
|
| 439 |
+
* \param pCudaResource - CUDA resource whose corresponding frame is to be released
|
| 440 |
+
* \param pStream - CUDA stream on which release will be done.
|
| 441 |
+
*
|
| 442 |
+
* \return
|
| 443 |
+
* ::CUDA_SUCCESS,
|
| 444 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 445 |
+
*
|
| 446 |
+
* \sa ::cuEGLStreamConsumerConnect, ::cuEGLStreamConsumerDisconnect,
|
| 447 |
+
* ::cuEGLStreamConsumerAcquireFrame, ::cuEGLStreamConsumerReleaseFrame,
|
| 448 |
+
* ::cudaEGLStreamConsumerReleaseFrame
|
| 449 |
+
*/
|
| 450 |
+
CUresult CUDAAPI cuEGLStreamConsumerReleaseFrame(CUeglStreamConnection *conn,
|
| 451 |
+
CUgraphicsResource pCudaResource, CUstream *pStream);
|
| 452 |
+
|
| 453 |
+
/**
|
| 454 |
+
* \brief Connect CUDA to EGLStream as a producer.
|
| 455 |
+
*
|
| 456 |
+
* Connect CUDA as a producer to EGLStreamKHR specified by \p stream.
|
| 457 |
+
*
|
| 458 |
+
* The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one
|
| 459 |
+
* API to another.
|
| 460 |
+
*
|
| 461 |
+
* \param conn - Pointer to the returned connection handle
|
| 462 |
+
* \param stream - EGLStreamKHR handle
|
| 463 |
+
* \param width - width of the image to be submitted to the stream
|
| 464 |
+
* \param height - height of the image to be submitted to the stream
|
| 465 |
+
*
|
| 466 |
+
* \return
|
| 467 |
+
* ::CUDA_SUCCESS,
|
| 468 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 469 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 470 |
+
*
|
| 471 |
+
* \sa ::cuEGLStreamProducerConnect, ::cuEGLStreamProducerDisconnect,
|
| 472 |
+
* ::cuEGLStreamProducerPresentFrame,
|
| 473 |
+
* ::cudaEGLStreamProducerConnect
|
| 474 |
+
*/
|
| 475 |
+
CUresult CUDAAPI cuEGLStreamProducerConnect(CUeglStreamConnection *conn, EGLStreamKHR stream,
|
| 476 |
+
EGLint width, EGLint height);
|
| 477 |
+
|
| 478 |
+
/**
|
| 479 |
+
* \brief Disconnect CUDA as a producer to EGLStream .
|
| 480 |
+
*
|
| 481 |
+
* Disconnect CUDA as a producer to EGLStreamKHR.
|
| 482 |
+
*
|
| 483 |
+
* \param conn - Conection to disconnect.
|
| 484 |
+
*
|
| 485 |
+
* \return
|
| 486 |
+
* ::CUDA_SUCCESS,
|
| 487 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 488 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 489 |
+
*
|
| 490 |
+
* \sa ::cuEGLStreamProducerConnect, ::cuEGLStreamProducerDisconnect,
|
| 491 |
+
* ::cuEGLStreamProducerPresentFrame,
|
| 492 |
+
* ::cudaEGLStreamProducerDisconnect
|
| 493 |
+
*/
|
| 494 |
+
CUresult CUDAAPI cuEGLStreamProducerDisconnect(CUeglStreamConnection *conn);
|
| 495 |
+
|
| 496 |
+
/**
|
| 497 |
+
* \brief Present a CUDA eglFrame to the EGLStream with CUDA as a producer.
|
| 498 |
+
*
|
| 499 |
+
* When a frame is presented by the producer, it gets associated with the EGLStream
|
| 500 |
+
* and thus it is illegal to free the frame before the producer is disconnected.
|
| 501 |
+
* If a frame is freed and reused it may lead to undefined behavior.
|
| 502 |
+
*
|
| 503 |
+
* If producer and consumer are on different GPUs (iGPU and dGPU) then frametype
|
| 504 |
+
* ::CU_EGL_FRAME_TYPE_ARRAY is not supported. ::CU_EGL_FRAME_TYPE_PITCH can be used for
|
| 505 |
+
* such cross-device applications.
|
| 506 |
+
*
|
| 507 |
+
* The ::CUeglFrame is defined as:
|
| 508 |
+
* \code
|
| 509 |
+
* typedef struct CUeglFrame_st {
|
| 510 |
+
* union {
|
| 511 |
+
* CUarray pArray[MAX_PLANES];
|
| 512 |
+
* void* pPitch[MAX_PLANES];
|
| 513 |
+
* } frame;
|
| 514 |
+
* unsigned int width;
|
| 515 |
+
* unsigned int height;
|
| 516 |
+
* unsigned int depth;
|
| 517 |
+
* unsigned int pitch;
|
| 518 |
+
* unsigned int planeCount;
|
| 519 |
+
* unsigned int numChannels;
|
| 520 |
+
* CUeglFrameType frameType;
|
| 521 |
+
* CUeglColorFormat eglColorFormat;
|
| 522 |
+
* CUarray_format cuFormat;
|
| 523 |
+
* } CUeglFrame;
|
| 524 |
+
* \endcode
|
| 525 |
+
*
|
| 526 |
+
* For ::CUeglFrame of type ::CU_EGL_FRAME_TYPE_PITCH, the application may present sub-region of a memory
|
| 527 |
+
* allocation. In that case, the pitched pointer will specify the start address of the sub-region in
|
| 528 |
+
* the allocation and corresponding ::CUeglFrame fields will specify the dimensions of the sub-region.
|
| 529 |
+
*
|
| 530 |
+
* \param conn - Connection on which to present the CUDA array
|
| 531 |
+
* \param eglframe - CUDA Eglstream Proucer Frame handle to be sent to the consumer over EglStream.
|
| 532 |
+
* \param pStream - CUDA stream on which to present the frame.
|
| 533 |
+
*
|
| 534 |
+
* \return
|
| 535 |
+
* ::CUDA_SUCCESS,
|
| 536 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 537 |
+
*
|
| 538 |
+
* \sa ::cuEGLStreamProducerConnect, ::cuEGLStreamProducerDisconnect,
|
| 539 |
+
* ::cuEGLStreamProducerReturnFrame,
|
| 540 |
+
* ::cudaEGLStreamProducerPresentFrame
|
| 541 |
+
*/
|
| 542 |
+
CUresult CUDAAPI cuEGLStreamProducerPresentFrame(CUeglStreamConnection *conn,
|
| 543 |
+
CUeglFrame eglframe, CUstream *pStream);
|
| 544 |
+
|
| 545 |
+
/**
|
| 546 |
+
* \brief Return the CUDA eglFrame to the EGLStream released by the consumer.
|
| 547 |
+
*
|
| 548 |
+
* This API can potentially return CUDA_ERROR_LAUNCH_TIMEOUT if the consumer has not
|
| 549 |
+
* returned a frame to EGL stream. If timeout is returned the application can retry.
|
| 550 |
+
*
|
| 551 |
+
* \param conn - Connection on which to return
|
| 552 |
+
* \param eglframe - CUDA Eglstream Proucer Frame handle returned from the consumer over EglStream.
|
| 553 |
+
* \param pStream - CUDA stream on which to return the frame.
|
| 554 |
+
*
|
| 555 |
+
* \return
|
| 556 |
+
* ::CUDA_SUCCESS,
|
| 557 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 558 |
+
* ::CUDA_ERROR_LAUNCH_TIMEOUT
|
| 559 |
+
*
|
| 560 |
+
* \sa ::cuEGLStreamProducerConnect, ::cuEGLStreamProducerDisconnect,
|
| 561 |
+
* ::cuEGLStreamProducerPresentFrame,
|
| 562 |
+
* ::cudaEGLStreamProducerReturnFrame
|
| 563 |
+
*/
|
| 564 |
+
CUresult CUDAAPI cuEGLStreamProducerReturnFrame(CUeglStreamConnection *conn,
|
| 565 |
+
CUeglFrame *eglframe, CUstream *pStream);
|
| 566 |
+
|
| 567 |
+
/**
|
| 568 |
+
* \brief Get an eglFrame through which to access a registered EGL graphics resource.
|
| 569 |
+
*
|
| 570 |
+
* Returns in \p *eglFrame an eglFrame pointer through which the registered graphics resource
|
| 571 |
+
* \p resource may be accessed.
|
| 572 |
+
* This API can only be called for registered EGL graphics resources.
|
| 573 |
+
*
|
| 574 |
+
* The ::CUeglFrame is defined as:
|
| 575 |
+
* \code
|
| 576 |
+
* typedef struct CUeglFrame_st {
|
| 577 |
+
* union {
|
| 578 |
+
* CUarray pArray[MAX_PLANES];
|
| 579 |
+
* void* pPitch[MAX_PLANES];
|
| 580 |
+
* } frame;
|
| 581 |
+
* unsigned int width;
|
| 582 |
+
* unsigned int height;
|
| 583 |
+
* unsigned int depth;
|
| 584 |
+
* unsigned int pitch;
|
| 585 |
+
* unsigned int planeCount;
|
| 586 |
+
* unsigned int numChannels;
|
| 587 |
+
* CUeglFrameType frameType;
|
| 588 |
+
* CUeglColorFormat eglColorFormat;
|
| 589 |
+
* CUarray_format cuFormat;
|
| 590 |
+
* } CUeglFrame;
|
| 591 |
+
* \endcode
|
| 592 |
+
*
|
| 593 |
+
* If \p resource is not registered then ::CUDA_ERROR_NOT_MAPPED is returned.
|
| 594 |
+
* *
|
| 595 |
+
* \param eglFrame - Returned eglFrame.
|
| 596 |
+
* \param resource - Registered resource to access.
|
| 597 |
+
* \param index - Index for cubemap surfaces.
|
| 598 |
+
* \param mipLevel - Mipmap level for the subresource to access.
|
| 599 |
+
*
|
| 600 |
+
* \return
|
| 601 |
+
* ::CUDA_SUCCESS,
|
| 602 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 603 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 604 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 605 |
+
* ::CUDA_ERROR_INVALID_VALUE,
|
| 606 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 607 |
+
* ::CUDA_ERROR_NOT_MAPPED
|
| 608 |
+
*
|
| 609 |
+
* \sa
|
| 610 |
+
* ::cuGraphicsMapResources,
|
| 611 |
+
* ::cuGraphicsSubResourceGetMappedArray,
|
| 612 |
+
* ::cuGraphicsResourceGetMappedPointer,
|
| 613 |
+
* ::cudaGraphicsResourceGetMappedEglFrame
|
| 614 |
+
*/
|
| 615 |
+
CUresult CUDAAPI cuGraphicsResourceGetMappedEglFrame(CUeglFrame* eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel);
|
| 616 |
+
|
| 617 |
+
/**
|
| 618 |
+
* \brief Creates an event from EGLSync object
|
| 619 |
+
*
|
| 620 |
+
* Creates an event *phEvent from an EGLSyncKHR eglSync with the flags specified
|
| 621 |
+
* via \p flags. Valid flags include:
|
| 622 |
+
* - ::CU_EVENT_DEFAULT: Default event creation flag.
|
| 623 |
+
* - ::CU_EVENT_BLOCKING_SYNC: Specifies that the created event should use blocking
|
| 624 |
+
* synchronization. A CPU thread that uses ::cuEventSynchronize() to wait on
|
| 625 |
+
* an event created with this flag will block until the event has actually
|
| 626 |
+
* been completed.
|
| 627 |
+
*
|
| 628 |
+
* Once the \p eglSync gets destroyed, ::cuEventDestroy is the only API
|
| 629 |
+
* that can be invoked on the event.
|
| 630 |
+
*
|
| 631 |
+
* ::cuEventRecord and TimingData are not supported for events created from EGLSync.
|
| 632 |
+
*
|
| 633 |
+
* The EGLSyncKHR is an opaque handle to an EGL sync object.
|
| 634 |
+
* typedef void* EGLSyncKHR
|
| 635 |
+
*
|
| 636 |
+
* \param phEvent - Returns newly created event
|
| 637 |
+
* \param eglSync - Opaque handle to EGLSync object
|
| 638 |
+
* \param flags - Event creation flags
|
| 639 |
+
*
|
| 640 |
+
* \return
|
| 641 |
+
* ::CUDA_SUCCESS,
|
| 642 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 643 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 644 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 645 |
+
* ::CUDA_ERROR_INVALID_VALUE,
|
| 646 |
+
* ::CUDA_ERROR_OUT_OF_MEMORY
|
| 647 |
+
*
|
| 648 |
+
* \sa
|
| 649 |
+
* ::cuEventQuery,
|
| 650 |
+
* ::cuEventSynchronize,
|
| 651 |
+
* ::cuEventDestroy
|
| 652 |
+
*/
|
| 653 |
+
CUresult CUDAAPI cuEventCreateFromEGLSync(CUevent *phEvent, EGLSyncKHR eglSync, unsigned int flags);
|
| 654 |
+
|
| 655 |
+
/** @} */ /* END CUDA_EGL */
|
| 656 |
+
|
| 657 |
+
#ifdef __cplusplus
|
| 658 |
+
};
|
| 659 |
+
#endif
|
| 660 |
+
|
| 661 |
+
#endif
|
| 662 |
+
|
lib/python3.11/site-packages/nvidia/cu13/include/cudaEGLTypedefs.h
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2020-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef CUDAEGLTYPEDEFS_H
|
| 51 |
+
#define CUDAEGLTYPEDEFS_H
|
| 52 |
+
|
| 53 |
+
#include <cudaEGL.h>
|
| 54 |
+
|
| 55 |
+
#ifdef __cplusplus
|
| 56 |
+
extern "C" {
|
| 57 |
+
#endif // __cplusplus
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Type definitions for functions defined in cudaEGL.h
|
| 61 |
+
*/
|
| 62 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsEGLRegisterImage_v7000)(CUgraphicsResource CUDAAPI *pCudaResource, EGLImageKHR image, unsigned int flags);
|
| 63 |
+
typedef CUresult (CUDAAPI *PFN_cuEGLStreamConsumerConnect_v7000)(CUeglStreamConnection CUDAAPI *conn, EGLStreamKHR stream);
|
| 64 |
+
typedef CUresult (CUDAAPI *PFN_cuEGLStreamConsumerConnectWithFlags_v8000)(CUeglStreamConnection CUDAAPI *conn, EGLStreamKHR stream, unsigned int flags);
|
| 65 |
+
typedef CUresult (CUDAAPI *PFN_cuEGLStreamConsumerDisconnect_v7000)(CUeglStreamConnection CUDAAPI *conn);
|
| 66 |
+
typedef CUresult (CUDAAPI *PFN_cuEGLStreamConsumerAcquireFrame_v7000)(CUeglStreamConnection CUDAAPI *conn, CUgraphicsResource CUDAAPI *pCudaResource, CUstream CUDAAPI *pStream, unsigned int timeout);
|
| 67 |
+
typedef CUresult (CUDAAPI *PFN_cuEGLStreamConsumerReleaseFrame_v7000)(CUeglStreamConnection CUDAAPI *conn, CUgraphicsResource pCudaResource, CUstream CUDAAPI *pStream);
|
| 68 |
+
typedef CUresult (CUDAAPI *PFN_cuEGLStreamProducerConnect_v7000)(CUeglStreamConnection CUDAAPI *conn, EGLStreamKHR stream, EGLint width, EGLint height);
|
| 69 |
+
typedef CUresult (CUDAAPI *PFN_cuEGLStreamProducerDisconnect_v7000)(CUeglStreamConnection CUDAAPI *conn);
|
| 70 |
+
typedef CUresult (CUDAAPI *PFN_cuEGLStreamProducerPresentFrame_v7000)(CUeglStreamConnection CUDAAPI *conn, CUeglFrame_v1 eglframe, CUstream CUDAAPI *pStream);
|
| 71 |
+
typedef CUresult (CUDAAPI *PFN_cuEGLStreamProducerReturnFrame_v7000)(CUeglStreamConnection CUDAAPI *conn, CUeglFrame_v1 CUDAAPI *eglframe, CUstream CUDAAPI *pStream);
|
| 72 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceGetMappedEglFrame_v7000)(CUeglFrame_v1 CUDAAPI *eglFrame, CUgraphicsResource resource, unsigned int index, unsigned int mipLevel);
|
| 73 |
+
typedef CUresult (CUDAAPI *PFN_cuEventCreateFromEGLSync_v9000)(CUevent CUDAAPI *phEvent, EGLSyncKHR eglSync, unsigned int flags);
|
| 74 |
+
|
| 75 |
+
#ifdef __cplusplus
|
| 76 |
+
}
|
| 77 |
+
#endif // __cplusplus
|
| 78 |
+
|
| 79 |
+
#endif // file guard
|
lib/python3.11/site-packages/nvidia/cu13/include/cudaGL.h
ADDED
|
@@ -0,0 +1,608 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2014 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef CUDAGL_H
|
| 51 |
+
#define CUDAGL_H
|
| 52 |
+
|
| 53 |
+
#include <cuda.h>
|
| 54 |
+
#include <GL/gl.h>
|
| 55 |
+
|
| 56 |
+
#if defined(__CUDA_API_VERSION_INTERNAL) || defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED)
|
| 57 |
+
#define __CUDA_DEPRECATED
|
| 58 |
+
#elif defined(_MSC_VER)
|
| 59 |
+
#define __CUDA_DEPRECATED __declspec(deprecated)
|
| 60 |
+
#elif defined(__GNUC__)
|
| 61 |
+
#define __CUDA_DEPRECATED __attribute__((deprecated))
|
| 62 |
+
#else
|
| 63 |
+
#define __CUDA_DEPRECATED
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
#ifdef CUDA_FORCE_API_VERSION
|
| 67 |
+
#error "CUDA_FORCE_API_VERSION is no longer supported."
|
| 68 |
+
#endif
|
| 69 |
+
|
| 70 |
+
#if defined(__CUDA_API_VERSION_INTERNAL) || defined(CUDA_API_PER_THREAD_DEFAULT_STREAM)
|
| 71 |
+
#define __CUDA_API_PER_THREAD_DEFAULT_STREAM
|
| 72 |
+
#define __CUDA_API_PTDS(api) api ## _ptds
|
| 73 |
+
#define __CUDA_API_PTSZ(api) api ## _ptsz
|
| 74 |
+
#else
|
| 75 |
+
#define __CUDA_API_PTDS(api) api
|
| 76 |
+
#define __CUDA_API_PTSZ(api) api
|
| 77 |
+
#endif
|
| 78 |
+
|
| 79 |
+
#define cuGLCtxCreate cuGLCtxCreate_v2
|
| 80 |
+
#define cuGLMapBufferObject __CUDA_API_PTDS(cuGLMapBufferObject_v2)
|
| 81 |
+
#define cuGLMapBufferObjectAsync __CUDA_API_PTSZ(cuGLMapBufferObjectAsync_v2)
|
| 82 |
+
#define cuGLGetDevices cuGLGetDevices_v2
|
| 83 |
+
|
| 84 |
+
#ifdef __cplusplus
|
| 85 |
+
extern "C" {
|
| 86 |
+
#endif
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* \file cudaGL.h
|
| 90 |
+
* \brief Header file for the OpenGL interoperability functions of the
|
| 91 |
+
* low-level CUDA driver application programming interface.
|
| 92 |
+
*/
|
| 93 |
+
|
| 94 |
+
/**
|
| 95 |
+
* \defgroup CUDA_GL OpenGL Interoperability
|
| 96 |
+
* \ingroup CUDA_DRIVER
|
| 97 |
+
*
|
| 98 |
+
* ___MANBRIEF___ OpenGL interoperability functions of the low-level CUDA
|
| 99 |
+
* driver API (___CURRENT_FILE___) ___ENDMANBRIEF___
|
| 100 |
+
*
|
| 101 |
+
* This section describes the OpenGL interoperability functions of the
|
| 102 |
+
* low-level CUDA driver application programming interface. Note that mapping
|
| 103 |
+
* of OpenGL resources is performed with the graphics API agnostic, resource
|
| 104 |
+
* mapping interface described in \ref CUDA_GRAPHICS "Graphics Interoperability".
|
| 105 |
+
*
|
| 106 |
+
* @{
|
| 107 |
+
*/
|
| 108 |
+
|
| 109 |
+
#if defined(_WIN32)
|
| 110 |
+
#if !defined(WGL_NV_gpu_affinity)
|
| 111 |
+
typedef void* HGPUNV;
|
| 112 |
+
#endif
|
| 113 |
+
#endif /* _WIN32 */
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* \brief Registers an OpenGL buffer object
|
| 117 |
+
*
|
| 118 |
+
* Registers the buffer object specified by \p buffer for access by
|
| 119 |
+
* CUDA. A handle to the registered object is returned as \p
|
| 120 |
+
* pCudaResource. The register flags \p Flags specify the intended usage,
|
| 121 |
+
* as follows:
|
| 122 |
+
*
|
| 123 |
+
* - ::CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this
|
| 124 |
+
* resource will be used. It is therefore assumed that this resource will be
|
| 125 |
+
* read from and written to by CUDA. This is the default value.
|
| 126 |
+
* - ::CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY: Specifies that CUDA
|
| 127 |
+
* will not write to this resource.
|
| 128 |
+
* - ::CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD: Specifies that
|
| 129 |
+
* CUDA will not read from this resource and will write over the
|
| 130 |
+
* entire contents of the resource, so none of the data previously
|
| 131 |
+
* stored in the resource will be preserved.
|
| 132 |
+
*
|
| 133 |
+
* \param pCudaResource - Pointer to the returned object handle
|
| 134 |
+
* \param buffer - name of buffer object to be registered
|
| 135 |
+
* \param Flags - Register flags
|
| 136 |
+
*
|
| 137 |
+
* \return
|
| 138 |
+
* ::CUDA_SUCCESS,
|
| 139 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 140 |
+
* ::CUDA_ERROR_ALREADY_MAPPED,
|
| 141 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 142 |
+
* ::CUDA_ERROR_OPERATING_SYSTEM
|
| 143 |
+
* \notefnerr
|
| 144 |
+
*
|
| 145 |
+
* \sa
|
| 146 |
+
* ::cuGraphicsUnregisterResource,
|
| 147 |
+
* ::cuGraphicsMapResources,
|
| 148 |
+
* ::cuGraphicsResourceGetMappedPointer,
|
| 149 |
+
* ::cudaGraphicsGLRegisterBuffer
|
| 150 |
+
*/
|
| 151 |
+
CUresult CUDAAPI cuGraphicsGLRegisterBuffer(CUgraphicsResource *pCudaResource, GLuint buffer, unsigned int Flags);
|
| 152 |
+
|
| 153 |
+
/**
|
| 154 |
+
* \brief Register an OpenGL texture or renderbuffer object
|
| 155 |
+
*
|
| 156 |
+
* Registers the texture or renderbuffer object specified by \p image for access by CUDA.
|
| 157 |
+
* A handle to the registered object is returned as \p pCudaResource.
|
| 158 |
+
*
|
| 159 |
+
* \p target must match the type of the object, and must be one of ::GL_TEXTURE_2D,
|
| 160 |
+
* ::GL_TEXTURE_RECTANGLE, ::GL_TEXTURE_CUBE_MAP, ::GL_TEXTURE_3D, ::GL_TEXTURE_2D_ARRAY,
|
| 161 |
+
* or ::GL_RENDERBUFFER.
|
| 162 |
+
*
|
| 163 |
+
* The register flags \p Flags specify the intended usage, as follows:
|
| 164 |
+
*
|
| 165 |
+
* - ::CU_GRAPHICS_REGISTER_FLAGS_NONE: Specifies no hints about how this
|
| 166 |
+
* resource will be used. It is therefore assumed that this resource will be
|
| 167 |
+
* read from and written to by CUDA. This is the default value.
|
| 168 |
+
* - ::CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY: Specifies that CUDA
|
| 169 |
+
* will not write to this resource.
|
| 170 |
+
* - ::CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD: Specifies that
|
| 171 |
+
* CUDA will not read from this resource and will write over the
|
| 172 |
+
* entire contents of the resource, so none of the data previously
|
| 173 |
+
* stored in the resource will be preserved.
|
| 174 |
+
* - ::CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST: Specifies that CUDA will
|
| 175 |
+
* bind this resource to a surface reference.
|
| 176 |
+
* - ::CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER: Specifies that CUDA will perform
|
| 177 |
+
* texture gather operations on this resource.
|
| 178 |
+
*
|
| 179 |
+
* The following image formats are supported. For brevity's sake, the list is abbreviated.
|
| 180 |
+
* For ex., {GL_R, GL_RG} X {8, 16} would expand to the following 4 formats
|
| 181 |
+
* {GL_R8, GL_R16, GL_RG8, GL_RG16} :
|
| 182 |
+
* - GL_RED, GL_RG, GL_RGBA, GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY
|
| 183 |
+
* - {GL_R, GL_RG, GL_RGBA} X {8, 16, 16F, 32F, 8UI, 16UI, 32UI, 8I, 16I, 32I}
|
| 184 |
+
* - {GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA, GL_INTENSITY} X
|
| 185 |
+
* {8, 16, 16F_ARB, 32F_ARB, 8UI_EXT, 16UI_EXT, 32UI_EXT, 8I_EXT, 16I_EXT, 32I_EXT}
|
| 186 |
+
*
|
| 187 |
+
* The following image classes are currently disallowed:
|
| 188 |
+
* - Textures with borders
|
| 189 |
+
* - Multisampled renderbuffers
|
| 190 |
+
*
|
| 191 |
+
* \param pCudaResource - Pointer to the returned object handle
|
| 192 |
+
* \param image - name of texture or renderbuffer object to be registered
|
| 193 |
+
* \param target - Identifies the type of object specified by \p image
|
| 194 |
+
* \param Flags - Register flags
|
| 195 |
+
*
|
| 196 |
+
* \return
|
| 197 |
+
* ::CUDA_SUCCESS,
|
| 198 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 199 |
+
* ::CUDA_ERROR_ALREADY_MAPPED,
|
| 200 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 201 |
+
* ::CUDA_ERROR_OPERATING_SYSTEM
|
| 202 |
+
* \notefnerr
|
| 203 |
+
*
|
| 204 |
+
* \sa
|
| 205 |
+
* ::cuGraphicsUnregisterResource,
|
| 206 |
+
* ::cuGraphicsMapResources,
|
| 207 |
+
* ::cuGraphicsSubResourceGetMappedArray,
|
| 208 |
+
* ::cudaGraphicsGLRegisterImage
|
| 209 |
+
*/
|
| 210 |
+
CUresult CUDAAPI cuGraphicsGLRegisterImage(CUgraphicsResource *pCudaResource, GLuint image, GLenum target, unsigned int Flags);
|
| 211 |
+
|
| 212 |
+
#ifdef _WIN32
|
| 213 |
+
/**
|
| 214 |
+
* \brief Gets the CUDA device associated with hGpu
|
| 215 |
+
*
|
| 216 |
+
* Returns in \p *pDevice the CUDA device associated with a \p hGpu, if
|
| 217 |
+
* applicable.
|
| 218 |
+
*
|
| 219 |
+
* \param pDevice - Device associated with hGpu
|
| 220 |
+
* \param hGpu - Handle to a GPU, as queried via ::WGL_NV_gpu_affinity()
|
| 221 |
+
*
|
| 222 |
+
* \return
|
| 223 |
+
* ::CUDA_SUCCESS,
|
| 224 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 225 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 226 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 227 |
+
* ::CUDA_ERROR_INVALID_VALUE
|
| 228 |
+
* \notefnerr
|
| 229 |
+
*
|
| 230 |
+
* \sa ::cuGLMapBufferObject,
|
| 231 |
+
* ::cuGLRegisterBufferObject, ::cuGLUnmapBufferObject,
|
| 232 |
+
* ::cuGLUnregisterBufferObject, ::cuGLUnmapBufferObjectAsync,
|
| 233 |
+
* ::cuGLSetBufferObjectMapFlags,
|
| 234 |
+
* ::cudaWGLGetDevice
|
| 235 |
+
*/
|
| 236 |
+
CUresult CUDAAPI cuWGLGetDevice(CUdevice *pDevice, HGPUNV hGpu);
|
| 237 |
+
#endif /* _WIN32 */
|
| 238 |
+
|
| 239 |
+
/**
|
| 240 |
+
* CUDA devices corresponding to an OpenGL device
|
| 241 |
+
*/
|
| 242 |
+
typedef enum CUGLDeviceList_enum {
|
| 243 |
+
CU_GL_DEVICE_LIST_ALL = 0x01, /**< The CUDA devices for all GPUs used by the current OpenGL context */
|
| 244 |
+
CU_GL_DEVICE_LIST_CURRENT_FRAME = 0x02, /**< The CUDA devices for the GPUs used by the current OpenGL context in its currently rendering frame */
|
| 245 |
+
CU_GL_DEVICE_LIST_NEXT_FRAME = 0x03, /**< The CUDA devices for the GPUs to be used by the current OpenGL context in the next frame */
|
| 246 |
+
} CUGLDeviceList;
|
| 247 |
+
|
| 248 |
+
/**
|
| 249 |
+
* \brief Gets the CUDA devices associated with the current OpenGL context
|
| 250 |
+
*
|
| 251 |
+
* Returns in \p *pCudaDeviceCount the number of CUDA-compatible devices
|
| 252 |
+
* corresponding to the current OpenGL context. Also returns in \p *pCudaDevices
|
| 253 |
+
* at most cudaDeviceCount of the CUDA-compatible devices corresponding to
|
| 254 |
+
* the current OpenGL context. If any of the GPUs being used by the current OpenGL
|
| 255 |
+
* context are not CUDA capable then the call will return CUDA_ERROR_NO_DEVICE.
|
| 256 |
+
*
|
| 257 |
+
* The \p deviceList argument may be any of the following:
|
| 258 |
+
* - ::CU_GL_DEVICE_LIST_ALL: Query all devices used by the current OpenGL context.
|
| 259 |
+
* - ::CU_GL_DEVICE_LIST_CURRENT_FRAME: Query the devices used by the current OpenGL context to
|
| 260 |
+
* render the current frame (in SLI).
|
| 261 |
+
* - ::CU_GL_DEVICE_LIST_NEXT_FRAME: Query the devices used by the current OpenGL context to
|
| 262 |
+
* render the next frame (in SLI). Note that this is a prediction, it can't be guaranteed that
|
| 263 |
+
* this is correct in all cases.
|
| 264 |
+
*
|
| 265 |
+
* \param pCudaDeviceCount - Returned number of CUDA devices.
|
| 266 |
+
* \param pCudaDevices - Returned CUDA devices.
|
| 267 |
+
* \param cudaDeviceCount - The size of the output device array pCudaDevices.
|
| 268 |
+
* \param deviceList - The set of devices to return.
|
| 269 |
+
*
|
| 270 |
+
* \return
|
| 271 |
+
* ::CUDA_SUCCESS,
|
| 272 |
+
* ::CUDA_ERROR_NO_DEVICE,
|
| 273 |
+
* ::CUDA_ERROR_INVALID_VALUE,
|
| 274 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 275 |
+
* ::CUDA_ERROR_INVALID_GRAPHICS_CONTEXT,
|
| 276 |
+
* ::CUDA_ERROR_OPERATING_SYSTEM
|
| 277 |
+
*
|
| 278 |
+
* \notefnerr
|
| 279 |
+
*
|
| 280 |
+
* \sa
|
| 281 |
+
* ::cuWGLGetDevice,
|
| 282 |
+
* ::cudaGLGetDevices
|
| 283 |
+
*/
|
| 284 |
+
CUresult CUDAAPI cuGLGetDevices(unsigned int *pCudaDeviceCount, CUdevice *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList);
|
| 285 |
+
|
| 286 |
+
/**
|
| 287 |
+
* \defgroup CUDA_GL_DEPRECATED OpenGL Interoperability [DEPRECATED]
|
| 288 |
+
*
|
| 289 |
+
* ___MANBRIEF___ deprecated OpenGL interoperability functions of the low-level
|
| 290 |
+
* CUDA driver API (___CURRENT_FILE___) ___ENDMANBRIEF___
|
| 291 |
+
*
|
| 292 |
+
* This section describes deprecated OpenGL interoperability functionality.
|
| 293 |
+
*
|
| 294 |
+
* @{
|
| 295 |
+
*/
|
| 296 |
+
|
| 297 |
+
/** Flags to map or unmap a resource */
|
| 298 |
+
typedef enum CUGLmap_flags_enum {
|
| 299 |
+
CU_GL_MAP_RESOURCE_FLAGS_NONE = 0x00,
|
| 300 |
+
CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01,
|
| 301 |
+
CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02,
|
| 302 |
+
} CUGLmap_flags;
|
| 303 |
+
|
| 304 |
+
/**
|
| 305 |
+
* \brief Create a CUDA context for interoperability with OpenGL
|
| 306 |
+
*
|
| 307 |
+
* \deprecated This function is deprecated as of Cuda 5.0.
|
| 308 |
+
*
|
| 309 |
+
* This function is deprecated and should no longer be used. It is
|
| 310 |
+
* no longer necessary to associate a CUDA context with an OpenGL
|
| 311 |
+
* context in order to achieve maximum interoperability performance.
|
| 312 |
+
*
|
| 313 |
+
* \param pCtx - Returned CUDA context
|
| 314 |
+
* \param Flags - Options for CUDA context creation
|
| 315 |
+
* \param device - Device on which to create the context
|
| 316 |
+
*
|
| 317 |
+
* \return
|
| 318 |
+
* ::CUDA_SUCCESS,
|
| 319 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 320 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 321 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 322 |
+
* ::CUDA_ERROR_INVALID_VALUE,
|
| 323 |
+
* ::CUDA_ERROR_OUT_OF_MEMORY
|
| 324 |
+
* \notefnerr
|
| 325 |
+
*
|
| 326 |
+
* \sa ::cuCtxCreate, ::cuGLInit, ::cuGLMapBufferObject,
|
| 327 |
+
* ::cuGLRegisterBufferObject, ::cuGLUnmapBufferObject,
|
| 328 |
+
* ::cuGLUnregisterBufferObject, ::cuGLMapBufferObjectAsync,
|
| 329 |
+
* ::cuGLUnmapBufferObjectAsync, ::cuGLSetBufferObjectMapFlags,
|
| 330 |
+
* ::cuWGLGetDevice
|
| 331 |
+
*/
|
| 332 |
+
__CUDA_DEPRECATED CUresult CUDAAPI cuGLCtxCreate(CUcontext *pCtx, unsigned int Flags, CUdevice device );
|
| 333 |
+
|
| 334 |
+
/**
|
| 335 |
+
* \brief Initializes OpenGL interoperability
|
| 336 |
+
*
|
| 337 |
+
* \deprecated This function is deprecated as of Cuda 3.0.
|
| 338 |
+
*
|
| 339 |
+
* Initializes OpenGL interoperability. This function is deprecated
|
| 340 |
+
* and calling it is no longer required. It may fail if the needed
|
| 341 |
+
* OpenGL driver facilities are not available.
|
| 342 |
+
*
|
| 343 |
+
* \return
|
| 344 |
+
* ::CUDA_SUCCESS,
|
| 345 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 346 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 347 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 348 |
+
* ::CUDA_ERROR_UNKNOWN
|
| 349 |
+
* \notefnerr
|
| 350 |
+
*
|
| 351 |
+
* \sa ::cuGLMapBufferObject,
|
| 352 |
+
* ::cuGLRegisterBufferObject, ::cuGLUnmapBufferObject,
|
| 353 |
+
* ::cuGLUnregisterBufferObject, ::cuGLMapBufferObjectAsync,
|
| 354 |
+
* ::cuGLUnmapBufferObjectAsync, ::cuGLSetBufferObjectMapFlags,
|
| 355 |
+
* ::cuWGLGetDevice
|
| 356 |
+
*/
|
| 357 |
+
__CUDA_DEPRECATED CUresult CUDAAPI cuGLInit(void);
|
| 358 |
+
|
| 359 |
+
/**
|
| 360 |
+
* \brief Registers an OpenGL buffer object
|
| 361 |
+
*
|
| 362 |
+
* \deprecated This function is deprecated as of Cuda 3.0.
|
| 363 |
+
*
|
| 364 |
+
* Registers the buffer object specified by \p buffer for access by
|
| 365 |
+
* CUDA. This function must be called before CUDA can map the buffer
|
| 366 |
+
* object. There must be a valid OpenGL context bound to the current
|
| 367 |
+
* thread when this function is called, and the buffer name is
|
| 368 |
+
* resolved by that context.
|
| 369 |
+
*
|
| 370 |
+
* \param buffer - The name of the buffer object to register.
|
| 371 |
+
*
|
| 372 |
+
* \return
|
| 373 |
+
* ::CUDA_SUCCESS,
|
| 374 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 375 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 376 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 377 |
+
* ::CUDA_ERROR_ALREADY_MAPPED
|
| 378 |
+
* \notefnerr
|
| 379 |
+
*
|
| 380 |
+
* \sa ::cuGraphicsGLRegisterBuffer
|
| 381 |
+
*/
|
| 382 |
+
__CUDA_DEPRECATED CUresult CUDAAPI cuGLRegisterBufferObject(GLuint buffer);
|
| 383 |
+
|
| 384 |
+
/**
|
| 385 |
+
* \brief Maps an OpenGL buffer object
|
| 386 |
+
*
|
| 387 |
+
* \deprecated This function is deprecated as of Cuda 3.0.
|
| 388 |
+
*
|
| 389 |
+
* Maps the buffer object specified by \p buffer into the address space of the
|
| 390 |
+
* current CUDA context and returns in \p *dptr and \p *size the base pointer
|
| 391 |
+
* and size of the resulting mapping.
|
| 392 |
+
*
|
| 393 |
+
* There must be a valid OpenGL context bound to the current thread
|
| 394 |
+
* when this function is called. This must be the same context, or a
|
| 395 |
+
* member of the same shareGroup, as the context that was bound when
|
| 396 |
+
* the buffer was registered.
|
| 397 |
+
*
|
| 398 |
+
* All streams in the current CUDA context are synchronized with the
|
| 399 |
+
* current GL context.
|
| 400 |
+
*
|
| 401 |
+
* \param dptr - Returned mapped base pointer
|
| 402 |
+
* \param size - Returned size of mapping
|
| 403 |
+
* \param buffer - The name of the buffer object to map
|
| 404 |
+
*
|
| 405 |
+
* \return
|
| 406 |
+
* ::CUDA_SUCCESS,
|
| 407 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 408 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 409 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 410 |
+
* ::CUDA_ERROR_INVALID_VALUE,
|
| 411 |
+
* ::CUDA_ERROR_MAP_FAILED
|
| 412 |
+
* \notefnerr
|
| 413 |
+
*
|
| 414 |
+
* \sa ::cuGraphicsMapResources
|
| 415 |
+
*/
|
| 416 |
+
__CUDA_DEPRECATED CUresult CUDAAPI cuGLMapBufferObject(CUdeviceptr *dptr, size_t *size, GLuint buffer);
|
| 417 |
+
|
| 418 |
+
/**
|
| 419 |
+
* \brief Unmaps an OpenGL buffer object
|
| 420 |
+
*
|
| 421 |
+
* \deprecated This function is deprecated as of Cuda 3.0.
|
| 422 |
+
*
|
| 423 |
+
* Unmaps the buffer object specified by \p buffer for access by CUDA.
|
| 424 |
+
*
|
| 425 |
+
* There must be a valid OpenGL context bound to the current thread
|
| 426 |
+
* when this function is called. This must be the same context, or a
|
| 427 |
+
* member of the same shareGroup, as the context that was bound when
|
| 428 |
+
* the buffer was registered.
|
| 429 |
+
*
|
| 430 |
+
* All streams in the current CUDA context are synchronized with the
|
| 431 |
+
* current GL context.
|
| 432 |
+
*
|
| 433 |
+
* \param buffer - Buffer object to unmap
|
| 434 |
+
*
|
| 435 |
+
* \return
|
| 436 |
+
* ::CUDA_SUCCESS,
|
| 437 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 438 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 439 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 440 |
+
* ::CUDA_ERROR_INVALID_VALUE
|
| 441 |
+
* \notefnerr
|
| 442 |
+
*
|
| 443 |
+
* \sa ::cuGraphicsUnmapResources
|
| 444 |
+
*/
|
| 445 |
+
__CUDA_DEPRECATED CUresult CUDAAPI cuGLUnmapBufferObject(GLuint buffer);
|
| 446 |
+
|
| 447 |
+
/**
|
| 448 |
+
* \brief Unregister an OpenGL buffer object
|
| 449 |
+
*
|
| 450 |
+
* \deprecated This function is deprecated as of Cuda 3.0.
|
| 451 |
+
*
|
| 452 |
+
* Unregisters the buffer object specified by \p buffer. This
|
| 453 |
+
* releases any resources associated with the registered buffer.
|
| 454 |
+
* After this call, the buffer may no longer be mapped for access by
|
| 455 |
+
* CUDA.
|
| 456 |
+
*
|
| 457 |
+
* There must be a valid OpenGL context bound to the current thread
|
| 458 |
+
* when this function is called. This must be the same context, or a
|
| 459 |
+
* member of the same shareGroup, as the context that was bound when
|
| 460 |
+
* the buffer was registered.
|
| 461 |
+
*
|
| 462 |
+
* \param buffer - Name of the buffer object to unregister
|
| 463 |
+
*
|
| 464 |
+
* \return
|
| 465 |
+
* ::CUDA_SUCCESS,
|
| 466 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 467 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 468 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 469 |
+
* ::CUDA_ERROR_INVALID_VALUE
|
| 470 |
+
* \notefnerr
|
| 471 |
+
*
|
| 472 |
+
* \sa ::cuGraphicsUnregisterResource
|
| 473 |
+
*/
|
| 474 |
+
__CUDA_DEPRECATED CUresult CUDAAPI cuGLUnregisterBufferObject(GLuint buffer);
|
| 475 |
+
|
| 476 |
+
/**
|
| 477 |
+
* \brief Set the map flags for an OpenGL buffer object
|
| 478 |
+
*
|
| 479 |
+
* \deprecated This function is deprecated as of Cuda 3.0.
|
| 480 |
+
*
|
| 481 |
+
* Sets the map flags for the buffer object specified by \p buffer.
|
| 482 |
+
*
|
| 483 |
+
* Changes to \p Flags will take effect the next time \p buffer is mapped.
|
| 484 |
+
* The \p Flags argument may be any of the following:
|
| 485 |
+
* - ::CU_GL_MAP_RESOURCE_FLAGS_NONE: Specifies no hints about how this
|
| 486 |
+
* resource will be used. It is therefore assumed that this resource will be
|
| 487 |
+
* read from and written to by CUDA kernels. This is the default value.
|
| 488 |
+
* - ::CU_GL_MAP_RESOURCE_FLAGS_READ_ONLY: Specifies that CUDA kernels which
|
| 489 |
+
* access this resource will not write to this resource.
|
| 490 |
+
* - ::CU_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD: Specifies that CUDA kernels
|
| 491 |
+
* which access this resource will not read from this resource and will
|
| 492 |
+
* write over the entire contents of the resource, so none of the data
|
| 493 |
+
* previously stored in the resource will be preserved.
|
| 494 |
+
*
|
| 495 |
+
* If \p buffer has not been registered for use with CUDA, then
|
| 496 |
+
* ::CUDA_ERROR_INVALID_HANDLE is returned. If \p buffer is presently
|
| 497 |
+
* mapped for access by CUDA, then ::CUDA_ERROR_ALREADY_MAPPED is returned.
|
| 498 |
+
*
|
| 499 |
+
* There must be a valid OpenGL context bound to the current thread
|
| 500 |
+
* when this function is called. This must be the same context, or a
|
| 501 |
+
* member of the same shareGroup, as the context that was bound when
|
| 502 |
+
* the buffer was registered.
|
| 503 |
+
*
|
| 504 |
+
* \param buffer - Buffer object to unmap
|
| 505 |
+
* \param Flags - Map flags
|
| 506 |
+
*
|
| 507 |
+
* \return
|
| 508 |
+
* ::CUDA_SUCCESS,
|
| 509 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 510 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 511 |
+
* ::CUDA_ERROR_ALREADY_MAPPED,
|
| 512 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 513 |
+
* \notefnerr
|
| 514 |
+
*
|
| 515 |
+
* \sa ::cuGraphicsResourceSetMapFlags
|
| 516 |
+
*/
|
| 517 |
+
__CUDA_DEPRECATED CUresult CUDAAPI cuGLSetBufferObjectMapFlags(GLuint buffer, unsigned int Flags);
|
| 518 |
+
|
| 519 |
+
/**
|
| 520 |
+
* \brief Maps an OpenGL buffer object
|
| 521 |
+
*
|
| 522 |
+
* \deprecated This function is deprecated as of Cuda 3.0.
|
| 523 |
+
*
|
| 524 |
+
* Maps the buffer object specified by \p buffer into the address space of the
|
| 525 |
+
* current CUDA context and returns in \p *dptr and \p *size the base pointer
|
| 526 |
+
* and size of the resulting mapping.
|
| 527 |
+
*
|
| 528 |
+
* There must be a valid OpenGL context bound to the current thread
|
| 529 |
+
* when this function is called. This must be the same context, or a
|
| 530 |
+
* member of the same shareGroup, as the context that was bound when
|
| 531 |
+
* the buffer was registered.
|
| 532 |
+
*
|
| 533 |
+
* Stream \p hStream in the current CUDA context is synchronized with
|
| 534 |
+
* the current GL context.
|
| 535 |
+
*
|
| 536 |
+
* \param dptr - Returned mapped base pointer
|
| 537 |
+
* \param size - Returned size of mapping
|
| 538 |
+
* \param buffer - The name of the buffer object to map
|
| 539 |
+
* \param hStream - Stream to synchronize
|
| 540 |
+
*
|
| 541 |
+
* \return
|
| 542 |
+
* ::CUDA_SUCCESS,
|
| 543 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 544 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 545 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 546 |
+
* ::CUDA_ERROR_INVALID_VALUE,
|
| 547 |
+
* ::CUDA_ERROR_MAP_FAILED
|
| 548 |
+
* \notefnerr
|
| 549 |
+
*
|
| 550 |
+
* \sa ::cuGraphicsMapResources
|
| 551 |
+
*/
|
| 552 |
+
__CUDA_DEPRECATED CUresult CUDAAPI cuGLMapBufferObjectAsync(CUdeviceptr *dptr, size_t *size, GLuint buffer, CUstream hStream);
|
| 553 |
+
|
| 554 |
+
/**
|
| 555 |
+
* \brief Unmaps an OpenGL buffer object
|
| 556 |
+
*
|
| 557 |
+
* \deprecated This function is deprecated as of Cuda 3.0.
|
| 558 |
+
*
|
| 559 |
+
* Unmaps the buffer object specified by \p buffer for access by CUDA.
|
| 560 |
+
*
|
| 561 |
+
* There must be a valid OpenGL context bound to the current thread
|
| 562 |
+
* when this function is called. This must be the same context, or a
|
| 563 |
+
* member of the same shareGroup, as the context that was bound when
|
| 564 |
+
* the buffer was registered.
|
| 565 |
+
*
|
| 566 |
+
* Stream \p hStream in the current CUDA context is synchronized with
|
| 567 |
+
* the current GL context.
|
| 568 |
+
*
|
| 569 |
+
* \param buffer - Name of the buffer object to unmap
|
| 570 |
+
* \param hStream - Stream to synchronize
|
| 571 |
+
*
|
| 572 |
+
* \return
|
| 573 |
+
* ::CUDA_SUCCESS,
|
| 574 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 575 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 576 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 577 |
+
* ::CUDA_ERROR_INVALID_VALUE
|
| 578 |
+
* \notefnerr
|
| 579 |
+
*
|
| 580 |
+
* \sa ::cuGraphicsUnmapResources
|
| 581 |
+
*/
|
| 582 |
+
__CUDA_DEPRECATED CUresult CUDAAPI cuGLUnmapBufferObjectAsync(GLuint buffer, CUstream hStream);
|
| 583 |
+
|
| 584 |
+
/** @} */ /* END CUDA_GL_DEPRECATED */
|
| 585 |
+
/** @} */ /* END CUDA_GL */
|
| 586 |
+
|
| 587 |
+
|
| 588 |
+
#if defined(__CUDA_API_VERSION_INTERNAL)
|
| 589 |
+
#undef cuGLCtxCreate
|
| 590 |
+
#undef cuGLMapBufferObject
|
| 591 |
+
#undef cuGLMapBufferObjectAsync
|
| 592 |
+
#undef cuGLGetDevices
|
| 593 |
+
|
| 594 |
+
CUresult CUDAAPI cuGLGetDevices(unsigned int *pCudaDeviceCount, CUdevice *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList);
|
| 595 |
+
CUresult CUDAAPI cuGLMapBufferObject_v2(CUdeviceptr *dptr, size_t *size, GLuint buffer);
|
| 596 |
+
CUresult CUDAAPI cuGLMapBufferObjectAsync_v2(CUdeviceptr *dptr, size_t *size, GLuint buffer, CUstream hStream);
|
| 597 |
+
CUresult CUDAAPI cuGLCtxCreate(CUcontext *pCtx, unsigned int Flags, CUdevice device );
|
| 598 |
+
CUresult CUDAAPI cuGLMapBufferObject(CUdeviceptr_v1 *dptr, unsigned int *size, GLuint buffer);
|
| 599 |
+
CUresult CUDAAPI cuGLMapBufferObjectAsync(CUdeviceptr_v1 *dptr, unsigned int *size, GLuint buffer, CUstream hStream);
|
| 600 |
+
#endif /* __CUDA_API_VERSION_INTERNAL */
|
| 601 |
+
|
| 602 |
+
#ifdef __cplusplus
|
| 603 |
+
};
|
| 604 |
+
#endif
|
| 605 |
+
|
| 606 |
+
#undef __CUDA_DEPRECATED
|
| 607 |
+
|
| 608 |
+
#endif
|
lib/python3.11/site-packages/nvidia/cu13/include/cudaGLTypedefs.h
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2020-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef CUDAGLTYPEDEFS_H
|
| 51 |
+
#define CUDAGLTYPEDEFS_H
|
| 52 |
+
|
| 53 |
+
// Dependent includes for cudagl.h
|
| 54 |
+
#include <GL/gl.h>
|
| 55 |
+
|
| 56 |
+
#include <cudaGL.h>
|
| 57 |
+
|
| 58 |
+
#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM)
|
| 59 |
+
#define __API_TYPEDEF_PTDS(api, default_version, ptds_version) api ## _v ## ptds_version ## _ptds
|
| 60 |
+
#define __API_TYPEDEF_PTSZ(api, default_version, ptds_version) api ## _v ## ptds_version ## _ptsz
|
| 61 |
+
#else
|
| 62 |
+
#define __API_TYPEDEF_PTDS(api, default_version, ptds_version) api ## _v ## default_version
|
| 63 |
+
#define __API_TYPEDEF_PTSZ(api, default_version, ptds_version) api ## _v ## default_version
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
#ifdef __cplusplus
|
| 67 |
+
extern "C" {
|
| 68 |
+
#endif // __cplusplus
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Type definitions for functions defined in cudaGL.h
|
| 72 |
+
*/
|
| 73 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsGLRegisterBuffer_v3000)(CUgraphicsResource *pCudaResource, GLuint buffer, unsigned int Flags);
|
| 74 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsGLRegisterImage_v3000)(CUgraphicsResource *pCudaResource, GLuint image, GLenum target, unsigned int Flags);
|
| 75 |
+
#ifdef _WIN32
|
| 76 |
+
typedef CUresult (CUDAAPI *PFN_cuWGLGetDevice_v2020)(CUdevice_v1 *pDevice, HGPUNV hGpu);
|
| 77 |
+
#endif
|
| 78 |
+
typedef CUresult (CUDAAPI *PFN_cuGLGetDevices_v6050)(unsigned int *pCudaDeviceCount, CUdevice_v1 *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList);
|
| 79 |
+
typedef CUresult (CUDAAPI *PFN_cuGLCtxCreate_v3020)(CUcontext *pCtx, unsigned int Flags, CUdevice_v1 device);
|
| 80 |
+
typedef CUresult (CUDAAPI *PFN_cuGLInit_v2000)(void);
|
| 81 |
+
typedef CUresult (CUDAAPI *PFN_cuGLRegisterBufferObject_v2000)(GLuint buffer);
|
| 82 |
+
typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObject_v7000_ptds)(CUdeviceptr_v2 *dptr, size_t *size, GLuint buffer);
|
| 83 |
+
typedef CUresult (CUDAAPI *PFN_cuGLUnmapBufferObject_v2000)(GLuint buffer);
|
| 84 |
+
typedef CUresult (CUDAAPI *PFN_cuGLUnregisterBufferObject_v2000)(GLuint buffer);
|
| 85 |
+
typedef CUresult (CUDAAPI *PFN_cuGLSetBufferObjectMapFlags_v2030)(GLuint buffer, unsigned int Flags);
|
| 86 |
+
typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObjectAsync_v7000_ptsz)(CUdeviceptr_v2 *dptr, size_t *size, GLuint buffer, CUstream hStream);
|
| 87 |
+
typedef CUresult (CUDAAPI *PFN_cuGLUnmapBufferObjectAsync_v2030)(GLuint buffer, CUstream hStream);
|
| 88 |
+
typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObject_v3020)(CUdeviceptr_v2 *dptr, size_t *size, GLuint buffer);
|
| 89 |
+
typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObjectAsync_v3020)(CUdeviceptr_v2 *dptr, size_t *size, GLuint buffer, CUstream hStream);
|
| 90 |
+
|
| 91 |
+
/*
|
| 92 |
+
* Type definitions for older versioned functions in cuda.h
|
| 93 |
+
*/
|
| 94 |
+
#if defined(__CUDA_API_VERSION_INTERNAL)
|
| 95 |
+
typedef CUresult (CUDAAPI *PFN_cuGLGetDevices_v4010)(unsigned int *pCudaDeviceCount, CUdevice_v1 *pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList);
|
| 96 |
+
typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObject_v2000)(CUdeviceptr_v1 *dptr, unsigned int *size, GLuint buffer);
|
| 97 |
+
typedef CUresult (CUDAAPI *PFN_cuGLMapBufferObjectAsync_v2030)(CUdeviceptr_v1 *dptr, unsigned int *size, GLuint buffer, CUstream hStream);
|
| 98 |
+
typedef CUresult (CUDAAPI *PFN_cuGLCtxCreate_v2000)(CUcontext *pCtx, unsigned int Flags, CUdevice_v1 device);
|
| 99 |
+
#endif
|
| 100 |
+
|
| 101 |
+
#ifdef __cplusplus
|
| 102 |
+
}
|
| 103 |
+
#endif // __cplusplus
|
| 104 |
+
|
| 105 |
+
#endif // file guard
|
lib/python3.11/site-packages/nvidia/cu13/include/cudaProfilerTypedefs.h
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2020-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef CUDAPROFILERTYPEDEFS_H
|
| 51 |
+
#define CUDAPROFILERTYPEDEFS_H
|
| 52 |
+
|
| 53 |
+
#include <cudaProfiler.h>
|
| 54 |
+
|
| 55 |
+
#ifdef __cplusplus
|
| 56 |
+
extern "C" {
|
| 57 |
+
#endif // __cplusplus
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Type definitions for functions defined in cudaProfiler.h
|
| 61 |
+
*/
|
| 62 |
+
typedef CUresult (CUDAAPI *PFN_cuProfilerInitialize_v4000)(const char *configFile, const char *outputFile, CUoutput_mode outputMode);
|
| 63 |
+
typedef CUresult (CUDAAPI *PFN_cuProfilerStart_v4000)(void);
|
| 64 |
+
typedef CUresult (CUDAAPI *PFN_cuProfilerStop_v4000)(void);
|
| 65 |
+
|
| 66 |
+
#ifdef __cplusplus
|
| 67 |
+
}
|
| 68 |
+
#endif // __cplusplus
|
| 69 |
+
|
| 70 |
+
#endif // file guard
|
lib/python3.11/site-packages/nvidia/cu13/include/cudaTypedefs.h
ADDED
|
@@ -0,0 +1,715 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2020-2022 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef CUDATYPEDEFS_H
|
| 51 |
+
#define CUDATYPEDEFS_H
|
| 52 |
+
|
| 53 |
+
#include <cuda.h>
|
| 54 |
+
|
| 55 |
+
#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM)
|
| 56 |
+
#define __API_TYPEDEF_PTDS(api, default_version, ptds_version) api ## _v ## ptds_version ## _ptds
|
| 57 |
+
#define __API_TYPEDEF_PTSZ(api, default_version, ptds_version) api ## _v ## ptds_version ## _ptsz
|
| 58 |
+
#else
|
| 59 |
+
#define __API_TYPEDEF_PTDS(api, default_version, ptds_version) api ## _v ## default_version
|
| 60 |
+
#define __API_TYPEDEF_PTSZ(api, default_version, ptds_version) api ## _v ## default_version
|
| 61 |
+
#endif
|
| 62 |
+
|
| 63 |
+
#ifdef __cplusplus
|
| 64 |
+
extern "C" {
|
| 65 |
+
#endif // __cplusplus
|
| 66 |
+
|
| 67 |
+
/*
|
| 68 |
+
* Type definitions for functions defined in cuda.h
|
| 69 |
+
*/
|
| 70 |
+
typedef CUresult (CUDAAPI *PFN_cuGetErrorString_v6000)(CUresult error, const char **pStr);
|
| 71 |
+
typedef CUresult (CUDAAPI *PFN_cuGetErrorName_v6000)(CUresult error, const char **pStr);
|
| 72 |
+
typedef CUresult (CUDAAPI *PFN_cuInit_v2000)(unsigned int Flags);
|
| 73 |
+
typedef CUresult (CUDAAPI *PFN_cuDriverGetVersion_v2020)(int *driverVersion);
|
| 74 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGet_v2000)(CUdevice_v1 *device, int ordinal);
|
| 75 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetCount_v2000)(int *count);
|
| 76 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetName_v2000)(char *name, int len, CUdevice_v1 dev);
|
| 77 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetUuid_v9020)(CUuuid *uuid, CUdevice_v1 dev);
|
| 78 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetUuid_v11040)(CUuuid *uuid, CUdevice_v1 dev);
|
| 79 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetLuid_v10000)(char *luid, unsigned int *deviceNodeMask, CUdevice_v1 dev);
|
| 80 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceTotalMem_v3020)(size_t *bytes, CUdevice_v1 dev);
|
| 81 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetTexture1DLinearMaxWidth_v11010)(size_t *maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice_v1 dev);
|
| 82 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetAttribute_v2000)(int *pi, CUdevice_attribute attrib, CUdevice_v1 dev);
|
| 83 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetHostAtomicCapabilities_v13000)(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice dev);
|
| 84 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetNvSciSyncAttributes_v10020)(void *nvSciSyncAttrList, CUdevice_v1 dev, int flags);
|
| 85 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceSetMemPool_v11020)(CUdevice_v1 dev, CUmemoryPool pool);
|
| 86 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetMemPool_v11020)(CUmemoryPool *pool, CUdevice_v1 dev);
|
| 87 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetDefaultMemPool_v11020)(CUmemoryPool *pool_out, CUdevice_v1 dev);
|
| 88 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetProperties_v2000)(CUdevprop_v1 *prop, CUdevice_v1 dev);
|
| 89 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceComputeCapability_v2000)(int *major, int *minor, CUdevice_v1 dev);
|
| 90 |
+
typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxRetain_v7000)(CUcontext *pctx, CUdevice_v1 dev);
|
| 91 |
+
typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxRelease_v11000)(CUdevice_v1 dev);
|
| 92 |
+
typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxSetFlags_v11000)(CUdevice_v1 dev, unsigned int flags);
|
| 93 |
+
typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxGetState_v7000)(CUdevice_v1 dev, unsigned int *flags, int *active);
|
| 94 |
+
typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxReset_v11000)(CUdevice_v1 dev);
|
| 95 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetExecAffinitySupport_v11040)(int *pi, CUexecAffinityType type, CUdevice dev);
|
| 96 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxCreate_v3020)(CUcontext *pctx, unsigned int flags, CUdevice_v1 dev);
|
| 97 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxCreate_v11040)(CUcontext *pctx, CUexecAffinityParam *paramsArray, int numParams, unsigned int flags, CUdevice_v1 dev);
|
| 98 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxCreate_v12050)(CUcontext *pctx, CUctxCreateParams *ctxCreateParams, unsigned int flags, CUdevice dev);
|
| 99 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetId_v12000)(CUcontext ctx, unsigned long long *ctxId);
|
| 100 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxDestroy_v4000)(CUcontext ctx);
|
| 101 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxPushCurrent_v4000)(CUcontext ctx);
|
| 102 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxPopCurrent_v4000)(CUcontext *pctx);
|
| 103 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxSetCurrent_v4000)(CUcontext ctx);
|
| 104 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetCurrent_v4000)(CUcontext *pctx);
|
| 105 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetDevice_v2000)(CUdevice_v1 *device);
|
| 106 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetDevice_v13000)(CUdevice *device, CUcontext ctx);
|
| 107 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetFlags_v7000)(unsigned int *flags);
|
| 108 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxSetFlags_v12010)(unsigned int flags);
|
| 109 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxSynchronize_v2000)(void);
|
| 110 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxSynchronize_v13000)(CUcontext ctx);
|
| 111 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxSetLimit_v3010)(CUlimit limit, size_t value);
|
| 112 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetLimit_v3010)(size_t *pvalue, CUlimit limit);
|
| 113 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetCacheConfig_v3020)(CUfunc_cache *pconfig);
|
| 114 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxSetCacheConfig_v3020)(CUfunc_cache config);
|
| 115 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetSharedMemConfig_v4020)(CUsharedconfig *pConfig);
|
| 116 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxSetSharedMemConfig_v4020)(CUsharedconfig config);
|
| 117 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetApiVersion_v3020)(CUcontext ctx, unsigned int *version);
|
| 118 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetStreamPriorityRange_v5050)(int *leastPriority, int *greatestPriority);
|
| 119 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxResetPersistingL2Cache_v11000)(void);
|
| 120 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxAttach_v2000)(CUcontext *pctx, unsigned int flags);
|
| 121 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxDetach_v2000)(CUcontext ctx);
|
| 122 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxGetExecAffinity_v11040)(CUexecAffinityParam *pExecAffinity, CUexecAffinityType type);
|
| 123 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleLoad_v2000)(CUmodule *module, const char *fname);
|
| 124 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleLoadData_v2000)(CUmodule *module, const void *image);
|
| 125 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleLoadDataEx_v2010)(CUmodule *module, const void *image, unsigned int numOptions, CUjit_option *options, void **optionValues);
|
| 126 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleLoadFatBinary_v2000)(CUmodule *module, const void *fatCubin);
|
| 127 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleUnload_v2000)(CUmodule hmod);
|
| 128 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleGetFunction_v2000)(CUfunction *hfunc, CUmodule hmod, const char *name);
|
| 129 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleGetGlobal_v3020)(CUdeviceptr_v2 *dptr, size_t *bytes, CUmodule hmod, const char *name);
|
| 130 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleGetTexRef_v2000)(CUtexref *pTexRef, CUmodule hmod, const char *name);
|
| 131 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleGetSurfRef_v3000)(CUsurfref *pSurfRef, CUmodule hmod, const char *name);
|
| 132 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleGetFunctionCount_v12040)(unsigned int *count, CUmodule hmod);
|
| 133 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleEnumerateFunctions_v12040)(CUfunction *functions, unsigned int numFunctions, CUmodule mod);
|
| 134 |
+
typedef CUresult (CUDAAPI *PFN_cuLinkCreate_v6050)(unsigned int numOptions, CUjit_option *options, void **optionValues, CUlinkState *stateOut);
|
| 135 |
+
typedef CUresult (CUDAAPI *PFN_cuLinkAddData_v6050)(CUlinkState state, CUjitInputType type, void *data, size_t size, const char *name, unsigned int numOptions, CUjit_option *options, void **optionValues);
|
| 136 |
+
typedef CUresult (CUDAAPI *PFN_cuLinkAddFile_v6050)(CUlinkState state, CUjitInputType type, const char *path, unsigned int numOptions, CUjit_option *options, void **optionValues);
|
| 137 |
+
typedef CUresult (CUDAAPI *PFN_cuLinkComplete_v5050)(CUlinkState state, void **cubinOut, size_t *sizeOut);
|
| 138 |
+
typedef CUresult (CUDAAPI *PFN_cuLinkDestroy_v5050)(CUlinkState state);
|
| 139 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetInfo_v3020)(size_t *free, size_t *total);
|
| 140 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAlloc_v3020)(CUdeviceptr_v2 *dptr, size_t bytesize);
|
| 141 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAllocPitch_v3020)(CUdeviceptr_v2 *dptr, size_t *pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes);
|
| 142 |
+
typedef CUresult (CUDAAPI *PFN_cuMemFree_v3020)(CUdeviceptr_v2 dptr);
|
| 143 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetAddressRange_v3020)(CUdeviceptr_v2 *pbase, size_t *psize, CUdeviceptr_v2 dptr);
|
| 144 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAllocHost_v3020)(void **pp, size_t bytesize);
|
| 145 |
+
typedef CUresult (CUDAAPI *PFN_cuMemFreeHost_v2000)(void *p);
|
| 146 |
+
typedef CUresult (CUDAAPI *PFN_cuMemHostAlloc_v2020)(void **pp, size_t bytesize, unsigned int Flags);
|
| 147 |
+
typedef CUresult (CUDAAPI *PFN_cuMemHostGetDevicePointer_v3020)(CUdeviceptr_v2 *pdptr, void *p, unsigned int Flags);
|
| 148 |
+
typedef CUresult (CUDAAPI *PFN_cuMemHostGetFlags_v2030)(unsigned int *pFlags, void *p);
|
| 149 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAllocManaged_v6000)(CUdeviceptr_v2 *dptr, size_t bytesize, unsigned int flags);
|
| 150 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetByPCIBusId_v4010)(CUdevice_v1 *dev, const char *pciBusId);
|
| 151 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetPCIBusId_v4010)(char *pciBusId, int len, CUdevice_v1 dev);
|
| 152 |
+
typedef CUresult (CUDAAPI *PFN_cuIpcGetEventHandle_v4010)(CUipcEventHandle_v1 *pHandle, CUevent event);
|
| 153 |
+
typedef CUresult (CUDAAPI *PFN_cuIpcOpenEventHandle_v4010)(CUevent *phEvent, CUipcEventHandle_v1 handle);
|
| 154 |
+
typedef CUresult (CUDAAPI *PFN_cuIpcGetMemHandle_v4010)(CUipcMemHandle_v1 *pHandle, CUdeviceptr_v2 dptr);
|
| 155 |
+
typedef CUresult (CUDAAPI *PFN_cuIpcOpenMemHandle_v11000)(CUdeviceptr_v2 *pdptr, CUipcMemHandle_v1 handle, unsigned int Flags);
|
| 156 |
+
typedef CUresult (CUDAAPI *PFN_cuIpcCloseMemHandle_v4010)(CUdeviceptr_v2 dptr);
|
| 157 |
+
typedef CUresult (CUDAAPI *PFN_cuMemHostRegister_v6050)(void *p, size_t bytesize, unsigned int Flags);
|
| 158 |
+
typedef CUresult (CUDAAPI *PFN_cuMemHostUnregister_v4000)(void *p);
|
| 159 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy_v7000_ptds)(CUdeviceptr_v2 dst, CUdeviceptr_v2 src, size_t ByteCount);
|
| 160 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyPeer_v7000_ptds)(CUdeviceptr_v2 dstDevice, CUcontext dstContext, CUdeviceptr_v2 srcDevice, CUcontext srcContext, size_t ByteCount);
|
| 161 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoD_v7000_ptds)(CUdeviceptr_v2 dstDevice, const void *srcHost, size_t ByteCount);
|
| 162 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoH_v7000_ptds)(void *dstHost, CUdeviceptr_v2 srcDevice, size_t ByteCount);
|
| 163 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoD_v7000_ptds)(CUdeviceptr_v2 dstDevice, CUdeviceptr_v2 srcDevice, size_t ByteCount);
|
| 164 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoA_v7000_ptds)(CUarray dstArray, size_t dstOffset, CUdeviceptr_v2 srcDevice, size_t ByteCount);
|
| 165 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoD_v7000_ptds)(CUdeviceptr_v2 dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount);
|
| 166 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoA_v7000_ptds)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount);
|
| 167 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoH_v7000_ptds)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount);
|
| 168 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoA_v7000_ptds)(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount);
|
| 169 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy2D_v7000_ptds)(const CUDA_MEMCPY2D_v2 *pCopy);
|
| 170 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy2DUnaligned_v7000_ptds)(const CUDA_MEMCPY2D_v2 *pCopy);
|
| 171 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3D_v7000_ptds)(const CUDA_MEMCPY3D_v2 *pCopy);
|
| 172 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DPeer_v7000_ptds)(const CUDA_MEMCPY3D_PEER_v1 *pCopy);
|
| 173 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAsync_v7000_ptsz)(CUdeviceptr_v2 dst, CUdeviceptr_v2 src, size_t ByteCount, CUstream hStream);
|
| 174 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyPeerAsync_v7000_ptsz)(CUdeviceptr_v2 dstDevice, CUcontext dstContext, CUdeviceptr_v2 srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream);
|
| 175 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoDAsync_v7000_ptsz)(CUdeviceptr_v2 dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream);
|
| 176 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoHAsync_v7000_ptsz)(void *dstHost, CUdeviceptr_v2 srcDevice, size_t ByteCount, CUstream hStream);
|
| 177 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoDAsync_v7000_ptsz)(CUdeviceptr_v2 dstDevice, CUdeviceptr_v2 srcDevice, size_t ByteCount, CUstream hStream);
|
| 178 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoAAsync_v7000_ptsz)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount, CUstream hStream);
|
| 179 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoHAsync_v7000_ptsz)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream);
|
| 180 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy2DAsync_v7000_ptsz)(const CUDA_MEMCPY2D_v2 *pCopy, CUstream hStream);
|
| 181 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DAsync_v7000_ptsz)(const CUDA_MEMCPY3D_v2 *pCopy, CUstream hStream);
|
| 182 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DPeerAsync_v7000_ptsz)(const CUDA_MEMCPY3D_PEER_v1 *pCopy, CUstream hStream);
|
| 183 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyBatchAsync_v12080_ptsz)(CUdeviceptr_v2 *dsts, CUdeviceptr_v2 *srcs, size_t *sizes, size_t count, CUmemcpyAttributes_v1 *attrs, size_t *attrIdxs, size_t numAttrs, size_t *failIdx, CUstream hStream);
|
| 184 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DBatchAsync_v12080_ptsz)(size_t numParams, CUDA_MEMCPY3D_BATCH_OP_v1 *opList, size_t *failIdx, unsigned long long flags, CUstream hStream);
|
| 185 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyBatchAsync_v13000_ptsz)(CUdeviceptr_v2 *dsts, CUdeviceptr_v2 *srcs, size_t *sizes, size_t count, CUmemcpyAttributes_v1 *attrs, size_t *attrIdxs, size_t numAttrs, CUstream hStream);
|
| 186 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DBatchAsync_v13000_ptsz)(size_t numParams, CUDA_MEMCPY3D_BATCH_OP_v1 *opList, unsigned long long flags, CUstream hStream);
|
| 187 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD8_v7000_ptds)(CUdeviceptr_v2 dstDevice, unsigned char uc, size_t N);
|
| 188 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD16_v7000_ptds)(CUdeviceptr_v2 dstDevice, unsigned short us, size_t N);
|
| 189 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD32_v7000_ptds)(CUdeviceptr_v2 dstDevice, unsigned int ui, size_t N);
|
| 190 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8_v7000_ptds)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height);
|
| 191 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16_v7000_ptds)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height);
|
| 192 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32_v7000_ptds)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height);
|
| 193 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD8Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, unsigned char uc, size_t N, CUstream hStream);
|
| 194 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD16Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, unsigned short us, size_t N, CUstream hStream);
|
| 195 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD32Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, unsigned int ui, size_t N, CUstream hStream);
|
| 196 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream);
|
| 197 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream);
|
| 198 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32Async_v7000_ptsz)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream);
|
| 199 |
+
typedef CUresult (CUDAAPI *PFN_cuArrayCreate_v3020)(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR_v2 *pAllocateArray);
|
| 200 |
+
typedef CUresult (CUDAAPI *PFN_cuArrayGetDescriptor_v3020)(CUDA_ARRAY_DESCRIPTOR_v2 *pArrayDescriptor, CUarray hArray);
|
| 201 |
+
typedef CUresult (CUDAAPI *PFN_cuArrayGetSparseProperties_v11010)(CUDA_ARRAY_SPARSE_PROPERTIES_v1 *sparseProperties, CUarray array);
|
| 202 |
+
typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayGetSparseProperties_v11010)(CUDA_ARRAY_SPARSE_PROPERTIES_v1 *sparseProperties, CUmipmappedArray mipmap);
|
| 203 |
+
typedef CUresult (CUDAAPI *PFN_cuArrayGetMemoryRequirements_v11060)(CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 *memoryRequirements, CUarray array, CUdevice device);
|
| 204 |
+
typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayGetMemoryRequirements_v11060)(CUDA_ARRAY_MEMORY_REQUIREMENTS_v1 *memoryRequirements, CUmipmappedArray mipmap, CUdevice device);
|
| 205 |
+
typedef CUresult (CUDAAPI *PFN_cuArrayGetPlane_v11020)(CUarray *pPlaneArray, CUarray hArray, unsigned int planeIdx);
|
| 206 |
+
typedef CUresult (CUDAAPI *PFN_cuArrayDestroy_v2000)(CUarray hArray);
|
| 207 |
+
typedef CUresult (CUDAAPI *PFN_cuArray3DCreate_v3020)(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR_v2 *pAllocateArray);
|
| 208 |
+
typedef CUresult (CUDAAPI *PFN_cuArray3DGetDescriptor_v3020)(CUDA_ARRAY3D_DESCRIPTOR_v2 *pArrayDescriptor, CUarray hArray);
|
| 209 |
+
typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayCreate_v5000)(CUmipmappedArray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR_v2 *pMipmappedArrayDesc, unsigned int numMipmapLevels);
|
| 210 |
+
typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayGetLevel_v5000)(CUarray *pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level);
|
| 211 |
+
typedef CUresult (CUDAAPI *PFN_cuMipmappedArrayDestroy_v5000)(CUmipmappedArray hMipmappedArray);
|
| 212 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAddressReserve_v10020)(CUdeviceptr_v2 *ptr, size_t size, size_t alignment, CUdeviceptr_v2 addr, unsigned long long flags);
|
| 213 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAddressFree_v10020)(CUdeviceptr_v2 ptr, size_t size);
|
| 214 |
+
typedef CUresult (CUDAAPI *PFN_cuMemCreate_v10020)(CUmemGenericAllocationHandle_v1 *handle, size_t size, const CUmemAllocationProp_v1 *prop, unsigned long long flags);
|
| 215 |
+
typedef CUresult (CUDAAPI *PFN_cuMemRelease_v10020)(CUmemGenericAllocationHandle_v1 handle);
|
| 216 |
+
typedef CUresult (CUDAAPI *PFN_cuMemMap_v10020)(CUdeviceptr_v2 ptr, size_t size, size_t offset, CUmemGenericAllocationHandle_v1 handle, unsigned long long flags);
|
| 217 |
+
typedef CUresult (CUDAAPI *PFN_cuMemMapArrayAsync_v11010_ptsz)(CUarrayMapInfo_v1 *mapInfoList, unsigned int count, CUstream hStream);
|
| 218 |
+
typedef CUresult (CUDAAPI *PFN_cuMemUnmap_v10020)(CUdeviceptr_v2 ptr, size_t size);
|
| 219 |
+
typedef CUresult (CUDAAPI *PFN_cuMemSetAccess_v10020)(CUdeviceptr_v2 ptr, size_t size, const CUmemAccessDesc_v1 *desc, size_t count);
|
| 220 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetAccess_v10020)(unsigned long long *flags, const CUmemLocation_v1 *location, CUdeviceptr_v2 ptr);
|
| 221 |
+
typedef CUresult (CUDAAPI *PFN_cuMemExportToShareableHandle_v10020)(void *shareableHandle, CUmemGenericAllocationHandle_v1 handle, CUmemAllocationHandleType handleType, unsigned long long flags);
|
| 222 |
+
typedef CUresult (CUDAAPI *PFN_cuMemImportFromShareableHandle_v10020)(CUmemGenericAllocationHandle_v1 *handle, void *osHandle, CUmemAllocationHandleType shHandleType);
|
| 223 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetAllocationGranularity_v10020)(size_t *granularity, const CUmemAllocationProp_v1 *prop, CUmemAllocationGranularity_flags option);
|
| 224 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetAllocationPropertiesFromHandle_v10020)(CUmemAllocationProp_v1 *prop, CUmemGenericAllocationHandle_v1 handle);
|
| 225 |
+
typedef CUresult (CUDAAPI *PFN_cuMemRetainAllocationHandle_v11000)(CUmemGenericAllocationHandle_v1 *handle, void *addr);
|
| 226 |
+
typedef CUresult (CUDAAPI *PFN_cuMemFreeAsync_v11020_ptsz)(CUdeviceptr_v2 dptr, CUstream hStream);
|
| 227 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAllocAsync_v11020_ptsz)(CUdeviceptr_v2 *dptr, size_t bytesize, CUstream hStream);
|
| 228 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolTrimTo_v11020)(CUmemoryPool pool, size_t minBytesToKeep);
|
| 229 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolSetAttribute_v11020)(CUmemoryPool pool, CUmemPool_attribute attr, void *value);
|
| 230 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolGetAttribute_v11020)(CUmemoryPool pool, CUmemPool_attribute attr, void *value);
|
| 231 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolSetAccess_v11020)(CUmemoryPool pool, const CUmemAccessDesc_v1 *map, size_t count);
|
| 232 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolGetAccess_v11020)(CUmemAccess_flags *flags, CUmemoryPool memPool, CUmemLocation_v1 *location);
|
| 233 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolCreate_v11020)(CUmemoryPool *pool, const CUmemPoolProps_v1 *poolProps);
|
| 234 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolDestroy_v11020)(CUmemoryPool pool);
|
| 235 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetDefaultMemPool_v13000)(CUmemoryPool *pool_out, CUmemLocation *location, CUmemAllocationType type);
|
| 236 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetMemPool_v13000)(CUmemoryPool *pool_out, CUmemLocation *location, CUmemAllocationType type);
|
| 237 |
+
typedef CUresult (CUDAAPI *PFN_cuMemSetMemPool_v13000)(CUmemLocation *location, CUmemAllocationType type, CUmemoryPool pool);
|
| 238 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAllocFromPoolAsync_v11020_ptsz)(CUdeviceptr_v2 *dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream);
|
| 239 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolExportToShareableHandle_v11020)(void *handle_out, CUmemoryPool pool, CUmemAllocationHandleType handleType, unsigned long long flags);
|
| 240 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolImportFromShareableHandle_v11020)(CUmemoryPool *pool_out, void *handle, CUmemAllocationHandleType handleType, unsigned long long flags);
|
| 241 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolExportPointer_v11020)(CUmemPoolPtrExportData_v1 *shareData_out, CUdeviceptr_v2 ptr);
|
| 242 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPoolImportPointer_v11020)(CUdeviceptr_v2 *ptr_out, CUmemoryPool pool, CUmemPoolPtrExportData_v1 *shareData);
|
| 243 |
+
typedef CUresult (CUDAAPI *PFN_cuPointerGetAttribute_v4000)(void *data, CUpointer_attribute attribute, CUdeviceptr_v2 ptr);
|
| 244 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPrefetchAsync_v8000_ptsz)(CUdeviceptr_v2 devPtr, size_t count, CUdevice_v1 dstDevice, CUstream hStream);
|
| 245 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAdvise_v8000)(CUdeviceptr_v2 devPtr, size_t count, CUmem_advise advice, CUdevice_v1 device);
|
| 246 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAdvise_v12020)(CUdeviceptr_v2 devPtr, size_t count, CUmem_advise advice, CUmemLocation_v1 location);
|
| 247 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPrefetchAsync_v12020_ptsz)(CUdeviceptr_v2 devPtr, size_t count, CUmemLocation_v1 location, unsigned int flags, CUstream hStream);
|
| 248 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPrefetchBatchAsync_v13000_ptsz)(CUdeviceptr_v2 *dptrs, size_t *sizes, size_t count, CUmemLocation_v1 *prefetchLocs, size_t *prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream);
|
| 249 |
+
typedef CUresult (CUDAAPI *PFN_cuMemDiscardBatchAsync_v13000_ptsz)(CUdeviceptr_v2 *dptrs, size_t *sizes, size_t count, unsigned long long flags, CUstream hStream);
|
| 250 |
+
typedef CUresult (CUDAAPI *PFN_cuMemDiscardAndPrefetchBatchAsync_v13000_ptsz)(CUdeviceptr_v2 *dptrs, size_t *sizes, size_t count, CUmemLocation_v1 *prefetchLocs, size_t *prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream);
|
| 251 |
+
typedef CUresult (CUDAAPI *PFN_cuMemRangeGetAttribute_v8000)(void *data, size_t dataSize, CUmem_range_attribute attribute, CUdeviceptr_v2 devPtr, size_t count);
|
| 252 |
+
typedef CUresult (CUDAAPI *PFN_cuMemRangeGetAttributes_v8000)(void **data, size_t *dataSizes, CUmem_range_attribute *attributes, size_t numAttributes, CUdeviceptr_v2 devPtr, size_t count);
|
| 253 |
+
typedef CUresult (CUDAAPI *PFN_cuMulticastCreate_v12010)(CUmemGenericAllocationHandle *mcHandle, const CUmulticastObjectProp *prop);
|
| 254 |
+
typedef CUresult (CUDAAPI *PFN_cuMulticastAddDevice_v12010)(CUmemGenericAllocationHandle mcHandle, CUdevice dev);
|
| 255 |
+
typedef CUresult (CUDAAPI *PFN_cuMulticastBindMem_v12010)(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUmemGenericAllocationHandle memHandle, size_t memOffset, size_t size, unsigned long long flags);
|
| 256 |
+
typedef CUresult (CUDAAPI *PFN_cuMulticastBindAddr_v12010)(CUmemGenericAllocationHandle mcHandle, size_t mcOffset, CUdeviceptr memptr, size_t size, unsigned long long flags);
|
| 257 |
+
typedef CUresult (CUDAAPI *PFN_cuMulticastUnbind_v12010)(CUmemGenericAllocationHandle mcHandle, CUdevice dev, size_t mcOffset, size_t size);
|
| 258 |
+
typedef CUresult (CUDAAPI *PFN_cuMulticastGetGranularity_v12010)(size_t *granularity, const CUmulticastObjectProp *prop, CUmulticastGranularity_flags option);
|
| 259 |
+
typedef CUresult (CUDAAPI *PFN_cuPointerSetAttribute_v6000)(const void *value, CUpointer_attribute attribute, CUdeviceptr_v2 ptr);
|
| 260 |
+
typedef CUresult (CUDAAPI *PFN_cuPointerGetAttributes_v7000)(unsigned int numAttributes, CUpointer_attribute *attributes, void **data, CUdeviceptr_v2 ptr);
|
| 261 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamCreate_v2000)(CUstream *phStream, unsigned int Flags);
|
| 262 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamCreateWithPriority_v5050)(CUstream *phStream, unsigned int flags, int priority);
|
| 263 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetId_v12000)(CUstream hStream, unsigned long long *streamId);
|
| 264 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetId_v12000_ptsz)(CUstream hStream, unsigned long long *streamId);
|
| 265 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetPriority_v7000_ptsz)(CUstream hStream, int *priority);
|
| 266 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetFlags_v7000_ptsz)(CUstream hStream, unsigned int *flags);
|
| 267 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCtx_v9020_ptsz)(CUstream hStream, CUcontext *pctx);
|
| 268 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitEvent_v7000_ptsz)(CUstream hStream, CUevent hEvent, unsigned int Flags);
|
| 269 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamAddCallback_v7000_ptsz)(CUstream hStream, CUstreamCallback callback, void *userData, unsigned int flags);
|
| 270 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBeginCapture_v10010_ptsz)(CUstream hStream, CUstreamCaptureMode mode);
|
| 271 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBeginCaptureToGraph_v12030_ptsz)(CUstream hStream, CUgraph hGraph, const CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, CUstreamCaptureMode mode);
|
| 272 |
+
typedef CUresult (CUDAAPI *PFN_cuThreadExchangeStreamCaptureMode_v10010)(CUstreamCaptureMode *mode);
|
| 273 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamEndCapture_v10000_ptsz)(CUstream hStream, CUgraph *phGraph);
|
| 274 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamIsCapturing_v10000_ptsz)(CUstream hStream, CUstreamCaptureStatus *captureStatus);
|
| 275 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v10010_ptsz)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out);
|
| 276 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v11030_ptsz)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, size_t *numDependencies_out);
|
| 277 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v12030_ptsz)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, const CUgraphEdgeData **edgeData_out, size_t *numDependencies_out);
|
| 278 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamUpdateCaptureDependencies_v11030_ptsz)(CUstream hStream, CUgraphNode *dependencies, size_t numDependencies, unsigned int flags);
|
| 279 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamUpdateCaptureDependencies_v12030_ptsz)(CUstream hStream, CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, unsigned int flags);
|
| 280 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamAttachMemAsync_v7000_ptsz)(CUstream hStream, CUdeviceptr_v2 dptr, size_t length, unsigned int flags);
|
| 281 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamQuery_v7000_ptsz)(CUstream hStream);
|
| 282 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamSynchronize_v7000_ptsz)(CUstream hStream);
|
| 283 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamDestroy_v4000)(CUstream hStream);
|
| 284 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamCopyAttributes_v11000_ptsz)(CUstream dst, CUstream src);
|
| 285 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetAttribute_v11000_ptsz)(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue_v1 *value_out);
|
| 286 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamSetAttribute_v11000_ptsz)(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue_v1 *value);
|
| 287 |
+
typedef CUresult (CUDAAPI *PFN_cuEventCreate_v2000)(CUevent *phEvent, unsigned int Flags);
|
| 288 |
+
typedef CUresult (CUDAAPI *PFN_cuEventRecord_v7000_ptsz)(CUevent hEvent, CUstream hStream);
|
| 289 |
+
typedef CUresult (CUDAAPI *PFN_cuEventRecordWithFlags_v11010_ptsz)(CUevent hEvent, CUstream hStream, unsigned int flags);
|
| 290 |
+
typedef CUresult (CUDAAPI *PFN_cuEventQuery_v2000)(CUevent hEvent);
|
| 291 |
+
typedef CUresult (CUDAAPI *PFN_cuEventSynchronize_v2000)(CUevent hEvent);
|
| 292 |
+
typedef CUresult (CUDAAPI *PFN_cuEventDestroy_v4000)(CUevent hEvent);
|
| 293 |
+
typedef CUresult (CUDAAPI *PFN_cuEventElapsedTime_v2000)(float *pMilliseconds, CUevent hStart, CUevent hEnd);
|
| 294 |
+
typedef CUresult (CUDAAPI *PFN_cuEventElapsedTime_v12080)(float *pMilliseconds, CUevent hStart, CUevent hEnd);
|
| 295 |
+
typedef CUresult (CUDAAPI *PFN_cuImportExternalMemory_v10000)(CUexternalMemory *extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC_v1 *memHandleDesc);
|
| 296 |
+
typedef CUresult (CUDAAPI *PFN_cuExternalMemoryGetMappedBuffer_v10000)(CUdeviceptr_v2 *devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC_v1 *bufferDesc);
|
| 297 |
+
typedef CUresult (CUDAAPI *PFN_cuExternalMemoryGetMappedMipmappedArray_v10000)(CUmipmappedArray *mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 *mipmapDesc);
|
| 298 |
+
typedef CUresult (CUDAAPI *PFN_cuDestroyExternalMemory_v10000)(CUexternalMemory extMem);
|
| 299 |
+
typedef CUresult (CUDAAPI *PFN_cuImportExternalSemaphore_v10000)(CUexternalSemaphore *extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_v1 *semHandleDesc);
|
| 300 |
+
typedef CUresult (CUDAAPI *PFN_cuSignalExternalSemaphoresAsync_v10000_ptsz)(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 *paramsArray, unsigned int numExtSems, CUstream stream);
|
| 301 |
+
typedef CUresult (CUDAAPI *PFN_cuWaitExternalSemaphoresAsync_v10000_ptsz)(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 *paramsArray, unsigned int numExtSems, CUstream stream);
|
| 302 |
+
typedef CUresult (CUDAAPI *PFN_cuDestroyExternalSemaphore_v10000)(CUexternalSemaphore extSem);
|
| 303 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue32_v8000_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags);
|
| 304 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue64_v9000_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags);
|
| 305 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue32_v8000_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags);
|
| 306 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue64_v9000_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags);
|
| 307 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBatchMemOp_v8000_ptsz)(CUstream stream, unsigned int count, CUstreamBatchMemOpParams_v1 *paramArray, unsigned int flags);
|
| 308 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue32_v11070_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags);
|
| 309 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue64_v11070_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags);
|
| 310 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue32_v11070_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags);
|
| 311 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue64_v11070_ptsz)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags);
|
| 312 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBatchMemOp_v11070_ptsz)(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags);
|
| 313 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncGetAttribute_v2020)(int *pi, CUfunction_attribute attrib, CUfunction hfunc);
|
| 314 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncSetAttribute_v9000)(CUfunction hfunc, CUfunction_attribute attrib, int value);
|
| 315 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncSetCacheConfig_v3000)(CUfunction hfunc, CUfunc_cache config);
|
| 316 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncSetSharedMemConfig_v4020)(CUfunction hfunc, CUsharedconfig config);
|
| 317 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncGetName_v12030)(const char **name, CUfunction hfunc);
|
| 318 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncGetParamInfo_v12040)(CUfunction func, size_t paramIndex, size_t *paramOffset, size_t *paramSize);
|
| 319 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncIsLoaded_v12040)(CUfunctionLoadingState *state, CUfunction hfunc);
|
| 320 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncLoad_v12040)(CUfunction hfunc);
|
| 321 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchKernel_v7000_ptsz)(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra);
|
| 322 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchKernelEx_v11060_ptsz)(const CUlaunchConfig *config, CUfunction f, void **kernelParams, void **extra);
|
| 323 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchCooperativeKernel_v9000_ptsz)(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams);
|
| 324 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchCooperativeKernelMultiDevice_v9000)(CUDA_LAUNCH_PARAMS_v1 *launchParamsList, unsigned int numDevices, unsigned int flags);
|
| 325 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchHostFunc_v10000_ptsz)(CUstream hStream, CUhostFn fn, void *userData);
|
| 326 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncSetBlockShape_v2000)(CUfunction hfunc, int x, int y, int z);
|
| 327 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncSetSharedSize_v2000)(CUfunction hfunc, unsigned int bytes);
|
| 328 |
+
typedef CUresult (CUDAAPI *PFN_cuParamSetSize_v2000)(CUfunction hfunc, unsigned int numbytes);
|
| 329 |
+
typedef CUresult (CUDAAPI *PFN_cuParamSeti_v2000)(CUfunction hfunc, int offset, unsigned int value);
|
| 330 |
+
typedef CUresult (CUDAAPI *PFN_cuParamSetf_v2000)(CUfunction hfunc, int offset, float value);
|
| 331 |
+
typedef CUresult (CUDAAPI *PFN_cuParamSetv_v2000)(CUfunction hfunc, int offset, void *ptr, unsigned int numbytes);
|
| 332 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunch_v2000)(CUfunction f);
|
| 333 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchGrid_v2000)(CUfunction f, int grid_width, int grid_height);
|
| 334 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchGridAsync_v2000)(CUfunction f, int grid_width, int grid_height, CUstream hStream);
|
| 335 |
+
typedef CUresult (CUDAAPI *PFN_cuParamSetTexRef_v2000)(CUfunction hfunc, int texunit, CUtexref hTexRef);
|
| 336 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphCreate_v10000)(CUgraph *phGraph, unsigned int flags);
|
| 337 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddKernelNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams);
|
| 338 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeGetParams_v10000)(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams);
|
| 339 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeSetParams_v10000)(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams);
|
| 340 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddKernelNode_v12000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_KERNEL_NODE_PARAMS_v2 *nodeParams);
|
| 341 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeGetParams_v12000)(CUgraphNode hNode, CUDA_KERNEL_NODE_PARAMS_v2 *nodeParams);
|
| 342 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeSetParams_v12000)(CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v2 *nodeParams);
|
| 343 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddMemcpyNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_MEMCPY3D_v2 *copyParams, CUcontext ctx);
|
| 344 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphMemcpyNodeGetParams_v10000)(CUgraphNode hNode, CUDA_MEMCPY3D_v2 *nodeParams);
|
| 345 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphMemcpyNodeSetParams_v10000)(CUgraphNode hNode, const CUDA_MEMCPY3D_v2 *nodeParams);
|
| 346 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddMemsetNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_MEMSET_NODE_PARAMS_v1 *memsetParams, CUcontext ctx);
|
| 347 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphMemsetNodeGetParams_v10000)(CUgraphNode hNode, CUDA_MEMSET_NODE_PARAMS_v1 *nodeParams);
|
| 348 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphMemsetNodeSetParams_v10000)(CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS_v1 *nodeParams);
|
| 349 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddHostNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_HOST_NODE_PARAMS_v1 *nodeParams);
|
| 350 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphHostNodeGetParams_v10000)(CUgraphNode hNode, CUDA_HOST_NODE_PARAMS_v1 *nodeParams);
|
| 351 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphHostNodeSetParams_v10000)(CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS_v1 *nodeParams);
|
| 352 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddChildGraphNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUgraph childGraph);
|
| 353 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphChildGraphNodeGetGraph_v10000)(CUgraphNode hNode, CUgraph *phGraph);
|
| 354 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddEmptyNode_v10000)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies);
|
| 355 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddEventRecordNode_v11010)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUevent event);
|
| 356 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphEventRecordNodeGetEvent_v11010)(CUgraphNode hNode, CUevent *event_out);
|
| 357 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphEventRecordNodeSetEvent_v11010)(CUgraphNode hNode, CUevent event);
|
| 358 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddEventWaitNode_v11010)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUevent event);
|
| 359 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphEventWaitNodeGetEvent_v11010)(CUgraphNode hNode, CUevent *event_out);
|
| 360 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphEventWaitNodeSetEvent_v11010)(CUgraphNode hNode, CUevent event);
|
| 361 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddExternalSemaphoresSignalNode_v11020)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 *nodeParams);
|
| 362 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExternalSemaphoresSignalNodeGetParams_v11020)(CUgraphNode hNode, CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 *params_out);
|
| 363 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExternalSemaphoresSignalNodeSetParams_v11020)(CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 *nodeParams);
|
| 364 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddExternalSemaphoresWaitNode_v11020)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 *nodeParams);
|
| 365 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExternalSemaphoresWaitNodeGetParams_v11020)(CUgraphNode hNode, CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 *params_out);
|
| 366 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExternalSemaphoresWaitNodeSetParams_v11020)(CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 *nodeParams);
|
| 367 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddBatchMemOpNode_v11070)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams);
|
| 368 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphBatchMemOpNodeGetParams_v11070)(CUgraphNode hNode, CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams_out);
|
| 369 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphBatchMemOpNodeSetParams_v11070)(CUgraphNode hNode, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams);
|
| 370 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecBatchMemOpNodeSetParams_v11070)(CUgraphExec graphExec, CUgraphNode node, const CUDA_BATCH_MEM_OP_NODE_PARAMS *nodeParams);
|
| 371 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphClone_v10000)(CUgraph *phGraphClone, CUgraph originalGraph);
|
| 372 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphNodeFindInClone_v10000)(CUgraphNode *phNode, CUgraphNode hOriginalNode, CUgraph hClonedGraph);
|
| 373 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetType_v10000)(CUgraphNode hNode, CUgraphNodeType *type);
|
| 374 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphGetNodes_v10000)(CUgraph hGraph, CUgraphNode *nodes, size_t *numNodes);
|
| 375 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphGetRootNodes_v10000)(CUgraph hGraph, CUgraphNode *rootNodes, size_t *numRootNodes);
|
| 376 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphGetEdges_v10000)(CUgraph hGraph, CUgraphNode *from, CUgraphNode *to, size_t *numEdges);
|
| 377 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphGetEdges_v12030)(CUgraph hGraph, CUgraphNode *from, CUgraphNode *to, CUgraphEdgeData *edgeData, size_t *numEdges);
|
| 378 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetDependencies_v10000)(CUgraphNode hNode, CUgraphNode *dependencies, size_t *numDependencies);
|
| 379 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetDependencies_v12030)(CUgraphNode hNode, CUgraphNode *dependencies, CUgraphEdgeData *edgeData, size_t *numDependencies);
|
| 380 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetDependentNodes_v10000)(CUgraphNode hNode, CUgraphNode *dependentNodes, size_t *numDependentNodes);
|
| 381 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetDependentNodes_v12030)(CUgraphNode hNode, CUgraphNode *dependentNodes, CUgraphEdgeData *edgeData, size_t *numDependentNodes);
|
| 382 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddDependencies_v10000)(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, size_t numDependencies);
|
| 383 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddDependencies_v12030)(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, const CUgraphEdgeData *edgeData, size_t numDependencies);
|
| 384 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphRemoveDependencies_v10000)(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, size_t numDependencies);
|
| 385 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphRemoveDependencies_v12030)(CUgraph hGraph, const CUgraphNode *from, const CUgraphNode *to, const CUgraphEdgeData *edgeData, size_t numDependencies);
|
| 386 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphDestroyNode_v10000)(CUgraphNode hNode);
|
| 387 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphInstantiateWithFlags_v11040)(CUgraphExec *phGraphExec, CUgraph hGraph, unsigned long long flags);
|
| 388 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphInstantiateWithParams_v12000_ptsz)(CUgraphExec *phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS *instantiateParams);
|
| 389 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecGetFlags_v12000)(CUgraphExec hGraphExec, cuuint64_t *flags);
|
| 390 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecKernelNodeSetParams_v10010)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v1 *nodeParams);
|
| 391 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecKernelNodeSetParams_v12000)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_KERNEL_NODE_PARAMS_v2 *nodeParams);
|
| 392 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecMemcpyNodeSetParams_v10020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMCPY3D_v2 *copyParams, CUcontext ctx);
|
| 393 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecMemsetNodeSetParams_v10020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_MEMSET_NODE_PARAMS_v1 *memsetParams, CUcontext ctx);
|
| 394 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecHostNodeSetParams_v10020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_HOST_NODE_PARAMS_v1 *nodeParams);
|
| 395 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecChildGraphNodeSetParams_v11010)(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraph childGraph);
|
| 396 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecEventRecordNodeSetEvent_v11010)(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event);
|
| 397 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecEventWaitNodeSetEvent_v11010)(CUgraphExec hGraphExec, CUgraphNode hNode, CUevent event);
|
| 398 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecExternalSemaphoresSignalNodeSetParams_v11020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v1 *nodeParams);
|
| 399 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecExternalSemaphoresWaitNodeSetParams_v11020)(CUgraphExec hGraphExec, CUgraphNode hNode, const CUDA_EXT_SEM_WAIT_NODE_PARAMS_v1 *nodeParams);
|
| 400 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphUpload_v11010_ptsz)(CUgraphExec hGraphExec, CUstream hStream);
|
| 401 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphLaunch_v10000_ptsz)(CUgraphExec hGraphExec, CUstream hStream);
|
| 402 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecDestroy_v10000)(CUgraphExec hGraphExec);
|
| 403 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphDestroy_v10000)(CUgraph hGraph);
|
| 404 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecUpdate_v10020)(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphNode *hErrorNode_out, CUgraphExecUpdateResult *updateResult_out);
|
| 405 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecUpdate_v12000)(CUgraphExec hGraphExec, CUgraph hGraph, CUgraphExecUpdateResultInfo *resultInfo);
|
| 406 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeCopyAttributes_v11000)(CUgraphNode dst, CUgraphNode src);
|
| 407 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeGetAttribute_v11000)(CUgraphNode hNode, CUkernelNodeAttrID attr, CUkernelNodeAttrValue_v1 *value_out);
|
| 408 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphKernelNodeSetAttribute_v11000)(CUgraphNode hNode, CUkernelNodeAttrID attr, const CUkernelNodeAttrValue_v1 *value);
|
| 409 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphDebugDotPrint_v11030)(CUgraph hGraph, const char *path, unsigned int flags);
|
| 410 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddMemAllocNode_v11040)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUDA_MEM_ALLOC_NODE_PARAMS *nodeParams);
|
| 411 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphMemAllocNodeGetParams_v11040)(CUgraphNode hNode, CUDA_MEM_ALLOC_NODE_PARAMS *params_out);
|
| 412 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddMemFreeNode_v11040)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUdeviceptr dptr);
|
| 413 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphMemFreeNodeGetParams_v11040)(CUgraphNode hNode, CUdeviceptr *dptr_out);
|
| 414 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphNodeSetEnabled_v11060)(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int isEnabled);
|
| 415 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphNodeGetEnabled_v11060)(CUgraphExec hGraphExec, CUgraphNode hNode, unsigned int *isEnabled);
|
| 416 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddNode_v12020)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, size_t numDependencies, CUgraphNodeParams *nodeParams);
|
| 417 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphAddNode_v12030)(CUgraphNode *phGraphNode, CUgraph hGraph, const CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, CUgraphNodeParams *nodeParams);
|
| 418 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphNodeSetParams_v12020)(CUgraphNode hNode, CUgraphNodeParams *nodeParams);
|
| 419 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphExecNodeSetParams_v12020)(CUgraphExec hGraphExec, CUgraphNode hNode, CUgraphNodeParams *nodeParams);
|
| 420 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphConditionalHandleCreate_v12030)(CUgraphConditionalHandle *pHandle_out, CUgraph hGraph, CUcontext ctx, unsigned int defaultLaunchValue, unsigned int flags);
|
| 421 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGraphMemTrim_v11040)(CUdevice device);
|
| 422 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetGraphMemAttribute_v11040)(CUdevice device, CUgraphMem_attribute attr, void* value);
|
| 423 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceSetGraphMemAttribute_v11040)(CUdevice device, CUgraphMem_attribute attr, void* value);
|
| 424 |
+
typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxActiveBlocksPerMultiprocessor_v6050)(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize);
|
| 425 |
+
typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags_v7000)(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize, unsigned int flags);
|
| 426 |
+
typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxPotentialBlockSize_v6050)(int *minGridSize, int *blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit);
|
| 427 |
+
typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxPotentialBlockSizeWithFlags_v7000)(int *minGridSize, int *blockSize, CUfunction func, CUoccupancyB2DSize blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags);
|
| 428 |
+
typedef CUresult (CUDAAPI *PFN_cuOccupancyAvailableDynamicSMemPerBlock_v10020)(size_t *dynamicSmemSize, CUfunction func, int numBlocks, int blockSize);
|
| 429 |
+
typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxPotentialClusterSize_v11070)(int *clusterSize, CUfunction func, const CUlaunchConfig *config);
|
| 430 |
+
typedef CUresult (CUDAAPI *PFN_cuOccupancyMaxActiveClusters_v11070)(int *numClusters, CUfunction func, const CUlaunchConfig *config);
|
| 431 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetArray_v2000)(CUtexref hTexRef, CUarray hArray, unsigned int Flags);
|
| 432 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetMipmappedArray_v5000)(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, unsigned int Flags);
|
| 433 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress_v3020)(size_t *ByteOffset, CUtexref hTexRef, CUdeviceptr_v2 dptr, size_t bytes);
|
| 434 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress2D_v4010)(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR_v2 *desc, CUdeviceptr_v2 dptr, size_t Pitch);
|
| 435 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetFormat_v2000)(CUtexref hTexRef, CUarray_format fmt, int NumPackedComponents);
|
| 436 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddressMode_v2000)(CUtexref hTexRef, int dim, CUaddress_mode am);
|
| 437 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetFilterMode_v2000)(CUtexref hTexRef, CUfilter_mode fm);
|
| 438 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetMipmapFilterMode_v5000)(CUtexref hTexRef, CUfilter_mode fm);
|
| 439 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetMipmapLevelBias_v5000)(CUtexref hTexRef, float bias);
|
| 440 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetMipmapLevelClamp_v5000)(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp);
|
| 441 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetMaxAnisotropy_v5000)(CUtexref hTexRef, unsigned int maxAniso);
|
| 442 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetBorderColor_v8000)(CUtexref hTexRef, float *pBorderColor);
|
| 443 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetFlags_v2000)(CUtexref hTexRef, unsigned int Flags);
|
| 444 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetAddress_v3020)(CUdeviceptr_v2 *pdptr, CUtexref hTexRef);
|
| 445 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetArray_v2000)(CUarray *phArray, CUtexref hTexRef);
|
| 446 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetMipmappedArray_v5000)(CUmipmappedArray *phMipmappedArray, CUtexref hTexRef);
|
| 447 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetAddressMode_v2000)(CUaddress_mode *pam, CUtexref hTexRef, int dim);
|
| 448 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetFilterMode_v2000)(CUfilter_mode *pfm, CUtexref hTexRef);
|
| 449 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetFormat_v2000)(CUarray_format *pFormat, int *pNumChannels, CUtexref hTexRef);
|
| 450 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetMipmapFilterMode_v5000)(CUfilter_mode *pfm, CUtexref hTexRef);
|
| 451 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetMipmapLevelBias_v5000)(float *pbias, CUtexref hTexRef);
|
| 452 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetMipmapLevelClamp_v5000)(float *pminMipmapLevelClamp, float *pmaxMipmapLevelClamp, CUtexref hTexRef);
|
| 453 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetMaxAnisotropy_v5000)(int *pmaxAniso, CUtexref hTexRef);
|
| 454 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetBorderColor_v8000)(float *pBorderColor, CUtexref hTexRef);
|
| 455 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetFlags_v2000)(unsigned int *pFlags, CUtexref hTexRef);
|
| 456 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefCreate_v2000)(CUtexref *pTexRef);
|
| 457 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefDestroy_v2000)(CUtexref hTexRef);
|
| 458 |
+
typedef CUresult (CUDAAPI *PFN_cuSurfRefSetArray_v3000)(CUsurfref hSurfRef, CUarray hArray, unsigned int Flags);
|
| 459 |
+
typedef CUresult (CUDAAPI *PFN_cuSurfRefGetArray_v3000)(CUarray *phArray, CUsurfref hSurfRef);
|
| 460 |
+
typedef CUresult (CUDAAPI *PFN_cuTexObjectCreate_v5000)(CUtexObject_v1 *pTexObject, const CUDA_RESOURCE_DESC_v1 *pResDesc, const CUDA_TEXTURE_DESC_v1 *pTexDesc, const CUDA_RESOURCE_VIEW_DESC_v1 *pResViewDesc);
|
| 461 |
+
typedef CUresult (CUDAAPI *PFN_cuTexObjectDestroy_v5000)(CUtexObject_v1 texObject);
|
| 462 |
+
typedef CUresult (CUDAAPI *PFN_cuTexObjectGetResourceDesc_v5000)(CUDA_RESOURCE_DESC_v1 *pResDesc, CUtexObject_v1 texObject);
|
| 463 |
+
typedef CUresult (CUDAAPI *PFN_cuTexObjectGetTextureDesc_v5000)(CUDA_TEXTURE_DESC_v1 *pTexDesc, CUtexObject_v1 texObject);
|
| 464 |
+
typedef CUresult (CUDAAPI *PFN_cuTexObjectGetResourceViewDesc_v5000)(CUDA_RESOURCE_VIEW_DESC_v1 *pResViewDesc, CUtexObject_v1 texObject);
|
| 465 |
+
typedef CUresult (CUDAAPI *PFN_cuSurfObjectCreate_v5000)(CUsurfObject_v1 *pSurfObject, const CUDA_RESOURCE_DESC_v1 *pResDesc);
|
| 466 |
+
typedef CUresult (CUDAAPI *PFN_cuSurfObjectDestroy_v5000)(CUsurfObject_v1 surfObject);
|
| 467 |
+
typedef CUresult (CUDAAPI *PFN_cuSurfObjectGetResourceDesc_v5000)(CUDA_RESOURCE_DESC_v1 *pResDesc, CUsurfObject_v1 surfObject);
|
| 468 |
+
typedef CUresult (CUDAAPI *PFN_cuTensorMapEncodeTiled_v12000)(CUtensorMap *tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void *globalAddress, const cuuint64_t *globalDim, const cuuint64_t *globalStrides, const cuuint32_t *boxDim, const cuuint32_t *elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill);
|
| 469 |
+
typedef CUresult (CUDAAPI *PFN_cuTensorMapEncodeIm2col_v12000)(CUtensorMap *tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void *globalAddress, const cuuint64_t *globalDim, const cuuint64_t *globalStrides, const int *pixelBoxLowerCorner, const int *pixelBoxUpperCorner, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t *elementStrides, CUtensorMapInterleave interleave, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill);
|
| 470 |
+
typedef CUresult (CUDAAPI *PFN_cuTensorMapReplaceAddress_v12000)(CUtensorMap *tensorMap, void *globalAddress);
|
| 471 |
+
typedef CUresult (CUDAAPI *PFN_cuTensorMapEncodeIm2colWide_v12080)(CUtensorMap *tensorMap, CUtensorMapDataType tensorDataType, cuuint32_t tensorRank, void *globalAddress, const cuuint64_t *globalDim, const cuuint64_t *globalStrides, int pixelBoxLowerCornerWidth, int pixelBoxUpperCornerWidth, cuuint32_t channelsPerPixel, cuuint32_t pixelsPerColumn, const cuuint32_t *elementStrides, CUtensorMapInterleave interleave, CUtensorMapIm2ColWideMode mode, CUtensorMapSwizzle swizzle, CUtensorMapL2promotion l2Promotion, CUtensorMapFloatOOBfill oobFill);
|
| 472 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceCanAccessPeer_v4000)(int *canAccessPeer, CUdevice_v1 dev, CUdevice_v1 peerDev);
|
| 473 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxEnablePeerAccess_v4000)(CUcontext peerContext, unsigned int Flags);
|
| 474 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxDisablePeerAccess_v4000)(CUcontext peerContext);
|
| 475 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetP2PAttribute_v8000)(int *value, CUdevice_P2PAttribute attrib, CUdevice_v1 srcDevice, CUdevice_v1 dstDevice);
|
| 476 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceGetP2PAtomicCapabilities_v13000)(unsigned int* capabilities, const CUatomicOperation* operations, unsigned int count, CUdevice srcDevice, CUdevice dstDevice);
|
| 477 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsUnregisterResource_v3000)(CUgraphicsResource resource);
|
| 478 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsSubResourceGetMappedArray_v3000)(CUarray *pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel);
|
| 479 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceGetMappedMipmappedArray_v5000)(CUmipmappedArray *pMipmappedArray, CUgraphicsResource resource);
|
| 480 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceGetMappedPointer_v3020)(CUdeviceptr_v2 *pDevPtr, size_t *pSize, CUgraphicsResource resource);
|
| 481 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceSetMapFlags_v6050)(CUgraphicsResource resource, unsigned int flags);
|
| 482 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsMapResources_v7000_ptsz)(unsigned int count, CUgraphicsResource *resources, CUstream hStream);
|
| 483 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsUnmapResources_v7000_ptsz)(unsigned int count, CUgraphicsResource *resources, CUstream hStream);
|
| 484 |
+
typedef CUresult (CUDAAPI *PFN_cuGetExportTable_v3000)(const void **ppExportTable, const CUuuid *pExportTableId);
|
| 485 |
+
typedef CUresult (CUDAAPI *PFN_cuFuncGetModule_v11000)(CUmodule *hmod, CUfunction hfunc);
|
| 486 |
+
typedef CUresult (CUDAAPI *PFN_cuGetProcAddress_v11030)(const char *symbol, void **pfn, int driverVersion, cuuint64_t flags);
|
| 487 |
+
typedef CUresult (CUDAAPI *PFN_cuGetProcAddress_v12000)(const char *symbol, void **pfn, int driverVersion, cuuint64_t flags, CUdriverProcAddressQueryResult *symbolFound);
|
| 488 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoD_v3020)(CUdeviceptr_v2 dstDevice, const void *srcHost, size_t ByteCount);
|
| 489 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoH_v3020)(void *dstHost, CUdeviceptr_v2 srcDevice, size_t ByteCount);
|
| 490 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoD_v3020)(CUdeviceptr_v2 dstDevice, CUdeviceptr_v2 srcDevice, size_t ByteCount);
|
| 491 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoA_v3020)(CUarray dstArray, size_t dstOffset, CUdeviceptr_v2 srcDevice, size_t ByteCount);
|
| 492 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoD_v3020)(CUdeviceptr_v2 dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount);
|
| 493 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoA_v3020)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount);
|
| 494 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoH_v3020)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount);
|
| 495 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoA_v3020)(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount);
|
| 496 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoAAsync_v3020)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount, CUstream hStream);
|
| 497 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoHAsync_v3020)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream);
|
| 498 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy2D_v3020)(const CUDA_MEMCPY2D_v2 *pCopy);
|
| 499 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy2DUnaligned_v3020)(const CUDA_MEMCPY2D_v2 *pCopy);
|
| 500 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3D_v3020)(const CUDA_MEMCPY3D_v2 *pCopy);
|
| 501 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoDAsync_v3020)(CUdeviceptr_v2 dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream);
|
| 502 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoHAsync_v3020)(void *dstHost, CUdeviceptr_v2 srcDevice, size_t ByteCount, CUstream hStream);
|
| 503 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoDAsync_v3020)(CUdeviceptr_v2 dstDevice, CUdeviceptr_v2 srcDevice, size_t ByteCount, CUstream hStream);
|
| 504 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy2DAsync_v3020)(const CUDA_MEMCPY2D_v2 *pCopy, CUstream hStream);
|
| 505 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DAsync_v3020)(const CUDA_MEMCPY3D_v2 *pCopy, CUstream hStream);
|
| 506 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD8_v3020)(CUdeviceptr_v2 dstDevice, unsigned char uc, size_t N);
|
| 507 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD16_v3020)(CUdeviceptr_v2 dstDevice, unsigned short us, size_t N);
|
| 508 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD32_v3020)(CUdeviceptr_v2 dstDevice, unsigned int ui, size_t N);
|
| 509 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height);
|
| 510 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height);
|
| 511 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height);
|
| 512 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy_v4000)(CUdeviceptr_v2 dst, CUdeviceptr_v2 src, size_t ByteCount);
|
| 513 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAsync_v4000)(CUdeviceptr_v2 dst, CUdeviceptr_v2 src, size_t ByteCount, CUstream hStream);
|
| 514 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyPeer_v4000)(CUdeviceptr_v2 dstDevice, CUcontext dstContext, CUdeviceptr_v2 srcDevice, CUcontext srcContext, size_t ByteCount);
|
| 515 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyPeerAsync_v4000)(CUdeviceptr_v2 dstDevice, CUcontext dstContext, CUdeviceptr_v2 srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream);
|
| 516 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DPeer_v4000)(const CUDA_MEMCPY3D_PEER_v1 *pCopy);
|
| 517 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DPeerAsync_v4000)(const CUDA_MEMCPY3D_PEER_v1 *pCopy, CUstream hStream);
|
| 518 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyBatchAsync_v12080)(CUdeviceptr_v2 *dsts, CUdeviceptr_v2 *srcs, size_t *sizes, size_t count, CUmemcpyAttributes_v1 *attrs, size_t *attrIdxs, size_t numAttrs, size_t *failIdx, CUstream hStream);
|
| 519 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DBatchAsync_v12080)(size_t numParams, CUDA_MEMCPY3D_BATCH_OP_v1 *opList, size_t *failIdx, unsigned long long flags, CUstream hStream);
|
| 520 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyBatchAsync_v13000)(CUdeviceptr_v2 *dsts, CUdeviceptr_v2 *srcs, size_t *sizes, size_t count, CUmemcpyAttributes_v1 *attrs, size_t *attrIdxs, size_t numAttrs, CUstream hStream);
|
| 521 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DBatchAsync_v13000)(size_t numParams, CUDA_MEMCPY3D_BATCH_OP_v1 *opList, unsigned long long flags, CUstream hStream);
|
| 522 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD8Async_v3020)(CUdeviceptr_v2 dstDevice, unsigned char uc, size_t N, CUstream hStream);
|
| 523 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD16Async_v3020)(CUdeviceptr_v2 dstDevice, unsigned short us, size_t N, CUstream hStream);
|
| 524 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD32Async_v3020)(CUdeviceptr_v2 dstDevice, unsigned int ui, size_t N, CUstream hStream);
|
| 525 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8Async_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream);
|
| 526 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16Async_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream);
|
| 527 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32Async_v3020)(CUdeviceptr_v2 dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream);
|
| 528 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetPriority_v5050)(CUstream hStream, int *priority);
|
| 529 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetFlags_v5050)(CUstream hStream, unsigned int *flags);
|
| 530 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCtx_v9020)(CUstream hStream, CUcontext *pctx);
|
| 531 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetDevice_v12080)(CUstream hStream, CUdevice *device);
|
| 532 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetDevice_v12080_ptsz)(CUstream hStream, CUdevice *device);
|
| 533 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitEvent_v3020)(CUstream hStream, CUevent hEvent, unsigned int Flags);
|
| 534 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamAddCallback_v5000)(CUstream hStream, CUstreamCallback callback, void *userData, unsigned int flags);
|
| 535 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamAttachMemAsync_v6000)(CUstream hStream, CUdeviceptr_v2 dptr, size_t length, unsigned int flags);
|
| 536 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamQuery_v2000)(CUstream hStream);
|
| 537 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamSynchronize_v2000)(CUstream hStream);
|
| 538 |
+
typedef CUresult (CUDAAPI *PFN_cuEventRecord_v2000)(CUevent hEvent, CUstream hStream);
|
| 539 |
+
typedef CUresult (CUDAAPI *PFN_cuEventRecordWithFlags_v11010)(CUevent hEvent, CUstream hStream, unsigned int flags);
|
| 540 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchKernel_v4000)(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra);
|
| 541 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchKernelEx_v11060)(const CUlaunchConfig *config, CUfunction f, void **kernelParams, void **extra);
|
| 542 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchHostFunc_v10000)(CUstream hStream, CUhostFn fn, void *userData);
|
| 543 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsMapResources_v3000)(unsigned int count, CUgraphicsResource *resources, CUstream hStream);
|
| 544 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsUnmapResources_v3000)(unsigned int count, CUgraphicsResource *resources, CUstream hStream);
|
| 545 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue32_v8000)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags);
|
| 546 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue32_v8000)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags);
|
| 547 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue64_v9000)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags);
|
| 548 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue64_v9000)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags);
|
| 549 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBatchMemOp_v8000)(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags);
|
| 550 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue32_v11070)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags);
|
| 551 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue32_v11070)(CUstream stream, CUdeviceptr_v2 addr, cuuint32_t value, unsigned int flags);
|
| 552 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWriteValue64_v11070)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags);
|
| 553 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamWaitValue64_v11070)(CUstream stream, CUdeviceptr_v2 addr, cuuint64_t value, unsigned int flags);
|
| 554 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBatchMemOp_v11070)(CUstream stream, unsigned int count, CUstreamBatchMemOpParams *paramArray, unsigned int flags);
|
| 555 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPrefetchAsync_v8000)(CUdeviceptr_v2 devPtr, size_t count, CUdevice_v1 dstDevice, CUstream hStream);
|
| 556 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPrefetchAsync_v12020)(CUdeviceptr_v2 devPtr, size_t count, CUmemLocation_v1 location, unsigned int flags, CUstream hStream);
|
| 557 |
+
typedef CUresult (CUDAAPI *PFN_cuMemPrefetchBatchAsync_v13000)(CUdeviceptr_v2 *dptrs, size_t *sizes, size_t count, CUmemLocation_v1 *prefetchLocs, size_t *prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream);
|
| 558 |
+
typedef CUresult (CUDAAPI *PFN_cuMemDiscardBatchAsync_v13000)(CUdeviceptr_v2 *dptrs, size_t *sizes, size_t count, unsigned long long flags, CUstream hStream);
|
| 559 |
+
typedef CUresult (CUDAAPI *PFN_cuMemDiscardAndPrefetchBatchAsync_v13000)(CUdeviceptr_v2 *dptrs, size_t *sizes, size_t count, CUmemLocation_v1 *prefetchLocs, size_t *prefetchLocIdxs, size_t numPrefetchLocs, unsigned long long flags, CUstream hStream);
|
| 560 |
+
typedef CUresult (CUDAAPI *PFN_cuLaunchCooperativeKernel_v9000)(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void **kernelParams);
|
| 561 |
+
typedef CUresult (CUDAAPI *PFN_cuSignalExternalSemaphoresAsync_v10000)(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_v1 *paramsArray, unsigned int numExtSems, CUstream stream);
|
| 562 |
+
typedef CUresult (CUDAAPI *PFN_cuWaitExternalSemaphoresAsync_v10000)(const CUexternalSemaphore *extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_v1 *paramsArray, unsigned int numExtSems, CUstream stream);
|
| 563 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBeginCapture_v10010)(CUstream hStream, CUstreamCaptureMode mode);
|
| 564 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBeginCaptureToGraph_v12030)(CUstream hStream, CUgraph hGraph, const CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, CUstreamCaptureMode mode);
|
| 565 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamEndCapture_v10000)(CUstream hStream, CUgraph *phGraph);
|
| 566 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamIsCapturing_v10000)(CUstream hStream, CUstreamCaptureStatus *captureStatus);
|
| 567 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v10010)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out);
|
| 568 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v11030)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, size_t *numDependencies_out);
|
| 569 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCaptureInfo_v12030)(CUstream hStream, CUstreamCaptureStatus *captureStatus_out, cuuint64_t *id_out, CUgraph *graph_out, const CUgraphNode **dependencies_out, const CUgraphEdgeData **edgeData_out, size_t *numDependencies_out);
|
| 570 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamUpdateCaptureDependencies_v11030)(CUstream hStream, CUgraphNode *dependencies, size_t numDependencies, unsigned int flags);
|
| 571 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamUpdateCaptureDependencies_v12030)(CUstream hStream, CUgraphNode *dependencies, const CUgraphEdgeData *dependencyData, size_t numDependencies, unsigned int flags);
|
| 572 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphInstantiateWithParams_v12000)(CUgraphExec *phGraphExec, CUgraph hGraph, CUDA_GRAPH_INSTANTIATE_PARAMS *instantiateParams);
|
| 573 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphUpload_v11010)(CUgraphExec hGraph, CUstream hStream);
|
| 574 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphLaunch_v10000)(CUgraphExec hGraph, CUstream hStream);
|
| 575 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamCopyAttributes_v11000)(CUstream dstStream, CUstream srcStream);
|
| 576 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetAttribute_v11000)(CUstream hStream, CUstreamAttrID attr, CUstreamAttrValue_v1 *value);
|
| 577 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamSetAttribute_v11000)(CUstream hStream, CUstreamAttrID attr, const CUstreamAttrValue_v1 *param);
|
| 578 |
+
typedef CUresult (CUDAAPI *PFN_cuMemMapArrayAsync_v11010)(CUarrayMapInfo_v1 *mapInfoList, unsigned int count, CUstream hStream);
|
| 579 |
+
typedef CUresult (CUDAAPI *PFN_cuMemFreeAsync_v11020)(CUdeviceptr_v2 dptr, CUstream hStream);
|
| 580 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAllocAsync_v11020)(CUdeviceptr_v2 *dptr, size_t bytesize, CUstream hStream);
|
| 581 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAllocFromPoolAsync_v11020)(CUdeviceptr_v2 *dptr, size_t bytesize, CUmemoryPool pool, CUstream hStream);
|
| 582 |
+
typedef CUresult (CUDAAPI *PFN_cuFlushGPUDirectRDMAWrites_v11030)(CUflushGPUDirectRDMAWritesTarget target, CUflushGPUDirectRDMAWritesScope scope);
|
| 583 |
+
typedef CUresult (CUDAAPI *PFN_cuUserObjectCreate_v11030)(CUuserObject *object_out, void *ptr, CUhostFn destroy, unsigned int initialRefcount, unsigned int flags);
|
| 584 |
+
typedef CUresult (CUDAAPI *PFN_cuUserObjectRetain_v11030)(CUuserObject object, unsigned int count);
|
| 585 |
+
typedef CUresult (CUDAAPI *PFN_cuUserObjectRelease_v11030)(CUuserObject object, unsigned int count);
|
| 586 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphRetainUserObject_v11030)(CUgraph graph, CUuserObject object, unsigned int count, unsigned int flags);
|
| 587 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphReleaseUserObject_v11030)(CUgraph graph, CUuserObject object, unsigned int count);
|
| 588 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleGetLoadingMode_v11070)(CUmoduleLoadingMode *mode);
|
| 589 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetHandleForAddressRange_v11070)(void *handle, CUdeviceptr dptr, size_t size, CUmemRangeHandleType handleType, unsigned long long flags);
|
| 590 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryLoadData_v12000)(CUlibrary *library, const void *code, CUjit_option *jitOptions, void **jitOptionsValues, unsigned int numJitOptions, CUlibraryOption *libraryOptions, void** libraryOptionValues, unsigned int numLibraryOptions);
|
| 591 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryLoadFromFile_v12000)(CUlibrary *library, const char *fileName, CUjit_option *jitOptions, void **jitOptionsValues, unsigned int numJitOptions, CUlibraryOption *libraryOptions, void **libraryOptionValues, unsigned int numLibraryOptions);
|
| 592 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryUnload_v12000)(CUlibrary library);
|
| 593 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryGetKernel_v12000)(CUkernel *pKernel, CUlibrary library, const char *name);
|
| 594 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryGetModule_v12000)(CUmodule *pMod, CUlibrary library);
|
| 595 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryGetKernelCount_v12040)(unsigned int *count, CUlibrary lib);
|
| 596 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryEnumerateKernels_v12040)(CUkernel *kernels, unsigned int numKernels, CUlibrary lib);
|
| 597 |
+
typedef CUresult (CUDAAPI *PFN_cuKernelGetFunction_v12000)(CUfunction *pFunc, CUkernel kernel);
|
| 598 |
+
typedef CUresult (CUDAAPI *PFN_cuKernelGetLibrary_v12050)(CUlibrary *pLib, CUkernel kernel);
|
| 599 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryGetGlobal_v12000)(CUdeviceptr *dptr, size_t *bytes, CUlibrary library, const char *name);
|
| 600 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryGetManaged_v12000)(CUdeviceptr *dptr, size_t *bytes, CUlibrary library, const char *name);
|
| 601 |
+
typedef CUresult (CUDAAPI *PFN_cuKernelGetAttribute_v12000)(int *pi, CUfunction_attribute attrib, CUkernel kernel, CUdevice dev);
|
| 602 |
+
typedef CUresult (CUDAAPI *PFN_cuKernelSetAttribute_v12000)(CUfunction_attribute attrib, int val, CUkernel kernel, CUdevice dev);
|
| 603 |
+
typedef CUresult (CUDAAPI *PFN_cuKernelSetCacheConfig_v12000)(CUkernel kernel, CUfunc_cache config, CUdevice dev);
|
| 604 |
+
typedef CUresult (CUDAAPI *PFN_cuKernelGetName_v12030)(const char **name, CUkernel hfunc);
|
| 605 |
+
typedef CUresult (CUDAAPI *PFN_cuKernelGetParamInfo_v12040)(CUkernel kernel, size_t paramIndex, size_t *paramOffset, size_t *paramSize);
|
| 606 |
+
typedef CUresult (CUDAAPI *PFN_cuLibraryGetUnifiedFunction_v12000)(void **fptr, CUlibrary library, const char *symbol);
|
| 607 |
+
typedef CUresult(CUDAAPI *PFN_cuCoredumpGetAttribute_v12010)(CUcoredumpSettings get, void *value, size_t *size);
|
| 608 |
+
typedef CUresult(CUDAAPI *PFN_cuCoredumpGetAttributeGlobal_v12010)(CUcoredumpSettings get, void *value, size_t *size);
|
| 609 |
+
typedef CUresult(CUDAAPI *PFN_cuCoredumpSetAttribute_v12010)(CUcoredumpSettings set, void *value, size_t *size);
|
| 610 |
+
typedef CUresult(CUDAAPI *PFN_cuCoredumpSetAttributeGlobal_v12010)(CUcoredumpSettings set, void *value, size_t *size);
|
| 611 |
+
typedef CUresult(CUDAAPI *PFN_cuDeviceRegisterAsyncNotification_v12040)(CUdevice device, CUasyncCallback callbackFunc, void *userData, CUasyncCallbackHandle *callback);
|
| 612 |
+
typedef CUresult(CUDAAPI *PFN_cuDeviceUnregisterAsyncNotification_v12040)(CUdevice device, CUasyncCallbackHandle callback);
|
| 613 |
+
typedef CUresult(CUDAAPI *PFN_cuGreenCtxCreate_v12040)(CUgreenCtx* phCtx, CUdevResourceDesc desc, CUdevice dev, unsigned int flags);
|
| 614 |
+
typedef CUresult(CUDAAPI *PFN_cuGreenCtxDestroy_v12040)(CUgreenCtx hCtx);
|
| 615 |
+
typedef CUresult(CUDAAPI *PFN_cuDeviceGetDevResource_v12040)(CUdevice dev, CUdevResource* result, CUdevResourceType type);
|
| 616 |
+
typedef CUresult(CUDAAPI *PFN_cuCtxGetDevResource_v12040)(CUcontext hCtx, CUdevResource* result, CUdevResourceType type);
|
| 617 |
+
typedef CUresult(CUDAAPI *PFN_cuGreenCtxGetDevResource_v12040)(CUgreenCtx hCtx, CUdevResource* result, CUdevResourceType type);
|
| 618 |
+
typedef CUresult(CUDAAPI *PFN_cuGreenCtxRecordEvent_v12040)(CUgreenCtx hCtx, CUevent hEvent);
|
| 619 |
+
typedef CUresult(CUDAAPI *PFN_cuGreenCtxWaitEvent_v12040)(CUgreenCtx hCtx, CUevent hEvent);
|
| 620 |
+
typedef CUresult(CUDAAPI *PFN_cuDevResourceGenerateDesc_v12040)(CUdevResourceDesc* phDesc, CUdevResource* resources, unsigned int nbResources);
|
| 621 |
+
typedef CUresult(CUDAAPI *PFN_cuDevSmResourceSplitByCount_v12040)(CUdevResource* result, unsigned int* nbGroups, const CUdevResource* input, CUdevResource* remaining, unsigned int useFlags, unsigned int minCount);
|
| 622 |
+
typedef CUresult(CUDAAPI *PFN_cuStreamGetGreenCtx_v12040)(CUstream hStream, CUgreenCtx *phCtx);
|
| 623 |
+
typedef CUresult(CUDAAPI *PFN_cuCtxFromGreenCtx_v12040)(CUcontext *pContext, CUgreenCtx hCtx);
|
| 624 |
+
typedef CUresult(CUDAAPI *PFN_cuGreenCtxGetId_v12090)(CUgreenCtx greenCtx, unsigned long long *greenCtxId);
|
| 625 |
+
typedef CUresult(CUDAAPI *PFN_cuCtxRecordEvent_v12050)(CUcontext hCtx, CUevent hEvent);
|
| 626 |
+
typedef CUresult(CUDAAPI *PFN_cuCtxWaitEvent_v12050)(CUcontext hCtx, CUevent hEvent);
|
| 627 |
+
typedef CUresult (CUDAAPI *PFN_cuGreenCtxStreamCreate_v12050)(CUstream* phStream, CUgreenCtx greenCtx, unsigned int flags, int priority);
|
| 628 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCtx_v12050)(CUstream hStream, CUcontext *pctx, CUgreenCtx *pGreenCtx);
|
| 629 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamGetCtx_v12050_ptsz)(CUstream hStream, CUcontext *pctx, CUgreenCtx *pGreenCtx);
|
| 630 |
+
typedef CUresult (CUDAAPI *PFN_cuMemBatchDecompressAsync_v12060)(CUmemDecompressParams *paramsArray, size_t count, unsigned int flags, size_t *errorIndex, CUstream stream);
|
| 631 |
+
typedef CUresult (CUDAAPI *PFN_cuMemBatchDecompressAsync_v12060_ptsz)(CUmemDecompressParams *paramsArray, size_t count, unsigned int flags, size_t *errorIndex, CUstream stream);
|
| 632 |
+
typedef CUresult (CUDAAPI *PFN_cuLogsRegisterCallback_v12090)(CUlogsCallback callbackFunc, void *userData, CUlogsCallbackHandle *callback);
|
| 633 |
+
typedef CUresult (CUDAAPI *PFN_cuLogsUnregisterCallback_v12090)(CUlogsCallbackHandle callback);
|
| 634 |
+
typedef CUresult (CUDAAPI *PFN_cuLogsCurrent_v12090)(CUlogIterator *iterator, unsigned int flags);
|
| 635 |
+
typedef CUresult (CUDAAPI *PFN_cuLogsDumpToFile_v12090)(CUlogIterator *iterator, const char *pathToFile, unsigned int flags);
|
| 636 |
+
typedef CUresult (CUDAAPI *PFN_cuLogsDumpToMemory_v12090)(CUlogIterator *iterator, char *buffer, size_t *size, unsigned int flags);
|
| 637 |
+
/*
|
| 638 |
+
* Type definitions for older versioned functions in cuda.h
|
| 639 |
+
*/
|
| 640 |
+
#if defined(__CUDA_API_VERSION_INTERNAL)
|
| 641 |
+
typedef CUresult (CUDAAPI *PFN_cuMemHostRegister_v4000)(void *p, size_t bytesize, unsigned int Flags);
|
| 642 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceSetMapFlags_v3000)(CUgraphicsResource resource, unsigned int flags);
|
| 643 |
+
typedef CUresult (CUDAAPI *PFN_cuLinkCreate_v5050)(unsigned int numOptions, CUjit_option *options, void **optionValues, CUlinkState *stateOut);
|
| 644 |
+
typedef CUresult (CUDAAPI *PFN_cuLinkAddData_v5050)(CUlinkState state, CUjitInputType type, void *data, size_t size, const char *name, unsigned int numOptions, CUjit_option *options, void **optionValues);
|
| 645 |
+
typedef CUresult (CUDAAPI *PFN_cuLinkAddFile_v5050)(CUlinkState state, CUjitInputType type, const char *path, unsigned int numOptions, CUjit_option *options, void **optionValues);
|
| 646 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress2D_v3020)(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR_v2 *desc, CUdeviceptr_v2 dptr, size_t Pitch);
|
| 647 |
+
typedef CUresult (CUDAAPI *PFN_cuDeviceTotalMem_v2000)(unsigned int *bytes, CUdevice_v1 dev);
|
| 648 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxCreate_v2000)(CUcontext *pctx, unsigned int flags, CUdevice_v1 dev);
|
| 649 |
+
typedef CUresult (CUDAAPI *PFN_cuModuleGetGlobal_v2000)(CUdeviceptr_v1 *dptr, unsigned int *bytes, CUmodule hmod, const char *name);
|
| 650 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetInfo_v2000)(unsigned int *free, unsigned int *total);
|
| 651 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAlloc_v2000)(CUdeviceptr_v1 *dptr, unsigned int bytesize);
|
| 652 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAllocPitch_v2000)(CUdeviceptr_v1 *dptr, unsigned int *pPitch, unsigned int WidthInBytes, unsigned int Height, unsigned int ElementSizeBytes);
|
| 653 |
+
typedef CUresult (CUDAAPI *PFN_cuMemFree_v2000)(CUdeviceptr_v1 dptr);
|
| 654 |
+
typedef CUresult (CUDAAPI *PFN_cuMemGetAddressRange_v2000)(CUdeviceptr_v1 *pbase, unsigned int *psize, CUdeviceptr_v1 dptr);
|
| 655 |
+
typedef CUresult (CUDAAPI *PFN_cuMemAllocHost_v2000)(void **pp, unsigned int bytesize);
|
| 656 |
+
typedef CUresult (CUDAAPI *PFN_cuMemHostGetDevicePointer_v2020)(CUdeviceptr_v1 *pdptr, void *p, unsigned int Flags);
|
| 657 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoD_v2000)(CUdeviceptr_v1 dstDevice, const void *srcHost, unsigned int ByteCount);
|
| 658 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoH_v2000)(void *dstHost, CUdeviceptr_v1 srcDevice, unsigned int ByteCount);
|
| 659 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoD_v2000)(CUdeviceptr_v1 dstDevice, CUdeviceptr_v1 srcDevice, unsigned int ByteCount);
|
| 660 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoA_v2000)(CUarray dstArray, unsigned int dstOffset, CUdeviceptr_v1 srcDevice, unsigned int ByteCount);
|
| 661 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoD_v2000)(CUdeviceptr_v1 dstDevice, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount);
|
| 662 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoA_v2000)(CUarray dstArray, unsigned int dstOffset, const void *srcHost, unsigned int ByteCount);
|
| 663 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoH_v2000)(void *dstHost, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount);
|
| 664 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoA_v2000)(CUarray dstArray, unsigned int dstOffset, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount);
|
| 665 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoAAsync_v2000)(CUarray dstArray, unsigned int dstOffset, const void *srcHost, unsigned int ByteCount, CUstream hStream);
|
| 666 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyAtoHAsync_v2000)(void *dstHost, CUarray srcArray, unsigned int srcOffset, unsigned int ByteCount, CUstream hStream);
|
| 667 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy2D_v2000)(const CUDA_MEMCPY2D_v1 *pCopy);
|
| 668 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy2DUnaligned_v2000)(const CUDA_MEMCPY2D_v1 *pCopy);
|
| 669 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3D_v2000)(const CUDA_MEMCPY3D_v1 *pCopy);
|
| 670 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyHtoDAsync_v2000)(CUdeviceptr_v1 dstDevice, const void *srcHost, unsigned int ByteCount, CUstream hStream);
|
| 671 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoHAsync_v2000)(void *dstHost, CUdeviceptr_v1 srcDevice, unsigned int ByteCount, CUstream hStream);
|
| 672 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpyDtoDAsync_v3000)(CUdeviceptr_v1 dstDevice, CUdeviceptr_v1 srcDevice, unsigned int ByteCount, CUstream hStream);
|
| 673 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy2DAsync_v2000)(const CUDA_MEMCPY2D_v1 *pCopy, CUstream hStream);
|
| 674 |
+
typedef CUresult (CUDAAPI *PFN_cuMemcpy3DAsync_v2000)(const CUDA_MEMCPY3D_v1 *pCopy, CUstream hStream);
|
| 675 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD8_v2000)(CUdeviceptr_v1 dstDevice, unsigned char uc, unsigned int N);
|
| 676 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD16_v2000)(CUdeviceptr_v1 dstDevice, unsigned short us, unsigned int N);
|
| 677 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD32_v2000)(CUdeviceptr_v1 dstDevice, unsigned int ui, unsigned int N);
|
| 678 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D8_v2000)(CUdeviceptr_v1 dstDevice, unsigned int dstPitch, unsigned char uc, unsigned int Width, unsigned int Height);
|
| 679 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D16_v2000)(CUdeviceptr_v1 dstDevice, unsigned int dstPitch, unsigned short us, unsigned int Width, unsigned int Height);
|
| 680 |
+
typedef CUresult (CUDAAPI *PFN_cuMemsetD2D32_v2000)(CUdeviceptr_v1 dstDevice, unsigned int dstPitch, unsigned int ui, unsigned int Width, unsigned int Height);
|
| 681 |
+
typedef CUresult (CUDAAPI *PFN_cuArrayCreate_v2000)(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR_v1 *pAllocateArray);
|
| 682 |
+
typedef CUresult (CUDAAPI *PFN_cuArrayGetDescriptor_v2000)(CUDA_ARRAY_DESCRIPTOR_v1 *pArrayDescriptor, CUarray hArray);
|
| 683 |
+
typedef CUresult (CUDAAPI *PFN_cuArray3DCreate_v2000)(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR_v1 *pAllocateArray);
|
| 684 |
+
typedef CUresult (CUDAAPI *PFN_cuArray3DGetDescriptor_v2000)(CUDA_ARRAY3D_DESCRIPTOR_v1 *pArrayDescriptor, CUarray hArray);
|
| 685 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress_v2000)(unsigned int *ByteOffset, CUtexref hTexRef, CUdeviceptr_v1 dptr, unsigned int bytes);
|
| 686 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefSetAddress2D_v2020)(CUtexref hTexRef, const CUDA_ARRAY_DESCRIPTOR_v1 *desc, CUdeviceptr_v1 dptr, unsigned int Pitch);
|
| 687 |
+
typedef CUresult (CUDAAPI *PFN_cuTexRefGetAddress_v2000)(CUdeviceptr_v1 *pdptr, CUtexref hTexRef);
|
| 688 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsResourceGetMappedPointer_v3000)(CUdeviceptr_v1 *pDevPtr, unsigned int *pSize, CUgraphicsResource resource);
|
| 689 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxDestroy_v2000)(CUcontext ctx);
|
| 690 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxPopCurrent_v2000)(CUcontext *pctx);
|
| 691 |
+
typedef CUresult (CUDAAPI *PFN_cuCtxPushCurrent_v2000)(CUcontext ctx);
|
| 692 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamDestroy_v2000)(CUstream hStream);
|
| 693 |
+
typedef CUresult (CUDAAPI *PFN_cuEventDestroy_v2000)(CUevent hEvent);
|
| 694 |
+
typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxRelease_v7000)(CUdevice_v1 dev);
|
| 695 |
+
typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxReset_v7000)(CUdevice_v1 dev);
|
| 696 |
+
typedef CUresult (CUDAAPI *PFN_cuDevicePrimaryCtxSetFlags_v7000)(CUdevice_v1 dev, unsigned int flags);
|
| 697 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBeginCapture_v10000)(CUstream hStream);
|
| 698 |
+
typedef CUresult (CUDAAPI *PFN_cuStreamBeginCapture_v10000_ptsz)(CUstream hStream);
|
| 699 |
+
typedef CUresult (CUDAAPI *PFN_cuIpcOpenMemHandle_v4010)(CUdeviceptr_v2 *pdptr, CUipcMemHandle_v1 handle, unsigned int Flags);
|
| 700 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphInstantiate_v10000)(CUgraphExec *phGraphExec, CUgraph hGraph, CUgraphNode *phErrorNode, char *logBuffer, size_t bufferSize);
|
| 701 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphInstantiate_v11000)(CUgraphExec *phGraphExec, CUgraph hGraph, CUgraphNode *phErrorNode, char *logBuffer, size_t bufferSize);
|
| 702 |
+
#endif
|
| 703 |
+
|
| 704 |
+
typedef CUresult (CUDAAPI *PFN_cuCheckpointProcessGetRestoreThreadId_v12080)(int pid, int *tid);
|
| 705 |
+
typedef CUresult (CUDAAPI *PFN_cuCheckpointProcessGetState_v12080)(int pid, CUprocessState *state);
|
| 706 |
+
typedef CUresult (CUDAAPI *PFN_cuCheckpointProcessLock_v12080)(int pid, CUcheckpointLockArgs *args);
|
| 707 |
+
typedef CUresult (CUDAAPI *PFN_cuCheckpointProcessCheckpoint_v12080)(int pid, CUcheckpointCheckpointArgs *args);
|
| 708 |
+
typedef CUresult (CUDAAPI *PFN_cuCheckpointProcessRestore_v12080)(int pid, CUcheckpointRestoreArgs *args);
|
| 709 |
+
typedef CUresult (CUDAAPI *PFN_cuCheckpointProcessUnlock_v12080)(int pid, CUcheckpointUnlockArgs *args);
|
| 710 |
+
|
| 711 |
+
#ifdef __cplusplus
|
| 712 |
+
}
|
| 713 |
+
#endif // __cplusplus
|
| 714 |
+
|
| 715 |
+
#endif // file guard
|
lib/python3.11/site-packages/nvidia/cu13/include/cudaVDPAU.h
ADDED
|
@@ -0,0 +1,282 @@
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2010-2014 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef CUDAVDPAU_H
|
| 51 |
+
#define CUDAVDPAU_H
|
| 52 |
+
|
| 53 |
+
#ifdef CUDA_FORCE_API_VERSION
|
| 54 |
+
#error "CUDA_FORCE_API_VERSION is no longer supported."
|
| 55 |
+
#endif
|
| 56 |
+
|
| 57 |
+
#define cuVDPAUCtxCreate cuVDPAUCtxCreate_v2
|
| 58 |
+
|
| 59 |
+
#ifdef __cplusplus
|
| 60 |
+
extern "C" {
|
| 61 |
+
#endif
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* \defgroup CUDA_VDPAU VDPAU Interoperability
|
| 65 |
+
* \ingroup CUDA_DRIVER
|
| 66 |
+
*
|
| 67 |
+
* ___MANBRIEF___ VDPAU interoperability functions of the low-level CUDA driver
|
| 68 |
+
* API (___CURRENT_FILE___) ___ENDMANBRIEF___
|
| 69 |
+
*
|
| 70 |
+
* This section describes the VDPAU interoperability functions of the
|
| 71 |
+
* low-level CUDA driver application programming interface.
|
| 72 |
+
*
|
| 73 |
+
* @{
|
| 74 |
+
*/
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* \brief Gets the CUDA device associated with a VDPAU device
|
| 78 |
+
*
|
| 79 |
+
* Returns in \p *pDevice the CUDA device associated with a \p vdpDevice, if
|
| 80 |
+
* applicable.
|
| 81 |
+
*
|
| 82 |
+
* \param pDevice - Device associated with vdpDevice
|
| 83 |
+
* \param vdpDevice - A VdpDevice handle
|
| 84 |
+
* \param vdpGetProcAddress - VDPAU's VdpGetProcAddress function pointer
|
| 85 |
+
*
|
| 86 |
+
* \return
|
| 87 |
+
* ::CUDA_SUCCESS,
|
| 88 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 89 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 90 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 91 |
+
* ::CUDA_ERROR_INVALID_VALUE
|
| 92 |
+
* \notefnerr
|
| 93 |
+
*
|
| 94 |
+
* \sa ::cuCtxCreate, ::cuVDPAUCtxCreate, ::cuGraphicsVDPAURegisterVideoSurface,
|
| 95 |
+
* ::cuGraphicsVDPAURegisterOutputSurface, ::cuGraphicsUnregisterResource,
|
| 96 |
+
* ::cuGraphicsResourceSetMapFlags, ::cuGraphicsMapResources,
|
| 97 |
+
* ::cuGraphicsUnmapResources, ::cuGraphicsSubResourceGetMappedArray,
|
| 98 |
+
* ::cudaVDPAUGetDevice
|
| 99 |
+
*/
|
| 100 |
+
CUresult CUDAAPI cuVDPAUGetDevice(CUdevice *pDevice, VdpDevice vdpDevice, VdpGetProcAddress *vdpGetProcAddress);
|
| 101 |
+
|
| 102 |
+
/**
|
| 103 |
+
* \brief Create a CUDA context for interoperability with VDPAU
|
| 104 |
+
*
|
| 105 |
+
* Creates a new CUDA context, initializes VDPAU interoperability, and
|
| 106 |
+
* associates the CUDA context with the calling thread. It must be called
|
| 107 |
+
* before performing any other VDPAU interoperability operations. It may fail
|
| 108 |
+
* if the needed VDPAU driver facilities are not available. For usage of the
|
| 109 |
+
* \p flags parameter, see ::cuCtxCreate().
|
| 110 |
+
*
|
| 111 |
+
* \param pCtx - Returned CUDA context
|
| 112 |
+
* \param flags - Options for CUDA context creation
|
| 113 |
+
* \param device - Device on which to create the context
|
| 114 |
+
* \param vdpDevice - The VdpDevice to interop with
|
| 115 |
+
* \param vdpGetProcAddress - VDPAU's VdpGetProcAddress function pointer
|
| 116 |
+
*
|
| 117 |
+
* \return
|
| 118 |
+
* ::CUDA_SUCCESS,
|
| 119 |
+
* ::CUDA_ERROR_DEINITIALIZED,
|
| 120 |
+
* ::CUDA_ERROR_NOT_INITIALIZED,
|
| 121 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 122 |
+
* ::CUDA_ERROR_INVALID_VALUE,
|
| 123 |
+
* ::CUDA_ERROR_OUT_OF_MEMORY
|
| 124 |
+
* \notefnerr
|
| 125 |
+
*
|
| 126 |
+
* \sa ::cuCtxCreate, ::cuGraphicsVDPAURegisterVideoSurface,
|
| 127 |
+
* ::cuGraphicsVDPAURegisterOutputSurface, ::cuGraphicsUnregisterResource,
|
| 128 |
+
* ::cuGraphicsResourceSetMapFlags, ::cuGraphicsMapResources,
|
| 129 |
+
* ::cuGraphicsUnmapResources, ::cuGraphicsSubResourceGetMappedArray,
|
| 130 |
+
* ::cuVDPAUGetDevice
|
| 131 |
+
*/
|
| 132 |
+
CUresult CUDAAPI cuVDPAUCtxCreate(CUcontext *pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress *vdpGetProcAddress);
|
| 133 |
+
|
| 134 |
+
/**
|
| 135 |
+
* \brief Registers a VDPAU VdpVideoSurface object
|
| 136 |
+
*
|
| 137 |
+
* Registers the VdpVideoSurface specified by \p vdpSurface for access by
|
| 138 |
+
* CUDA. A handle to the registered object is returned as \p pCudaResource.
|
| 139 |
+
* The surface's intended usage is specified using \p flags, as follows:
|
| 140 |
+
*
|
| 141 |
+
* - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE: Specifies no hints about how this
|
| 142 |
+
* resource will be used. It is therefore assumed that this resource will be
|
| 143 |
+
* read from and written to by CUDA. This is the default value.
|
| 144 |
+
* - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY: Specifies that CUDA
|
| 145 |
+
* will not write to this resource.
|
| 146 |
+
* - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD: Specifies that
|
| 147 |
+
* CUDA will not read from this resource and will write over the
|
| 148 |
+
* entire contents of the resource, so none of the data previously
|
| 149 |
+
* stored in the resource will be preserved.
|
| 150 |
+
*
|
| 151 |
+
* The VdpVideoSurface is presented as an array of subresources that may be
|
| 152 |
+
* accessed using pointers returned by ::cuGraphicsSubResourceGetMappedArray.
|
| 153 |
+
* The exact number of valid \p arrayIndex values depends on the VDPAU surface
|
| 154 |
+
* format. The mapping is shown in the table below. \p mipLevel must be 0.
|
| 155 |
+
*
|
| 156 |
+
* \htmlonly
|
| 157 |
+
* <table>
|
| 158 |
+
* <tr><th>VdpChromaType </th><th>arrayIndex</th><th>Size </th><th>Format</th><th>Content </th></tr>
|
| 159 |
+
* <tr><td rowspan="4" valign="top">VDP_CHROMA_TYPE_420</td><td>0 </td><td>w x h/2</td><td>R8 </td><td>Top-field luma </td></tr>
|
| 160 |
+
* <tr> <td>1 </td><td>w x h/2</td><td>R8 </td><td>Bottom-field luma </td></tr>
|
| 161 |
+
* <tr> <td>2 </td><td>w/2 x h/4</td><td>R8G8 </td><td>Top-field chroma </td></tr>
|
| 162 |
+
* <tr> <td>3 </td><td>w/2 x h/4</td><td>R8G8 </td><td>Bottom-field chroma</td></tr>
|
| 163 |
+
* <tr><td rowspan="4" valign="top">VDP_CHROMA_TYPE_422</td><td>0 </td><td>w x h/2</td><td>R8 </td><td>Top-field luma </td></tr>
|
| 164 |
+
* <tr> <td>1 </td><td>w x h/2</td><td>R8 </td><td>Bottom-field luma </td></tr>
|
| 165 |
+
* <tr> <td>2 </td><td>w/2 x h/2</td><td>R8G8 </td><td>Top-field chroma </td></tr>
|
| 166 |
+
* <tr> <td>3 </td><td>w/2 x h/2</td><td>R8G8 </td><td>Bottom-field chroma</td></tr>
|
| 167 |
+
* </table>
|
| 168 |
+
* \endhtmlonly
|
| 169 |
+
*
|
| 170 |
+
* \latexonly
|
| 171 |
+
* \begin{tabular}{|l|l|l|l|l|}
|
| 172 |
+
* \hline
|
| 173 |
+
* VdpChromaType & arrayIndex & Size & Format & Content \\
|
| 174 |
+
* \hline
|
| 175 |
+
* VDP\_CHROMA\_TYPE\_420 & 0 & w x h/2 & R8 & Top-field luma \\
|
| 176 |
+
* & 1 & w x h/2 & R8 & Bottom-field luma \\
|
| 177 |
+
* & 2 & w/2 x h/4 & R8G8 & Top-field chroma \\
|
| 178 |
+
* & 3 & w/2 x h/4 & R8G8 & Bottom-field chroma \\
|
| 179 |
+
* \hline
|
| 180 |
+
* VDP\_CHROMA\_TYPE\_422 & 0 & w x h/2 & R8 & Top-field luma \\
|
| 181 |
+
* & 1 & w x h/2 & R8 & Bottom-field luma \\
|
| 182 |
+
* & 2 & w/2 x h/2 & R8G8 & Top-field chroma \\
|
| 183 |
+
* & 3 & w/2 x h/2 & R8G8 & Bottom-field chroma \\
|
| 184 |
+
* \hline
|
| 185 |
+
* \end{tabular}
|
| 186 |
+
* \endlatexonly
|
| 187 |
+
*
|
| 188 |
+
* \param pCudaResource - Pointer to the returned object handle
|
| 189 |
+
* \param vdpSurface - The VdpVideoSurface to be registered
|
| 190 |
+
* \param flags - Map flags
|
| 191 |
+
*
|
| 192 |
+
* \return
|
| 193 |
+
* ::CUDA_SUCCESS,
|
| 194 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 195 |
+
* ::CUDA_ERROR_ALREADY_MAPPED,
|
| 196 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 197 |
+
* \notefnerr
|
| 198 |
+
*
|
| 199 |
+
* \sa ::cuCtxCreate, ::cuVDPAUCtxCreate,
|
| 200 |
+
* ::cuGraphicsVDPAURegisterOutputSurface, ::cuGraphicsUnregisterResource,
|
| 201 |
+
* ::cuGraphicsResourceSetMapFlags, ::cuGraphicsMapResources,
|
| 202 |
+
* ::cuGraphicsUnmapResources, ::cuGraphicsSubResourceGetMappedArray,
|
| 203 |
+
* ::cuVDPAUGetDevice,
|
| 204 |
+
* ::cudaGraphicsVDPAURegisterVideoSurface
|
| 205 |
+
*/
|
| 206 |
+
CUresult CUDAAPI cuGraphicsVDPAURegisterVideoSurface(CUgraphicsResource *pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags);
|
| 207 |
+
|
| 208 |
+
/**
|
| 209 |
+
* \brief Registers a VDPAU VdpOutputSurface object
|
| 210 |
+
*
|
| 211 |
+
* Registers the VdpOutputSurface specified by \p vdpSurface for access by
|
| 212 |
+
* CUDA. A handle to the registered object is returned as \p pCudaResource.
|
| 213 |
+
* The surface's intended usage is specified using \p flags, as follows:
|
| 214 |
+
*
|
| 215 |
+
* - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE: Specifies no hints about how this
|
| 216 |
+
* resource will be used. It is therefore assumed that this resource will be
|
| 217 |
+
* read from and written to by CUDA. This is the default value.
|
| 218 |
+
* - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY: Specifies that CUDA
|
| 219 |
+
* will not write to this resource.
|
| 220 |
+
* - ::CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD: Specifies that
|
| 221 |
+
* CUDA will not read from this resource and will write over the
|
| 222 |
+
* entire contents of the resource, so none of the data previously
|
| 223 |
+
* stored in the resource will be preserved.
|
| 224 |
+
*
|
| 225 |
+
* The VdpOutputSurface is presented as an array of subresources that may be
|
| 226 |
+
* accessed using pointers returned by ::cuGraphicsSubResourceGetMappedArray.
|
| 227 |
+
* The exact number of valid \p arrayIndex values depends on the VDPAU surface
|
| 228 |
+
* format. The mapping is shown in the table below. \p mipLevel must be 0.
|
| 229 |
+
*
|
| 230 |
+
* \htmlonly
|
| 231 |
+
* <table>
|
| 232 |
+
* <tr><th>VdpRGBAFormat </th><th>arrayIndex</th><th>Size </th><th>Format </th><th>Content </th></tr>
|
| 233 |
+
* <tr><td>VDP_RGBA_FORMAT_B8G8R8A8 </td><td>0 </td><td>w x h</td><td>ARGB8 </td><td>Entire surface</td></tr>
|
| 234 |
+
* <tr><td>VDP_RGBA_FORMAT_R10G10B10A2</td><td>0 </td><td>w x h</td><td>A2BGR10</td><td>Entire surface</td></tr>
|
| 235 |
+
* </table>
|
| 236 |
+
* \endhtmlonly
|
| 237 |
+
*
|
| 238 |
+
* \latexonly
|
| 239 |
+
* \begin{tabular}{|l|l|l|l|l|}
|
| 240 |
+
* \hline
|
| 241 |
+
* VdpRGBAFormat & arrayIndex & Size & Format & Content \\
|
| 242 |
+
* \hline
|
| 243 |
+
* VDP\_RGBA\_FORMAT\_B8G8R8A8 & 0 & w x h & ARGB8 & Entire surface \\
|
| 244 |
+
* VDP\_RGBA\_FORMAT\_R10G10B10A2 & 0 & w x h & A2BGR10 & Entire surface \\
|
| 245 |
+
* \hline
|
| 246 |
+
* \end{tabular}
|
| 247 |
+
* \endlatexonly
|
| 248 |
+
*
|
| 249 |
+
* \param pCudaResource - Pointer to the returned object handle
|
| 250 |
+
* \param vdpSurface - The VdpOutputSurface to be registered
|
| 251 |
+
* \param flags - Map flags
|
| 252 |
+
*
|
| 253 |
+
* \return
|
| 254 |
+
* ::CUDA_SUCCESS,
|
| 255 |
+
* ::CUDA_ERROR_INVALID_HANDLE,
|
| 256 |
+
* ::CUDA_ERROR_ALREADY_MAPPED,
|
| 257 |
+
* ::CUDA_ERROR_INVALID_CONTEXT,
|
| 258 |
+
* \notefnerr
|
| 259 |
+
*
|
| 260 |
+
* \sa ::cuCtxCreate, ::cuVDPAUCtxCreate,
|
| 261 |
+
* ::cuGraphicsVDPAURegisterVideoSurface, ::cuGraphicsUnregisterResource,
|
| 262 |
+
* ::cuGraphicsResourceSetMapFlags, ::cuGraphicsMapResources,
|
| 263 |
+
* ::cuGraphicsUnmapResources, ::cuGraphicsSubResourceGetMappedArray,
|
| 264 |
+
* ::cuVDPAUGetDevice,
|
| 265 |
+
* ::cudaGraphicsVDPAURegisterOutputSurface
|
| 266 |
+
*/
|
| 267 |
+
CUresult CUDAAPI cuGraphicsVDPAURegisterOutputSurface(CUgraphicsResource *pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags);
|
| 268 |
+
|
| 269 |
+
/** @} */ /* END CUDA_VDPAU */
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
#if defined(__CUDA_API_VERSION_INTERNAL)
|
| 273 |
+
#undef cuVDPAUCtxCreate
|
| 274 |
+
|
| 275 |
+
CUresult CUDAAPI cuVDPAUCtxCreate(CUcontext *pCtx, unsigned int flags, CUdevice device, VdpDevice vdpDevice, VdpGetProcAddress *vdpGetProcAddress);
|
| 276 |
+
#endif /* __CUDA_API_VERSION_INTERNAL */
|
| 277 |
+
|
| 278 |
+
#ifdef __cplusplus
|
| 279 |
+
};
|
| 280 |
+
#endif
|
| 281 |
+
|
| 282 |
+
#endif
|
lib/python3.11/site-packages/nvidia/cu13/include/cudaVDPAUTypedefs.h
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2020-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef CUDAVDPAUTYPEDEFS_H
|
| 51 |
+
#define CUDAVDPAUTYPEDEFS_H
|
| 52 |
+
|
| 53 |
+
// Dependent includes for cudavdpau.h
|
| 54 |
+
#include <vdpau/vdpau.h>
|
| 55 |
+
|
| 56 |
+
#include <cudaVDPAU.h>
|
| 57 |
+
|
| 58 |
+
#ifdef __cplusplus
|
| 59 |
+
extern "C" {
|
| 60 |
+
#endif // __cplusplus
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Type definitions for functions defined in cudaVDPAU.h
|
| 64 |
+
*/
|
| 65 |
+
typedef CUresult (CUDAAPI *PFN_cuVDPAUGetDevice_v3010)(CUdevice_v1 *pDevice, VdpDevice vdpDevice, VdpGetProcAddress *vdpGetProcAddress);
|
| 66 |
+
typedef CUresult (CUDAAPI *PFN_cuVDPAUCtxCreate_v3020)(CUcontext *pCtx, unsigned int flags, CUdevice_v1 device, VdpDevice vdpDevice, VdpGetProcAddress *vdpGetProcAddress);
|
| 67 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsVDPAURegisterVideoSurface_v3010)(CUgraphicsResource *pCudaResource, VdpVideoSurface vdpSurface, unsigned int flags);
|
| 68 |
+
typedef CUresult (CUDAAPI *PFN_cuGraphicsVDPAURegisterOutputSurface_v3010)(CUgraphicsResource *pCudaResource, VdpOutputSurface vdpSurface, unsigned int flags);
|
| 69 |
+
|
| 70 |
+
/*
|
| 71 |
+
* Type definitions for older versioned functions in cudaVDPAU.h
|
| 72 |
+
*/
|
| 73 |
+
#if defined(__CUDA_API_VERSION_INTERNAL)
|
| 74 |
+
typedef CUresult (CUDAAPI *PFN_cuVDPAUCtxCreate_v3010)(CUcontext *pCtx, unsigned int flags, CUdevice_v1 device, VdpDevice vdpDevice, VdpGetProcAddress *vdpGetProcAddress);
|
| 75 |
+
#endif
|
| 76 |
+
|
| 77 |
+
#ifdef __cplusplus
|
| 78 |
+
}
|
| 79 |
+
#endif // __cplusplus
|
| 80 |
+
|
| 81 |
+
#endif // file guard
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda_awbarrier.h
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2019 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef _CUDA_AWBARRIER_H_
|
| 51 |
+
# define _CUDA_AWBARRIER_H_
|
| 52 |
+
|
| 53 |
+
# include "cuda_awbarrier_primitives.h"
|
| 54 |
+
|
| 55 |
+
# if !defined(_CUDA_AWBARRIER_SM_TARGET)
|
| 56 |
+
# error This file requires compute capability 7.0 or greater.
|
| 57 |
+
# endif
|
| 58 |
+
|
| 59 |
+
# if !defined(_CUDA_AWBARRIER_CPLUSPLUS_11_OR_LATER)
|
| 60 |
+
# error This file requires compiler support for the ISO C++ 2011 standard. This support must be enabled with the \
|
| 61 |
+
-std=c++11 compiler option.
|
| 62 |
+
# endif
|
| 63 |
+
|
| 64 |
+
_CUDA_AWBARRIER_BEGIN_NAMESPACE
|
| 65 |
+
|
| 66 |
+
class awbarrier {
|
| 67 |
+
public:
|
| 68 |
+
class arrival_token {
|
| 69 |
+
public:
|
| 70 |
+
arrival_token() = default;
|
| 71 |
+
~arrival_token() = default;
|
| 72 |
+
_CUDA_AWBARRIER_QUALIFIER uint32_t pending_count() const;
|
| 73 |
+
private:
|
| 74 |
+
_CUDA_AWBARRIER_QUALIFIER arrival_token(uint64_t token);
|
| 75 |
+
uint64_t token;
|
| 76 |
+
friend awbarrier;
|
| 77 |
+
};
|
| 78 |
+
awbarrier() = default;
|
| 79 |
+
awbarrier(const awbarrier&) = delete;
|
| 80 |
+
awbarrier& operator=(const awbarrier&) = delete;
|
| 81 |
+
~awbarrier() = default;
|
| 82 |
+
|
| 83 |
+
_CUDA_AWBARRIER_QUALIFIER arrival_token arrive();
|
| 84 |
+
_CUDA_AWBARRIER_QUALIFIER arrival_token arrive_and_drop();
|
| 85 |
+
_CUDA_AWBARRIER_QUALIFIER bool timed_wait(arrival_token token, uint32_t hint_cycles);
|
| 86 |
+
_CUDA_AWBARRIER_QUALIFIER bool timed_wait_parity(bool phase, uint32_t hint_cycles);
|
| 87 |
+
_CUDA_AWBARRIER_QUALIFIER void wait(arrival_token token);
|
| 88 |
+
_CUDA_AWBARRIER_QUALIFIER void arrive_and_wait();
|
| 89 |
+
_CUDA_AWBARRIER_QUALIFIER bool try_wait(arrival_token token, uint32_t maxSleepNanosec);
|
| 90 |
+
_CUDA_AWBARRIER_QUALIFIER bool try_wait_parity(bool phase, uint32_t maxSleepNanosec);
|
| 91 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER __host__ constexpr uint32_t max();
|
| 92 |
+
|
| 93 |
+
private:
|
| 94 |
+
uint64_t barrier;
|
| 95 |
+
friend _CUDA_AWBARRIER_QUALIFIER void init(awbarrier* barrier, uint32_t expected_count);
|
| 96 |
+
friend _CUDA_AWBARRIER_QUALIFIER void inval(awbarrier* barrier);
|
| 97 |
+
friend class pipeline;
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 101 |
+
uint32_t awbarrier::arrival_token::pending_count() const
|
| 102 |
+
{
|
| 103 |
+
const uint32_t pending_count = _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_token_pending_count(this->token);
|
| 104 |
+
#if (__CUDA_ARCH__ >= 900)
|
| 105 |
+
return pending_count;
|
| 106 |
+
#else
|
| 107 |
+
return (pending_count >> 15);
|
| 108 |
+
#endif
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 112 |
+
awbarrier::arrival_token::arrival_token(uint64_t token)
|
| 113 |
+
: token(token)
|
| 114 |
+
{
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 118 |
+
void init(awbarrier* barrier, uint32_t expected_count)
|
| 119 |
+
{
|
| 120 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 121 |
+
_CUDA_AWBARRIER_ASSERT(expected_count > 0 && expected_count <= _CUDA_AWBARRIER_MAX_COUNT);
|
| 122 |
+
|
| 123 |
+
#if (__CUDA_ARCH__ >= 900)
|
| 124 |
+
const uint32_t init_count = expected_count;
|
| 125 |
+
#else
|
| 126 |
+
const uint32_t init_count = (expected_count << 15) + expected_count;
|
| 127 |
+
#endif
|
| 128 |
+
|
| 129 |
+
_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_init(&barrier->barrier, init_count);
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 133 |
+
void inval(awbarrier* barrier)
|
| 134 |
+
{
|
| 135 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 136 |
+
|
| 137 |
+
_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_inval(&barrier->barrier);
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 141 |
+
awbarrier::arrival_token awbarrier::arrive()
|
| 142 |
+
{
|
| 143 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier));
|
| 144 |
+
|
| 145 |
+
#if (__CUDA_ARCH__ < 900)
|
| 146 |
+
const uint32_t arrive_count = 1 << 15;
|
| 147 |
+
const uint64_t token = _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop_no_complete<false>(&this->barrier, arrive_count);
|
| 148 |
+
(void)
|
| 149 |
+
#else
|
| 150 |
+
const uint64_t token =
|
| 151 |
+
#endif
|
| 152 |
+
_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop<false>(&this->barrier);
|
| 153 |
+
|
| 154 |
+
return arrival_token(token);
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 158 |
+
awbarrier::arrival_token awbarrier::arrive_and_drop()
|
| 159 |
+
{
|
| 160 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier));
|
| 161 |
+
|
| 162 |
+
#if (__CUDA_ARCH__ < 900)
|
| 163 |
+
const uint32_t arrive_count = 1 << 15;
|
| 164 |
+
const uint64_t token = _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop_no_complete<true>(&this->barrier, arrive_count);
|
| 165 |
+
(void)
|
| 166 |
+
#else
|
| 167 |
+
const uint64_t token =
|
| 168 |
+
#endif
|
| 169 |
+
_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop<true>(&this->barrier);
|
| 170 |
+
|
| 171 |
+
return arrival_token(token);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 175 |
+
bool awbarrier::timed_wait(arrival_token token, uint32_t hint_cycles)
|
| 176 |
+
{
|
| 177 |
+
constexpr uint64_t max_busy_wait_cycles = 1024;
|
| 178 |
+
constexpr uint32_t max_sleep_ns = 1 << 20;
|
| 179 |
+
|
| 180 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier));
|
| 181 |
+
|
| 182 |
+
if (_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait(&this->barrier, token.token)) {
|
| 183 |
+
return true;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
uint64_t start_cycles = clock64();
|
| 187 |
+
uint64_t elapsed_cycles = 0;
|
| 188 |
+
uint32_t sleep_ns = 32;
|
| 189 |
+
while (elapsed_cycles < hint_cycles) {
|
| 190 |
+
if (_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait(&this->barrier, token.token)) {
|
| 191 |
+
return true;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
if (elapsed_cycles > max_busy_wait_cycles) {
|
| 195 |
+
__nanosleep(sleep_ns);
|
| 196 |
+
if (sleep_ns < max_sleep_ns) {
|
| 197 |
+
sleep_ns *= 2;
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
elapsed_cycles = clock64() - start_cycles;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
return false;
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 208 |
+
bool awbarrier::timed_wait_parity(bool phase, uint32_t hint_cycles)
|
| 209 |
+
{
|
| 210 |
+
constexpr uint64_t max_busy_wait_cycles = 1024;
|
| 211 |
+
constexpr uint32_t max_sleep_ns = 1 << 20;
|
| 212 |
+
|
| 213 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier));
|
| 214 |
+
|
| 215 |
+
if (_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait_parity(&this->barrier, phase)) {
|
| 216 |
+
return true;
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
uint64_t start_cycles = clock64();
|
| 220 |
+
uint64_t elapsed_cycles = 0;
|
| 221 |
+
uint32_t sleep_ns = 32;
|
| 222 |
+
while (elapsed_cycles < hint_cycles) {
|
| 223 |
+
if (_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait_parity(&this->barrier, phase)) {
|
| 224 |
+
return true;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
if (elapsed_cycles > max_busy_wait_cycles) {
|
| 228 |
+
__nanosleep(sleep_ns);
|
| 229 |
+
if (sleep_ns < max_sleep_ns) {
|
| 230 |
+
sleep_ns *= 2;
|
| 231 |
+
}
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
elapsed_cycles = clock64() - start_cycles;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
return false;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 241 |
+
bool awbarrier::try_wait(arrival_token token, uint32_t maxSleepNanosec)
|
| 242 |
+
{
|
| 243 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier));
|
| 244 |
+
|
| 245 |
+
return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_try_wait(&this->barrier, token.token, maxSleepNanosec);
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 249 |
+
bool awbarrier::try_wait_parity(bool phase, uint32_t maxSleepNanosec)
|
| 250 |
+
{
|
| 251 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier));
|
| 252 |
+
|
| 253 |
+
return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_try_wait_parity(&this->barrier, phase, maxSleepNanosec);
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 257 |
+
void awbarrier::wait(arrival_token token)
|
| 258 |
+
{
|
| 259 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier));
|
| 260 |
+
|
| 261 |
+
while (!timed_wait(token, ~0u));
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
_CUDA_AWBARRIER_QUALIFIER
|
| 265 |
+
void awbarrier::arrive_and_wait()
|
| 266 |
+
{
|
| 267 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(&this->barrier));
|
| 268 |
+
|
| 269 |
+
this->wait(this->arrive());
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
_CUDA_AWBARRIER_QUALIFIER __host__
|
| 273 |
+
constexpr uint32_t awbarrier::max()
|
| 274 |
+
{
|
| 275 |
+
return _CUDA_AWBARRIER_MAX_COUNT;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
_CUDA_AWBARRIER_END_NAMESPACE
|
| 279 |
+
|
| 280 |
+
#endif /* !_CUDA_AWBARRIER_H_ */
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda_awbarrier_helpers.h
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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poration. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef _CUDA_AWBARRIER_HELPERS_H_
|
| 51 |
+
#define _CUDA_AWBARRIER_HELPERS_H_
|
| 52 |
+
|
| 53 |
+
#define _CUDA_AWBARRIER_NAMESPACE nvcuda::experimental
|
| 54 |
+
#define _CUDA_AWBARRIER_BEGIN_NAMESPACE namespace nvcuda { namespace experimental {
|
| 55 |
+
#define _CUDA_AWBARRIER_END_NAMESPACE } }
|
| 56 |
+
|
| 57 |
+
#define _CUDA_AWBARRIER_INTERNAL_NAMESPACE _CUDA_AWBARRIER_NAMESPACE::__awbarrier_internal
|
| 58 |
+
#define _CUDA_AWBARRIER_BEGIN_INTERNAL_NAMESPACE _CUDA_AWBARRIER_BEGIN_NAMESPACE namespace __awbarrier_internal {
|
| 59 |
+
#define _CUDA_AWBARRIER_END_INTERNAL_NAMESPACE } _CUDA_AWBARRIER_END_NAMESPACE
|
| 60 |
+
|
| 61 |
+
# if !defined(_CUDA_AWBARRIER_QUALIFIER)
|
| 62 |
+
# define _CUDA_AWBARRIER_QUALIFIER inline __device__
|
| 63 |
+
# endif
|
| 64 |
+
# if !defined(_CUDA_AWBARRIER_STATIC_QUALIFIER)
|
| 65 |
+
# define _CUDA_AWBARRIER_STATIC_QUALIFIER static inline __device__
|
| 66 |
+
#endif
|
| 67 |
+
|
| 68 |
+
#if defined(__CUDA_ARCH__)
|
| 69 |
+
#if (__CUDA_ARCH__ >= 900)
|
| 70 |
+
# define _CUDA_AWBARRIER_SM_TARGET _CUDA_AWBARRIER_SM_90
|
| 71 |
+
#elif (__CUDA_ARCH__ >= 800)
|
| 72 |
+
# define _CUDA_AWBARRIER_SM_TARGET _CUDA_AWBARRIER_SM_80
|
| 73 |
+
#elif (__CUDA_ARCH__ >= 700)
|
| 74 |
+
# define _CUDA_AWBARRIER_SM_TARGET _CUDA_AWBARRIER_SM_70
|
| 75 |
+
#endif
|
| 76 |
+
#else
|
| 77 |
+
# define _CUDA_AWBARRIER_SM_TARGET _CUDA_AWBARRIER_SM_70
|
| 78 |
+
#endif
|
| 79 |
+
|
| 80 |
+
#define _CUDA_AWBARRIER_MAX_COUNT ((1 << 14) - 1)
|
| 81 |
+
|
| 82 |
+
#if defined(__cplusplus) && ((__cplusplus >= 201103L) || (defined(_MSC_VER) && (_MSC_VER >= 1900)))
|
| 83 |
+
# define _CUDA_AWBARRIER_CPLUSPLUS_11_OR_LATER
|
| 84 |
+
#endif
|
| 85 |
+
|
| 86 |
+
#if !defined(_CUDA_AWBARRIER_DEBUG)
|
| 87 |
+
# if defined(__CUDACC_DEBUG__)
|
| 88 |
+
# define _CUDA_AWBARRIER_DEBUG 1
|
| 89 |
+
# else
|
| 90 |
+
# define _CUDA_AWBARRIER_DEBUG 0
|
| 91 |
+
# endif
|
| 92 |
+
#endif
|
| 93 |
+
|
| 94 |
+
#if defined(_CUDA_AWBARRIER_DEBUG) && (_CUDA_AWBARRIER_DEBUG == 1) && !defined(NDEBUG)
|
| 95 |
+
# if !defined(__CUDACC_RTC__)
|
| 96 |
+
# include <cassert>
|
| 97 |
+
# endif
|
| 98 |
+
# define _CUDA_AWBARRIER_ASSERT(x) assert((x));
|
| 99 |
+
# define _CUDA_AWBARRIER_ABORT() assert(0);
|
| 100 |
+
#else
|
| 101 |
+
# define _CUDA_AWBARRIER_ASSERT(x)
|
| 102 |
+
# define _CUDA_AWBARRIER_ABORT() __trap();
|
| 103 |
+
#endif
|
| 104 |
+
|
| 105 |
+
#if defined(__CUDACC_RTC__)
|
| 106 |
+
typedef unsigned short uint16_t;
|
| 107 |
+
typedef unsigned int uint32_t;
|
| 108 |
+
typedef unsigned long long uint64_t;
|
| 109 |
+
typedef uint64_t uintptr_t;
|
| 110 |
+
#else
|
| 111 |
+
# include <stdint.h>
|
| 112 |
+
#endif
|
| 113 |
+
|
| 114 |
+
// implicitly provided by NVRTC
|
| 115 |
+
#ifndef __CUDACC_RTC__
|
| 116 |
+
#include <nv/target>
|
| 117 |
+
#endif /* !defined(__CUDACC_RTC__) */
|
| 118 |
+
|
| 119 |
+
typedef uint64_t __mbarrier_t;
|
| 120 |
+
typedef uint64_t __mbarrier_token_t;
|
| 121 |
+
|
| 122 |
+
_CUDA_AWBARRIER_BEGIN_INTERNAL_NAMESPACE
|
| 123 |
+
|
| 124 |
+
extern "C" __device__ uint32_t __nvvm_get_smem_pointer(void *);
|
| 125 |
+
|
| 126 |
+
union AWBarrier {
|
| 127 |
+
struct {
|
| 128 |
+
uint32_t expected;
|
| 129 |
+
uint32_t pending;
|
| 130 |
+
} split;
|
| 131 |
+
uint64_t raw;
|
| 132 |
+
};
|
| 133 |
+
|
| 134 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 135 |
+
void awbarrier_init(uint64_t* barrier, uint32_t expected_count) {
|
| 136 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 137 |
+
_CUDA_AWBARRIER_ASSERT(expected_count > 0 && expected_count < (1 << 29));
|
| 138 |
+
|
| 139 |
+
NV_IF_TARGET(NV_PROVIDES_SM_80,
|
| 140 |
+
asm volatile ("mbarrier.init.shared.b64 [%0], %1;"
|
| 141 |
+
:
|
| 142 |
+
: "r"(__nvvm_get_smem_pointer(barrier)), "r"(expected_count)
|
| 143 |
+
: "memory");
|
| 144 |
+
return;
|
| 145 |
+
)
|
| 146 |
+
NV_IF_TARGET(NV_PROVIDES_SM_70,
|
| 147 |
+
AWBarrier* awbarrier = reinterpret_cast<AWBarrier*>(barrier);
|
| 148 |
+
|
| 149 |
+
awbarrier->split.expected = 0x40000000 - expected_count;
|
| 150 |
+
awbarrier->split.pending = 0x80000000 - expected_count;
|
| 151 |
+
return;
|
| 152 |
+
)
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 156 |
+
void awbarrier_inval(uint64_t* barrier) {
|
| 157 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 158 |
+
|
| 159 |
+
NV_IF_TARGET(NV_PROVIDES_SM_80,
|
| 160 |
+
asm volatile ("mbarrier.inval.shared.b64 [%0];"
|
| 161 |
+
:
|
| 162 |
+
: "r"(__nvvm_get_smem_pointer(barrier))
|
| 163 |
+
: "memory");
|
| 164 |
+
return;
|
| 165 |
+
)
|
| 166 |
+
return;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 170 |
+
uint32_t awbarrier_token_pending_count(uint64_t token) {
|
| 171 |
+
NV_IF_TARGET(NV_PROVIDES_SM_80,
|
| 172 |
+
uint32_t __pending_count;
|
| 173 |
+
|
| 174 |
+
asm ("mbarrier.pending_count.b64 %0, %1;"
|
| 175 |
+
: "=r"(__pending_count)
|
| 176 |
+
: "l"(token));
|
| 177 |
+
return __pending_count;
|
| 178 |
+
)
|
| 179 |
+
NV_IF_TARGET(NV_PROVIDES_SM_70,
|
| 180 |
+
const uint32_t pending = token >> 32;
|
| 181 |
+
return 0x80000000 - (pending & 0x7fffffff);
|
| 182 |
+
)
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
template<bool _Drop>
|
| 186 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 187 |
+
uint64_t awbarrier_arrive_drop(uint64_t* barrier) {
|
| 188 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 189 |
+
|
| 190 |
+
NV_IF_TARGET(NV_PROVIDES_SM_80,
|
| 191 |
+
uint64_t token;
|
| 192 |
+
|
| 193 |
+
if (_Drop) {
|
| 194 |
+
asm volatile ("mbarrier.arrive_drop.shared.b64 %0, [%1];"
|
| 195 |
+
: "=l"(token)
|
| 196 |
+
: "r"(__nvvm_get_smem_pointer(barrier))
|
| 197 |
+
: "memory");
|
| 198 |
+
} else {
|
| 199 |
+
asm volatile ("mbarrier.arrive.shared.b64 %0, [%1];"
|
| 200 |
+
: "=l"(token)
|
| 201 |
+
: "r"(__nvvm_get_smem_pointer(barrier))
|
| 202 |
+
: "memory");
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
return token;
|
| 206 |
+
)
|
| 207 |
+
NV_IF_TARGET(NV_PROVIDES_SM_70,
|
| 208 |
+
AWBarrier* awbarrier = reinterpret_cast<AWBarrier*>(barrier);
|
| 209 |
+
|
| 210 |
+
while ((*reinterpret_cast<volatile uint32_t*>(&awbarrier->split.pending) & 0x7fffffff) == 0);
|
| 211 |
+
|
| 212 |
+
if (_Drop) {
|
| 213 |
+
(void)atomicAdd_block(&awbarrier->split.expected, 1);
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
__threadfence_block();
|
| 217 |
+
|
| 218 |
+
const uint32_t old_pending = atomicAdd_block(&awbarrier->split.pending, 1);
|
| 219 |
+
const uint32_t new_pending = old_pending + 1;
|
| 220 |
+
const bool reset = (old_pending ^ new_pending) & 0x80000000;
|
| 221 |
+
|
| 222 |
+
if (reset) {
|
| 223 |
+
__threadfence_block();
|
| 224 |
+
|
| 225 |
+
uint32_t new_expected = *reinterpret_cast<volatile uint32_t*>(&awbarrier->split.expected);
|
| 226 |
+
new_expected &= ~0x40000000;
|
| 227 |
+
if (new_expected & 0x20000000) {
|
| 228 |
+
new_expected |= 0x40000000;
|
| 229 |
+
}
|
| 230 |
+
atomicAdd_block(&awbarrier->split.pending, new_expected);
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
return static_cast<uint64_t>(old_pending) << 32;
|
| 234 |
+
)
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
template<bool _Drop>
|
| 238 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 239 |
+
uint64_t awbarrier_arrive_drop_no_complete(uint64_t* barrier, uint32_t count) {
|
| 240 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 241 |
+
_CUDA_AWBARRIER_ASSERT(count > 0 && count < (1 << 29));
|
| 242 |
+
|
| 243 |
+
NV_IF_TARGET(NV_PROVIDES_SM_80,
|
| 244 |
+
uint64_t token;
|
| 245 |
+
|
| 246 |
+
if (_Drop) {
|
| 247 |
+
asm volatile ("mbarrier.arrive_drop.noComplete.shared.b64 %0, [%1], %2;"
|
| 248 |
+
: "=l"(token)
|
| 249 |
+
: "r"(__nvvm_get_smem_pointer(barrier)), "r"(count)
|
| 250 |
+
: "memory");
|
| 251 |
+
} else {
|
| 252 |
+
asm volatile ("mbarrier.arrive.noComplete.shared.b64 %0, [%1], %2;"
|
| 253 |
+
: "=l"(token)
|
| 254 |
+
: "r"(__nvvm_get_smem_pointer(barrier)), "r"(count)
|
| 255 |
+
: "memory");
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
return token;
|
| 259 |
+
)
|
| 260 |
+
NV_IF_TARGET(NV_PROVIDES_SM_70,
|
| 261 |
+
AWBarrier* awbarrier = reinterpret_cast<AWBarrier*>(barrier);
|
| 262 |
+
|
| 263 |
+
while ((*reinterpret_cast<volatile uint32_t*>(&awbarrier->split.pending) & 0x7fffffff) == 0);
|
| 264 |
+
|
| 265 |
+
if (_Drop) {
|
| 266 |
+
(void)atomicAdd_block(&awbarrier->split.expected, count);
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
return static_cast<uint64_t>(atomicAdd_block(&awbarrier->split.pending, count)) << 32;
|
| 270 |
+
)
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 274 |
+
bool awbarrier_test_wait(uint64_t* barrier, uint64_t token) {
|
| 275 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 276 |
+
|
| 277 |
+
NV_IF_TARGET(NV_PROVIDES_SM_80,
|
| 278 |
+
uint32_t __wait_complete;
|
| 279 |
+
|
| 280 |
+
asm volatile ("{"
|
| 281 |
+
" .reg .pred %%p;"
|
| 282 |
+
" mbarrier.test_wait.shared.b64 %%p, [%1], %2;"
|
| 283 |
+
" selp.b32 %0, 1, 0, %%p;"
|
| 284 |
+
"}"
|
| 285 |
+
: "=r"(__wait_complete)
|
| 286 |
+
: "r"(__nvvm_get_smem_pointer(barrier)), "l"(token)
|
| 287 |
+
: "memory");
|
| 288 |
+
return bool(__wait_complete);
|
| 289 |
+
)
|
| 290 |
+
NV_IF_TARGET(NV_PROVIDES_SM_70,
|
| 291 |
+
volatile AWBarrier* awbarrier = reinterpret_cast<volatile AWBarrier*>(barrier);
|
| 292 |
+
|
| 293 |
+
return ((token >> 32) ^ awbarrier->split.pending) & 0x80000000;
|
| 294 |
+
)
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 298 |
+
bool awbarrier_test_wait_parity(uint64_t* barrier, bool phase_parity) {
|
| 299 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 300 |
+
|
| 301 |
+
NV_IF_TARGET(NV_PROVIDES_SM_90,
|
| 302 |
+
uint32_t __wait_complete = 0;
|
| 303 |
+
|
| 304 |
+
asm volatile ("{"
|
| 305 |
+
".reg .pred %%p;"
|
| 306 |
+
"mbarrier.test_wait.parity.shared.b64 %%p, [%1], %2;"
|
| 307 |
+
"selp.b32 %0, 1, 0, %%p;"
|
| 308 |
+
"}"
|
| 309 |
+
: "=r"(__wait_complete)
|
| 310 |
+
: "r"(__nvvm_get_smem_pointer(barrier)), "r"(static_cast<uint32_t>(phase_parity))
|
| 311 |
+
: "memory");
|
| 312 |
+
|
| 313 |
+
return __wait_complete;
|
| 314 |
+
)
|
| 315 |
+
_CUDA_AWBARRIER_ABORT()
|
| 316 |
+
return false;
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 320 |
+
bool awbarrier_try_wait(uint64_t* barrier, uint64_t token, uint32_t max_sleep_nanosec) {
|
| 321 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 322 |
+
|
| 323 |
+
NV_IF_TARGET(NV_PROVIDES_SM_90,
|
| 324 |
+
uint32_t __wait_complete = 0;
|
| 325 |
+
|
| 326 |
+
asm volatile ("{\n\t"
|
| 327 |
+
".reg .pred p;\n\t"
|
| 328 |
+
"mbarrier.try_wait.shared.b64 p, [%1], %2, %3;\n\t"
|
| 329 |
+
"selp.b32 %0, 1, 0, p;\n\t"
|
| 330 |
+
"}"
|
| 331 |
+
: "=r"(__wait_complete)
|
| 332 |
+
: "r"(__nvvm_get_smem_pointer(barrier)), "l"(token), "r"(max_sleep_nanosec)
|
| 333 |
+
: "memory");
|
| 334 |
+
|
| 335 |
+
return __wait_complete;
|
| 336 |
+
)
|
| 337 |
+
_CUDA_AWBARRIER_ABORT()
|
| 338 |
+
return false;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 342 |
+
bool awbarrier_try_wait_parity(uint64_t* barrier, bool phase_parity, uint32_t max_sleep_nanosec) {
|
| 343 |
+
_CUDA_AWBARRIER_ASSERT(__isShared(barrier));
|
| 344 |
+
|
| 345 |
+
NV_IF_TARGET(NV_PROVIDES_SM_90,
|
| 346 |
+
uint32_t __wait_complete = 0;
|
| 347 |
+
|
| 348 |
+
asm volatile ("{\n\t"
|
| 349 |
+
".reg .pred p;\n\t"
|
| 350 |
+
"mbarrier.try_wait.parity.shared.b64 p, [%1], %2, %3;\n\t"
|
| 351 |
+
"selp.b32 %0, 1, 0, p;\n\t"
|
| 352 |
+
"}"
|
| 353 |
+
: "=r"(__wait_complete)
|
| 354 |
+
: "r"(__nvvm_get_smem_pointer(barrier)), "r"(static_cast<uint32_t>(phase_parity)), "r"(max_sleep_nanosec)
|
| 355 |
+
: "memory");
|
| 356 |
+
|
| 357 |
+
return __wait_complete;
|
| 358 |
+
)
|
| 359 |
+
_CUDA_AWBARRIER_ABORT()
|
| 360 |
+
return false;
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
_CUDA_AWBARRIER_END_INTERNAL_NAMESPACE
|
| 364 |
+
|
| 365 |
+
#endif /* !_CUDA_AWBARRIER_HELPERS_H_ */
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda_awbarrier_primitives.h
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2019 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef _CUDA_AWBARRIER_PRIMITIVES_H_
|
| 51 |
+
#define _CUDA_AWBARRIER_PRIMITIVES_H_
|
| 52 |
+
|
| 53 |
+
#include "cuda_awbarrier_helpers.h"
|
| 54 |
+
|
| 55 |
+
#if !defined(_CUDA_AWBARRIER_SM_TARGET)
|
| 56 |
+
# error This file requires compute capability 7.0 or greater.
|
| 57 |
+
#endif
|
| 58 |
+
|
| 59 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER __host__
|
| 60 |
+
uint32_t __mbarrier_maximum_count() {
|
| 61 |
+
return _CUDA_AWBARRIER_MAX_COUNT;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 65 |
+
void __mbarrier_init(__mbarrier_t* barrier, uint32_t expected_count) {
|
| 66 |
+
_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_init(barrier, expected_count);
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 70 |
+
void __mbarrier_inval(__mbarrier_t* barrier) {
|
| 71 |
+
_CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_inval(barrier);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 75 |
+
__mbarrier_token_t __mbarrier_arrive(__mbarrier_t* barrier) {
|
| 76 |
+
return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop<false>(barrier);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 80 |
+
__mbarrier_token_t __mbarrier_arrive_and_drop(__mbarrier_t* barrier) {
|
| 81 |
+
return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_arrive_drop<true>(barrier);
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 85 |
+
bool __mbarrier_test_wait(__mbarrier_t* barrier, __mbarrier_token_t token) {
|
| 86 |
+
return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait(barrier, token);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 90 |
+
uint32_t __mbarrier_token_pending_count(__mbarrier_token_t token) {
|
| 91 |
+
return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_token_pending_count(token);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 95 |
+
bool __mbarrier_test_wait_parity(__mbarrier_t* barrier, bool phase_parity) {
|
| 96 |
+
return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_test_wait_parity(barrier, phase_parity);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 100 |
+
bool __mbarrier_try_wait(__mbarrier_t* barrier, __mbarrier_token_t token, uint32_t max_sleep_nanosec) {
|
| 101 |
+
return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_try_wait(barrier, token, max_sleep_nanosec);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
_CUDA_AWBARRIER_STATIC_QUALIFIER
|
| 105 |
+
bool __mbarrier_try_wait_parity(__mbarrier_t* barrier, bool phase_parity, uint32_t max_sleep_nanosec) {
|
| 106 |
+
return _CUDA_AWBARRIER_INTERNAL_NAMESPACE::awbarrier_try_wait_parity(barrier, phase_parity, max_sleep_nanosec);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
#endif /* !_CUDA_AWBARRIER_PRIMITIVES_H_ */
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda_bf16.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda_bf16.hpp
ADDED
|
The di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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_DEVICE_RUNTIME_API_H__)
|
| 51 |
+
#define __CUDA_DEVICE_RUNTIME_API_H__
|
| 52 |
+
|
| 53 |
+
#if defined(__CUDACC__) && !defined(__CUDACC_RTC__)
|
| 54 |
+
#include <stdlib.h>
|
| 55 |
+
#endif
|
| 56 |
+
|
| 57 |
+
/*******************************************************************************
|
| 58 |
+
* *
|
| 59 |
+
* *
|
| 60 |
+
* *
|
| 61 |
+
*******************************************************************************/
|
| 62 |
+
|
| 63 |
+
#if !defined(CUDA_FORCE_CDP1_IF_SUPPORTED) && !defined(__CUDADEVRT_INTERNAL__) && !defined(_NVHPC_CUDA) && !(defined(_WIN32) && !defined(_WIN64))
|
| 64 |
+
#define __CUDA_INTERNAL_USE_CDP2
|
| 65 |
+
#endif
|
| 66 |
+
|
| 67 |
+
#if !defined(__CUDACC_RTC__)
|
| 68 |
+
|
| 69 |
+
#if !defined(__CUDACC_INTERNAL_NO_STUBS__) && !defined(__CUDACC_RDC__) && !defined(__CUDACC_EWP__) && defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 350) && !defined(__CUDADEVRT_INTERNAL__)
|
| 70 |
+
|
| 71 |
+
#if defined(__cplusplus)
|
| 72 |
+
extern "C" {
|
| 73 |
+
#endif
|
| 74 |
+
|
| 75 |
+
struct cudaFuncAttributes;
|
| 76 |
+
|
| 77 |
+
// Bug 4398304
|
| 78 |
+
// WAR for doxgyen processing duplicate entries causing warnings to be listed in the documentation
|
| 79 |
+
/** \cond impl_private */
|
| 80 |
+
|
| 81 |
+
#ifndef __CUDA_INTERNAL_USE_CDP2
|
| 82 |
+
inline __device__ cudaError_t CUDARTAPI cudaMalloc(void **p, size_t s)
|
| 83 |
+
{
|
| 84 |
+
return cudaErrorUnknown;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
inline __device__ cudaError_t CUDARTAPI cudaFuncGetAttributes(struct cudaFuncAttributes *p, const void *c)
|
| 88 |
+
{
|
| 89 |
+
return cudaErrorUnknown;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
inline __device__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device)
|
| 93 |
+
{
|
| 94 |
+
return cudaErrorUnknown;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
inline __device__ cudaError_t CUDARTAPI cudaGetDevice(int *device)
|
| 98 |
+
{
|
| 99 |
+
return cudaErrorUnknown;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
inline __device__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize)
|
| 103 |
+
{
|
| 104 |
+
return cudaErrorUnknown;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
inline __device__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags)
|
| 108 |
+
{
|
| 109 |
+
return cudaErrorUnknown;
|
| 110 |
+
}
|
| 111 |
+
#else // __CUDA_INTERNAL_USE_CDP2
|
| 112 |
+
inline __device__ cudaError_t CUDARTAPI __cudaCDP2Malloc(void **p, size_t s)
|
| 113 |
+
{
|
| 114 |
+
return cudaErrorUnknown;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
inline __device__ cudaError_t CUDARTAPI __cudaCDP2FuncGetAttributes(struct cudaFuncAttributes *p, const void *c)
|
| 118 |
+
{
|
| 119 |
+
return cudaErrorUnknown;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
inline __device__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device)
|
| 123 |
+
{
|
| 124 |
+
return cudaErrorUnknown;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
inline __device__ cudaError_t CUDARTAPI __cudaCDP2GetDevice(int *device)
|
| 128 |
+
{
|
| 129 |
+
return cudaErrorUnknown;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
inline __device__ cudaError_t CUDARTAPI __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize)
|
| 133 |
+
{
|
| 134 |
+
return cudaErrorUnknown;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
inline __device__ cudaError_t CUDARTAPI __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags)
|
| 138 |
+
{
|
| 139 |
+
return cudaErrorUnknown;
|
| 140 |
+
}
|
| 141 |
+
#endif // __CUDA_INTERNAL_USE_CDP2
|
| 142 |
+
|
| 143 |
+
/** \endcond */
|
| 144 |
+
|
| 145 |
+
#if defined(__cplusplus)
|
| 146 |
+
}
|
| 147 |
+
#endif
|
| 148 |
+
|
| 149 |
+
#endif /* !defined(__CUDACC_INTERNAL_NO_STUBS__) && !defined(__CUDACC_RDC__) && !defined(__CUDACC_EWP__) && defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 350) && !defined(__CUDADEVRT_INTERNAL__) */
|
| 150 |
+
|
| 151 |
+
#endif /* !defined(__CUDACC_RTC__) */
|
| 152 |
+
|
| 153 |
+
#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED)
|
| 154 |
+
# define __DEPRECATED__(msg)
|
| 155 |
+
#elif defined(_WIN32)
|
| 156 |
+
# define __DEPRECATED__(msg) __declspec(deprecated(msg))
|
| 157 |
+
#elif (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5 && !defined(__clang__))))
|
| 158 |
+
# define __DEPRECATED__(msg) __attribute__((deprecated))
|
| 159 |
+
#else
|
| 160 |
+
# define __DEPRECATED__(msg) __attribute__((deprecated(msg)))
|
| 161 |
+
#endif
|
| 162 |
+
|
| 163 |
+
#if defined(__CUDA_ARCH__) && !defined(__CDPRT_SUPPRESS_SYNC_DEPRECATION_WARNING)
|
| 164 |
+
# define __CDPRT_DEPRECATED(func_name) __DEPRECATED__("Use of "#func_name" from device code is deprecated. Moreover, such use will cause this module to fail to load on sm_90+ devices. If calls to "#func_name" from device code cannot be removed for older devices at this time, you may guard them with __CUDA_ARCH__ macros to remove them only for sm_90+ devices, making sure to generate code for compute_90 for the macros to take effect. Note that this mitigation will no longer work when support for "#func_name" from device code is eventually dropped for all devices. Disable this warning with -D__CDPRT_SUPPRESS_SYNC_DEPRECATION_WARNING.")
|
| 165 |
+
#else
|
| 166 |
+
# define __CDPRT_DEPRECATED(func_name)
|
| 167 |
+
#endif
|
| 168 |
+
|
| 169 |
+
#if defined(__cplusplus) && defined(__CUDACC__) /* Visible to nvcc front-end only */
|
| 170 |
+
#if !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 350) // Visible to SM>=3.5 and "__host__ __device__" only
|
| 171 |
+
|
| 172 |
+
#include "driver_types.h"
|
| 173 |
+
#include "crt/host_defines.h"
|
| 174 |
+
|
| 175 |
+
#define cudaStreamGraphTailLaunch (cudaStream_t)0x0100000000000000
|
| 176 |
+
#define cudaStreamGraphFireAndForget (cudaStream_t)0x0200000000000000
|
| 177 |
+
#define cudaStreamGraphFireAndForgetAsSibling (cudaStream_t)0x0300000000000000
|
| 178 |
+
|
| 179 |
+
#ifdef __CUDA_INTERNAL_USE_CDP2
|
| 180 |
+
#define cudaStreamTailLaunch ((cudaStream_t)0x3) /**< Per-grid stream with a tail launch semantics. Only applicable when used with CUDA Dynamic Parallelism. */
|
| 181 |
+
#define cudaStreamFireAndForget ((cudaStream_t)0x4) /**< Per-grid stream with a fire-and-forget synchronization behavior. Only applicable when used with CUDA Dynamic Parallelism. */
|
| 182 |
+
#endif
|
| 183 |
+
|
| 184 |
+
extern "C"
|
| 185 |
+
{
|
| 186 |
+
|
| 187 |
+
// Symbols beginning with __cudaCDP* should not be used outside
|
| 188 |
+
// this header file. Instead, compile with -DCUDA_FORCE_CDP1_IF_SUPPORTED if
|
| 189 |
+
// CDP1 support is required.
|
| 190 |
+
|
| 191 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaDeviceSynchronizeDeprecationAvoidance(void);
|
| 192 |
+
|
| 193 |
+
// Bug 4398304
|
| 194 |
+
// WAR for doxgyen processing duplicate entries causing warnings to be listed in the documentation
|
| 195 |
+
/** \cond impl_private */
|
| 196 |
+
|
| 197 |
+
#ifndef __CUDA_INTERNAL_USE_CDP2
|
| 198 |
+
//// CDP1 endpoints
|
| 199 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device);
|
| 200 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit);
|
| 201 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig);
|
| 202 |
+
extern __DEPRECATED__("cudaDeviceGetSharedMemConfig deprecated") __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig);
|
| 203 |
+
#if (__CUDA_ARCH__ < 900) && (defined(CUDA_FORCE_CDP1_IF_SUPPORTED) || (defined(_WIN32) && !defined(_WIN64)))
|
| 204 |
+
// cudaDeviceSynchronize is removed on sm_90+
|
| 205 |
+
extern __device__ __cudart_builtin__ __CDPRT_DEPRECATED(cudaDeviceSynchronize) cudaError_t CUDARTAPI cudaDeviceSynchronize(void);
|
| 206 |
+
#endif
|
| 207 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetLastError(void);
|
| 208 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaPeekAtLastError(void);
|
| 209 |
+
extern __device__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorString(cudaError_t error);
|
| 210 |
+
extern __device__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorName(cudaError_t error);
|
| 211 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDeviceCount(int *count);
|
| 212 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDevice(int *device);
|
| 213 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags);
|
| 214 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamDestroy(cudaStream_t stream);
|
| 215 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags);
|
| 216 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent_ptsz(cudaStream_t stream, cudaEvent_t event, unsigned int flags);
|
| 217 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags);
|
| 218 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord(cudaEvent_t event, cudaStream_t stream);
|
| 219 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord_ptsz(cudaEvent_t event, cudaStream_t stream);
|
| 220 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags);
|
| 221 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags_ptsz(cudaEvent_t event, cudaStream_t stream, unsigned int flags);
|
| 222 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventDestroy(cudaEvent_t event);
|
| 223 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func);
|
| 224 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFree(void *devPtr);
|
| 225 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMalloc(void **devPtr, size_t size);
|
| 226 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream);
|
| 227 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync_ptsz(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream);
|
| 228 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream);
|
| 229 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync_ptsz(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream);
|
| 230 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync(const struct cudaMemcpy3DParms *p, cudaStream_t stream);
|
| 231 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync_ptsz(const struct cudaMemcpy3DParms *p, cudaStream_t stream);
|
| 232 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync(void *devPtr, int value, size_t count, cudaStream_t stream);
|
| 233 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync_ptsz(void *devPtr, int value, size_t count, cudaStream_t stream);
|
| 234 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream);
|
| 235 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync_ptsz(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream);
|
| 236 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream);
|
| 237 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync_ptsz(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream);
|
| 238 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaRuntimeGetVersion(int *runtimeVersion);
|
| 239 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize);
|
| 240 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags);
|
| 241 |
+
#endif // __CUDA_INTERNAL_USE_CDP2
|
| 242 |
+
|
| 243 |
+
//// CDP2 endpoints
|
| 244 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device);
|
| 245 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetLimit(size_t *pValue, enum cudaLimit limit);
|
| 246 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig);
|
| 247 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2DeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig);
|
| 248 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2GetLastError(void);
|
| 249 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2PeekAtLastError(void);
|
| 250 |
+
extern __device__ __cudart_builtin__ const char* CUDARTAPI __cudaCDP2GetErrorString(cudaError_t error);
|
| 251 |
+
extern __device__ __cudart_builtin__ const char* CUDARTAPI __cudaCDP2GetErrorName(cudaError_t error);
|
| 252 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2GetDeviceCount(int *count);
|
| 253 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2GetDevice(int *device);
|
| 254 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2StreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags);
|
| 255 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2StreamDestroy(cudaStream_t stream);
|
| 256 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2StreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags);
|
| 257 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2StreamWaitEvent_ptsz(cudaStream_t stream, cudaEvent_t event, unsigned int flags);
|
| 258 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventCreateWithFlags(cudaEvent_t *event, unsigned int flags);
|
| 259 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventRecord(cudaEvent_t event, cudaStream_t stream);
|
| 260 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventRecord_ptsz(cudaEvent_t event, cudaStream_t stream);
|
| 261 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags);
|
| 262 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventRecordWithFlags_ptsz(cudaEvent_t event, cudaStream_t stream, unsigned int flags);
|
| 263 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2EventDestroy(cudaEvent_t event);
|
| 264 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2FuncGetAttributes(struct cudaFuncAttributes *attr, const void *func);
|
| 265 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Free(void *devPtr);
|
| 266 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Malloc(void **devPtr, size_t size);
|
| 267 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2MemcpyAsync(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream);
|
| 268 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2MemcpyAsync_ptsz(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream);
|
| 269 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memcpy2DAsync(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream);
|
| 270 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memcpy2DAsync_ptsz(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream);
|
| 271 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memcpy3DAsync(const struct cudaMemcpy3DParms *p, cudaStream_t stream);
|
| 272 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memcpy3DAsync_ptsz(const struct cudaMemcpy3DParms *p, cudaStream_t stream);
|
| 273 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2MemsetAsync(void *devPtr, int value, size_t count, cudaStream_t stream);
|
| 274 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2MemsetAsync_ptsz(void *devPtr, int value, size_t count, cudaStream_t stream);
|
| 275 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memset2DAsync(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream);
|
| 276 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memset2DAsync_ptsz(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream);
|
| 277 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream);
|
| 278 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2Memset3DAsync_ptsz(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream);
|
| 279 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2RuntimeGetVersion(int *runtimeVersion);
|
| 280 |
+
extern __device__ __cudart_builtin__ void * CUDARTAPI __cudaCDP2GetParameterBuffer(size_t alignment, size_t size);
|
| 281 |
+
extern __device__ __cudart_builtin__ void * CUDARTAPI __cudaCDP2GetParameterBufferV2(void *func, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize);
|
| 282 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2LaunchDevice_ptsz(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream);
|
| 283 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2LaunchDeviceV2_ptsz(void *parameterBuffer, cudaStream_t stream);
|
| 284 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2LaunchDevice(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream);
|
| 285 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2LaunchDeviceV2(void *parameterBuffer, cudaStream_t stream);
|
| 286 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize);
|
| 287 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags);
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphLaunch(cudaGraphExec_t graphExec, cudaStream_t stream);
|
| 291 |
+
#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM)
|
| 292 |
+
static inline __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphLaunch_ptsz(cudaGraphExec_t graphExec, cudaStream_t stream)
|
| 293 |
+
{
|
| 294 |
+
if (stream == 0) {
|
| 295 |
+
stream = cudaStreamPerThread;
|
| 296 |
+
}
|
| 297 |
+
return cudaGraphLaunch(graphExec, stream);
|
| 298 |
+
}
|
| 299 |
+
#endif
|
| 300 |
+
|
| 301 |
+
/** \endcond */
|
| 302 |
+
|
| 303 |
+
/**
|
| 304 |
+
* \ingroup CUDART_GRAPH
|
| 305 |
+
* \brief Get the currently running device graph id.
|
| 306 |
+
*
|
| 307 |
+
* Get the currently running device graph id.
|
| 308 |
+
* \return Returns the current device graph id, 0 if the call is outside of a device graph.
|
| 309 |
+
* \sa cudaGraphLaunch
|
| 310 |
+
*/
|
| 311 |
+
static inline __device__ __cudart_builtin__ cudaGraphExec_t CUDARTAPI cudaGetCurrentGraphExec(void)
|
| 312 |
+
{
|
| 313 |
+
unsigned long long current_graph_exec;
|
| 314 |
+
asm ("mov.u64 %0, %%current_graph_exec;" : "=l"(current_graph_exec));
|
| 315 |
+
return (cudaGraphExec_t)current_graph_exec;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
/**
|
| 319 |
+
* \ingroup CUDART_GRAPH
|
| 320 |
+
* \brief Updates the kernel parameters of the given kernel node
|
| 321 |
+
*
|
| 322 |
+
* Updates \p size bytes in the kernel parameters of \p node at \p offset to
|
| 323 |
+
* the contents of \p value. \p node must be device-updatable, and must reside upon the same
|
| 324 |
+
* device as the calling kernel.
|
| 325 |
+
*
|
| 326 |
+
* If this function is called for the node's immediate dependent and that dependent is configured
|
| 327 |
+
* for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before
|
| 328 |
+
* kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure
|
| 329 |
+
* that the update is visible to that dependent node before it is launched.
|
| 330 |
+
*
|
| 331 |
+
* \param node - The node to update
|
| 332 |
+
* \param offset - The offset into the params at which to make the update
|
| 333 |
+
* \param value - Buffer containing the params to write
|
| 334 |
+
* \param size - Size in bytes to update
|
| 335 |
+
*
|
| 336 |
+
* \return
|
| 337 |
+
* cudaSuccess,
|
| 338 |
+
* cudaErrorInvalidValue
|
| 339 |
+
* \notefnerr
|
| 340 |
+
*
|
| 341 |
+
* \sa
|
| 342 |
+
* ::cudaGraphKernelNodeSetEnabled,
|
| 343 |
+
* ::cudaGraphKernelNodeSetGridDim,
|
| 344 |
+
* ::cudaGraphKernelNodeUpdatesApply
|
| 345 |
+
*/
|
| 346 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParam(cudaGraphDeviceNode_t node, size_t offset, const void *value , size_t size);
|
| 347 |
+
|
| 348 |
+
/**
|
| 349 |
+
* \ingroup CUDART_GRAPH
|
| 350 |
+
* \brief Enables or disables the given kernel node
|
| 351 |
+
*
|
| 352 |
+
* Enables or disables \p node based upon \p enable. If \p enable is true, the node will be enabled;
|
| 353 |
+
* if it is false, the node will be disabled. Disabled nodes will act as a NOP during execution.
|
| 354 |
+
* \p node must be device-updatable, and must reside upon the same device as the calling kernel.
|
| 355 |
+
*
|
| 356 |
+
* If this function is called for the node's immediate dependent and that dependent is configured
|
| 357 |
+
* for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before
|
| 358 |
+
* kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure
|
| 359 |
+
* that the update is visible to that dependent node before it is launched.
|
| 360 |
+
*
|
| 361 |
+
* \param node - The node to update
|
| 362 |
+
* \param enable - Whether to enable or disable the node
|
| 363 |
+
*
|
| 364 |
+
* \return
|
| 365 |
+
* cudaSuccess,
|
| 366 |
+
* cudaErrorInvalidValue
|
| 367 |
+
* \notefnerr
|
| 368 |
+
*
|
| 369 |
+
* \sa
|
| 370 |
+
* ::cudaGraphKernelNodeSetParam,
|
| 371 |
+
* ::cudaGraphKernelNodeSetGridDim,
|
| 372 |
+
* ::cudaGraphKernelNodeUpdatesApply
|
| 373 |
+
*/
|
| 374 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetEnabled(cudaGraphDeviceNode_t node, bool enable);
|
| 375 |
+
|
| 376 |
+
/**
|
| 377 |
+
* \ingroup CUDART_GRAPH
|
| 378 |
+
* \brief Updates the grid dimensions of the given kernel node
|
| 379 |
+
*
|
| 380 |
+
* Sets the grid dimensions of \p node to \p gridDim. \p node must be device-updatable,
|
| 381 |
+
* and must reside upon the same device as thecalling kernel.
|
| 382 |
+
*
|
| 383 |
+
* If this function is called for the node's immediate dependent and that dependent is configured
|
| 384 |
+
* for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before
|
| 385 |
+
* kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure
|
| 386 |
+
* that the update is visible to that dependent node before it is launched.
|
| 387 |
+
*
|
| 388 |
+
* \param node - The node to update
|
| 389 |
+
* \param gridDim - The grid dimensions to set
|
| 390 |
+
*
|
| 391 |
+
* \return
|
| 392 |
+
* cudaSuccess,
|
| 393 |
+
* cudaErrorInvalidValue
|
| 394 |
+
* \notefnerr
|
| 395 |
+
*
|
| 396 |
+
* \sa
|
| 397 |
+
* ::cudaGraphKernelNodeSetParam,
|
| 398 |
+
* ::cudaGraphKernelNodeSetEnabled,
|
| 399 |
+
* ::cudaGraphKernelNodeUpdatesApply
|
| 400 |
+
*/
|
| 401 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetGridDim(cudaGraphDeviceNode_t node, dim3 gridDim);
|
| 402 |
+
|
| 403 |
+
/**
|
| 404 |
+
* \ingroup CUDART_GRAPH
|
| 405 |
+
* \brief Batch applies multiple kernel node updates
|
| 406 |
+
*
|
| 407 |
+
* Batch applies one or more kernel node updates based on the information provided in \p updates.
|
| 408 |
+
* \p updateCount specifies the number of updates to apply. Each entry in \p updates must specify
|
| 409 |
+
* a node to update, the type of update to apply, and the parameters for that type of update. See
|
| 410 |
+
* the documentation for ::cudaGraphKernelNodeUpdate for more detail.
|
| 411 |
+
*
|
| 412 |
+
* If this function is called for the node's immediate dependent and that dependent is configured
|
| 413 |
+
* for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before
|
| 414 |
+
* kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure
|
| 415 |
+
* that the update is visible to that dependent node before it is launched.
|
| 416 |
+
*
|
| 417 |
+
* \param updates - The updates to apply
|
| 418 |
+
* \param updateCount - The number of updates to apply
|
| 419 |
+
*
|
| 420 |
+
* \return
|
| 421 |
+
* cudaSuccess,
|
| 422 |
+
* cudaErrorInvalidValue
|
| 423 |
+
* \notefnerr
|
| 424 |
+
*
|
| 425 |
+
* \sa
|
| 426 |
+
* ::cudaGraphKernelNodeSetParam,
|
| 427 |
+
* ::cudaGraphKernelNodeSetEnabled,
|
| 428 |
+
* ::cudaGraphKernelNodeSetGridDim
|
| 429 |
+
*/
|
| 430 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeUpdatesApply(const cudaGraphKernelNodeUpdate *updates, size_t updateCount);
|
| 431 |
+
|
| 432 |
+
/**
|
| 433 |
+
* \ingroup CUDART_EXECUTION
|
| 434 |
+
* \brief Programmatic dependency trigger
|
| 435 |
+
*
|
| 436 |
+
* This device function ensures the programmatic launch completion edges /
|
| 437 |
+
* events are fulfilled. See
|
| 438 |
+
* ::cudaLaunchAttributeID::cudaLaunchAttributeProgrammaticStreamSerialization
|
| 439 |
+
* and ::cudaLaunchAttributeID::cudaLaunchAttributeProgrammaticEvent for more
|
| 440 |
+
* information. The event / edge kick off only happens when every CTAs
|
| 441 |
+
* in the grid has either exited or called this function at least once,
|
| 442 |
+
* otherwise the kick off happens automatically after all warps finishes
|
| 443 |
+
* execution but before the grid completes. The kick off only enables
|
| 444 |
+
* scheduling of the secondary kernel. It provides no memory visibility
|
| 445 |
+
* guarantee itself. The user could enforce memory visibility by inserting a
|
| 446 |
+
* memory fence of the correct scope.
|
| 447 |
+
*/
|
| 448 |
+
static inline __device__ __cudart_builtin__ void CUDARTAPI cudaTriggerProgrammaticLaunchCompletion(void)
|
| 449 |
+
{
|
| 450 |
+
asm volatile("griddepcontrol.launch_dependents;":::);
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
/**
|
| 454 |
+
* \ingroup CUDART_EXECUTION
|
| 455 |
+
* \brief Programmatic grid dependency synchronization
|
| 456 |
+
*
|
| 457 |
+
* This device function will block the thread until all direct grid
|
| 458 |
+
* dependencies have completed. This API is intended to use in conjuncture with
|
| 459 |
+
* programmatic / launch event / dependency. See
|
| 460 |
+
* ::cudaLaunchAttributeID::cudaLaunchAttributeProgrammaticStreamSerialization
|
| 461 |
+
* and ::cudaLaunchAttributeID::cudaLaunchAttributeProgrammaticEvent for more
|
| 462 |
+
* information.
|
| 463 |
+
*/
|
| 464 |
+
static inline __device__ __cudart_builtin__ void CUDARTAPI cudaGridDependencySynchronize(void)
|
| 465 |
+
{
|
| 466 |
+
asm volatile("griddepcontrol.wait;":::"memory");
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
/**
|
| 470 |
+
* \ingroup CUDART_GRAPH
|
| 471 |
+
* \brief Sets the condition value associated with a conditional node.
|
| 472 |
+
*
|
| 473 |
+
* Sets the condition value associated with a conditional node.
|
| 474 |
+
*
|
| 475 |
+
* Note: \p handle must be associated with the same context as the kernel calling this function.
|
| 476 |
+
* Note: It is undefined behavior to have racing / possibly concurrent calls to ::cudaGraphSetConditional.
|
| 477 |
+
*
|
| 478 |
+
* \sa cudaGraphConditionalHandleCreate
|
| 479 |
+
*/
|
| 480 |
+
extern __device__ __cudart_builtin__ void CUDARTAPI cudaGraphSetConditional(cudaGraphConditionalHandle handle, unsigned int value);
|
| 481 |
+
|
| 482 |
+
//// CG API
|
| 483 |
+
extern __device__ __cudart_builtin__ unsigned long long CUDARTAPI cudaCGGetIntrinsicHandle(enum cudaCGScope scope);
|
| 484 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaCGSynchronize(unsigned long long handle, unsigned int flags);
|
| 485 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaCGSynchronizeGrid(unsigned long long handle, unsigned int flags);
|
| 486 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaCGGetSize(unsigned int *numThreads, unsigned int *numGrids, unsigned long long handle);
|
| 487 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaCGGetRank(unsigned int *threadRank, unsigned int *gridRank, unsigned long long handle);
|
| 488 |
+
|
| 489 |
+
|
| 490 |
+
//// CDP API
|
| 491 |
+
|
| 492 |
+
#ifdef __CUDA_ARCH__
|
| 493 |
+
|
| 494 |
+
// Bug 4398304
|
| 495 |
+
// WAR for doxgyen processing duplicate entries causing warnings to be listed in the documentation
|
| 496 |
+
/** \cond impl_private */
|
| 497 |
+
|
| 498 |
+
#ifdef __CUDA_INTERNAL_USE_CDP2
|
| 499 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetAttribute(int *value, enum cudaDeviceAttr attr, int device)
|
| 500 |
+
{
|
| 501 |
+
return __cudaCDP2DeviceGetAttribute(value, attr, device);
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit)
|
| 505 |
+
{
|
| 506 |
+
return __cudaCDP2DeviceGetLimit(pValue, limit);
|
| 507 |
+
}
|
| 508 |
+
|
| 509 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig)
|
| 510 |
+
{
|
| 511 |
+
return __cudaCDP2DeviceGetCacheConfig(pCacheConfig);
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig)
|
| 515 |
+
{
|
| 516 |
+
return __cudaCDP2DeviceGetSharedMemConfig(pConfig);
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetLastError(void)
|
| 520 |
+
{
|
| 521 |
+
return __cudaCDP2GetLastError();
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaPeekAtLastError(void)
|
| 525 |
+
{
|
| 526 |
+
return __cudaCDP2PeekAtLastError();
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
static __inline__ __device__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorString(cudaError_t error)
|
| 530 |
+
{
|
| 531 |
+
return __cudaCDP2GetErrorString(error);
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
static __inline__ __device__ __cudart_builtin__ const char* CUDARTAPI cudaGetErrorName(cudaError_t error)
|
| 535 |
+
{
|
| 536 |
+
return __cudaCDP2GetErrorName(error);
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDeviceCount(int *count)
|
| 540 |
+
{
|
| 541 |
+
return __cudaCDP2GetDeviceCount(count);
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGetDevice(int *device)
|
| 545 |
+
{
|
| 546 |
+
return __cudaCDP2GetDevice(device);
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamCreateWithFlags(cudaStream_t *pStream, unsigned int flags)
|
| 550 |
+
{
|
| 551 |
+
return __cudaCDP2StreamCreateWithFlags(pStream, flags);
|
| 552 |
+
}
|
| 553 |
+
|
| 554 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamDestroy(cudaStream_t stream)
|
| 555 |
+
{
|
| 556 |
+
return __cudaCDP2StreamDestroy(stream);
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent(cudaStream_t stream, cudaEvent_t event, unsigned int flags)
|
| 560 |
+
{
|
| 561 |
+
return __cudaCDP2StreamWaitEvent(stream, event, flags);
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamWaitEvent_ptsz(cudaStream_t stream, cudaEvent_t event, unsigned int flags)
|
| 565 |
+
{
|
| 566 |
+
return __cudaCDP2StreamWaitEvent_ptsz(stream, event, flags);
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventCreateWithFlags(cudaEvent_t *event, unsigned int flags)
|
| 570 |
+
{
|
| 571 |
+
return __cudaCDP2EventCreateWithFlags(event, flags);
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord(cudaEvent_t event, cudaStream_t stream)
|
| 575 |
+
{
|
| 576 |
+
return __cudaCDP2EventRecord(event, stream);
|
| 577 |
+
}
|
| 578 |
+
|
| 579 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecord_ptsz(cudaEvent_t event, cudaStream_t stream)
|
| 580 |
+
{
|
| 581 |
+
return __cudaCDP2EventRecord_ptsz(event, stream);
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags(cudaEvent_t event, cudaStream_t stream, unsigned int flags)
|
| 585 |
+
{
|
| 586 |
+
return __cudaCDP2EventRecordWithFlags(event, stream, flags);
|
| 587 |
+
}
|
| 588 |
+
|
| 589 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventRecordWithFlags_ptsz(cudaEvent_t event, cudaStream_t stream, unsigned int flags)
|
| 590 |
+
{
|
| 591 |
+
return __cudaCDP2EventRecordWithFlags_ptsz(event, stream, flags);
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaEventDestroy(cudaEvent_t event)
|
| 595 |
+
{
|
| 596 |
+
return __cudaCDP2EventDestroy(event);
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFuncGetAttributes(struct cudaFuncAttributes *attr, const void *func)
|
| 600 |
+
{
|
| 601 |
+
return __cudaCDP2FuncGetAttributes(attr, func);
|
| 602 |
+
}
|
| 603 |
+
|
| 604 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaFree(void *devPtr)
|
| 605 |
+
{
|
| 606 |
+
return __cudaCDP2Free(devPtr);
|
| 607 |
+
}
|
| 608 |
+
|
| 609 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMalloc(void **devPtr, size_t size)
|
| 610 |
+
{
|
| 611 |
+
return __cudaCDP2Malloc(devPtr, size);
|
| 612 |
+
}
|
| 613 |
+
|
| 614 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream)
|
| 615 |
+
{
|
| 616 |
+
return __cudaCDP2MemcpyAsync(dst, src, count, kind, stream);
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpyAsync_ptsz(void *dst, const void *src, size_t count, enum cudaMemcpyKind kind, cudaStream_t stream)
|
| 620 |
+
{
|
| 621 |
+
return __cudaCDP2MemcpyAsync_ptsz(dst, src, count, kind, stream);
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream)
|
| 625 |
+
{
|
| 626 |
+
return __cudaCDP2Memcpy2DAsync(dst, dpitch, src, spitch, width, height, kind, stream);
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy2DAsync_ptsz(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, enum cudaMemcpyKind kind, cudaStream_t stream)
|
| 630 |
+
{
|
| 631 |
+
return __cudaCDP2Memcpy2DAsync_ptsz(dst, dpitch, src, spitch, width, height, kind, stream);
|
| 632 |
+
}
|
| 633 |
+
|
| 634 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync(const struct cudaMemcpy3DParms *p, cudaStream_t stream)
|
| 635 |
+
{
|
| 636 |
+
return __cudaCDP2Memcpy3DAsync(p, stream);
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemcpy3DAsync_ptsz(const struct cudaMemcpy3DParms *p, cudaStream_t stream)
|
| 640 |
+
{
|
| 641 |
+
return __cudaCDP2Memcpy3DAsync_ptsz(p, stream);
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync(void *devPtr, int value, size_t count, cudaStream_t stream)
|
| 645 |
+
{
|
| 646 |
+
return __cudaCDP2MemsetAsync(devPtr, value, count, stream);
|
| 647 |
+
}
|
| 648 |
+
|
| 649 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemsetAsync_ptsz(void *devPtr, int value, size_t count, cudaStream_t stream)
|
| 650 |
+
{
|
| 651 |
+
return __cudaCDP2MemsetAsync_ptsz(devPtr, value, count, stream);
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream)
|
| 655 |
+
{
|
| 656 |
+
return __cudaCDP2Memset2DAsync(devPtr, pitch, value, width, height, stream);
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset2DAsync_ptsz(void *devPtr, size_t pitch, int value, size_t width, size_t height, cudaStream_t stream)
|
| 660 |
+
{
|
| 661 |
+
return __cudaCDP2Memset2DAsync_ptsz(devPtr, pitch, value, width, height, stream);
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream)
|
| 665 |
+
{
|
| 666 |
+
return __cudaCDP2Memset3DAsync(pitchedDevPtr, value, extent, stream);
|
| 667 |
+
}
|
| 668 |
+
|
| 669 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMemset3DAsync_ptsz(struct cudaPitchedPtr pitchedDevPtr, int value, struct cudaExtent extent, cudaStream_t stream)
|
| 670 |
+
{
|
| 671 |
+
return __cudaCDP2Memset3DAsync_ptsz(pitchedDevPtr, value, extent, stream);
|
| 672 |
+
}
|
| 673 |
+
|
| 674 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaRuntimeGetVersion(int *runtimeVersion)
|
| 675 |
+
{
|
| 676 |
+
return __cudaCDP2RuntimeGetVersion(runtimeVersion);
|
| 677 |
+
}
|
| 678 |
+
|
| 679 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize)
|
| 680 |
+
{
|
| 681 |
+
return __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSmemSize);
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, const void *func, int blockSize, size_t dynamicSmemSize, unsigned int flags)
|
| 685 |
+
{
|
| 686 |
+
return __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSmemSize, flags);
|
| 687 |
+
}
|
| 688 |
+
#endif // __CUDA_INTERNAL_USE_CDP2
|
| 689 |
+
|
| 690 |
+
/** \endcond */
|
| 691 |
+
|
| 692 |
+
#endif // __CUDA_ARCH__
|
| 693 |
+
|
| 694 |
+
|
| 695 |
+
/**
|
| 696 |
+
* \ingroup CUDART_EXECUTION
|
| 697 |
+
* \brief Obtains a parameter buffer
|
| 698 |
+
*
|
| 699 |
+
* Obtains a parameter buffer which can be filled with parameters for a kernel launch.
|
| 700 |
+
* Parameters passed to ::cudaLaunchDevice must be allocated via this function.
|
| 701 |
+
*
|
| 702 |
+
* This is a low level API and can only be accessed from Parallel Thread Execution (PTX).
|
| 703 |
+
* CUDA user code should use <<< >>> to launch kernels.
|
| 704 |
+
*
|
| 705 |
+
* \param alignment - Specifies alignment requirement of the parameter buffer
|
| 706 |
+
* \param size - Specifies size requirement in bytes
|
| 707 |
+
*
|
| 708 |
+
* \return
|
| 709 |
+
* Returns pointer to the allocated parameterBuffer
|
| 710 |
+
* \notefnerr
|
| 711 |
+
*
|
| 712 |
+
* \sa cudaLaunchDevice
|
| 713 |
+
*/
|
| 714 |
+
#ifdef __CUDA_INTERNAL_USE_CDP2
|
| 715 |
+
static __inline__ __device__ __cudart_builtin__ void * CUDARTAPI cudaGetParameterBuffer(size_t alignment, size_t size)
|
| 716 |
+
{
|
| 717 |
+
return __cudaCDP2GetParameterBuffer(alignment, size);
|
| 718 |
+
}
|
| 719 |
+
#else
|
| 720 |
+
extern __device__ __cudart_builtin__ void * CUDARTAPI cudaGetParameterBuffer(size_t alignment, size_t size);
|
| 721 |
+
#endif
|
| 722 |
+
|
| 723 |
+
|
| 724 |
+
#ifdef __CUDA_INTERNAL_USE_CDP2
|
| 725 |
+
static __inline__ __device__ __cudart_builtin__ void * CUDARTAPI cudaGetParameterBufferV2(void *func, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize)
|
| 726 |
+
{
|
| 727 |
+
return __cudaCDP2GetParameterBufferV2(func, gridDimension, blockDimension, sharedMemSize);
|
| 728 |
+
}
|
| 729 |
+
#else
|
| 730 |
+
extern __device__ __cudart_builtin__ void * CUDARTAPI cudaGetParameterBufferV2(void *func, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize);
|
| 731 |
+
#endif
|
| 732 |
+
|
| 733 |
+
|
| 734 |
+
#ifdef __CUDA_INTERNAL_USE_CDP2
|
| 735 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDevice_ptsz(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream)
|
| 736 |
+
{
|
| 737 |
+
return __cudaCDP2LaunchDevice_ptsz(func, parameterBuffer, gridDimension, blockDimension, sharedMemSize, stream);
|
| 738 |
+
}
|
| 739 |
+
|
| 740 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDeviceV2_ptsz(void *parameterBuffer, cudaStream_t stream)
|
| 741 |
+
{
|
| 742 |
+
return __cudaCDP2LaunchDeviceV2_ptsz(parameterBuffer, stream);
|
| 743 |
+
}
|
| 744 |
+
#else
|
| 745 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDevice_ptsz(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream);
|
| 746 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDeviceV2_ptsz(void *parameterBuffer, cudaStream_t stream);
|
| 747 |
+
#endif
|
| 748 |
+
|
| 749 |
+
|
| 750 |
+
/**
|
| 751 |
+
* \ingroup CUDART_EXECUTION
|
| 752 |
+
* \brief Launches a specified kernel
|
| 753 |
+
*
|
| 754 |
+
* Launches a specified kernel with the specified parameter buffer. A parameter buffer can be obtained
|
| 755 |
+
* by calling ::cudaGetParameterBuffer().
|
| 756 |
+
*
|
| 757 |
+
* This is a low level API and can only be accessed from Parallel Thread Execution (PTX).
|
| 758 |
+
* CUDA user code should use <<< >>> to launch the kernels.
|
| 759 |
+
*
|
| 760 |
+
* \param func - Pointer to the kernel to be launched
|
| 761 |
+
* \param parameterBuffer - Holds the parameters to the launched kernel. parameterBuffer can be NULL. (Optional)
|
| 762 |
+
* \param gridDimension - Specifies grid dimensions
|
| 763 |
+
* \param blockDimension - Specifies block dimensions
|
| 764 |
+
* \param sharedMemSize - Specifies size of shared memory
|
| 765 |
+
* \param stream - Specifies the stream to be used
|
| 766 |
+
*
|
| 767 |
+
* \return
|
| 768 |
+
* ::cudaSuccess, ::cudaErrorInvalidDevice, ::cudaErrorLaunchMaxDepthExceeded, ::cudaErrorInvalidConfiguration,
|
| 769 |
+
* ::cudaErrorStartupFailure, ::cudaErrorLaunchPendingCountExceeded, ::cudaErrorLaunchOutOfResources
|
| 770 |
+
* \notefnerr
|
| 771 |
+
* \n Please refer to Execution Configuration and Parameter Buffer Layout from the CUDA Programming
|
| 772 |
+
* Guide for the detailed descriptions of launch configuration and parameter layout respectively.
|
| 773 |
+
*
|
| 774 |
+
* \sa cudaGetParameterBuffer
|
| 775 |
+
*/
|
| 776 |
+
#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) && defined(__CUDA_ARCH__)
|
| 777 |
+
// When compiling for the device and per thread default stream is enabled, add
|
| 778 |
+
// a static inline redirect to the per thread stream entry points.
|
| 779 |
+
|
| 780 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI
|
| 781 |
+
cudaLaunchDevice(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream)
|
| 782 |
+
{
|
| 783 |
+
#ifdef __CUDA_INTERNAL_USE_CDP2
|
| 784 |
+
return __cudaCDP2LaunchDevice_ptsz(func, parameterBuffer, gridDimension, blockDimension, sharedMemSize, stream);
|
| 785 |
+
#else
|
| 786 |
+
return cudaLaunchDevice_ptsz(func, parameterBuffer, gridDimension, blockDimension, sharedMemSize, stream);
|
| 787 |
+
#endif
|
| 788 |
+
}
|
| 789 |
+
|
| 790 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI
|
| 791 |
+
cudaLaunchDeviceV2(void *parameterBuffer, cudaStream_t stream)
|
| 792 |
+
{
|
| 793 |
+
#ifdef __CUDA_INTERNAL_USE_CDP2
|
| 794 |
+
return __cudaCDP2LaunchDeviceV2_ptsz(parameterBuffer, stream);
|
| 795 |
+
#else
|
| 796 |
+
return cudaLaunchDeviceV2_ptsz(parameterBuffer, stream);
|
| 797 |
+
#endif
|
| 798 |
+
}
|
| 799 |
+
#else // defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) && defined(__CUDA_ARCH__)
|
| 800 |
+
#ifdef __CUDA_INTERNAL_USE_CDP2
|
| 801 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDevice(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream)
|
| 802 |
+
{
|
| 803 |
+
return __cudaCDP2LaunchDevice(func, parameterBuffer, gridDimension, blockDimension, sharedMemSize, stream);
|
| 804 |
+
}
|
| 805 |
+
|
| 806 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDeviceV2(void *parameterBuffer, cudaStream_t stream)
|
| 807 |
+
{
|
| 808 |
+
return __cudaCDP2LaunchDeviceV2(parameterBuffer, stream);
|
| 809 |
+
}
|
| 810 |
+
#else // __CUDA_INTERNAL_USE_CDP2
|
| 811 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDevice(void *func, void *parameterBuffer, dim3 gridDimension, dim3 blockDimension, unsigned int sharedMemSize, cudaStream_t stream);
|
| 812 |
+
extern __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaLaunchDeviceV2(void *parameterBuffer, cudaStream_t stream);
|
| 813 |
+
#endif // __CUDA_INTERNAL_USE_CDP2
|
| 814 |
+
#endif // defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) && defined(__CUDA_ARCH__)
|
| 815 |
+
|
| 816 |
+
|
| 817 |
+
// These symbols should not be used outside of this header file.
|
| 818 |
+
#define __cudaCDP2DeviceGetAttribute
|
| 819 |
+
#define __cudaCDP2DeviceGetLimit
|
| 820 |
+
#define __cudaCDP2DeviceGetCacheConfig
|
| 821 |
+
#define __cudaCDP2DeviceGetSharedMemConfig
|
| 822 |
+
#define __cudaCDP2GetLastError
|
| 823 |
+
#define __cudaCDP2PeekAtLastError
|
| 824 |
+
#define __cudaCDP2GetErrorString
|
| 825 |
+
#define __cudaCDP2GetErrorName
|
| 826 |
+
#define __cudaCDP2GetDeviceCount
|
| 827 |
+
#define __cudaCDP2GetDevice
|
| 828 |
+
#define __cudaCDP2StreamCreateWithFlags
|
| 829 |
+
#define __cudaCDP2StreamDestroy
|
| 830 |
+
#define __cudaCDP2StreamWaitEvent
|
| 831 |
+
#define __cudaCDP2StreamWaitEvent_ptsz
|
| 832 |
+
#define __cudaCDP2EventCreateWithFlags
|
| 833 |
+
#define __cudaCDP2EventRecord
|
| 834 |
+
#define __cudaCDP2EventRecord_ptsz
|
| 835 |
+
#define __cudaCDP2EventRecordWithFlags
|
| 836 |
+
#define __cudaCDP2EventRecordWithFlags_ptsz
|
| 837 |
+
#define __cudaCDP2EventDestroy
|
| 838 |
+
#define __cudaCDP2FuncGetAttributes
|
| 839 |
+
#define __cudaCDP2Free
|
| 840 |
+
#define __cudaCDP2Malloc
|
| 841 |
+
#define __cudaCDP2MemcpyAsync
|
| 842 |
+
#define __cudaCDP2MemcpyAsync_ptsz
|
| 843 |
+
#define __cudaCDP2Memcpy2DAsync
|
| 844 |
+
#define __cudaCDP2Memcpy2DAsync_ptsz
|
| 845 |
+
#define __cudaCDP2Memcpy3DAsync
|
| 846 |
+
#define __cudaCDP2Memcpy3DAsync_ptsz
|
| 847 |
+
#define __cudaCDP2MemsetAsync
|
| 848 |
+
#define __cudaCDP2MemsetAsync_ptsz
|
| 849 |
+
#define __cudaCDP2Memset2DAsync
|
| 850 |
+
#define __cudaCDP2Memset2DAsync_ptsz
|
| 851 |
+
#define __cudaCDP2Memset3DAsync
|
| 852 |
+
#define __cudaCDP2Memset3DAsync_ptsz
|
| 853 |
+
#define __cudaCDP2RuntimeGetVersion
|
| 854 |
+
#define __cudaCDP2GetParameterBuffer
|
| 855 |
+
#define __cudaCDP2GetParameterBufferV2
|
| 856 |
+
#define __cudaCDP2LaunchDevice_ptsz
|
| 857 |
+
#define __cudaCDP2LaunchDeviceV2_ptsz
|
| 858 |
+
#define __cudaCDP2LaunchDevice
|
| 859 |
+
#define __cudaCDP2LaunchDeviceV2
|
| 860 |
+
#define __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessor
|
| 861 |
+
#define __cudaCDP2OccupancyMaxActiveBlocksPerMultiprocessorWithFlags
|
| 862 |
+
|
| 863 |
+
}
|
| 864 |
+
|
| 865 |
+
// Bug 4398304
|
| 866 |
+
// WAR for doxgyen processing duplicate entries causing warnings to be listed in the documentation
|
| 867 |
+
/** \cond impl_private */
|
| 868 |
+
|
| 869 |
+
template <typename T> static __inline__ __device__ __cudart_builtin__ cudaError_t cudaMalloc(T **devPtr, size_t size);
|
| 870 |
+
template <typename T> static __inline__ __device__ __cudart_builtin__ cudaError_t cudaFuncGetAttributes(struct cudaFuncAttributes *attr, T *entry);
|
| 871 |
+
template <typename T> static __inline__ __device__ __cudart_builtin__ cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, T func, int blockSize, size_t dynamicSmemSize);
|
| 872 |
+
template <typename T> static __inline__ __device__ __cudart_builtin__ cudaError_t cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, T func, int blockSize, size_t dynamicSmemSize, unsigned int flags);
|
| 873 |
+
|
| 874 |
+
/** \endcond */
|
| 875 |
+
|
| 876 |
+
/**
|
| 877 |
+
* \ingroup CUDART_GRAPH
|
| 878 |
+
* \brief Updates the kernel parameters of the given kernel node
|
| 879 |
+
*
|
| 880 |
+
* Updates the kernel parameters of \p node at \p offset to \p value. \p node must be
|
| 881 |
+
* device-updatable, and must reside upon the same device as the calling kernel.
|
| 882 |
+
*
|
| 883 |
+
* If this function is called for the node's immediate dependent and that dependent is configured
|
| 884 |
+
* for programmatic dependent launch, then a memory fence must be invoked via __threadfence() before
|
| 885 |
+
* kickoff of the dependent is triggered via ::cudaTriggerProgrammaticLaunchCompletion() to ensure
|
| 886 |
+
* that the update is visible to that dependent node before it is launched.
|
| 887 |
+
*
|
| 888 |
+
* \param node - The node to update
|
| 889 |
+
* \param offset - The offset into the params at which to make the update
|
| 890 |
+
* \param value - Parameter value to write
|
| 891 |
+
*
|
| 892 |
+
* \return
|
| 893 |
+
* cudaSuccess,
|
| 894 |
+
* cudaErrorInvalidValue
|
| 895 |
+
* \notefnerr
|
| 896 |
+
*
|
| 897 |
+
* \sa
|
| 898 |
+
* ::cudaGraphKernelNodeSetEnabled,
|
| 899 |
+
* ::cudaGraphKernelNodeSetGridDim,
|
| 900 |
+
* ::cudaGraphKernelNodeUpdatesApply
|
| 901 |
+
*/
|
| 902 |
+
template <typename T>
|
| 903 |
+
static __inline__ __device__ __cudart_builtin__ cudaError_t CUDARTAPI cudaGraphKernelNodeSetParam(cudaGraphDeviceNode_t node, size_t offset, const T &value)
|
| 904 |
+
{
|
| 905 |
+
return cudaGraphKernelNodeSetParam(node, offset, &value, sizeof(T));
|
| 906 |
+
}
|
| 907 |
+
|
| 908 |
+
#endif // !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 350)
|
| 909 |
+
#endif /* defined(__cplusplus) && defined(__CUDACC__) */
|
| 910 |
+
|
| 911 |
+
#undef __DEPRECATED__
|
| 912 |
+
#undef __CDPRT_DEPRECATED
|
| 913 |
+
#undef __CUDA_INTERNAL_USE_CDP2
|
| 914 |
+
|
| 915 |
+
#endif /* !__CUDA_DEVICE_RUNTIME_API_H__ */
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda_egl_interop.h
ADDED
|
@@ -0,0 +1,645 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2019 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_EGL_INTEROP_H__)
|
| 51 |
+
#define __CUDA_EGL_INTEROP_H__
|
| 52 |
+
|
| 53 |
+
#include "cuda_runtime_api.h"
|
| 54 |
+
#include "cuda_runtime.h"
|
| 55 |
+
#include "cudart_platform.h"
|
| 56 |
+
#include "EGL/egl.h"
|
| 57 |
+
#include "EGL/eglext.h"
|
| 58 |
+
|
| 59 |
+
#if defined(__cplusplus)
|
| 60 |
+
extern "C" {
|
| 61 |
+
#endif /* __cplusplus */
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* \addtogroup CUDART_TYPES
|
| 65 |
+
* @{
|
| 66 |
+
*/
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Maximum number of planes per frame
|
| 70 |
+
*/
|
| 71 |
+
#define CUDA_EGL_MAX_PLANES 3
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* CUDA EglFrame type - array or pointer
|
| 75 |
+
*/
|
| 76 |
+
typedef enum cudaEglFrameType_enum
|
| 77 |
+
{
|
| 78 |
+
cudaEglFrameTypeArray = 0, /**< Frame type CUDA array */
|
| 79 |
+
cudaEglFrameTypePitch = 1, /**< Frame type CUDA pointer */
|
| 80 |
+
} cudaEglFrameType;
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* Resource location flags- sysmem or vidmem
|
| 84 |
+
*
|
| 85 |
+
* For CUDA context on iGPU, since video and system memory are equivalent -
|
| 86 |
+
* these flags will not have an effect on the execution.
|
| 87 |
+
*
|
| 88 |
+
* For CUDA context on dGPU, applications can use the flag ::cudaEglResourceLocationFlags
|
| 89 |
+
* to give a hint about the desired location.
|
| 90 |
+
*
|
| 91 |
+
* ::cudaEglResourceLocationSysmem - the frame data is made resident on the system memory
|
| 92 |
+
* to be accessed by CUDA.
|
| 93 |
+
*
|
| 94 |
+
* ::cudaEglResourceLocationVidmem - the frame data is made resident on the dedicated
|
| 95 |
+
* video memory to be accessed by CUDA.
|
| 96 |
+
*
|
| 97 |
+
* There may be an additional latency due to new allocation and data migration,
|
| 98 |
+
* if the frame is produced on a different memory.
|
| 99 |
+
*/
|
| 100 |
+
typedef enum cudaEglResourceLocationFlags_enum {
|
| 101 |
+
cudaEglResourceLocationSysmem = 0x00, /**< Resource location sysmem */
|
| 102 |
+
cudaEglResourceLocationVidmem = 0x01, /**< Resource location vidmem */
|
| 103 |
+
} cudaEglResourceLocationFlags;
|
| 104 |
+
|
| 105 |
+
/**
|
| 106 |
+
* CUDA EGL Color Format - The different planar and multiplanar formats currently supported for CUDA_EGL interops.
|
| 107 |
+
*/
|
| 108 |
+
typedef enum cudaEglColorFormat_enum {
|
| 109 |
+
cudaEglColorFormatYUV420Planar = 0, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 110 |
+
cudaEglColorFormatYUV420SemiPlanar = 1, /**< Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV420Planar. */
|
| 111 |
+
cudaEglColorFormatYUV422Planar = 2, /**< Y, U, V each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 112 |
+
cudaEglColorFormatYUV422SemiPlanar = 3, /**< Y, UV in two surfaces with VU byte ordering, width, height ratio same as YUV422Planar. */
|
| 113 |
+
cudaEglColorFormatARGB = 6, /**< R/G/B/A four channels in one surface with BGRA byte ordering. */
|
| 114 |
+
cudaEglColorFormatRGBA = 7, /**< R/G/B/A four channels in one surface with ABGR byte ordering. */
|
| 115 |
+
cudaEglColorFormatL = 8, /**< single luminance channel in one surface. */
|
| 116 |
+
cudaEglColorFormatR = 9, /**< single color channel in one surface. */
|
| 117 |
+
cudaEglColorFormatYUV444Planar = 10, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. */
|
| 118 |
+
cudaEglColorFormatYUV444SemiPlanar = 11, /**< Y, UV in two surfaces (UV as one surface) with VU byte ordering, width, height ratio same as YUV444Planar. */
|
| 119 |
+
cudaEglColorFormatYUYV422 = 12, /**< Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 120 |
+
cudaEglColorFormatUYVY422 = 13, /**< Y, U, V in one surface, interleaved as YUYV in one channel. */
|
| 121 |
+
cudaEglColorFormatABGR = 14, /**< R/G/B/A four channels in one surface with RGBA byte ordering. */
|
| 122 |
+
cudaEglColorFormatBGRA = 15, /**< R/G/B/A four channels in one surface with ARGB byte ordering. */
|
| 123 |
+
cudaEglColorFormatA = 16, /**< Alpha color format - one channel in one surface. */
|
| 124 |
+
cudaEglColorFormatRG = 17, /**< R/G color format - two channels in one surface with GR byte ordering */
|
| 125 |
+
cudaEglColorFormatAYUV = 18, /**< Y, U, V, A four channels in one surface, interleaved as VUYA. */
|
| 126 |
+
cudaEglColorFormatYVU444SemiPlanar = 19, /**< Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 127 |
+
cudaEglColorFormatYVU422SemiPlanar = 20, /**< Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 128 |
+
cudaEglColorFormatYVU420SemiPlanar = 21, /**< Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 129 |
+
cudaEglColorFormatY10V10U10_444SemiPlanar = 22, /**< Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 130 |
+
cudaEglColorFormatY10V10U10_420SemiPlanar = 23, /**< Y10, V10U10 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 131 |
+
cudaEglColorFormatY12V12U12_444SemiPlanar = 24, /**< Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 132 |
+
cudaEglColorFormatY12V12U12_420SemiPlanar = 25, /**< Y12, V12U12 in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 133 |
+
cudaEglColorFormatVYUY_ER = 26, /**< Extended Range Y, U, V in one surface, interleaved as YVYU in one channel. */
|
| 134 |
+
cudaEglColorFormatUYVY_ER = 27, /**< Extended Range Y, U, V in one surface, interleaved as YUYV in one channel. */
|
| 135 |
+
cudaEglColorFormatYUYV_ER = 28, /**< Extended Range Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 136 |
+
cudaEglColorFormatYVYU_ER = 29, /**< Extended Range Y, U, V in one surface, interleaved as VYUY in one channel. */
|
| 137 |
+
cudaEglColorFormatYUVA_ER = 31, /**< Extended Range Y, U, V, A four channels in one surface, interleaved as AVUY. */
|
| 138 |
+
cudaEglColorFormatAYUV_ER = 32, /**< Extended Range Y, U, V, A four channels in one surface, interleaved as VUYA. */
|
| 139 |
+
cudaEglColorFormatYUV444Planar_ER = 33, /**< Extended Range Y, U, V in three surfaces, U/V width = Y width, U/V height = Y height. */
|
| 140 |
+
cudaEglColorFormatYUV422Planar_ER = 34, /**< Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 141 |
+
cudaEglColorFormatYUV420Planar_ER = 35, /**< Extended Range Y, U, V in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 142 |
+
cudaEglColorFormatYUV444SemiPlanar_ER = 36, /**< Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 143 |
+
cudaEglColorFormatYUV422SemiPlanar_ER = 37, /**< Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 144 |
+
cudaEglColorFormatYUV420SemiPlanar_ER = 38, /**< Extended Range Y, UV in two surfaces (UV as one surface) with VU byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 145 |
+
cudaEglColorFormatYVU444Planar_ER = 39, /**< Extended Range Y, V, U in three surfaces, U/V width = Y width, U/V height = Y height. */
|
| 146 |
+
cudaEglColorFormatYVU422Planar_ER = 40, /**< Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 147 |
+
cudaEglColorFormatYVU420Planar_ER = 41, /**< Extended Range Y, V, U in three surfaces, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 148 |
+
cudaEglColorFormatYVU444SemiPlanar_ER = 42, /**< Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = Y width, U/V height = Y height. */
|
| 149 |
+
cudaEglColorFormatYVU422SemiPlanar_ER = 43, /**< Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 150 |
+
cudaEglColorFormatYVU420SemiPlanar_ER = 44, /**< Extended Range Y, VU in two surfaces (VU as one surface) with UV byte ordering, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 151 |
+
cudaEglColorFormatBayerRGGB = 45, /**< Bayer format - one channel in one surface with interleaved RGGB ordering. */
|
| 152 |
+
cudaEglColorFormatBayerBGGR = 46, /**< Bayer format - one channel in one surface with interleaved BGGR ordering. */
|
| 153 |
+
cudaEglColorFormatBayerGRBG = 47, /**< Bayer format - one channel in one surface with interleaved GRBG ordering. */
|
| 154 |
+
cudaEglColorFormatBayerGBRG = 48, /**< Bayer format - one channel in one surface with interleaved GBRG ordering. */
|
| 155 |
+
cudaEglColorFormatBayer10RGGB = 49, /**< Bayer10 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 156 |
+
cudaEglColorFormatBayer10BGGR = 50, /**< Bayer10 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 157 |
+
cudaEglColorFormatBayer10GRBG = 51, /**< Bayer10 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 158 |
+
cudaEglColorFormatBayer10GBRG = 52, /**< Bayer10 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 159 |
+
cudaEglColorFormatBayer12RGGB = 53, /**< Bayer12 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 160 |
+
cudaEglColorFormatBayer12BGGR = 54, /**< Bayer12 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 161 |
+
cudaEglColorFormatBayer12GRBG = 55, /**< Bayer12 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 162 |
+
cudaEglColorFormatBayer12GBRG = 56, /**< Bayer12 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 163 |
+
cudaEglColorFormatBayer14RGGB = 57, /**< Bayer14 format - one channel in one surface with interleaved RGGB ordering. Out of 16 bits, 14 bits used 2 bits No-op. */
|
| 164 |
+
cudaEglColorFormatBayer14BGGR = 58, /**< Bayer14 format - one channel in one surface with interleaved BGGR ordering. Out of 16 bits, 14 bits used 2 bits No-op. */
|
| 165 |
+
cudaEglColorFormatBayer14GRBG = 59, /**< Bayer14 format - one channel in one surface with interleaved GRBG ordering. Out of 16 bits, 14 bits used 2 bits No-op. */
|
| 166 |
+
cudaEglColorFormatBayer14GBRG = 60, /**< Bayer14 format - one channel in one surface with interleaved GBRG ordering. Out of 16 bits, 14 bits used 2 bits No-op. */
|
| 167 |
+
cudaEglColorFormatBayer20RGGB = 61, /**< Bayer20 format - one channel in one surface with interleaved RGGB ordering. Out of 32 bits, 20 bits used 12 bits No-op. */
|
| 168 |
+
cudaEglColorFormatBayer20BGGR = 62, /**< Bayer20 format - one channel in one surface with interleaved BGGR ordering. Out of 32 bits, 20 bits used 12 bits No-op. */
|
| 169 |
+
cudaEglColorFormatBayer20GRBG = 63, /**< Bayer20 format - one channel in one surface with interleaved GRBG ordering. Out of 32 bits, 20 bits used 12 bits No-op. */
|
| 170 |
+
cudaEglColorFormatBayer20GBRG = 64, /**< Bayer20 format - one channel in one surface with interleaved GBRG ordering. Out of 32 bits, 20 bits used 12 bits No-op. */
|
| 171 |
+
cudaEglColorFormatYVU444Planar = 65, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = Y width, U/V height = Y height. */
|
| 172 |
+
cudaEglColorFormatYVU422Planar = 66, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = Y height. */
|
| 173 |
+
cudaEglColorFormatYVU420Planar = 67, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 174 |
+
cudaEglColorFormatBayerIspRGGB = 68, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved RGGB ordering and mapped to opaque integer datatype. */
|
| 175 |
+
cudaEglColorFormatBayerIspBGGR = 69, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved BGGR ordering and mapped to opaque integer datatype. */
|
| 176 |
+
cudaEglColorFormatBayerIspGRBG = 70, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GRBG ordering and mapped to opaque integer datatype. */
|
| 177 |
+
cudaEglColorFormatBayerIspGBRG = 71, /**< Nvidia proprietary Bayer ISP format - one channel in one surface with interleaved GBRG ordering and mapped to opaque integer datatype. */
|
| 178 |
+
cudaEglColorFormatBayerBCCR = 72, /**< Bayer format - one channel in one surface with interleaved BCCR ordering. */
|
| 179 |
+
cudaEglColorFormatBayerRCCB = 73, /**< Bayer format - one channel in one surface with interleaved RCCB ordering. */
|
| 180 |
+
cudaEglColorFormatBayerCRBC = 74, /**< Bayer format - one channel in one surface with interleaved CRBC ordering. */
|
| 181 |
+
cudaEglColorFormatBayerCBRC = 75, /**< Bayer format - one channel in one surface with interleaved CBRC ordering. */
|
| 182 |
+
cudaEglColorFormatBayer10CCCC = 76, /**< Bayer10 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 10 bits used 6 bits No-op. */
|
| 183 |
+
cudaEglColorFormatBayer12BCCR = 77, /**< Bayer12 format - one channel in one surface with interleaved BCCR ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 184 |
+
cudaEglColorFormatBayer12RCCB = 78, /**< Bayer12 format - one channel in one surface with interleaved RCCB ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 185 |
+
cudaEglColorFormatBayer12CRBC = 79, /**< Bayer12 format - one channel in one surface with interleaved CRBC ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 186 |
+
cudaEglColorFormatBayer12CBRC = 80, /**< Bayer12 format - one channel in one surface with interleaved CBRC ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 187 |
+
cudaEglColorFormatBayer12CCCC = 81, /**< Bayer12 format - one channel in one surface with interleaved CCCC ordering. Out of 16 bits, 12 bits used 4 bits No-op. */
|
| 188 |
+
cudaEglColorFormatY = 82, /**< Color format for single Y plane. */
|
| 189 |
+
cudaEglColorFormatYUV420SemiPlanar_2020 = 83, /**< Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 190 |
+
cudaEglColorFormatYVU420SemiPlanar_2020 = 84, /**< Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 191 |
+
cudaEglColorFormatYUV420Planar_2020 = 85, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 192 |
+
cudaEglColorFormatYVU420Planar_2020 = 86, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 193 |
+
cudaEglColorFormatYUV420SemiPlanar_709 = 87, /**< Y, UV in two surfaces (UV as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 194 |
+
cudaEglColorFormatYVU420SemiPlanar_709 = 88, /**< Y, VU in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 195 |
+
cudaEglColorFormatYUV420Planar_709 = 89, /**< Y, U, V in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 196 |
+
cudaEglColorFormatYVU420Planar_709 = 90, /**< Y, V, U in three surfaces, each in a separate surface, U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 197 |
+
cudaEglColorFormatY10V10U10_420SemiPlanar_709 = 91, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 198 |
+
cudaEglColorFormatY10V10U10_420SemiPlanar_2020 = 92, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 199 |
+
cudaEglColorFormatY10V10U10_422SemiPlanar_2020 = 93, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. */
|
| 200 |
+
cudaEglColorFormatY10V10U10_422SemiPlanar = 94, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. */
|
| 201 |
+
cudaEglColorFormatY10V10U10_422SemiPlanar_709 = 95, /**< Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = Y height. */
|
| 202 |
+
cudaEglColorFormatY_ER = 96, /**< Extended Range Color format for single Y plane. */
|
| 203 |
+
cudaEglColorFormatY_709_ER = 97, /**< Extended Range Color format for single Y plane. */
|
| 204 |
+
cudaEglColorFormatY10_ER = 98, /**< Extended Range Color format for single Y10 plane. */
|
| 205 |
+
cudaEglColorFormatY10_709_ER = 99, /**< Extended Range Color format for single Y10 plane. */
|
| 206 |
+
cudaEglColorFormatY12_ER = 100, /**< Extended Range Color format for single Y12 plane. */
|
| 207 |
+
cudaEglColorFormatY12_709_ER = 101, /**< Extended Range Color format for single Y12 plane. */
|
| 208 |
+
cudaEglColorFormatYUVA = 102, /**< Y, U, V, A four channels in one surface, interleaved as AVUY. */
|
| 209 |
+
cudaEglColorFormatYVYU = 104, /**< Y, U, V in one surface, interleaved as YVYU in one channel. */
|
| 210 |
+
cudaEglColorFormatVYUY = 105, /**< Y, U, V in one surface, interleaved as VYUY in one channel. */
|
| 211 |
+
cudaEglColorFormatY10V10U10_420SemiPlanar_ER = 106, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 212 |
+
cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER = 107, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 213 |
+
cudaEglColorFormatY10V10U10_444SemiPlanar_ER = 108, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */
|
| 214 |
+
cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER = 109, /**< Extended Range Y10, V10U10 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */
|
| 215 |
+
cudaEglColorFormatY12V12U12_420SemiPlanar_ER = 110, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 216 |
+
cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER = 111, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = 1/2 Y width, U/V height = 1/2 Y height. */
|
| 217 |
+
cudaEglColorFormatY12V12U12_444SemiPlanar_ER = 112, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */
|
| 218 |
+
cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER = 113, /**< Extended Range Y12, V12U12 in two surfaces (VU as one surface) U/V width = Y width, U/V height = Y height. */
|
| 219 |
+
cudaEglColorFormatUYVY709 = 114, /**< Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 220 |
+
cudaEglColorFormatUYVY709_ER = 115, /**< Extended Range Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 221 |
+
cudaEglColorFormatUYVY2020 = 116, /**< Y, U, V in one surface, interleaved as UYVY in one channel. */
|
| 222 |
+
} cudaEglColorFormat;
|
| 223 |
+
|
| 224 |
+
/**
|
| 225 |
+
* CUDA EGL Plane Descriptor - structure defining each plane of a CUDA EGLFrame
|
| 226 |
+
*/
|
| 227 |
+
typedef struct cudaEglPlaneDesc_st {
|
| 228 |
+
unsigned int width; /**< Width of plane */
|
| 229 |
+
unsigned int height; /**< Height of plane */
|
| 230 |
+
unsigned int depth; /**< Depth of plane */
|
| 231 |
+
unsigned int pitch; /**< Pitch of plane */
|
| 232 |
+
unsigned int numChannels; /**< Number of channels for the plane */
|
| 233 |
+
struct cudaChannelFormatDesc channelDesc; /**< Channel Format Descriptor */
|
| 234 |
+
unsigned int reserved[4]; /**< Reserved for future use */
|
| 235 |
+
} cudaEglPlaneDesc;
|
| 236 |
+
|
| 237 |
+
/**
|
| 238 |
+
* CUDA EGLFrame Descriptor - structure defining one frame of EGL.
|
| 239 |
+
*
|
| 240 |
+
* Each frame may contain one or more planes depending on whether the surface is Multiplanar or not.
|
| 241 |
+
* Each plane of EGLFrame is represented by ::cudaEglPlaneDesc which is defined as:
|
| 242 |
+
* \code
|
| 243 |
+
* typedef struct cudaEglPlaneDesc_st {
|
| 244 |
+
* unsigned int width;
|
| 245 |
+
* unsigned int height;
|
| 246 |
+
* unsigned int depth;
|
| 247 |
+
* unsigned int pitch;
|
| 248 |
+
* unsigned int numChannels;
|
| 249 |
+
* struct cudaChannelFormatDesc channelDesc;
|
| 250 |
+
* unsigned int reserved[4];
|
| 251 |
+
* } cudaEglPlaneDesc;
|
| 252 |
+
* \endcode
|
| 253 |
+
|
| 254 |
+
*/
|
| 255 |
+
typedef struct cudaEglFrame_st {
|
| 256 |
+
union {
|
| 257 |
+
cudaArray_t pArray[CUDA_EGL_MAX_PLANES]; /**< Array of CUDA arrays corresponding to each plane*/
|
| 258 |
+
struct cudaPitchedPtr pPitch[CUDA_EGL_MAX_PLANES]; /**< Array of Pointers corresponding to each plane*/
|
| 259 |
+
} frame;
|
| 260 |
+
cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES]; /**< CUDA EGL Plane Descriptor ::cudaEglPlaneDesc*/
|
| 261 |
+
unsigned int planeCount; /**< Number of planes */
|
| 262 |
+
cudaEglFrameType frameType; /**< Array or Pitch */
|
| 263 |
+
cudaEglColorFormat eglColorFormat; /**< CUDA EGL Color Format*/
|
| 264 |
+
} cudaEglFrame;
|
| 265 |
+
|
| 266 |
+
/**
|
| 267 |
+
* CUDA EGLSream Connection
|
| 268 |
+
*/
|
| 269 |
+
typedef struct CUeglStreamConnection_st *cudaEglStreamConnection;
|
| 270 |
+
|
| 271 |
+
/** @} */ /* END CUDART_TYPES */
|
| 272 |
+
|
| 273 |
+
/**
|
| 274 |
+
* \addtogroup CUDART_EGL EGL Interoperability
|
| 275 |
+
* This section describes the EGL interoperability functions of the CUDA
|
| 276 |
+
* runtime application programming interface.
|
| 277 |
+
*
|
| 278 |
+
* @{
|
| 279 |
+
*/
|
| 280 |
+
|
| 281 |
+
/**
|
| 282 |
+
* \brief Registers an EGL image
|
| 283 |
+
*
|
| 284 |
+
* Registers the EGLImageKHR specified by \p image for access by
|
| 285 |
+
* CUDA. A handle to the registered object is returned as \p pCudaResource.
|
| 286 |
+
* Additional Mapping/Unmapping is not required for the registered resource and
|
| 287 |
+
* ::cudaGraphicsResourceGetMappedEglFrame can be directly called on the \p pCudaResource.
|
| 288 |
+
*
|
| 289 |
+
* The application will be responsible for synchronizing access to shared objects.
|
| 290 |
+
* The application must ensure that any pending operation which access the objects have completed
|
| 291 |
+
* before passing control to CUDA. This may be accomplished by issuing and waiting for
|
| 292 |
+
* glFinish command on all GLcontexts (for OpenGL and likewise for other APIs).
|
| 293 |
+
* The application will be also responsible for ensuring that any pending operation on the
|
| 294 |
+
* registered CUDA resource has completed prior to executing subsequent commands in other APIs
|
| 295 |
+
* accesing the same memory objects.
|
| 296 |
+
* This can be accomplished by calling cuCtxSynchronize or cuEventSynchronize (preferably).
|
| 297 |
+
*
|
| 298 |
+
* The surface's intended usage is specified using \p flags, as follows:
|
| 299 |
+
*
|
| 300 |
+
* - ::cudaGraphicsRegisterFlagsNone: Specifies no hints about how this
|
| 301 |
+
* resource will be used. It is therefore assumed that this resource will be
|
| 302 |
+
* read from and written to by CUDA. This is the default value.
|
| 303 |
+
* - ::cudaGraphicsRegisterFlagsReadOnly: Specifies that CUDA
|
| 304 |
+
* will not write to this resource.
|
| 305 |
+
* - ::cudaGraphicsRegisterFlagsWriteDiscard: Specifies that
|
| 306 |
+
* CUDA will not read from this resource and will write over the
|
| 307 |
+
* entire contents of the resource, so none of the data previously
|
| 308 |
+
* stored in the resource will be preserved.
|
| 309 |
+
*
|
| 310 |
+
* The EGLImageKHR is an object which can be used to create EGLImage target resource. It is defined as a void pointer.
|
| 311 |
+
* typedef void* EGLImageKHR
|
| 312 |
+
*
|
| 313 |
+
* \param pCudaResource - Pointer to the returned object handle
|
| 314 |
+
* \param image - An EGLImageKHR image which can be used to create target resource.
|
| 315 |
+
* \param flags - Map flags
|
| 316 |
+
*
|
| 317 |
+
* \return
|
| 318 |
+
* ::cudaSuccess,
|
| 319 |
+
* ::cudaErrorInvalidResourceHandle,
|
| 320 |
+
* ::cudaErrorInvalidValue,
|
| 321 |
+
* ::cudaErrorUnknown
|
| 322 |
+
*
|
| 323 |
+
* \sa
|
| 324 |
+
* ::cudaGraphicsUnregisterResource,
|
| 325 |
+
* ::cudaGraphicsResourceGetMappedEglFrame,
|
| 326 |
+
* ::cuGraphicsEGLRegisterImage
|
| 327 |
+
*/
|
| 328 |
+
extern __host__ cudaError_t CUDARTAPI cudaGraphicsEGLRegisterImage(struct cudaGraphicsResource **pCudaResource, EGLImageKHR image, unsigned int flags);
|
| 329 |
+
|
| 330 |
+
/**
|
| 331 |
+
* \brief Connect CUDA to EGLStream as a consumer.
|
| 332 |
+
*
|
| 333 |
+
* Connect CUDA as a consumer to EGLStreamKHR specified by \p eglStream.
|
| 334 |
+
*
|
| 335 |
+
* The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one
|
| 336 |
+
* API to another.
|
| 337 |
+
*
|
| 338 |
+
* \param conn - Pointer to the returned connection handle
|
| 339 |
+
* \param eglStream - EGLStreamKHR handle
|
| 340 |
+
*
|
| 341 |
+
* \return
|
| 342 |
+
* ::cudaSuccess,
|
| 343 |
+
* ::cudaErrorInvalidValue,
|
| 344 |
+
* ::cudaErrorUnknown
|
| 345 |
+
*
|
| 346 |
+
* \sa
|
| 347 |
+
* ::cudaEGLStreamConsumerDisconnect,
|
| 348 |
+
* ::cudaEGLStreamConsumerAcquireFrame,
|
| 349 |
+
* ::cudaEGLStreamConsumerReleaseFrame,
|
| 350 |
+
* ::cuEGLStreamConsumerConnect
|
| 351 |
+
*/
|
| 352 |
+
extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerConnect(cudaEglStreamConnection *conn, EGLStreamKHR eglStream);
|
| 353 |
+
|
| 354 |
+
/**
|
| 355 |
+
* \brief Connect CUDA to EGLStream as a consumer with given flags.
|
| 356 |
+
*
|
| 357 |
+
* Connect CUDA as a consumer to EGLStreamKHR specified by \p stream with specified \p flags defined by
|
| 358 |
+
* ::cudaEglResourceLocationFlags.
|
| 359 |
+
*
|
| 360 |
+
* The flags specify whether the consumer wants to access frames from system memory or video memory.
|
| 361 |
+
* Default is ::cudaEglResourceLocationVidmem.
|
| 362 |
+
*
|
| 363 |
+
* \param conn - Pointer to the returned connection handle
|
| 364 |
+
* \param eglStream - EGLStreamKHR handle
|
| 365 |
+
* \param flags - Flags denote intended location - system or video.
|
| 366 |
+
*
|
| 367 |
+
* \return
|
| 368 |
+
* ::cudaSuccess,
|
| 369 |
+
* ::cudaErrorInvalidValue,
|
| 370 |
+
* ::cudaErrorUnknown
|
| 371 |
+
*
|
| 372 |
+
* \sa
|
| 373 |
+
* ::cudaEGLStreamConsumerDisconnect,
|
| 374 |
+
* ::cudaEGLStreamConsumerAcquireFrame,
|
| 375 |
+
* ::cudaEGLStreamConsumerReleaseFrame,
|
| 376 |
+
* ::cuEGLStreamConsumerConnectWithFlags
|
| 377 |
+
*/
|
| 378 |
+
extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerConnectWithFlags(cudaEglStreamConnection *conn, EGLStreamKHR eglStream, unsigned int flags);
|
| 379 |
+
|
| 380 |
+
/**
|
| 381 |
+
* \brief Disconnect CUDA as a consumer to EGLStream .
|
| 382 |
+
*
|
| 383 |
+
* Disconnect CUDA as a consumer to EGLStreamKHR.
|
| 384 |
+
*
|
| 385 |
+
* \param conn - Conection to disconnect.
|
| 386 |
+
*
|
| 387 |
+
* \return
|
| 388 |
+
* ::cudaSuccess,
|
| 389 |
+
* ::cudaErrorInvalidValue,
|
| 390 |
+
* ::cudaErrorUnknown
|
| 391 |
+
*
|
| 392 |
+
* \sa
|
| 393 |
+
* ::cudaEGLStreamConsumerConnect,
|
| 394 |
+
* ::cudaEGLStreamConsumerAcquireFrame,
|
| 395 |
+
* ::cudaEGLStreamConsumerReleaseFrame,
|
| 396 |
+
* ::cuEGLStreamConsumerDisconnect
|
| 397 |
+
*/
|
| 398 |
+
extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerDisconnect(cudaEglStreamConnection *conn);
|
| 399 |
+
|
| 400 |
+
/**
|
| 401 |
+
* \brief Acquire an image frame from the EGLStream with CUDA as a consumer.
|
| 402 |
+
*
|
| 403 |
+
* Acquire an image frame from EGLStreamKHR.
|
| 404 |
+
* ::cudaGraphicsResourceGetMappedEglFrame can be called on \p pCudaResource to get
|
| 405 |
+
* ::cudaEglFrame.
|
| 406 |
+
*
|
| 407 |
+
* \param conn - Connection on which to acquire
|
| 408 |
+
* \param pCudaResource - CUDA resource on which the EGLStream frame will be mapped for use.
|
| 409 |
+
* \param pStream - CUDA stream for synchronization and any data migrations
|
| 410 |
+
* implied by ::cudaEglResourceLocationFlags.
|
| 411 |
+
* \param timeout - Desired timeout in usec.
|
| 412 |
+
*
|
| 413 |
+
* \return
|
| 414 |
+
* ::cudaSuccess,
|
| 415 |
+
* ::cudaErrorInvalidValue,
|
| 416 |
+
* ::cudaErrorUnknown,
|
| 417 |
+
* ::cudaErrorLaunchTimeout
|
| 418 |
+
*
|
| 419 |
+
* \sa
|
| 420 |
+
* ::cudaEGLStreamConsumerConnect,
|
| 421 |
+
* ::cudaEGLStreamConsumerDisconnect,
|
| 422 |
+
* ::cudaEGLStreamConsumerReleaseFrame,
|
| 423 |
+
* ::cuEGLStreamConsumerAcquireFrame
|
| 424 |
+
*/
|
| 425 |
+
|
| 426 |
+
extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerAcquireFrame(cudaEglStreamConnection *conn,
|
| 427 |
+
cudaGraphicsResource_t *pCudaResource, cudaStream_t *pStream, unsigned int timeout);
|
| 428 |
+
/**
|
| 429 |
+
* \brief Releases the last frame acquired from the EGLStream.
|
| 430 |
+
*
|
| 431 |
+
* Release the acquired image frame specified by \p pCudaResource to EGLStreamKHR.
|
| 432 |
+
*
|
| 433 |
+
* \param conn - Connection on which to release
|
| 434 |
+
* \param pCudaResource - CUDA resource whose corresponding frame is to be released
|
| 435 |
+
* \param pStream - CUDA stream on which release will be done.
|
| 436 |
+
*
|
| 437 |
+
* \return
|
| 438 |
+
* ::cudaSuccess,
|
| 439 |
+
* ::cudaErrorInvalidValue,
|
| 440 |
+
* ::cudaErrorUnknown
|
| 441 |
+
*
|
| 442 |
+
* \sa
|
| 443 |
+
* ::cudaEGLStreamConsumerConnect,
|
| 444 |
+
* ::cudaEGLStreamConsumerDisconnect,
|
| 445 |
+
* ::cudaEGLStreamConsumerAcquireFrame,
|
| 446 |
+
* ::cuEGLStreamConsumerReleaseFrame
|
| 447 |
+
*/
|
| 448 |
+
extern __host__ cudaError_t CUDARTAPI cudaEGLStreamConsumerReleaseFrame(cudaEglStreamConnection *conn,
|
| 449 |
+
cudaGraphicsResource_t pCudaResource, cudaStream_t *pStream);
|
| 450 |
+
|
| 451 |
+
/**
|
| 452 |
+
* \brief Connect CUDA to EGLStream as a producer.
|
| 453 |
+
*
|
| 454 |
+
* Connect CUDA as a producer to EGLStreamKHR specified by \p stream.
|
| 455 |
+
*
|
| 456 |
+
* The EGLStreamKHR is an EGL object that transfers a sequence of image frames from one
|
| 457 |
+
* API to another.
|
| 458 |
+
*
|
| 459 |
+
* \param conn - Pointer to the returned connection handle
|
| 460 |
+
* \param eglStream - EGLStreamKHR handle
|
| 461 |
+
* \param width - width of the image to be submitted to the stream
|
| 462 |
+
* \param height - height of the image to be submitted to the stream
|
| 463 |
+
*
|
| 464 |
+
* \return
|
| 465 |
+
* ::cudaSuccess,
|
| 466 |
+
* ::cudaErrorInvalidValue,
|
| 467 |
+
* ::cudaErrorUnknown
|
| 468 |
+
*
|
| 469 |
+
* \sa
|
| 470 |
+
* ::cudaEGLStreamProducerDisconnect,
|
| 471 |
+
* ::cudaEGLStreamProducerPresentFrame,
|
| 472 |
+
* ::cudaEGLStreamProducerReturnFrame,
|
| 473 |
+
* ::cuEGLStreamProducerConnect
|
| 474 |
+
*/
|
| 475 |
+
extern __host__ cudaError_t CUDARTAPI cudaEGLStreamProducerConnect(cudaEglStreamConnection *conn,
|
| 476 |
+
EGLStreamKHR eglStream, EGLint width, EGLint height);
|
| 477 |
+
|
| 478 |
+
/**
|
| 479 |
+
* \brief Disconnect CUDA as a producer to EGLStream .
|
| 480 |
+
*
|
| 481 |
+
* Disconnect CUDA as a producer to EGLStreamKHR.
|
| 482 |
+
*
|
| 483 |
+
* \param conn - Conection to disconnect.
|
| 484 |
+
*
|
| 485 |
+
* \return
|
| 486 |
+
* ::cudaSuccess,
|
| 487 |
+
* ::cudaErrorInvalidValue,
|
| 488 |
+
* ::cudaErrorUnknown
|
| 489 |
+
*
|
| 490 |
+
* \sa
|
| 491 |
+
* ::cudaEGLStreamProducerConnect,
|
| 492 |
+
* ::cudaEGLStreamProducerPresentFrame,
|
| 493 |
+
* ::cudaEGLStreamProducerReturnFrame,
|
| 494 |
+
* ::cuEGLStreamProducerDisconnect
|
| 495 |
+
*/
|
| 496 |
+
extern __host__ cudaError_t CUDARTAPI cudaEGLStreamProducerDisconnect(cudaEglStreamConnection *conn);
|
| 497 |
+
|
| 498 |
+
/**
|
| 499 |
+
* \brief Present a CUDA eglFrame to the EGLStream with CUDA as a producer.
|
| 500 |
+
*
|
| 501 |
+
* The ::cudaEglFrame is defined as:
|
| 502 |
+
* \code
|
| 503 |
+
* typedef struct cudaEglFrame_st {
|
| 504 |
+
* union {
|
| 505 |
+
* cudaArray_t pArray[CUDA_EGL_MAX_PLANES];
|
| 506 |
+
* struct cudaPitchedPtr pPitch[CUDA_EGL_MAX_PLANES];
|
| 507 |
+
* } frame;
|
| 508 |
+
* cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES];
|
| 509 |
+
* unsigned int planeCount;
|
| 510 |
+
* cudaEglFrameType frameType;
|
| 511 |
+
* cudaEglColorFormat eglColorFormat;
|
| 512 |
+
* } cudaEglFrame;
|
| 513 |
+
* \endcode
|
| 514 |
+
*
|
| 515 |
+
* For ::cudaEglFrame of type ::cudaEglFrameTypePitch, the application may present sub-region of a memory
|
| 516 |
+
* allocation. In that case, ::cudaPitchedPtr::ptr will specify the start address of the sub-region in
|
| 517 |
+
* the allocation and ::cudaEglPlaneDesc will specify the dimensions of the sub-region.
|
| 518 |
+
*
|
| 519 |
+
* \param conn - Connection on which to present the CUDA array
|
| 520 |
+
* \param eglframe - CUDA Eglstream Proucer Frame handle to be sent to the consumer over EglStream.
|
| 521 |
+
* \param pStream - CUDA stream on which to present the frame.
|
| 522 |
+
*
|
| 523 |
+
* \return
|
| 524 |
+
* ::cudaSuccess,
|
| 525 |
+
* ::cudaErrorInvalidValue,
|
| 526 |
+
* ::cudaErrorUnknown
|
| 527 |
+
*
|
| 528 |
+
* \sa
|
| 529 |
+
* ::cudaEGLStreamProducerConnect,
|
| 530 |
+
* ::cudaEGLStreamProducerDisconnect,
|
| 531 |
+
* ::cudaEGLStreamProducerReturnFrame,
|
| 532 |
+
* ::cuEGLStreamProducerPresentFrame
|
| 533 |
+
*/
|
| 534 |
+
extern __host__ cudaError_t CUDARTAPI cudaEGLStreamProducerPresentFrame(cudaEglStreamConnection *conn,
|
| 535 |
+
cudaEglFrame eglframe, cudaStream_t *pStream);
|
| 536 |
+
|
| 537 |
+
/**
|
| 538 |
+
* \brief Return the CUDA eglFrame to the EGLStream last released by the consumer.
|
| 539 |
+
*
|
| 540 |
+
* This API can potentially return cudaErrorLaunchTimeout if the consumer has not
|
| 541 |
+
* returned a frame to EGL stream. If timeout is returned the application can retry.
|
| 542 |
+
*
|
| 543 |
+
* \param conn - Connection on which to present the CUDA array
|
| 544 |
+
* \param eglframe - CUDA Eglstream Proucer Frame handle returned from the consumer over EglStream.
|
| 545 |
+
* \param pStream - CUDA stream on which to return the frame.
|
| 546 |
+
*
|
| 547 |
+
* \return
|
| 548 |
+
* ::cudaSuccess,
|
| 549 |
+
* ::cudaErrorLaunchTimeout,
|
| 550 |
+
* ::cudaErrorInvalidValue,
|
| 551 |
+
* ::cudaErrorUnknown
|
| 552 |
+
*
|
| 553 |
+
* \sa
|
| 554 |
+
* ::cudaEGLStreamProducerConnect,
|
| 555 |
+
* ::cudaEGLStreamProducerDisconnect,
|
| 556 |
+
* ::cudaEGLStreamProducerPresentFrame,
|
| 557 |
+
* ::cuEGLStreamProducerReturnFrame
|
| 558 |
+
*/
|
| 559 |
+
extern __host__ cudaError_t CUDARTAPI cudaEGLStreamProducerReturnFrame(cudaEglStreamConnection *conn,
|
| 560 |
+
cudaEglFrame *eglframe, cudaStream_t *pStream);
|
| 561 |
+
|
| 562 |
+
/**
|
| 563 |
+
* \brief Get an eglFrame through which to access a registered EGL graphics resource.
|
| 564 |
+
*
|
| 565 |
+
* Returns in \p *eglFrame an eglFrame pointer through which the registered graphics resource
|
| 566 |
+
* \p resource may be accessed.
|
| 567 |
+
* This API can only be called for EGL graphics resources.
|
| 568 |
+
*
|
| 569 |
+
* The ::cudaEglFrame is defined as
|
| 570 |
+
* \code
|
| 571 |
+
* typedef struct cudaEglFrame_st {
|
| 572 |
+
* union {
|
| 573 |
+
* cudaArray_t pArray[CUDA_EGL_MAX_PLANES];
|
| 574 |
+
* struct cudaPitchedPtr pPitch[CUDA_EGL_MAX_PLANES];
|
| 575 |
+
* } frame;
|
| 576 |
+
* cudaEglPlaneDesc planeDesc[CUDA_EGL_MAX_PLANES];
|
| 577 |
+
* unsigned int planeCount;
|
| 578 |
+
* cudaEglFrameType frameType;
|
| 579 |
+
* cudaEglColorFormat eglColorFormat;
|
| 580 |
+
* } cudaEglFrame;
|
| 581 |
+
* \endcode
|
| 582 |
+
*
|
| 583 |
+
*
|
| 584 |
+
* \param eglFrame - Returned eglFrame.
|
| 585 |
+
* \param resource - Registered resource to access.
|
| 586 |
+
* \param index - Index for cubemap surfaces.
|
| 587 |
+
* \param mipLevel - Mipmap level for the subresource to access.
|
| 588 |
+
*
|
| 589 |
+
* \return
|
| 590 |
+
* ::cudaSuccess,
|
| 591 |
+
* ::cudaErrorInvalidValue,
|
| 592 |
+
* ::cudaErrorUnknown
|
| 593 |
+
*
|
| 594 |
+
* \note Note that in case of multiplanar \p *eglFrame, pitch of only first plane (unsigned int cudaEglPlaneDesc::pitch) is to be considered by the application.
|
| 595 |
+
*
|
| 596 |
+
* \sa
|
| 597 |
+
* ::cudaGraphicsSubResourceGetMappedArray,
|
| 598 |
+
* ::cudaGraphicsResourceGetMappedPointer,
|
| 599 |
+
* ::cuGraphicsResourceGetMappedEglFrame
|
| 600 |
+
*/
|
| 601 |
+
extern __host__ cudaError_t CUDARTAPI cudaGraphicsResourceGetMappedEglFrame(cudaEglFrame* eglFrame,
|
| 602 |
+
cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel);
|
| 603 |
+
|
| 604 |
+
/**
|
| 605 |
+
* \brief Creates an event from EGLSync object
|
| 606 |
+
*
|
| 607 |
+
* Creates an event *phEvent from an EGLSyncKHR eglSync with the flages specified
|
| 608 |
+
* via \p flags. Valid flags include:
|
| 609 |
+
* - ::cudaEventDefault: Default event creation flag.
|
| 610 |
+
* - ::cudaEventBlockingSync: Specifies that the created event should use blocking
|
| 611 |
+
* synchronization. A CPU thread that uses ::cudaEventSynchronize() to wait on
|
| 612 |
+
* an event created with this flag will block until the event has actually
|
| 613 |
+
* been completed.
|
| 614 |
+
*
|
| 615 |
+
* ::cudaEventRecord and TimingData are not supported for events created from EGLSync.
|
| 616 |
+
*
|
| 617 |
+
* The EGLSyncKHR is an opaque handle to an EGL sync object.
|
| 618 |
+
* typedef void* EGLSyncKHR
|
| 619 |
+
*
|
| 620 |
+
* \param phEvent - Returns newly created event
|
| 621 |
+
* \param eglSync - Opaque handle to EGLSync object
|
| 622 |
+
* \param flags - Event creation flags
|
| 623 |
+
*
|
| 624 |
+
* \return
|
| 625 |
+
* ::cudaSuccess,
|
| 626 |
+
* ::cudaErrorInitializationError,
|
| 627 |
+
* ::cudaErrorInvalidValue,
|
| 628 |
+
* ::cudaErrorLaunchFailure,
|
| 629 |
+
* ::cudaErrorMemoryAllocation
|
| 630 |
+
*
|
| 631 |
+
* \sa
|
| 632 |
+
* ::cudaEventQuery,
|
| 633 |
+
* ::cudaEventSynchronize,
|
| 634 |
+
* ::cudaEventDestroy
|
| 635 |
+
*/
|
| 636 |
+
extern __host__ cudaError_t CUDARTAPI cudaEventCreateFromEGLSync(cudaEvent_t *phEvent, EGLSyncKHR eglSync, unsigned int flags);
|
| 637 |
+
|
| 638 |
+
/** @} */ /* END CUDART_EGL */
|
| 639 |
+
|
| 640 |
+
#if defined(__cplusplus)
|
| 641 |
+
}
|
| 642 |
+
#endif /* __cplusplus */
|
| 643 |
+
|
| 644 |
+
#endif /* __CUDA_EGL_INTEROP_H__ */
|
| 645 |
+
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda_fp16.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda_fp16.hpp
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lib/python3.11/site-packages/nvidia/cu13/include/cuda_fp4.h
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2024 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#ifndef __CUDA_FP4_H__
|
| 51 |
+
#define __CUDA_FP4_H__
|
| 52 |
+
|
| 53 |
+
/* Set up function decorations */
|
| 54 |
+
#if defined(__CUDACC__)
|
| 55 |
+
#define __CUDA_FP4_DECL__ static __device__ __inline__
|
| 56 |
+
#define __CUDA_HOSTDEVICE_FP4__ __host__ __device__
|
| 57 |
+
#define __CUDA_HOSTDEVICE_FP4_DECL__ static __host__ __device__ __inline__
|
| 58 |
+
#else /* !defined(__CUDACC__) */
|
| 59 |
+
#if defined(__GNUC__)
|
| 60 |
+
#define __CUDA_HOSTDEVICE_FP4_DECL__ static __attribute__((unused))
|
| 61 |
+
#else
|
| 62 |
+
#define __CUDA_HOSTDEVICE_FP4_DECL__ static
|
| 63 |
+
#endif /* defined(__GNUC__) */
|
| 64 |
+
#define __CUDA_HOSTDEVICE_FP4__
|
| 65 |
+
#endif /* defined(__CUDACC_) */
|
| 66 |
+
|
| 67 |
+
#if !defined(_MSC_VER) && __cplusplus >= 201103L
|
| 68 |
+
#define __CPP_VERSION_AT_LEAST_11_FP4
|
| 69 |
+
#elif _MSC_FULL_VER >= 190024210 && _MSVC_LANG >= 201103L
|
| 70 |
+
#define __CPP_VERSION_AT_LEAST_11_FP4
|
| 71 |
+
#endif
|
| 72 |
+
|
| 73 |
+
/* bring in fp6 types infrastructure and dependencies */
|
| 74 |
+
#include "cuda_fp6.h"
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* \defgroup CUDA_MATH_INTRINSIC_FP4 FP4 Intrinsics
|
| 78 |
+
* This section describes fp4 intrinsic functions.
|
| 79 |
+
* To use these functions, include the header file \p cuda_fp4.h in your
|
| 80 |
+
* program.
|
| 81 |
+
*
|
| 82 |
+
* \note Most of the operations defined here benefit from native HW support
|
| 83 |
+
* when compiled for specific GPU targets (e.g. devices of compute capability 10.0a),
|
| 84 |
+
* other targets use emulation path.
|
| 85 |
+
*
|
| 86 |
+
* The following macros are available to help users selectively enable/disable
|
| 87 |
+
* various definitions present in the header file:
|
| 88 |
+
* - \p __CUDA_NO_FP4_CONVERSIONS__ - If defined, this macro will prevent any
|
| 89 |
+
* use of the C++ type conversions (converting constructors and conversion
|
| 90 |
+
* operators) defined in the header.
|
| 91 |
+
* - \p __CUDA_NO_FP4_CONVERSION_OPERATORS__ - If defined, this macro will
|
| 92 |
+
* prevent any use of the C++ conversion operators from \p fp4 to other types.
|
| 93 |
+
*/
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
* \defgroup CUDA_MATH_FP4_MISC FP4 Conversion and Data Movement
|
| 97 |
+
* \ingroup CUDA_MATH_INTRINSIC_FP4
|
| 98 |
+
* To use these functions, include the header file \p cuda_fp4.h in your
|
| 99 |
+
* program.
|
| 100 |
+
*/
|
| 101 |
+
|
| 102 |
+
/**
|
| 103 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 104 |
+
* \brief 8-bit \p unsigned \p integer
|
| 105 |
+
* type abstraction used for \p fp4 floating-point
|
| 106 |
+
* numbers storage.
|
| 107 |
+
*/
|
| 108 |
+
typedef __nv_fp8_storage_t __nv_fp4_storage_t;
|
| 109 |
+
|
| 110 |
+
/**
|
| 111 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 112 |
+
* \brief 8-bit \p unsigned \p integer
|
| 113 |
+
* type abstraction used for storage of pairs of
|
| 114 |
+
* \p fp4 floating-point numbers.
|
| 115 |
+
*/
|
| 116 |
+
typedef __nv_fp8_storage_t __nv_fp4x2_storage_t;
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 120 |
+
* \brief 16-bit \p unsigned \p integer
|
| 121 |
+
* type abstraction used for storage of tetrads of
|
| 122 |
+
* \p fp4 floating-point numbers.
|
| 123 |
+
*/
|
| 124 |
+
typedef __nv_fp8x2_storage_t __nv_fp4x4_storage_t;
|
| 125 |
+
|
| 126 |
+
/**
|
| 127 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 128 |
+
* \brief Enumerates the possible
|
| 129 |
+
* interpretations of the 4-bit values when referring to them as
|
| 130 |
+
* \p fp4 types.
|
| 131 |
+
*/
|
| 132 |
+
typedef enum __nv_fp4_interpretation_t {
|
| 133 |
+
__NV_E2M1, /**< Stands for \p fp4 numbers of \p e2m1 kind. */
|
| 134 |
+
} __nv_fp4_interpretation_t;
|
| 135 |
+
|
| 136 |
+
/* Forward-declaration of C-style APIs */
|
| 137 |
+
|
| 138 |
+
/**
|
| 139 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 140 |
+
* \brief Converts input \p double precision \p x to \p fp4 type of the
|
| 141 |
+
* requested kind using specified rounding mode and saturating
|
| 142 |
+
* the out-of-range values.
|
| 143 |
+
*
|
| 144 |
+
* \details Converts input \p x to \p fp4 type of the kind specified by
|
| 145 |
+
* \p fp4_interpretation parameter,
|
| 146 |
+
* using rounding mode specified by \p rounding parameter.
|
| 147 |
+
* Large out-of-range values saturate to MAXNORM of the same sign.
|
| 148 |
+
* \p NaN input values result in positive MAXNORM.
|
| 149 |
+
*
|
| 150 |
+
* \returns
|
| 151 |
+
* - The \p __nv_fp4_storage_t value holds the result of conversion.
|
| 152 |
+
*/
|
| 153 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __nv_fp4_storage_t
|
| 154 |
+
__nv_cvt_double_to_fp4(const double x,
|
| 155 |
+
const __nv_fp4_interpretation_t fp4_interpretation,
|
| 156 |
+
const enum cudaRoundMode rounding);
|
| 157 |
+
|
| 158 |
+
/**
|
| 159 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 160 |
+
* \brief Converts input vector of two \p double precision numbers packed
|
| 161 |
+
* in \p double2 \p x into a vector of two values of \p fp4 type of the
|
| 162 |
+
* requested kind using specified rounding mode and saturating
|
| 163 |
+
* the out-of-range values.
|
| 164 |
+
*
|
| 165 |
+
* \details Converts input vector \p x to a vector of two \p fp4 values of the
|
| 166 |
+
* kind specified by \p fp4_interpretation parameter, using
|
| 167 |
+
* rounding mode specified by \p rounding parameter.
|
| 168 |
+
* Large out-of-range values saturate to MAXNORM of the same sign.
|
| 169 |
+
* \p NaN input values result in positive MAXNORM.
|
| 170 |
+
*
|
| 171 |
+
* \returns
|
| 172 |
+
* - The \p __nv_fp4x2_storage_t value holds the result of conversion.
|
| 173 |
+
*/
|
| 174 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __nv_fp4x2_storage_t
|
| 175 |
+
__nv_cvt_double2_to_fp4x2(const double2 x,
|
| 176 |
+
const __nv_fp4_interpretation_t fp4_interpretation,
|
| 177 |
+
const enum cudaRoundMode rounding);
|
| 178 |
+
|
| 179 |
+
/**
|
| 180 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 181 |
+
* \brief Converts input \p single precision \p x to \p fp4 type of the
|
| 182 |
+
* requested kind using specified rounding mode and saturating
|
| 183 |
+
* the out-of-range values.
|
| 184 |
+
*
|
| 185 |
+
* \details Converts input \p x to \p fp4 type of the kind specified by
|
| 186 |
+
* \p fp4_interpretation parameter, using
|
| 187 |
+
* rounding mode specified by \p rounding parameter.
|
| 188 |
+
* Large out-of-range values saturate to MAXNORM of the same sign.
|
| 189 |
+
* \p NaN input values result in positive MAXNORM.
|
| 190 |
+
*
|
| 191 |
+
* \returns
|
| 192 |
+
* - The \p __nv_fp4_storage_t value holds the result of conversion.
|
| 193 |
+
*/
|
| 194 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __nv_fp4_storage_t
|
| 195 |
+
__nv_cvt_float_to_fp4(const float x,
|
| 196 |
+
const __nv_fp4_interpretation_t fp4_interpretation,
|
| 197 |
+
const enum cudaRoundMode rounding);
|
| 198 |
+
|
| 199 |
+
/**
|
| 200 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 201 |
+
* \brief Converts input vector of two \p single precision numbers packed
|
| 202 |
+
* in \p float2 \p x into a vector of two values of \p fp4 type of the
|
| 203 |
+
* requested kind using specified rounding mode and saturating
|
| 204 |
+
* the out-of-range values.
|
| 205 |
+
*
|
| 206 |
+
* \details Converts input vector \p x to a vector of two \p fp4 values of the
|
| 207 |
+
* kind specified by \p fp4_interpretation parameter,
|
| 208 |
+
* using rounding mode specified by \p rounding parameter.
|
| 209 |
+
* Large out-of-range values saturate to MAXNORM of the same sign.
|
| 210 |
+
* \p NaN input values result in positive MAXNORM.
|
| 211 |
+
*
|
| 212 |
+
* \returns
|
| 213 |
+
* - The \p __nv_fp4x2_storage_t value holds the result of conversion.
|
| 214 |
+
*/
|
| 215 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __nv_fp4x2_storage_t
|
| 216 |
+
__nv_cvt_float2_to_fp4x2(const float2 x,
|
| 217 |
+
const __nv_fp4_interpretation_t fp4_interpretation,
|
| 218 |
+
const enum cudaRoundMode rounding);
|
| 219 |
+
|
| 220 |
+
/**
|
| 221 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 222 |
+
* \brief Converts input \p half precision \p x to \p fp4 type of the
|
| 223 |
+
* requested kind using specified rounding mode and saturating
|
| 224 |
+
* the out-of-range values.
|
| 225 |
+
*
|
| 226 |
+
* \details Converts input \p x to \p fp4 type of the kind specified by
|
| 227 |
+
* \p fp4_interpretation parameter,
|
| 228 |
+
* using rounding mode specified by \p rounding parameter.
|
| 229 |
+
* Large out-of-range values saturate to MAXNORM of the same sign.
|
| 230 |
+
* \p NaN input values result in positive MAXNORM.
|
| 231 |
+
*
|
| 232 |
+
* \returns
|
| 233 |
+
* - The \p __nv_fp4_storage_t value holds the result of conversion.
|
| 234 |
+
*/
|
| 235 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __nv_fp4_storage_t
|
| 236 |
+
__nv_cvt_halfraw_to_fp4(const __half_raw x,
|
| 237 |
+
const __nv_fp4_interpretation_t fp4_interpretation,
|
| 238 |
+
const enum cudaRoundMode rounding);
|
| 239 |
+
|
| 240 |
+
/**
|
| 241 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 242 |
+
* \brief Converts input vector of two \p half precision numbers packed
|
| 243 |
+
* in \p __half2_raw \p x into a vector of two values of \p fp4 type of the
|
| 244 |
+
* requested kind using specified rounding mode and saturating
|
| 245 |
+
* the out-of-range values.
|
| 246 |
+
*
|
| 247 |
+
* \details Converts input vector \p x to a vector of two \p fp4 values of the
|
| 248 |
+
* kind specified by \p fp4_interpretation parameter,
|
| 249 |
+
* using rounding mode specified by \p rounding parameter.
|
| 250 |
+
* Large out-of-range values saturate to MAXNORM of the same sign.
|
| 251 |
+
* \p NaN input values result in positive MAXNORM.
|
| 252 |
+
*
|
| 253 |
+
* \returns
|
| 254 |
+
* - The \p __nv_fp4x2_storage_t value holds the result of conversion.
|
| 255 |
+
*/
|
| 256 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __nv_fp4x2_storage_t __nv_cvt_halfraw2_to_fp4x2(
|
| 257 |
+
const __half2_raw x,
|
| 258 |
+
const __nv_fp4_interpretation_t fp4_interpretation,
|
| 259 |
+
const enum cudaRoundMode rounding);
|
| 260 |
+
|
| 261 |
+
/**
|
| 262 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 263 |
+
* \brief Converts input \p nv_bfloat16 precision \p x to \p fp4 type of the
|
| 264 |
+
* requested kind using specified rounding mode and saturating
|
| 265 |
+
* the out-of-range values.
|
| 266 |
+
*
|
| 267 |
+
* \details Converts input \p x to \p fp4 type of the kind specified by
|
| 268 |
+
* \p fp4_interpretation parameter,
|
| 269 |
+
* using rounding mode specified by \p rounding parameter.
|
| 270 |
+
* Large out-of-range values saturate to MAXNORM of the same sign.
|
| 271 |
+
* \p NaN input values result in positive MAXNORM.
|
| 272 |
+
*
|
| 273 |
+
* \returns
|
| 274 |
+
* - The \p __nv_fp4_storage_t value holds the result of conversion.
|
| 275 |
+
*/
|
| 276 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __nv_fp4_storage_t __nv_cvt_bfloat16raw_to_fp4(
|
| 277 |
+
const __nv_bfloat16_raw x,
|
| 278 |
+
const __nv_fp4_interpretation_t fp4_interpretation,
|
| 279 |
+
const enum cudaRoundMode rounding);
|
| 280 |
+
|
| 281 |
+
/**
|
| 282 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 283 |
+
* \brief Converts input vector of two \p nv_bfloat16 precision numbers packed
|
| 284 |
+
* in \p __nv_bfloat162_raw \p x into a vector of two values of \p fp4 type of the
|
| 285 |
+
* requested kind using specified rounding mode and saturating
|
| 286 |
+
* the out-of-range values.
|
| 287 |
+
*
|
| 288 |
+
* \details Converts input vector \p x to a vector of two \p fp4 values of the
|
| 289 |
+
* kind specified by \p fp4_interpretation parameter,
|
| 290 |
+
* using rounding mode specified by \p rounding parameter.
|
| 291 |
+
* Large out-of-range values saturate to MAXNORM of the same sign.
|
| 292 |
+
* \p NaN input values result in positive MAXNORM.
|
| 293 |
+
*
|
| 294 |
+
* \returns
|
| 295 |
+
* - The \p __nv_fp4x2_storage_t value holds the result of conversion.
|
| 296 |
+
*/
|
| 297 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __nv_fp4x2_storage_t
|
| 298 |
+
__nv_cvt_bfloat16raw2_to_fp4x2(
|
| 299 |
+
const __nv_bfloat162_raw x,
|
| 300 |
+
const __nv_fp4_interpretation_t fp4_interpretation,
|
| 301 |
+
const enum cudaRoundMode rounding);
|
| 302 |
+
|
| 303 |
+
/**
|
| 304 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 305 |
+
* \brief Converts input \p fp4 \p x of the specified kind
|
| 306 |
+
* to \p half precision.
|
| 307 |
+
*
|
| 308 |
+
* \details Converts input \p x of \p fp4 type of the kind specified by
|
| 309 |
+
* \p fp4_interpretation parameter
|
| 310 |
+
* to \p half precision.
|
| 311 |
+
*
|
| 312 |
+
* \returns
|
| 313 |
+
* - The \p __half_raw value holds the result of conversion.
|
| 314 |
+
*/
|
| 315 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __half_raw
|
| 316 |
+
__nv_cvt_fp4_to_halfraw(const __nv_fp4_storage_t x,
|
| 317 |
+
const __nv_fp4_interpretation_t fp4_interpretation);
|
| 318 |
+
/**
|
| 319 |
+
* \ingroup CUDA_MATH_FP4_MISC
|
| 320 |
+
* \brief Converts input vector of two \p fp4 values of the specified kind
|
| 321 |
+
* to a vector of two \p half precision values packed in \p __half2_raw
|
| 322 |
+
* structure.
|
| 323 |
+
*
|
| 324 |
+
* \details Converts input vector \p x of \p fp4 type of the kind specified by
|
| 325 |
+
* \p fp4_interpretation parameter
|
| 326 |
+
* to a vector of two \p half precision values and returns as \p __half2_raw
|
| 327 |
+
* structure.
|
| 328 |
+
*
|
| 329 |
+
* \returns
|
| 330 |
+
* - The \p __half2_raw value holds the result of conversion.
|
| 331 |
+
*/
|
| 332 |
+
__CUDA_HOSTDEVICE_FP4_DECL__ __half2_raw
|
| 333 |
+
__nv_cvt_fp4x2_to_halfraw2(const __nv_fp4x2_storage_t x,
|
| 334 |
+
const __nv_fp4_interpretation_t fp4_interpretation);
|
| 335 |
+
|
| 336 |
+
#if defined(__cplusplus)
|
| 337 |
+
|
| 338 |
+
#define __CUDA_FP4_TYPES_EXIST__
|
| 339 |
+
|
| 340 |
+
/* Forward-declaration of structures defined in "cuda_fp4.hpp" */
|
| 341 |
+
struct __nv_fp4_e2m1;
|
| 342 |
+
struct __nv_fp4x2_e2m1;
|
| 343 |
+
struct __nv_fp4x4_e2m1;
|
| 344 |
+
|
| 345 |
+
#endif /* defined(__cplusplus) */
|
| 346 |
+
|
| 347 |
+
#include "cuda_fp4.hpp"
|
| 348 |
+
|
| 349 |
+
#undef __CUDA_FP4_DECL__
|
| 350 |
+
#undef __CUDA_HOSTDEVICE_FP4__
|
| 351 |
+
#undef __CUDA_HOSTDEVICE_FP4_DECL__
|
| 352 |
+
|
| 353 |
+
#if defined(__CPP_VERSION_AT_LEAST_11_FP4)
|
| 354 |
+
#undef __CPP_VERSION_AT_LEAST_11_FP4
|
| 355 |
+
#endif /* defined(__CPP_VERSION_AT_LEAST_11_FP4) */
|
| 356 |
+
|
| 357 |
+
#endif /* end of include guard: __CUDA_FP4_H__ */
|