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
bdef7adb
Commit
bdef7adb
authored
Oct 04, 2023
by
Artur Wojcik
Browse files
a few c++ fixes to allow compilation on Windows
parent
bd425d0d
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
51 additions
and
13 deletions
+51
-13
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/driver/main.cpp
src/driver/main.cpp
+1
-0
src/include/migraphx/auto_register.hpp
src/include/migraphx/auto_register.hpp
+3
-4
src/include/migraphx/config.hpp
src/include/migraphx/config.hpp
+4
-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/matcher.hpp
src/include/migraphx/matcher.hpp
+7
-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
+1
-1
No files found.
src/api/api.cpp
View file @
bdef7adb
...
@@ -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>
namespace
migraphx
{
namespace
migraphx
{
...
...
src/api/include/migraphx/migraphx.h
View file @
bdef7adb
...
@@ -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>
...
...
src/api/include/migraphx/migraphx.hpp
View file @
bdef7adb
...
@@ -66,7 +66,7 @@ template <class PrivateMigraphTypeNameProbe>
...
@@ -66,7 +66,7 @@ template <class PrivateMigraphTypeNameProbe>
std
::
string
compute_type_name
()
std
::
string
compute_type_name
()
{
{
std
::
string
name
;
std
::
string
name
;
#ifdef
_MSC_VER
#if
def
ined(
_MSC_VER
) && !defined(__clang__)
name
=
typeid
(
PrivateMigraphTypeNameProbe
).
name
();
name
=
typeid
(
PrivateMigraphTypeNameProbe
).
name
();
name
=
name
.
substr
(
7
);
name
=
name
.
substr
(
7
);
#else
#else
...
...
src/driver/main.cpp
View file @
bdef7adb
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include <migraphx/json.hpp>
#include <migraphx/json.hpp>
#include <migraphx/version.h>
#include <migraphx/version.h>
#include <migraphx/instruction.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/eliminate_identity.hpp>
#include <migraphx/eliminate_identity.hpp>
#include <migraphx/eliminate_pad.hpp>
#include <migraphx/eliminate_pad.hpp>
...
...
src/include/migraphx/auto_register.hpp
View file @
bdef7adb
...
@@ -63,9 +63,8 @@ const int auto_register<Action, T>::static_register = auto_register_action<Actio
...
@@ -63,9 +63,8 @@ const int auto_register<Action, T>::static_register = auto_register_action<Actio
#define MIGRAPHX_AUTO_REGISTER_NAME(x) MIGRAPHX_AUTO_REGISTER_NAME_DETAIL(x)
#define MIGRAPHX_AUTO_REGISTER_NAME(x) MIGRAPHX_AUTO_REGISTER_NAME_DETAIL(x)
// NOLINTNEXTLINE
// NOLINTNEXTLINE
#define MIGRAPHX_AUTO_REGISTER(...) \
#define MIGRAPHX_AUTO_REGISTER(...) \
void MIGRAPHX_AUTO_REGISTER_NAME(__LINE__)(migraphx::auto_register<__VA_ARGS__> x = \
[[maybe_unused]] void MIGRAPHX_AUTO_REGISTER_NAME(__LINE__)( \
migraphx::auto_register<__VA_ARGS__>{}) \
migraphx::auto_register<__VA_ARGS__> x = migraphx::auto_register<__VA_ARGS__>{});
__attribute__((unused));
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/include/migraphx/config.hpp
View file @
bdef7adb
...
@@ -26,6 +26,10 @@
...
@@ -26,6 +26,10 @@
#include <migraphx/export.h>
#include <migraphx/export.h>
#if defined(_MSC_VER) && !defined(__clang__)
#include <ciso646>
#endif
#if !defined(MIGRAPHX_USE_CLANG_TIDY) && !defined(DOXYGEN)
#if !defined(MIGRAPHX_USE_CLANG_TIDY) && !defined(DOXYGEN)
#ifdef BUILD_DEV
#ifdef BUILD_DEV
...
...
src/include/migraphx/filesystem.hpp
View file @
bdef7adb
...
@@ -29,6 +29,17 @@
...
@@ -29,6 +29,17 @@
#if defined(CPPCHECK)
#if defined(CPPCHECK)
#define MIGRAPHX_HAS_FILESYSTEM 1
#define MIGRAPHX_HAS_FILESYSTEM 1
#define MIGRAPHX_HAS_FILESYSTEM_TS 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)
#elif defined(__has_include)
#if __has_include(<filesystem>) && __cplusplus >= 201703L
#if __has_include(<filesystem>) && __cplusplus >= 201703L
#define MIGRAPHX_HAS_FILESYSTEM 1
#define MIGRAPHX_HAS_FILESYSTEM 1
...
...
src/include/migraphx/float_equal.hpp
View file @
bdef7adb
...
@@ -27,9 +27,6 @@
...
@@ -27,9 +27,6 @@
#include <algorithm>
#include <algorithm>
#include <cmath>
#include <cmath>
#include <numeric>
#include <numeric>
#ifdef _MSC_VER
#include <iso646.h>
#endif
#include <migraphx/requires.hpp>
#include <migraphx/requires.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
...
...
src/include/migraphx/generate.hpp
View file @
bdef7adb
...
@@ -48,7 +48,7 @@ constexpr T normalize(unsigned long z)
...
@@ -48,7 +48,7 @@ constexpr T normalize(unsigned long z)
template
<
class
T
,
MIGRAPHX_REQUIRES
(
is_signed
<
T
>{}
and
not
is_floating_point
<
T
>
{})
>
template
<
class
T
,
MIGRAPHX_REQUIRES
(
is_signed
<
T
>{}
and
not
is_floating_point
<
T
>
{})
>
constexpr
T
normalize
(
unsigned
long
z
)
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
;
const
auto
half_max
=
max
/
2
;
return
half_max
-
(
z
%
max
);
return
half_max
-
(
z
%
max
);
}
}
...
@@ -58,7 +58,7 @@ template <class T,
...
@@ -58,7 +58,7 @@ template <class T,
not
std
::
is_same
<
T
,
bool
>
{})
>
not
std
::
is_same
<
T
,
bool
>
{})
>
constexpr
T
normalize
(
unsigned
long
z
)
constexpr
T
normalize
(
unsigned
long
z
)
{
{
const
auto
max
=
1UL
<<
(
sizeof
(
T
)
*
5
);
const
auto
max
=
1UL
L
<<
(
sizeof
(
T
)
*
5
);
return
z
%
max
;
return
z
%
max
;
}
}
...
...
src/include/migraphx/matcher.hpp
View file @
bdef7adb
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <migraphx/type_name.hpp>
#include <migraphx/type_name.hpp>
#include <migraphx/source_location.hpp>
#include <migraphx/source_location.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <array>
#include <unordered_map>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
...
@@ -307,6 +308,12 @@ struct matcher_result
...
@@ -307,6 +308,12 @@ struct matcher_result
{
{
}
}
instruction_container
&
operator
=
(
const
std
::
unordered_map
<
std
::
string
,
instruction_ref
>&
x
)
{
ins_map
=
x
;
return
*
this
;
}
instruction_ref
operator
[](
const
std
::
string
&
name
)
const
instruction_ref
operator
[](
const
std
::
string
&
name
)
const
{
{
auto
it
=
ins_map
.
find
(
name
);
auto
it
=
ins_map
.
find
(
name
);
...
...
src/include/migraphx/op/nonmaxsuppression.hpp
View file @
bdef7adb
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#ifndef MIGRAPHX_GUARD_OPERATORS_NONMAXSUPPRESSION_HPP
#ifndef MIGRAPHX_GUARD_OPERATORS_NONMAXSUPPRESSION_HPP
#define MIGRAPHX_GUARD_OPERATORS_NONMAXSUPPRESSION_HPP
#define MIGRAPHX_GUARD_OPERATORS_NONMAXSUPPRESSION_HPP
#include <array>
#include <cmath>
#include <cmath>
#include <queue>
#include <queue>
#include <cstdint>
#include <cstdint>
...
...
src/include/migraphx/op/roialign.hpp
View file @
bdef7adb
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <migraphx/dfor.hpp>
#include <migraphx/dfor.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/shape_for_each.hpp>
#include <migraphx/shape_for_each.hpp>
#include <array>
#include <cmath>
#include <cmath>
#include <numeric>
#include <numeric>
#include <utility>
#include <utility>
...
...
src/include/migraphx/optional.hpp
View file @
bdef7adb
...
@@ -29,6 +29,17 @@
...
@@ -29,6 +29,17 @@
#if defined(CPPCHECK)
#if defined(CPPCHECK)
#define MIGRAPHX_HAS_OPTIONAL 1
#define MIGRAPHX_HAS_OPTIONAL 1
#define MIGRAPHX_HAS_OPTIONAL_TS 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)
#elif defined(__has_include)
#if __has_include(<optional>) && __cplusplus >= 201703L
#if __has_include(<optional>) && __cplusplus >= 201703L
#define MIGRAPHX_HAS_OPTIONAL 1
#define MIGRAPHX_HAS_OPTIONAL 1
...
...
src/include/migraphx/run_loop.hpp
View file @
bdef7adb
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <migraphx/module.hpp>
#include <migraphx/module.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/ranges.hpp>
#include <migraphx/ranges.hpp>
#include <array>
#include <string>
#include <string>
namespace
migraphx
{
namespace
migraphx
{
...
...
src/include/migraphx/source_location.hpp
View file @
bdef7adb
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#ifndef MIGRAPHX_GUARD_MIGRAPHX_SOURCE_LOCATION_HPP
#ifndef MIGRAPHX_GUARD_MIGRAPHX_SOURCE_LOCATION_HPP
#define MIGRAPHX_GUARD_MIGRAPHX_SOURCE_LOCATION_HPP
#define MIGRAPHX_GUARD_MIGRAPHX_SOURCE_LOCATION_HPP
#include <cstdint>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#if defined(CPPCHECK)
#if defined(CPPCHECK)
...
...
src/include/migraphx/type_name.hpp
View file @
bdef7adb
...
@@ -34,7 +34,7 @@ template <class PrivateMigraphTypeNameProbe>
...
@@ -34,7 +34,7 @@ template <class PrivateMigraphTypeNameProbe>
std
::
string
compute_type_name
()
std
::
string
compute_type_name
()
{
{
std
::
string
name
;
std
::
string
name
;
#ifdef
_MSC_VER
#if
def
ined(
_MSC_VER
) && !defined(__clang__)
name
=
typeid
(
PrivateMigraphTypeNameProbe
).
name
();
name
=
typeid
(
PrivateMigraphTypeNameProbe
).
name
();
name
=
name
.
substr
(
7
);
name
=
name
.
substr
(
7
);
#else
#else
...
...
src/onnx/onnx_parser.cpp
View file @
bdef7adb
...
@@ -244,7 +244,7 @@ void onnx_parser::parse_from(std::istream& is, std::string name)
...
@@ -244,7 +244,7 @@ void onnx_parser::parse_from(std::istream& is, std::string name)
this
->
filename
=
std
::
move
(
name
);
this
->
filename
=
std
::
move
(
name
);
auto
parent_path
=
fs
::
path
(
this
->
filename
).
parent_path
();
auto
parent_path
=
fs
::
path
(
this
->
filename
).
parent_path
();
if
(
not
parent_path
.
empty
())
if
(
not
parent_path
.
empty
())
this
->
path
=
parent_path
;
this
->
path
=
parent_path
.
string
()
;
onnx
::
ModelProto
model
;
onnx
::
ModelProto
model
;
if
(
model
.
ParseFromIstream
(
&
is
))
if
(
model
.
ParseFromIstream
(
&
is
))
...
...
src/targets/cpu/include/migraphx/cpu/pointwise.hpp
View file @
bdef7adb
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#ifndef MIGRAPHX_GUARD_AMDMIGRAPHX_CPU_POINTWISE_HPP
#ifndef MIGRAPHX_GUARD_AMDMIGRAPHX_CPU_POINTWISE_HPP
#define MIGRAPHX_GUARD_AMDMIGRAPHX_CPU_POINTWISE_HPP
#define MIGRAPHX_GUARD_AMDMIGRAPHX_CPU_POINTWISE_HPP
#include <array>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
#include <migraphx/context.hpp>
#include <migraphx/context.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/check_shapes.hpp>
...
...
src/targets/gpu/hiprtc/main.cpp
View file @
bdef7adb
...
@@ -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>
...
...
test/include/test.hpp
View file @
bdef7adb
...
@@ -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
;
...
...
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