Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hercules
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
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
llvm
Hercules
Commits
1848d531
Commit
1848d531
authored
2 months ago
by
Russel Arbore
Browse files
Options
Downloads
Patches
Plain Diff
Chefs kiss
parent
5ba0636b
No related branches found
No related tags found
1 merge request
!178
Some Cava optimization
Pipeline
#201633
passed
2 months ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
juno_samples/cava/src/cava.jn
+17
-17
17 additions, 17 deletions
juno_samples/cava/src/cava.jn
juno_samples/cava/src/cpu.sch
+19
-0
19 additions, 0 deletions
juno_samples/cava/src/cpu.sch
with
36 additions
and
17 deletions
juno_samples/cava/src/cava.jn
+
17
−
17
View file @
1848d531
...
...
@@ -35,20 +35,6 @@ fn scale<row : usize, col : usize>(input : u8[CHAN, row, col]) -> f32[CHAN, row,
return
res
;
}
fn
descale
<
row
:
usize
,
col
:
usize
>
(
input
:
f32
[
CHAN
,
row
,
col
])
->
u8
[
CHAN
,
row
,
col
]
{
let
res
:
u8
[
CHAN
,
row
,
col
];
for
chan
=
0
to
CHAN
{
for
r
=
0
to
row
{
for
c
=
0
to
col
{
res
[
chan
,
r
,
c
]
=
min!
::
<
f32
>
(
max!
::
<
f32
>
(
input
[
chan
,
r
,
c
]
*
255
,
0
),
255
)
as
u8
;
}
}
}
return
res
;
}
fn
demosaic
<
row
:
usize
,
col
:
usize
>
(
input
:
f32
[
CHAN
,
row
,
col
])
->
f32
[
CHAN
,
row
,
col
]
{
@
res2
let
res
:
f32
[
CHAN
,
row
,
col
];
...
...
@@ -184,7 +170,7 @@ fn gamut<row : usize, col : usize, num_ctrl_pts : usize>(
fn
tone_map
<
row
:
usize
,
col
:
usize
>
(
input
:
f32
[
CHAN
,
row
,
col
],
tone_map
:
f32
[
256
,
CHAN
])
->
f32
[
CHAN
,
row
,
col
]
{
let
result
:
f32
[
CHAN
,
row
,
col
];
@
res1
let
result
:
f32
[
CHAN
,
row
,
col
];
for
chan
=
0
to
CHAN
{
for
r
=
0
to
row
{
...
...
@@ -198,6 +184,20 @@ fn tone_map<row : usize, col:usize>
return
result
;
}
fn
descale
<
row
:
usize
,
col
:
usize
>
(
input
:
f32
[
CHAN
,
row
,
col
])
->
u8
[
CHAN
,
row
,
col
]
{
@
res2
let
res
:
u8
[
CHAN
,
row
,
col
];
for
chan
=
0
to
CHAN
{
for
r
=
0
to
row
{
for
c
=
0
to
col
{
res
[
chan
,
r
,
c
]
=
min!
::
<
f32
>
(
max!
::
<
f32
>
(
input
[
chan
,
r
,
c
]
*
255
,
0
),
255
)
as
u8
;
}
}
}
return
res
;
}
#[entry]
fn
cava
<
r
,
c
,
num_ctrl_pts
:
usize
>
(
input
:
u8
[
CHAN
,
r
,
c
],
...
...
@@ -212,7 +212,7 @@ fn cava<r, c, num_ctrl_pts : usize>(
@
fuse2
let
denosd
=
denoise
::
<
r
,
c
>
(
demosc
);
@
fuse3
let
transf
=
transform
::
<
r
,
c
>
(
denosd
,
TsTw
);
@
fuse4
let
gamutd
=
gamut
::
<
r
,
c
,
num_ctrl_pts
>
(
transf
,
ctrl_pts
,
weights
,
coefs
);
let
tonemd
=
tone_map
::
<
r
,
c
>
(
gamutd
,
tonemap
);
let
dscald
=
descale
::
<
r
,
c
>
(
tonemd
);
@
fuse5
let
tonemd
=
tone_map
::
<
r
,
c
>
(
gamutd
,
tonemap
);
@
fuse5
let
dscald
=
descale
::
<
r
,
c
>
(
tonemd
);
return
dscald
;
}
This diff is collapsed.
Click to expand it.
juno_samples/cava/src/cpu.sch
+
19
−
0
View file @
1848d531
...
...
@@ -22,6 +22,9 @@ inline(fuse3);
let fuse4 = outline(cava@fuse4);
inline(fuse4);
let fuse5 = outline(cava@fuse5);
inline(fuse5);
ip-sroa(*);
sroa(*);
simpl!(*);
...
...
@@ -58,6 +61,7 @@ fixpoint {
fork-guard-elim(fuse3);
fork-coalesce(fuse3);
}
simpl!(fuse3);
fork-split(fuse3);
unforkify(fuse3);
...
...
@@ -68,8 +72,23 @@ fixpoint {
fork-guard-elim(fuse4);
fork-coalesce(fuse4);
}
simpl!(fuse4);
fork-split(fuse4);
unforkify(fuse4);
no-memset(fuse5@res1);
no-memset(fuse5@res2);
fixpoint {
forkify(fuse5);
fork-guard-elim(fuse5);
fork-coalesce(fuse5);
}
simpl!(fuse5);
array-slf(fuse5);
simpl!(fuse5);
fork-split(fuse5);
unforkify(fuse5);
simpl!(*);
delete-uncalled(*);
gcm(*);
\ No newline at end of file
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