Skip to main content

cuCtxSetCacheConfig

Function cuCtxSetCacheConfig 

Source
pub unsafe extern "C" fn cuCtxSetCacheConfig(
    config: CUfunc_cache,
) -> CUresult
Expand description

Sets the preferred cache configuration for the current context.

On devices where the L1 cache and shared memory use the same hardware resources, this sets through config the preferred cache configuration for the current context. This is only a preference. The driver will use the requested configuration if possible, but it is free to choose a different configuration if required to execute the function. Any function preference set via cuFuncSetCacheConfig or cuKernelSetCacheConfig will be preferred over this context-wide setting. Setting the context-wide cache configuration to CUfunc_cache_enum::CU_FUNC_CACHE_PREFER_NONE will cause subsequent kernel launches to prefer to not change the cache configuration unless required to launch the kernel.

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:

Note that this function may also return error codes from previous, asynchronous launches.

§Parameters

  • config: Requested cache configuration

§Return value

See also: cuCtxCreate, cuCtxDestroy, cuCtxGetApiVersion, cuCtxGetCacheConfig, cuCtxGetDevice, cuCtxGetFlags, cuCtxGetLimit, cuCtxPopCurrent, cuCtxPushCurrent, cuCtxSetLimit, cuCtxSynchronize, cuFuncSetCacheConfig, cudaDeviceSetCacheConfig, cuKernelSetCacheConfig.