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
07acd53b
"vscode:/vscode.git/clone" did not exist on "9170835c24a691489086c73f95a6fde201589147"
Commit
07acd53b
authored
Jun 07, 2022
by
carlushuang
Browse files
let control core binding
parent
f9cf57d4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
10 deletions
+38
-10
example/cpu_02_conv2d_fwd_bias_relu_add/cpu_conv2d_fwd_bias_relu_add.cpp
...conv2d_fwd_bias_relu_add/cpu_conv2d_fwd_bias_relu_add.cpp
+2
-2
include/ck/tensor_operation/cpu/grid/gridwise_gemm_avx2.hpp
include/ck/tensor_operation/cpu/grid/gridwise_gemm_avx2.hpp
+5
-4
include/ck/tensor_operation/cpu/grid/gridwise_gemm_bias_activation_add_avx2.hpp
...ation/cpu/grid/gridwise_gemm_bias_activation_add_avx2.hpp
+5
-4
include/ck/utility/envvar.hpp
include/ck/utility/envvar.hpp
+26
-0
No files found.
example/cpu_02_conv2d_fwd_bias_relu_add/cpu_conv2d_fwd_bias_relu_add.cpp
View file @
07acd53b
...
...
@@ -16,8 +16,8 @@
#define TEST_LAYOUT_NHWC_KYXC_NHWK 0
#define TEST_LAYOUT_NHWC_KYXCK8_NHWK 1
#define TEST_LAYOUT_NHWC_YXCK_NHWK
1
#define TEST_LAYOUT TEST_LAYOUT_NHWC_
K
YXC_NHWK
#define TEST_LAYOUT_NHWC_YXCK_NHWK
2
#define TEST_LAYOUT TEST_LAYOUT_NHWC_YXC
K
_NHWK
using
F32
=
float
;
using
F16
=
ck
::
half_t
;
...
...
include/ck/tensor_operation/cpu/grid/gridwise_gemm_avx2.hpp
View file @
07acd53b
...
...
@@ -9,6 +9,7 @@
#include "threadwise_tensor_slice_transfer_avx2.hpp"
#include "threadwise_tensor_slice_transfer_avx2_specialization.hpp"
#include "dynamic_buffer_cpu.hpp"
#include "envvar.hpp"
#include <utility>
#include <unistd.h>
#include <omp.h>
...
...
@@ -303,8 +304,8 @@ struct GridwiseGemmAvx2_MxN
int
total_threads
=
omp_get_max_threads
();
#if
0
if(total_threads > 1)
{
if
(
total_threads
>
1
&&
ck
::
getenv_int
(
"CK_CPU_BIND_CORE"
,
1
)
!=
0
)
{
#pragma omp parallel
{
int
tid
=
omp_get_thread_num
();
...
...
@@ -313,12 +314,12 @@ struct GridwiseGemmAvx2_MxN
CPU_SET
(
tid
,
&
set
);
if (sched_setaffinity(0, sizeof(set), &set) == -1) {
if
(
sched_setaffinity
(
0
,
sizeof
(
set
),
&
set
)
==
-
1
)
{
throw
std
::
runtime_error
(
"wrong! fail to set thread affinity"
);
}
}
}
#endif
// TODO: openmp aware ordering
//
...
...
include/ck/tensor_operation/cpu/grid/gridwise_gemm_bias_activation_add_avx2.hpp
View file @
07acd53b
...
...
@@ -9,6 +9,7 @@
#include "threadwise_tensor_slice_transfer_avx2.hpp"
#include "threadwise_tensor_slice_transfer_avx2_specialization.hpp"
#include "dynamic_buffer_cpu.hpp"
#include "envvar.hpp"
#include <utility>
#include <unistd.h>
#include <omp.h>
...
...
@@ -329,8 +330,8 @@ struct GridwiseGemmBiasActivationAddAvx2_MxN
int
total_threads
=
omp_get_max_threads
();
#if
0
if(total_threads > 1)
{
if
(
total_threads
>
1
&&
ck
::
getenv_int
(
"CK_CPU_BIND_CORE"
,
1
)
!=
0
)
{
#pragma omp parallel
{
int
tid
=
omp_get_thread_num
();
...
...
@@ -339,12 +340,12 @@ struct GridwiseGemmBiasActivationAddAvx2_MxN
CPU_SET
(
tid
,
&
set
);
if (sched_setaffinity(0, sizeof(set), &set) == -1) {
if
(
sched_setaffinity
(
0
,
sizeof
(
set
),
&
set
)
==
-
1
)
{
throw
std
::
runtime_error
(
"wrong! fail to set thread affinity"
);
}
}
}
#endif
// TODO: openmp aware ordering
//
...
...
include/ck/utility/envvar.hpp
0 → 100644
View file @
07acd53b
#ifndef __ENVVAR_HPP
#define __ENVVAR_HPP
#include <cstdlib>
namespace
ck
{
static
inline
int
getenv_int
(
const
char
*
var_name
,
int
default_int
)
{
char
*
v
=
::
getenv
(
var_name
);
int
r
=
default_int
;
if
(
v
)
r
=
::
atoi
(
v
);
return
r
;
}
static
inline
char
*
getenv_str
(
const
char
*
var_name
,
char
*
default_str
)
{
char
*
v
=
::
getenv
(
var_name
);
if
(
v
)
return
v
;
return
default_str
;
}
}
// namespace ck
#endif
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