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
f5411e07
Unverified
Commit
f5411e07
authored
Oct 04, 2023
by
Artur Wojcik
Committed by
GitHub
Oct 04, 2023
Browse files
fix call to std::isfinite() on Windows (#2283)
parent
42a7e55d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
9 deletions
+7
-9
src/cpp_generator.cpp
src/cpp_generator.cpp
+2
-2
src/include/migraphx/op/convert.hpp
src/include/migraphx/op/convert.hpp
+1
-1
src/include/migraphx/op/isnan.hpp
src/include/migraphx/op/isnan.hpp
+1
-1
src/include/migraphx/verify.hpp
src/include/migraphx/verify.hpp
+2
-4
src/program.cpp
src/program.cpp
+1
-1
No files found.
src/cpp_generator.cpp
View file @
f5411e07
...
@@ -213,13 +213,13 @@ cpp_generator::function cpp_generator::generate_module(const module& m,
...
@@ -213,13 +213,13 @@ cpp_generator::function cpp_generator::generate_module(const module& m,
ins
->
get_literal
().
visit
([
&
](
auto
v
)
{
ins
->
get_literal
().
visit
([
&
](
auto
v
)
{
assert
(
v
.
size
()
==
1
);
assert
(
v
.
size
()
==
1
);
auto
x
=
v
.
front
();
auto
x
=
v
.
front
();
if
(
std
::
isinf
(
x
))
if
(
std
::
isinf
(
static_cast
<
double
>
(
x
)
))
{
{
string_literal
=
"__builtin_huge_val()"
;
string_literal
=
"__builtin_huge_val()"
;
if
(
x
<
0
)
if
(
x
<
0
)
string_literal
=
"-__builtin_huge_val()"
;
string_literal
=
"-__builtin_huge_val()"
;
}
}
else
if
(
std
::
isnan
(
x
))
else
if
(
std
::
isnan
(
static_cast
<
double
>
(
x
)
))
string_literal
=
"__builtin_nan()"
;
string_literal
=
"__builtin_nan()"
;
else
else
string_literal
=
ins
->
get_literal
().
to_string
();
string_literal
=
ins
->
get_literal
().
to_string
();
...
...
src/include/migraphx/op/convert.hpp
View file @
f5411e07
...
@@ -68,7 +68,7 @@ struct convert : unary<convert>
...
@@ -68,7 +68,7 @@ struct convert : unary<convert>
auto
y
=
x
;
auto
y
=
x
;
shape
::
visit
(
type
,
[
&
](
auto
as
)
{
shape
::
visit
(
type
,
[
&
](
auto
as
)
{
// clamping value between target_type's max and min doesn't work for NaNs,
// clamping value between target_type's max and min doesn't work for NaNs,
if
(
std
::
isnan
(
x
))
if
(
std
::
isnan
(
static_cast
<
double
>
(
x
)
))
{
{
y
=
as
.
nan
();
y
=
as
.
nan
();
}
}
...
...
src/include/migraphx/op/isnan.hpp
View file @
f5411e07
...
@@ -35,7 +35,7 @@ struct isnan : unary<isnan>
...
@@ -35,7 +35,7 @@ struct isnan : unary<isnan>
{
{
auto
apply
()
const
auto
apply
()
const
{
{
return
[](
auto
x
)
{
return
std
::
isnan
(
x
);
};
return
[](
auto
x
)
{
return
std
::
isnan
(
static_cast
<
double
>
(
x
)
);
};
}
}
std
::
string
name
()
const
{
return
"isnan"
;
}
std
::
string
name
()
const
{
return
"isnan"
;
}
...
...
src/include/migraphx/verify.hpp
View file @
f5411e07
...
@@ -90,8 +90,7 @@ struct not_finite_fn
...
@@ -90,8 +90,7 @@ struct not_finite_fn
template
<
class
T
>
template
<
class
T
>
bool
operator
()(
T
x
)
const
bool
operator
()(
T
x
)
const
{
{
using
std
::
isfinite
;
return
not
std
::
isfinite
(
static_cast
<
double
>
(
x
));
return
not
isfinite
(
x
);
}
}
};
};
static
constexpr
not_finite_fn
not_finite
{};
static
constexpr
not_finite_fn
not_finite
{};
...
@@ -101,8 +100,7 @@ struct compare_mag_fn
...
@@ -101,8 +100,7 @@ struct compare_mag_fn
template
<
class
T
,
class
U
>
template
<
class
T
,
class
U
>
bool
operator
()(
T
x
,
U
y
)
const
bool
operator
()(
T
x
,
U
y
)
const
{
{
using
std
::
fabs
;
return
std
::
fabs
(
x
)
<
std
::
fabs
(
y
);
return
fabs
(
x
)
<
fabs
(
y
);
}
}
};
};
static
constexpr
compare_mag_fn
compare_mag
{};
static
constexpr
compare_mag_fn
compare_mag
{};
...
...
src/program.cpp
View file @
f5411e07
...
@@ -347,7 +347,7 @@ void program::finalize()
...
@@ -347,7 +347,7 @@ void program::finalize()
template
<
class
T
>
template
<
class
T
>
std
::
string
classify
(
T
x
)
std
::
string
classify
(
T
x
)
{
{
switch
(
std
::
fpclassify
(
x
))
switch
(
std
::
fpclassify
(
static_cast
<
double
>
(
x
)
))
{
{
case
FP_INFINITE
:
return
"inf"
;
case
FP_INFINITE
:
return
"inf"
;
case
FP_NAN
:
return
"nan"
;
case
FP_NAN
:
return
"nan"
;
...
...
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