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
ed196e59
Commit
ed196e59
authored
Dec 13, 2023
by
Uros Petkovic
Browse files
Fix compilation of math functions on Windows
parent
5fe1b075
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
src/include/migraphx/float_equal.hpp
src/include/migraphx/float_equal.hpp
+5
-1
src/simplify_qdq.cpp
src/simplify_qdq.cpp
+2
-2
src/targets/gpu/device/include/migraphx/gpu/device/float_equal.hpp
...ts/gpu/device/include/migraphx/gpu/device/float_equal.hpp
+5
-1
No files found.
src/include/migraphx/float_equal.hpp
View file @
ed196e59
...
...
@@ -43,7 +43,11 @@ struct float_equal_fn
template
<
class
T
,
MIGRAPHX_REQUIRES
(
is_floating_point
<
T
>{})
>
static
bool
apply
(
T
x
,
T
y
)
{
return
std
::
isfinite
(
x
)
and
std
::
isfinite
(
y
)
and
// The standard library from MSVC does not implement std::isfinite() for integer
// types - no additional overloads are provided. According to the documentation,
// integer types should be treaded as doubles.
// Refer to https://en.cppreference.com/w/cpp/numeric/math/isfinite for more information.
return
std
::
isfinite
(
static_cast
<
double
>
(
x
))
and
std
::
isfinite
(
static_cast
<
double
>
(
y
))
and
std
::
nextafter
(
x
,
std
::
numeric_limits
<
T
>::
lowest
())
<=
y
and
std
::
nextafter
(
x
,
std
::
numeric_limits
<
T
>::
max
())
>=
y
;
}
...
...
src/simplify_qdq.cpp
View file @
ed196e59
...
...
@@ -214,10 +214,10 @@ bool compare_literals(instruction_ref ins1, instruction_ref ins2)
l1
.
end
(),
[
&
](
auto
v
)
{
return
((
float_equal
(
v
,
l1
.
front
()))
or
(
std
::
isinf
(
l1
.
front
())
and
std
::
isinf
(
v
)));
(
std
::
isinf
(
static_cast
<
double
>
(
l1
.
front
())
)
and
std
::
isinf
(
static_cast
<
double
>
(
v
)
)));
})
and
std
::
all_of
(
l2
.
begin
(),
l2
.
end
(),
[
&
](
auto
v
)
{
return
((
float_equal
(
v
,
l1
.
front
()))
or
(
std
::
isinf
(
l1
.
front
())
and
std
::
isinf
(
v
)));
return
((
float_equal
(
v
,
l1
.
front
()))
or
(
std
::
isinf
(
static_cast
<
double
>
(
l1
.
front
())
)
and
std
::
isinf
(
static_cast
<
double
>
(
v
)
)));
});
});
...
...
src/targets/gpu/device/include/migraphx/gpu/device/float_equal.hpp
View file @
ed196e59
...
...
@@ -39,7 +39,11 @@ using common_type = typename std::common_type<Ts...>::type;
template
<
class
T
,
MIGRAPHX_REQUIRES
(
is_floating_point
<
T
>{})
>
__device__
bool
float_equal_device
(
T
x
,
T
y
)
{
return
std
::
isfinite
(
x
)
and
std
::
isfinite
(
y
)
and
// The standard library from MSVC does not implement std::isfinite() for integer
// types - no additional overloads are provided. According to the documentation,
// integer types should be treaded as doubles.
// Refer to https://en.cppreference.com/w/cpp/numeric/math/isfinite for more information.
return
std
::
isfinite
(
static_cast
<
double
>
(
x
))
and
std
::
isfinite
(
static_cast
<
double
>
(
y
))
and
std
::
nextafter
(
x
,
std
::
numeric_limits
<
T
>::
lowest
())
<=
y
and
std
::
nextafter
(
x
,
std
::
numeric_limits
<
T
>::
max
())
>=
y
;
}
...
...
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