NVTX C API Reference v3
NVIDIA Tools Extension Library
Loading...
Searching...
No Matches
nvToolsExtMemCudaRt.h
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2009-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Licensed under the Apache License v2.0 with LLVM Exceptions.
18 * See https://nvidia.github.io/NVTX/LICENSE.txt for license information.
19 */
20
21#if defined(NVTX_AS_SYSTEM_HEADER)
22#if defined(__clang__)
23#pragma clang system_header
24#elif defined(__GNUC__) || defined(__NVCOMPILER)
25#pragma GCC system_header
26#elif defined(_MSC_VER)
27#pragma system_header
28#endif
29#endif
30
31#include "nvToolsExtMem.h"
32
33#include "cuda.h"
34#include "cuda_runtime.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
40#ifndef NVTX_MEM_CUDART_CONTENTS_V1
41#define NVTX_MEM_CUDART_CONTENTS_V1
42
67#define NVTX_MEM_TYPE_CUDA_ARRAY 0x11
68
72{
73 uint16_t extCompatID; /* Set to NVTX_EXT_COMPATID_MEM */
74 uint16_t structSize; /* Size of the structure. */
75 uint32_t reserved0;
76 cudaArray_t src;
77 size_t offset[3];
78 size_t extent[3];
81
82
93#define NVTX_MEM_TYPE_CU_ARRAY 0x12
94
98{
99 uint16_t extCompatID; /* Set to NVTX_EXT_COMPATID_MEM */
100 uint16_t structSize; /* Size of the structure. */
101 uint32_t reserved0;
102 CUarray src;
103 size_t offset[3];
104 size_t extent[3];
107
108/* Reserving 0x2-0xF for more common types */
109
110#define NVTX_MEM_CUDA_PEER_ALL_DEVICES -1
111
128 nvtxDomainHandle_t domain);
129
146 nvtxDomainHandle_t domain,
147 int device);
148
159NVTX_DECLSPEC void NVTX_API nvtxMemCudaSetPeerAccess(
160 nvtxDomainHandle_t domain,
161 nvtxMemPermissionsHandle_t permissions,
162 int devicePeer, /* device number such as from cudaGetDevice() or NVTX_MEM_CUDA_PEER_ALL_DEVICES */
163 uint32_t flags); /* NVTX_MEM_PERMISSIONS_REGION_FLAGS_* */
164
182{
183 uint16_t extCompatID; /* Set to NVTX_EXT_COMPATID_MEM */
184 uint16_t structSize; /* Size of the structure. */
185
186 uint32_t regionType; /* NVTX_MEM_TYPE_* */
187
188 size_t regionDescCount;
189 size_t regionDescElementSize;
190 void const* regionDescElements; /* this will also become the handle for this region */
191
194
199NVTX_DECLSPEC void NVTX_API nvtxMemCudaMarkInitialized(
200 nvtxDomainHandle_t domain,
201 cudaStream_t stream,
202 uint8_t isPerThreadStream, /* 0 for false, otherwise true */
204
207#endif /* NVTX_MEM_CUDART_CONTENTS_V1 */
208
209#ifdef __GNUC__
210#pragma GCC visibility push(internal)
211#endif
212
213#ifndef NVTX_NO_IMPL
214#define NVTX_EXT_IMPL_MEM_CUDART_GUARD /* Ensure other headers cannot be included directly */
215#include "nvtxDetail/nvtxExtImplMemCudaRt_v1.h"
216#undef NVTX_EXT_IMPL_MEM_CUDART_GUARD
217#endif /*NVTX_NO_IMPL*/
218
219#ifdef __GNUC__
220#pragma GCC visibility pop
221#endif
222
223
224#ifdef __cplusplus
225}
226#endif /* __cplusplus */
NVTX_DECLSPEC void NVTX_API nvtxMemCudaMarkInitialized(nvtxDomainHandle_t domain, cudaStream_t stream, uint8_t isPerThreadStream, nvtxMemMarkInitializedBatch_t const *desc)
Register a region of memory inside of a heap of linear process virtual memory.
NVTX_DECLSPEC nvtxMemPermissionsHandle_t NVTX_API nvtxMemCudaGetDeviceWidePermissions(nvtxDomainHandle_t domain, int device)
Get the permission object that represent the CUDA runtime device or cuda driver context.
NVTX_DECLSPEC void NVTX_API nvtxMemCudaSetPeerAccess(nvtxDomainHandle_t domain, nvtxMemPermissionsHandle_t permissions, int devicePeer, uint32_t flags)
Change the default behavior for all memory mapped in from a particular device.
NVTX_DECLSPEC nvtxMemPermissionsHandle_t NVTX_API nvtxMemCudaGetProcessWidePermissions(nvtxDomainHandle_t domain)
Get the permission object that represent the CUDA runtime device or cuda driver context.
nvtxMemPermissions_t * nvtxMemPermissionsHandle_t
A handle returned by a tool to represent a memory permissions mask.
structure to describe memory in a CUDA array object
structure to describe memory in a CUDA array object
Mark memory ranges as initialized.