Skip to content

Commit a174822

Browse files
author
thomassong
committed
Add new functions of CUDA 10.2
Signed-off-by: thomassong <[email protected]>
1 parent de5d52a commit a174822

File tree

7 files changed

+446
-117
lines changed

7 files changed

+446
-117
lines changed

include/cuda-helper.h

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
2-
* Tencent is pleased to support the open source community by making TKEStack available.
2+
* Tencent is pleased to support the open source community by making TKEStack
3+
* available.
34
*
45
* Copyright (C) 2012-2019 Tencent. All Rights Reserved.
56
*
6-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
7-
* this file except in compliance with the License. You may obtain a copy of the
8-
* License at
7+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
8+
* use this file except in compliance with the License. You may obtain a copy of
9+
* the License at
910
*
1011
* https://opensource.org/licenses/Apache-2.0
1112
*
@@ -909,6 +910,40 @@ typedef enum {
909910
CUDA_ENTRY_ENUM(cuStreamGetCaptureInfo_ptsz),
910911
/** cuThreadExchangeStreamCaptureMode */
911912
CUDA_ENTRY_ENUM(cuThreadExchangeStreamCaptureMode),
913+
/** cuDeviceGetNvSciSyncAttributes */
914+
CUDA_ENTRY_ENUM(cuDeviceGetNvSciSyncAttributes),
915+
/** cuGraphExecHostNodeSetParams */
916+
CUDA_ENTRY_ENUM(cuGraphExecHostNodeSetParams),
917+
/** cuGraphExecMemcpyNodeSetParams */
918+
CUDA_ENTRY_ENUM(cuGraphExecMemcpyNodeSetParams),
919+
/** cuGraphExecMemsetNodeSetParams */
920+
CUDA_ENTRY_ENUM(cuGraphExecMemsetNodeSetParams),
921+
/** cuGraphExecUpdate */
922+
CUDA_ENTRY_ENUM(cuGraphExecUpdate),
923+
/** cuMemAddressFree */
924+
CUDA_ENTRY_ENUM(cuMemAddressFree),
925+
/** cuMemAddressReserve */
926+
CUDA_ENTRY_ENUM(cuMemAddressReserve),
927+
/** cuMemCreate */
928+
CUDA_ENTRY_ENUM(cuMemCreate),
929+
/** cuMemExportToShareableHandle */
930+
CUDA_ENTRY_ENUM(cuMemExportToShareableHandle),
931+
/** cuMemGetAccess */
932+
CUDA_ENTRY_ENUM(cuMemGetAccess),
933+
/** cuMemGetAllocationGranularity */
934+
CUDA_ENTRY_ENUM(cuMemGetAllocationGranularity),
935+
/** cuMemGetAllocationPropertiesFromHandle */
936+
CUDA_ENTRY_ENUM(cuMemGetAllocationPropertiesFromHandle),
937+
/** cuMemImportFromShareableHandle */
938+
CUDA_ENTRY_ENUM(cuMemImportFromShareableHandle),
939+
/** cuMemMap */
940+
CUDA_ENTRY_ENUM(cuMemMap),
941+
/** cuMemRelease */
942+
CUDA_ENTRY_ENUM(cuMemRelease),
943+
/** cuMemSetAccess */
944+
CUDA_ENTRY_ENUM(cuMemSetAccess),
945+
/** cuMemUnmap */
946+
CUDA_ENTRY_ENUM(cuMemUnmap),
912947

913948
CUDA_ENTRY_END
914949
} cuda_entry_enum_t;

include/cuda-subset.h

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,129 @@ typedef struct CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st {
19171917
unsigned int reserved[16];
19181918
} CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS;
19191919

1920+
typedef unsigned long long CUmemGenericAllocationHandle;
1921+
1922+
typedef enum CUgraphExecUpdateResult_enum {
1923+
CU_GRAPH_EXEC_UPDATE_SUCCESS = 0x0, /**< The update succeeded */
1924+
CU_GRAPH_EXEC_UPDATE_ERROR =
1925+
0x1, /**< The update failed for an unexpected reason which is described in
1926+
the return value of the function */
1927+
CU_GRAPH_EXEC_UPDATE_ERROR_TOPOLOGY_CHANGED =
1928+
0x2, /**< The update failed because the topology changed */
1929+
CU_GRAPH_EXEC_UPDATE_ERROR_NODE_TYPE_CHANGED =
1930+
0x3, /**< The update failed because a node type changed */
1931+
CU_GRAPH_EXEC_UPDATE_ERROR_FUNCTION_CHANGED =
1932+
0x4, /**< The update failed because the function of a kernel node changed
1933+
*/
1934+
CU_GRAPH_EXEC_UPDATE_ERROR_PARAMETERS_CHANGED =
1935+
0x5, /**< The update failed because the parameters changed in a way that
1936+
is not supported */
1937+
CU_GRAPH_EXEC_UPDATE_ERROR_NOT_SUPPORTED =
1938+
0x6 /**< The update failed because something about the node is not
1939+
supported */
1940+
} CUgraphExecUpdateResult;
1941+
1942+
/**
1943+
* Defines the allocation types available
1944+
*/
1945+
typedef enum CUmemAllocationType_enum {
1946+
CU_MEM_ALLOCATION_TYPE_INVALID = 0x0,
1947+
1948+
/** This allocation type is 'pinned', i.e. cannot migrate from its current
1949+
* location while the application is actively using it
1950+
*/
1951+
CU_MEM_ALLOCATION_TYPE_PINNED = 0x1,
1952+
CU_MEM_ALLOCATION_TYPE_MAX = 0xFFFFFFFF
1953+
} CUmemAllocationType;
1954+
1955+
/**
1956+
* Flags for specifying particular handle types
1957+
*/
1958+
typedef enum CUmemAllocationHandleType_enum {
1959+
CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR =
1960+
0x1, /**< Allows a file descriptor to be used for exporting. Permitted
1961+
only on POSIX systems. (int) */
1962+
CU_MEM_HANDLE_TYPE_WIN32 =
1963+
0x2, /**< Allows a Win32 NT handle to be used for exporting. (HANDLE) */
1964+
CU_MEM_HANDLE_TYPE_WIN32_KMT = 0x4, /**< Allows a Win32 KMT handle to be used
1965+
for exporting. (D3DKMT_HANDLE) */
1966+
CU_MEM_HANDLE_TYPE_MAX = 0xFFFFFFFF
1967+
} CUmemAllocationHandleType;
1968+
1969+
/**
1970+
* Specifies the type of location
1971+
*/
1972+
typedef enum CUmemLocationType_enum {
1973+
CU_MEM_LOCATION_TYPE_INVALID = 0x0,
1974+
CU_MEM_LOCATION_TYPE_DEVICE =
1975+
0x1, /**< Location is a device location, thus id is a device ordinal */
1976+
CU_MEM_LOCATION_TYPE_MAX = 0xFFFFFFFF
1977+
} CUmemLocationType;
1978+
1979+
/**
1980+
* Specifies a location for an allocation.
1981+
*/
1982+
typedef struct CUmemLocation_st {
1983+
CUmemLocationType type; /**< Specifies the location type, which modifies the
1984+
meaning of id. */
1985+
int id; /**< identifier for a given this location's ::CUmemLocationType. */
1986+
} CUmemLocation;
1987+
1988+
/**
1989+
* Specifies the allocation properties for a allocation.
1990+
*/
1991+
typedef struct CUmemAllocationProp_st {
1992+
/** Allocation type */
1993+
CUmemAllocationType type;
1994+
/** requested ::CUmemAllocationHandleType */
1995+
CUmemAllocationHandleType requestedHandleTypes;
1996+
/** Location of allocation */
1997+
CUmemLocation location;
1998+
/**
1999+
* Windows-specific LPSECURITYATTRIBUTES required when
2000+
* ::CU_MEM_HANDLE_TYPE_WIN32 is specified. This security attribute defines
2001+
* the scope of which exported allocations may be tranferred to other
2002+
* processes. In all other cases, this field is required to be zero.
2003+
*/
2004+
void *win32HandleMetaData;
2005+
/** Reserved for future use, must be zero */
2006+
unsigned long long reserved;
2007+
} CUmemAllocationProp;
2008+
2009+
/**
2010+
* Flag for requesting different optimal and required granularities for an
2011+
* allocation.
2012+
*/
2013+
typedef enum CUmemAllocationGranularity_flags_enum {
2014+
CU_MEM_ALLOC_GRANULARITY_MINIMUM =
2015+
0x0, /**< Minimum required granularity for allocation */
2016+
CU_MEM_ALLOC_GRANULARITY_RECOMMENDED =
2017+
0x1 /**< Recommended granularity for allocation for best performance */
2018+
} CUmemAllocationGranularity_flags;
2019+
2020+
/**
2021+
* Specifies the memory protection flags for mapping.
2022+
*/
2023+
typedef enum CUmemAccess_flags_enum {
2024+
CU_MEM_ACCESS_FLAGS_PROT_NONE =
2025+
0x0, /**< Default, make the address range not accessible */
2026+
CU_MEM_ACCESS_FLAGS_PROT_READ =
2027+
0x1, /**< Make the address range read accessible */
2028+
CU_MEM_ACCESS_FLAGS_PROT_READWRITE =
2029+
0x3, /**< Make the address range read-write accessible */
2030+
CU_MEM_ACCESS_FLAGS_PROT_MAX = 0xFFFFFFFF
2031+
} CUmemAccess_flags;
2032+
2033+
/**
2034+
* Memory access descriptor
2035+
*/
2036+
typedef struct CUmemAccessDesc_st {
2037+
CUmemLocation location; /**< Location on which the request is to change it's
2038+
accessibility */
2039+
CUmemAccess_flags
2040+
flags; /**< ::CUmemProt accessibility flags to set on the request */
2041+
} CUmemAccessDesc;
2042+
19202043
#ifdef __cplusplus
19212044
}
19222045
#endif

include/nvml-helper.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
2-
* Tencent is pleased to support the open source community by making TKEStack available.
2+
* Tencent is pleased to support the open source community by making TKEStack
3+
* available.
34
*
45
* Copyright (C) 2012-2019 Tencent. All Rights Reserved.
56
*
6-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
7-
* this file except in compliance with the License. You may obtain a copy of the
8-
* License at
7+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
8+
* use this file except in compliance with the License. You may obtain a copy of
9+
* the License at
910
*
1011
* https://opensource.org/licenses/Apache-2.0
1112
*
@@ -451,6 +452,14 @@ typedef enum {
451452
NVML_ENTRY_ENUM(nvmlGetVgpuVersion),
452453
/** nvmlSetVgpuVersion */
453454
NVML_ENTRY_ENUM(nvmlSetVgpuVersion),
455+
/** nvmlDeviceGetGridLicensableFeatures_v3 */
456+
NVML_ENTRY_ENUM(nvmlDeviceGetGridLicensableFeatures_v3),
457+
/** nvmlDeviceGetHostVgpuMode */
458+
NVML_ENTRY_ENUM(nvmlDeviceGetHostVgpuMode),
459+
/** nvmlDeviceGetPgpuMetadataString */
460+
NVML_ENTRY_ENUM(nvmlDeviceGetPgpuMetadataString),
461+
/** nvmlVgpuInstanceGetEccMode */
462+
NVML_ENTRY_ENUM(nvmlVgpuInstanceGetEccMode),
454463

455464
NVML_ENTRY_END
456465
} nvml_entry_enum_t;

0 commit comments

Comments
 (0)