Commit 2fc6b715 authored by Paul's avatar Paul
Browse files

Merge

parents 5967d68d 118e05c7
...@@ -39,10 +39,8 @@ jobs: ...@@ -39,10 +39,8 @@ jobs:
- name: Prepare timestamp - name: Prepare timestamp
id: cache_timestamp id: cache_timestamp
shell: cmake -P {0} shell: bash
run: | run: echo timestamp="$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Cache files for tidy - name: Cache files for tidy
uses: pat-s/always-upload-cache@v3.0.11 uses: pat-s/always-upload-cache@v3.0.11
...@@ -65,6 +63,7 @@ jobs: ...@@ -65,6 +63,7 @@ jobs:
-DMIGRAPHX_ENABLE_GPU=On \ -DMIGRAPHX_ENABLE_GPU=On \
-DMIGRAPHX_ENABLE_CPU=On \ -DMIGRAPHX_ENABLE_CPU=On \
-DMIGRAPHX_ENABLE_FPGA=On \ -DMIGRAPHX_ENABLE_FPGA=On \
-DBUILD_DEV=On \
-DROCM_ENABLE_GH_ANNOTATIONS=On \ -DROCM_ENABLE_GH_ANNOTATIONS=On \
-DCLANG_TIDY_DEPEND_ON_TARGET=Off \ -DCLANG_TIDY_DEPEND_ON_TARGET=Off \
-DCLANG_TIDY_CACHE=/data/tidy-cache \ -DCLANG_TIDY_CACHE=/data/tidy-cache \
...@@ -88,10 +87,8 @@ jobs: ...@@ -88,10 +87,8 @@ jobs:
- name: Prepare timestamp - name: Prepare timestamp
id: cache_timestamp id: cache_timestamp
shell: cmake -P {0} shell: bash
run: | run: echo timestamp="$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Cache files for cppcheck - name: Cache files for cppcheck
uses: pat-s/always-upload-cache@v2.1.3 uses: pat-s/always-upload-cache@v2.1.3
...@@ -112,6 +109,7 @@ jobs: ...@@ -112,6 +109,7 @@ jobs:
cd build cd build
CXX=/opt/rocm/llvm/bin/clang++ CC=/opt/rocm/llvm/bin/clang cmake \ CXX=/opt/rocm/llvm/bin/clang++ CC=/opt/rocm/llvm/bin/clang cmake \
-DCPPCHECK_BUILD_DIR=/data/cppcheck-cache \ -DCPPCHECK_BUILD_DIR=/data/cppcheck-cache \
-DBUILD_DEV=On \
-DROCM_ENABLE_GH_ANNOTATIONS=On \ -DROCM_ENABLE_GH_ANNOTATIONS=On \
.. ..
make -j2 cppcheck make -j2 cppcheck
...@@ -233,12 +231,11 @@ jobs: ...@@ -233,12 +231,11 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz pip install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
rbuild prepare -d cget -s gh rbuild prepare -d cget -s gh
sudo apt-get install -y lld
- name: Prepare timestamp - name: Prepare timestamp
id: cache_timestamp id: cache_timestamp
shell: cmake -P {0} shell: bash
run: | run: echo timestamp="$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Cache files for ccache - name: Cache files for ccache
# Ignore the failure of a step and avoid terminating the job. # Ignore the failure of a step and avoid terminating the job.
...@@ -262,10 +259,11 @@ jobs: ...@@ -262,10 +259,11 @@ jobs:
rbuild build -d cget -s gh -T check \ rbuild build -d cget -s gh -T check \
-DCMAKE_BUILD_TYPE=${{matrix.configuration}} \ -DCMAKE_BUILD_TYPE=${{matrix.configuration}} \
-DMIGRAPHX_ENABLE_PYTHON=${{matrix.configuration == 'release' && 'On' || 'Off'}} \ -DMIGRAPHX_ENABLE_PYTHON=${{matrix.configuration == 'release' && 'On' || 'Off'}} \
-DBUILD_DEV=On \
-DCMAKE_CXX_FLAGS_DEBUG="-g1 -Os -fdebug-prefix-map=$PWD=. -fdebug-types-section -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined" \ -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Os -fdebug-prefix-map=$PWD=. -fdebug-types-section -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined" \
-DCMAKE_CXX_FLAGS_CODECOV="-g1 -Og -fdebug-prefix-map=$PWD=. -fdebug-types-section -fprofile-arcs -ftest-coverage -fno-omit-frame-pointer" \ -DCMAKE_CXX_FLAGS_CODECOV="-g1 -Og -fdebug-prefix-map=$PWD=. -fdebug-types-section -fprofile-arcs -ftest-coverage -fno-omit-frame-pointer" \
-DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=gold' \ -DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld' \
-DCMAKE_SHARED_LINKER_FLAGS='-fuse-ld=gold' -DCMAKE_SHARED_LINKER_FLAGS='-fuse-ld=lld'
${{ github.workspace }}/cget/bin/ccache -s ${{ github.workspace }}/cget/bin/ccache -s
- name: Upload code coverage - name: Upload code coverage
...@@ -329,12 +327,11 @@ jobs: ...@@ -329,12 +327,11 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz pip install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
rbuild prepare -d cget -s gh rbuild prepare -d cget -s gh
sudo apt-get install -y lld
- name: Prepare timestamp - name: Prepare timestamp
id: cache_timestamp id: cache_timestamp
shell: cmake -P {0} shell: bash
run: | run: echo timestamp="$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_OUTPUT
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Cache files for ccache - name: Cache files for ccache
# Ignore the failure of a step and avoid terminating the job. # Ignore the failure of a step and avoid terminating the job.
...@@ -358,10 +355,11 @@ jobs: ...@@ -358,10 +355,11 @@ jobs:
rbuild build -d cget -s gh -T check \ rbuild build -d cget -s gh -T check \
-DCMAKE_BUILD_TYPE=${{matrix.configuration}} \ -DCMAKE_BUILD_TYPE=${{matrix.configuration}} \
-DMIGRAPHX_ENABLE_PYTHON=${{matrix.configuration == 'release' && 'On' || 'Off'}} \ -DMIGRAPHX_ENABLE_PYTHON=${{matrix.configuration == 'release' && 'On' || 'Off'}} \
-DBUILD_DEV=On \
-DCMAKE_CXX_FLAGS_DEBUG="-g1 -Os -fdebug-prefix-map=$PWD=. -fdebug-types-section -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined" \ -DCMAKE_CXX_FLAGS_DEBUG="-g1 -Os -fdebug-prefix-map=$PWD=. -fdebug-types-section -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined" \
-DCMAKE_CXX_FLAGS_CODECOV="-g1 -Og -fdebug-prefix-map=$PWD=. -fdebug-types-section -fprofile-arcs -ftest-coverage -fno-omit-frame-pointer" \ -DCMAKE_CXX_FLAGS_CODECOV="-g1 -Og -fdebug-prefix-map=$PWD=. -fdebug-types-section -fprofile-arcs -ftest-coverage -fno-omit-frame-pointer" \
-DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=gold' \ -DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld' \
-DCMAKE_SHARED_LINKER_FLAGS='-fuse-ld=gold' \ -DCMAKE_SHARED_LINKER_FLAGS='-fuse-ld=lld' \
-DMIGRAPHX_ENABLE_FPGA=On -DMIGRAPHX_ENABLE_FPGA=On
${{ github.workspace }}/cget/bin/ccache -s ${{ github.workspace }}/cget/bin/ccache -s
......
...@@ -20,6 +20,10 @@ on: ...@@ -20,6 +20,10 @@ on:
description: Repository where benchmark utils are stored description: Repository where benchmark utils are stored
required: true required: true
default: "ROCmSoftwarePlatform/migraphx-benchmark-utils" default: "ROCmSoftwarePlatform/migraphx-benchmark-utils"
organization:
description: Organization based on which location of files will be different
required: true
default: "AMD"
jobs: jobs:
release: release:
...@@ -29,6 +33,7 @@ jobs: ...@@ -29,6 +33,7 @@ jobs:
end_date: ${{ github.event.inputs.end_date || 'yyyy-mm-dd' }} end_date: ${{ github.event.inputs.end_date || 'yyyy-mm-dd' }}
history_repo: ${{ github.event.inputs.history_repo || 'ROCmSoftwarePlatform/migraphx-reports' }} history_repo: ${{ github.event.inputs.history_repo || 'ROCmSoftwarePlatform/migraphx-reports' }}
benchmark_utils_repo: ${{ github.event.inputs.benchmark_utils_repo || 'ROCmSoftwarePlatform/migraphx-benchmark-utils' }} benchmark_utils_repo: ${{ github.event.inputs.benchmark_utils_repo || 'ROCmSoftwarePlatform/migraphx-benchmark-utils' }}
organization: ${{ github.event.inputs.organization || 'AMD' }}
secrets: secrets:
gh_token: ${{ secrets.MIGRAPHX_BOT_TOKEN }} gh_token: ${{ secrets.MIGRAPHX_BOT_TOKEN }}
mail_user: ${{ secrets.MAIL_USERNAME }} mail_user: ${{ secrets.MAIL_USERNAME }}
......
...@@ -29,6 +29,10 @@ on: ...@@ -29,6 +29,10 @@ on:
description: Last N results description: Last N results
required: true required: true
default: '10' default: '10'
model_timeout:
description: If model in performance test script passes this threshold, it will be skipped
required: true
default: '30m'
flags: flags:
description: -m for Max value; -s for Std dev; -r for Threshold file description: -m for Max value; -s for Std dev; -r for Threshold file
required: true required: true
...@@ -46,6 +50,7 @@ jobs: ...@@ -46,6 +50,7 @@ jobs:
performance_reports_repo: ${{ github.event.inputs.performance_reports_repo || 'ROCmSoftwarePlatform/migraphx-reports' }} performance_reports_repo: ${{ github.event.inputs.performance_reports_repo || 'ROCmSoftwarePlatform/migraphx-reports' }}
benchmark_utils_repo: ${{ github.event.inputs.benchmark_utils_repo || 'ROCmSoftwarePlatform/migraphx-benchmark-utils' }} benchmark_utils_repo: ${{ github.event.inputs.benchmark_utils_repo || 'ROCmSoftwarePlatform/migraphx-benchmark-utils' }}
organization: ${{ github.event.inputs.organization || 'AMD' }} organization: ${{ github.event.inputs.organization || 'AMD' }}
model_timeout: ${{ github.event.inputs.model_timeout || '30m' }}
secrets: secrets:
gh_token: ${{ secrets.MIGRAPHX_BOT_TOKEN }} gh_token: ${{ secrets.MIGRAPHX_BOT_TOKEN }}
mail_user: ${{ secrets.MAIL_USERNAME }} mail_user: ${{ secrets.MAIL_USERNAME }}
......
name: Onnxruntime main weekly sync name: Onnxruntime main weekly sync
on: on:
schedule: schedule:
- cron: "05 17 * * 1" - cron: '07 17 * * 5'
jobs: jobs:
createPullRequest:
name: Update and create pull request
runs-on: ubuntu-latest runs-on: ubuntu-latest
sync:
steps: steps:
- name: get_date
run: echo todays_date="$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: extract_sha1
run: echo onnxsha="$(git ls-remote https://github.com/microsoft/onnxruntime.git HEAD | awk '{print $1}')" >> $GITHUB_ENV
- name: echo_sha1
run: echo ${{ env.onnxsha }}
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
ref: develop ref: develop
path: ../
get_date:
steps:
- run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
update_file: - name: update_file
needs: [sync get_date] run: echo ${{ env.onnxsha }} > test/onnx/.onnxrt-commit
steps:
- run: git clone https://github.com/microsoft/onnxruntime.git && cd onnxruntime && git rev-parse HEAD >> ../test/onnx/.onnxrt-commit
Add_commit: - name: Make changes to pull request
needs: update_file uses: peter-evans/create-pull-request@v4
steps:
- name: Add & Commit
uses: EndBug/add-and-commit@v9.1.1
with: with:
new_branch: onnxruntime-sync-${{ steps.date.outputs.date }} token: ${{ secrets.GITHUB_TOKEN }}
add: ../test/onnx/.onnxrt-commit commit-message: Update onnxruntime main ${{ env.onnxsha }}
message: Update Onnxruntime commit to latest release committer: Github <noreply@github.com>
default_author: github_actions author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
push: true signoff: false
PR: branch: onnxruntime-sync-${{ env.todays_date }}
needs: Add_commit delete-branch: true
steps: title: 'Onnxruntime Weekly Sync ${{ env.todays_date }}'
- name: GitHub Action for creating Pull Requests body: |
uses: devops-infra/action-pull-request@v0.5.3 Update CI point for Onnxruntime builds
with: - Updated with changes from ${{ env.todays_date }}
github_token: ${{ secrets.GITHUB_TOKEN }} - Auto-generated by [create-pull-request][1]
title: Sync Onnxruntime main - Update .onnxrt-commit to ${{ env.onnxsha }}
reviewer: pfultz2, causten
assignee: TedThemistokleous [1]: https://github.com/peter-evans/create-pull-request
label: automatic, onnxruntime labels: |
target_branch: develop onnxruntime
dependancies
automated
assignees: TedThemistokleous
reviewers: TedThemistokleous causten
draft: false
base: develop
\ No newline at end of file
...@@ -46,6 +46,8 @@ else() ...@@ -46,6 +46,8 @@ else()
set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "") set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "")
endif() endif()
set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/lib")
project(migraphx) project(migraphx)
find_package(ROCM REQUIRED) find_package(ROCM REQUIRED)
...@@ -65,8 +67,10 @@ set(CMAKE_EXTRA_INCLUDE_FILES) ...@@ -65,8 +67,10 @@ set(CMAKE_EXTRA_INCLUDE_FILES)
include(ROCMSetupVersion) include(ROCMSetupVersion)
rocm_setup_version(VERSION 2.6) option(BUILD_DEV "Build for development purpose only" OFF)
set(MIGRAPHX_SO_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
rocm_setup_version(VERSION 2.6.0)
set(MIGRAPHX_SO_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
option( BUILD_SHARED_LIBS "Build as a shared library" ON ) option( BUILD_SHARED_LIBS "Build as a shared library" ON )
......
...@@ -110,7 +110,7 @@ RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXR ...@@ -110,7 +110,7 @@ RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXR
ADD tools/build_and_test_onnxrt.sh /onnxruntime/build_and_test_onnxrt.sh ADD tools/build_and_test_onnxrt.sh /onnxruntime/build_and_test_onnxrt.sh
RUN cget -p /usr/local install ROCmSoftwarePlatform/rocMLIR@78b706fe9879587ab98b6614ae539265374a3fae -DBUILD_MIXR_TARGET=On -DLLVM_ENABLE_ZSTD=Off -DLLVM_ENABLE_THREADS=Off RUN cget -p /usr/local install ROCmSoftwarePlatform/rocMLIR@acb727b348086b58a7f261b32c0e4f0686a4c0ee -DBUILD_MIXR_TARGET=On -DLLVM_ENABLE_ZSTD=Off -DLLVM_ENABLE_THREADS=Off
ENV MIOPEN_FIND_DB_PATH=/tmp/miopen/find-db ENV MIOPEN_FIND_DB_PATH=/tmp/miopen/find-db
ENV MIOPEN_USER_DB_PATH=/tmp/miopen/user-db ENV MIOPEN_USER_DB_PATH=/tmp/miopen/user-db
......
...@@ -28,7 +28,7 @@ def rocmtestnode(Map conf) { ...@@ -28,7 +28,7 @@ def rocmtestnode(Map conf) {
rm -rf build rm -rf build
mkdir build mkdir build
cd build cd build
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ${flags} .. cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_DEV=On ${flags} ..
make -j\$(nproc) generate all doc package check VERBOSE=1 make -j\$(nproc) generate all doc package check VERBOSE=1
""" """
echo cmd echo cmd
...@@ -116,10 +116,12 @@ rocmtest clang_debug: rocmnode('vega') { cmake_build -> ...@@ -116,10 +116,12 @@ rocmtest clang_debug: rocmnode('vega') { cmake_build ->
} }
}, mlir_debug: rocmnode('vega') { cmake_build -> }, mlir_debug: rocmnode('vega') { cmake_build ->
stage('MLIR Debug') { stage('MLIR Debug') {
withEnv(['MIGRAPHX_ENABLE_MLIR=1']) {
def sanitizers = "undefined" def sanitizers = "undefined"
def debug_flags = "-g -O2 -fsanitize=${sanitizers} -fno-sanitize-recover=${sanitizers}" def debug_flags = "-g -O2 -fsanitize=${sanitizers} -fno-sanitize-recover=${sanitizers}"
cmake_build(flags: "-DCMAKE_BUILD_TYPE=debug -DMIGRAPHX_ENABLE_PYTHON=Off -DMIGRAPHX_ENABLE_MLIR=On -DCMAKE_CXX_FLAGS_DEBUG='${debug_flags}' -DCMAKE_C_FLAGS_DEBUG='${debug_flags}'") cmake_build(flags: "-DCMAKE_BUILD_TYPE=debug -DMIGRAPHX_ENABLE_PYTHON=Off -DMIGRAPHX_ENABLE_MLIR=On -DCMAKE_CXX_FLAGS_DEBUG='${debug_flags}' -DCMAKE_C_FLAGS_DEBUG='${debug_flags}'")
} }
}
}, clang_asan: rocmnode('nogpu') { cmake_build -> }, clang_asan: rocmnode('nogpu') { cmake_build ->
stage('Clang ASAN') { stage('Clang ASAN') {
def sanitizers = "undefined,address" def sanitizers = "undefined,address"
......
...@@ -32,6 +32,10 @@ Disable fast math optimization ...@@ -32,6 +32,10 @@ Disable fast math optimization
Perform an exhaustive search to find the fastest version of generated kernels for selected backend Perform an exhaustive search to find the fastest version of generated kernels for selected backend
.. options:: --split-single-dyn-dim
Enable the split single dynamic dimension pass
.. option:: --fp16 .. option:: --fp16
Quantize for fp16 Quantize for fp16
......
...@@ -24,7 +24,7 @@ Load as MIGraphX JSON ...@@ -24,7 +24,7 @@ Load as MIGraphX JSON
.. option:: --batch [unsigned int] (Default: 1) .. option:: --batch [unsigned int] (Default: 1)
Set batch size for model For a static model, set batch size. For a dynamic batch model, sets the batch size at runtime.
.. option:: --nhwc .. option:: --nhwc
...@@ -46,6 +46,14 @@ Trim instructions from the end (Default: 0) ...@@ -46,6 +46,14 @@ Trim instructions from the end (Default: 0)
Dim of a parameter (format: "@name d1 d2 dn") Dim of a parameter (format: "@name d1 d2 dn")
.. options:: --dyn-input-dim [std::vector<std::string>]
Set dynamic dimensions of a parameter using JSON formatting (format "@name" "dynamic_dimension_json")
.. options:: --default-dyn-dim
Set the default dynamic dimension (format {min:x, max:y, optimals:[o1,o2,...]})
.. option:: --optimize, -O .. option:: --optimize, -O
Optimize when reading Optimize when reading
......
...@@ -27,7 +27,7 @@ project (PLS) ...@@ -27,7 +27,7 @@ project (PLS)
set (CMAKE_CXX_STANDARD 14) set (CMAKE_CXX_STANDARD 14)
set (EXAMPLE parse_load_save) set (EXAMPLE parse_load_save)
list (APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm) list (APPEND CMAKE_PREFIX_PATH /opt/rocm)
find_package (migraphx) find_package (migraphx)
message("source file: " ${EXAMPLE}.cpp " ---> bin: " ${EXAMPLE}) message("source file: " ${EXAMPLE}.cpp " ---> bin: " ${EXAMPLE})
......
...@@ -27,7 +27,7 @@ project (custom_miopen_kernel) ...@@ -27,7 +27,7 @@ project (custom_miopen_kernel)
set (CMAKE_CXX_STANDARD 14) set (CMAKE_CXX_STANDARD 14)
set (EXAMPLE custom_op_miopen_kernel) set (EXAMPLE custom_op_miopen_kernel)
list (APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm) list (APPEND CMAKE_PREFIX_PATH /opt/rocm)
find_package (migraphx REQUIRED) find_package (migraphx REQUIRED)
find_package (miopen REQUIRED) find_package (miopen REQUIRED)
......
...@@ -28,7 +28,7 @@ set (CMAKE_CXX_STANDARD 14) ...@@ -28,7 +28,7 @@ set (CMAKE_CXX_STANDARD 14)
set (EXAMPLE custom_op_rocblas_kernel) set (EXAMPLE custom_op_rocblas_kernel)
list (APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm) list (APPEND CMAKE_PREFIX_PATH /opt/rocm)
find_package (migraphx REQUIRED) find_package (migraphx REQUIRED)
find_package (rocblas REQUIRED) find_package (rocblas REQUIRED)
......
...@@ -29,7 +29,7 @@ See below for a comprehensive list of commands and option arguments, as well as ...@@ -29,7 +29,7 @@ See below for a comprehensive list of commands and option arguments, as well as
| --tf | Load file as a tensorflow graph | | --tf | Load file as a tensorflow graph |
| --migraphx | Load file as a migraphx graph | | --migraphx | Load file as a migraphx graph |
| --migraphx-json | Load file as a migraphx JSON graph | | --migraphx-json | Load file as a migraphx JSON graph |
| --batch | Set batch size for the model | | --batch | For a static model, set batch size. For a dynamic batch model, sets the batch size at runtime.|
| --nhwc | Treat tensorflow format as nhwc | | --nhwc | Treat tensorflow format as nhwc |
| --nchw | Treat tensorflow format as nchw | | --nchw | Treat tensorflow format as nchw |
| --skip-unknown-operators | Skip unknown operators when parsing and continue to parse | | --skip-unknown-operators | Skip unknown operators when parsing and continue to parse |
...@@ -44,12 +44,16 @@ See below for a comprehensive list of commands and option arguments, as well as ...@@ -44,12 +44,16 @@ See below for a comprehensive list of commands and option arguments, as well as
| --output \| -o | Output to file | | --output \| -o | Output to file |
| --fill0 | Fill parameter with 0s | | --fill0 | Fill parameter with 0s |
| --fill1 | Fill parameter with 1s | | --fill1 | Fill parameter with 1s |
| --input-dim | Set static dimensions of a parameter |
| --dyn-input-dim | Set dynamic dimensions of a parameter |
| --default-dyn-dim | Set default dynamic dimension |
| --gpu | Compile on the gpu | | --gpu | Compile on the gpu |
| --cpu | Compile on the cpu | | --cpu | Compile on the cpu |
| --ref | Compile on the reference implementation | | --ref | Compile on the reference implementation |
| --enable-offload-copy | Enable implicit offload copying | | --enable-offload-copy | Enable implicit offload copying |
| --disable-fast-math | Disable fast math optimization | | --disable-fast-math | Disable fast math optimization |
| --exhaustive-tune | Enable exhaustive search to find fastest kernel | | --exhaustive-tune | Enable exhaustive search to find fastest kernel |
| --split-single-dyn-dim | Enable split_single_dyn_dim compiler pass |
| --fp16 | Quantize for fp16 | | --fp16 | Quantize for fp16 |
| --int8 | Quantize for int8 | | --int8 | Quantize for int8 |
| --tolerance | Tolerance for errors | | --tolerance | Tolerance for errors |
...@@ -88,7 +92,7 @@ batch_norm_inference ...@@ -88,7 +92,7 @@ batch_norm_inference
broadcast broadcast
capture capture
ceil ceil
check_context::migraphx::version_1::gpu::context check_context::migraphx::gpu::context
clip clip
concat concat
contiguous contiguous
...@@ -304,7 +308,7 @@ $ /opt/rocm/bin/migraphx-driver run --onnx simple_graph.onnx ...@@ -304,7 +308,7 @@ $ /opt/rocm/bin/migraphx-driver run --onnx simple_graph.onnx
``` ```
Compiling ... Compiling ...
Reading: simple_graph.onnx Reading: simple_graph.onnx
@0 = check_context::migraphx::version_1::gpu::context -> float_type, {}, {} @0 = check_context::migraphx::gpu::context -> float_type, {}, {}
@1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1} @1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1}
@2 = hip::hip_copy_literal[id=@literal:1] -> float_type, {784, 128}, {128, 1} @2 = hip::hip_copy_literal[id=@literal:1] -> float_type, {784, 128}, {128, 1}
x:0 = @param:x:0 -> float_type, {1, 28, 28}, {784, 28, 1} x:0 = @param:x:0 -> float_type, {1, 28, 28}, {784, 28, 1}
...@@ -327,7 +331,7 @@ x:0 = @param:x:0 -> float_type, {1, 28, 28}, {784, 28, 1} ...@@ -327,7 +331,7 @@ x:0 = @param:x:0 -> float_type, {1, 28, 28}, {784, 28, 1}
@18 = @return(@17) @18 = @return(@17)
Allocating params ... Allocating params ...
@0 = check_context::migraphx::version_1::gpu::context -> float_type, {}, {} @0 = check_context::migraphx::gpu::context -> float_type, {}, {}
@1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1} @1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1}
@2 = hip::hip_copy_literal[id=@literal:1] -> float_type, {784, 128}, {128, 1} @2 = hip::hip_copy_literal[id=@literal:1] -> float_type, {784, 128}, {128, 1}
x:0 = @param:x:0 -> float_type, {1, 28, 28}, {784, 28, 1} x:0 = @param:x:0 -> float_type, {1, 28, 28}, {784, 28, 1}
...@@ -399,7 +403,7 @@ $ /opt/rocm/bin/migraphx-driver compile --gpu --fp16 simple_graph.pb ...@@ -399,7 +403,7 @@ $ /opt/rocm/bin/migraphx-driver compile --gpu --fp16 simple_graph.pb
``` ```
Compiling ... Compiling ...
Reading: simple_graph.pb Reading: simple_graph.pb
@0 = check_context::migraphx::version_1::gpu::context -> float_type, {}, {} @0 = check_context::migraphx::gpu::context -> float_type, {}, {}
@1 = hip::hip_allocate_memory[shape=float_type, {456}, {1},id=scratch] -> float_type, {456}, {1} @1 = hip::hip_allocate_memory[shape=float_type, {456}, {1},id=scratch] -> float_type, {456}, {1}
@2 = hip::hip_copy_literal[id=@literal:0] -> half_type, {784, 128}, {128, 1} @2 = hip::hip_copy_literal[id=@literal:0] -> half_type, {784, 128}, {128, 1}
@3 = load[offset=256,end=1824](@1) -> half_type, {1, 28, 28}, {784, 28, 1} @3 = load[offset=256,end=1824](@1) -> half_type, {1, 28, 28}, {784, 28, 1}
...@@ -502,7 +506,7 @@ x = @param:x -> float_type, {1, 28, 28}, {784, 28, 1} ...@@ -502,7 +506,7 @@ x = @param:x -> float_type, {1, 28, 28}, {784, 28, 1}
@18 = ref::softmax[axis=1](@17) -> float_type, {1, 10}, {10, 1} @18 = ref::softmax[axis=1](@17) -> float_type, {1, 10}, {10, 1}
@19 = ref::identity(@18) -> float_type, {1, 10}, {10, 1} @19 = ref::identity(@18) -> float_type, {1, 10}, {10, 1}
@0 = check_context::migraphx::version_1::gpu::context -> float_type, {}, {} @0 = check_context::migraphx::gpu::context -> float_type, {}, {}
@1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1} @1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1}
@2 = hip::hip_copy_literal[id=@literal:3] -> float_type, {784, 128}, {128, 1} @2 = hip::hip_copy_literal[id=@literal:3] -> float_type, {784, 128}, {128, 1}
x = @param:x -> float_type, {1, 28, 28}, {784, 28, 1} x = @param:x -> float_type, {1, 28, 28}, {784, 28, 1}
...@@ -538,7 +542,7 @@ $ /opt/rocm/bin/migraphx-driver perf simple_graph.pb ...@@ -538,7 +542,7 @@ $ /opt/rocm/bin/migraphx-driver perf simple_graph.pb
``` ```
Compiling ... Compiling ...
Reading: simple_graph.pb Reading: simple_graph.pb
@0 = check_context::migraphx::version_1::gpu::context -> float_type, {}, {} @0 = check_context::migraphx::gpu::context -> float_type, {}, {}
@1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1} @1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1}
@2 = hip::hip_copy_literal[id=@literal:3] -> float_type, {784, 128}, {128, 1} @2 = hip::hip_copy_literal[id=@literal:3] -> float_type, {784, 128}, {128, 1}
@3 = load[offset=0,end=512](@1) -> float_type, {1, 128}, {128, 1} @3 = load[offset=0,end=512](@1) -> float_type, {1, 128}, {128, 1}
...@@ -561,7 +565,7 @@ output = @param:output -> float_type, {1, 10}, {10, 1} ...@@ -561,7 +565,7 @@ output = @param:output -> float_type, {1, 10}, {10, 1}
Allocating params ... Allocating params ...
Running performance report ... Running performance report ...
@0 = check_context::migraphx::version_1::gpu::context -> float_type, {}, {}: 0.00057782ms, 1% @0 = check_context::migraphx::gpu::context -> float_type, {}, {}: 0.00057782ms, 1%
@1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1}: 0.000295ms, 1% @1 = hip::hip_allocate_memory[shape=float_type, {256}, {1},id=scratch] -> float_type, {256}, {1}: 0.000295ms, 1%
@2 = hip::hip_copy_literal[id=@literal:3] -> float_type, {784, 128}, {128, 1}: 0.00027942ms, 1% @2 = hip::hip_copy_literal[id=@literal:3] -> float_type, {784, 128}, {128, 1}: 0.00027942ms, 1%
@3 = load[offset=0,end=512](@1) -> float_type, {1, 128}, {128, 1}: 0.000232ms, 1% @3 = load[offset=0,end=512](@1) -> float_type, {1, 128}, {128, 1}: 0.000232ms, 1%
...@@ -591,7 +595,7 @@ hip::hip_copy_literal: 0.00186824ms, 1% ...@@ -591,7 +595,7 @@ hip::hip_copy_literal: 0.00186824ms, 1%
load: 0.0016288ms, 1% load: 0.0016288ms, 1%
@param: 0.0013428ms, 1% @param: 0.0013428ms, 1%
broadcast: 0.00118042ms, 1% broadcast: 0.00118042ms, 1%
check_context::migraphx::version_1::gpu::context: 0.00057782ms, 1% check_context::migraphx::gpu::context: 0.00057782ms, 1%
reshape: 0.00033842ms, 1% reshape: 0.00033842ms, 1%
hip::hip_allocate_memory: 0.000295ms, 1% hip::hip_allocate_memory: 0.000295ms, 1%
......
...@@ -27,7 +27,7 @@ project (CAI) ...@@ -27,7 +27,7 @@ project (CAI)
set (CMAKE_CXX_STANDARD 14) set (CMAKE_CXX_STANDARD 14)
set (EXAMPLE mnist_inference) set (EXAMPLE mnist_inference)
list (APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm) list (APPEND CMAKE_PREFIX_PATH /opt/rocm)
find_package (migraphx) find_package (migraphx)
message("source file: " ${EXAMPLE}.cpp " ---> bin: " ${EXAMPLE}) message("source file: " ${EXAMPLE}.cpp " ---> bin: " ${EXAMPLE})
......
...@@ -50,6 +50,7 @@ add_library(migraphx ...@@ -50,6 +50,7 @@ add_library(migraphx
env.cpp env.cpp
file_buffer.cpp file_buffer.cpp
fuse_pointwise.cpp fuse_pointwise.cpp
fuse_reduce.cpp
generate.cpp generate.cpp
inline_module.cpp inline_module.cpp
insert_pad.cpp insert_pad.cpp
...@@ -73,6 +74,7 @@ add_library(migraphx ...@@ -73,6 +74,7 @@ add_library(migraphx
process.cpp process.cpp
program.cpp program.cpp
propagate_constant.cpp propagate_constant.cpp
promote_literals.cpp
quantization.cpp quantization.cpp
quantize_fp16.cpp quantize_fp16.cpp
quantize_int8.cpp quantize_int8.cpp
...@@ -91,6 +93,7 @@ add_library(migraphx ...@@ -91,6 +93,7 @@ add_library(migraphx
shape.cpp shape.cpp
simplify_algebra.cpp simplify_algebra.cpp
simplify_reshapes.cpp simplify_reshapes.cpp
split_single_dyn_dim.cpp
tmp_dir.cpp tmp_dir.cpp
value.cpp value.cpp
verify_args.cpp verify_args.cpp
...@@ -251,7 +254,7 @@ find_package(PkgConfig) ...@@ -251,7 +254,7 @@ find_package(PkgConfig)
pkg_check_modules(SQLITE3 REQUIRED IMPORTED_TARGET sqlite3) pkg_check_modules(SQLITE3 REQUIRED IMPORTED_TARGET sqlite3)
target_link_libraries(migraphx PRIVATE PkgConfig::SQLITE3) target_link_libraries(migraphx PRIVATE PkgConfig::SQLITE3)
find_package(msgpackc-cxx) find_package(msgpackc-cxx QUIET)
if(NOT msgpackc-cxx_FOUND) if(NOT msgpackc-cxx_FOUND)
find_package(msgpack REQUIRED) find_package(msgpack REQUIRED)
endif() endif()
...@@ -292,6 +295,10 @@ if(HAVE_HALF_EXPR) ...@@ -292,6 +295,10 @@ if(HAVE_HALF_EXPR)
target_compile_definitions(migraphx PUBLIC -DHAS_HALF_V1) target_compile_definitions(migraphx PUBLIC -DHAS_HALF_V1)
endif() endif()
if(BUILD_DEV)
target_compile_definitions(migraphx PUBLIC -DBUILD_DEV)
endif()
rocm_export_targets( rocm_export_targets(
TARGETS migraphx::migraphx_c TARGETS migraphx::migraphx_c
NAMESPACE migraphx:: NAMESPACE migraphx::
......
...@@ -26,10 +26,13 @@ add_library(migraphx_c ...@@ -26,10 +26,13 @@ add_library(migraphx_c
api.cpp api.cpp
) )
set_target_properties(migraphx_c PROPERTIES EXPORT_NAME c) set_target_properties(migraphx_c PROPERTIES EXPORT_NAME c)
# migraphx_c is stable API interface library. SO version of this should be
# bumped when binary compatibility is broken.
rocm_set_soversion(migraphx_c 3.0) rocm_set_soversion(migraphx_c 3.0)
rocm_clang_tidy_check(migraphx_c) rocm_clang_tidy_check(migraphx_c)
target_link_libraries(migraphx_c PRIVATE migraphx migraphx_tf migraphx_onnx migraphx_all_targets) target_link_libraries(migraphx_c PRIVATE migraphx migraphx_tf migraphx_onnx)
rocm_install_targets( rocm_install_targets(
TARGETS migraphx_c TARGETS migraphx_c
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <migraphx/register_target.hpp> #include <migraphx/register_target.hpp>
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/quantization.hpp> #include <migraphx/quantization.hpp>
#include <migraphx/ref/target.hpp>
#include <migraphx/load_save.hpp> #include <migraphx/load_save.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
#include <migraphx/register_op.hpp> #include <migraphx/register_op.hpp>
......
...@@ -89,8 +89,8 @@ std::vector<shape::dynamic_dimension> compute_broadcasted_dyn_dims(shape s0, sha ...@@ -89,8 +89,8 @@ std::vector<shape::dynamic_dimension> compute_broadcasted_dyn_dims(shape s0, sha
} }
else if(a == 1 or b == 1) else if(a == 1 or b == 1)
{ {
// setting opt to 0, may need to be changed // setting optimals to empty, may need to be changed
return shape::dynamic_dimension{std::max(a.min, b.min), std::max(a.max, b.max), 0}; return shape::dynamic_dimension{std::max(a.min, b.min), std::max(a.max, b.max)};
} }
else else
{ {
...@@ -148,10 +148,8 @@ shape common_shape(const std::vector<shape>& shapes) ...@@ -148,10 +148,8 @@ shape common_shape(const std::vector<shape>& shapes)
return {compute_common_types(shapes), compute_common_lens(shapes)}; return {compute_common_types(shapes), compute_common_lens(shapes)};
} }
instruction_ref insert_common_op(module& m, std::vector<instruction_ref>
instruction_ref ins, insert_common_args(module& m, instruction_ref ins, std::vector<instruction_ref> inputs)
const operation& op,
std::vector<instruction_ref> inputs)
{ {
if(std::any_of( if(std::any_of(
inputs.cbegin(), inputs.cend(), [](auto input) { return input->get_shape().dynamic(); })) inputs.cbegin(), inputs.cend(), [](auto input) { return input->get_shape().dynamic(); }))
...@@ -210,7 +208,20 @@ instruction_ref insert_common_op(module& m, ...@@ -210,7 +208,20 @@ instruction_ref insert_common_op(module& m,
return input; return input;
}); });
} }
return m.insert_instruction(ins, op, inputs); return inputs;
}
std::vector<instruction_ref> add_common_args(module& m, std::vector<instruction_ref> inputs)
{
return insert_common_args(m, m.end(), std::move(inputs));
}
instruction_ref insert_common_op(module& m,
instruction_ref ins,
const operation& op,
std::vector<instruction_ref> inputs)
{
return m.insert_instruction(ins, op, insert_common_args(m, ins, std::move(inputs)));
} }
instruction_ref add_common_op(module& m, const operation& op, std::vector<instruction_ref> inputs) instruction_ref add_common_op(module& m, const operation& op, std::vector<instruction_ref> inputs)
......
...@@ -106,6 +106,13 @@ cpp_generator::function& cpp_generator::function::set_generic_types(const module ...@@ -106,6 +106,13 @@ cpp_generator::function& cpp_generator::function::set_generic_types(const module
return *this; return *this;
} }
cpp_generator::function& cpp_generator::function::add_generic_param(const std::string& pname)
{
params.push_back({pname, "T" + pname});
tparams.push_back("class T" + pname);
return *this;
}
struct cpp_generator_impl struct cpp_generator_impl
{ {
std::stringstream fs{}; std::stringstream fs{};
...@@ -182,7 +189,8 @@ std::string cpp_generator::generate_point_op(const operation& op, ...@@ -182,7 +189,8 @@ std::string cpp_generator::generate_point_op(const operation& op,
std::string cpp_generator::str() const { return impl->fs.str(); } std::string cpp_generator::str() const { return impl->fs.str(); }
cpp_generator::function cpp_generator::generate_module(const module& m) cpp_generator::function cpp_generator::generate_module(const module& m,
const generate_module_callback& g)
{ {
function f; function f;
auto name = transform_string(m.name(), [](char c) { auto name = transform_string(m.name(), [](char c) {
...@@ -195,13 +203,7 @@ cpp_generator::function cpp_generator::generate_module(const module& m) ...@@ -195,13 +203,7 @@ cpp_generator::function cpp_generator::generate_module(const module& m)
if(ins->name() == "@literal") if(ins->name() == "@literal")
return shape::cpp_type(ins->get_shape().type()) + "(" + return shape::cpp_type(ins->get_shape().type()) + "(" +
ins->get_literal().to_string() + ")"; ins->get_literal().to_string() + ")";
std::vector<std::string> args; auto s = g(ins, names);
std::transform(ins->inputs().begin(),
ins->inputs().end(),
std::back_inserter(args),
[&](auto i) { return names.at(i); });
auto s = this->generate_point_op(ins->get_operator(), args);
if(impl->fresult) if(impl->fresult)
return impl->fresult(ins->get_shape()) + '(' + s + ')'; return impl->fresult(ins->get_shape()) + '(' + s + ')';
else else
...@@ -210,6 +212,24 @@ cpp_generator::function cpp_generator::generate_module(const module& m) ...@@ -210,6 +212,24 @@ cpp_generator::function cpp_generator::generate_module(const module& m)
return f; return f;
} }
std::vector<std::string>
cpp_generator::to_args(const std::vector<instruction_ref>& inputs,
const std::unordered_map<instruction_ref, std::string>& names)
{
std::vector<std::string> args;
std::transform(inputs.begin(), inputs.end(), std::back_inserter(args), [&](auto i) {
return names.at(i);
});
return args;
}
cpp_generator::function cpp_generator::generate_module(const module& m)
{
return this->generate_module(m, [&](auto ins, const auto& names) {
return this->generate_point_op(ins->get_operator(), to_args(ins->inputs(), names));
});
}
std::string cpp_generator::create_function(const cpp_generator::function& f) std::string cpp_generator::create_function(const cpp_generator::function& f)
{ {
impl->function_count++; impl->function_count++;
......
...@@ -42,6 +42,7 @@ add_custom_command( ...@@ -42,6 +42,7 @@ add_custom_command(
) )
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/driver) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/driver)
rocm_clang_tidy_check(driver) rocm_clang_tidy_check(driver)
target_link_libraries(driver migraphx_all_targets migraphx_onnx migraphx_tf) target_link_libraries(driver migraphx_all_targets migraphx_onnx migraphx_tf)
rocm_install_targets( rocm_install_targets(
......
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