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
0fa35b29
"git@developer.sourcefind.cn:cnjsdfcy/simbricks.git" did not exist on "bee2e1e973dba9a2ce06b7057dfb4404f6fac17f"
Commit
0fa35b29
authored
Sep 14, 2022
by
Po-Yen, Chen
Browse files
Use AsSpan() to shorten check_err() calls
parent
c0c1d247
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
12 deletions
+9
-12
example/37_permute/common.hpp
example/37_permute/common.hpp
+1
-0
example/37_permute/run_permute_bundle_example.inc
example/37_permute/run_permute_bundle_example.inc
+6
-10
example/37_permute/run_permute_element_example.inc
example/37_permute/run_permute_element_example.inc
+2
-2
No files found.
example/37_permute/common.hpp
View file @
0fa35b29
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include <iterator>
#include <iterator>
#include <numeric>
#include <numeric>
#include <type_traits>
#include <type_traits>
#include <utility>
#include "ck/ck.hpp"
#include "ck/ck.hpp"
#include "ck/tensor_operation/gpu/element/binary_element_wise_operation.hpp"
#include "ck/tensor_operation/gpu/element/binary_element_wise_operation.hpp"
...
...
example/37_permute/run_permute_bundle_example.inc
View file @
0fa35b29
...
@@ -19,9 +19,7 @@ bool run_permute_bundle(const Problem& problem)
...
@@ -19,9 +19,7 @@ bool run_permute_bundle(const Problem& problem)
// initialize tensor by assigning DataType values
// initialize tensor by assigning DataType values
using
std
::
data
,
std
::
size
;
using
std
::
data
,
std
::
size
;
ck
::
utils
::
FillUniformDistribution
<
DataType
>
{
-
1.
f
,
1.
f
}(
ck
::
utils
::
FillUniformDistribution
<
DataType
>
{
-
1.
f
,
1.
f
}(
input_bundle_tensor
.
AsSpan
<
DataType
>
());
ck
::
span
<
DataType
>
{
reinterpret_cast
<
DataType
*>
(
data
(
input_bundle_tensor
)),
input_bundle_tensor
.
GetElementSpaceSize
()
*
NumElemsInBundle
});
DeviceMem
input_device_buf
(
input_bundle_tensor
.
GetElementSpaceSizeInBytes
());
DeviceMem
input_device_buf
(
input_bundle_tensor
.
GetElementSpaceSizeInBytes
());
DeviceMem
output_device_buf
(
output_bundle_tensor
.
GetElementSpaceSizeInBytes
());
DeviceMem
output_device_buf
(
output_bundle_tensor
.
GetElementSpaceSizeInBytes
());
...
@@ -72,13 +70,11 @@ bool run_permute_bundle(const Problem& problem)
...
@@ -72,13 +70,11 @@ bool run_permute_bundle(const Problem& problem)
return
false
;
return
false
;
}
}
return
ck
::
utils
::
check_err
(
return
ck
::
utils
::
check_err
(
output_bundle_tensor
.
AsSpan
<
const
DataType
>
(),
ck
::
span
<
const
DataType
>
{
reinterpret_cast
<
DataType
*>
(
data
(
output_bundle_tensor
)),
output_tensor
.
AsSpan
<
const
DataType
>
(),
output_bundle_tensor
.
GetElementSpaceSize
()
*
NumElemsInBundle
},
"Error: incorrect results in output tensor"
,
ck
::
span
<
const
DataType
>
{
output_tensor
},
1
e
-
6
,
"Error: incorrect results in output tensor"
,
1
e
-
6
);
1
e
-
6
,
1
e
-
6
);
}
}
bool
run_permute_bundle_example
(
const
Problem
::
Shape
&
shape
,
const
Problem
::
Axes
&
axes
)
bool
run_permute_bundle_example
(
const
Problem
::
Shape
&
shape
,
const
Problem
::
Axes
&
axes
)
...
...
example/37_permute/run_permute_element_example.inc
View file @
0fa35b29
...
@@ -57,8 +57,8 @@ bool run_permute_element(const Problem& problem)
...
@@ -57,8 +57,8 @@ bool run_permute_element(const Problem& problem)
return
false
;
return
false
;
}
}
return
ck
::
utils
::
check_err
(
output_tensor
.
mData
,
return
ck
::
utils
::
check_err
(
output_tensor
.
AsSpan
<
const
OutDataType
>
()
,
output_tensor_host
.
mData
,
output_tensor_host
.
AsSpan
<
const
OutDataType
>
()
,
"Error: incorrect results in output tensor"
,
"Error: incorrect results in output tensor"
,
1
e
-
6
,
1
e
-
6
,
1
e
-
6
);
1
e
-
6
);
...
...
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