From 27a3b2fa2ac54c9baa7acbc9dd3f51c2b796159c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 7 Feb 2015 22:52:26 +0100
Subject: nvcuda: Add support for CUDA 7.0.

---
 dlls/nvcuda/nvcuda.c    | 623 +++++++++++++++++++++++++++++++++++++++++++++---
 dlls/nvcuda/nvcuda.spec |  61 +++++
 2 files changed, 645 insertions(+), 39 deletions(-)

diff --git a/dlls/nvcuda/nvcuda.c b/dlls/nvcuda/nvcuda.c
index 8b356fd..3262afd 100644
--- a/dlls/nvcuda/nvcuda.c
+++ b/dlls/nvcuda/nvcuda.c
@@ -338,6 +338,74 @@ static CUresult (*pcuOccupancyMaxPotentialBlockSize)(int *minGridSize, int *bloc
                                                      void *blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit);
 */
 
+/* CUDA 7.0 */
+static CUresult (*pcuCtxGetFlags)(unsigned int *flags);
+static CUresult (*pcuDevicePrimaryCtxGetState)(CUdevice dev, unsigned int *flags, int *active);
+static CUresult (*pcuDevicePrimaryCtxRelease)(CUdevice dev);
+static CUresult (*pcuDevicePrimaryCtxReset)(CUdevice dev);
+static CUresult (*pcuDevicePrimaryCtxRetain)(CUcontext *pctx, CUdevice dev);
+static CUresult (*pcuDevicePrimaryCtxSetFlags)(CUdevice dev, unsigned int flags);
+static CUresult (*pcuEventRecord_ptsz)(CUevent hEvent, CUstream hStream);
+static CUresult (*pcuGLMapBufferObjectAsync_v2_ptsz)(CUdeviceptr *dptr, size_t *size, GLuint buffer, CUstream hStream);
+static CUresult (*pcuGLMapBufferObject_v2_ptds)(CUdeviceptr *dptr, size_t *size, GLuint buffer);
+static CUresult (*pcuGraphicsMapResources_ptsz)(unsigned int count, CUgraphicsResource *resources, CUstream hStream);
+static CUresult (*pcuGraphicsUnmapResources_ptsz)(unsigned int count, CUgraphicsResource *resources, CUstream hStream);
+static CUresult (*pcuLaunchKernel_ptsz)(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ,
+                                        unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ,
+                                        unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra);
+static CUresult (*pcuMemcpy2DAsync_v2_ptsz)(const CUDA_MEMCPY2D *pCopy, CUstream hStream);
+static CUresult (*pcuMemcpy2DUnaligned_v2_ptds)(const CUDA_MEMCPY2D *pCopy);
+static CUresult (*pcuMemcpy2D_v2_ptds)(const CUDA_MEMCPY2D *pCopy);
+static CUresult (*pcuMemcpy3DAsync_v2_ptsz)(const CUDA_MEMCPY3D *pCopy, CUstream hStream);
+static CUresult (*pcuMemcpy3DPeerAsync_ptsz)(const CUDA_MEMCPY3D_PEER *pCopy, CUstream hStream);
+static CUresult (*pcuMemcpy3DPeer_ptds)(const CUDA_MEMCPY3D_PEER *pCopy);
+static CUresult (*pcuMemcpy3D_v2_ptds)(const CUDA_MEMCPY3D *pCopy);
+static CUresult (*pcuMemcpyAsync_ptsz)(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream);
+static CUresult (*pcuMemcpyAtoA_v2_ptds)(CUarray dstArray, size_t dstOffset, CUarray srcArray, size_t srcOffset, size_t ByteCount);
+static CUresult (*pcuMemcpyAtoD_v2_ptds)(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount);
+static CUresult (*pcuMemcpyAtoHAsync_v2_ptsz)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream);
+static CUresult (*pcuMemcpyAtoH_v2_ptds)(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount);
+static CUresult (*pcuMemcpyDtoA_v2_ptds)(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount);
+static CUresult (*pcuMemcpyDtoDAsync_v2_ptsz)(CUdeviceptr dstDevice, CUdeviceptr srcDevice, unsigned int ByteCount, CUstream hStream);
+static CUresult (*pcuMemcpyDtoD_v2_ptds)(CUdeviceptr dstDevice, CUdeviceptr srcDevice, unsigned int ByteCount);
+static CUresult (*pcuMemcpyDtoHAsync_v2_ptsz)(void *dstHost, CUdeviceptr srcDevice, unsigned int ByteCount, CUstream hStream);
+static CUresult (*pcuMemcpyDtoH_v2_ptds)(void *dstHost, CUdeviceptr srcDevice, unsigned int ByteCount);
+static CUresult (*pcuMemcpyHtoAAsync_v2_ptsz)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount, CUstream hStream);
+static CUresult (*pcuMemcpyHtoA_v2_ptds)(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount);
+static CUresult (*pcuMemcpyHtoDAsync_v2_ptsz)(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream);
+static CUresult (*pcuMemcpyHtoD_v2_ptds)(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount);
+static CUresult (*pcuMemcpyPeerAsync_ptsz)(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice,
+                                           CUcontext srcContext, size_t ByteCount, CUstream hStream);
+static CUresult (*pcuMemcpyPeer_ptds)(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount);
+static CUresult (*pcuMemcpy_ptds)(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount);
+static CUresult (*pcuMemsetD16Async_ptsz)(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream);
+static CUresult (*pcuMemsetD16_v2_ptds)(CUdeviceptr dstDevice, unsigned short us, size_t N);
+static CUresult (*pcuMemsetD2D16Async_ptsz)(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height, CUstream hStream);
+static CUresult (*pcuMemsetD2D16_v2_ptds)(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height);
+static CUresult (*pcuMemsetD2D32Async_ptsz)(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height, CUstream hStream);
+static CUresult (*pcuMemsetD2D32_v2_ptds)(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height);
+static CUresult (*pcuMemsetD2D8Async_ptsz)(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc, size_t Width, size_t Height, CUstream hStream);
+static CUresult (*pcuMemsetD2D8_v2_ptds)(CUdeviceptr dstDevice, unsigned int dstPitch, unsigned char uc, unsigned int Width, unsigned int Height);
+static CUresult (*pcuMemsetD32Async_ptsz)(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream);
+static CUresult (*pcuMemsetD32_v2_ptds)(CUdeviceptr dstDevice, unsigned int ui, size_t N);
+static CUresult (*pcuMemsetD8Async_ptsz)(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream);
+static CUresult (*pcuMemsetD8_v2_ptds)(CUdeviceptr dstDevice, unsigned char uc, unsigned int N);
+static CUresult (*pcuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags)(int *numBlocks, CUfunction func, int blockSize,
+                                                                         size_t dynamicSMemSize, unsigned int flags);
+/*
+static CUresult (*pcuOccupancyMaxPotentialBlockSizeWithFlags)(int *minGridSize, int *blockSize, CUfunction func, void *blockSizeToDynamicSMemSize,
+                                                              size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags);
+*/
+static CUresult (*pcuPointerGetAttributes)(unsigned int numAttributes, CUpointer_attribute *attributes, void **data, CUdeviceptr ptr);
+static CUresult (*pcuStreamAddCallback_ptsz)(CUstream hStream, void *callback, void *userData, unsigned int flags);
+static CUresult (*pcuStreamAttachMemAsync_ptsz)(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags);
+static CUresult (*pcuStreamGetFlags_ptsz)(CUstream hStream, unsigned int *flags);
+static CUresult (*pcuStreamGetPriority_ptsz)(CUstream hStream, int *priority);
+static CUresult (*pcuStreamQuery_ptsz)(CUstream hStream);
+static CUresult (*pcuStreamSynchronize_ptsz)(CUstream hStream);
+static CUresult (*pcuStreamWaitEvent_ptsz)(CUstream hStream, CUevent hEvent, unsigned int Flags);
+
+
 static void *cuda_handle = NULL;
 
 static BOOL load_functions(void)
@@ -609,6 +677,65 @@ static BOOL load_functions(void)
     TRY_LOAD_FUNCPTR(cuOccupancyMaxActiveBlocksPerMultiprocessor);
     /* TRY_LOAD_FUNCPTR(cuOccupancyMaxPotentialBlockSize); */
 
+    /* CUDA 7.0 */
+    TRY_LOAD_FUNCPTR(cuCtxGetFlags);
+    TRY_LOAD_FUNCPTR(cuDevicePrimaryCtxGetState);
+    TRY_LOAD_FUNCPTR(cuDevicePrimaryCtxRelease);
+    TRY_LOAD_FUNCPTR(cuDevicePrimaryCtxReset);
+    TRY_LOAD_FUNCPTR(cuDevicePrimaryCtxRetain);
+    TRY_LOAD_FUNCPTR(cuDevicePrimaryCtxSetFlags);
+    TRY_LOAD_FUNCPTR(cuEventRecord_ptsz);
+    TRY_LOAD_FUNCPTR(cuGLMapBufferObjectAsync_v2_ptsz);
+    TRY_LOAD_FUNCPTR(cuGLMapBufferObject_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuGraphicsMapResources_ptsz);
+    TRY_LOAD_FUNCPTR(cuGraphicsUnmapResources_ptsz);
+    TRY_LOAD_FUNCPTR(cuLaunchKernel_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpy2DAsync_v2_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpy2DUnaligned_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpy2D_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpy3DAsync_v2_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpy3DPeerAsync_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpy3DPeer_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpy3D_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpyAsync_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpyAtoA_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpyAtoD_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpyAtoHAsync_v2_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpyAtoH_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpyDtoA_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpyDtoDAsync_v2_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpyDtoD_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpyDtoHAsync_v2_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpyDtoH_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpyHtoAAsync_v2_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpyHtoA_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpyHtoDAsync_v2_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpyHtoD_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpyPeerAsync_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemcpyPeer_ptds);
+    TRY_LOAD_FUNCPTR(cuMemcpy_ptds);
+    TRY_LOAD_FUNCPTR(cuMemsetD16Async_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemsetD16_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemsetD2D16Async_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemsetD2D16_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemsetD2D32Async_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemsetD2D32_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemsetD2D8Async_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemsetD2D8_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemsetD32Async_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemsetD32_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuMemsetD8Async_ptsz);
+    TRY_LOAD_FUNCPTR(cuMemsetD8_v2_ptds);
+    TRY_LOAD_FUNCPTR(cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags);
+    /* TRY_LOAD_FUNCPTR(cuOccupancyMaxPotentialBlockSizeWithFlags); */
+    TRY_LOAD_FUNCPTR(cuPointerGetAttributes);
+    TRY_LOAD_FUNCPTR(cuStreamAddCallback_ptsz);
+    TRY_LOAD_FUNCPTR(cuStreamAttachMemAsync_ptsz);
+    TRY_LOAD_FUNCPTR(cuStreamGetFlags_ptsz);
+    TRY_LOAD_FUNCPTR(cuStreamGetPriority_ptsz);
+    TRY_LOAD_FUNCPTR(cuStreamQuery_ptsz);
+    TRY_LOAD_FUNCPTR(cuStreamSynchronize_ptsz);
+    TRY_LOAD_FUNCPTR(cuStreamWaitEvent_ptsz);
 
     #undef LOAD_FUNCPTR
     #undef TRY_LOAD_FUNCPTR
@@ -1888,13 +2015,12 @@ static void stream_callback_wrapper(CUstream hStream, CUresult status, void *use
     free(wrapper);
 }
 
-CUresult WINAPI wine_cuStreamAddCallback(CUstream hStream, void *callback, void *userData, unsigned int flags)
+static CUresult stream_add_callback(CUresult (*func)(CUstream, void *, void *, unsigned int),
+                                    CUstream hStream, void *callback, void *userData, unsigned int flags)
 {
     struct stream_callback_entry *wrapper;
     CUresult ret;
 
-    TRACE("(%p, %p, %p, %u)\n", hStream, callback, userData, flags);
-
     wrapper = malloc(sizeof(*wrapper));
     if (!wrapper)
         return CUDA_ERROR_OUT_OF_MEMORY;
@@ -1917,7 +2043,7 @@ CUresult WINAPI wine_cuStreamAddCallback(CUstream hStream, void *callback, void
     }
     pthread_mutex_unlock(&stream_callback_mutex);
 
-    ret = pcuStreamAddCallback(hStream, stream_callback_wrapper, wrapper, flags);
+    ret = func(hStream, stream_callback_wrapper, wrapper, flags);
     if (ret)
     {
         pthread_mutex_lock(&stream_callback_mutex);
@@ -1936,6 +2062,12 @@ CUresult WINAPI wine_cuStreamAddCallback(CUstream hStream, void *callback, void
     return ret;
 }
 
+CUresult WINAPI wine_cuStreamAddCallback(CUstream hStream, void *callback, void *userData, unsigned int flags)
+{
+    TRACE("(%p, %p, %p, %u)\n", hStream, callback, userData, flags);
+    return stream_add_callback(pcuStreamAddCallback, hStream, callback, userData, flags);
+}
+
 CUresult WINAPI wine_cuStreamAttachMemAsync(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags)
 {
     TRACE("(%p, " DEV_PTR ", %lu, %u)\n", hStream, dptr, (SIZE_T)length, flags);
@@ -2234,6 +2366,17 @@ CUresult WINAPI wine_cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArra
     return pcuTexRefSetMipmappedArray(hTexRef, hMipmappedArray, Flags);
 }
 
+#define CHECK_FUNCPTR(f) \
+    do \
+    { \
+        if (p##f == NULL) \
+        { \
+            FIXME("not supported\n"); \
+            return CUDA_ERROR_NOT_SUPPORTED; \
+        } \
+    } \
+    while (0)
+
 /*
  * Additions in CUDA 6.5
  */
@@ -2242,22 +2385,14 @@ CUresult WINAPI wine_cuGLGetDevices_v2(unsigned int *pCudaDeviceCount, CUdevice
                                        unsigned int cudaDeviceCount, CUGLDeviceList deviceList)
 {
     TRACE("(%p, %p, %u, %d)\n", pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList);
-    if (!pcuGLGetDevices_v2)
-    {
-        FIXME("not supported\n");
-        return CUDA_ERROR_NOT_SUPPORTED;
-    }
+    CHECK_FUNCPTR(cuGLGetDevices_v2);
     return pcuGLGetDevices_v2(pCudaDeviceCount, pCudaDevices, cudaDeviceCount, deviceList);
 }
 
 CUresult WINAPI wine_cuGraphicsResourceSetMapFlags_v2(CUgraphicsResource resource, unsigned int flags)
 {
     TRACE("(%p, %u)\n", resource, flags);
-    if (!pcuGraphicsResourceSetMapFlags_v2)
-    {
-        FIXME("not supported\n");
-        return CUDA_ERROR_NOT_SUPPORTED;
-    }
+    CHECK_FUNCPTR(cuGraphicsResourceSetMapFlags_v2);
     return pcuGraphicsResourceSetMapFlags_v2(resource, flags);
 }
 
@@ -2265,11 +2400,7 @@ CUresult WINAPI wine_cuLinkAddData_v2(CUlinkState state, CUjitInputType type, vo
                                       unsigned int numOptions, CUjit_option *options, void **optionValues)
 {
     TRACE("(%p, %d, %p, %lu, %s, %u, %p, %p)\n", state, type, data, (SIZE_T)size, name, numOptions, options, optionValues);
-    if (!pcuLinkAddData_v2)
-    {
-        FIXME("not supported\n");
-        return CUDA_ERROR_NOT_SUPPORTED;
-    }
+    CHECK_FUNCPTR(cuLinkAddData_v2);
     return pcuLinkAddData_v2(state, type, data, size, name, numOptions, options, optionValues);
 }
 
@@ -2277,33 +2408,21 @@ CUresult WINAPI wine_cuLinkCreate_v2(unsigned int numOptions, CUjit_option *opti
                                      void **optionValues, CUlinkState *stateOut)
 {
     TRACE("(%u, %p, %p, %p)\n", numOptions, options, optionValues, stateOut);
-    if (!pcuLinkCreate_v2)
-    {
-        FIXME("not supported\n");
-        return CUDA_ERROR_NOT_SUPPORTED;
-    }
+    CHECK_FUNCPTR(cuLinkCreate_v2);
     return pcuLinkCreate_v2(numOptions, options, optionValues, stateOut);
 }
 
 CUresult WINAPI wine_cuMemHostRegister_v2(void *p, size_t bytesize, unsigned int Flags)
 {
     TRACE("(%p, %lu, %u)\n", p, (SIZE_T)bytesize, Flags);
-    if (!pcuMemHostRegister_v2)
-    {
-        FIXME("not supported\n");
-        return CUDA_ERROR_NOT_SUPPORTED;
-    }
+    CHECK_FUNCPTR(cuMemHostRegister_v2);
     return pcuMemHostRegister_v2(p, bytesize, Flags);
 }
 
 CUresult WINAPI wine_cuOccupancyMaxActiveBlocksPerMultiprocessor(int *numBlocks, CUfunction func, int blockSize, size_t dynamicSMemSize)
 {
     TRACE("(%p, %p, %d, %lu)\n", numBlocks, func, blockSize, (SIZE_T)dynamicSMemSize);
-    if (!pcuOccupancyMaxActiveBlocksPerMultiprocessor)
-    {
-        FIXME("not supported\n");
-        return CUDA_ERROR_NOT_SUPPORTED;
-    }
+    CHECK_FUNCPTR(cuOccupancyMaxActiveBlocksPerMultiprocessor);
     return pcuOccupancyMaxActiveBlocksPerMultiprocessor(numBlocks, func, blockSize, dynamicSMemSize);
 }
 
@@ -2312,16 +2431,442 @@ CUresult WINAPI wine_cuOccupancyMaxPotentialBlockSize(int *minGridSize, int *blo
                                                       void *blockSizeToDynamicSMemSize, size_t dynamicSMemSize, int blockSizeLimit)
 {
     TRACE("(%p, %p, %p, %p, %lu, %d)\n", minGridSize, blockSize, func, blockSizeToDynamicSMemSize, (SIZE_T)dynamicSMemSize, blockSizeLimit);
-    if (!pcuOccupancyMaxPotentialBlockSize)
-    {
-        FIXME("not supported\n");
-        return CUDA_ERROR_NOT_SUPPORTED;
-    }
+    CHECK_FUNCPTR(cuOccupancyMaxPotentialBlockSize);
     return pcuOccupancyMaxPotentialBlockSize(minGridSize, blockSize, func, blockSizeToDynamicSMemSize, dynamicSMemSize, blockSizeLimit);
 }
 */
 
 /*
+ * Additions in CUDA 7.0
+ */
+
+CUresult WINAPI wine_cuCtxGetFlags(unsigned int *flags)
+{
+    TRACE("(%p)\n", flags);
+    CHECK_FUNCPTR(cuCtxGetFlags);
+    return pcuCtxGetFlags(flags);
+}
+
+CUresult WINAPI wine_cuDevicePrimaryCtxGetState(CUdevice dev, unsigned int *flags, int *active)
+{
+    TRACE("(%u, %p, %p)\n", dev, flags, active);
+    CHECK_FUNCPTR(cuDevicePrimaryCtxGetState);
+    return pcuDevicePrimaryCtxGetState(dev, flags, active);
+}
+
+CUresult WINAPI wine_cuDevicePrimaryCtxRelease(CUdevice dev)
+{
+    TRACE("(%u)\n", dev);
+    CHECK_FUNCPTR(cuDevicePrimaryCtxRelease);
+    return pcuDevicePrimaryCtxRelease(dev);
+}
+
+CUresult WINAPI wine_cuDevicePrimaryCtxReset(CUdevice dev)
+{
+    TRACE("(%u)\n", dev);
+    CHECK_FUNCPTR(cuDevicePrimaryCtxReset);
+    return pcuDevicePrimaryCtxReset(dev);
+}
+
+CUresult WINAPI wine_cuDevicePrimaryCtxRetain(CUcontext *pctx, CUdevice dev)
+{
+    TRACE("(%p, %u)\n", pctx, dev);
+    CHECK_FUNCPTR(cuDevicePrimaryCtxRetain);
+    return pcuDevicePrimaryCtxRetain(pctx, dev);
+}
+
+CUresult WINAPI wine_cuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags)
+{
+    TRACE("(%u, %u)\n", dev, flags);
+    CHECK_FUNCPTR(cuDevicePrimaryCtxSetFlags);
+    return pcuDevicePrimaryCtxSetFlags(dev, flags);
+}
+
+CUresult WINAPI wine_cuEventRecord_ptsz(CUevent hEvent, CUstream hStream)
+{
+    TRACE("(%p, %p)\n", hEvent, hStream);
+    CHECK_FUNCPTR(cuEventRecord_ptsz);
+    return pcuEventRecord_ptsz(hEvent, hStream);
+}
+
+CUresult WINAPI wine_cuGLMapBufferObjectAsync_v2_ptsz(CUdeviceptr *dptr, size_t *size, GLuint buffer, CUstream hStream)
+{
+    TRACE("(%p, %p, %u, %p)\n", dptr, size,  buffer, hStream);
+    CHECK_FUNCPTR(cuGLMapBufferObjectAsync_v2_ptsz);
+    return pcuGLMapBufferObjectAsync_v2_ptsz(dptr, size,  buffer, hStream);
+}
+
+CUresult WINAPI wine_cuGLMapBufferObject_v2_ptds(CUdeviceptr *dptr, size_t *size, GLuint buffer)
+{
+    TRACE("(%p, %p, %u)\n", dptr, size, buffer);
+    CHECK_FUNCPTR(cuGLMapBufferObject_v2_ptds);
+    return pcuGLMapBufferObject_v2_ptds(dptr, size, buffer);
+}
+
+CUresult WINAPI wine_cuGraphicsMapResources_ptsz(unsigned int count, CUgraphicsResource *resources, CUstream hStream)
+{
+    TRACE("(%u, %p, %p)\n", count, resources, hStream);
+    CHECK_FUNCPTR(cuGraphicsMapResources_ptsz);
+    return pcuGraphicsMapResources_ptsz(count, resources, hStream);
+}
+
+CUresult WINAPI wine_cuGraphicsUnmapResources_ptsz(unsigned int count, CUgraphicsResource *resources, CUstream hStream)
+{
+    TRACE("(%u, %p, %p)\n", count, resources, hStream);
+    CHECK_FUNCPTR(cuGraphicsUnmapResources_ptsz);
+    return pcuGraphicsUnmapResources_ptsz(count, resources, hStream);
+}
+
+CUresult WINAPI wine_cuLaunchKernel_ptsz(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ,
+                                         unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ,
+                                         unsigned int sharedMemBytes, CUstream hStream, void **kernelParams, void **extra)
+{
+    TRACE("(%p, %u, %u, %u, %u, %u, %u, %u, %p, %p, %p),\n", f, gridDimX, gridDimY, gridDimZ, blockDimX,
+          blockDimY, blockDimZ, sharedMemBytes, hStream, kernelParams, extra);
+    CHECK_FUNCPTR(cuLaunchKernel_ptsz);
+    return pcuLaunchKernel_ptsz(f, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes,
+                                hStream, kernelParams, extra);
+}
+
+CUresult WINAPI wine_cuMemcpy2DAsync_v2_ptsz(const CUDA_MEMCPY2D *pCopy, CUstream hStream)
+{
+    TRACE("(%p, %p)\n", pCopy, hStream);
+    CHECK_FUNCPTR(cuMemcpy2DAsync_v2_ptsz);
+    return pcuMemcpy2DAsync_v2_ptsz(pCopy, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpy2DUnaligned_v2_ptds(const CUDA_MEMCPY2D *pCopy)
+{
+    TRACE("(%p)\n", pCopy);
+    CHECK_FUNCPTR(cuMemcpy2DUnaligned_v2_ptds);
+    return pcuMemcpy2DUnaligned_v2_ptds(pCopy);
+}
+
+CUresult WINAPI wine_cuMemcpy2D_v2_ptds(const CUDA_MEMCPY2D *pCopy)
+{
+    TRACE("(%p)\n", pCopy);
+    CHECK_FUNCPTR(cuMemcpy2D_v2_ptds);
+    return pcuMemcpy2D_v2_ptds(pCopy);
+}
+
+CUresult WINAPI wine_cuMemcpy3DAsync_v2_ptsz(const CUDA_MEMCPY3D *pCopy, CUstream hStream)
+{
+    TRACE("(%p, %p)\n", pCopy, hStream);
+    CHECK_FUNCPTR(cuMemcpy3DAsync_v2_ptsz);
+    return pcuMemcpy3DAsync_v2_ptsz(pCopy, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpy3DPeerAsync_ptsz(const CUDA_MEMCPY3D_PEER *pCopy, CUstream hStream)
+{
+    TRACE("(%p, %p)\n", pCopy, hStream);
+    CHECK_FUNCPTR(cuMemcpy3DPeerAsync_ptsz);
+    return pcuMemcpy3DPeerAsync_ptsz(pCopy, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpy3DPeer_ptds(const CUDA_MEMCPY3D_PEER *pCopy)
+{
+    TRACE("(%p)\n", pCopy);
+    CHECK_FUNCPTR(cuMemcpy3DPeer_ptds);
+    return pcuMemcpy3DPeer_ptds(pCopy);
+}
+
+CUresult WINAPI wine_cuMemcpy3D_v2_ptds(const CUDA_MEMCPY3D *pCopy)
+{
+    TRACE("(%p)\n", pCopy);
+    CHECK_FUNCPTR(cuMemcpy3D_v2_ptds);
+    return pcuMemcpy3D_v2_ptds(pCopy);
+}
+
+CUresult WINAPI wine_cuMemcpyAsync_ptsz(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", " DEV_PTR ", %lu, %p)\n", dst, src, (SIZE_T)ByteCount, hStream);
+    CHECK_FUNCPTR(cuMemcpyAsync_ptsz);
+    return pcuMemcpyAsync_ptsz(dst, src, ByteCount, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpyAtoA_v2_ptds(CUarray dstArray, size_t dstOffset, CUarray srcArray,
+                                          size_t srcOffset, size_t ByteCount)
+{
+    TRACE("(%p, %lu, %p, %lu, %lu)\n", dstArray, (SIZE_T)dstOffset, srcArray, (SIZE_T)srcOffset, (SIZE_T)ByteCount);
+    CHECK_FUNCPTR(cuMemcpyAtoA_v2_ptds);
+    return pcuMemcpyAtoA_v2_ptds(dstArray, dstOffset, srcArray, srcOffset, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemcpyAtoD_v2_ptds(CUdeviceptr dstDevice, CUarray srcArray, size_t srcOffset, size_t ByteCount)
+{
+    TRACE("(" DEV_PTR ", %p, %lu, %lu)\n", dstDevice, srcArray, (SIZE_T)srcOffset, (SIZE_T)ByteCount);
+    CHECK_FUNCPTR(cuMemcpyAtoD_v2_ptds);
+    return pcuMemcpyAtoD_v2_ptds(dstDevice, srcArray, srcOffset, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemcpyAtoHAsync_v2_ptsz(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount, CUstream hStream)
+{
+    TRACE("(%p, %p, %lu, %lu, %p)\n", dstHost, srcArray, (SIZE_T)srcOffset, (SIZE_T)ByteCount, hStream);
+    CHECK_FUNCPTR(cuMemcpyAtoHAsync_v2_ptsz);
+    return pcuMemcpyAtoHAsync_v2_ptsz(dstHost, srcArray, srcOffset, ByteCount, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpyAtoH_v2_ptds(void *dstHost, CUarray srcArray, size_t srcOffset, size_t ByteCount)
+{
+    TRACE("(%p, %p, %lu, %lu)\n", dstHost, srcArray, (SIZE_T)srcOffset, (SIZE_T)ByteCount);
+    CHECK_FUNCPTR(cuMemcpyAtoH_v2_ptds);
+    return pcuMemcpyAtoH_v2_ptds(dstHost, srcArray, srcOffset, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemcpyDtoA_v2_ptds(CUarray dstArray, size_t dstOffset, CUdeviceptr srcDevice, size_t ByteCount)
+{
+    TRACE("(%p, %lu, " DEV_PTR ", %lu)\n", dstArray, (SIZE_T)dstOffset, srcDevice, (SIZE_T)ByteCount);
+    CHECK_FUNCPTR(cuMemcpyDtoA_v2_ptds);
+    return pcuMemcpyDtoA_v2_ptds(dstArray, dstOffset, srcDevice, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemcpyDtoDAsync_v2_ptsz(CUdeviceptr dstDevice, CUdeviceptr srcDevice,
+                                               unsigned int ByteCount, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", " DEV_PTR ", %u, %p)\n", dstDevice, srcDevice, ByteCount, hStream);
+    CHECK_FUNCPTR(cuMemcpyDtoDAsync_v2_ptsz);
+    return pcuMemcpyDtoDAsync_v2_ptsz(dstDevice, srcDevice, ByteCount, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpyDtoD_v2_ptds(CUdeviceptr dstDevice, CUdeviceptr srcDevice, unsigned int ByteCount)
+{
+    TRACE("(" DEV_PTR ", " DEV_PTR ", %u)\n", dstDevice, srcDevice, ByteCount);
+    CHECK_FUNCPTR(cuMemcpyDtoD_v2_ptds);
+    return pcuMemcpyDtoD_v2_ptds(dstDevice, srcDevice, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemcpyDtoHAsync_v2_ptsz(void *dstHost, CUdeviceptr srcDevice, unsigned int ByteCount, CUstream hStream)
+{
+    TRACE("(%p, " DEV_PTR ", %u, %p)\n", dstHost, srcDevice, ByteCount, hStream);
+    CHECK_FUNCPTR(cuMemcpyDtoHAsync_v2_ptsz);
+    return pcuMemcpyDtoHAsync_v2_ptsz(dstHost, srcDevice, ByteCount, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpyDtoH_v2_ptds(void *dstHost, CUdeviceptr srcDevice, unsigned int ByteCount)
+{
+    TRACE("(%p, " DEV_PTR ", %u)\n", dstHost, srcDevice, ByteCount);
+    CHECK_FUNCPTR(cuMemcpyDtoH_v2_ptds);
+    return pcuMemcpyDtoH_v2_ptds(dstHost, srcDevice, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemcpyHtoAAsync_v2_ptsz(CUarray dstArray, size_t dstOffset, const void *srcHost,
+                                               size_t ByteCount, CUstream hStream)
+{
+    TRACE("(%p, %lu, %p, %lu, %p)\n", dstArray, (SIZE_T)dstOffset, srcHost, (SIZE_T)ByteCount, hStream);
+    CHECK_FUNCPTR(cuMemcpyHtoAAsync_v2_ptsz);
+    return pcuMemcpyHtoAAsync_v2_ptsz(dstArray, dstOffset, srcHost, ByteCount, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpyHtoA_v2_ptds(CUarray dstArray, size_t dstOffset, const void *srcHost, size_t ByteCount)
+{
+    TRACE("(%p, %lu, %p, %lu)\n", dstArray, (SIZE_T)dstOffset, srcHost, (SIZE_T)ByteCount);
+    CHECK_FUNCPTR(cuMemcpyHtoA_v2_ptds);
+    return pcuMemcpyHtoA_v2_ptds(dstArray, dstOffset, srcHost, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemcpyHtoDAsync_v2_ptsz(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", %p, %lu, %p)\n", dstDevice, srcHost, (SIZE_T)ByteCount, hStream);
+    CHECK_FUNCPTR(cuMemcpyHtoDAsync_v2_ptsz);
+    return pcuMemcpyHtoDAsync_v2_ptsz(dstDevice, srcHost, ByteCount, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpyHtoD_v2_ptds(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount)
+{
+    TRACE("(" DEV_PTR ", %p, %lu)\n", dstDevice, srcHost, (SIZE_T)ByteCount);
+    CHECK_FUNCPTR(cuMemcpyHtoD_v2_ptds);
+    return pcuMemcpyHtoD_v2_ptds(dstDevice, srcHost, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemcpyPeerAsync_ptsz(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice,
+                                            CUcontext srcContext, size_t ByteCount, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", %p, " DEV_PTR ", %p, %lu, %p)\n", dstDevice, dstContext, srcDevice, srcContext, (SIZE_T)ByteCount, hStream);
+    CHECK_FUNCPTR(cuMemcpyPeerAsync_ptsz);
+    return pcuMemcpyPeerAsync_ptsz(dstDevice, dstContext, srcDevice, srcContext, ByteCount, hStream);
+}
+
+CUresult WINAPI wine_cuMemcpyPeer_ptds(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice,
+                                       CUcontext srcContext, size_t ByteCount)
+{
+    TRACE("(" DEV_PTR ", %p, " DEV_PTR ", %p, %lu)\n", dstDevice, dstContext, srcDevice, srcContext, (SIZE_T)ByteCount);
+    CHECK_FUNCPTR(cuMemcpyPeer_ptds);
+    return pcuMemcpyPeer_ptds(dstDevice, dstContext, srcDevice, srcContext, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemcpy_ptds(CUdeviceptr dst, CUdeviceptr src, size_t ByteCount)
+{
+    TRACE("(" DEV_PTR ", " DEV_PTR ", %lu)\n", dst, src, (SIZE_T)ByteCount);
+    CHECK_FUNCPTR(cuMemcpy_ptds);
+    return pcuMemcpy_ptds(dst, src, ByteCount);
+}
+
+CUresult WINAPI wine_cuMemsetD16Async_ptsz(CUdeviceptr dstDevice, unsigned short us, size_t N, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", %u, %lu, %p)\n", dstDevice, us, (SIZE_T)N, hStream);
+    CHECK_FUNCPTR(cuMemsetD16Async_ptsz);
+    return pcuMemsetD16Async_ptsz(dstDevice, us, N, hStream);
+}
+
+CUresult WINAPI wine_cuMemsetD16_v2_ptds(CUdeviceptr dstDevice, unsigned short us, size_t N)
+{
+    TRACE("(" DEV_PTR ", %u, %lu)\n", dstDevice, us, (SIZE_T)N);
+    CHECK_FUNCPTR(cuMemsetD16_v2_ptds);
+    return pcuMemsetD16_v2_ptds(dstDevice, us, N);
+}
+
+CUresult WINAPI wine_cuMemsetD2D16Async_ptsz(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us,
+                                             size_t Width, size_t Height, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", %lu, %u, %lu, %lu, %p)\n", dstDevice, (SIZE_T)dstPitch, us, (SIZE_T)Width, (SIZE_T)Height, hStream);
+    CHECK_FUNCPTR(cuMemsetD2D16Async_ptsz);
+    return pcuMemsetD2D16Async_ptsz(dstDevice, dstPitch, us, Width, Height, hStream);
+}
+
+CUresult WINAPI wine_cuMemsetD2D16_v2_ptds(CUdeviceptr dstDevice, size_t dstPitch, unsigned short us, size_t Width, size_t Height)
+{
+    TRACE("(" DEV_PTR ", %lu, %u, %lu, %lu)\n", dstDevice, (SIZE_T)dstPitch, us, (SIZE_T)Width, (SIZE_T)Height);
+    CHECK_FUNCPTR(cuMemsetD2D16_v2_ptds);
+    return pcuMemsetD2D16_v2_ptds(dstDevice, dstPitch, us, Width, Height);
+}
+
+CUresult WINAPI wine_cuMemsetD2D32Async_ptsz(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui,
+                                        size_t Width, size_t Height, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", %lu, %u, %lu, %lu, %p)\n", dstDevice, (SIZE_T)dstPitch, ui, (SIZE_T)Width, (SIZE_T)Height, hStream);
+    CHECK_FUNCPTR(cuMemsetD2D32Async_ptsz);
+    return pcuMemsetD2D32Async_ptsz(dstDevice, dstPitch, ui, Width, Height, hStream);
+}
+
+CUresult WINAPI wine_cuMemsetD2D32_v2_ptds(CUdeviceptr dstDevice, size_t dstPitch, unsigned int ui, size_t Width, size_t Height)
+{
+    TRACE("(" DEV_PTR ", %lu, %u, %lu, %lu)\n", dstDevice, (SIZE_T)dstPitch, ui, (SIZE_T)Width, (SIZE_T)Height);
+    CHECK_FUNCPTR(cuMemsetD2D32_v2_ptds);
+    return pcuMemsetD2D32_v2_ptds(dstDevice, dstPitch, ui, Width, Height);
+}
+
+CUresult WINAPI wine_cuMemsetD2D8Async_ptsz(CUdeviceptr dstDevice, size_t dstPitch, unsigned char uc,
+                                            size_t Width, size_t Height, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", %lu, %u, %lu, %lu, %p)\n", dstDevice, (SIZE_T)dstPitch, uc, (SIZE_T)Width, (SIZE_T)Height, hStream);
+    CHECK_FUNCPTR(cuMemsetD2D8Async_ptsz);
+    return pcuMemsetD2D8Async_ptsz(dstDevice, dstPitch, uc, Width, Height, hStream);
+}
+
+CUresult WINAPI wine_cuMemsetD2D8_v2_ptds(CUdeviceptr dstDevice, unsigned int dstPitch, unsigned char uc,
+                                     unsigned int Width, unsigned int Height)
+{
+    TRACE("(" DEV_PTR ", %u, %x, %u, %u)\n", dstDevice, dstPitch, uc, Width, Height);
+    CHECK_FUNCPTR(cuMemsetD2D8_v2_ptds);
+    return pcuMemsetD2D8_v2_ptds(dstDevice, dstPitch, uc, Width, Height);
+}
+
+CUresult WINAPI wine_cuMemsetD32Async_ptsz(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", %u, %lu, %p)\n", dstDevice, ui, (SIZE_T)N, hStream);
+    CHECK_FUNCPTR(cuMemsetD32Async_ptsz);
+    return pcuMemsetD32Async_ptsz(dstDevice, ui, N, hStream);
+}
+
+CUresult WINAPI wine_cuMemsetD32_v2_ptds(CUdeviceptr dstDevice, unsigned int ui, size_t N)
+{
+    TRACE("(" DEV_PTR ", %u, %lu)\n", dstDevice, ui, (SIZE_T)N);
+    CHECK_FUNCPTR(cuMemsetD32_v2_ptds);
+    return pcuMemsetD32_v2_ptds(dstDevice, ui, N);
+}
+
+CUresult WINAPI wine_cuMemsetD8Async_ptsz(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream)
+{
+    TRACE("(" DEV_PTR ", %x, %lu, %p)\n", dstDevice, uc, (SIZE_T)N, hStream);
+    CHECK_FUNCPTR(cuMemsetD8Async_ptsz);
+    return pcuMemsetD8Async_ptsz(dstDevice, uc, N, hStream);
+}
+
+CUresult WINAPI wine_cuMemsetD8_v2_ptds(CUdeviceptr dstDevice, unsigned char uc, unsigned int N)
+{
+    TRACE("(" DEV_PTR ", %x, %u)\n", dstDevice, uc, N);
+    CHECK_FUNCPTR(cuMemsetD8_v2_ptds);
+    return pcuMemsetD8_v2_ptds(dstDevice, uc, N);
+}
+
+CUresult WINAPI wine_cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(int *numBlocks, CUfunction func, int blockSize,
+                                                                          size_t dynamicSMemSize, unsigned int flags)
+{
+    TRACE("(%p, %p, %d, %lu, %u)\n", numBlocks, func, blockSize, (SIZE_T)dynamicSMemSize, flags);
+    CHECK_FUNCPTR(cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags);
+    return pcuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(numBlocks, func, blockSize, dynamicSMemSize, flags);
+}
+
+/*
+CUresult WINAPI wine_cuOccupancyMaxPotentialBlockSizeWithFlags(int *minGridSize, int *blockSize, CUfunction func, void *blockSizeToDynamicSMemSize,
+                                                               size_t dynamicSMemSize, int blockSizeLimit, unsigned int flags)
+{
+    TRACE("(%p, %p, %p, %p, %lu, %d, %u)\n", minGridSize, blockSize, func, blockSizeToDynamicSMemSize, (SIZE_T)dynamicSMemSize, blockSizeLimit, flags);
+    CHECK_FUNCPTR(cuOccupancyMaxPotentialBlockSizeWithFlags);
+    return pcuOccupancyMaxPotentialBlockSizeWithFlags(minGridSize, blockSize, func, blockSizeToDynamicSMemSize,
+                                                      dynamicSMemSize, blockSizeLimit, flags);
+}
+*/
+
+CUresult WINAPI wine_cuPointerGetAttributes(unsigned int numAttributes, CUpointer_attribute *attributes, void **data, CUdeviceptr ptr)
+{
+    TRACE("(%u, %p, %p, " DEV_PTR ")\n", numAttributes, attributes, data, ptr);
+    CHECK_FUNCPTR(cuPointerGetAttributes);
+    return pcuPointerGetAttributes(numAttributes, attributes, data, ptr);
+}
+
+CUresult WINAPI wine_cuStreamAddCallback_ptsz(CUstream hStream, void *callback, void *userData, unsigned int flags)
+{
+    TRACE("(%p, %p, %p, %u)\n", hStream, callback, userData, flags);
+    CHECK_FUNCPTR(cuStreamAddCallback_ptsz);
+    return stream_add_callback(pcuStreamAddCallback_ptsz, hStream, callback, userData, flags);
+}
+
+CUresult WINAPI wine_cuStreamAttachMemAsync_ptsz(CUstream hStream, CUdeviceptr dptr, size_t length, unsigned int flags)
+{
+    TRACE("(%p, " DEV_PTR ", %lu, %u)\n", hStream, dptr, (SIZE_T)length, flags);
+    CHECK_FUNCPTR(cuStreamAttachMemAsync_ptsz);
+    return pcuStreamAttachMemAsync_ptsz(hStream, dptr, length, flags);
+}
+
+CUresult WINAPI wine_cuStreamGetFlags_ptsz(CUstream hStream, unsigned int *flags)
+{
+    TRACE("(%p, %p)\n", hStream, flags);
+    CHECK_FUNCPTR(cuStreamGetFlags_ptsz);
+    return pcuStreamGetFlags_ptsz(hStream, flags);
+}
+
+CUresult WINAPI wine_cuStreamGetPriority_ptsz(CUstream hStream, int *priority)
+{
+    TRACE("(%p, %p)\n", hStream, priority);
+    CHECK_FUNCPTR(cuStreamGetPriority_ptsz);
+    return pcuStreamGetPriority_ptsz(hStream, priority);
+}
+
+CUresult WINAPI wine_cuStreamQuery_ptsz(CUstream hStream)
+{
+    TRACE("(%p)\n", hStream);
+    CHECK_FUNCPTR(cuStreamQuery_ptsz);
+    return pcuStreamQuery_ptsz(hStream);
+}
+
+CUresult WINAPI wine_cuStreamSynchronize_ptsz(CUstream hStream)
+{
+    TRACE("(%p)\n", hStream);
+    CHECK_FUNCPTR(cuStreamSynchronize_ptsz);
+    return pcuStreamSynchronize_ptsz(hStream);
+}
+
+CUresult WINAPI wine_cuStreamWaitEvent_ptsz(CUstream hStream, CUevent hEvent, unsigned int Flags)
+{
+    TRACE("(%p, %p, %u)\n", hStream, hEvent, Flags);
+    CHECK_FUNCPTR(cuStreamWaitEvent_ptsz);
+    return pcuStreamWaitEvent_ptsz(hStream, hEvent, Flags);
+}
+
+#undef CHECK_FUNCPTR
+
+/*
  * Direct3D emulated functions
  */
 
diff --git a/dlls/nvcuda/nvcuda.spec b/dlls/nvcuda/nvcuda.spec
index 5ca921e..84b5fcd 100644
--- a/dlls/nvcuda/nvcuda.spec
+++ b/dlls/nvcuda/nvcuda.spec
@@ -317,3 +317,64 @@
 @ stdcall cuOccupancyMaxActiveBlocksPerMultiprocessor(ptr ptr long long) wine_cuOccupancyMaxActiveBlocksPerMultiprocessor
 @ stub cuOccupancyMaxPotentialBlockSize
 #@ stdcall cuOccupancyMaxPotentialBlockSize(ptr ptr ptr ptr long long) wine_cuOccupancyMaxPotentialBlockSize
+
+# CUDA 7.0
+@ stdcall cuCtxGetFlags(ptr) wine_cuCtxGetFlags
+@ stdcall cuDevicePrimaryCtxGetState(long ptr ptr) wine_cuDevicePrimaryCtxGetState
+@ stdcall cuDevicePrimaryCtxRelease(long) wine_cuDevicePrimaryCtxRelease
+@ stdcall cuDevicePrimaryCtxReset(long) wine_cuDevicePrimaryCtxReset
+@ stdcall cuDevicePrimaryCtxRetain(ptr long) wine_cuDevicePrimaryCtxRetain
+@ stdcall cuDevicePrimaryCtxSetFlags(long long) wine_cuDevicePrimaryCtxSetFlags
+@ stdcall cuEventRecord_ptsz(ptr ptr) wine_cuEventRecord_ptsz
+@ stdcall cuGLMapBufferObjectAsync_v2_ptsz(ptr ptr long ptr) wine_cuGLMapBufferObjectAsync_v2_ptsz
+@ stdcall cuGLMapBufferObject_v2_ptds(ptr ptr long) wine_cuGLMapBufferObject_v2_ptds
+@ stdcall cuGraphicsMapResources_ptsz(long ptr ptr) wine_cuGraphicsMapResources_ptsz
+@ stdcall cuGraphicsUnmapResources_ptsz(long ptr ptr) wine_cuGraphicsUnmapResources_ptsz
+@ stdcall cuLaunchKernel_ptsz(ptr long long long long long long long ptr ptr ptr) wine_cuLaunchKernel_ptsz
+@ stdcall cuMemcpy2DAsync_v2_ptsz(ptr ptr) wine_cuMemcpy2DAsync_v2_ptsz
+@ stdcall cuMemcpy2DUnaligned_v2_ptds(ptr) wine_cuMemcpy2DUnaligned_v2_ptds
+@ stdcall cuMemcpy2D_v2_ptds(ptr) wine_cuMemcpy2D_v2_ptds
+@ stdcall cuMemcpy3DAsync_v2_ptsz(ptr ptr) wine_cuMemcpy3DAsync_v2_ptsz
+@ stdcall cuMemcpy3DPeerAsync_ptsz(ptr ptr) wine_cuMemcpy3DPeerAsync_ptsz
+@ stdcall cuMemcpy3DPeer_ptds(ptr) wine_cuMemcpy3DPeer_ptds
+@ stdcall cuMemcpy3D_v2_ptds(ptr) wine_cuMemcpy3D_v2_ptds
+@ stdcall cuMemcpyAsync_ptsz(long long long ptr) wine_cuMemcpyAsync_ptsz
+@ stdcall cuMemcpyAtoA_v2_ptds(ptr long ptr long long) wine_cuMemcpyAtoA_v2_ptds
+@ stdcall cuMemcpyAtoD_v2_ptds(long ptr long long) wine_cuMemcpyAtoD_v2_ptds
+@ stdcall cuMemcpyAtoHAsync_v2_ptsz(ptr ptr long long ptr) wine_cuMemcpyAtoHAsync_v2_ptsz
+@ stdcall cuMemcpyAtoH_v2_ptds(ptr ptr long long) wine_cuMemcpyAtoH_v2_ptds
+@ stdcall cuMemcpyDtoA_v2_ptds(ptr long long long) wine_cuMemcpyDtoA_v2_ptds
+@ stdcall cuMemcpyDtoDAsync_v2_ptsz(long long long ptr) wine_cuMemcpyDtoDAsync_v2_ptsz
+@ stdcall cuMemcpyDtoD_v2_ptds(long long long) wine_cuMemcpyDtoD_v2_ptds
+@ stdcall cuMemcpyDtoHAsync_v2_ptsz(ptr long long ptr) wine_cuMemcpyDtoHAsync_v2_ptsz
+@ stdcall cuMemcpyDtoH_v2_ptds(ptr long long) wine_cuMemcpyDtoH_v2_ptds
+@ stdcall cuMemcpyHtoAAsync_v2_ptsz(ptr long ptr long ptr) wine_cuMemcpyHtoAAsync_v2_ptsz
+@ stdcall cuMemcpyHtoA_v2_ptds(ptr long ptr long) wine_cuMemcpyHtoA_v2_ptds
+@ stdcall cuMemcpyHtoDAsync_v2_ptsz(long ptr long ptr) wine_cuMemcpyHtoDAsync_v2_ptsz
+@ stdcall cuMemcpyHtoD_v2_ptds(long ptr long) wine_cuMemcpyHtoD_v2_ptds
+@ stdcall cuMemcpyPeerAsync_ptsz(long ptr long ptr long ptr) wine_cuMemcpyPeerAsync_ptsz
+@ stdcall cuMemcpyPeer_ptds(long ptr long ptr long) wine_cuMemcpyPeer_ptds
+@ stdcall cuMemcpy_ptds(long long long) wine_cuMemcpy_ptds
+@ stdcall cuMemsetD16Async_ptsz(long long long ptr) wine_cuMemsetD16Async_ptsz
+@ stdcall cuMemsetD16_v2_ptds(long long long) wine_cuMemsetD16_v2_ptds
+@ stdcall cuMemsetD2D16Async_ptsz(long long long long long ptr) wine_cuMemsetD2D16Async_ptsz
+@ stdcall cuMemsetD2D16_v2_ptds(long long long long long) wine_cuMemsetD2D16_v2_ptds
+@ stdcall cuMemsetD2D32Async_ptsz(long long long long long ptr) wine_cuMemsetD2D32Async_ptsz
+@ stdcall cuMemsetD2D32_v2_ptds(long long long long long) wine_cuMemsetD2D32_v2_ptds
+@ stdcall cuMemsetD2D8Async_ptsz(long long long long long ptr) wine_cuMemsetD2D8Async_ptsz
+@ stdcall cuMemsetD2D8_v2_ptds(long long long long long) wine_cuMemsetD2D8_v2_ptds
+@ stdcall cuMemsetD32Async_ptsz(long long long ptr) wine_cuMemsetD32Async_ptsz
+@ stdcall cuMemsetD32_v2_ptds(long long long) wine_cuMemsetD32_v2_ptds
+@ stdcall cuMemsetD8Async_ptsz(long long long ptr) wine_cuMemsetD8Async_ptsz
+@ stdcall cuMemsetD8_v2_ptds(long long long) wine_cuMemsetD8_v2_ptds
+@ stdcall cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(ptr ptr long long long) wine_cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags
+@ stub cuOccupancyMaxPotentialBlockSizeWithFlags
+#@ stdcall cuOccupancyMaxPotentialBlockSizeWithFlags(ptr ptr ptr ptr long long long) wine_cuOccupancyMaxPotentialBlockSizeWithFlags
+@ stdcall cuPointerGetAttributes(long ptr ptr long) wine_cuPointerGetAttributes
+@ stdcall cuStreamAddCallback_ptsz(ptr ptr ptr long) wine_cuStreamAddCallback_ptsz
+@ stdcall cuStreamAttachMemAsync_ptsz(ptr long long long) wine_cuStreamAttachMemAsync_ptsz
+@ stdcall cuStreamGetFlags_ptsz(ptr ptr) wine_cuStreamGetFlags_ptsz
+@ stdcall cuStreamGetPriority_ptsz(ptr ptr) wine_cuStreamGetPriority_ptsz
+@ stdcall cuStreamQuery_ptsz(ptr) wine_cuStreamQuery_ptsz
+@ stdcall cuStreamSynchronize_ptsz(ptr) wine_cuStreamSynchronize_ptsz
+@ stdcall cuStreamWaitEvent_ptsz(ptr ptr long) wine_cuStreamWaitEvent_ptsz
-- 
2.2.2

