Function rcudnn_sys::cudaFuncSetCacheConfig[][src]

pub unsafe extern "C" fn cudaFuncSetCacheConfig(
    func: *const c_void,
    cacheConfig: cudaFuncCache
) -> cudaError_t
Expand description

\brief Sets the preferred cache configuration for a device function

On devices where the L1 cache and shared memory use the same hardware resources, this sets through \p cacheConfig the preferred cache configuration for the function specified via \p func. This is only a preference. The runtime will use the requested configuration if possible, but it is free to choose a different configuration if required to execute \p func.

\p func is a device function symbol and must be declared as a \c global function. If the specified function does not exist, then ::cudaErrorInvalidDeviceFunction is returned. For templated functions, pass the function symbol as follows: func_name<template_arg_0,…,template_arg_N>

This setting does nothing on devices where the size of the L1 cache and shared memory are fixed.

Launching a kernel with a different preference than the most recent preference setting may insert a device-side synchronization point.

The supported cache configurations are:

  • ::cudaFuncCachePreferNone: no preference for shared memory or L1 (default)
  • ::cudaFuncCachePreferShared: prefer larger shared memory and smaller L1 cache
  • ::cudaFuncCachePreferL1: prefer larger L1 cache and smaller shared memory
  • ::cudaFuncCachePreferEqual: prefer equal size L1 cache and shared memory

\param func - Device function symbol \param cacheConfig - Requested cache configuration

\return ::cudaSuccess, ::cudaErrorInvalidDeviceFunction \notefnerr \note_string_api_deprecation2 \note_init_rt \note_callback

\sa \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) “cudaFuncSetCacheConfig (C++ API)”, \ref ::cudaFuncGetAttributes(struct cudaFuncAttributes*, const void*) “cudaFuncGetAttributes (C API)”, \ref ::cudaLaunchKernel(const void *func, dim3 gridDim, dim3 blockDim, void **args, size_t sharedMem, cudaStream_t stream) “cudaLaunchKernel (C API)”, ::cudaThreadGetCacheConfig, ::cudaThreadSetCacheConfig, ::cuFuncSetCacheConfig