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
ca052a91
Commit
ca052a91
authored
Oct 31, 2023
by
Artur Wojcik
Browse files
Merge branch 'develop' into uif2-initial
parents
bc7ac032
254c2a78
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
31 additions
and
49 deletions
+31
-49
CMakeLists.txt
CMakeLists.txt
+11
-3
src/CMakeLists.txt
src/CMakeLists.txt
+6
-4
src/include/migraphx/op/allocate.hpp
src/include/migraphx/op/allocate.hpp
+2
-4
src/quantization.cpp
src/quantization.cpp
+1
-1
src/targets/cpu/lowering.cpp
src/targets/cpu/lowering.cpp
+1
-14
src/targets/gpu/CMakeLists.txt
src/targets/gpu/CMakeLists.txt
+1
-2
src/targets/gpu/hiprtc/CMakeLists.txt
src/targets/gpu/hiprtc/CMakeLists.txt
+0
-3
src/targets/gpu/prefuse_ops.cpp
src/targets/gpu/prefuse_ops.cpp
+6
-10
test/api/CMakeLists.txt
test/api/CMakeLists.txt
+0
-6
test/op_shape_test.cpp
test/op_shape_test.cpp
+3
-2
No files found.
CMakeLists.txt
View file @
ca052a91
...
...
@@ -112,9 +112,17 @@ set(MIGRAPHX_ENABLE_CPU Off CACHE BOOL "")
# Disable fpga backend by default
set
(
MIGRAPHX_ENABLE_FPGA Off CACHE BOOL
""
)
set
(
CMAKE_CXX_STANDARD 17
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
set
(
CMAKE_CXX_EXTENSIONS OFF
)
if
(
WIN32
)
add_compile_definitions
(
$<$<COMPILE_LANGUAGE:C,CXX>:_CRT_SECURE_NO_WARNINGS>
$<$<COMPILE_LANGUAGE:C,CXX>:_USE_MATH_DEFINES>
)
endif
()
if
(
MSVC
)
add_compile_options
(
$<$<COMPILE_LANGUAGE:CXX>:/std:c++17>
)
else
()
add_compile_options
(
$<$<COMPILE_LANGUAGE:CXX>:-std=c++17>
)
endif
()
list
(
APPEND CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
include
(
EnableCompilerWarnings
)
...
...
src/CMakeLists.txt
View file @
ca052a91
...
...
@@ -28,7 +28,11 @@ include(ROCMInstallTargets)
include
(
ROCMPackageConfigHelpers
)
include
(
RegisterOp
)
include
(
CheckCXXLinkerFlag
)
if
(
WIN32
)
# Due to compilation crashing, we need to use type-erased matchers on Windows.
add_compile_definitions
(
$<$<COMPILE_LANGUAGE:C,CXX>:MIGRAPHX_USE_TYPE_ERASED_MATCHERS=1>
)
endif
()
add_library
(
migraphx
adjust_allocation.cpp
...
...
@@ -246,9 +250,7 @@ rocm_install_targets(
${
CMAKE_CURRENT_BINARY_DIR
}
/include
)
if
(
WIN32
)
target_compile_definitions
(
migraphx PUBLIC _CRT_SECURE_NO_WARNINGS _USE_MATH_DEFINES
)
else
()
if
(
NOT WIN32
)
check_cxx_linker_flag
(
-lstdc++fs HAS_LIB_STD_FILESYSTEM
)
if
(
HAS_LIB_STD_FILESYSTEM
)
target_link_libraries
(
migraphx PRIVATE -lstdc++fs
)
...
...
src/include/migraphx/op/allocate.hpp
View file @
ca052a91
...
...
@@ -37,6 +37,8 @@ namespace op {
* Static allocate:
* No inputs: `allocate()`
* `this.s` attribute set to the static output shape of the buffer.
* `this.s` attribute can be set to a dynamic output shape; however this will allocate the maximum
* buffer size for that case
*
* Dynamic allocate:
* One input: `allocate(output_dims)`
...
...
@@ -74,10 +76,6 @@ struct allocate
}
else
{
if
(
s
->
dynamic
())
{
MIGRAPHX_THROW
(
"ALLOCATE: dynamic shape attribute and no input"
);
}
migraphx
::
check_shapes
{
inputs
,
*
this
,
false
}.
has
(
0
);
}
return
s
.
value
();
...
...
src/quantization.cpp
View file @
ca052a91
...
...
@@ -147,8 +147,8 @@ void quantize_int8(program& prog,
run_passes
(
prog
,
{
quantize_int8_pass
{
ins_names
,
*
int8_quant_params
},
optimize_module
{},
simplify_qdq
{},
optimize_module
{},
dead_code_elimination
{}});
}
...
...
src/targets/cpu/lowering.cpp
View file @
ca052a91
...
...
@@ -23,7 +23,6 @@
*/
#include <migraphx/cpu/lowering.hpp>
#if !defined(_MSC_VER)
#include <migraphx/instruction.hpp>
#include <migraphx/dfor.hpp>
#include <migraphx/op/identity.hpp>
...
...
@@ -52,15 +51,12 @@
#include <migraphx/cpu/context.hpp>
#include <migraphx/register_op.hpp>
#include <migraphx/make_op.hpp>
#endif
#include <migraphx/program.hpp>
#if !defined(_MSC_VER)
#include <migraphx/tune_axis.hpp>
#include <migraphx/match/layernorm.hpp>
#include <migraphx/match/gelu_erf.hpp>
#include <migraphx/match/gelu_tanh.hpp>
#include <migraphx/matcher.hpp>
#endif
#include <unordered_map>
#include <utility>
#include <iostream>
...
...
@@ -69,7 +65,6 @@ namespace migraphx {
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
cpu
{
#if !defined(_MSC_VER)
template
<
typename
T
>
T
zero
(
const
T
&
)
{
...
...
@@ -450,16 +445,8 @@ struct cpu_apply
return
modl
->
insert_instruction
(
ins
,
make_op
(
"allocate"
,
{{
"shape"
,
to_value
(
s
)}}));
}
};
#endif
void
lowering
::
apply
(
module
&
m
)
const
{
#if !defined(_MSC_VER)
cpu_apply
{
&
m
}.
apply
();
#else
(
void
)
m
;
#endif
}
void
lowering
::
apply
(
module
&
m
)
const
{
cpu_apply
{
&
m
}.
apply
();
}
}
// namespace cpu
}
// namespace MIGRAPHX_INLINE_NS
...
...
src/targets/gpu/CMakeLists.txt
View file @
ca052a91
...
...
@@ -22,8 +22,7 @@
# THE SOFTWARE.
# ####################################################################################
list
(
APPEND CMAKE_PREFIX_PATH /opt/rocm $ENV{ROCM_PATH}
)
find_package
(
hip
)
find_package
(
hip REQUIRED
)
if
(
NOT GPU_TARGETS
)
message
(
FATAL_ERROR
"HIP package is broken and has no GPU_TARGETS, please pass -DGPU_TARGETS=$(/opt/rocm/bin/rocminfo | grep -o -m1 'gfx.*') to cmake to build for your gpu."
)
endif
()
...
...
src/targets/gpu/hiprtc/CMakeLists.txt
View file @
ca052a91
...
...
@@ -25,9 +25,6 @@
add_executable
(
migraphx-hiprtc-driver
main.cpp
)
if
(
WIN32
)
target_compile_definitions
(
migraphx-hiprtc-driver PRIVATE _CRT_SECURE_NO_WARNINGS
)
endif
()
rocm_clang_tidy_check
(
migraphx-hiprtc-driver
)
target_link_libraries
(
migraphx-hiprtc-driver PRIVATE migraphx_gpu
)
add_dependencies
(
migraphx_all_targets migraphx-hiprtc-driver
)
...
...
src/targets/gpu/prefuse_ops.cpp
View file @
ca052a91
...
...
@@ -23,24 +23,19 @@
*/
#include <migraphx/permutation.hpp>
#include <migraphx/gpu/prefuse_ops.hpp>
#if !defined(_MSC_VER)
#include <migraphx/gpu/gemm_softmax_gemm.hpp>
#include <migraphx/match/layernorm.hpp>
#include <migraphx/register_op.hpp>
#endif
#include <migraphx/pass_manager.hpp>
#if !defined(_MSC_VER)
#include <migraphx/dead_code_elimination.hpp>
#if MIGRAPHX_USE_COMPOSABLEKERNEL
#if
def
MIGRAPHX_USE_COMPOSABLEKERNEL
#include <migraphx/gpu/ck.hpp>
#endif
#endif
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
#if !defined(_MSC_VER)
namespace
{
template
<
class
Derived
,
std
::
size_t
N
>
...
...
@@ -129,6 +124,8 @@ struct find_add_layernorm
}
};
#ifdef MIGRAPHX_USE_COMPOSABLEKERNEL
struct
pre_gemm_softmax_gemm
:
gemm_softmax_gemm
{
std
::
string
name
()
const
{
return
"gpu::pre_gemm_softmax_gemm"
;
}
...
...
@@ -182,19 +179,18 @@ struct find_gemm_softmax_gemm
}
};
}
// namespace
#endif
}
// namespace
void
prefuse_ops
::
apply
(
module_pass_manager
&
mpm
)
const
{
#if !defined(_MSC_VER)
match
::
find_matches
(
mpm
.
get_module
(),
find_layernorm
{});
mpm
.
run_pass
(
dead_code_elimination
{});
match
::
find_matches
(
mpm
.
get_module
(),
find_add_layernorm
{});
#ifdef MIHRAPHX_USE_COMPOSABLEKERNEL
if
(
enabled
(
MIGRAPHX_ENABLE_CK
{}))
match
::
find_matches
(
mpm
,
find_gemm_softmax_gemm
{});
#else
(
void
)
mpm
;
#endif
}
...
...
test/api/CMakeLists.txt
View file @
ca052a91
...
...
@@ -30,9 +30,6 @@ function(add_api_test TEST_NAME TEST_SRC TEST_DIR)
add_test
(
NAME
${
NAME
}
COMMAND $<TARGET_FILE:
${
NAME
}
> WORKING_DIRECTORY
${
TEST_DIR
}
)
add_dependencies
(
tests
${
NAME
}
)
add_dependencies
(
check
${
NAME
}
)
if
(
WIN32
)
target_compile_definitions
(
${
NAME
}
PRIVATE _CRT_SECURE_NO_WARNINGS
)
endif
()
endfunction
()
# Workaround: C file dont work with clang-tidy right now, need a fix in rocm-cmake
...
...
@@ -44,9 +41,6 @@ function(add_c_api_test TEST_NAME TEST_SRC TEST_DIR)
add_test
(
NAME
${
NAME
}
COMMAND $<TARGET_FILE:
${
NAME
}
> WORKING_DIRECTORY
${
TEST_DIR
}
)
add_dependencies
(
tests
${
NAME
}
)
add_dependencies
(
check
${
NAME
}
)
if
(
WIN32
)
target_compile_definitions
(
${
NAME
}
PRIVATE _CRT_SECURE_NO_WARNINGS
)
endif
()
endfunction
()
add_api_test
(
array_base test_array_base.cpp
${
TEST_ONNX_DIR
}
)
...
...
test/op_shape_test.cpp
View file @
ca052a91
...
...
@@ -116,11 +116,12 @@ TEST_CASE(allocate_dyn_with_shape_attr)
input
);
}
TEST_CASE
(
allocate_dyn_no_input
_error
)
TEST_CASE
(
allocate_dyn_no_input
)
{
migraphx
::
shape
shape_attr
{
migraphx
::
shape
::
float_type
,
{{
1
,
4
},
{
3
,
3
},
{
4
,
8
,
{
4
,
6
}},
{
4
,
8
},
{
4
,
6
}}};
throws_shape
(
migraphx
::
make_op
(
"allocate"
,
{{
"shape"
,
migraphx
::
to_value
(
shape_attr
)}}));
expect_shape
(
shape_attr
,
migraphx
::
make_op
(
"allocate"
,
{{
"shape"
,
migraphx
::
to_value
(
shape_attr
)}}));
}
TEST_CASE
(
allocate_shape_and_buf_type_error
)
...
...
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