SWDEV-240803 - add hipFuncSetAttribute and hipFuncAttribute
Change-Id: I3f4d67b19d89fd348fa5b884af4a2542ee4aba60
This commit is contained in:
@@ -290,6 +290,14 @@ typedef enum hipJitOption {
|
||||
hipJitOptionNumOptions
|
||||
} hipJitOption;
|
||||
|
||||
/**
|
||||
* @warning On AMD devices and some Nvidia devices, these hints and controls are ignored.
|
||||
*/
|
||||
typedef enum hipFuncAttribute {
|
||||
hipFuncAttributeMaxDynamicSharedMemorySize = 8,
|
||||
hipFuncAttributePreferredSharedMemoryCarveout = 9,
|
||||
hipFuncAttributeMax
|
||||
} hipFuncAttribute;
|
||||
|
||||
/**
|
||||
* @warning On AMD devices and some Nvidia devices, these hints and controls are ignored.
|
||||
@@ -528,6 +536,21 @@ hipError_t hipDeviceGetCacheConfig(hipFuncCache_t* cacheConfig);
|
||||
hipError_t hipDeviceGetLimit(size_t* pValue, enum hipLimit_t limit);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set attribute for a specific function
|
||||
*
|
||||
* @param [in] func;
|
||||
* @param [in] attr;
|
||||
* @param [in] value;
|
||||
*
|
||||
* @returns #hipSuccess, #hipErrorInvalidDeviceFunction, #hipErrorInvalidValue
|
||||
*
|
||||
* Note: AMD devices and some Nvidia GPUS do not support shared cache banking, and the hint is
|
||||
* ignored on those architectures.
|
||||
*
|
||||
*/
|
||||
hipError_t hipFuncSetAttribute(const void* func, hipFuncAttribute attr, int value);
|
||||
|
||||
/**
|
||||
* @brief Set Cache configuration for a specific function
|
||||
*
|
||||
|
||||
@@ -185,6 +185,7 @@ typedef cudaStream_t hipStream_t;
|
||||
typedef cudaIpcEventHandle_t hipIpcEventHandle_t;
|
||||
typedef cudaIpcMemHandle_t hipIpcMemHandle_t;
|
||||
typedef enum cudaLimit hipLimit_t;
|
||||
typedef enum cudaFuncAttribute hipFuncAttribute;
|
||||
typedef enum cudaFuncCache hipFuncCache_t;
|
||||
typedef CUcontext hipCtx_t;
|
||||
typedef enum cudaSharedMemConfig hipSharedMemConfig;
|
||||
@@ -1007,6 +1008,10 @@ inline static hipError_t hipDeviceGetCacheConfig(hipFuncCache_t* pCacheConfig) {
|
||||
return hipCUDAErrorTohipError(cudaDeviceGetCacheConfig(pCacheConfig));
|
||||
}
|
||||
|
||||
inline static hipError_t hipFuncSetAttribute(const void* func, hipFuncAttribute attr, int value) {
|
||||
return hipCUDAErrorTohipError(cudaFuncSetAttribute(func, attr, value));
|
||||
}
|
||||
|
||||
inline static hipError_t hipDeviceSetCacheConfig(hipFuncCache_t cacheConfig) {
|
||||
return hipCUDAErrorTohipError(cudaDeviceSetCacheConfig(cacheConfig));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user