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_ROCM
Commits
ecd638f3
"test/split_k/split_k.cpp" did not exist on "4be7f0198e55f386d51cdb127dc0fa69427d6fe0"
Commit
ecd638f3
authored
Feb 12, 2025
by
Rostyslav Geyyer
Browse files
Fix nan logic
parent
7c5c2c8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
include/ck/utility/mxf4_utils.hpp
include/ck/utility/mxf4_utils.hpp
+6
-6
No files found.
include/ck/utility/mxf4_utils.hpp
View file @
ecd638f3
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
// Copyright (c) 2024, Advanced Micro Devices, Inc. All rights reserved.
// Copyright (c) 2024
-2025
, Advanced Micro Devices, Inc. All rights reserved.
#pragma once
#pragma once
...
@@ -13,7 +13,7 @@ __host__ __device__ inline bool is_nan<f4_t>(e8m0_bexp_t const scale,
...
@@ -13,7 +13,7 @@ __host__ __device__ inline bool is_nan<f4_t>(e8m0_bexp_t const scale,
f4_t
const
dataBytes
[[
maybe_unused
]])
f4_t
const
dataBytes
[[
maybe_unused
]])
{
{
// no need to check for data as it does not have NaN representation
// no need to check for data as it does not have NaN representation
return
scale
==
NumericLimits
<
e8m0_bexp_t
>::
QuietNaN
();
return
scale
.
is_nan
();
}
}
// no infinity representation in ocp_e2m1_mxfp4 will always return false
// no infinity representation in ocp_e2m1_mxfp4 will always return false
...
@@ -26,11 +26,9 @@ __host__ __device__ inline bool is_inf<f4_t>(e8m0_bexp_t const scale [[maybe_unu
...
@@ -26,11 +26,9 @@ __host__ __device__ inline bool is_inf<f4_t>(e8m0_bexp_t const scale [[maybe_unu
}
}
template
<
>
template
<
>
__host__
__device__
inline
bool
is_zero
<
f4_t
>
(
e8m0_bexp_t
const
scale
,
f4_t
const
data
)
__host__
__device__
inline
bool
is_zero
<
f4_t
>
(
e8m0_bexp_t
const
scale
[[
maybe_unused
]],
f4_t
const
data
)
{
{
if
(
is_nan
<
f4_t
>
(
scale
,
data
))
return
false
;
// no need to check for scale as it does not have a 0 representation
// no need to check for scale as it does not have a 0 representation
f4_t
result
=
(
data
&
0b00001111
)
&
NumericUtils
<
f4_t
>::
set_sign_mask
;
f4_t
result
=
(
data
&
0b00001111
)
&
NumericUtils
<
f4_t
>::
set_sign_mask
;
...
@@ -41,7 +39,9 @@ template <>
...
@@ -41,7 +39,9 @@ template <>
__host__
__device__
inline
float
to_float
<
f4_t
>
(
e8m0_bexp_t
const
scale
,
f4_t
const
data
)
__host__
__device__
inline
float
to_float
<
f4_t
>
(
e8m0_bexp_t
const
scale
,
f4_t
const
data
)
{
{
if
(
is_nan
<
f4_t
>
(
scale
,
data
))
if
(
is_nan
<
f4_t
>
(
scale
,
data
))
{
return
std
::
numeric_limits
<
float
>::
quiet_NaN
();
return
std
::
numeric_limits
<
float
>::
quiet_NaN
();
}
if
(
is_zero
<
f4_t
>
(
scale
,
data
))
if
(
is_zero
<
f4_t
>
(
scale
,
data
))
return
0.0
f
;
return
0.0
f
;
...
...
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