NVTX C API Reference v3
NVIDIA Tools Extension Library
Loading...
Searching...
No Matches
nvToolsExtMemCudaRt.h
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2009-2025 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
58#define NVTX_MEM_TYPE_CUDA_ARRAY 0x11
59
63{
64 uint16_t extCompatID; /* Set to NVTX_EXT_COMPATID_MEM */
65 uint16_t structSize; /* Size of the structure. */
66 uint32_t reserved0;
67 cudaArray_t src;
68 size_t offset[3];
69 size_t extent[3];
72
73
84#define NVTX_MEM_TYPE_CU_ARRAY 0x12
85
89{
90 uint16_t extCompatID; /* Set to NVTX_EXT_COMPATID_MEM */
91 uint16_t structSize; /* Size of the structure. */
92 uint32_t reserved0;
93 CUarray src;
94 size_t offset[3];
95 size_t extent[3];
98
99/* Reserving 0x2-0xF for more common types */
100
101#define NVTX_MEM_CUDA_PEER_ALL_DEVICES -1
102
119 nvtxDomainHandle_t domain);
120
137 nvtxDomainHandle_t domain,
138 int device);
139
150NVTX_DECLSPEC void NVTX_API nvtxMemCudaSetPeerAccess(
151 nvtxDomainHandle_t domain,
152 nvtxMemPermissionsHandle_t permissions,
153 int devicePeer, /* device number such as from cudaGetDevice() or NVTX_MEM_CUDA_PEER_ALL_DEVICES */
154 uint32_t flags); /* NVTX_MEM_PERMISSIONS_REGION_FLAGS_* */
155
173{
174 uint16_t extCompatID; /* Set to NVTX_EXT_COMPATID_MEM */
175 uint16_t structSize; /* Size of the structure. */
176
177 uint32_t regionType; /* NVTX_MEM_TYPE_* */
178
179 size_t regionDescCount;
180 size_t regionDescElementSize;
181 void const* regionDescElements; /* this will also become the handle for this region */
182
185
190NVTX_DECLSPEC void NVTX_API nvtxMemCudaMarkInitialized(
191 nvtxDomainHandle_t domain,
192 cudaStream_t stream,
193 uint8_t isPerThreadStream, /* 0 for false, otherwise true */
195
198#endif /* NVTX_MEM_CUDART_CONTENTS_V1 */
199
200#ifdef __GNUC__
201#pragma GCC visibility push(internal)
202#endif
203
204#ifndef NVTX_NO_IMPL
205#define NVTX_EXT_IMPL_MEM_CUDART_GUARD /* Ensure other headers cannot be included directly */
206#include "nvtxDetail/nvtxExtImplMemCudaRt_v1.h"
207#undef NVTX_EXT_IMPL_MEM_CUDART_GUARD
208#endif /*NVTX_NO_IMPL*/
209
210#ifdef __GNUC__
211#pragma GCC visibility pop
212#endif
213
214
215#ifdef __cplusplus
216}
217#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.