From 79de17dc84b006ddd66a6a975142cbd2f2072789 Mon Sep 17 00:00:00 2001 From: Evgeny Mankov Date: Tue, 13 Aug 2019 16:48:07 +0300 Subject: [PATCH] [HIPIFY][Driver API] Add support for hipFuncGetAttribute() and enum hipFunction_attribute --- ...A_Driver_API_functions_supported_by_HIP.md | 28 +++++++++---------- .../src/CUDA2HIP_Driver_API_functions.cpp | 2 +- .../src/CUDA2HIP_Driver_API_types.cpp | 26 ++++++++--------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/hipamd/docs/markdown/CUDA_Driver_API_functions_supported_by_HIP.md b/hipamd/docs/markdown/CUDA_Driver_API_functions_supported_by_HIP.md index 02a6c6f4a4..061105caf7 100644 --- a/hipamd/docs/markdown/CUDA_Driver_API_functions_supported_by_HIP.md +++ b/hipamd/docs/markdown/CUDA_Driver_API_functions_supported_by_HIP.md @@ -190,19 +190,19 @@ | 0x01 |*`CU_FUNC_CACHE_PREFER_SHARED`* |*`hipFuncCachePreferShared`* | | 0x02 |*`CU_FUNC_CACHE_PREFER_L1`* |*`hipFuncCachePreferL1`* | | 0x03 |*`CU_FUNC_CACHE_PREFER_EQUAL`* |*`hipFuncCachePreferEqual`* | -| enum |***`CUfunction_attribute`*** | | -| typedef |***`CUfunction_attribute_enum`*** | | -| 0 |*`CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK`* | | -| 1 |*`CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`* | | -| 2 |*`CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES`* | | -| 3 |*`CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES`* | | -| 4 |*`CU_FUNC_ATTRIBUTE_NUM_REGS`* | | -| 5 |*`CU_FUNC_ATTRIBUTE_PTX_VERSION`* | | -| 6 |*`CU_FUNC_ATTRIBUTE_BINARY_VERSION`* | | -| 7 |*`CU_FUNC_ATTRIBUTE_CACHE_MODE_CA`* | | -| 8 |*`CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`* | | 9.0 | -| 9 |*`CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`* | | 9.0 | -| 10 |*`CU_FUNC_ATTRIBUTE_MAX`* | | +| enum |***`CUfunction_attribute`*** |***`hipFunction_attribute`*** | +| typedef |***`CUfunction_attribute_enum`*** |***`hipFunction_attribute`*** | +| 0 |*`CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK`* |*`HIP_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK`* | +| 1 |*`CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`* |*`HIP_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES`* | +| 2 |*`CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES`* |*`HIP_FUNC_ATTRIBUTE_CONST_SIZE_BYTES`* | +| 3 |*`CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES`* |*`HIP_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES`* | +| 4 |*`CU_FUNC_ATTRIBUTE_NUM_REGS`* |*`HIP_FUNC_ATTRIBUTE_NUM_REGS`* | +| 5 |*`CU_FUNC_ATTRIBUTE_PTX_VERSION`* |*`HIP_FUNC_ATTRIBUTE_PTX_VERSION`* | +| 6 |*`CU_FUNC_ATTRIBUTE_BINARY_VERSION`* |*`HIP_FUNC_ATTRIBUTE_BINARY_VERSION`* | +| 7 |*`CU_FUNC_ATTRIBUTE_CACHE_MODE_CA`* |*`HIP_FUNC_ATTRIBUTE_CACHE_MODE_CA`* | +| 8 |*`CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`* |*`HIP_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES`* | 9.0 | +| 9 |*`CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`* |*`HIP_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT`* | 9.0 | +| 10 |*`CU_FUNC_ATTRIBUTE_MAX`* |*`HIP_FUNC_ATTRIBUTE_MAX`* | | enum |***`CUgraphicsMapResourceFlags`*** | | | typedef |***`CUgraphicsMapResourceFlags_enum`*** | | | 0x00 |*`CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE`* | | @@ -980,7 +980,7 @@ | **CUDA** | **HIP** |**CUDA version\***| |-----------------------------------------------------------|-------------------------------|:----------------:| -| `cuFuncGetAttribute` | | +| `cuFuncGetAttribute` | `hipFuncGetAttribute` | | `cuFuncSetAttribute` | | 9.0 | | `cuFuncSetCacheConfig` | `hipFuncSetCacheConfig` | | `cuFuncSetSharedMemConfig` | | diff --git a/hipamd/hipify-clang/src/CUDA2HIP_Driver_API_functions.cpp b/hipamd/hipify-clang/src/CUDA2HIP_Driver_API_functions.cpp index 78f663a6fc..224aa06394 100644 --- a/hipamd/hipify-clang/src/CUDA2HIP_Driver_API_functions.cpp +++ b/hipamd/hipify-clang/src/CUDA2HIP_Driver_API_functions.cpp @@ -407,7 +407,7 @@ const std::map CUDA_DRIVER_FUNCTION_MAP{ // 5.17.Execution Control // no analogue - {"cuFuncGetAttribute", {"hipFuncGetAttribute", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}}, + {"cuFuncGetAttribute", {"hipFuncGetAttribute", "", CONV_EXECUTION, API_DRIVER}}, // no analogue // NOTE: Not equal to cudaFuncSetAttribute due to different signatures {"cuFuncSetAttribute", {"hipFuncSetAttribute", "", CONV_EXECUTION, API_DRIVER, HIP_UNSUPPORTED}}, diff --git a/hipamd/hipify-clang/src/CUDA2HIP_Driver_API_types.cpp b/hipamd/hipify-clang/src/CUDA2HIP_Driver_API_types.cpp index 717e86315d..53dd4c0d80 100644 --- a/hipamd/hipify-clang/src/CUDA2HIP_Driver_API_types.cpp +++ b/hipamd/hipify-clang/src/CUDA2HIP_Driver_API_types.cpp @@ -754,31 +754,31 @@ const std::map CUDA_DRIVER_TYPE_NAME_MAP{ {"CU_FUNC_CACHE_PREFER_EQUAL", {"hipFuncCachePreferEqual", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 0x03 // cudaFuncAttribute - {"CUfunction_attribute", {"hipFuncAttribute", "", CONV_TYPE, API_DRIVER, HIP_UNSUPPORTED}}, - {"CUfunction_attribute_enum", {"hipFuncAttribute", "", CONV_TYPE, API_DRIVER, HIP_UNSUPPORTED}}, + {"CUfunction_attribute", {"hipFunction_attribute", "", CONV_TYPE, API_DRIVER}}, + {"CUfunction_attribute_enum", {"hipFunction_attribute", "", CONV_TYPE, API_DRIVER}}, // CUfunction_attribute enum values // no analogue - {"CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK", {"hipFuncAttributeMaxThreadsPerBlocks", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 0 + {"CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK", {"HIP_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 0 // no analogue - {"CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES", {"hipFuncAttributeSharedSizeBytes", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 1 + {"CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES", {"HIP_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 1 // no analogue - {"CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES", {"hipFuncAttributeConstSizeBytes", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 2 + {"CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES", {"HIP_FUNC_ATTRIBUTE_CONST_SIZE_BYTES", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 2 // no analogue - {"CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES", {"hipFuncAttributeLocalSizeBytes", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 3 + {"CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES", {"HIP_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 3 // no analogue - {"CU_FUNC_ATTRIBUTE_NUM_REGS", {"hipFuncAttributeNumRegs", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 4 + {"CU_FUNC_ATTRIBUTE_NUM_REGS", {"HIP_FUNC_ATTRIBUTE_NUM_REGS", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 4 // no analogue - {"CU_FUNC_ATTRIBUTE_PTX_VERSION", {"hipFuncAttributePtxVersion", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 5 + {"CU_FUNC_ATTRIBUTE_PTX_VERSION", {"HIP_FUNC_ATTRIBUTE_PTX_VERSION", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 5 // no analogue - {"CU_FUNC_ATTRIBUTE_BINARY_VERSION", {"hipFuncAttributeBinaryVersion", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 6 + {"CU_FUNC_ATTRIBUTE_BINARY_VERSION", {"HIP_FUNC_ATTRIBUTE_BINARY_VERSION", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 6 // no analogue - {"CU_FUNC_ATTRIBUTE_CACHE_MODE_CA", {"hipFuncAttributeCacheModeCA", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 7 + {"CU_FUNC_ATTRIBUTE_CACHE_MODE_CA", {"HIP_FUNC_ATTRIBUTE_CACHE_MODE_CA", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 7 // cudaFuncAttributeMaxDynamicSharedMemorySize - {"CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES", {"hipFuncAttributeMaxDynamicSharedMemorySize", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 8 + {"CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES", {"HIP_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 8 // cudaFuncAttributePreferredSharedMemoryCarveout - {"CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT", {"hipFuncAttributePreferredSharedMemoryCarveout", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 9 + {"CU_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT", {"HIP_FUNC_ATTRIBUTE_PREFERRED_SHARED_MEMORY_CARVEOUT", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 9 // cudaFuncAttributeMax - {"CU_FUNC_ATTRIBUTE_MAX", {"hipFuncAttributeMax", "", CONV_NUMERIC_LITERAL, API_DRIVER, HIP_UNSUPPORTED}}, // 10 + {"CU_FUNC_ATTRIBUTE_MAX", {"HIP_FUNC_ATTRIBUTE_MAX", "", CONV_NUMERIC_LITERAL, API_DRIVER}}, // 10 //cudaGraphicsMapFlags {"CUgraphicsMapResourceFlags", {"hipGraphicsMapFlags", "", CONV_TYPE, API_DRIVER, HIP_UNSUPPORTED}},