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
f363ec7f
Commit
f363ec7f
authored
Nov 26, 2024
by
letaoqin
Browse files
add tag for gather index
parent
c1d6f9ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
include/ck_tile/core/algorithm/indexing_adaptor.hpp
include/ck_tile/core/algorithm/indexing_adaptor.hpp
+9
-3
No files found.
include/ck_tile/core/algorithm/indexing_adaptor.hpp
View file @
f363ec7f
...
...
@@ -57,7 +57,7 @@ struct indexing_adaptor_onshot_cached
return
ck_tile
::
is_known_at_compile_time
<
IndexingType
>::
value
;
}
};
#define Using_Gather 1
template
<
typename
IndexingType
>
struct
indexing_adaptor
{
...
...
@@ -65,8 +65,10 @@ struct indexing_adaptor
CK_TILE_HOST_DEVICE
constexpr
indexing_adaptor
()
=
default
;
CK_TILE_HOST_DEVICE
constexpr
indexing_adaptor
(
const
IndexingType
*
idx
)
:
cached_idx_
(
idx
)
{}
const
IndexingType
*
cached_idx_
;
#if Using_Gather
mutable
index_t
pre_up_index_
=
0
;
mutable
index_t
pre_low_index_
=
0
;
#endif
template
<
typename
LowIdx
,
typename
UpIdx
>
CK_TILE_HOST_DEVICE
constexpr
void
calculate_lower_index
(
LowIdx
&
idx_low
,
...
...
@@ -76,7 +78,7 @@ struct indexing_adaptor
"wrong! inconsistent # of dimension"
);
idx_low
(
number
<
0
>
{})
=
*
(
cached_idx_
+
idx_up
[
number
<
0
>
{}]);
#if Using_Gather
pre_up_index_
=
idx_up
[
number
<
0
>
{}];
pre_low_index_
=
idx_low
(
number
<
0
>
{});
#if 0
...
...
@@ -84,6 +86,7 @@ struct indexing_adaptor
{
printf("\n first index from %d to %d \n", idx_up[number<0>{}], idx_low(number<0>{}));
}
#endif
#endif
}
...
...
@@ -97,7 +100,9 @@ struct indexing_adaptor
static_assert
(
LowIdxDiff
::
size
()
==
1
&&
UpIdxDiff
::
size
()
==
1
&&
LowIdx
::
size
()
==
1
&&
UpIdx
::
size
()
==
1
,
"wrong! inconsistent # of dimension"
);
#if !Using_Gather
idx_diff_low
(
number
<
0
>
{})
=
idx_diff_up
[
number
<
0
>
{}];
#else
int
up_index
=
idx_diff_up
[
number
<
0
>
{}]
+
pre_up_index_
;
int
low_index
=
*
(
cached_idx_
+
up_index
);
idx_diff_low
(
number
<
0
>
{})
=
low_index
-
pre_low_index_
;
...
...
@@ -113,6 +118,7 @@ struct indexing_adaptor
idx_diff_up[number<0>{}],
idx_diff_low(number<0>{}));
}
#endif
#endif
// pass the diff to lower, but not changing the actually index
...
...
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