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
cce35871
Unverified
Commit
cce35871
authored
Apr 10, 2023
by
Umang Yadav
Committed by
GitHub
Apr 10, 2023
Browse files
Always build ref target when building MIGraphX (#1636)
parent
d3eb5609
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
12 deletions
+14
-12
src/driver/main.cpp
src/driver/main.cpp
+4
-4
test/CMakeLists.txt
test/CMakeLists.txt
+2
-2
test/api/CMakeLists.txt
test/api/CMakeLists.txt
+3
-3
test/targets.cpp
test/targets.cpp
+5
-3
No files found.
src/driver/main.cpp
View file @
cce35871
...
@@ -388,12 +388,12 @@ struct compiler_target
...
@@ -388,12 +388,12 @@ struct compiler_target
{
{
#ifdef HAVE_GPU
#ifdef HAVE_GPU
std
::
string
target_name
=
"gpu"
;
std
::
string
target_name
=
"gpu"
;
#elif HAVE_CPU
#elif
defined(
HAVE_CPU
)
std
::
string
target_name
=
"cpu"
;
std
::
string
target_name
=
"cpu"
;
#elif HAVE_FPGA
#elif
defined(
HAVE_FPGA
)
std
::
string
target_name
=
"fpga"
std
::
string
target_name
=
"fpga"
;
#else
#else
std
::
string
target_name
=
"ref"
std
::
string
target_name
=
"ref"
;
#endif
#endif
void
parse
(
argument_parser
&
ap
)
void
parse
(
argument_parser
&
ap
)
...
...
test/CMakeLists.txt
View file @
cce35871
...
@@ -110,7 +110,7 @@ function(add_test_executable TEST_NAME)
...
@@ -110,7 +110,7 @@ function(add_test_executable TEST_NAME)
add_test_command
(
${
TEST_NAME
}
${
TEST_COMMAND
}
)
add_test_command
(
${
TEST_NAME
}
${
TEST_COMMAND
}
)
add_dependencies
(
tests
${
TEST_NAME
}
)
add_dependencies
(
tests
${
TEST_NAME
}
)
add_dependencies
(
check
${
TEST_NAME
}
)
add_dependencies
(
check
${
TEST_NAME
}
)
target_link_libraries
(
${
TEST_NAME
}
migraphx migraphx_onnx
)
target_link_libraries
(
${
TEST_NAME
}
migraphx migraphx_onnx
migraphx_ref
)
target_include_directories
(
${
TEST_NAME
}
PUBLIC include
)
target_include_directories
(
${
TEST_NAME
}
PUBLIC include
)
endfunction
(
add_test_executable
)
endfunction
(
add_test_executable
)
...
@@ -163,7 +163,7 @@ foreach(ONNX_TEST ${ONNX_TESTS})
...
@@ -163,7 +163,7 @@ foreach(ONNX_TEST ${ONNX_TESTS})
set
(
TEST_NAME test_
${
BASE_NAME
}
)
set
(
TEST_NAME test_
${
BASE_NAME
}
)
add_executable
(
${
TEST_NAME
}
${
ONNX_TEST
}
)
add_executable
(
${
TEST_NAME
}
${
ONNX_TEST
}
)
rocm_clang_tidy_check
(
${
TEST_NAME
}
)
rocm_clang_tidy_check
(
${
TEST_NAME
}
)
target_link_libraries
(
${
TEST_NAME
}
migraphx_onnx
)
target_link_libraries
(
${
TEST_NAME
}
migraphx_onnx
migraphx_ref
)
target_include_directories
(
${
TEST_NAME
}
PUBLIC include
)
target_include_directories
(
${
TEST_NAME
}
PUBLIC include
)
add_test
(
NAME
${
TEST_NAME
}
COMMAND $<TARGET_FILE:
${
TEST_NAME
}
> WORKING_DIRECTORY
${
TEST_ONNX_DIR
}
)
add_test
(
NAME
${
TEST_NAME
}
COMMAND $<TARGET_FILE:
${
TEST_NAME
}
> WORKING_DIRECTORY
${
TEST_ONNX_DIR
}
)
add_dependencies
(
tests
${
TEST_NAME
}
)
add_dependencies
(
tests
${
TEST_NAME
}
)
...
...
test/api/CMakeLists.txt
View file @
cce35871
...
@@ -25,7 +25,7 @@ function(add_api_test TEST_NAME TEST_SRC TEST_DIR)
...
@@ -25,7 +25,7 @@ function(add_api_test TEST_NAME TEST_SRC TEST_DIR)
set
(
NAME test_api_
${
TEST_NAME
}
)
set
(
NAME test_api_
${
TEST_NAME
}
)
add_executable
(
${
NAME
}
EXCLUDE_FROM_ALL
${
TEST_SRC
}
)
add_executable
(
${
NAME
}
EXCLUDE_FROM_ALL
${
TEST_SRC
}
)
rocm_clang_tidy_check
(
${
NAME
}
)
rocm_clang_tidy_check
(
${
NAME
}
)
target_link_libraries
(
${
NAME
}
migraphx_c migraphx
)
target_link_libraries
(
${
NAME
}
migraphx_c migraphx
migraphx_all_targets
)
target_include_directories
(
${
NAME
}
PUBLIC ../include
)
target_include_directories
(
${
NAME
}
PUBLIC ../include
)
add_test
(
NAME
${
NAME
}
COMMAND $<TARGET_FILE:
${
NAME
}
> WORKING_DIRECTORY
${
TEST_DIR
}
)
add_test
(
NAME
${
NAME
}
COMMAND $<TARGET_FILE:
${
NAME
}
> WORKING_DIRECTORY
${
TEST_DIR
}
)
add_dependencies
(
tests
${
NAME
}
)
add_dependencies
(
tests
${
NAME
}
)
...
@@ -59,7 +59,7 @@ if(MIGRAPHX_ENABLE_GPU)
...
@@ -59,7 +59,7 @@ if(MIGRAPHX_ENABLE_GPU)
list
(
APPEND CMAKE_PREFIX_PATH /opt/rocm
)
list
(
APPEND CMAKE_PREFIX_PATH /opt/rocm
)
find_package
(
hip
)
find_package
(
hip
)
add_api_test
(
gpu test_gpu.cpp
${
TEST_ONNX_DIR
}
)
add_api_test
(
gpu test_gpu.cpp
${
TEST_ONNX_DIR
}
)
target_link_libraries
(
test_api_gpu
hip::host
)
target_link_libraries
(
test_api_gpu
)
add_api_test
(
custom_op_gpu test_custom_op_gpu.cpp
${
TEST_ONNX_DIR
}
)
add_api_test
(
custom_op_gpu test_custom_op_gpu.cpp
${
TEST_ONNX_DIR
}
)
target_link_libraries
(
test_api_custom_op_gpu
hip::host
)
target_link_libraries
(
test_api_custom_op_gpu
)
endif
()
endif
()
test/targets.cpp
View file @
cce35871
...
@@ -41,10 +41,12 @@ TEST_CASE(make_invalid_target)
...
@@ -41,10 +41,12 @@ TEST_CASE(make_invalid_target)
TEST_CASE
(
targets
)
TEST_CASE
(
targets
)
{
{
// GCC doesn't load libmigraphx_ref unless necesssary even though it is linked to the test.
// Force it to load by making ref target
#if defined(__GNUC__) && !defined(__clang__)
auto
ref_target
=
migraphx
::
make_target
(
"ref"
);
#endif
auto
ts
=
migraphx
::
get_targets
();
auto
ts
=
migraphx
::
get_targets
();
EXPECT
(
ts
.
size
()
==
0
);
auto
ref_t
=
migraphx
::
make_target
(
"ref"
);
ts
=
migraphx
::
get_targets
();
EXPECT
(
ts
.
size
()
==
1
);
EXPECT
(
ts
.
size
()
==
1
);
}
}
...
...
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