@@ -131,7 +131,6 @@ option(onnxruntime_ENABLE_INSTRUMENT "Enable Instrument with Event Tracing for W
131
131
option (onnxruntime_USE_TELEMETRY "Build with Telemetry" OFF )
132
132
cmake_dependent_option (onnxruntime_USE_MIMALLOC "Override new/delete and arena allocator with mimalloc" OFF "WIN32;NOT onnxruntime_USE_CUDA;NOT onnxruntime_USE_OPENVINO" OFF )
133
133
option (onnxruntime_USE_CANN "Build with CANN support" OFF )
134
- option (onnxruntime_USE_ROCM "Build with AMD GPU support" OFF )
135
134
option (onnxruntime_USE_XNNPACK "Build with XNNPACK support. Provides an alternative math library on ARM, WebAssembly and x86." OFF )
136
135
option (onnxruntime_USE_WEBNN "Build with WebNN support. Enable hardware acceleration in web browsers." OFF )
137
136
option (onnxruntime_USE_WEBGPU "Build with WebGPU support. Enable WebGPU via C/C++ interface." OFF )
@@ -193,7 +192,6 @@ option(onnxruntime_WEBASSEMBLY_RUN_TESTS_IN_BROWSER "Enable this option to run t
193
192
option (onnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO "Enable this option to turn on DWARF format debug info" OFF )
194
193
option (onnxruntime_ENABLE_WEBASSEMBLY_PROFILING "Enable this option to turn on WebAssembly profiling and preserve function names" OFF )
195
194
option (onnxruntime_ENABLE_WEBASSEMBLY_OUTPUT_OPTIMIZED_MODEL "Enable this option to allow WebAssembly to output optimized model" OFF )
196
- option (onnxruntime_ENABLE_WEBASSEMBLY_MEMORY64 "Enable this option to allow WebAssembly to use 64bit memory" OFF )
197
195
option (onnxruntime_ENABLE_WEBASSEMBLY_RELAXED_SIMD "Enable WebAssembly Relaxed SIMD" OFF )
198
196
199
197
# Enable bitcode for iOS
@@ -223,7 +221,6 @@ option(onnxruntime_PREBUILT_PYTORCH_PATH "Path to pytorch installation dir")
223
221
option (onnxruntime_EXTERNAL_TRANSFORMER_SRC_PATH "Path to external transformer src dir" )
224
222
225
223
option (onnxruntime_ENABLE_CUDA_PROFILING "Enable CUDA kernel profiling" OFF )
226
- option (onnxruntime_ENABLE_ROCM_PROFILING "Enable ROCM kernel profiling" OFF )
227
224
228
225
option (onnxruntime_ENABLE_CPUINFO "Enable cpuinfo" ON )
229
226
@@ -232,21 +229,6 @@ option(onnxruntime_ENABLE_ATEN "Enable ATen fallback" OFF)
232
229
233
230
# dlpack support
234
231
cmake_dependent_option (onnxruntime_ENABLE_DLPACK "Enable dlpack" ON "onnxruntime_ENABLE_TRAINING OR onnxruntime_ENABLE_ATEN OR onnxruntime_ENABLE_PYTHON" OFF )
235
-
236
- # Triton support
237
- option (onnxruntime_ENABLE_TRITON "Enable Triton" OFF )
238
-
239
- # composable kernel is managed automatically, unless user want to explicitly disable it, it should not be manually set
240
- option (onnxruntime_USE_COMPOSABLE_KERNEL "Enable composable kernel for ROCm EP" ON )
241
- cmake_dependent_option (onnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE "Enable ck_tile for composable kernel" ON "onnxruntime_USE_COMPOSABLE_KERNEL" OFF )
242
- option (onnxruntime_USE_ROCBLAS_EXTENSION_API "Enable rocblas tuning for ROCm EP" OFF )
243
- option (onnxruntime_USE_TRITON_KERNEL "Enable triton compiled kernel" OFF )
244
- option (onnxruntime_BUILD_KERNEL_EXPLORER "Build Kernel Explorer for testing and profiling GPU kernels" OFF )
245
-
246
- option (onnxruntime_BUILD_CACHE "onnxruntime build with cache" OFF )
247
- # https://zeux.io/2010/11/22/z7-everything-old-is-new-again/
248
- cmake_dependent_option (MSVC_Z7_OVERRIDE "replacing /Zi and /ZI with /Z7 when using MSVC with CCache" ON "onnxruntime_BUILD_CACHE; MSVC" OFF )
249
-
250
232
option (onnxruntime_USE_AZURE "Build with azure inferencing support" OFF )
251
233
option (onnxruntime_USE_LOCK_FREE_QUEUE "Build with lock-free task queue for threadpool." OFF )
252
234
option (onnxruntime_FORCE_GENERIC_ALGORITHMS "Disable optimized arch-specific algorithms. Use only for testing and debugging generic algorithms." OFF )
@@ -292,176 +274,6 @@ if (onnxruntime_ENABLE_TRAINING_APIS)
292
274
endif ()
293
275
endif ()
294
276
295
- if (onnxruntime_USE_ROCM )
296
- if (WIN32 )
297
- message (FATAL_ERROR "ROCM does not support build in Windows!" )
298
- endif ()
299
- if (onnxruntime_USE_CUDA )
300
- message (FATAL_ERROR "ROCM does not support build with CUDA!" )
301
- endif ()
302
-
303
- # replicate strategy used by pytorch to get ROCM_VERSION
304
- # https://github.com/pytorch/pytorch/blob/5c5b71b6eebae76d744261715231093e62f0d090/cmake/public/LoadHIP.cmake
305
- # with modification
306
- if (EXISTS "${onnxruntime_ROCM_HOME} /.info/version" )
307
- message ("\n ***** ROCm version from ${onnxruntime_ROCM_HOME} /.info/version ****\n " )
308
- file (READ "${onnxruntime_ROCM_HOME} /.info/version" ROCM_VERSION_DEV_RAW )
309
- string (REGEX MATCH "^([0-9]+)\. ([0-9]+)\. ([0-9]+)-.*$" ROCM_VERSION_MATCH ${ROCM_VERSION_DEV_RAW} )
310
- elseif (EXISTS "${onnxruntime_ROCM_HOME} /include/rocm_version.h" )
311
- message ("\n ***** ROCm version from ${onnxruntime_ROCM_HOME} /include/rocm_version.h ****\n " )
312
- file (READ "${onnxruntime_ROCM_HOME} /include/rocm_version.h" ROCM_VERSION_H_RAW )
313
- string (REGEX MATCH "\" ([0-9]+)\. ([0-9]+)\. ([0-9]+).*\" " ROCM_VERSION_MATCH ${ROCM_VERSION_H_RAW} )
314
- elseif (EXISTS "${onnxruntime_ROCM_HOME} /include/rocm-core/rocm_version.h" )
315
- message ("\n ***** ROCm version from ${onnxruntime_ROCM_HOME} /include/rocm-core/rocm_version.h ****\n " )
316
- file (READ "${onnxruntime_ROCM_HOME} /include/rocm-core/rocm_version.h" ROCM_VERSION_H_RAW )
317
- string (REGEX MATCH "\" ([0-9]+)\. ([0-9]+)\. ([0-9]+).*\" " ROCM_VERSION_MATCH ${ROCM_VERSION_H_RAW} )
318
- endif ()
319
-
320
- if (ROCM_VERSION_MATCH )
321
- set (ROCM_VERSION_DEV_MAJOR ${CMAKE_MATCH_1} )
322
- set (ROCM_VERSION_DEV_MINOR ${CMAKE_MATCH_2} )
323
- set (ROCM_VERSION_DEV_PATCH ${CMAKE_MATCH_3} )
324
- set (ROCM_VERSION_DEV "${ROCM_VERSION_DEV_MAJOR} .${ROCM_VERSION_DEV_MINOR} .${ROCM_VERSION_DEV_PATCH} " )
325
- math (EXPR ROCM_VERSION_DEV_INT "(${ROCM_VERSION_DEV_MAJOR} *10000) + (${ROCM_VERSION_DEV_MINOR} *100) + ${ROCM_VERSION_DEV_PATCH} " )
326
-
327
- message ("ROCM_VERSION_DEV: ${ROCM_VERSION_DEV} " )
328
- message ("ROCM_VERSION_DEV_MAJOR: ${ROCM_VERSION_DEV_MAJOR} " )
329
- message ("ROCM_VERSION_DEV_MINOR: ${ROCM_VERSION_DEV_MINOR} " )
330
- message ("ROCM_VERSION_DEV_PATCH: ${ROCM_VERSION_DEV_PATCH} " )
331
- message ("ROCM_VERSION_DEV_INT: ${ROCM_VERSION_DEV_INT} " )
332
- else ()
333
- message (FATAL_ERROR "Cannot determine ROCm version string" )
334
- endif ()
335
-
336
-
337
- if (NOT CMAKE_HIP_COMPILER )
338
- set (CMAKE_HIP_COMPILER "${onnxruntime_ROCM_HOME} /llvm/bin/clang++" )
339
- endif ()
340
-
341
- if (NOT CMAKE_HIP_ARCHITECTURES )
342
- if (ROCM_VERSION_DEV VERSION_LESS "6.2" )
343
- message (FATAL_ERROR "CMAKE_HIP_ARCHITECTURES is not set when ROCm version < 6.2" )
344
- else ()
345
- set (CMAKE_HIP_ARCHITECTURES "gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx940;gfx941;gfx942;gfx1200;gfx1201" )
346
- endif ()
347
- endif ()
348
-
349
- file (GLOB rocm_cmake_components ${onnxruntime_ROCM_HOME} /lib/cmake/* )
350
- list (APPEND CMAKE_PREFIX_PATH ${rocm_cmake_components} )
351
- # Force cmake to accept the configured HIP compiler. Because the configured CMAKE_PREFIX_PATH does not work during
352
- # enable_language(HIP), we might need to move configuring of CMAKE_PREFIX_PATH to build.py (in the future).
353
- set (CMAKE_HIP_COMPILER_FORCED ON )
354
-
355
- enable_language (HIP )
356
- # NOTE: Flags -mllvm -amdgpu-early-inline-all=true are critical for gpu kernel code performance. -mllvm passes the
357
- # next flag to underlying LLVM instead of clang and -amdgpu-early-inline-all=true is the optimization flag for LLVM.
358
- # With CMake's enable_language(HIP), additional flags including the proceeding one are propagated from
359
- # hip-lang::device library. But in some weird cases, the hip-lang::device target may not be properly configured, for
360
- # example, the CMAKE_PREFIX_PATH might be improperly configured.
361
- if (NOT DEFINED _CMAKE_HIP_DEVICE_RUNTIME_TARGET )
362
- message (FATAL_ERROR "HIP Language is not properly configured." )
363
- endif ()
364
- add_compile_options ("$<$<COMPILE_LANGUAGE:HIP>:SHELL:-x hip>" )
365
-
366
- if (NOT onnxruntime_HIPIFY_PERL )
367
- find_path (HIPIFY_PERL_PATH
368
- NAMES hipify-perl
369
- HINTS
370
- ${onnxruntime_ROCM_HOME} /bin
371
- ${onnxruntime_ROCM_HOME} /hip/bin )
372
- if (HIPIFY_PERL_PATH-NOTFOUND )
373
- MESSAGE (FATAL_ERROR "hipify-perl not found" )
374
- endif ()
375
- MESSAGE ("HIPIFY PATH: ${HIPIFY_PERL_PATH} /hipify-perl" )
376
- set (onnxruntime_HIPIFY_PERL ${HIPIFY_PERL_PATH} /hipify-perl )
377
- endif ()
378
-
379
- # replicate strategy used by pytorch to get ROCM_VERSION
380
- # https://github.com/pytorch/pytorch/blob/1a10751731784942dcbb9c0524c1369a29d45244/cmake/public/LoadHIP.cmake#L45-L109
381
- # with modification
382
- set (ROCM_INCLUDE_DIRS "${onnxruntime_ROCM_HOME} /include" )
383
- set (PROJECT_RANDOM_BINARY_DIR "${CMAKE_BINARY_DIR} " )
384
- set (file "${CMAKE_BINARY_DIR} /detect_rocm_version.cc" )
385
-
386
- # Find ROCM version for checks
387
- # ROCM 5.0 and later will have header api for version management
388
- if (EXISTS ${ROCM_INCLUDE_DIRS} /rocm_version.h )
389
- file (WRITE ${file} ""
390
- "#include <rocm_version.h>\n "
391
- )
392
- elseif (EXISTS ${ROCM_INCLUDE_DIRS} /rocm-core/rocm_version.h )
393
- file (WRITE ${file} ""
394
- "#include <rocm-core/rocm_version.h>\n "
395
- )
396
- else ()
397
- message (FATAL_ERROR "********************* rocm_version.h couldnt be found ******************\n " )
398
- endif ()
399
-
400
- file (APPEND ${file} ""
401
- "#include <cstdio>\n "
402
-
403
- "#ifndef ROCM_VERSION_PATCH\n "
404
- "#define ROCM_VERSION_PATCH 0\n "
405
- "#endif\n "
406
- "#define STRINGIFYHELPER(x) #x\n "
407
- "#define STRINGIFY(x) STRINGIFYHELPER(x)\n "
408
- "int main() {\n "
409
- " printf(\" %d.%d.%s\" , ROCM_VERSION_MAJOR, ROCM_VERSION_MINOR, STRINGIFY(ROCM_VERSION_PATCH));\n "
410
- " return 0;\n "
411
- "}\n "
412
- )
413
-
414
- try_run (run_result compile_result ${PROJECT_RANDOM_BINARY_DIR} ${file}
415
- CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${ROCM_INCLUDE_DIRS} "
416
- RUN_OUTPUT_VARIABLE rocm_version_from_header
417
- COMPILE_OUTPUT_VARIABLE output_var
418
- )
419
- # We expect the compile to be successful if the include directory exists.
420
- if (NOT compile_result )
421
- message (FATAL_ERROR "ROCM: Couldn't determine version from header: " ${output_var} )
422
- endif ()
423
- message (STATUS "ROCM: Header version is: " ${rocm_version_from_header} )
424
- set (ROCM_VERSION_DEV_RAW ${rocm_version_from_header} )
425
-
426
- string (REGEX MATCH "^([0-9]+)\. ([0-9]+)\. ([0-9]+).*$" ROCM_VERSION_DEV_MATCH ${ROCM_VERSION_DEV_RAW} )
427
-
428
- if (ROCM_VERSION_DEV_MATCH )
429
- set (ROCM_VERSION_DEV_MAJOR ${CMAKE_MATCH_1} )
430
- set (ROCM_VERSION_DEV_MINOR ${CMAKE_MATCH_2} )
431
- set (ROCM_VERSION_DEV_PATCH ${CMAKE_MATCH_3} )
432
- set (ROCM_VERSION_DEV "${ROCM_VERSION_DEV_MAJOR} .${ROCM_VERSION_DEV_MINOR} .${ROCM_VERSION_DEV_PATCH} " )
433
- math (EXPR ROCM_VERSION_DEV_INT "(${ROCM_VERSION_DEV_MAJOR} *10000) + (${ROCM_VERSION_DEV_MINOR} *100) + ${ROCM_VERSION_DEV_PATCH} " )
434
- else ()
435
- message (FATAL_ERROR "Cannot determine ROCm version string" )
436
- endif ()
437
- message ("\n ***** ROCm version from rocm_version.h ****\n " )
438
- message ("ROCM_VERSION_DEV: ${ROCM_VERSION_DEV} " )
439
- message ("ROCM_VERSION_DEV_MAJOR: ${ROCM_VERSION_DEV_MAJOR} " )
440
- message ("ROCM_VERSION_DEV_MINOR: ${ROCM_VERSION_DEV_MINOR} " )
441
- message ("ROCM_VERSION_DEV_PATCH: ${ROCM_VERSION_DEV_PATCH} " )
442
- message ("ROCM_VERSION_DEV_INT: ${ROCM_VERSION_DEV_INT} " )
443
- message ("\n ***** HIP LANGUAGE CONFIG INFO ****\n " )
444
- message ("CMAKE_HIP_COMPILER: ${CMAKE_HIP_COMPILER} " )
445
- message ("CMAKE_HIP_ARCHITECTURES: ${CMAKE_HIP_ARCHITECTURES} " )
446
- message ("CMAKE_HIP_FLAGS: ${CMAKE_HIP_FLAGS} " )
447
- string (TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE )
448
- message ("CMAKE_HIP_FLAGS_${BUILD_TYPE} : ${CMAKE_HIP_FLAGS_${BUILD_TYPE} }" )
449
- add_definitions (-DROCM_VERSION=${ROCM_VERSION_DEV_INT} )
450
-
451
- if (onnxruntime_USE_COMPOSABLE_KERNEL AND ROCM_VERSION_DEV VERSION_LESS "5.3" )
452
- message (WARNING "composable kernel is only supported on ROCm >= 5.3" )
453
- set (onnxruntime_USE_COMPOSABLE_KERNEL OFF )
454
- set (onnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE OFF )
455
- endif ()
456
- if (onnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE AND ROCM_VERSION_DEV VERSION_LESS "6.0" )
457
- message (WARNING "ck_tile can only be enabled on ROCm >= 6.0 due to compatibility and compilation speed, disable automatically" )
458
- set (onnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE OFF )
459
- endif ()
460
- if (onnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE AND CMAKE_BUILD_TYPE STREQUAL "Debug" )
461
- message (WARNING "ck_tile hits compiler error in Debug build, disable automatically" )
462
- set (onnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE OFF )
463
- endif ()
464
- endif ()
465
277
466
278
467
279
@@ -1048,10 +860,6 @@ if (onnxruntime_USE_ARMNN)
1048
860
list (APPEND ORT_PROVIDER_FLAGS -DUSE_ARMNN=1 )
1049
861
list (APPEND ONNXRUNTIME_PROVIDER_NAMES armnn )
1050
862
endif ()
1051
- if (onnxruntime_USE_ROCM )
1052
- list (APPEND ORT_PROVIDER_FLAGS -DUSE_ROCM=1 )
1053
- list (APPEND ONNXRUNTIME_PROVIDER_NAMES rocm )
1054
- endif ()
1055
863
if (onnxruntime_USE_COREML )
1056
864
list (APPEND ORT_PROVIDER_FLAGS -DUSE_COREML=1 )
1057
865
list (APPEND ONNXRUNTIME_PROVIDER_NAMES coreml )
@@ -1292,32 +1100,6 @@ function(onnxruntime_set_compile_flags target_name)
1292
1100
target_compile_options (${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:-Wno-strict-aliasing>" )
1293
1101
endif ()
1294
1102
endif ()
1295
- if (onnxruntime_USE_ROCM )
1296
- # flags are detected with CXX language mode, some flags are not supported with hipclang
1297
- # because we may mix gcc and hipclang
1298
- set (ORT_HIP_WARNING_FLAGS ${ORT_WARNING_FLAGS} )
1299
- list (REMOVE_ITEM ORT_HIP_WARNING_FLAGS -Wno-nonnull-compare )
1300
- # Unsupported by Clang 18 yet.
1301
- list (REMOVE_ITEM ORT_HIP_WARNING_FLAGS -Wno-dangling-reference )
1302
-
1303
- list (REMOVE_ITEM ORT_HIP_WARNING_FLAGS -Wno-interference-size )
1304
- # float16.h:90:12: error: ‘tmp’ is used uninitialized
1305
- list (APPEND ORT_HIP_WARNING_FLAGS -Wno-uninitialized )
1306
- list (APPEND ORT_HIP_WARNING_FLAGS -Wno-deprecated-copy )
1307
-
1308
- # some #pragma unroll will fail, do not treat them as error
1309
- # #warning must not be treated as error
1310
- list (APPEND ORT_HIP_WARNING_FLAGS -Wno-error=pass-failed "-Wno-error=#warnings" )
1311
-
1312
- # otherwise error: builtin __has_trivial_assign is deprecated; use __is_trivially_assignable instead
1313
- if (ROCM_VERSION_DEV VERSION_GREATER_EQUAL "5.4" )
1314
- list (APPEND ORT_HIP_WARNING_FLAGS "-Wno-deprecated-builtins" )
1315
- endif ()
1316
-
1317
- foreach (FLAG ${ORT_HIP_WARNING_FLAGS} )
1318
- target_compile_options (${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:HIP>:SHELL:${FLAG} >" )
1319
- endforeach ()
1320
- endif ()
1321
1103
endfunction ()
1322
1104
1323
1105
function (onnxruntime_set_source_file_properties target_name )
@@ -1346,14 +1128,6 @@ function(onnxruntime_configure_target target_name)
1346
1128
set_target_properties (${target_name} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL TRUE )
1347
1129
endif ()
1348
1130
1349
- if (onnxruntime_BUILD_KERNEL_EXPLORER )
1350
- get_target_property (target_type ${target_name} TYPE )
1351
- if (target_type STREQUAL "MODULE_LIBRARY" OR target_type STREQUAL "SHARED_LIBRARY" )
1352
- set_property (TARGET ${target_name}
1353
- APPEND_STRING PROPERTY LINK_FLAGS " -Xlinker --version-script=${ONNXRUNTIME_ROOT} /python/tools/kernel_explorer/version_script.lds " )
1354
- endif ()
1355
- endif ()
1356
-
1357
1131
# Keep BinSkim happy
1358
1132
if (MSVC AND NOT onnxruntime_target_platform MATCHES "ARM" )
1359
1133
target_link_options (${target_name} PRIVATE "/CETCOMPAT" )
@@ -1652,10 +1426,6 @@ if (onnxruntime_ENABLE_CUDA_PROFILING)
1652
1426
add_compile_definitions (ENABLE_CUDA_PROFILING )
1653
1427
endif ()
1654
1428
1655
- if (onnxruntime_ENABLE_ROCM_PROFILING )
1656
- add_compile_definitions (ENABLE_ROCM_PROFILING )
1657
- endif ()
1658
-
1659
1429
if (onnxruntime_ENABLE_TRAINING )
1660
1430
add_compile_definitions (ENABLE_TRAINING_CORE )
1661
1431
add_compile_definitions (ENABLE_STRIDED_TENSORS )
@@ -1678,7 +1448,7 @@ if (UNIX OR onnxruntime_USE_NCCL)
1678
1448
if (onnxruntime_USE_NCCL )
1679
1449
if (onnxruntime_USE_CUDA )
1680
1450
set (NCCL_LIBNAME "nccl" )
1681
- elseif (onnxruntime_USE_ROCM OR onnxruntime_USE_MIGRAPHX )
1451
+ elseif (onnxruntime_USE_MIGRAPHX )
1682
1452
set (NCCL_LIBNAME "rccl" )
1683
1453
endif ()
1684
1454
find_path (NCCL_INCLUDE_DIR
@@ -1871,11 +1641,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
1871
1641
endif ()
1872
1642
endif ()
1873
1643
1874
- if (onnxruntime_BUILD_KERNEL_EXPLORER )
1875
- message (STATUS "Kernel Explorer Build is enabled" )
1876
- list (APPEND ONNXRUNTIME_CMAKE_FILES onnxruntime_kernel_explorer )
1877
- endif ()
1878
-
1879
1644
# When GDK_PLATFORM is set then WINAPI_FAMILY is defined in gdk_toolchain.cmake (along with other relevant flags/definitions).
1880
1645
if (WIN32 AND NOT GDK_PLATFORM AND NOT CMAKE_CROSSCOMPILING )
1881
1646
if (NOT CMAKE_CXX_STANDARD_LIBRARIES MATCHES kernel32.lib )
0 commit comments