From d1627ecf92f59c5ee09e7e0f0acb6db3102a81ae Mon Sep 17 00:00:00 2001 From: Igor Mirosavljevic <104914075+IgorMirosavljevicHTEC@users.noreply.github.com> Date: Thu, 23 May 2024 15:45:44 +0200 Subject: [PATCH 1/4] Ci improvements (#3114) --- .github/workflows/config.md | 29 ++++++++ .github/workflows/performance.yaml | 57 +++++++++++--- .github/workflows/sync_rocMLIR.yaml | 90 +++++++++++++++++++++++ .github/workflows/weekly_master_sync.yaml | 25 +++++++ 4 files changed, 190 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/config.md create mode 100644 .github/workflows/sync_rocMLIR.yaml create mode 100644 .github/workflows/weekly_master_sync.yaml diff --git a/.github/workflows/config.md b/.github/workflows/config.md new file mode 100644 index 00000000000..326c99ca483 --- /dev/null +++ b/.github/workflows/config.md @@ -0,0 +1,29 @@ +#=====ROCM INFO===== +ROCM_VERSION : '6.0.2' +#default ROCm version to be used +ROCM_BASE_IMAGE : 'rocm/dev-ubuntu-20.04' +#base image from dockerhub to be used +ROCM_BUILT_IMAGE : 'rocm-migraphx' +#name of the docker image built upon ROCm base +USE_NAVI : '0' +#disable NAVI in image build +OVERWRITE_EXISTING : 'true' +#building new ROCm image overwrites old with same version + +#=====REPOS INFO===== +ORGANIZATION_REPO : 'AMD' +BENCHMARK_UTILS_REPO : 'ROCm/migraphx-benchmark-utils' +PERFORMANCE_REPORTS_REPO : 'ROCm/migraphx-reports' +PERFORMANCE_BACKUP_REPO : 'migraphx-benchmark/performance-backup' + +#=====PERFORMANCE SCRIPT PARAMETERS===== +RESULTS_TO_COMPARE : '10' +#number of previous performance results to be used in calculations +CALCULATION_METHOD_FLAG : '-r' +#calculation method used in reporting, -m for Max value; -s for Std dev; -r for Threshold file +PERFORMANCE_TEST_TIMEOUT : '30m' +#timeout for each model after which test is aborted + +#===== W A R N I N G ===== +#VARIABLE NAMES NOT TO BE CHANGED, VALUES ONLY! +#VALUES MUST BE ENGLOSED IN SINGLE QUOTES! \ No newline at end of file diff --git a/.github/workflows/performance.yaml b/.github/workflows/performance.yaml index 42e92e6dc2b..98e79ac3efe 100644 --- a/.github/workflows/performance.yaml +++ b/.github/workflows/performance.yaml @@ -5,7 +5,7 @@ on: branches: [develop] types: [opened, synchronize, closed] schedule: - - cron: "0 6 * * 1-6" + - cron: "0 7 * * 1-6" workflow_dispatch: inputs: @@ -47,18 +47,53 @@ concurrency: cancel-in-progress: true jobs: - release: + get_config: + runs-on: ubuntu-latest + outputs: + rocm_version: ${{ steps.read_config.outputs.rocm_version }} + utils_repo: ${{ steps.read_config.outputs.utils_repo }} + reports_repo: ${{ steps.read_config.outputs.reports_repo }} + backup_repo: ${{ steps.read_config.outputs.backup_repo }} + repo_org: ${{ steps.read_config.outputs.repo_org }} + perf_number: ${{ steps.read_config.outputs.perf_number }} + perf_flag: ${{ steps.read_config.outputs.perf_flag }} + perf_timeout: ${{ steps.read_config.outputs.perf_timeout }} + steps: + - name: checkout + uses: actions/checkout@v4.1.1 + - name: read_config + id: read_config + run: | + ROCM_VERSION=$(grep 'ROCM_VERSION' .github/workflows/config.md | cut -d "'" -f2) + BENCHMARK_UTILS_REPO=$(grep 'BENCHMARK_UTILS_REPO' .github/workflows/config.md | cut -d "'" -f2) + PERFORMANCE_REPORTS_REPO=$(grep 'PERFORMANCE_REPORTS_REPO' .github/workflows/config.md | cut -d "'" -f2) + PERFORMANCE_BACKUP_REPO=$(grep 'PERFORMANCE_BACKUP_REPO' .github/workflows/config.md | cut -d "'" -f2) + ORGANIZATION_REPO=$(grep 'ORGANIZATION_REPO' .github/workflows/config.md | cut -d "'" -f2) + RESULTS_TO_COMPARE=$(grep 'RESULTS_TO_COMPARE' .github/workflows/config.md | cut -d "'" -f2) + CALCULATION_METHOD_FLAG=$(grep 'CALCULATION_METHOD_FLAG' .github/workflows/config.md | cut -d "'" -f2) + PERFORMANCE_TEST_TIMEOUT=$(grep 'PERFORMANCE_TEST_TIMEOUT' .github/workflows/config.md | cut -d "'" -f2) + echo "rocm_version=$ROCM_VERSION" >> $GITHUB_OUTPUT + echo "utils_repo=$BENCHMARK_UTILS_REPO" >> $GITHUB_OUTPUT + echo "reports_repo=$PERFORMANCE_REPORTS_REPO" >> $GITHUB_OUTPUT + echo "backup_repo=$PERFORMANCE_BACKUP_REPO" >> $GITHUB_OUTPUT + echo "repo_org=$ORGANIZATION_REPO" >> $GITHUB_OUTPUT + echo "perf_number=$RESULTS_TO_COMPARE" >> $GITHUB_OUTPUT + echo "perf_flag=$CALCULATION_METHOD_FLAG" >> $GITHUB_OUTPUT + echo "perf_timeout=$PERFORMANCE_TEST_TIMEOUT" >> $GITHUB_OUTPUT + + call_reusable: + needs: get_config uses: ROCm/migraphx-benchmark/.github/workflows/perf-test.yml@main with: - rocm_release: ${{ github.event.inputs.rocm_release || '6.0.2' }} - result_number: ${{ github.event.inputs.result_number || '10' }} - flags: ${{ github.event.inputs.flags || '-r' }} - performance_reports_repo: ${{ github.event.inputs.performance_reports_repo || 'ROCm/migraphx-reports' }} - performance_backup_repo: ${{ github.event.inputs.performance_backup_repo || 'migraphx-benchmark/performance-backup' }} - benchmark_utils_repo: ${{ github.event.inputs.benchmark_utils_repo || 'ROCm/migraphx-benchmark-utils' }} - organization: ${{ github.event.inputs.organization || 'AMD' }} - model_timeout: ${{ github.event.inputs.model_timeout || '30m' }} + rocm_release: ${{ github.event.inputs.rocm_release || needs.get_config.outputs.rocm_version }} + benchmark_utils_repo: ${{ github.event.inputs.benchmark_utils_repo || needs.get_config.outputs.utils_repo }} + performance_reports_repo: ${{ github.event.inputs.performance_reports_repo || needs.get_config.outputs.reports_repo }} + performance_backup_repo: ${{ github.event.inputs.performance_backup_repo || needs.get_config.outputs.backup_repo }} + organization: ${{ github.event.inputs.organization || needs.get_config.outputs.repo_org }} + result_number: ${{ github.event.inputs.result_number || needs.get_config.outputs.perf_number }} + flags: ${{ github.event.inputs.flags || needs.get_config.outputs.perf_flag }} + model_timeout: ${{ github.event.inputs.model_timeout || needs.get_config.outputs.perf_timeout }} secrets: gh_token: ${{ secrets.MIGRAPHX_BOT_TOKEN }} mail_user: ${{ secrets.MAIL_USERNAME }} - mail_pass: ${{ secrets.MAIL_PASSWORD }} + mail_pass: ${{ secrets.MAIL_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/sync_rocMLIR.yaml b/.github/workflows/sync_rocMLIR.yaml new file mode 100644 index 00000000000..08001f4175a --- /dev/null +++ b/.github/workflows/sync_rocMLIR.yaml @@ -0,0 +1,90 @@ +name: rocMLIR sync with extended accuracy + +on: + schedule: + - cron: '0 7 * * sun' + pull_request: + branches: [develop] + types: [synchronize, closed] + workflow_dispatch: + inputs: + rocm_release: + type: string + description: ROCm release version + required: true + default: '6.0.2' + base_image: + type: string + description: Base image for ROCm Docker build + required: true + default: 'rocm/dev-ubuntu-20.04' + docker_image: + type: string + description: Docker image name for rocm Docker build + required: true + default: 'rocm-migraphx' + build_navi: + type: string + description: Build navi number + required: true + default: '0' + benchmark_utils_repo: + type: string + description: Repository where benchmark utils are stored + required: true + default: 'ROCm/migraphx-benchmark-utils' + performance_reports_repo: + description: Repository where performance reports are stored + required: true + default: 'ROCm/migraphx-reports' + organization: + type: string + description: Organization based on which location of files will be different + required: true + default: 'AMD' + +jobs: + get_config: + runs-on: ubuntu-latest + outputs: + rocm_version: ${{ steps.read_config.outputs.rocm_version }} + rocm_base_image: ${{ steps.read_config.outputs.rocm_base_image }} + rocm_built_image: ${{ steps.read_config.outputs.rocm_built_image }} + use_navi: ${{ steps.read_config.outputs.use_navi }} + utils_repo: ${{ steps.read_config.outputs.utils_repo }} + reports_repo: ${{ steps.read_config.outputs.reports_repo }} + repo_org: ${{ steps.read_config.outputs.repo_org }} + steps: + - name: checkout + uses: actions/checkout@v4.1.1 + - name: read_config + id: read_config + run: | + ROCM_VERSION=$(grep 'ROCM_VERSION' .github/workflows/config.md | cut -d "'" -f2) + ROCM_BASE_IMAGE=$(grep 'ROCM_BASE_IMAGE' .github/workflows/config.md | cut -d "'" -f2) + ROCM_BUILT_IMAGE=$(grep 'ROCM_BUILT_IMAGE' .github/workflows/config.md | cut -d "'" -f2) + BENCHMARK_UTILS_REPO=$(grep 'BENCHMARK_UTILS_REPO' .github/workflows/config.md | cut -d "'" -f2) + PERFORMANCE_REPORTS_REPO=$(grep 'PERFORMANCE_REPORTS_REPO' .github/workflows/config.md | cut -d "'" -f2) + ORGANIZATION_REPO=$(grep 'ORGANIZATION_REPO' .github/workflows/config.md | cut -d "'" -f2) + USE_NAVI=$(grep 'USE_NAVI' .github/workflows/config.ymd | cut -d "'" -f2) + echo "rocm_version=$ROCM_VERSION" >> $GITHUB_OUTPUT + echo "rocm_base_image=$ROCM_BASE_IMAGE" >> $GITHUB_OUTPUT + echo "rocm_built_image=$ROCM_BUILT_IMAGE" >> $GITHUB_OUTPUT + echo "use_navi=$USE_NAVI" >> $GITHUB_OUTPUT + echo "utils_repo=$BENCHMARK_UTILS_REPO" >> $GITHUB_OUTPUT + echo "reports_repo=$PERFORMANCE_REPORTS_REPO" >> $GITHUB_OUTPUT + echo "repo_org=$ORGANIZATION_REPO" >> $GITHUB_OUTPUT + + call_reusable: + needs: get_config + uses: ROCm/migraphx-benchmark/.github/workflows/rocMLIR_sync.yml@main + with: + rocm_release: ${{ github.event.inputs.rocm_release || needs.get_config.outputs.rocm_version }} + base_image: ${{ github.event.inputs.base_image || needs.get_config.outputs.rocm_base_image }} + docker_image: ${{ github.event.inputs.docker_image || needs.get_config.outputs.rocm_built_image }} + build_navi: ${{ github.event.inputs.build_navi || needs.get_config.outputs.use_navi }} + benchmark_utils_repo: ${{ github.event.inputs.benchmark_utils_repo || needs.get_config.outputs.utils_repo }} + performance_reports_repo: ${{ github.event.inputs.performance_reports_repo || needs.get_config.outputs.reports_repo }} + organization: ${{ github.event.inputs.organization || needs.get_config.outputs.repo_org }} + secrets: + gh_token: ${{ secrets.MIGRAPHX_BOT_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/weekly_master_sync.yaml b/.github/workflows/weekly_master_sync.yaml new file mode 100644 index 00000000000..9273e663c22 --- /dev/null +++ b/.github/workflows/weekly_master_sync.yaml @@ -0,0 +1,25 @@ +name: Master weekly sync + +on: + schedule: + - cron: '0 15 * * sun' + workflow_dispatch: + +jobs: + SyncAndMerge: + name: Sync master and merge develop + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v4.1.1 + with: + ref: develop + fetch-depth: '0' + + - name: Merge Fast Forward Only + uses: IgorMirosavljevicHTEC/github-action-merge-fast-forward@v1.0 + with: + branchtomerge: develop + branch: master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From bceef13f72d7e36a16973646cd6abfda6e8821ad Mon Sep 17 00:00:00 2001 From: Ahsan Saghir <142340507+ahsan-ca@users.noreply.github.com> Date: Thu, 23 May 2024 10:47:24 -0400 Subject: [PATCH 2/4] MIGraphx private lib changes (#3108) --- dev-requirements.txt | 2 +- src/CMakeLists.txt | 1 + src/targets/cpu/CMakeLists.txt | 1 + src/targets/fpga/CMakeLists.txt | 1 + src/targets/gpu/CMakeLists.txt | 1 + src/targets/ref/CMakeLists.txt | 1 + src/tf/CMakeLists.txt | 1 + 7 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index cf520e3cb59..c9fce73e910 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -26,5 +26,5 @@ facebook/zstd@v1.4.5 -X subdir -DCMAKE_DIR=build/cmake ccache@v4.1 -DENABLE_TESTING=OFF pcre,pfultz2/pcre@8.45 -H sha256:d6f7182602a775a7d500a0cedca6449af0400c6493951513046d17615ed0bf11 danmar/cppcheck@bb2711c22a0be09efe7f1a8da3030876471026c8 -DHAVE_RULES=1 # 2.11 -RadeonOpenCompute/rocm-cmake@5a34e72d9f113eb5d028e740c2def1f944619595 --build +RadeonOpenCompute/rocm-cmake@a83c5075d85f1fd28d657a9277eb21c834d76f3f --build -f requirements.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eedc7a27501..62197380cc4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -269,6 +269,7 @@ register_op(migraphx HEADER migraphx/builtin.hpp OPERATORS builtin::literal buil rocm_clang_tidy_check(migraphx) migraphx_generate_export_header(migraphx) rocm_install_targets( + PRIVATE TARGETS migraphx INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include diff --git a/src/targets/cpu/CMakeLists.txt b/src/targets/cpu/CMakeLists.txt index 4c08d60123c..e8a57422b01 100755 --- a/src/targets/cpu/CMakeLists.txt +++ b/src/targets/cpu/CMakeLists.txt @@ -97,6 +97,7 @@ else() endif() rocm_install_targets( + PRIVATE TARGETS migraphx_cpu INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include diff --git a/src/targets/fpga/CMakeLists.txt b/src/targets/fpga/CMakeLists.txt index 39df3be6400..304c92851c8 100644 --- a/src/targets/fpga/CMakeLists.txt +++ b/src/targets/fpga/CMakeLists.txt @@ -36,6 +36,7 @@ rocm_clang_tidy_check(migraphx_fpga) target_link_libraries(migraphx_fpga migraphx) rocm_install_targets( + PRIVATE TARGETS migraphx_fpga INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include diff --git a/src/targets/gpu/CMakeLists.txt b/src/targets/gpu/CMakeLists.txt index d2e73ef1de7..da733498f7d 100644 --- a/src/targets/gpu/CMakeLists.txt +++ b/src/targets/gpu/CMakeLists.txt @@ -332,6 +332,7 @@ add_subdirectory(driver) add_subdirectory(hiprtc) rocm_install_targets( + PRIVATE TARGETS migraphx_gpu migraphx_device compile_for_gpu INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include diff --git a/src/targets/ref/CMakeLists.txt b/src/targets/ref/CMakeLists.txt index 0d72afba107..3f442406a49 100644 --- a/src/targets/ref/CMakeLists.txt +++ b/src/targets/ref/CMakeLists.txt @@ -36,6 +36,7 @@ target_link_libraries(migraphx_ref PUBLIC migraphx) migraphx_generate_export_header(migraphx_ref) rocm_install_targets( + PRIVATE TARGETS migraphx_ref INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index 316bd7371ed..6257be2afa3 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -60,6 +60,7 @@ endif() target_link_libraries(migraphx_tf PUBLIC migraphx) rocm_install_targets( + PRIVATE TARGETS migraphx_tf ) From ca6512908d44cd56c622b523dc59cb5e79cd39a1 Mon Sep 17 00:00:00 2001 From: Zakor Gyula <126694206+gyulaz-htec@users.noreply.github.com> Date: Mon, 27 May 2024 21:01:17 +0200 Subject: [PATCH 3/4] Fix mod compile issue on GPU (#2268) (#3086) --- src/include/migraphx/op/mod.hpp | 3 +-- .../kernels/include/migraphx/kernels/math.hpp | 18 +++++++++++++++++- test/py/onnx_backend_test.py | 2 -- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/include/migraphx/op/mod.hpp b/src/include/migraphx/op/mod.hpp index f1a48e3c58f..38f947a3587 100644 --- a/src/include/migraphx/op/mod.hpp +++ b/src/include/migraphx/op/mod.hpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,7 +38,6 @@ struct mod : binary { auto a = base_attributes(); a["commutative"] = false; - a["point_op"] = "${function:fmod}((${function:remainder}(${0}, ${1})) + ${1}, ${1})"; return a; } auto apply() const diff --git a/src/targets/gpu/kernels/include/migraphx/kernels/math.hpp b/src/targets/gpu/kernels/include/migraphx/kernels/math.hpp index 5a6cca7bc24..da00ff9c781 100644 --- a/src/targets/gpu/kernels/include/migraphx/kernels/math.hpp +++ b/src/targets/gpu/kernels/include/migraphx/kernels/math.hpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -256,6 +256,21 @@ constexpr auto min(const T& a, const U& b) return min>(a, b); } +template ())> +constexpr T mod(const T& a, const T& b) +{ + if constexpr(is_integral{}) + // onnx mod operator requires numpy style modulus + return ((a % b) + b) % b; + return static_cast(fmod(remainder(a, b) + b, b)); +} + +template {} and not is_any_vec())> +constexpr auto mod(const T& a, const U& b) +{ + return mod>(a, b); +} + MIGRAPHX_DEVICE_MATH_VEC(abs) MIGRAPHX_DEVICE_MATH_VEC(acos) MIGRAPHX_DEVICE_MATH_VEC(acosh) @@ -275,6 +290,7 @@ MIGRAPHX_DEVICE_MATH_VEC(isnan) MIGRAPHX_DEVICE_MATH_VEC(log) MIGRAPHX_DEVICE_MATH_VEC(max) MIGRAPHX_DEVICE_MATH_VEC(min) +MIGRAPHX_DEVICE_MATH_VEC(mod) MIGRAPHX_DEVICE_MATH_VEC(nearbyint) MIGRAPHX_DEVICE_MATH_VEC(pow) MIGRAPHX_DEVICE_MATH_VEC(remainder) diff --git a/test/py/onnx_backend_test.py b/test/py/onnx_backend_test.py index 353bcea3944..2d847c97300 100644 --- a/test/py/onnx_backend_test.py +++ b/test/py/onnx_backend_test.py @@ -119,8 +119,6 @@ def disabled_tests_onnx_1_7_0(backend_test): backend_test.exclude(r'test_einsum_transpose_cpu') backend_test.exclude(r'test_maxunpool_export_with_output_shape_cpu') backend_test.exclude(r'test_maxunpool_export_without_output_shape_cpu') - backend_test.exclude(r'test_mod_mixed_sign_int32_cpu') - backend_test.exclude(r'test_mod_mixed_sign_int8_cpu') backend_test.exclude(r'test_qlinearmatmul_2D_cpu') backend_test.exclude(r'test_qlinearmatmul_3D_cpu') backend_test.exclude(r'test_range_float_type_positive_delta_expanded_cpu') From 2dcca47322b967fc99093ec74d940d261d2713a4 Mon Sep 17 00:00:00 2001 From: Chris Austen Date: Mon, 27 May 2024 15:03:01 -0400 Subject: [PATCH 4/4] Move up pybind to support new builds of ONNX Runtime (#3121) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 49b42573add..ff97144acf2 100755 --- a/requirements.txt +++ b/requirements.txt @@ -24,7 +24,7 @@ google/protobuf@v3.19.0 -DCMAKE_POSITION_INDEPENDENT_CODE=On -X subdir -Dprotobuf_BUILD_TESTS=Off nlohmann/json@v3.8.0 ROCm/half@rocm-5.6.0 -pybind/pybind11@d159a563383d10c821ba7b2a71905d1207db6de4 --build +pybind/pybind11@3e9dfa2866941655c56877882565e7577de6fc7b --build msgpack/msgpack-c@cpp-3.3.0 -DMSGPACK_BUILD_TESTS=Off sqlite3@3.43.2 -DCMAKE_POSITION_INDEPENDENT_CODE=On ROCm/composable_kernel@57cdd70b7cb14e5e3b60cd9a5f96ba8dc343763e -DCK_BUILD_JIT_LIB=On -DCMAKE_POSITION_INDEPENDENT_CODE=On