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
8c144c7a
"symphony/git@developer.sourcefind.cn:cnjsdfcy/simbricks.git" did not exist on "f8c67ccc76780608512b18e7cbb45a69b7c86073"
Commit
8c144c7a
authored
May 29, 2022
by
Anthony Chang
Browse files
dump lds content in appropriate precision type
parent
91d8b7d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
include/ck/utility/debug.hpp
include/ck/utility/debug.hpp
+15
-4
No files found.
include/ck/utility/debug.hpp
View file @
8c144c7a
...
@@ -9,21 +9,33 @@ template <typename T, typename Enable = void>
...
@@ -9,21 +9,33 @@ template <typename T, typename Enable = void>
struct
PrintAsType
;
struct
PrintAsType
;
template
<
typename
T
>
template
<
typename
T
>
struct
PrintAsType
<
T
,
typename
std
::
enable_if
<
std
::
is_floating_point
<
T
>::
value
>::
valu
e
>
struct
PrintAsType
<
T
,
typename
std
::
enable_if
<
std
::
is_floating_point
<
T
>::
value
>::
typ
e
>
{
{
using
type
=
float
;
using
type
=
float
;
__host__
__device__
static
void
Print
(
const
T
&
p
)
{
printf
(
"%.3f "
,
static_cast
<
type
>
(
p
));
}
};
};
template
<
>
template
<
>
struct
PrintAsType
<
ck
::
half_t
,
void
>
struct
PrintAsType
<
ck
::
half_t
,
void
>
{
{
using
type
=
float
;
using
type
=
float
;
__host__
__device__
static
void
Print
(
const
ck
::
half_t
&
p
)
{
printf
(
"%.3f "
,
static_cast
<
type
>
(
p
));
}
};
};
template
<
typename
T
>
template
<
typename
T
>
struct
PrintAsType
<
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
valu
e
>
struct
PrintAsType
<
T
,
typename
std
::
enable_if
<
std
::
is_integral
<
T
>::
value
>::
typ
e
>
{
{
using
type
=
int
;
using
type
=
int
;
__host__
__device__
static
void
Print
(
const
T
&
p
)
{
printf
(
"%d "
,
static_cast
<
type
>
(
p
));
}
};
};
}
// namespace detail
}
// namespace detail
...
@@ -38,7 +50,6 @@ struct PrintAsType<T, typename std::enable_if<std::is_integral<T>::value>::value
...
@@ -38,7 +50,6 @@ struct PrintAsType<T, typename std::enable_if<std::is_integral<T>::value>::value
template
<
typename
T
,
index_t
element_stride
=
1
,
index_t
row_bytes
=
128
>
template
<
typename
T
,
index_t
element_stride
=
1
,
index_t
row_bytes
=
128
>
__device__
void
print_shared
(
T
const
*
p_shared
,
index_t
num_elements
)
__device__
void
print_shared
(
T
const
*
p_shared
,
index_t
num_elements
)
{
{
using
PrintType
=
typename
detail
::
PrintAsType
<
T
>::
type
;
constexpr
index_t
row_elements
=
row_bytes
/
sizeof
(
T
);
constexpr
index_t
row_elements
=
row_bytes
/
sizeof
(
T
);
static_assert
((
element_stride
>=
1
&&
element_stride
<=
row_elements
),
static_assert
((
element_stride
>=
1
&&
element_stride
<=
row_elements
),
"element_stride should between [1, row_elements]"
);
"element_stride should between [1, row_elements]"
);
...
@@ -60,7 +71,7 @@ __device__ void print_shared(T const* p_shared, index_t num_elements)
...
@@ -60,7 +71,7 @@ __device__ void print_shared(T const* p_shared, index_t num_elements)
printf
(
"elem %5d: "
,
i
);
printf
(
"elem %5d: "
,
i
);
for
(
index_t
j
=
0
;
j
<
row_elements
;
j
+=
element_stride
)
for
(
index_t
j
=
0
;
j
<
row_elements
;
j
+=
element_stride
)
{
{
printf
(
"%.0f "
,
static_cast
<
PrintType
>
(
p_shared
[
i
+
j
])
)
;
detail
::
Print
As
Type
<
T
>::
Print
(
p_shared
[
i
+
j
]);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
...
...
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