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
jerrrrry
infinicore
Commits
c667efbd
Unverified
Commit
c667efbd
authored
Apr 11, 2025
by
PanZezhong1725
Committed by
GitHub
Apr 11, 2025
Browse files
Merge pull request #132 from InfiniTensor/issue/130
issue/130: GEMM算子CPU平台的omp重构
parents
4f8afafd
8e2192f4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
23 deletions
+26
-23
src/infiniop/ops/gemm/cpu/gemm_cpu.cc
src/infiniop/ops/gemm/cpu/gemm_cpu.cc
+26
-23
No files found.
src/infiniop/ops/gemm/cpu/gemm_cpu.cc
View file @
c667efbd
...
...
@@ -40,12 +40,17 @@ void calculate(
std
::
swap
(
a
,
b
);
}
for
(
size_t
i
=
0
;
i
<
info
.
batch
;
++
i
)
{
for
(
size_t
m_
=
0
;
m_
<
info
.
m
;
++
m_
)
{
for
(
size_t
n_
=
0
;
n_
<
info
.
n
;
++
n_
)
{
#pragma omp parallel for
for
(
ptrdiff_t
index
=
0
;
index
<
ptrdiff_t
(
info
.
batch
*
info
.
m
*
info
.
n
);
++
index
)
{
size_t
ind
=
index
;
size_t
n_
=
ind
%
info
.
n
;
ind
/=
info
.
n
;
size_t
m_
=
ind
%
info
.
m
;
ind
/=
info
.
m
;
size_t
i
=
ind
;
auto
c_
=
reinterpret_cast
<
Tdata
*>
(
c
)
+
i
*
info
.
c_matrix
.
stride
+
m_
*
info
.
c_matrix
.
row_stride
+
n_
*
info
.
c_matrix
.
col_stride
;
float
sum
=
0
;
for
(
size_
t
k_
=
0
;
k_
<
info
.
k
;
++
k_
)
{
for
(
in
t
k_
=
0
;
k_
<
static_cast
<
int
>
(
info
.
k
)
;
++
k_
)
{
auto
a_
=
reinterpret_cast
<
const
Tdata
*>
(
a
)
+
i
*
info
.
a_matrix
.
stride
+
m_
*
info
.
a_matrix
.
row_stride
+
k_
*
info
.
a_matrix
.
col_stride
;
auto
b_
=
reinterpret_cast
<
const
Tdata
*>
(
b
)
+
i
*
info
.
b_matrix
.
stride
+
n_
*
info
.
b_matrix
.
col_stride
+
k_
*
info
.
b_matrix
.
row_stride
;
if
constexpr
(
std
::
is_same
<
Tdata
,
fp16_t
>::
value
)
{
...
...
@@ -64,8 +69,6 @@ void calculate(
*
c_
=
beta
*
(
*
c_
)
+
alpha
*
sum
;
}
}
}
}
}
infiniStatus_t
Descriptor
::
calculate
(
...
...
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