Skip to content

Commit 9fee723

Browse files
authored
Merge pull request #2019 from ROCmSoftwarePlatform/rel57_workitems
2 parents 0bc6089 + 97cc1df commit 9fee723

File tree

103 files changed

+2270
-832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2270
-832
lines changed

.githooks/pre-commit

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,7 @@
44
# are installed, and if so, uses the installed version to format
55
# the staged changes.
66

7-
base=clang-format-10
8-
format=""
9-
yapf_base=yapf
10-
yapf_format=""
11-
12-
use_yapf=true
13-
14-
# Redirect output to stderr.
15-
exec 1>&2
16-
17-
# check if clang-format is installed
18-
type "$base" >/dev/null 2>&1 && format="$base"
19-
20-
# no versions of clang-format are installed
21-
if [ -z "$format" ]
22-
then
23-
echo "$base is not installed. Pre-commit hook will not be executed."
24-
exit 0
25-
fi
26-
27-
# check if yapf is installed
28-
type "$yapf_base" >/dev/null 2>&1 && yapf_format="$yapf_base"
29-
30-
# no versions of yapf are installed
31-
if [ -z "$yapf_format" ]
32-
then
33-
echo "$yapf_base is not installed. Pre-commit hook for python files will not be executed"
34-
use_yapf=false
35-
fi
36-
377
# Do everything from top - level
388
cd $(git rev-parse --show-toplevel)
399

40-
if git rev-parse --verify HEAD >/dev/null 2>&1
41-
then
42-
against=HEAD
43-
else
44-
# Initial commit: diff against an empty tree object
45-
against=16bbb57
46-
fi
47-
48-
# do the formatting
49-
for file in $(git diff-index --cached --name-only $against | grep -E '\.h$|\.hpp$|\.cpp$|\.cl$|\.c$|\.h\.in$|\.hpp\.in$|\.cpp\.in$|\.py$')
50-
do
51-
if [ -e "$file" ]
52-
then
53-
if [ $(echo $file | grep -E '\.py$') ]
54-
then
55-
if $use_yapf
56-
then
57-
echo "$yapf_format $file"
58-
"$yapf_format" -i "$file"
59-
fi
60-
else
61-
echo "$format $file"
62-
"$format" -i -style=file "$file"
63-
fi
64-
fi
65-
done
10+
python3 tools/format.py -q -i HEAD

.github/workflows/ci.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ jobs:
144144
runs-on: ROCM-Ubuntu
145145
steps:
146146
- uses: actions/checkout@v3
147+
with:
148+
fetch-depth: 0
147149

148150
# In this step, this action saves a list of existing images,
149151
# the cache is created without them in the post run.
@@ -164,19 +166,8 @@ jobs:
164166
shell: bash -c "docker run -i -v=$GITHUB_WORKSPACE:/data -w /data migraphx bash < {0}"
165167
run: |
166168
set -e
167-
find . -iname '*.h' \
168-
-o -iname '*.hpp' \
169-
-o -iname '*.cpp' \
170-
-o -iname '*.h.in' \
171-
-o -iname '*.hpp.in' \
172-
-o -iname '*.cpp.in' \
173-
-o -iname '*.cl' \
174-
-o -iname '*.c' \
175-
| grep -v 'build/' \
176-
| xargs -n 1 -P 1 -I{} -t sh -c 'clang-format-10 -style=file {} | diff - {}'
177-
find . -iname '*.py' \
178-
| grep -v 'build/' \
179-
| xargs -n 1 -P 1 -I{} -t sh -c 'yapf {} | diff - {}'
169+
git config --global --add safe.directory /data
170+
python3 tools/format.py origin/${{ github.event_name == 'pull_request' && github.base_ref || 'develop' }}
180171
181172
pyflakes:
182173
runs-on: ubuntu-20.04
@@ -323,6 +314,7 @@ jobs:
323314
env:
324315
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
325316
run: |
317+
set +x
326318
gh extension install actions/gh-actions-cache --pin v1.0.1
327319
gh actions-cache delete ${{ steps.ccache_restore.outputs.cache-matched-key }} --confirm
328320
@@ -439,6 +431,7 @@ jobs:
439431
env:
440432
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
441433
run: |
434+
set +x
442435
gh extension install actions/gh-actions-cache
443436
gh actions-cache delete ${{ steps.ccache_restore_fpga.outputs.cache-matched-key }} --confirm
444437
continue-on-error: true

.github/workflows/performance.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
rocm_release:
1313
description: ROCm Version
1414
required: true
15-
default: '5.5'
15+
default: '5.6'
1616
performance_reports_repo:
1717
description: Repository where performance reports are stored
1818
required: true
@@ -42,13 +42,15 @@ on:
4242
required: true
4343
default: '-r'
4444

45-
concurrency: "perftest-${{ github.head_ref || github.base_ref || 'schedule' }}"
45+
concurrency:
46+
group: "perftest-${{ github.head_ref || github.base_ref || 'schedule' }}"
47+
cancel-in-progress: true
4648

4749
jobs:
4850
release:
4951
uses: ROCmSoftwarePlatform/migraphx-benchmark/.github/workflows/perf-test.yml@main
5052
with:
51-
rocm_release: ${{ github.event.inputs.rocm_release || '5.5' }}
53+
rocm_release: ${{ github.event.inputs.rocm_release || '5.6' }}
5254
result_number: ${{ github.event.inputs.result_number || '10' }}
5355
flags: ${{ github.event.inputs.flags || '-r' }}
5456
performance_reports_repo: ${{ github.event.inputs.performance_reports_repo || 'ROCmSoftwarePlatform/migraphx-reports' }}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,13 @@ docs/_images
7070
docs/_static
7171
docs/_templates
7272
docs/.doxygen/docBin
73+
docs/.doxygen/DoxygenWarningLog.txt
7374
docs/_doxygen
75+
docs/html
7476
/_readthedocs
77+
78+
# JetBrains config directories (ignoring symlinks)
79+
.idea/
80+
cmake-build*/
81+
build*/
82+

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ RUN sh -c "echo 'Package: *\nPin: release o=repo.radeon.com\nPin-priority: 600'
1919
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
2020
apt-utils \
2121
build-essential \
22-
clang-format-10 \
2322
cmake \
2423
curl \
2524
doxygen \
@@ -97,7 +96,8 @@ RUN /download_models.sh && rm /download_models.sh
9796
# Install latest ccache version
9897
RUN cget -p $PREFIX install facebook/zstd@v1.4.5 -X subdir -DCMAKE_DIR=build/cmake
9998
RUN cget -p $PREFIX install ccache@v4.1 -DENABLE_TESTING=OFF
100-
RUN cget -p /opt/cmake install kitware/cmake@v3.24.3
99+
RUN cget -p /opt/cmake install kitware/cmake@v3.26.4
100+
101101

102102
COPY ./test/onnx/.onnxrt-commit /
103103

Jenkinsfile

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@ def rocmtestnode(Map conf) {
1515
def compiler = bconf.get("compiler", "/opt/rocm/llvm/bin/clang++")
1616
def flags = bconf.get("flags", "")
1717
def gpu_debug = bconf.get("gpu_debug", "0")
18-
def hiprtc_workarounds = bconf.get("hiprtc_workarounds", "0")
1918
def cmd = """
2019
ulimit -c unlimited
2120
echo "leak:dnnl::impl::malloc" > suppressions.txt
2221
export LSAN_OPTIONS="suppressions=\$(pwd)/suppressions.txt"
2322
export MIGRAPHX_GPU_DEBUG=${gpu_debug}
24-
export MIGRAPHX_ENABLE_HIPRTC_WORKAROUNDS=${hiprtc_workarounds}
2523
export CXX=${compiler}
2624
export CXXFLAGS='-Werror'
2725
env
2826
rm -rf build
2927
mkdir build
3028
cd build
31-
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_DEV=On ${flags} ..
29+
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_DEV=On -DCMAKE_EXECUTE_PROCESS_COMMAND_ECHO=STDOUT ${flags} ..
3230
git diff
3331
git diff-index --quiet HEAD || (echo "Git repo is not clean after running cmake." && exit 1)
3432
make -j\$(nproc) generate VERBOSE=1
@@ -90,9 +88,9 @@ def rocmnodename(name) {
9088
} else if(name == "navi21") {
9189
node_name = "${rocmtest_name} && navi21";
9290
} else if(name == "mi100+") {
93-
node_name = "${rocmtest_name} && (gfx908 || gfx90a)";
94-
} else if(name == "anygpu") {
95-
node_name = "${rocmtest_name} && (gfx908 || gfx90a || vega)";
91+
node_name = "${rocmtest_name} && (gfx908 || gfx90a) && !vm";
92+
} else if(name == "cdna") {
93+
node_name = "${rocmtest_name} && (gfx908 || gfx90a || vega20) && !vm";
9694
} else if(name == "nogpu") {
9795
node_name = "${rocmtest_name} && nogpu";
9896
}
@@ -105,30 +103,22 @@ def rocmnode(name, body) {
105103
}
106104
}
107105

108-
rocmtest clang_debug: rocmnode('vega') { cmake_build ->
109-
stage('Hip Clang Debug') {
106+
rocmtest clang_debug: rocmnode('cdna') { cmake_build ->
107+
stage('hipRTC Debug') {
110108
def sanitizers = "undefined"
111109
def debug_flags = "-g -O2 -fsanitize=${sanitizers} -fno-sanitize-recover=${sanitizers}"
112-
cmake_build(flags: "-DCMAKE_BUILD_TYPE=debug -DMIGRAPHX_ENABLE_PYTHON=Off -DCMAKE_CXX_FLAGS_DEBUG='${debug_flags}' -DCMAKE_C_FLAGS_DEBUG='${debug_flags}'")
110+
cmake_build(flags: "-DCMAKE_BUILD_TYPE=debug -DMIGRAPHX_ENABLE_PYTHON=Off -DCMAKE_CXX_FLAGS_DEBUG='${debug_flags}' -DCMAKE_C_FLAGS_DEBUG='${debug_flags}' -DMIGRAPHX_USE_HIPRTC=On", gpu_debug: true)
113111
}
114-
}, clang_gpu_debug: rocmnode('vega') { cmake_build ->
115-
stage('Hip Clang GPU Debug') {
116-
cmake_build(flags: "-DCMAKE_BUILD_TYPE=release", gpu_debug: true)
117-
}
118-
}, clang_release: rocmnode('vega') { cmake_build ->
112+
}, clang_release: rocmnode('cdna') { cmake_build ->
119113
stage('Hip Clang Release') {
120114
cmake_build(flags: "-DCMAKE_BUILD_TYPE=release")
121115
stash includes: 'build/*.deb', name: 'migraphx-package'
122116
}
123-
}, hiprtc_gpu_debug: rocmnode('vega') { cmake_build ->
124-
stage('HipRTC GPU Debug') {
125-
cmake_build(flags: "-DCMAKE_BUILD_TYPE=release -DMIGRAPHX_USE_HIPRTC=On", gpu_debug: true, hiprtc_workarounds: true)
126-
}
127-
}, all_targets_debug : rocmnode('vega') { cmake_build ->
117+
}, all_targets_debug : rocmnode('cdna') { cmake_build ->
128118
stage('All targets Release') {
129119
cmake_build(flags: "-DCMAKE_BUILD_TYPE=release -DMIGRAPHX_ENABLE_GPU=On -DMIGRAPHX_ENABLE_CPU=On -DMIGRAPHX_ENABLE_FPGA=On")
130120
}
131-
}, mlir_debug: rocmnode('vega') { cmake_build ->
121+
}, mlir_debug: rocmnode('cdna') { cmake_build ->
132122
stage('MLIR Debug') {
133123
withEnv(['MIGRAPHX_ENABLE_MLIR=1']) {
134124
def sanitizers = "undefined"
@@ -165,7 +155,7 @@ def onnxnode(name, body) {
165155
}
166156
}
167157

168-
rocmtest onnx: onnxnode('anygpu') { cmake_build ->
158+
rocmtest onnx: onnxnode('cdna') { cmake_build ->
169159
stage("Onnx runtime") {
170160
sh '''
171161
apt install half

cmake/Embed.cmake

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@
2424
find_program(EMBED_LD ld)
2525
find_program(EMBED_OBJCOPY objcopy)
2626

27-
if(LINUX)
28-
option(EMBED_USE_LD "Use ld to embed data files" ON)
29-
else()
30-
option(EMBED_USE_LD "Use ld to embed data files" OFF)
31-
endif()
27+
option(EMBED_USE_LD "Use ld to embed data files" OFF)
3228

3329
function(wrap_string)
3430
set(options)
@@ -60,8 +56,8 @@ endfunction()
6056

6157
function(generate_embed_source EMBED_NAME)
6258
set(options)
63-
set(oneValueArgs SRC HEADER)
64-
set(multiValueArgs OBJECTS SYMBOLS)
59+
set(oneValueArgs SRC HEADER RELATIVE)
60+
set(multiValueArgs OBJECTS SYMBOLS FILES)
6561

6662
cmake_parse_arguments(PARSE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
6763

@@ -78,6 +74,8 @@ function(generate_embed_source EMBED_NAME)
7874
foreach(idx RANGE ${LEN})
7975
list(GET PARSE_SYMBOLS ${idx} SYMBOL)
8076
list(GET PARSE_OBJECTS ${idx} OBJECT)
77+
list(GET PARSE_FILES ${idx} FILE)
78+
8179
set(START_SYMBOL "_binary_${SYMBOL}_start")
8280
set(END_SYMBOL "_binary_${SYMBOL}_end")
8381
if(EMBED_USE_LD)
@@ -92,9 +90,11 @@ function(generate_embed_source EMBED_NAME)
9290
")
9391
endif()
9492

95-
# TODO: Should use NAME_WLE
96-
get_filename_component(BASE_NAME "${OBJECT}" NAME)
97-
string(REGEX REPLACE ".[A-Za-z0-9_]+$" "" BASE_NAME ${BASE_NAME})
93+
if(PARSE_RELATIVE)
94+
file(RELATIVE_PATH BASE_NAME ${PARSE_RELATIVE} "${FILE}")
95+
else()
96+
get_filename_component(BASE_NAME "${FILE}" NAME)
97+
endif()
9898

9999
string(APPEND INIT_KERNELS "
100100
{ \"${BASE_NAME}\", { ${START_SYMBOL}, ${END_SYMBOL}} },
@@ -162,6 +162,11 @@ function(embed_file OUTPUT_FILE OUTPUT_SYMBOL FILE)
162162
endfunction()
163163

164164
function(add_embed_library EMBED_NAME)
165+
set(options)
166+
set(oneValueArgs RELATIVE)
167+
set(multiValueArgs)
168+
cmake_parse_arguments(PARSE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
169+
165170
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/embed)
166171
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/embed/${EMBED_NAME})
167172
set(EMBED_DIR ${CMAKE_CURRENT_BINARY_DIR}/embed/${EMBED_NAME})
@@ -171,15 +176,26 @@ function(add_embed_library EMBED_NAME)
171176
set(OUTPUT_FILES)
172177
set(SYMBOLS)
173178
message(STATUS "Embedding files")
174-
foreach(FILE ${ARGN})
179+
foreach(FILE ${PARSE_UNPARSED_ARGUMENTS})
175180
embed_file(OUTPUT_FILE OUTPUT_SYMBOL ${FILE})
176181
list(APPEND OUTPUT_FILES ${OUTPUT_FILE})
177182
list(APPEND SYMBOLS ${OUTPUT_SYMBOL})
178183
endforeach()
179184
message(STATUS "Generating embedding library ${EMBED_NAME}")
180-
generate_embed_source(${EMBED_NAME} SRC ${SRC_FILE} HEADER ${HEADER_FILE} OBJECTS ${OUTPUT_FILES} SYMBOLS ${SYMBOLS})
181-
add_library(${EMBED_NAME} STATIC ${OUTPUT_FILES} "${SRC_FILE}")
182-
target_include_directories(${EMBED_NAME} PUBLIC "${EMBED_DIR}/include")
183-
target_compile_options(${EMBED_NAME} PRIVATE -Wno-reserved-identifier -Wno-extern-initializer -Wno-missing-variable-declarations)
184-
set_target_properties(${EMBED_NAME} PROPERTIES POSITION_INDEPENDENT_CODE On)
185+
generate_embed_source(${EMBED_NAME} SRC ${SRC_FILE} HEADER ${HEADER_FILE} OBJECTS ${OUTPUT_FILES} SYMBOLS ${SYMBOLS} RELATIVE ${PARSE_RELATIVE} FILES ${PARSE_UNPARSED_ARGUMENTS})
186+
187+
set(INTERNAL_EMBED_LIB embed_lib_${EMBED_NAME})
188+
add_library(${INTERNAL_EMBED_LIB} OBJECT "${SRC_FILE}")
189+
target_include_directories(${INTERNAL_EMBED_LIB} PRIVATE "${EMBED_DIR}/include")
190+
target_compile_options(${INTERNAL_EMBED_LIB} PRIVATE -Wno-reserved-identifier -Wno-extern-initializer -Wno-missing-variable-declarations)
191+
set_target_properties(${INTERNAL_EMBED_LIB} PROPERTIES POSITION_INDEPENDENT_CODE On)
192+
193+
add_library(${EMBED_NAME} INTERFACE)
194+
if(EMBED_USE_LD)
195+
target_sources(${EMBED_NAME} INTERFACE ${OUTPUT_FILES})
196+
else()
197+
target_sources(${INTERNAL_EMBED_LIB} PRIVATE ${OUTPUT_FILES})
198+
endif()
199+
target_sources(${EMBED_NAME} INTERFACE $<TARGET_OBJECTS:${INTERNAL_EMBED_LIB}>)
200+
target_include_directories(${EMBED_NAME} INTERFACE "${EMBED_DIR}/include")
185201
endfunction()

cmake/PythonModules.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,22 @@ macro(find_python version)
3838
find_program(PYTHON_CONFIG_${version} python${version}-config)
3939
if(EXISTS ${PYTHON_CONFIG_${version}})
4040
py_exec(COMMAND ${PYTHON_CONFIG_${version}} --includes OUTPUT_VARIABLE _python_include_args)
41+
execute_process(COMMAND ${PYTHON_CONFIG_${version}} --ldflags --embed OUTPUT_VARIABLE _python_ldflags_args RESULT_VARIABLE _python_ldflags_result)
42+
if(NOT _python_ldflags_result EQUAL 0)
43+
py_exec(COMMAND ${PYTHON_CONFIG_${version}} --ldflags OUTPUT_VARIABLE _python_ldflags_args)
44+
endif()
4145
separate_arguments(_python_includes UNIX_COMMAND "${_python_include_args}")
46+
separate_arguments(_python_ldflags UNIX_COMMAND "${_python_ldflags_args}")
4247
string(REPLACE "-I" "" _python_includes "${_python_includes}")
4348
add_library(python${version}::headers INTERFACE IMPORTED GLOBAL)
4449
set_target_properties(python${version}::headers PROPERTIES
4550
INTERFACE_INCLUDE_DIRECTORIES "${_python_includes}"
4651
)
52+
add_library(python${version}::runtime INTERFACE IMPORTED GLOBAL)
53+
set_target_properties(python${version}::runtime PROPERTIES
54+
INTERFACE_LINK_OPTIONS "${_python_ldflags}"
55+
INTERFACE_LINK_LIBRARIES python${version}::headers
56+
)
4757
py_exec(COMMAND ${PYTHON_CONFIG_${version}} --prefix OUTPUT_VARIABLE _python_prefix)
4858
string(STRIP "${_python_prefix}" _python_prefix)
4959
set(PYTHON_${version}_EXECUTABLE "${_python_prefix}/bin/python${version}" CACHE PATH "")

docs/driver/read.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Print out program in text format.
8282

8383
Print out program in binary format.
8484

85+
.. option:: --py
86+
87+
Print out program using python API.
88+
8589
.. option:: --output, -o [std::string]
8690

8791
Output to file.

hip-clang.docker

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ RUN sh -c 'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/5.6
1212
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
1313
apt-utils \
1414
build-essential \
15-
clang-format-10 \
1615
cmake \
1716
curl \
1817
doxygen \

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
google/protobuf@v3.11.0 -DCMAKE_POSITION_INDEPENDENT_CODE=On -X subdir -Dprotobuf_BUILD_TESTS=Off
2525
nlohmann/json@v3.8.0
2626
live-clones/blaze@v3.8 -X header -DHEADER_DIR=blaze -H sha256:d0ff011f47538285178908ea5f2cab46bb6a8f55b1edb6e03224a82dbc1a3212
27-
ROCmSoftwarePlatform/half@rocm-5.4.2
27+
ROCmSoftwarePlatform/half@rocm-5.6.0
2828
pybind/pybind11@d159a563383d10c821ba7b2a71905d1207db6de4 --build
2929
msgpack/msgpack-c@cpp-3.3.0 -DMSGPACK_BUILD_TESTS=Off
3030
sqlite3@3.17 -DCMAKE_POSITION_INDEPENDENT_CODE=On

0 commit comments

Comments
 (0)