"git@developer.sourcefind.cn:yangql/composable_kernel.git" did not exist on "567f5e9c5f0aa6481570fba9267224626014542f"
Commit 0f4a3215 authored by Lei Wang's avatar Lei Wang Committed by LeiWang1999
Browse files

[Bugfix] Correct dynamic shared memory size error handling in HIP wrapper (#362)

- Updated the error handling logic in `PREDEF_ATTRIBUTE_SET_DYNAMIC_MEMORY_HIP` to check if the dynamic shared memory size exceeds the maximum limit of 65536.
- Improved error message clarity by specifying the function name and the attempted size, ensuring better debugging information.
- Ensured the function returns 0 upon successful setting of the dynamic shared memory size.
parent 55614f18
...@@ -17,11 +17,11 @@ PREDEF_ATTRIBUTE_SET_DYNAMIC_MEMORY = """ ...@@ -17,11 +17,11 @@ PREDEF_ATTRIBUTE_SET_DYNAMIC_MEMORY = """
""" """
PREDEF_ATTRIBUTE_SET_DYNAMIC_MEMORY_HIP = """ PREDEF_ATTRIBUTE_SET_DYNAMIC_MEMORY_HIP = """
hipError_t result_{0} = hipFuncSetAttribute((const void *){0}, hipFuncAttributeMaxDynamicSharedMemorySize, {1}); if ({1} > 65536) {{
if (result_{0} != HIP_SUCCESS) {{ snprintf(error_buf, ERROR_BUF_SIZE, "Failed to set the allowed dynamic shared memory size for {0} to %d", {1});
snprintf(error_buf, ERROR_BUF_SIZE, "Failed to set the allowed dynamic shared memory size to %d with error: %s", {1}, hipGetErrorString(result_{0}));
return -1; return -1;
}} }}
return 0;
""" """
PREDEF_INIT_FUNC = """ PREDEF_INIT_FUNC = """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment