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
3b3fcc16
Commit
3b3fcc16
authored
Jun 01, 2023
by
Artur Wojcik
Browse files
enable compilation on Windows
Signed-off-by:
Artur Wojcik
<
artur.wojcik@amd.com
>
parent
15897dcf
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
305 additions
and
16 deletions
+305
-16
src/targets/gpu/compile_hip.cpp
src/targets/gpu/compile_hip.cpp
+11
-3
src/targets/gpu/hiprtc/main.cpp
src/targets/gpu/hiprtc/main.cpp
+1
-0
src/targets/gpu/kernels/migraphx_kernels.cpp
src/targets/gpu/kernels/migraphx_kernels.cpp
+87
-0
src/targets/gpu/kernels/migraphx_kernels.hpp
src/targets/gpu/kernels/migraphx_kernels.hpp
+38
-0
src/targets/gpu/kernels/resource.h
src/targets/gpu/kernels/resource.h
+64
-0
src/targets/gpu/kernels/resource.rc
src/targets/gpu/kernels/resource.rc
+59
-0
src/tmp_dir.cpp
src/tmp_dir.cpp
+11
-1
test/CMakeLists.txt
test/CMakeLists.txt
+25
-6
test/api/CMakeLists.txt
test/api/CMakeLists.txt
+0
-4
test/include/test.hpp
test/include/test.hpp
+1
-1
test/jit.cpp
test/jit.cpp
+5
-1
test/promote_literals_test.cpp
test/promote_literals_test.cpp
+1
-0
tools/api/api.cpp
tools/api/api.cpp
+1
-0
tools/api/migraphx.h
tools/api/migraphx.h
+1
-0
No files found.
src/targets/gpu/compile_hip.cpp
View file @
3b3fcc16
...
...
@@ -251,8 +251,12 @@ compile_hip_src(const std::vector<src_file>& srcs, std::string params, const std
std
::
cout
<<
std
::
string
(
src
.
content
)
<<
std
::
endl
;
}
}
#ifdef _WIN32
fs
::
path
driver
{
"migraphx-hiprtc-driver.exe"
};
#else
auto
p
=
dynamic_loader
::
path
(
&
compile_hip_src_with_hiprtc
);
auto
driver
=
p
.
parent_path
().
parent_path
()
/
"bin"
/
"migraphx-hiprtc-driver"
;
#endif
if
(
fs
::
exists
(
driver
))
{
...
...
@@ -284,16 +288,21 @@ std::vector<std::vector<char>> compile_hip_src_with_hiprtc(std::vector<hiprtc_sr
bool
is_hip_clang_compiler
()
{
static
const
auto
result
=
ends_with
(
MIGRAPHX_STRINGIZE
(
MIGRAPHX_HIP_COMPILER
),
"clang++"
);
static
const
auto
result
=
fs
::
path
{
MIGRAPHX_STRINGIZE
(
MIGRAPHX_HIP_COMPILER
)}.
stem
()
==
"clang++"
;
return
result
;
}
#ifdef MIGRAPHX_HIP_COMPILER_LAUNCHER
bool
has_compiler_launcher
()
{
static
const
auto
result
=
fs
::
exists
(
MIGRAPHX_STRINGIZE
(
MIGRAPHX_HIP_COMPILER_LAUNCHER
));
return
result
;
}
#endif
src_compiler
assemble
(
src_compiler
compiler
)
{
compiler
.
out_ext
=
".S"
;
...
...
@@ -306,8 +315,7 @@ compile_hip_src(const std::vector<src_file>& srcs, std::string params, const std
{
assert
(
not
srcs
.
empty
());
if
(
not
is_hip_clang_compiler
())
MIGRAPHX_THROW
(
"Unknown hip compiler: "
+
std
::
string
(
MIGRAPHX_STRINGIZE
(
MIGRAPHX_HIP_COMPILER
)));
MIGRAPHX_THROW
(
"Unknown hip compiler: "
MIGRAPHX_STRINGIZE
(
MIGRAPHX_HIP_COMPILER
));
if
(
params
.
find
(
"-std="
)
==
std
::
string
::
npos
)
params
+=
" --std=c++17"
;
...
...
src/targets/gpu/hiprtc/main.cpp
View file @
3b3fcc16
...
...
@@ -27,6 +27,7 @@
#include <migraphx/msgpack.hpp>
#include <migraphx/file_buffer.hpp>
#include <migraphx/ranges.hpp>
#include <array>
#include <iostream>
#include <cstring>
...
...
src/targets/gpu/kernels/migraphx_kernels.cpp
0 → 100644
View file @
3b3fcc16
/*
* 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.
*/
#include <Windows.h>
#include "migraphx_kernels.hpp"
#include "resource.h"
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
namespace
resource
{
std
::
string_view
read
(
int
id
)
{
HMODULE
handle
{
::
GetModuleHandle
(
nullptr
)};
HRSRC
rc
{
::
FindResource
(
handle
,
MAKEINTRESOURCE
(
id
),
MAKEINTRESOURCE
(
MIGRAPHX_TEXTFILE
))};
HGLOBAL
data
{
::
LoadResource
(
handle
,
rc
)};
return
{
static_cast
<
char
const
*>
(
::
LockResource
(
data
)),
::
SizeofResource
(
handle
,
rc
)};
}
}
// namespace resource
std
::
vector
<
src_file
>
migraphx_kernels
()
{
static
src_file
_kernels_
[]
=
{
{
"migraphx/kernels/algorithm.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_ALGORITHM_HPP
)},
{
"migraphx/kernels/args.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_ARGS_HPP
)},
{
"migraphx/kernels/array.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_ARRAY_HPP
)},
{
"migraphx/kernels/concat.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_CONCAT_HPP
)},
{
"migraphx/kernels/debug.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_DEBUG_HPP
)},
{
"migraphx/kernels/dfor.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_DFOR_HPP
)},
{
"migraphx/kernels/dpp.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_DPP_HPP
)},
{
"migraphx/kernels/functional.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_FUNCTIONAL_HPP
)},
{
"migraphx/kernels/gather.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_GATHER_HPP
)},
{
"migraphx/kernels/gathernd.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_GATHERND_HPP
)},
{
"migraphx/kernels/generic_constant.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_GENERIC_CONSTANT_HPP
)},
{
"migraphx/kernels/hip.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_HIP_HPP
)},
{
"migraphx/kernels/index.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_INDEX_HPP
)},
{
"migraphx/kernels/integral_constant.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_INTEGRAL_CONSTANT_HPP
)},
{
"migraphx/kernels/iota_iterator.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_IOTA_ITERATOR_HPP
)},
{
"migraphx/kernels/layernorm.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_LAYERNORM_HPP
)},
{
"migraphx/kernels/math.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_MATH_HPP
)},
{
"migraphx/kernels/ops.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_OPS_HPP
)},
{
"migraphx/kernels/pad.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_PAD_HPP
)},
{
"migraphx/kernels/pointwise.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_POINTWISE_HPP
)},
{
"migraphx/kernels/preload.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_PRELOAD_HPP
)},
{
"migraphx/kernels/print.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_PRINT_HPP
)},
{
"migraphx/kernels/ranges.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_RANGES_HPP
)},
{
"migraphx/kernels/reduce.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_REDUCE_HPP
)},
{
"migraphx/kernels/roialign.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_ROIALIGN_HPP
)},
{
"migraphx/kernels/scatternd.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_SCATTERND_HPP
)},
{
"migraphx/kernels/shape.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_SHAPE_HPP
)},
{
"migraphx/kernels/softmax.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_SOFTMAX_HPP
)},
{
"migraphx/kernels/tensor_view.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_TENSOR_VIEW_HPP
)},
{
"migraphx/kernels/type_traits.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_TYPE_TRAITS_HPP
)},
{
"migraphx/kernels/types.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_TYPES_HPP
)},
{
"migraphx/kernels/vec.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_VEC_HPP
)},
{
"migraphx/kernels/vectorize.hpp"
,
resource
::
read
(
MIGRAPHX_IDR_VECTORIZE_HPP
)}};
return
{
std
::
begin
(
_kernels_
),
std
::
end
(
_kernels_
)};
}
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
src/targets/gpu/kernels/migraphx_kernels.hpp
0 → 100644
View file @
3b3fcc16
/*
* 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.
*/
#ifndef MIGRAPHX_GUARD_MIGRAPHX_KERNELS_HPP
#define MIGRAPHX_GUARD_MIGRAPHX_KERNELS_HPP
#include "migraphx/compile_src.hpp"
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
namespace
gpu
{
std
::
vector
<
src_file
>
migraphx_kernels
();
}
// namespace gpu
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
#endif // MIGRAPHX_GUARD_MIGRAPHX_KERNELS_HPP
src/targets/gpu/kernels/resource.h
0 → 100644
View file @
3b3fcc16
/*
* 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.
*/
#ifndef MIGRAPHX_GUARD_MIGRAPHX_KERNELS_RESOURCE_H
#define MIGRAPHX_GUARD_MIGRAPHX_KERNELS_RESOURCE_H
#define MIGRAPHX_TEXTFILE 256
#define MIGRAPHX_IDR_ALGORITHM_HPP 101
#define MIGRAPHX_IDR_ARGS_HPP 102
#define MIGRAPHX_IDR_ARRAY_HPP 103
#define MIGRAPHX_IDR_CONCAT_HPP 104
#define MIGRAPHX_IDR_DEBUG_HPP 105
#define MIGRAPHX_IDR_DFOR_HPP 106
#define MIGRAPHX_IDR_DPP_HPP 107
#define MIGRAPHX_IDR_FUNCTIONAL_HPP 108
#define MIGRAPHX_IDR_GATHER_HPP 109
#define MIGRAPHX_IDR_GATHERND_HPP 110
#define MIGRAPHX_IDR_GENERIC_CONSTANT_HPP 111
#define MIGRAPHX_IDR_HIP_HPP 112
#define MIGRAPHX_IDR_INDEX_HPP 113
#define MIGRAPHX_IDR_INTEGRAL_CONSTANT_HPP 114
#define MIGRAPHX_IDR_IOTA_ITERATOR_HPP 115
#define MIGRAPHX_IDR_LAYERNORM_HPP 116
#define MIGRAPHX_IDR_MATH_HPP 117
#define MIGRAPHX_IDR_OPS_HPP 118
#define MIGRAPHX_IDR_PAD_HPP 119
#define MIGRAPHX_IDR_POINTWISE_HPP 120
#define MIGRAPHX_IDR_PRELOAD_HPP 121
#define MIGRAPHX_IDR_PRINT_HPP 122
#define MIGRAPHX_IDR_RANGES_HPP 123
#define MIGRAPHX_IDR_REDUCE_HPP 124
#define MIGRAPHX_IDR_ROIALIGN_HPP 125
#define MIGRAPHX_IDR_SCATTERND_HPP 126
#define MIGRAPHX_IDR_SHAPE_HPP 127
#define MIGRAPHX_IDR_SOFTMAX_HPP 128
#define MIGRAPHX_IDR_TENSOR_VIEW_HPP 129
#define MIGRAPHX_IDR_TYPE_TRAITS_HPP 130
#define MIGRAPHX_IDR_TYPES_HPP 131
#define MIGRAPHX_IDR_VEC_HPP 132
#define MIGRAPHX_IDR_VECTORIZE_HPP 134
#endif // MIGRAPHX_GUARD_MIGRAPHX_KERNELS_RESOURCE_H
src/targets/gpu/kernels/resource.rc
0 → 100644
View file @
3b3fcc16
//
// 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.
//
#include "resource.h"
MIGRAPHX_IDR_ALGORITHM_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/algorithm.hpp"
MIGRAPHX_IDR_ARGS_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/args.hpp"
MIGRAPHX_IDR_ARRAY_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/array.hpp"
MIGRAPHX_IDR_CONCAT_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/concat.hpp"
MIGRAPHX_IDR_DEBUG_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/debug.hpp"
MIGRAPHX_IDR_DFOR_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/dfor.hpp"
MIGRAPHX_IDR_DPP_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/dpp.hpp"
MIGRAPHX_IDR_FUNCTIONAL_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/functional.hpp"
MIGRAPHX_IDR_GATHER_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/gather.hpp"
MIGRAPHX_IDR_GATHERND_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/gathernd.hpp"
MIGRAPHX_IDR_GENERIC_CONSTANT_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/generic_constant.hpp"
MIGRAPHX_IDR_HIP_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/hip.hpp"
MIGRAPHX_IDR_INDEX_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/index.hpp"
MIGRAPHX_IDR_INTEGRAL_CONSTANT_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/integral_constant.hpp"
MIGRAPHX_IDR_IOTA_ITERATOR_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/iota_iterator.hpp"
MIGRAPHX_IDR_LAYERNORM_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/layernorm.hpp"
MIGRAPHX_IDR_MATH_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/math.hpp"
MIGRAPHX_IDR_OPS_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/ops.hpp"
MIGRAPHX_IDR_PAD_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/pad.hpp"
MIGRAPHX_IDR_POINTWISE_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/pointwise.hpp"
MIGRAPHX_IDR_PRELOAD_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/preload.hpp"
MIGRAPHX_IDR_PRINT_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/print.hpp"
MIGRAPHX_IDR_RANGES_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/ranges.hpp"
MIGRAPHX_IDR_REDUCE_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/reduce.hpp"
MIGRAPHX_IDR_ROIALIGN_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/roialign.hpp"
MIGRAPHX_IDR_SCATTERND_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/scatternd.hpp"
MIGRAPHX_IDR_SHAPE_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/shape.hpp"
MIGRAPHX_IDR_SOFTMAX_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/softmax.hpp"
MIGRAPHX_IDR_TENSOR_VIEW_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/tensor_view.hpp"
MIGRAPHX_IDR_TYPE_TRAITS_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/type_traits.hpp"
MIGRAPHX_IDR_TYPES_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/types.hpp"
MIGRAPHX_IDR_VEC_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/vec.hpp"
MIGRAPHX_IDR_VECTORIZE_HPP MIGRAPHX_TEXTFILE "include/migraphx/kernels/vectorize.hpp"
src/tmp_dir.cpp
View file @
3b3fcc16
...
...
@@ -31,8 +31,18 @@
#include <sstream>
#include <iostream>
#include <string>
#include <sys/types.h>
#ifdef _WIN32
// cppcheck-suppress definePrefix
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#undef getpid
// cppcheck-suppress [definePrefix, defineUpperCase]
#define getpid _getpid
#else
#include <unistd.h>
#include <sys/types.h>
#endif
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
...
...
test/CMakeLists.txt
View file @
3b3fcc16
...
...
@@ -42,8 +42,18 @@ foreach(TEST ${TESTS})
endforeach
()
if
(
MIGRAPHX_ENABLE_GPU
)
# gpu tests
file
(
GLOB GPU_TESTS CONFIGURE_DEPENDS gpu/*.cpp
)
set
(
GPU_TESTS
gpu/adjust_allocation.cpp
gpu/context_serialize.cpp
gpu/hip.cpp
gpu/jit.cpp
gpu/literal.cpp
gpu/manage_host_buffer.cpp
gpu/mlir.cpp
gpu/pack_args.cpp
gpu/pack_int8_args.cpp
gpu/quantization.cpp
gpu/stream_sync.cpp
)
foreach
(
TEST
${
GPU_TESTS
}
)
get_filename_component
(
BASE_NAME
${
TEST
}
NAME_WE
)
...
...
@@ -53,16 +63,22 @@ if(MIGRAPHX_ENABLE_GPU)
COST 10
RESOURCE_LOCK gpu
)
if
(
WIN32
)
target_include_directories
(
test_gpu_
${
BASE_NAME
}
PRIVATE
${
CMAKE_SOURCE_DIR
}
/src/targets/gpu/kernels
)
else
()
target_link_libraries
(
test_gpu_
${
BASE_NAME
}
migraphx_kernels
)
endif
()
if
(
MIGRAPHX_USE_HIPRTC
)
target_compile_definitions
(
test_gpu_
${
BASE_NAME
}
PUBLIC -DMIGRAPHX_USE_HIPRTC
)
endif
()
target_link_libraries
(
test_gpu_
${
BASE_NAME
}
migraphx_gpu
migraphx_kernels
)
target_link_libraries
(
test_gpu_
${
BASE_NAME
}
migraphx_gpu
)
endforeach
()
endif
()
if
(
MIGRAPHX_ENABLE_FPGA
)
# fpga tests
file
(
GLOB FPGA_TESTS CONFIGURE_DEPENDS fpga/*.cpp
)
set
(
FPGA_TESTS
fpga/get_target_assignments.cpp
fpga/test_compile.cpp
)
foreach
(
TEST
${
FPGA_TESTS
}
)
get_filename_component
(
BASE_NAME
${
TEST
}
NAME_WE
)
...
...
@@ -78,7 +94,10 @@ endif()
# Onnx test
set
(
TEST_ONNX_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/onnx
)
file
(
GLOB ONNX_TESTS
${
TEST_ONNX_DIR
}
/*.cpp
)
set
(
ONNX_TESTS
onnx/onnx_rnn_test.cpp
onnx/onnx_test.cpp
onnx/verify_onnx.cpp
)
foreach
(
ONNX_TEST
${
ONNX_TESTS
}
)
get_filename_component
(
BASE_NAME
${
ONNX_TEST
}
NAME_WE
)
...
...
test/api/CMakeLists.txt
View file @
3b3fcc16
...
...
@@ -57,10 +57,6 @@ add_api_test(custom_op test_custom_op.cpp ${TEST_ONNX_DIR})
add_api_test
(
tf_parser test_tf_parser.cpp
${
TEST_TF_DIR
}
)
# GPU-based tests
if
(
MIGRAPHX_ENABLE_GPU
)
list
(
APPEND CMAKE_PREFIX_PATH /opt/rocm
)
find_package
(
hip
)
add_api_test
(
gpu test_gpu.cpp
${
TEST_ONNX_DIR
}
)
target_link_libraries
(
test_api_gpu
)
add_api_test
(
custom_op_gpu test_custom_op_gpu.cpp
${
TEST_ONNX_DIR
}
)
target_link_libraries
(
test_api_custom_op_gpu
)
endif
()
test/include/test.hpp
View file @
3b3fcc16
...
...
@@ -333,7 +333,7 @@ enum class color
bg_blue
=
44
,
bg_default
=
49
};
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
color
&
c
)
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
[[
maybe_unused
]]
const
color
&
c
)
{
#ifndef _WIN32
static
const
bool
use_color
=
isatty
(
STDOUT_FILENO
)
!=
0
;
...
...
test/jit.cpp
View file @
3b3fcc16
...
...
@@ -46,8 +46,12 @@ std::function<F>
compile_function
(
const
std
::
string
&
src
,
const
std
::
string
&
flags
,
const
std
::
string
&
fname
)
{
migraphx
::
src_compiler
compiler
;
compiler
.
flags
=
flags
+
"-std=c++14 -fPIC -shared"
;
compiler
.
flags
=
flags
+
"-std=c++14 -fPIC -shared"
;
#ifdef _WIN32
compiler
.
output
=
"simple.dll"
;
#else
compiler
.
output
=
"libsimple.so"
;
#endif
migraphx
::
src_file
f
{
"main.cpp"
,
src
};
auto
image
=
compiler
.
compile
({
f
});
return
migraphx
::
dynamic_loader
{
image
}.
get_function
<
F
>
(
fname
);
...
...
test/promote_literals_test.cpp
View file @
3b3fcc16
...
...
@@ -26,6 +26,7 @@
#include <migraphx/program.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/eliminate_common_subexpression.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/pass_manager.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/serialize.hpp>
...
...
tools/api/api.cpp
View file @
3b3fcc16
...
...
@@ -38,6 +38,7 @@
#include <migraphx/register_op.hpp>
#include <migraphx/json.hpp>
#include <migraphx/convert_to_json.hpp>
#include <array>
#include <algorithm>
#include <cstdarg>
...
...
tools/api/migraphx.h
View file @
3b3fcc16
...
...
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <migraphx/api/export.h>
...
...
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