"vscode:/vscode.git/clone" did not exist on "9b14e317e17cbcaf3c486643dbd9a1eb10a5a935"
Commit 3b3fcc16 authored by Artur Wojcik's avatar Artur Wojcik
Browse files

enable compilation on Windows


Signed-off-by: default avatarArtur Wojcik <artur.wojcik@amd.com>
parent 15897dcf
...@@ -251,8 +251,12 @@ compile_hip_src(const std::vector<src_file>& srcs, std::string params, const std ...@@ -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; 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 p = dynamic_loader::path(&compile_hip_src_with_hiprtc);
auto driver = p.parent_path().parent_path() / "bin" / "migraphx-hiprtc-driver"; auto driver = p.parent_path().parent_path() / "bin" / "migraphx-hiprtc-driver";
#endif
if(fs::exists(driver)) if(fs::exists(driver))
{ {
...@@ -284,16 +288,21 @@ std::vector<std::vector<char>> compile_hip_src_with_hiprtc(std::vector<hiprtc_sr ...@@ -284,16 +288,21 @@ std::vector<std::vector<char>> compile_hip_src_with_hiprtc(std::vector<hiprtc_sr
bool is_hip_clang_compiler() 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; return result;
} }
#ifdef MIGRAPHX_HIP_COMPILER_LAUNCHER
bool has_compiler_launcher() bool has_compiler_launcher()
{ {
static const auto result = fs::exists(MIGRAPHX_STRINGIZE(MIGRAPHX_HIP_COMPILER_LAUNCHER)); static const auto result = fs::exists(MIGRAPHX_STRINGIZE(MIGRAPHX_HIP_COMPILER_LAUNCHER));
return result; return result;
} }
#endif
src_compiler assemble(src_compiler compiler) src_compiler assemble(src_compiler compiler)
{ {
compiler.out_ext = ".S"; compiler.out_ext = ".S";
...@@ -306,8 +315,7 @@ compile_hip_src(const std::vector<src_file>& srcs, std::string params, const std ...@@ -306,8 +315,7 @@ compile_hip_src(const std::vector<src_file>& srcs, std::string params, const std
{ {
assert(not srcs.empty()); assert(not srcs.empty());
if(not is_hip_clang_compiler()) if(not is_hip_clang_compiler())
MIGRAPHX_THROW("Unknown hip compiler: " + MIGRAPHX_THROW("Unknown hip compiler: " MIGRAPHX_STRINGIZE(MIGRAPHX_HIP_COMPILER));
std::string(MIGRAPHX_STRINGIZE(MIGRAPHX_HIP_COMPILER)));
if(params.find("-std=") == std::string::npos) if(params.find("-std=") == std::string::npos)
params += " --std=c++17"; params += " --std=c++17";
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <migraphx/msgpack.hpp> #include <migraphx/msgpack.hpp>
#include <migraphx/file_buffer.hpp> #include <migraphx/file_buffer.hpp>
#include <migraphx/ranges.hpp> #include <migraphx/ranges.hpp>
#include <array>
#include <iostream> #include <iostream>
#include <cstring> #include <cstring>
......
/*
* 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
/*
* 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
/*
* 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
//
// 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"
...@@ -31,8 +31,18 @@ ...@@ -31,8 +31,18 @@
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <string> #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 <unistd.h>
#include <sys/types.h>
#endif
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
......
...@@ -42,8 +42,18 @@ foreach(TEST ${TESTS}) ...@@ -42,8 +42,18 @@ foreach(TEST ${TESTS})
endforeach() endforeach()
if(MIGRAPHX_ENABLE_GPU) if(MIGRAPHX_ENABLE_GPU)
# gpu tests set(GPU_TESTS
file(GLOB GPU_TESTS CONFIGURE_DEPENDS gpu/*.cpp) 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}) foreach(TEST ${GPU_TESTS})
get_filename_component(BASE_NAME ${TEST} NAME_WE) get_filename_component(BASE_NAME ${TEST} NAME_WE)
...@@ -53,16 +63,22 @@ if(MIGRAPHX_ENABLE_GPU) ...@@ -53,16 +63,22 @@ if(MIGRAPHX_ENABLE_GPU)
COST 10 COST 10
RESOURCE_LOCK gpu 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) if(MIGRAPHX_USE_HIPRTC)
target_compile_definitions(test_gpu_${BASE_NAME} PUBLIC -DMIGRAPHX_USE_HIPRTC) target_compile_definitions(test_gpu_${BASE_NAME} PUBLIC -DMIGRAPHX_USE_HIPRTC)
endif() endif()
target_link_libraries(test_gpu_${BASE_NAME} migraphx_gpu migraphx_kernels) target_link_libraries(test_gpu_${BASE_NAME} migraphx_gpu)
endforeach() endforeach()
endif() endif()
if(MIGRAPHX_ENABLE_FPGA) if(MIGRAPHX_ENABLE_FPGA)
# fpga tests set(FPGA_TESTS
file(GLOB FPGA_TESTS CONFIGURE_DEPENDS fpga/*.cpp) fpga/get_target_assignments.cpp
fpga/test_compile.cpp)
foreach(TEST ${FPGA_TESTS}) foreach(TEST ${FPGA_TESTS})
get_filename_component(BASE_NAME ${TEST} NAME_WE) get_filename_component(BASE_NAME ${TEST} NAME_WE)
...@@ -78,7 +94,10 @@ endif() ...@@ -78,7 +94,10 @@ endif()
# Onnx test # Onnx test
set(TEST_ONNX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/onnx) 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}) foreach(ONNX_TEST ${ONNX_TESTS})
get_filename_component(BASE_NAME ${ONNX_TEST} NAME_WE) get_filename_component(BASE_NAME ${ONNX_TEST} NAME_WE)
......
...@@ -57,10 +57,6 @@ add_api_test(custom_op test_custom_op.cpp ${TEST_ONNX_DIR}) ...@@ -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}) add_api_test(tf_parser test_tf_parser.cpp ${TEST_TF_DIR})
# GPU-based tests # GPU-based tests
if(MIGRAPHX_ENABLE_GPU) if(MIGRAPHX_ENABLE_GPU)
list(APPEND CMAKE_PREFIX_PATH /opt/rocm)
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)
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)
endif() endif()
...@@ -333,7 +333,7 @@ enum class color ...@@ -333,7 +333,7 @@ enum class color
bg_blue = 44, bg_blue = 44,
bg_default = 49 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 #ifndef _WIN32
static const bool use_color = isatty(STDOUT_FILENO) != 0; static const bool use_color = isatty(STDOUT_FILENO) != 0;
......
...@@ -47,7 +47,11 @@ compile_function(const std::string& src, const std::string& flags, const std::st ...@@ -47,7 +47,11 @@ compile_function(const std::string& src, const std::string& flags, const std::st
{ {
migraphx::src_compiler compiler; 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"; compiler.output = "libsimple.so";
#endif
migraphx::src_file f{"main.cpp", src}; migraphx::src_file f{"main.cpp", src};
auto image = compiler.compile({f}); auto image = compiler.compile({f});
return migraphx::dynamic_loader{image}.get_function<F>(fname); return migraphx::dynamic_loader{image}.get_function<F>(fname);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/dead_code_elimination.hpp> #include <migraphx/dead_code_elimination.hpp>
#include <migraphx/eliminate_common_subexpression.hpp> #include <migraphx/eliminate_common_subexpression.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/pass_manager.hpp> #include <migraphx/pass_manager.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
#include <migraphx/serialize.hpp> #include <migraphx/serialize.hpp>
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <migraphx/register_op.hpp> #include <migraphx/register_op.hpp>
#include <migraphx/json.hpp> #include <migraphx/json.hpp>
#include <migraphx/convert_to_json.hpp> #include <migraphx/convert_to_json.hpp>
#include <array>
#include <algorithm> #include <algorithm>
#include <cstdarg> #include <cstdarg>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <migraphx/api/export.h> #include <migraphx/api/export.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment