Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LightMotif
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Larralde
LightMotif
Commits
dacd23a8
Commit
dacd23a8
authored
9 months ago
by
Martin Larralde
Browse files
Options
Downloads
Patches
Plain Diff
Clean code in NEON platform implementation
parent
9f3fe1a5
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
lightmotif/src/pli/platform/neon.rs
+9
-12
9 additions, 12 deletions
lightmotif/src/pli/platform/neon.rs
with
9 additions
and
12 deletions
lightmotif/src/pli/platform/neon.rs
+
9
−
12
View file @
dacd23a8
...
...
@@ -131,10 +131,6 @@ unsafe fn score_f32_neon<A: Alphabet, C: MultipleOf<U16>>(
rows
:
Range
<
usize
>
,
scores
:
&
mut
StripedScores
<
f32
,
C
>
,
)
{
use
crate
::
dense
::
DenseMatrix
;
let
zero_u8
=
vdupq_n_u8
(
0
);
let
zero_f32
=
vdupq_n_f32
(
0.0
);
// process columns of the striped matrix, any multiple of 16 is supported
let
data
=
scores
.matrix_mut
();
for
offset
in
(
0
..
C
::
Quotient
::
USIZE
)
.map
(|
i
|
i
*
<
Neon
as
Backend
>
::
LANES
::
USIZE
)
{
...
...
@@ -142,7 +138,12 @@ unsafe fn score_f32_neon<A: Alphabet, C: MultipleOf<U16>>(
// process every position of the sequence data
for
i
in
rows
.clone
()
{
// reset sums for current position
let
mut
s
=
float32x4x4_t
(
zero_f32
,
zero_f32
,
zero_f32
,
zero_f32
);
let
mut
s
=
float32x4x4_t
(
vdupq_n_f32
(
0.0
),
vdupq_n_f32
(
0.0
),
vdupq_n_f32
(
0.0
),
vdupq_n_f32
(
0.0
),
);
// reset position
let
mut
dataptr
=
seq
.matrix
()[
i
]
.as_ptr
()
.add
(
offset
);
let
mut
pssmptr
=
pssm
[
0
]
.as_ptr
();
...
...
@@ -150,10 +151,10 @@ unsafe fn score_f32_neon<A: Alphabet, C: MultipleOf<U16>>(
for
_
in
0
..
pssm
.rows
()
{
// load sequence row
let
x
=
vld1q_u8
(
dataptr
as
*
const
u8
);
let
z
=
vzipq_u8
(
x
,
zero_u8
);
let
z
=
vzipq_u8
(
x
,
vdupq_n_u8
(
0
)
);
// transform u8 into u32
let
lo
=
vzipq_u8
(
z
.0
,
zero_u8
);
let
hi
=
vzipq_u8
(
z
.1
,
zero_u8
);
let
lo
=
vzipq_u8
(
z
.0
,
vdupq_n_u8
(
0
)
);
let
hi
=
vzipq_u8
(
z
.1
,
vdupq_n_u8
(
0
)
);
let
x1
=
vreinterpretq_u32_u8
(
lo
.0
);
let
x2
=
vreinterpretq_u32_u8
(
lo
.1
);
let
x3
=
vreinterpretq_u32_u8
(
hi
.0
);
...
...
@@ -190,10 +191,6 @@ unsafe fn score_u8_neon<A: Alphabet, C: MultipleOf<U16>>(
rows
:
Range
<
usize
>
,
scores
:
&
mut
StripedScores
<
u8
,
C
>
,
)
{
use
crate
::
dense
::
DenseMatrix
;
let
zero_u8
=
vdupq_n_u8
(
0
);
let
zero_f32
=
vdupq_n_f32
(
0.0
);
// process columns of the striped matrix, any multiple of 16 is supported
let
data
=
scores
.matrix_mut
();
for
offset
in
(
0
..
C
::
Quotient
::
USIZE
)
.map
(|
i
|
i
*
<
Neon
as
Backend
>
::
LANES
::
USIZE
)
{
...
...
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