Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
nvperf_cuda_host.h198 linesDownload Raw Back to include
1#ifndef NVPERF_CUDA_HOST_H
2#define NVPERF_CUDA_HOST_H
3
4/*
5 * Copyright 2014-2023 NVIDIA Corporation.  All rights reserved.
6 *
7 * NOTICE TO USER:
8 *
9 * This source code is subject to NVIDIA ownership rights under U.S. and
10 * international Copyright laws.
11 *
12 * This software and the information contained herein is PROPRIETARY and
13 * CONFIDENTIAL to NVIDIA and is being provided under the terms and conditions
14 * of a form of NVIDIA software license agreement.
15 *
16 * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
17 * CODE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
18 * IMPLIED WARRANTY OF ANY KIND.  NVIDIA DISCLAIMS ALL WARRANTIES WITH
19 * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
20 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
21 * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
22 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
23 * OF USE, DATA OR PROFITS,  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
24 * OR OTHER TORTIOUS ACTION,  ARISING OUT OF OR IN CONNECTION WITH THE USE
25 * OR PERFORMANCE OF THIS SOURCE CODE.
26 *
27 * U.S. Government End Users.   This source code is a "commercial item" as
28 * that term is defined at  48 C.F.R. 2.101 (OCT 1995), consisting  of
29 * "commercial computer  software"  and "commercial computer software
30 * documentation" as such terms are  used in 48 C.F.R. 12.212 (SEPT 1995)
31 * and is provided to the U.S. Government only as a commercial end item.
32 * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
33 * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
34 * source code with only those rights set forth herein.
35 *
36 * Any use of this source code in individual and commercial software must
37 * include, in the user documentation and internal comments to the code,
38 * the above Disclaimer and U.S. Government End Users Notice.
39 */
40
41#include <stddef.h>
42#include <stdint.h>
43#include "nvperf_common.h"
44#include "nvperf_host.h"
45
46#if defined(__GNUC__) && defined(NVPA_SHARED_LIB)
47    #pragma GCC visibility push(default)
48    #if !defined(NVPW_LOCAL)
49        #define NVPW_LOCAL __attribute__ ((visibility ("hidden")))
50    #endif
51#else
52    #if !defined(NVPW_LOCAL)
53        #define NVPW_LOCAL
54    #endif
55#endif
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61/**
62 *  @file   nvperf_cuda_host.h
63 */
64
65    /// 'NVPA_MetricsContext' and its APIs are deprecated, please use 'NVPW_MetricsEvaluator' and its APIs instead.
66    typedef struct NVPA_MetricsContext NVPA_MetricsContext;
67
68    typedef struct NVPW_CUDA_MetricsContext_Create_Params
69    {
70        /// [in]
71        size_t structSize;
72        /// [in] assign to NULL
73        void* pPriv;
74        /// [in]
75        const char* pChipName;
76        /// [out]
77        struct NVPA_MetricsContext* pMetricsContext;
78    } NVPW_CUDA_MetricsContext_Create_Params;
79#define NVPW_CUDA_MetricsContext_Create_Params_STRUCT_SIZE NVPA_STRUCT_SIZE(NVPW_CUDA_MetricsContext_Create_Params, pMetricsContext)
80
81    NVPA_Status NVPW_CUDA_MetricsContext_Create(NVPW_CUDA_MetricsContext_Create_Params* pParams);
82
83    typedef struct NVPW_CUDA_RawMetricsConfig_Create_Params
84    {
85        /// [in]
86        size_t structSize;
87        /// [in] assign to NULL
88        void* pPriv;
89        /// [in]
90        NVPA_ActivityKind activityKind;
91        /// [in]
92        const char* pChipName;
93        /// [out] new NVPA_RawMetricsConfig object
94        struct NVPA_RawMetricsConfig* pRawMetricsConfig;
95    } NVPW_CUDA_RawMetricsConfig_Create_Params;
96#define NVPW_CUDA_RawMetricsConfig_Create_Params_STRUCT_SIZE NVPA_STRUCT_SIZE(NVPW_CUDA_RawMetricsConfig_Create_Params, pRawMetricsConfig)
97
98    NVPA_Status NVPW_CUDA_RawMetricsConfig_Create(NVPW_CUDA_RawMetricsConfig_Create_Params* pParams);
99
100    typedef struct NVPW_CUDA_RawMetricsConfig_Create_V2_Params
101    {
102        /// [in]
103        size_t structSize;
104        /// [in] assign to NULL
105        void* pPriv;
106        /// [in]
107        NVPA_ActivityKind activityKind;
108        /// [in] accepted for chips supported at the time-of-release.
109        const char* pChipName;
110        /// [in] buffer with counter availability image - required for future chip support
111        const uint8_t* pCounterAvailabilityImage;
112        /// [out] new NVPA_RawMetricsConfig object
113        struct NVPA_RawMetricsConfig* pRawMetricsConfig;
114    } NVPW_CUDA_RawMetricsConfig_Create_V2_Params;
115#define NVPW_CUDA_RawMetricsConfig_Create_V2_Params_STRUCT_SIZE NVPA_STRUCT_SIZE(NVPW_CUDA_RawMetricsConfig_Create_V2_Params, pRawMetricsConfig)
116
117    /// Use either 'pChipName' or 'pCounterAvailabilityImage'.
118    NVPA_Status NVPW_CUDA_RawMetricsConfig_Create_V2(NVPW_CUDA_RawMetricsConfig_Create_V2_Params* pParams);
119
120    typedef struct NVPW_CUDA_CounterDataBuilder_Create_Params
121    {
122        /// [in]
123        size_t structSize;
124        /// [in] assign to NULL
125        void* pPriv;
126        /// [in] accepted for chips supported at the time-of-release.
127        const char* pChipName;
128        /// [in] buffer with counter availability image - required for future chip support
129        const uint8_t* pCounterAvailabilityImage;
130        /// [out] new NVPA_CounterDataBuilder object
131        struct NVPA_CounterDataBuilder* pCounterDataBuilder;
132    } NVPW_CUDA_CounterDataBuilder_Create_Params;
133#define NVPW_CUDA_CounterDataBuilder_Create_Params_STRUCT_SIZE NVPA_STRUCT_SIZE(NVPW_CUDA_CounterDataBuilder_Create_Params, pCounterDataBuilder)
134
135    /// Use either 'pChipName' or 'pCounterAvailabilityImage'.
136    NVPA_Status NVPW_CUDA_CounterDataBuilder_Create(NVPW_CUDA_CounterDataBuilder_Create_Params* pParams);
137
138    typedef struct NVPW_MetricsEvaluator NVPW_MetricsEvaluator;
139
140    typedef struct NVPW_CUDA_MetricsEvaluator_CalculateScratchBufferSize_Params
141    {
142        /// [in]
143        size_t structSize;
144        /// [in] assign to NULL
145        void* pPriv;
146        /// [in] accepted for chips supported at the time-of-release.
147        const char* pChipName;
148        /// [in] buffer with counter availability image - required for future chip support
149        const uint8_t* pCounterAvailabilityImage;
150        /// [out]
151        size_t scratchBufferSize;
152    } NVPW_CUDA_MetricsEvaluator_CalculateScratchBufferSize_Params;
153#define NVPW_CUDA_MetricsEvaluator_CalculateScratchBufferSize_Params_STRUCT_SIZE NVPA_STRUCT_SIZE(NVPW_CUDA_MetricsEvaluator_CalculateScratchBufferSize_Params, scratchBufferSize)
154
155    /// Use either 'pChipName' or 'pCounterAvailabilityImage'.
156    NVPA_Status NVPW_CUDA_MetricsEvaluator_CalculateScratchBufferSize(NVPW_CUDA_MetricsEvaluator_CalculateScratchBufferSize_Params* pParams);
157
158    typedef struct NVPW_CUDA_MetricsEvaluator_Initialize_Params
159    {
160        /// [in]
161        size_t structSize;
162        /// [in] assign to NULL
163        void* pPriv;
164        /// [in]
165        uint8_t* pScratchBuffer;
166        /// [in] the size of the 'pScratchBuffer' array, should be at least the size of the 'scratchBufferSize' returned
167        /// by 'NVPW_CUDA_MetricsEvaluator_CalculateScratchBufferSize'
168        size_t scratchBufferSize;
169        /// [in] accepted for chips supported at the time-of-release.
170        const char* pChipName;
171        /// [in] buffer with counter availability image - required for future chip support
172        const uint8_t* pCounterAvailabilityImage;
173        /// [in]
174        const uint8_t* pCounterDataImage;
175        /// [in] must be provided if 'pCounterDataImage' is not NULL
176        size_t counterDataImageSize;
177        /// [out]
178        struct NVPW_MetricsEvaluator* pMetricsEvaluator;
179    } NVPW_CUDA_MetricsEvaluator_Initialize_Params;
180#define NVPW_CUDA_MetricsEvaluator_Initialize_Params_STRUCT_SIZE NVPA_STRUCT_SIZE(NVPW_CUDA_MetricsEvaluator_Initialize_Params, pMetricsEvaluator)
181
182    /// Use one of 'pChipName', 'pCounterAvailabilityImage', or 'pCounterDataImage'. 'pChipName' or
183    /// 'pCounterAvailabilityImage' will create a metrics evaluator based on a virtual device while 'pCounterDataImage'
184    /// will create a metrics evaluator based on the actual device.
185    NVPA_Status NVPW_CUDA_MetricsEvaluator_Initialize(NVPW_CUDA_MetricsEvaluator_Initialize_Params* pParams);
186
187
188
189#ifdef __cplusplus
190} // extern "C"
191#endif
192
193#if defined(__GNUC__) && defined(NVPA_SHARED_LIB)
194    #pragma GCC visibility pop
195#endif
196
197#endif // NVPERF_CUDA_HOST_H
198 
codekingpro/portable-devtools · Team Ai