From 71b98fef5e29ed8dfd18531910fe134f0cc40da4 Mon Sep 17 00:00:00 2001 From: Aditya Atluri Date: Wed, 12 Oct 2016 21:06:30 -0500 Subject: [PATCH] added limit api support for nvcc Change-Id: Ib6c939e44343158a70e0de7f107d21afc0d0efba --- hipamd/include/hip/nvcc_detail/hip_runtime_api.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hipamd/include/hip/nvcc_detail/hip_runtime_api.h b/hipamd/include/hip/nvcc_detail/hip_runtime_api.h index 838465bd0d..b4369eb9f0 100644 --- a/hipamd/include/hip/nvcc_detail/hip_runtime_api.h +++ b/hipamd/include/hip/nvcc_detail/hip_runtime_api.h @@ -72,6 +72,7 @@ typedef cudaEvent_t hipEvent_t; typedef cudaStream_t hipStream_t; typedef cudaIpcEventHandle_t hipIpcEventHandle_t; typedef cudaIpcMemHandle_t hipIpcMemHandle_t; +typedef cudaLimit hipLimit_t; typedef CUcontext hipCtx_t; typedef CUsharedconfig hipSharedMemConfig; typedef CUfunc_cache hipFuncCache; @@ -101,6 +102,7 @@ switch(cuError) { case cudaErrorPeerAccessAlreadyEnabled : return hipErrorPeerAccessAlreadyEnabled ; case cudaErrorHostMemoryAlreadyRegistered : return hipErrorHostMemoryAlreadyRegistered ; case cudaErrorHostMemoryNotRegistered : return hipErrorHostMemoryNotRegistered ; + case cudaErrorUnsupportedLimit : return hipErrorUnsupportedLimit ; default : return hipErrorUnknown; // Note - translated error. }; } @@ -730,12 +732,17 @@ inline static hipError_t hipDeviceGetName(char *name,int len,hipDevice_t device) return hipCUResultTohipError(cuDeviceGetName(name,len,device)); } -inline static hipError_t hipDeviceGetPCIBusId (int *pciBusId,int len,hipDevice_t device) +inline static hipError_t hipDeviceGetPCIBusId(int *pciBusId,int len,hipDevice_t device) { return hipCUResultTohipError(cuDeviceGetPCIBusId((char*)pciBusId,len,device)); } -inline static hipError_t hipDeviceTotalMem (size_t *bytes,hipDevice_t device) +inline static hipError_t hipDeviceGetLimit(size_t *pValue, hipLimit_t limit) +{ + return hipCUDAErrorTohipError(cudaDeviceGetLimit(pValue, limit); +} + +inline static hipError_t hipDeviceTotalMem(size_t *bytes,hipDevice_t device) { return hipCUResultTohipError(cuDeviceTotalMem(bytes,device)); }