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
0672c72a
Commit
0672c72a
authored
Nov 09, 2023
by
Umang Yadav
Browse files
Disable vectorization for float8
parent
27759bd0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
src/targets/gpu/compile_gen.cpp
src/targets/gpu/compile_gen.cpp
+11
-1
src/targets/gpu/kernels/include/migraphx/kernels/vectorize.hpp
...argets/gpu/kernels/include/migraphx/kernels/vectorize.hpp
+1
-3
No files found.
src/targets/gpu/compile_gen.cpp
View file @
0672c72a
...
@@ -54,6 +54,11 @@ vectorize vectorize::elements(std::size_t axis,
...
@@ -54,6 +54,11 @@ vectorize vectorize::elements(std::size_t axis,
const
std
::
vector
<
shape
>&
inputs
,
const
std
::
vector
<
shape
>&
inputs
,
const
std
::
vector
<
std
::
size_t
>&
sizes
)
const
std
::
vector
<
std
::
size_t
>&
sizes
)
{
{
// disable vectorization for fp8 types
if
(
std
::
any_of
(
inputs
.
begin
(),
inputs
.
end
(),
[
&
](
auto
ishape
)
{
return
ishape
.
type
()
==
migraphx
::
shape
::
float8_type
;
}))
return
{
1
,
axis
};
if
(
std
::
all_of
(
if
(
std
::
all_of
(
inputs
.
begin
(),
inputs
.
end
(),
[
&
](
const
auto
&
s
)
{
return
s
.
lens
()[
axis
]
==
1
;
}))
inputs
.
begin
(),
inputs
.
end
(),
[
&
](
const
auto
&
s
)
{
return
s
.
lens
()[
axis
]
==
1
;
}))
return
{
1
,
axis
};
return
{
1
,
axis
};
...
@@ -86,6 +91,11 @@ vectorize vectorize::elements(std::size_t axis,
...
@@ -86,6 +91,11 @@ vectorize vectorize::elements(std::size_t axis,
vectorize
vectorize
::
elements
(
context
&
ctx
,
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
)
vectorize
vectorize
::
elements
(
context
&
ctx
,
std
::
size_t
axis
,
const
std
::
vector
<
shape
>&
inputs
)
{
{
// disable vectorization for fp8 types
if
(
std
::
any_of
(
inputs
.
begin
(),
inputs
.
end
(),
[
&
](
auto
ishape
)
{
return
ishape
.
type
()
==
migraphx
::
shape
::
float8_type
;
}))
return
{
1
,
axis
};
if
(
inputs
.
empty
())
if
(
inputs
.
empty
())
return
{
1
,
axis
};
return
{
1
,
axis
};
std
::
size_t
n
=
std
::
max_element
(
inputs
.
begin
(),
std
::
size_t
n
=
std
::
max_element
(
inputs
.
begin
(),
...
@@ -305,7 +315,7 @@ std::string generate_reduce(const module& m, const std::string& name)
...
@@ -305,7 +315,7 @@ std::string generate_reduce(const module& m, const std::string& name)
std
::
transform
(
std
::
transform
(
params
.
begin
(),
params
.
end
(),
params
.
begin
(),
[](
auto
s
)
{
return
"auto "
+
s
;
});
params
.
begin
(),
params
.
end
(),
params
.
begin
(),
[](
auto
s
)
{
return
"auto "
+
s
;
});
return
interpolate_string
(
inner_template
,
return
interpolate_string
(
inner_template
,
{{
"inner"
,
inner_name
},
{{
"inner"
,
inner_name
},
{
"params"
,
join_strings
(
params
,
", "
)},
{
"params"
,
join_strings
(
params
,
", "
)},
{
"args"
,
join_strings
(
args
,
", "
)},
{
"args"
,
join_strings
(
args
,
", "
)},
{
"call"
,
call_function
}});
{
"call"
,
call_function
}});
...
...
src/targets/gpu/kernels/include/migraphx/kernels/vectorize.hpp
View file @
0672c72a
...
@@ -237,9 +237,7 @@ template <index_int N, index_int Axis, class T>
...
@@ -237,9 +237,7 @@ template <index_int N, index_int Axis, class T>
__device__
__host__
auto
vectorize_tensor
(
T
x
)
__device__
__host__
auto
vectorize_tensor
(
T
x
)
{
{
constexpr
auto
shape
=
get_shape_c
<
T
>
{};
constexpr
auto
shape
=
get_shape_c
<
T
>
{};
if
constexpr
(
is_same
<
typename
T
::
type
,
migraphx_fp8
::
fp8e4m3fnuz
>
{})
if
constexpr
(
shape
.
lens
[
Axis
]
==
1
)
return
x
;
else
if
constexpr
(
shape
.
lens
[
Axis
]
==
1
)
return
x
;
return
x
;
else
if
constexpr
(
shape
.
strides
[
Axis
]
==
0
)
else
if
constexpr
(
shape
.
strides
[
Axis
]
==
0
)
return
tensor_step
<
N
>
(
x
,
_c
<
Axis
>
);
return
tensor_step
<
N
>
(
x
,
_c
<
Axis
>
);
...
...
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