Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
a50cb302
Unverified
Commit
a50cb302
authored
Oct 11, 2023
by
Artur Wojcik
Committed by
GitHub
Oct 11, 2023
Browse files
a few c++ fixes to allow compilation on Windows (#2282)
parent
c58e7d89
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
46 additions
and
12 deletions
+46
-12
src/api/api.cpp
src/api/api.cpp
+1
-0
src/api/include/migraphx/migraphx.h
src/api/include/migraphx/migraphx.h
+1
-0
src/api/include/migraphx/migraphx.hpp
src/api/include/migraphx/migraphx.hpp
+1
-1
src/include/migraphx/auto_register.hpp
src/include/migraphx/auto_register.hpp
+3
-4
src/include/migraphx/config.hpp
src/include/migraphx/config.hpp
+1
-0
src/include/migraphx/filesystem.hpp
src/include/migraphx/filesystem.hpp
+11
-0
src/include/migraphx/float_equal.hpp
src/include/migraphx/float_equal.hpp
+0
-3
src/include/migraphx/generate.hpp
src/include/migraphx/generate.hpp
+2
-2
src/include/migraphx/instruction_ref.hpp
src/include/migraphx/instruction_ref.hpp
+4
-0
src/include/migraphx/matcher.hpp
src/include/migraphx/matcher.hpp
+1
-0
src/include/migraphx/op/nonmaxsuppression.hpp
src/include/migraphx/op/nonmaxsuppression.hpp
+1
-0
src/include/migraphx/op/roialign.hpp
src/include/migraphx/op/roialign.hpp
+1
-0
src/include/migraphx/optional.hpp
src/include/migraphx/optional.hpp
+11
-0
src/include/migraphx/run_loop.hpp
src/include/migraphx/run_loop.hpp
+1
-0
src/include/migraphx/source_location.hpp
src/include/migraphx/source_location.hpp
+1
-0
src/include/migraphx/type_name.hpp
src/include/migraphx/type_name.hpp
+1
-1
src/onnx/onnx_parser.cpp
src/onnx/onnx_parser.cpp
+1
-1
src/targets/cpu/include/migraphx/cpu/pointwise.hpp
src/targets/cpu/include/migraphx/cpu/pointwise.hpp
+1
-0
src/targets/gpu/hiprtc/main.cpp
src/targets/gpu/hiprtc/main.cpp
+1
-0
test/include/test.hpp
test/include/test.hpp
+2
-0
No files found.
src/api/api.cpp
View file @
a50cb302
...
...
@@ -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>
...
...
src/api/include/migraphx/migraphx.h
View file @
a50cb302
...
...
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <migraphx/api/export.h>
...
...
src/api/include/migraphx/migraphx.hpp
View file @
a50cb302
...
...
@@ -66,7 +66,7 @@ template <class PrivateMigraphTypeNameProbe>
std
::
string
compute_type_name
()
{
std
::
string
name
;
#ifdef
_MSC_VER
#if
def
ined(
_MSC_VER
) && !defined(__clang__)
name
=
typeid
(
PrivateMigraphTypeNameProbe
).
name
();
name
=
name
.
substr
(
7
);
#else
...
...
src/include/migraphx/auto_register.hpp
View file @
a50cb302
...
...
@@ -62,10 +62,9 @@ const int auto_register<Action, T>::static_register = auto_register_action<Actio
#define MIGRAPHX_AUTO_REGISTER_NAME_DETAIL(x) migraphx_auto_register_##x
#define MIGRAPHX_AUTO_REGISTER_NAME(x) MIGRAPHX_AUTO_REGISTER_NAME_DETAIL(x)
// NOLINTNEXTLINE
#define MIGRAPHX_AUTO_REGISTER(...) \
void MIGRAPHX_AUTO_REGISTER_NAME(__LINE__)(migraphx::auto_register<__VA_ARGS__> x = \
migraphx::auto_register<__VA_ARGS__>{}) \
__attribute__((unused));
#define MIGRAPHX_AUTO_REGISTER(...) \
[[maybe_unused]] void MIGRAPHX_AUTO_REGISTER_NAME(__LINE__)( \
migraphx::auto_register<__VA_ARGS__> x = migraphx::auto_register<__VA_ARGS__>{});
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
...
...
src/include/migraphx/config.hpp
View file @
a50cb302
...
...
@@ -25,6 +25,7 @@
#define MIGRAPHX_GUARD_CONFIG_HPP
#include <migraphx/export.h>
#include <ciso646>
#if !defined(MIGRAPHX_USE_CLANG_TIDY) && !defined(DOXYGEN)
...
...
src/include/migraphx/filesystem.hpp
View file @
a50cb302
...
...
@@ -29,6 +29,17 @@
#if defined(CPPCHECK)
#define MIGRAPHX_HAS_FILESYSTEM 1
#define MIGRAPHX_HAS_FILESYSTEM_TS 1
#elif defined(_WIN32)
#if _MSC_VER >= 1920
#define MIGRAPHX_HAS_FILESYSTEM 1
#define MIGRAPHX_HAS_FILESYSTEM_TS 0
#elif _MSC_VER >= 1900
#define MIGRAPHX_HAS_FILESYSTEM 0
#define MIGRAPHX_HAS_FILESYSTEM_TS 1
#else
#define MIGRAPHX_HAS_FILESYSTEM 0
#define MIGRAPHX_HAS_FILESYSTEM_TS 0
#endif
#elif defined(__has_include)
#if __has_include(<filesystem>) && __cplusplus >= 201703L
#define MIGRAPHX_HAS_FILESYSTEM 1
...
...
src/include/migraphx/float_equal.hpp
View file @
a50cb302
...
...
@@ -27,9 +27,6 @@
#include <algorithm>
#include <cmath>
#include <numeric>
#ifdef _MSC_VER
#include <iso646.h>
#endif
#include <migraphx/requires.hpp>
#include <migraphx/config.hpp>
...
...
src/include/migraphx/generate.hpp
View file @
a50cb302
...
...
@@ -48,7 +48,7 @@ constexpr T normalize(unsigned long z)
template
<
class
T
,
MIGRAPHX_REQUIRES
(
is_signed
<
T
>{}
and
not
is_floating_point
<
T
>
{})
>
constexpr
T
normalize
(
unsigned
long
z
)
{
const
auto
max
=
1UL
<<
(
sizeof
(
T
)
*
5
);
const
auto
max
=
1UL
L
<<
(
sizeof
(
T
)
*
5
);
const
auto
half_max
=
max
/
2
;
return
half_max
-
(
z
%
max
);
}
...
...
@@ -58,7 +58,7 @@ template <class T,
not
std
::
is_same
<
T
,
bool
>
{})
>
constexpr
T
normalize
(
unsigned
long
z
)
{
const
auto
max
=
1UL
<<
(
sizeof
(
T
)
*
5
);
const
auto
max
=
1UL
L
<<
(
sizeof
(
T
)
*
5
);
return
z
%
max
;
}
...
...
src/include/migraphx/instruction_ref.hpp
View file @
a50cb302
...
...
@@ -95,4 +95,8 @@ struct equal_to<migraphx::instruction_ref> // NOLINT
}
// namespace std
#ifdef _MSC_VER
#include <migraphx/instruction.hpp>
#endif
#endif
src/include/migraphx/matcher.hpp
View file @
a50cb302
...
...
@@ -33,6 +33,7 @@
#include <migraphx/type_name.hpp>
#include <migraphx/source_location.hpp>
#include <migraphx/config.hpp>
#include <array>
#include <unordered_map>
#include <unordered_set>
...
...
src/include/migraphx/op/nonmaxsuppression.hpp
View file @
a50cb302
...
...
@@ -24,6 +24,7 @@
#ifndef MIGRAPHX_GUARD_OPERATORS_NONMAXSUPPRESSION_HPP
#define MIGRAPHX_GUARD_OPERATORS_NONMAXSUPPRESSION_HPP
#include <array>
#include <cmath>
#include <queue>
#include <cstdint>
...
...
src/include/migraphx/op/roialign.hpp
View file @
a50cb302
...
...
@@ -33,6 +33,7 @@
#include <migraphx/dfor.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/shape_for_each.hpp>
#include <array>
#include <cmath>
#include <numeric>
#include <utility>
...
...
src/include/migraphx/optional.hpp
View file @
a50cb302
...
...
@@ -29,6 +29,17 @@
#if defined(CPPCHECK)
#define MIGRAPHX_HAS_OPTIONAL 1
#define MIGRAPHX_HAS_OPTIONAL_TS 1
#elif defined(_WIN32)
#if _MSC_VER >= 1920
#define MIGRAPHX_HAS_OPTIONAL 1
#define MIGRAPHX_HAS_OPTIONAL_TS 0
#elif _MSC_VER >= 1900
#define MIGRAPHX_HAS_OPTIONAL 0
#define MIGRAPHX_HAS_OPTIONAL_TS 1
#else
#define MIGRAPHX_HAS_OPTIONAL 0
#define MIGRAPHX_HAS_OPTIONAL_TS 0
#endif
#elif defined(__has_include)
#if __has_include(<optional>) && __cplusplus >= 201703L
#define MIGRAPHX_HAS_OPTIONAL 1
...
...
src/include/migraphx/run_loop.hpp
View file @
a50cb302
...
...
@@ -31,6 +31,7 @@
#include <migraphx/module.hpp>
#include <migraphx/config.hpp>
#include <migraphx/ranges.hpp>
#include <array>
#include <string>
namespace
migraphx
{
...
...
src/include/migraphx/source_location.hpp
View file @
a50cb302
...
...
@@ -24,6 +24,7 @@
#ifndef MIGRAPHX_GUARD_MIGRAPHX_SOURCE_LOCATION_HPP
#define MIGRAPHX_GUARD_MIGRAPHX_SOURCE_LOCATION_HPP
#include <cstdint>
#include <migraphx/config.hpp>
#if defined(CPPCHECK)
...
...
src/include/migraphx/type_name.hpp
View file @
a50cb302
...
...
@@ -34,7 +34,7 @@ template <class PrivateMigraphTypeNameProbe>
std
::
string
compute_type_name
()
{
std
::
string
name
;
#ifdef
_MSC_VER
#if
def
ined(
_MSC_VER
) && !defined(__clang__)
name
=
typeid
(
PrivateMigraphTypeNameProbe
).
name
();
name
=
name
.
substr
(
7
);
#else
...
...
src/onnx/onnx_parser.cpp
View file @
a50cb302
...
...
@@ -244,7 +244,7 @@ void onnx_parser::parse_from(std::istream& is, std::string name)
this
->
filename
=
std
::
move
(
name
);
auto
parent_path
=
fs
::
path
(
this
->
filename
).
parent_path
();
if
(
not
parent_path
.
empty
())
this
->
path
=
parent_path
;
this
->
path
=
parent_path
.
string
()
;
onnx
::
ModelProto
model
;
if
(
model
.
ParseFromIstream
(
&
is
))
...
...
src/targets/cpu/include/migraphx/cpu/pointwise.hpp
View file @
a50cb302
...
...
@@ -24,6 +24,7 @@
#ifndef MIGRAPHX_GUARD_AMDMIGRAPHX_CPU_POINTWISE_HPP
#define MIGRAPHX_GUARD_AMDMIGRAPHX_CPU_POINTWISE_HPP
#include <array>
#include <migraphx/config.hpp>
#include <migraphx/context.hpp>
#include <migraphx/check_shapes.hpp>
...
...
src/targets/gpu/hiprtc/main.cpp
View file @
a50cb302
...
...
@@ -27,6 +27,7 @@
#include <migraphx/msgpack.hpp>
#include <migraphx/file_buffer.hpp>
#include <migraphx/ranges.hpp>
#include <array>
#include <iostream>
#include <cstring>
...
...
test/include/test.hpp
View file @
a50cb302
...
...
@@ -339,6 +339,8 @@ inline std::ostream& operator<<(std::ostream& os, const color& c)
static
const
bool
use_color
=
isatty
(
STDOUT_FILENO
)
!=
0
;
if
(
use_color
)
return
os
<<
"
\033
["
<<
static_cast
<
std
::
size_t
>
(
c
)
<<
"m"
;
#else
(
void
)
c
;
#endif
return
os
;
}
...
...
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