Skip to content

Commit 572e43c

Browse files
TedThemistokleousstsokolojeffdaily
authored
[MIGraphX EP/ ROCm EP] add gfx1200, gfx1201 to CMAKE_HIP_ARCHITECTURES (#22348)
### Description Add additonal gfx targets for AMD GPU support ### Motivation and Context Required to integrate mainline onnxruntime support for AMD GPUs --------- Co-authored-by: Stefan Sokolovic <[email protected]> Co-authored-by: Jeff Daily <[email protected]>
1 parent d736765 commit 572e43c

File tree

5 files changed

+2293
-3
lines changed

5 files changed

+2293
-3
lines changed

cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ if (onnxruntime_USE_ROCM)
294294
endif()
295295

296296
if (NOT CMAKE_HIP_ARCHITECTURES)
297-
set(CMAKE_HIP_ARCHITECTURES "gfx906;gfx908;gfx90a;gfx1030;gfx1100;gfx1101")
297+
set(CMAKE_HIP_ARCHITECTURES "gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx940;gfx941;gfx942;gfx1200;gfx1201")
298298
endif()
299299

300300
file(GLOB rocm_cmake_components ${onnxruntime_ROCM_HOME}/lib/cmake/*)

cmake/external/composable_kernel.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
set(PATCH ${PROJECT_SOURCE_DIR}/patches/composable_kernel/Fix_Clang_Build.patch)
1+
set(PATCH_CLANG ${PROJECT_SOURCE_DIR}/patches/composable_kernel/Fix_Clang_Build.patch)
2+
set(PATCH_GFX12X ${PROJECT_SOURCE_DIR}/patches/composable_kernel/Add_gfx12x_support.patch)
23

34
include(FetchContent)
45
FetchContent_Declare(composable_kernel
56
URL ${DEP_URL_composable_kernel}
67
URL_HASH SHA1=${DEP_SHA1_composable_kernel}
7-
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PATCH}
8+
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PATCH_CLANG} &&
9+
${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PATCH_GFX12X}
810
)
911

1012
FetchContent_GetProperties(composable_kernel)

cmake/hip_fatbin_insert

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SECTIONS {
2+
.hipFatBinSegment : { *(.hipFatBinSegment) }
3+
} INSERT AFTER .bss
4+
5+
SECTIONS {
6+
.hip_fatbin : { *(.hip_fatbin) }
7+
} INSERT AFTER .hipFatBinSegment

cmake/onnxruntime_providers_rocm.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
auto_set_source_files_hip_language(${onnxruntime_providers_rocm_src})
117117
onnxruntime_add_shared_library_module(onnxruntime_providers_rocm ${onnxruntime_providers_rocm_src})
118118
target_compile_options(onnxruntime_providers_rocm PRIVATE -D__HIP_PLATFORM_AMD__=1 -D__HIP_PLATFORM_HCC__=1)
119+
target_link_options(onnxruntime_providers_rocm PRIVATE -T ${REPO_ROOT}/cmake/hip_fatbin_insert)
119120

120121
if(NOT MSVC)
121122
target_compile_options(onnxruntime_providers_rocm PRIVATE -Wno-sign-compare)

0 commit comments

Comments
 (0)