Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:45:12

0001 /*
0002  * SPDX-FileCopyrightText: Copyright (c) 2009-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
0003  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0004  *
0005  * Licensed under the Apache License, Version 2.0 (the "License");
0006  * you may not use this file except in compliance with the License.
0007  * You may obtain a copy of the License at
0008  *
0009  *     http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  *
0017  * Licensed under the Apache License v2.0 with LLVM Exceptions.
0018  * See https://nvidia.github.io/NVTX/LICENSE.txt for license information.
0019  */
0020 
0021 #ifndef NVTX_IMPL_GUARD_CUDART
0022 #error Never include this file directly -- it is automatically included by nvToolsExtCudaRt.h (except when NVTX_NO_IMPL is defined).
0023 #endif
0024 
0025 #if defined(NVTX_AS_SYSTEM_HEADER)
0026 #if defined(__clang__)
0027 #pragma clang system_header
0028 #elif defined(__GNUC__) || defined(__NVCOMPILER)
0029 #pragma GCC system_header
0030 #elif defined(_MSC_VER)
0031 #pragma system_header
0032 #endif
0033 #endif
0034 
0035 
0036 #ifdef __cplusplus
0037 extern "C" {
0038 #endif /* __cplusplus */
0039 
0040 typedef void (NVTX_API * nvtxNameCudaDeviceA_impl_fntype)(int device, const char* name);
0041 typedef void (NVTX_API * nvtxNameCudaDeviceW_impl_fntype)(int device, const wchar_t* name);
0042 typedef void (NVTX_API * nvtxNameCudaStreamA_impl_fntype)(cudaStream_t stream, const char* name);
0043 typedef void (NVTX_API * nvtxNameCudaStreamW_impl_fntype)(cudaStream_t stream, const wchar_t* name);
0044 typedef void (NVTX_API * nvtxNameCudaEventA_impl_fntype)(cudaEvent_t event, const char* name);
0045 typedef void (NVTX_API * nvtxNameCudaEventW_impl_fntype)(cudaEvent_t event, const wchar_t* name);
0046 
0047 NVTX_DECLSPEC void NVTX_API nvtxNameCudaDeviceA(int device, const char* name)
0048 {
0049     NVTX_SET_NAME_MANGLING_OPTIONS
0050 #ifdef NVTX_DISABLE
0051     (void)device;
0052     (void)name;
0053 #else /* NVTX_DISABLE */
0054     nvtxNameCudaDeviceA_impl_fntype local = NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameCudaDeviceA_impl_fnptr;
0055     if (local != NVTX_NULLPTR)
0056         (*local)(device, name);
0057 #endif /* NVTX_DISABLE */
0058 }
0059 
0060 NVTX_DECLSPEC void NVTX_API nvtxNameCudaDeviceW(int device, const wchar_t* name)
0061 {
0062     NVTX_SET_NAME_MANGLING_OPTIONS
0063 #ifdef NVTX_DISABLE
0064     (void)device;
0065     (void)name;
0066 #else /* NVTX_DISABLE */
0067     nvtxNameCudaDeviceW_impl_fntype local = NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameCudaDeviceW_impl_fnptr;
0068     if (local != NVTX_NULLPTR)
0069         (*local)(device, name);
0070 #endif /* NVTX_DISABLE */
0071 }
0072 
0073 NVTX_DECLSPEC void NVTX_API nvtxNameCudaStreamA(cudaStream_t stream, const char* name)
0074 {
0075     NVTX_SET_NAME_MANGLING_OPTIONS
0076 #ifdef NVTX_DISABLE
0077     (void)stream;
0078     (void)name;
0079 #else /* NVTX_DISABLE */
0080     nvtxNameCudaStreamA_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameCudaStreamA_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameCudaStreamA_impl_fnptr);
0081     if (local != NVTX_NULLPTR)
0082         (*local)(stream, name);
0083 #endif /* NVTX_DISABLE */
0084 }
0085 
0086 NVTX_DECLSPEC void NVTX_API nvtxNameCudaStreamW(cudaStream_t stream, const wchar_t* name)
0087 {
0088     NVTX_SET_NAME_MANGLING_OPTIONS
0089 #ifdef NVTX_DISABLE
0090     (void)stream;
0091     (void)name;
0092 #else /* NVTX_DISABLE */
0093     nvtxNameCudaStreamW_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameCudaStreamW_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameCudaStreamW_impl_fnptr);
0094     if (local != NVTX_NULLPTR)
0095         (*local)(stream, name);
0096 #endif /* NVTX_DISABLE */
0097 }
0098 
0099 NVTX_DECLSPEC void NVTX_API nvtxNameCudaEventA(cudaEvent_t event, const char* name)
0100 {
0101     NVTX_SET_NAME_MANGLING_OPTIONS
0102 #ifdef NVTX_DISABLE
0103     (void)event;
0104     (void)name;
0105 #else /* NVTX_DISABLE */
0106     nvtxNameCudaEventA_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameCudaEventA_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameCudaEventA_impl_fnptr);
0107     if (local != NVTX_NULLPTR)
0108         (*local)(event, name);
0109 #endif /* NVTX_DISABLE */
0110 }
0111 
0112 NVTX_DECLSPEC void NVTX_API nvtxNameCudaEventW(cudaEvent_t event, const wchar_t* name)
0113 {
0114     NVTX_SET_NAME_MANGLING_OPTIONS
0115 #ifdef NVTX_DISABLE
0116     (void)event;
0117     (void)name;
0118 #else /* NVTX_DISABLE */
0119     nvtxNameCudaEventW_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameCudaEventW_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameCudaEventW_impl_fnptr);
0120     if (local != NVTX_NULLPTR)
0121         (*local)(event, name);
0122 #endif /* NVTX_DISABLE */
0123 }
0124 
0125 #ifdef __cplusplus
0126 } /* extern "C" */
0127 #endif /* __cplusplus */
0128