Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
80eb522f
Commit
80eb522f
authored
Oct 05, 2023
by
Artur Wojcik
Browse files
update uif2-initial with the recent changes
parent
bba8276d
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
48 deletions
+83
-48
tools/CMakeLists.txt
tools/CMakeLists.txt
+1
-5
tools/generate.cmake
tools/generate.cmake
+82
-0
tools/generate.cmd
tools/generate.cmd
+0
-43
No files found.
tools/CMakeLists.txt
View file @
80eb522f
...
...
@@ -22,8 +22,4 @@
# THE SOFTWARE.
#####################################################################################
if
(
WIN32
)
add_custom_target
(
generate generate.cmd WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
else
()
add_custom_target
(
generate bash
${
CMAKE_CURRENT_SOURCE_DIR
}
/generate.sh
)
endif
()
\ No newline at end of file
add_custom_target
(
generate
${
CMAKE_COMMAND
}
-P generate.cmake WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
tools/generate.
sh
→
tools/generate.
cmake
100755 → 100644
View file @
80eb522f
...
...
@@ -21,23 +21,62 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#####################################################################################
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
CLANG_FORMAT
=
/opt/rocm/llvm/bin/clang-format
SRC_DIR
=
$DIR
/../src
PYTHON
=
python3
if
type
-p
python3.6
>
/dev/null
;
then
PYTHON
=
python3.6
fi
if
type
-p
python3.8
>
/dev/null
;
then
PYTHON
=
python3.8
fi
ls
-1
$DIR
/include/ | xargs
-n
1
-P
$(
nproc
)
-I
{}
-t
bash
-c
"
$PYTHON
$DIR
/te.py
$DIR
/include/{} |
$CLANG_FORMAT
-style=file >
$SRC_DIR
/include/migraphx/{}"
function
api
{
$PYTHON
$DIR
/api.py
$SRC_DIR
/api/migraphx.py
$1
|
$CLANG_FORMAT
-style
=
file
>
$2
}
find_program
(
CLANG_FORMAT clang-format PATHS /opt/rocm/llvm $ENV{HIP_PATH}
)
if
(
NOT CLANG_FORMAT
)
message
(
WARNING
"clang-format not found - skipping 'generate' target!"
)
return
()
endif
()
api
$DIR
/api/migraphx.h
$SRC_DIR
/api/include/migraphx/migraphx.h
echo
"Finished generating header migraphx.h"
api
$DIR
/api/api.cpp
$SRC_DIR
/api/api.cpp
echo
"Finished generating source api.cpp "
cmake_path
(
NATIVE_PATH CLANG_FORMAT NORMALIZE __clang_format
)
if
(
WIN32
)
set
(
__clang_format
"C:
${
__clang_format
}
"
)
endif
()
find_package
(
Python 3 COMPONENTS Interpreter
)
if
(
NOT Python_EXECUTABLE
)
message
(
WARNING
"Python 3 interpreter not found - skipping 'generate' target!"
)
return
()
endif
()
cmake_path
(
SET SRC_DIR NORMALIZE
${
CMAKE_CURRENT_LIST_DIR
}
/../src
)
file
(
GLOB __files
${
CMAKE_CURRENT_LIST_DIR
}
/include/*.hpp
)
foreach
(
__file
${
__files
}
)
cmake_path
(
NATIVE_PATH __file NORMALIZE __input_native_path
)
cmake_path
(
GET __file FILENAME __file_name
)
cmake_path
(
SET __output_path
"
${
SRC_DIR
}
/include/migraphx/
${
__file_name
}
"
)
cmake_path
(
NATIVE_PATH __output_path __output_native_path
)
message
(
"Generating
${
__output_native_path
}
"
)
execute_process
(
COMMAND
${
Python_EXECUTABLE
}
te.py
${
__input_native_path
}
|
${
__clang_format
}
-style=file
OUTPUT_FILE
${
__output_native_path
}
ERROR_VARIABLE __error_code
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
if
(
__error_code
)
message
(
WARNING
"
${
__error_code
}
"
)
endif
()
endforeach
()
function
(
generate_api __input_path __output_path
)
cmake_path
(
NATIVE_PATH __output_path NORMALIZE __output_native_path
)
cmake_path
(
NATIVE_PATH __input_path NORMALIZE __input_native_path
)
cmake_path
(
SET __migraphx_py_path
"
${
SRC_DIR
}
/api/migraphx.py"
)
cmake_path
(
NATIVE_PATH __migraphx_py_path __migraphx_py_native_path
)
cmake_path
(
SET __api_py_path
"
${
CMAKE_CURRENT_LIST_DIR
}
/api.py"
)
cmake_path
(
NATIVE_PATH __api_py_path __api_py_native_path
)
message
(
"Generating
${
__output_native_path
}
"
)
execute_process
(
COMMAND
${
Python_EXECUTABLE
}
${
__api_py_native_path
}
${
__migraphx_py_native_path
}
${
__input_native_path
}
|
${
__clang_format
}
-style=file
OUTPUT_FILE
${
__output_native_path
}
ERROR_VARIABLE __error_code
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
if
(
__error_code
)
message
(
WARNING
"
${
__error_code
}
"
)
endif
()
endfunction
()
generate_api
(
"
${
CMAKE_CURRENT_LIST_DIR
}
/api/migraphx.h"
"
${
SRC_DIR
}
/api/include/migraphx/migraphx.h"
)
generate_api
(
"
${
CMAKE_CURRENT_LIST_DIR
}
/api/api.cpp"
"
${
SRC_DIR
}
/api/api.cpp"
)
tools/generate.cmd
deleted
100644 → 0
View file @
bba8276d
::
:: The MIT License (MIT)
::
:: Copyright (c) 2015-2022 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
:: in the Software without restriction, including without limitation the rights
:: to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
:: copies of the Software, and to permit persons to whom the Software is
:: furnished to do so, subject to the following conditions:
::
:: The above copyright notice and this permission notice shall be included in
:: all copies or substantial portions of the Software.
::
:: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
:: IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
:: FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
:: AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
:: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
:: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
:: THE SOFTWARE.
@echo
off
if
not
defined
CLANG_FORMAT_10
(
set
CLANG_FORMAT_10
=
C
:\Program
Files
\LLVM\10.0\bin\clang
-format
.exe
)
python
--version
>
nul
2
>&
1
if
errorlevel
1
(
echo
Error
^:
Python
not
installed
!
goto
:eof
)
for
/f
"usebackq delims=|"
%%f
in
(
`dir /b "
%cd%
\include"`
)
do
(
python
%cd%
\te.py
%cd%
\include\
%%f
|
"
%CLANG
_FORMAT_10
%
"
-style
=
file
>
%cd%
\..\src\include\migraphx\
%%f
)
call
:api
%cd%
\api\migraphx.h
%cd%
\..\src\api\include\migraphx\migraphx.h
echo
Finished
generating
header
migraphx
.h
call
:api
%cd%
\api\api.cpp
%cd%
\..\src\api\api.cpp
echo
Finished
generating
source
api
.h
goto
:eof
:api
python
%cd%
\api.py
%cd%
\..\src\api\migraphx.py
%
~
1
|
"
%CLANG
_FORMAT_10
%
"
-style
=
file
>
%
~
2
exit
/b
0
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment