Add Max Texture 1D,2D,3D device properties (#1226)
* Add Max Texture 1D,2D,3D device properties
* Corrected testcase to use enums defined in hipDeviceAttribute_t
* Added texture 1D,2D and 3D support for NVIDIA path
[ROCm/hip commit: 8e496c09d9]
Этот коммит содержится в:
коммит произвёл
Maneesh Gupta
родитель
358d9d311f
Коммит
df4dee39f4
@@ -321,6 +321,12 @@ while (@ARGV) {
|
||||
$ft{'err'} += s/\bcudaDevAttrMaxSharedMemoryPerMultiprocessor\b/hipDeviceAttributeMaxSharedMemoryPerMultiprocessor/g;
|
||||
$ft{'err'} += s/\bcudaDevAttrMemoryClockRate\b/hipDeviceAttributeMemoryClockRate/g;
|
||||
$ft{'err'} += s/\bcudaDevAttrGlobalMemoryBusWidth\b/hipDeviceAttributeMemoryBusWidth/g;
|
||||
$ft{'err'} += s/\bcudaDevAttrMaxTexture1DWidth\b/hipDeviceAttributeMaxTexture1DWidth/g;
|
||||
$ft{'err'} += s/\bcudaDevAttrMaxTexture2DWidth\b/hipDeviceAttributeMaxTexture2DWidth/g;
|
||||
$ft{'err'} += s/\bcudaDevAttrMaxTexture2DHeight\b/hipDeviceAttributeMaxTexture2DHeight/g;
|
||||
$ft{'err'} += s/\bcudaDevAttrMaxTexture3DWidth\b/hipDeviceAttributeMaxTexture3DWidth/g;
|
||||
$ft{'err'} += s/\bcudaDevAttrMaxTexture3DHeight\b/hipDeviceAttributeMaxTexture3DHeight/g;
|
||||
$ft{'err'} += s/\bcudaDevAttrMaxTexture3DDepth\b/hipDeviceAttributeMaxTexture3DDepth/g;
|
||||
#--------
|
||||
$ft{'dev'} += s/\bcudaDeviceAttr\b/hipDeviceAttribute_t/g;
|
||||
$ft{'dev'} += s/\bcudaDeviceGetAttribute\b/hipDeviceGetAttribute/g;
|
||||
|
||||
@@ -519,12 +519,12 @@
|
||||
| 18 |*`cudaDevAttrIntegrated`* |*`hipDeviceAttributeIntegrated`* |
|
||||
| 19 |*`cudaDevAttrCanMapHostMemory`* | |
|
||||
| 20 |*`cudaDevAttrComputeMode`* |*`hipDeviceAttributeComputeMode`* |
|
||||
| 21 |*`cudaDevAttrMaxTexture1DWidth`* | |
|
||||
| 22 |*`cudaDevAttrMaxTexture2DWidth`* | |
|
||||
| 23 |*`cudaDevAttrMaxTexture2DHeight`* | |
|
||||
| 24 |*`cudaDevAttrMaxTexture3DWidth`* | |
|
||||
| 25 |*`cudaDevAttrMaxTexture3DHeight`* | |
|
||||
| 26 |*`cudaDevAttrMaxTexture3DDepth`* | |
|
||||
| 21 |*`cudaDevAttrMaxTexture1DWidth`* |*`hipDeviceAttributeMaxTexture1DWidth`* |
|
||||
| 22 |*`cudaDevAttrMaxTexture2DWidth`* |*`hipDeviceAttributeMaxTexture2DWidth`* |
|
||||
| 23 |*`cudaDevAttrMaxTexture2DHeight`* |*`hipDeviceAttributeMaxTexture2DHeight`* |
|
||||
| 24 |*`cudaDevAttrMaxTexture3DWidth`* |*`hipDeviceAttributeMaxTexture3DWidth`* |
|
||||
| 25 |*`cudaDevAttrMaxTexture3DHeight`* |*`hipDeviceAttributeMaxTexture3DHeight`* |
|
||||
| 26 |*`cudaDevAttrMaxTexture3DDepth`* |*`hipDeviceAttributeMaxTexture3DDepth`* |
|
||||
| 27 |*`cudaDevAttrMaxTexture2DLayeredWidth`* | |
|
||||
| 28 |*`cudaDevAttrMaxTexture2DLayeredHeight`* | |
|
||||
| 29 |*`cudaDevAttrMaxTexture2DLayeredLayers`* | |
|
||||
|
||||
@@ -328,17 +328,17 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DRIVER_TYPE_NAME_MAP{
|
||||
// cudaDevAttrComputeMode
|
||||
{"CU_DEVICE_ATTRIBUTE_COMPUTE_MODE", {"hipDeviceAttributeComputeMode", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 20
|
||||
// cudaDevAttrMaxTexture1DWidth
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH", {"hipDeviceAttributeMaxTexture1DWidth", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 21
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH", {"hipDeviceAttributeMaxTexture1DWidth", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 21
|
||||
// cudaDevAttrMaxTexture2DWidth
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH", {"hipDeviceAttributeMaxTexture2DWidth", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 22
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH", {"hipDeviceAttributeMaxTexture2DWidth", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 22
|
||||
// cudaDevAttrMaxTexture2DHeight
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT", {"hipDeviceAttributeMaxTexture2DHeight", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 23
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT", {"hipDeviceAttributeMaxTexture2DHeight", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 23
|
||||
// cudaDevAttrMaxTexture3DWidth
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH", {"hipDeviceAttributeMaxTexture3DWidth", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 24
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH", {"hipDeviceAttributeMaxTexture3DWidth", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 24
|
||||
// cudaDevAttrMaxTexture3DHeight
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT", {"hipDeviceAttributeMaxTexture3DHeight", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 25
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT", {"hipDeviceAttributeMaxTexture3DHeight", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 25
|
||||
// cudaDevAttrMaxTexture3DDepth
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH", {"hipDeviceAttributeMaxTexture3DDepth", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 26
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH", {"hipDeviceAttributeMaxTexture3DDepth", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 26
|
||||
// cudaDevAttrMaxTexture2DLayeredWidth
|
||||
{"CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH", {"hipDeviceAttributeMaxTexture2DLayeredWidth", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 27
|
||||
// cudaDevAttrMaxTexture2DLayeredHeight
|
||||
|
||||
@@ -255,17 +255,17 @@ const std::map<llvm::StringRef, hipCounter> CUDA_RUNTIME_TYPE_NAME_MAP {
|
||||
// CU_DEVICE_ATTRIBUTE_COMPUTE_MODE
|
||||
{"cudaDevAttrComputeMode", {"hipDeviceAttributeComputeMode", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 20
|
||||
// CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH
|
||||
{"cudaDevAttrMaxTexture1DWidth", {"hipDeviceAttributeMaxTexture1DWidth", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 21
|
||||
{"cudaDevAttrMaxTexture1DWidth", {"hipDeviceAttributeMaxTexture1DWidth", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 21
|
||||
// CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH
|
||||
{"cudaDevAttrMaxTexture2DWidth", {"hipDeviceAttributeMaxTexture2DWidth", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 22
|
||||
{"cudaDevAttrMaxTexture2DWidth", {"hipDeviceAttributeMaxTexture2DWidth", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 22
|
||||
// CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT
|
||||
{"cudaDevAttrMaxTexture2DHeight", {"hipDeviceAttributeMaxTexture2DHeight", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 23
|
||||
{"cudaDevAttrMaxTexture2DHeight", {"hipDeviceAttributeMaxTexture2DHeight", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 23
|
||||
// CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH
|
||||
{"cudaDevAttrMaxTexture3DWidth", {"hipDeviceAttributeMaxTexture3DWidth", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 24
|
||||
{"cudaDevAttrMaxTexture3DWidth", {"hipDeviceAttributeMaxTexture3DWidth", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 24
|
||||
// CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT
|
||||
{"cudaDevAttrMaxTexture3DHeight", {"hipDeviceAttributeMaxTexture3DHeight", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 25
|
||||
{"cudaDevAttrMaxTexture3DHeight", {"hipDeviceAttributeMaxTexture3DHeight", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 25
|
||||
// CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH
|
||||
{"cudaDevAttrMaxTexture3DDepth", {"hipDeviceAttributeMaxTexture3DDepth", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 26
|
||||
{"cudaDevAttrMaxTexture3DDepth", {"hipDeviceAttributeMaxTexture3DDepth", "", CONV_NUMERIC_LITERAL, API_RUNTIME}}, // 26
|
||||
// CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH
|
||||
{"cudaDevAttrMaxTexture2DLayeredWidth", {"hipDeviceAttributeMaxTexture2DLayeredWidth", "", CONV_NUMERIC_LITERAL, API_RUNTIME, HIP_UNSUPPORTED}}, // 27
|
||||
// CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT
|
||||
|
||||
@@ -116,7 +116,10 @@ typedef struct hipDeviceProp_t {
|
||||
int gcnArch; ///< AMD GCN Arch Value. Eg: 803, 701
|
||||
int integrated; ///< APU vs dGPU
|
||||
int cooperativeLaunch; ///< HIP device supports cooperative launch
|
||||
int cooperativeMultiDeviceLaunch; ///< HIP device supports cooperative launch on multiple devices
|
||||
int cooperativeMultiDeviceLaunch; ///< HIP device supports cooperative launch on multiple devices
|
||||
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
|
||||
} hipDeviceProp_t;
|
||||
|
||||
|
||||
@@ -295,6 +298,14 @@ typedef enum hipDeviceAttribute_t {
|
||||
hipDeviceAttributeIntegrated, ///< iGPU
|
||||
hipDeviceAttributeCooperativeLaunch, ///< Support cooperative launch
|
||||
hipDeviceAttributeCooperativeMultiDeviceLaunch, ///< Support cooperative launch on multiple devices
|
||||
|
||||
hipDeviceAttributeMaxTexture1DWidth, ///< Maximum number of elements in 1D images
|
||||
hipDeviceAttributeMaxTexture2DWidth, ///< Maximum dimension width of 2D images in image elements
|
||||
hipDeviceAttributeMaxTexture2DHeight, ///< Maximum dimension height of 2D images in image elements
|
||||
hipDeviceAttributeMaxTexture3DWidth, ///< Maximum dimension width of 3D images in image elements
|
||||
hipDeviceAttributeMaxTexture3DHeight, ///< Maximum dimensions height of 3D images in image elements
|
||||
hipDeviceAttributeMaxTexture3DDepth ///< Maximum dimensions depth of 3D images in image elements
|
||||
|
||||
} hipDeviceAttribute_t;
|
||||
|
||||
enum hipComputeMode {
|
||||
|
||||
@@ -772,6 +772,13 @@ inline static hipError_t hipGetDeviceProperties(hipDeviceProp_t* p_prop, int dev
|
||||
p_prop->maxSharedMemoryPerMultiProcessor = cdprop.sharedMemPerMultiprocessor;
|
||||
p_prop->isMultiGpuBoard = cdprop.isMultiGpuBoard;
|
||||
|
||||
p_prop->maxTexture1D = cdprop.maxTexture1D;
|
||||
p_prop->maxTexture2D[0] = cdprop.maxTexture2D[0];
|
||||
p_prop->maxTexture2D[1] = cdprop.maxTexture2D[1];
|
||||
p_prop->maxTexture3D[0] = cdprop.maxTexture3D[0];
|
||||
p_prop->maxTexture3D[1] = cdprop.maxTexture3D[1];
|
||||
p_prop->maxTexture3D[2] = cdprop.maxTexture3D[2];
|
||||
|
||||
return hipCUDAErrorTohipError(cerror);
|
||||
}
|
||||
|
||||
@@ -858,6 +865,24 @@ inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t att
|
||||
case hipDeviceAttributeIntegrated:
|
||||
cdattr = cudaDevAttrIntegrated;
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture1DWidth:
|
||||
cdattr = cudaDevAttrMaxTexture1DWidth;
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture2DWidth:
|
||||
cdattr = cudaDevAttrMaxTexture2DWidth;
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture2DHeight:
|
||||
cdattr = cudaDevAttrMaxTexture2DHeight;
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture3DWidth:
|
||||
cdattr = cudaDevAttrMaxTexture3DWidth;
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture3DHeight:
|
||||
cdattr = cudaDevAttrMaxTexture3DHeight;
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture3DDepth:
|
||||
cdattr = cudaDevAttrMaxTexture3DDepth;
|
||||
break;
|
||||
default:
|
||||
cerror = cudaErrorInvalidValue;
|
||||
break;
|
||||
|
||||
@@ -276,6 +276,24 @@ hipError_t ihipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device
|
||||
case hipDeviceAttributeIntegrated:
|
||||
*pi = prop->integrated;
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture1DWidth:
|
||||
*pi = prop->maxTexture1D;
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture2DWidth:
|
||||
*pi = prop->maxTexture2D[0];
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture2DHeight:
|
||||
*pi = prop->maxTexture2D[1];
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture3DWidth:
|
||||
*pi = prop->maxTexture3D[0];
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture3DHeight:
|
||||
*pi = prop->maxTexture3D[1];
|
||||
break;
|
||||
case hipDeviceAttributeMaxTexture3DDepth:
|
||||
*pi = prop->maxTexture3D[2];
|
||||
break;
|
||||
default:
|
||||
e = hipErrorInvalidValue;
|
||||
break;
|
||||
|
||||
@@ -43,7 +43,7 @@ THE SOFTWARE.
|
||||
#include <hc.hpp>
|
||||
#include <hc_am.hpp>
|
||||
#include "hsa/hsa_ext_amd.h"
|
||||
|
||||
#include "hsa/hsa_ext_image.h"
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "hip_hcc_internal.h"
|
||||
#include "trace_helper.h"
|
||||
@@ -913,6 +913,18 @@ hipError_t ihipDevice_t::initProperties(hipDeviceProp_t* prop) {
|
||||
if(agent_profile == HSA_PROFILE_FULL) {
|
||||
prop->integrated = 1;
|
||||
}
|
||||
|
||||
err = hsa_agent_get_info(_hsaAgent, (hsa_agent_info_t)HSA_EXT_AGENT_INFO_IMAGE_1D_MAX_ELEMENTS,
|
||||
&prop->maxTexture1D);
|
||||
DeviceErrorCheck(err);
|
||||
|
||||
err = hsa_agent_get_info(_hsaAgent, (hsa_agent_info_t)HSA_EXT_AGENT_INFO_IMAGE_2D_MAX_ELEMENTS,
|
||||
prop->maxTexture2D);
|
||||
DeviceErrorCheck(err);
|
||||
|
||||
err = hsa_agent_get_info(_hsaAgent, (hsa_agent_info_t)HSA_EXT_AGENT_INFO_IMAGE_3D_MAX_ELEMENTS,
|
||||
prop->maxTexture3D);
|
||||
DeviceErrorCheck(err);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,5 +109,12 @@ int main(int argc, char* argv[]) {
|
||||
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxSharedMemoryPerMultiprocessor,
|
||||
props.maxSharedMemoryPerMultiProcessor));
|
||||
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeIntegrated, props.integrated));
|
||||
|
||||
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture1DWidth, props.maxTexture1D));
|
||||
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture2DWidth, props.maxTexture2D[0]));
|
||||
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture2DHeight, props.maxTexture2D[1]));
|
||||
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DWidth, props.maxTexture3D[0]));
|
||||
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DHeight, props.maxTexture3D[1]));
|
||||
CHECK(test_hipDeviceGetAttribute(deviceId, hipDeviceAttributeMaxTexture3DDepth, props.maxTexture3D[2]));
|
||||
passed();
|
||||
};
|
||||
|
||||
Ссылка в новой задаче
Block a user