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
0fb084b3
Commit
0fb084b3
authored
Jun 29, 2022
by
Paul
Browse files
Format
parent
78be5944
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
51 deletions
+49
-51
src/targets/gpu/kernels/include/migraphx/kernels/array.hpp
src/targets/gpu/kernels/include/migraphx/kernels/array.hpp
+1
-1
src/targets/gpu/kernels/include/migraphx/kernels/shape.hpp
src/targets/gpu/kernels/include/migraphx/kernels/shape.hpp
+48
-50
No files found.
src/targets/gpu/kernels/include/migraphx/kernels/array.hpp
View file @
0fb084b3
...
...
@@ -209,7 +209,7 @@ struct integral_const_array : array<T, sizeof...(Xs)>
MIGRAPHX_DEVICE_CONSTEXPR
integral_const_array
()
:
base_array
({
Xs
...})
{}
};
template
<
class
F
>
template
<
class
F
>
constexpr
auto
return_const_array
(
F
f
)
{
constexpr
const
auto
a
=
f
();
...
...
src/targets/gpu/kernels/include/migraphx/kernels/shape.hpp
View file @
0fb084b3
...
...
@@ -104,14 +104,12 @@ struct shape
MIGRAPHX_ASSERT
(
i
==
compute_index
(
i
));
return
i
;
}
else
{
return
compute_index
(
i
);
}
}
else
{
return
compute_index
(
i
);
}
}
constexpr
index_int
compute_index
(
index_int
i
)
const
{
constexpr
index_int
compute_index
(
index_int
i
)
const
{
constexpr
auto
sstrides
=
compute_standard_strides
();
constexpr
auto
rank
=
Lens
{}.
size
();
index_int
result
=
0
;
...
...
@@ -128,11 +126,11 @@ struct shape
}
});
return
result
;
}
}
/// Convert single index into a multi-index
constexpr
index_array
multi
(
index_int
idx
)
const
{
/// Convert single index into a multi-index
constexpr
index_array
multi
(
index_int
idx
)
const
{
index_array
result
;
index_int
tidx
=
idx
;
for
(
diff_int
is
=
result
.
size
()
-
1
;
is
>
0
;
is
--
)
...
...
@@ -142,24 +140,24 @@ struct shape
}
result
[
0
]
=
tidx
;
return
result
;
}
/// Convert multi-index into a single index
constexpr
index_int
single
(
index_array
idx
)
const
{
}
/// Convert multi-index into a single index
constexpr
index_int
single
(
index_array
idx
)
const
{
if
(
idx
.
empty
())
return
0
;
return
inner_product
(
lens
.
begin
()
+
1
,
lens
.
end
(),
idx
.
begin
(),
idx
.
back
());
}
}
constexpr
shape
get_shape
()
const
{
return
*
this
;
}
constexpr
shape
get_shape
()
const
{
return
*
this
;
}
template
<
class
Stream
>
friend
constexpr
const
Stream
&
operator
<<
(
const
Stream
&
ss
,
const
shape
&
s
)
{
template
<
class
Stream
>
friend
constexpr
const
Stream
&
operator
<<
(
const
Stream
&
ss
,
const
shape
&
s
)
{
ss
<<
"{"
<<
s
.
lens
<<
"}, {"
<<
s
.
strides
<<
"}"
;
return
ss
;
}
};
}
};
// namespace migraphx
template
<
class
Lens
,
class
Strides
>
constexpr
shape
<
Lens
,
Strides
>
make_shape
(
Lens
lens
,
Strides
strides
)
...
...
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