diff --git a/projects/clr/hipamd/src/hip_context.cpp b/projects/clr/hipamd/src/hip_context.cpp index 32b3545ecd..2a10a2aa58 100644 --- a/projects/clr/hipamd/src/hip_context.cpp +++ b/projects/clr/hipamd/src/hip_context.cpp @@ -312,6 +312,11 @@ hipError_t hipCtxGetCacheConfig(hipFuncCache_t* cacheConfig) { hipError_t hipCtxSetCacheConfig(hipFuncCache_t cacheConfig) { HIP_INIT_API(hipCtxSetCacheConfig, cacheConfig); + if (cacheConfig != hipFuncCachePreferNone && cacheConfig != hipFuncCachePreferShared && + cacheConfig != hipFuncCachePreferL1 && cacheConfig != hipFuncCachePreferEqual) { + HIP_RETURN(hipErrorInvalidValue); + } + assert(0 && "Unimplemented"); HIP_RETURN(hipErrorNotSupported); diff --git a/projects/clr/hipamd/src/hip_device_runtime.cpp b/projects/clr/hipamd/src/hip_device_runtime.cpp index bf9196461a..bf757fe0f1 100644 --- a/projects/clr/hipamd/src/hip_device_runtime.cpp +++ b/projects/clr/hipamd/src/hip_device_runtime.cpp @@ -574,6 +574,11 @@ hipError_t hipDeviceReset(void) { hipError_t hipDeviceSetCacheConfig(hipFuncCache_t cacheConfig) { HIP_INIT_API(hipDeviceSetCacheConfig, cacheConfig); + if (cacheConfig != hipFuncCachePreferNone && cacheConfig != hipFuncCachePreferShared && + cacheConfig != hipFuncCachePreferL1 && cacheConfig != hipFuncCachePreferEqual) { + HIP_RETURN(hipErrorInvalidValue); + } + // No way to set cache config yet. HIP_RETURN(hipSuccess); diff --git a/projects/clr/hipamd/src/hip_module.cpp b/projects/clr/hipamd/src/hip_module.cpp index 35a0120c10..7e670be022 100644 --- a/projects/clr/hipamd/src/hip_module.cpp +++ b/projects/clr/hipamd/src/hip_module.cpp @@ -222,7 +222,12 @@ hipError_t hipFuncSetAttribute(const void* func, hipFuncAttribute attr, int valu hipError_t hipFuncSetCacheConfig(const void* func, hipFuncCache_t cacheConfig) { HIP_INIT_API(hipFuncSetCacheConfig, cacheConfig); - // No way to set cache config yet. + if (func == nullptr) { HIP_RETURN(hipErrorInvalidDeviceFunction); } + if (cacheConfig != hipFuncCachePreferNone && cacheConfig != hipFuncCachePreferShared && + cacheConfig != hipFuncCachePreferL1 && cacheConfig != hipFuncCachePreferEqual) { + HIP_RETURN(hipErrorInvalidValue); + } + // No way to set cache config yet HIP_RETURN(hipSuccess); } @@ -230,7 +235,13 @@ hipError_t hipFuncSetCacheConfig(const void* func, hipFuncCache_t cacheConfig) { hipError_t hipFuncSetSharedMemConfig(const void* func, hipSharedMemConfig config) { HIP_INIT_API(hipFuncSetSharedMemConfig, func, config); - // No way to set Shared Memory config function yet. + if (func == nullptr) { HIP_RETURN(hipErrorInvalidDeviceFunction); } + if (config != hipSharedMemBankSizeDefault && config != hipSharedMemBankSizeFourByte && + config != hipSharedMemBankSizeEightByte) { + HIP_RETURN(hipErrorInvalidValue); + } + + // No way to set shared memory config yet HIP_RETURN(hipSuccess); }