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
7f0915f6
Commit
7f0915f6
authored
Mar 03, 2022
by
Chao Liu
Browse files
format
parent
d1e9d6cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
20 deletions
+19
-20
test/conv2d_fwd.cpp
test/conv2d_fwd.cpp
+1
-1
test/magic_number_division.cpp
test/magic_number_division.cpp
+2
-3
test/split_k.cpp
test/split_k.cpp
+16
-16
No files found.
test/conv2d_fwd.cpp
View file @
7f0915f6
...
@@ -78,7 +78,7 @@ int main(int argc, char* argv[])
...
@@ -78,7 +78,7 @@ int main(int argc, char* argv[])
if
(
argc
==
1
)
if
(
argc
==
1
)
{
{
init_method
=
1
;
init_method
=
1
;
data_type
=
0
;
data_type
=
0
;
}
}
else
if
(
argc
==
3
)
else
if
(
argc
==
3
)
{
{
...
...
test/magic_number_division.cpp
View file @
7f0915f6
...
@@ -161,12 +161,11 @@ int main(int, char*[])
...
@@ -161,12 +161,11 @@ int main(int, char*[])
if
(
pass
)
if
(
pass
)
{
{
std
::
cout
<<
"test magic number division: Pass"
<<
std
::
endl
;
std
::
cout
<<
"test magic number division: Pass"
<<
std
::
endl
;
return
0
;
return
0
;
}
}
else
else
{
{
std
::
cout
<<
"test magic number division: Fail"
<<
std
::
endl
;
std
::
cout
<<
"test magic number division: Fail"
<<
std
::
endl
;
return
-
1
;
return
-
1
;
}
}
}
}
test/split_k.cpp
View file @
7f0915f6
...
@@ -69,7 +69,6 @@ struct gemmArgs
...
@@ -69,7 +69,6 @@ struct gemmArgs
int
KBatch
;
int
KBatch
;
};
};
int
test_gemm
(
const
gemmArgs
&
args
)
int
test_gemm
(
const
gemmArgs
&
args
)
{
{
bool
a_row_major
,
b_row_major
,
c_row_major
;
bool
a_row_major
,
b_row_major
,
c_row_major
;
...
@@ -115,8 +114,10 @@ int test_gemm(const gemmArgs& args)
...
@@ -115,8 +114,10 @@ int test_gemm(const gemmArgs& args)
Tensor
<
float
>
a_m_k
(
f_host_tensor_descriptor
(
args
.
M
,
args
.
K
,
args
.
StrideA
,
a_row_major
));
Tensor
<
float
>
a_m_k
(
f_host_tensor_descriptor
(
args
.
M
,
args
.
K
,
args
.
StrideA
,
a_row_major
));
Tensor
<
float
>
b_k_n
(
f_host_tensor_descriptor
(
args
.
K
,
args
.
N
,
args
.
StrideB
,
b_row_major
));
Tensor
<
float
>
b_k_n
(
f_host_tensor_descriptor
(
args
.
K
,
args
.
N
,
args
.
StrideB
,
b_row_major
));
Tensor
<
float
>
c_m_n_host_result
(
f_host_tensor_descriptor
(
args
.
M
,
args
.
N
,
args
.
StrideC
,
c_row_major
));
Tensor
<
float
>
c_m_n_host_result
(
Tensor
<
float
>
c_m_n_device_result
(
f_host_tensor_descriptor
(
args
.
M
,
args
.
N
,
args
.
StrideC
,
c_row_major
));
f_host_tensor_descriptor
(
args
.
M
,
args
.
N
,
args
.
StrideC
,
c_row_major
));
Tensor
<
float
>
c_m_n_device_result
(
f_host_tensor_descriptor
(
args
.
M
,
args
.
N
,
args
.
StrideC
,
c_row_major
));
// init data
// init data
std
::
size_t
num_thread
=
std
::
thread
::
hardware_concurrency
();
std
::
size_t
num_thread
=
std
::
thread
::
hardware_concurrency
();
...
@@ -205,7 +206,7 @@ int test_gemm(const gemmArgs& args)
...
@@ -205,7 +206,7 @@ int test_gemm(const gemmArgs& args)
else
else
{
{
std
::
cout
<<
"test split k: Fail "
<<
std
::
endl
;
std
::
cout
<<
"test split k: Fail "
<<
std
::
endl
;
error_code
=
-
1
;
// test needs to report failure
error_code
=
-
1
;
// test needs to report failure
}
}
return
error_code
;
return
error_code
;
}
}
...
@@ -221,17 +222,17 @@ int main(int argc, char* argv[])
...
@@ -221,17 +222,17 @@ int main(int argc, char* argv[])
}
}
else
if
(
argc
==
9
)
else
if
(
argc
==
9
)
{
{
const
int
layout
=
static_cast
<
GemmMatrixLayout
>
(
std
::
stoi
(
argv
[
1
]));
const
int
layout
=
static_cast
<
GemmMatrixLayout
>
(
std
::
stoi
(
argv
[
1
]));
const
int
M
=
std
::
stoi
(
argv
[
2
]);
const
int
M
=
std
::
stoi
(
argv
[
2
]);
const
int
N
=
std
::
stoi
(
argv
[
3
]);
const
int
N
=
std
::
stoi
(
argv
[
3
]);
const
int
K
=
std
::
stoi
(
argv
[
4
]);
const
int
K
=
std
::
stoi
(
argv
[
4
]);
const
int
StrideA
=
std
::
stoi
(
argv
[
5
]);
const
int
StrideA
=
std
::
stoi
(
argv
[
5
]);
const
int
StrideB
=
std
::
stoi
(
argv
[
6
]);
const
int
StrideB
=
std
::
stoi
(
argv
[
6
]);
const
int
StrideC
=
std
::
stoi
(
argv
[
7
]);
const
int
StrideC
=
std
::
stoi
(
argv
[
7
]);
const
int
KBatch
=
std
::
stoi
(
argv
[
8
]);
const
int
KBatch
=
std
::
stoi
(
argv
[
8
]);
test_cases
=
{{
layout
,
M
,
N
,
K
,
StrideA
,
StrideB
,
StrideC
,
KBatch
}};
test_cases
=
{{
layout
,
M
,
N
,
K
,
StrideA
,
StrideB
,
StrideC
,
KBatch
}};
}
}
else
else
{
{
...
@@ -242,12 +243,11 @@ int main(int argc, char* argv[])
...
@@ -242,12 +243,11 @@ int main(int argc, char* argv[])
printf
(
"arg2 to 7: M, N, K, StrideA, StrideB, StrideC KBatch
\n
"
);
printf
(
"arg2 to 7: M, N, K, StrideA, StrideB, StrideC KBatch
\n
"
);
return
-
1
;
return
-
1
;
}
}
for
(
const
auto
&
kinder
:
test_cases
)
for
(
const
auto
&
kinder
:
test_cases
)
{
{
const
auto
res
=
test_gemm
(
kinder
);
const
auto
res
=
test_gemm
(
kinder
);
if
(
!
res
)
if
(
!
res
)
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
}
}
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