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
composable_kernel
Commits
a0bde1f4
Commit
a0bde1f4
authored
Sep 28, 2023
by
Bartlomiej Wroblewski
Browse files
Include possible DataType -> ComputeDataType casting error in the threshold
parent
cfcdb03e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
profiler/include/profiler/profile_contraction_impl.hpp
profiler/include/profiler/profile_contraction_impl.hpp
+7
-3
No files found.
profiler/include/profiler/profile_contraction_impl.hpp
View file @
a0bde1f4
...
@@ -290,14 +290,18 @@ int profile_contraction_impl(ck::index_t do_verification,
...
@@ -290,14 +290,18 @@ int profile_contraction_impl(ck::index_t do_verification,
// Comparing one to another can result in an absolute error as high as twice that
// Comparing one to another can result in an absolute error as high as twice that
// value.
// value.
double
threshold
=
2
*
nelems_k
*
std
::
numeric_limits
<
AccDataType
>::
epsilon
();
double
threshold
=
2
*
nelems_k
*
std
::
numeric_limits
<
AccDataType
>::
epsilon
();
// TODO: Add a generic solution in CK.
// Handle the possible casting error of either AccDataType -> DataType or
if
constexpr
(
ck
::
is_same_v
<
DataType
,
ck
::
bhalf_t
>
)
// DataType -> ComputeDataType.
// TODO: Add a generic solution for calculating thresholds in CK.
if
constexpr
(
ck
::
is_same_v
<
DataType
,
ck
::
bhalf_t
>
||
ck
::
is_same_v
<
ComputeDataType
,
ck
::
bhalf_t
>
)
{
{
const
double
epsilon
=
std
::
pow
(
2
,
-
7
);
const
double
epsilon
=
std
::
pow
(
2
,
-
7
);
// Maximum relative casting error when rounding to zero.
// Maximum relative casting error when rounding to zero.
threshold
+=
epsilon
*
2
;
threshold
+=
epsilon
*
2
;
}
}
else
if
constexpr
(
ck
::
is_same_v
<
DataType
,
ck
::
half_t
>
)
else
if
constexpr
(
ck
::
is_same_v
<
DataType
,
ck
::
half_t
>
||
ck
::
is_same_v
<
ComputeDataType
,
ck
::
half_t
>
)
{
{
const
double
epsilon
=
std
::
pow
(
2
,
-
10
);
const
double
epsilon
=
std
::
pow
(
2
,
-
10
);
// Maximum relative casting error when rounding to zero.
// Maximum relative casting error when rounding to zero.
...
...
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