Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
Opus
Commits
a1079c2c
Commit
a1079c2c
authored
3 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Again, same conversion as 3206cec, for NEON
parent
7d8b00f1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dnn/vec_neon.h
+12
-14
12 additions, 14 deletions
dnn/vec_neon.h
with
12 additions
and
14 deletions
dnn/vec_neon.h
+
12
−
14
View file @
a1079c2c
...
...
@@ -291,15 +291,15 @@ static inline void sgemv_accum8x4(float *_out, const qweight *w, int rows, int c
{
int
i
,
j
;
signed
char
x
[
MAX_INPUTS
];
int
out
[
MAX_OUTPUTS
];
const
float32x4_t
scale
=
vdupq_n_f32
(
SCALE
);
const
float32x4_t
scale_1
=
vdupq_n_f32
(
SCALE_1
);
(
void
)
col_stride
;
for
(
i
=
0
;
i
<
rows
;
i
++
)
out
[
i
]
=
(
int
)
floor
(.
5
+
SCALE
*
_out
[
i
]);
for
(
i
=
0
;
i
<
cols
;
i
++
)
x
[
i
]
=
(
int
)
floor
(.
5
+
127
*
_x
[
i
]);
for
(
i
=
0
;
i
<
rows
;
i
+=
8
)
{
int32x4_t
acc0
,
acc1
;
acc0
=
vld1q_
s
32
(
&
out
[
i
]);
acc1
=
vld1q_
s
32
(
&
out
[
i
+
4
]);
acc0
=
vcvtnq_s32_f32
(
vmulq_f32
(
scale
,
vld1q_
f
32
(
&
_
out
[
i
])
))
;
acc1
=
vcvtnq_s32_f32
(
vmulq_f32
(
scale
,
vld1q_
f
32
(
&
_
out
[
i
+
4
])
))
;
for
(
j
=
0
;
j
<
cols
;
j
+=
4
)
{
int8x16_t
vw0
,
vw1
,
vx
;
...
...
@@ -310,25 +310,24 @@ static inline void sgemv_accum8x4(float *_out, const qweight *w, int rows, int c
acc1
=
vdotprod
(
acc1
,
vw1
,
vx
);
w
+=
32
;
}
vst1q_
s
32
(
&
out
[
i
],
acc0
);
vst1q_
s
32
(
&
out
[
i
+
4
],
acc1
);
vst1q_
f
32
(
&
_
out
[
i
],
vmulq_f32
(
scale_1
,
vcvtq_f32_s32
(
acc0
)
))
;
vst1q_
f
32
(
&
_
out
[
i
+
4
],
vmulq_f32
(
scale_1
,
vcvtq_f32_s32
(
acc1
)
))
;
}
for
(
i
=
0
;
i
<
rows
;
i
++
)
_out
[
i
]
=
SCALE_1
*
out
[
i
];
}
static
inline
void
sparse_sgemv_accum8x4
(
float
*
_out
,
const
qweight
*
w
,
int
rows
,
int
cols
,
const
int
*
idx
,
const
float
*
_x
)
{
int
i
,
j
;
signed
char
x
[
MAX_INPUTS
];
int
out
[
MAX_OUTPUTS
]
;
for
(
i
=
0
;
i
<
rows
;
i
++
)
out
[
i
]
=
(
int
)
floor
(.
5
+
SCALE
*
_out
[
i
]
);
const
float32x4_t
scale
=
vdupq_n_f32
(
SCALE
)
;
const
float32x4_t
scale_1
=
vdupq_n_f32
(
SCALE_1
);
for
(
i
=
0
;
i
<
cols
;
i
++
)
x
[
i
]
=
floor
(.
5
+
127
*
_x
[
i
]);
for
(
i
=
0
;
i
<
rows
;
i
+=
8
)
{
int
colblocks
;
int32x4_t
acc0
,
acc1
;
acc0
=
vld1q_
s
32
(
&
out
[
i
]);
acc1
=
vld1q_
s
32
(
&
out
[
i
+
4
]);
acc0
=
vcvtnq_s32_f32
(
vmulq_f32
(
scale
,
vld1q_
f
32
(
&
_
out
[
i
])
))
;
acc1
=
vcvtnq_s32_f32
(
vmulq_f32
(
scale
,
vld1q_
f
32
(
&
_
out
[
i
+
4
])
))
;
colblocks
=
*
idx
++
;
for
(
j
=
0
;
j
<
colblocks
;
j
++
)
{
...
...
@@ -342,8 +341,7 @@ static inline void sparse_sgemv_accum8x4(float *_out, const qweight *w, int rows
acc1
=
vdotprod
(
acc1
,
vw1
,
vx
);
w
+=
32
;
}
vst1q_
s
32
(
&
out
[
i
],
acc0
);
vst1q_
s
32
(
&
out
[
i
+
4
],
acc1
);
vst1q_
f
32
(
&
_
out
[
i
],
vmulq_f32
(
scale_1
,
vcvtq_f32_s32
(
acc0
)
))
;
vst1q_
f
32
(
&
_
out
[
i
+
4
],
vmulq_f32
(
scale_1
,
vcvtq_f32_s32
(
acc1
)
))
;
}
for
(
i
=
0
;
i
<
rows
;
i
++
)
_out
[
i
]
=
SCALE_1
*
out
[
i
];
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment