Fixed hipDeviceGetCacheConfig on nvcc path
1. Changed test macro to emit line numbers 2. Added getcacheconfig api test for nvcc path 3. Fixed hipFuncCache_t data type TODO: With this commit, right now there are 2 func cache datatypes a. hipFuncCache_t for runtime API b. hipFuncCache for driver API Map these to a single data type Change-Id: Ia47c9f5d7c2633638051bf17b1103048a1ede973
This commit is contained in:
@@ -112,12 +112,12 @@ enum hipLimit_t
|
||||
/**
|
||||
* @warning On AMD devices and recent Nvidia devices, these hints and controls are ignored.
|
||||
*/
|
||||
typedef enum hipFuncCache {
|
||||
typedef enum hipFuncCache_t {
|
||||
hipFuncCachePreferNone, ///< no preference for shared memory or L1 (default)
|
||||
hipFuncCachePreferShared, ///< prefer larger shared memory and smaller L1 cache
|
||||
hipFuncCachePreferL1, ///< prefer larger L1 cache and smaller shared memory
|
||||
hipFuncCachePreferEqual, ///< prefer equal size L1 cache and shared memory
|
||||
} hipFuncCache;
|
||||
} hipFuncCache_t;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,6 +76,7 @@ typedef cudaStream_t hipStream_t;
|
||||
typedef cudaIpcEventHandle_t hipIpcEventHandle_t;
|
||||
typedef cudaIpcMemHandle_t hipIpcMemHandle_t;
|
||||
typedef cudaLimit hipLimit_t;
|
||||
typedef cudaFuncCache hipFuncCache_t;
|
||||
typedef CUcontext hipCtx_t;
|
||||
typedef CUsharedconfig hipSharedMemConfig;
|
||||
typedef CUfunc_cache hipFuncCache;
|
||||
@@ -323,6 +324,10 @@ inline static hipError_t hipDeviceSynchronize() {
|
||||
return hipCUDAErrorTohipError(cudaDeviceSynchronize());
|
||||
}
|
||||
|
||||
inline static hipError_t hipDeviceGetCacheConfig(hipFuncCache_t *pCacheConfig) {
|
||||
return hipCUDAErrorTohipError(cudaDeviceGetCacheConfig(pCacheConfig));
|
||||
}
|
||||
|
||||
inline static const char* hipGetErrorString(hipError_t error){
|
||||
return cudaGetErrorString(hipErrorToCudaError(error));
|
||||
}
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ hipError_t hipGetDeviceCount(int *count)
|
||||
return e;
|
||||
}
|
||||
|
||||
hipError_t hipDeviceSetCacheConfig(hipFuncCache cacheConfig)
|
||||
hipError_t hipDeviceSetCacheConfig(hipFuncCache_t cacheConfig)
|
||||
{
|
||||
HIP_INIT_API(cacheConfig);
|
||||
|
||||
|
||||
@@ -23,12 +23,13 @@ THE SOFTWARE.
|
||||
int main()
|
||||
{
|
||||
int val;
|
||||
hipDeviceAttr_t attr = hipDevAttrMaxThreadsPerBlock;
|
||||
hipDeviceAttribute_t attr = hipDeviceAttributeMaxThreadsPerBlock; ///< Maximum number of threads per block.
|
||||
|
||||
HIP_PRINT_STATUS(hipDeviceGetAttribute(NULL, attr, 0));
|
||||
HIP_PRINT_STATUS(hipDeviceGetAttribute(&val, attr, 0));
|
||||
HIP_PRINT_STATUS(hipDeviceGetAttribute(NULL, attr, -1));
|
||||
HIP_PRINT_STATUS(hipDeviceGetAttribute(&val, attr, -1));
|
||||
attr = 91;
|
||||
attr = hipDeviceAttribute_t(91);
|
||||
|
||||
HIP_PRINT_STATUS(hipDeviceGetAttribute(NULL, attr, 0));
|
||||
HIP_PRINT_STATUS(hipDeviceGetAttribute(&val, attr, 0));
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include<hip/hip_runtime_api.h>
|
||||
#include"test_common.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
hipFuncCache_t pCacheConfig;
|
||||
HIP_PRINT_STATUS(hipDeviceGetCacheConfig(&pCacheConfig));
|
||||
HIP_PRINT_STATUS(hipDeviceGetCacheConfig(NULL));
|
||||
}
|
||||
@@ -65,7 +65,7 @@ THE SOFTWARE.
|
||||
printf ("warn: TEST WARNING\n%s", KNRM );\
|
||||
|
||||
#define HIP_PRINT_STATUS(status) \
|
||||
std::cout<<hipGetErrorName(status)<<std::endl;
|
||||
std::cout<<hipGetErrorName(status)<<" at line: "<<__LINE__<<std::endl;
|
||||
|
||||
#define HIPCHECK(error) \
|
||||
{\
|
||||
|
||||
Reference in New Issue
Block a user