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_OPENCL
0022 #error Never include this file directly -- it is automatically included by nvToolsExtCuda.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 * nvtxNameClDeviceA_impl_fntype)(cl_device_id device, const char* name);
0041 typedef void (NVTX_API * nvtxNameClDeviceW_impl_fntype)(cl_device_id device, const wchar_t* name);
0042 typedef void (NVTX_API * nvtxNameClContextA_impl_fntype)(cl_context context, const char* name);
0043 typedef void (NVTX_API * nvtxNameClContextW_impl_fntype)(cl_context context, const wchar_t* name);
0044 typedef void (NVTX_API * nvtxNameClCommandQueueA_impl_fntype)(cl_command_queue command_queue, const char* name);
0045 typedef void (NVTX_API * nvtxNameClCommandQueueW_impl_fntype)(cl_command_queue command_queue, const wchar_t* name);
0046 typedef void (NVTX_API * nvtxNameClMemObjectA_impl_fntype)(cl_mem memobj, const char* name);
0047 typedef void (NVTX_API * nvtxNameClMemObjectW_impl_fntype)(cl_mem memobj, const wchar_t* name);
0048 typedef void (NVTX_API * nvtxNameClSamplerA_impl_fntype)(cl_sampler sampler, const char* name);
0049 typedef void (NVTX_API * nvtxNameClSamplerW_impl_fntype)(cl_sampler sampler, const wchar_t* name);
0050 typedef void (NVTX_API * nvtxNameClProgramA_impl_fntype)(cl_program program, const char* name);
0051 typedef void (NVTX_API * nvtxNameClProgramW_impl_fntype)(cl_program program, const wchar_t* name);
0052 typedef void (NVTX_API * nvtxNameClEventA_impl_fntype)(cl_event evnt, const char* name);
0053 typedef void (NVTX_API * nvtxNameClEventW_impl_fntype)(cl_event evnt, const wchar_t* name);
0054 
0055 NVTX_DECLSPEC void NVTX_API nvtxNameClDeviceA(cl_device_id device, const char* name)
0056 {
0057     NVTX_SET_NAME_MANGLING_OPTIONS
0058 #ifdef NVTX_DISABLE
0059     (void)device;
0060     (void)name;
0061 #else /* NVTX_DISABLE */
0062     nvtxNameClDeviceA_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClDeviceA_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClDeviceA_impl_fnptr);
0063     if (local != NVTX_NULLPTR)
0064         (*local)(device, name);
0065 #endif /* NVTX_DISABLE */
0066 }
0067 
0068 NVTX_DECLSPEC void NVTX_API nvtxNameClDeviceW(cl_device_id device, const wchar_t* name)
0069 {
0070     NVTX_SET_NAME_MANGLING_OPTIONS
0071 #ifdef NVTX_DISABLE
0072     (void)device;
0073     (void)name;
0074 #else /* NVTX_DISABLE */
0075     nvtxNameClDeviceW_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClDeviceW_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClDeviceW_impl_fnptr);
0076     if (local != NVTX_NULLPTR)
0077         (*local)(device, name);
0078 #endif /* NVTX_DISABLE */
0079 }
0080 
0081 NVTX_DECLSPEC void NVTX_API nvtxNameClContextA(cl_context context, const char* name)
0082 {
0083     NVTX_SET_NAME_MANGLING_OPTIONS
0084 #ifdef NVTX_DISABLE
0085     (void)context;
0086     (void)name;
0087 #else /* NVTX_DISABLE */
0088     nvtxNameClContextA_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClContextA_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClContextA_impl_fnptr);
0089     if (local != NVTX_NULLPTR)
0090         (*local)(context, name);
0091 #endif /* NVTX_DISABLE */
0092 }
0093 
0094 NVTX_DECLSPEC void NVTX_API nvtxNameClContextW(cl_context context, const wchar_t* name)
0095 {
0096     NVTX_SET_NAME_MANGLING_OPTIONS
0097 #ifdef NVTX_DISABLE
0098     (void)context;
0099     (void)name;
0100 #else /* NVTX_DISABLE */
0101     nvtxNameClContextW_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClContextW_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClContextW_impl_fnptr);
0102     if (local != NVTX_NULLPTR)
0103         (*local)(context, name);
0104 #endif /* NVTX_DISABLE */
0105 }
0106 
0107 NVTX_DECLSPEC void NVTX_API nvtxNameClCommandQueueA(cl_command_queue command_queue, const char* name)
0108 {
0109     NVTX_SET_NAME_MANGLING_OPTIONS
0110 #ifdef NVTX_DISABLE
0111     (void)command_queue;
0112     (void)name;
0113 #else /* NVTX_DISABLE */
0114     nvtxNameClCommandQueueA_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClCommandQueueA_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClCommandQueueA_impl_fnptr);
0115     if (local != NVTX_NULLPTR)
0116         (*local)(command_queue, name);
0117 #endif /* NVTX_DISABLE */
0118 }
0119 
0120 NVTX_DECLSPEC void NVTX_API nvtxNameClCommandQueueW(cl_command_queue command_queue, const wchar_t* name)
0121 {
0122     NVTX_SET_NAME_MANGLING_OPTIONS
0123 #ifdef NVTX_DISABLE
0124     (void)command_queue;
0125     (void)name;
0126 #else /* NVTX_DISABLE */
0127     nvtxNameClCommandQueueW_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClCommandQueueW_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClCommandQueueW_impl_fnptr);
0128     if (local != NVTX_NULLPTR)
0129         (*local)(command_queue, name);
0130 #endif /* NVTX_DISABLE */
0131 }
0132 
0133 NVTX_DECLSPEC void NVTX_API nvtxNameClMemObjectA(cl_mem memobj, const char* name)
0134 {
0135     NVTX_SET_NAME_MANGLING_OPTIONS
0136 #ifdef NVTX_DISABLE
0137     (void)memobj;
0138     (void)name;
0139 #else /* NVTX_DISABLE */
0140     nvtxNameClMemObjectA_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClMemObjectA_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClMemObjectA_impl_fnptr);
0141     if (local != NVTX_NULLPTR)
0142         (*local)(memobj, name);
0143 #endif /* NVTX_DISABLE */
0144 }
0145 
0146 NVTX_DECLSPEC void NVTX_API nvtxNameClMemObjectW(cl_mem memobj, const wchar_t* name)
0147 {
0148     NVTX_SET_NAME_MANGLING_OPTIONS
0149 #ifdef NVTX_DISABLE
0150     (void)memobj;
0151     (void)name;
0152 #else /* NVTX_DISABLE */
0153     nvtxNameClMemObjectW_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClMemObjectW_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClMemObjectW_impl_fnptr);
0154     if (local != NVTX_NULLPTR)
0155         (*local)(memobj, name);
0156 #endif /* NVTX_DISABLE */
0157 }
0158 
0159 NVTX_DECLSPEC void NVTX_API nvtxNameClSamplerA(cl_sampler sampler, const char* name)
0160 {
0161     NVTX_SET_NAME_MANGLING_OPTIONS
0162 #ifdef NVTX_DISABLE
0163     (void)sampler;
0164     (void)name;
0165 #else /* NVTX_DISABLE */
0166     nvtxNameClSamplerA_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClSamplerA_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClSamplerA_impl_fnptr);
0167     if (local != NVTX_NULLPTR)
0168         (*local)(sampler, name);
0169 #endif /* NVTX_DISABLE */
0170 }
0171 
0172 NVTX_DECLSPEC void NVTX_API nvtxNameClSamplerW(cl_sampler sampler, const wchar_t* name)
0173 {
0174     NVTX_SET_NAME_MANGLING_OPTIONS
0175 #ifdef NVTX_DISABLE
0176     (void)sampler;
0177     (void)name;
0178 #else /* NVTX_DISABLE */
0179     nvtxNameClSamplerW_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClSamplerW_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClSamplerW_impl_fnptr);
0180     if (local != NVTX_NULLPTR)
0181         (*local)(sampler, name);
0182 #endif /* NVTX_DISABLE */
0183 }
0184 
0185 NVTX_DECLSPEC void NVTX_API nvtxNameClProgramA(cl_program program, const char* name)
0186 {
0187     NVTX_SET_NAME_MANGLING_OPTIONS
0188 #ifdef NVTX_DISABLE
0189     (void)program;
0190     (void)name;
0191 #else /* NVTX_DISABLE */
0192     nvtxNameClProgramA_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClProgramA_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClProgramA_impl_fnptr);
0193     if (local != NVTX_NULLPTR)
0194         (*local)(program, name);
0195 #endif /* NVTX_DISABLE */
0196 }
0197 
0198 NVTX_DECLSPEC void NVTX_API nvtxNameClProgramW(cl_program program, const wchar_t* name)
0199 {
0200     NVTX_SET_NAME_MANGLING_OPTIONS
0201 #ifdef NVTX_DISABLE
0202     (void)program;
0203     (void)name;
0204 #else /* NVTX_DISABLE */
0205     nvtxNameClProgramW_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClProgramW_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClProgramW_impl_fnptr);
0206     if (local != NVTX_NULLPTR)
0207         (*local)(program, name);
0208 #endif /* NVTX_DISABLE */
0209 }
0210 
0211 NVTX_DECLSPEC void NVTX_API nvtxNameClEventA(cl_event evnt, const char* name)
0212 {
0213     NVTX_SET_NAME_MANGLING_OPTIONS
0214 #ifdef NVTX_DISABLE
0215     (void)evnt;
0216     (void)name;
0217 #else /* NVTX_DISABLE */
0218     nvtxNameClEventA_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClEventA_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClEventA_impl_fnptr);
0219     if (local != NVTX_NULLPTR)
0220         (*local)(evnt, name);
0221 #endif /* NVTX_DISABLE */
0222 }
0223 
0224 NVTX_DECLSPEC void NVTX_API nvtxNameClEventW(cl_event evnt, const wchar_t* name)
0225 {
0226     NVTX_SET_NAME_MANGLING_OPTIONS
0227 #ifdef NVTX_DISABLE
0228     (void)evnt;
0229     (void)name;
0230 #else /* NVTX_DISABLE */
0231     nvtxNameClEventW_impl_fntype local = NVTX_REINTERPRET_CAST(nvtxNameClEventW_impl_fntype, NVTX_VERSIONED_IDENTIFIER(nvtxGlobals).nvtxNameClEventW_impl_fnptr);
0232     if (local != NVTX_NULLPTR)
0233         (*local)(evnt, name);
0234 #endif /* NVTX_DISABLE */
0235 }
0236 
0237 #ifdef __cplusplus
0238 } /* extern "C" */
0239 #endif /* __cplusplus */