From 7b0f478767c2f65f87de63e5eea950abb7e31e04 Mon Sep 17 00:00:00 2001 From: wkwchau Date: Fri, 2 Aug 2019 06:00:25 -0400 Subject: [PATCH] Added CooperativeLaunch and CooperativeMultiDeviceLaunch flag and property for hipDeviceGetAttribute() and hipGetDeviceProperties() (#1247) [ROCm/clr commit: ed04e96e2d86199108d3f1ab1e26f03b7f5b89dc] --- projects/clr/hipamd/src/hip_device.cpp | 6 ++++++ projects/clr/hipamd/src/hip_hcc.cpp | 4 ++++ .../tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/projects/clr/hipamd/src/hip_device.cpp b/projects/clr/hipamd/src/hip_device.cpp index 1c0e5c9109..31b3997def 100644 --- a/projects/clr/hipamd/src/hip_device.cpp +++ b/projects/clr/hipamd/src/hip_device.cpp @@ -305,6 +305,12 @@ hipError_t ihipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device *hdp = prop->hdpRegFlushCntl; } break; + case hipDeviceAttributeCooperativeLaunch: + *pi = prop->cooperativeLaunch; + break; + case hipDeviceAttributeCooperativeMultiDeviceLaunch: + *pi = prop->cooperativeMultiDeviceLaunch; + break; default: e = hipErrorInvalidValue; break; diff --git a/projects/clr/hipamd/src/hip_hcc.cpp b/projects/clr/hipamd/src/hip_hcc.cpp index f3d6eae6b7..ff19227b57 100644 --- a/projects/clr/hipamd/src/hip_hcc.cpp +++ b/projects/clr/hipamd/src/hip_hcc.cpp @@ -904,6 +904,10 @@ hipError_t ihipDevice_t::initProperties(hipDeviceProp_t* prop) { prop->integrated = 1; } + // Enable the cooperative group for gfx9+ + prop->cooperativeLaunch = (prop->gcnArch < 900) ? 0 : 1; + prop->cooperativeMultiDeviceLaunch = (prop->gcnArch < 900) ? 0 : 1; + err = hsa_agent_get_info(_hsaAgent, (hsa_agent_info_t)HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS, &prop->maxTexture1D); DeviceErrorCheck(err); diff --git a/projects/clr/hipamd/tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp b/projects/clr/hipamd/tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp index 27947339cb..c69eb93a10 100644 --- a/projects/clr/hipamd/tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp +++ b/projects/clr/hipamd/tests/src/runtimeApi/device/hipGetDeviceAttribute.cpp @@ -132,6 +132,10 @@ int main(int argc, char* argv[]) { CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DWidth, props.maxTexture3D[0])); CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DHeight, props.maxTexture3D[1])); CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DDepth, props.maxTexture3D[2])); + + CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeCooperativeLaunch, props.cooperativeLaunch)); + CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeCooperativeMultiDeviceLaunch, props.cooperativeMultiDeviceLaunch)); + #ifndef __HIP_PLATFORM_NVCC__ CHECK(test_hipDeviceGetHdpAddress(deviceId, hipDeviceAttributeHdpMemFlushCntl, props.hdpMemFlushCntl)); CHECK(test_hipDeviceGetHdpAddress(deviceId, hipDeviceAttributeHdpRegFlushCntl, props.hdpRegFlushCntl));