From 7bfb990ef7f0300ca00fb2bfa93acb7a0fd4a481 Mon Sep 17 00:00:00 2001 From: Aryan Salmanpour Date: Tue, 3 Mar 2020 13:25:36 -0500 Subject: [PATCH] [HIP] add hip specific properties for cooperative kernel multi device --- hipamd/include/hip/hip_runtime_api.h | 16 ++++++++++++++++ hipamd/include/hip/nvcc_detail/hip_runtime_api.h | 4 ++++ hipamd/src/hip_device.cpp | 12 ++++++++++++ hipamd/src/hip_hcc.cpp | 5 +++++ 4 files changed, 37 insertions(+) diff --git a/hipamd/include/hip/hip_runtime_api.h b/hipamd/include/hip/hip_runtime_api.h index 025688e98c..340b01c99d 100644 --- a/hipamd/include/hip/hip_runtime_api.h +++ b/hipamd/include/hip/hip_runtime_api.h @@ -117,6 +117,14 @@ typedef struct hipDeviceProp_t { int integrated; ///< APU vs dGPU int cooperativeLaunch; ///< HIP device supports cooperative launch int cooperativeMultiDeviceLaunch; ///< HIP device supports cooperative launch on multiple devices + int cooperativeMultiDeviceUnmatchedFunc; ///< HIP device supports cooperative launch on multiple + ///devices with unmatched functions + int cooperativeMultiDeviceUnmatchedGridDim; ///< HIP device supports cooperative launch on multiple + ///devices with unmatched grid dimensions + int cooperativeMultiDeviceUnmatchedBlockDim;///< HIP device supports cooperative launch on multiple + ///devices with unmatched block dimensions + int cooperativeMultiDeviceUnmatchedSharedMem;///< HIP device supports cooperative launch on multiple + ///devices with unmatched shared memories int maxTexture1D; ///< Maximum number of elements in 1D images int maxTexture2D[2]; ///< Maximum dimensions (width, height) of 2D images, in image elements int maxTexture3D[3]; ///< Maximum dimensions (width, height, depth) of 3D images, in image elements @@ -313,6 +321,14 @@ typedef enum hipDeviceAttribute_t { hipDeviceAttributeIntegrated, ///< iGPU hipDeviceAttributeCooperativeLaunch, ///< Support cooperative launch hipDeviceAttributeCooperativeMultiDeviceLaunch, ///< Support cooperative launch on multiple devices + hipDeviceAttributeCooperativeMultiDeviceUnmatchedFunc, ///< Supports cooperative launch on multiple + ///devices with unmatched functions + hipDeviceAttributeCooperativeMultiDeviceUnmatchedGridDim, ///< Supports cooperative launch on multiple + ///devices with unmatched grid dimensions + hipDeviceAttributeCooperativeMultiDeviceUnmatchedBlockDim,///< Supports cooperative launch on multiple + ///devices with unmatched block dimensions + hipDeviceAttributeCooperativeMultiDeviceUnmatchedSharedMem,///< Supports cooperative launch on multiple + ///devices with unmatched shared memories hipDeviceAttributeMaxTexture1DWidth, ///< Maximum number of elements in 1D images hipDeviceAttributeMaxTexture2DWidth, ///< Maximum dimension width of 2D images in image elements diff --git a/hipamd/include/hip/nvcc_detail/hip_runtime_api.h b/hipamd/include/hip/nvcc_detail/hip_runtime_api.h index 6e0d02d0c0..04f7a429df 100644 --- a/hipamd/include/hip/nvcc_detail/hip_runtime_api.h +++ b/hipamd/include/hip/nvcc_detail/hip_runtime_api.h @@ -1134,6 +1134,10 @@ inline static hipError_t hipGetDeviceProperties(hipDeviceProp_t* p_prop, int dev p_prop->integrated = cdprop.integrated; p_prop->cooperativeLaunch = cdprop.cooperativeLaunch; p_prop->cooperativeMultiDeviceLaunch = cdprop.cooperativeMultiDeviceLaunch; + p_prop->cooperativeMultiDeviceUnmatchedFunc = 0; + p_prop->cooperativeMultiDeviceUnmatchedGridDim = 0; + p_prop->cooperativeMultiDeviceUnmatchedBlockDim = 0; + p_prop->cooperativeMultiDeviceUnmatchedSharedMem = 0; p_prop->maxTexture1D = cdprop.maxTexture1D; p_prop->maxTexture2D[0] = cdprop.maxTexture2D[0]; diff --git a/hipamd/src/hip_device.cpp b/hipamd/src/hip_device.cpp index 1bbdb10bbc..e5797727ae 100644 --- a/hipamd/src/hip_device.cpp +++ b/hipamd/src/hip_device.cpp @@ -310,6 +310,18 @@ hipError_t ihipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device case hipDeviceAttributeCooperativeMultiDeviceLaunch: *pi = prop->cooperativeMultiDeviceLaunch; break; + case hipDeviceAttributeCooperativeMultiDeviceUnmatchedFunc: + *pi = prop->cooperativeMultiDeviceUnmatchedFunc; + break; + case hipDeviceAttributeCooperativeMultiDeviceUnmatchedGridDim: + *pi = prop->cooperativeMultiDeviceUnmatchedGridDim; + break; + case hipDeviceAttributeCooperativeMultiDeviceUnmatchedBlockDim: + *pi = prop->cooperativeMultiDeviceUnmatchedBlockDim; + break; + case hipDeviceAttributeCooperativeMultiDeviceUnmatchedSharedMem: + *pi = prop->cooperativeMultiDeviceUnmatchedSharedMem; + break; case hipDeviceAttributeMaxPitch: *pi = prop->memPitch; break; diff --git a/hipamd/src/hip_hcc.cpp b/hipamd/src/hip_hcc.cpp index c9688408c8..99c63e0338 100644 --- a/hipamd/src/hip_hcc.cpp +++ b/hipamd/src/hip_hcc.cpp @@ -901,6 +901,11 @@ hipError_t ihipDevice_t::initProperties(hipDeviceProp_t* prop) { prop->cooperativeLaunch = (prop->gcnArch < 900) ? 0 : 1; prop->cooperativeMultiDeviceLaunch = (prop->gcnArch < 900) ? 0 : 1; + prop->cooperativeMultiDeviceUnmatchedFunc = prop->cooperativeMultiDeviceLaunch; + prop->cooperativeMultiDeviceUnmatchedGridDim = prop->cooperativeMultiDeviceLaunch; + prop->cooperativeMultiDeviceUnmatchedBlockDim = prop->cooperativeMultiDeviceLaunch; + prop->cooperativeMultiDeviceUnmatchedSharedMem = prop->cooperativeMultiDeviceLaunch; + err = hsa_agent_get_info(_hsaAgent, (hsa_agent_info_t)HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS, &prop->maxTexture1D); DeviceErrorCheck(err);