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
0b1a9eb3
Commit
0b1a9eb3
authored
3 months ago
by
Russel Arbore
Browse files
Options
Downloads
Patches
Plain Diff
Add intrinsics to math exprs, array slf gets rid of first ctrl pts
look in gamut
parent
0958995e
No related branches found
No related tags found
1 merge request
!178
Some Cava optimization
Pipeline
#201655
passed
3 months ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hercules_ir/src/einsum.rs
+31
-0
31 additions, 0 deletions
hercules_ir/src/einsum.rs
hercules_opt/src/utils.rs
+7
-0
7 additions, 0 deletions
hercules_opt/src/utils.rs
juno_samples/cava/src/cpu.sch
+3
-0
3 additions, 0 deletions
juno_samples/cava/src/cpu.sch
with
41 additions
and
0 deletions
hercules_ir/src/einsum.rs
+
31
−
0
View file @
0b1a9eb3
...
...
@@ -34,6 +34,7 @@ pub enum MathExpr {
Unary
(
UnaryOperator
,
MathID
),
Binary
(
BinaryOperator
,
MathID
,
MathID
),
Ternary
(
TernaryOperator
,
MathID
,
MathID
,
MathID
),
IntrinsicFunc
(
Intrinsic
,
Box
<
[
MathID
]
>
),
}
pub
type
MathEnv
=
Vec
<
MathExpr
>
;
...
...
@@ -224,6 +225,16 @@ impl<'a> EinsumContext<'a> {
let
third
=
self
.compute_math_expr
(
third
);
MathExpr
::
Ternary
(
op
,
first
,
second
,
third
)
}
Node
::
IntrinsicCall
{
intrinsic
,
ref
args
,
}
=>
{
let
args
=
args
.into_iter
()
.map
(|
id
|
self
.compute_math_expr
(
*
id
))
.collect
();
MathExpr
::
IntrinsicFunc
(
intrinsic
,
args
)
}
Node
::
Read
{
collect
,
ref
indices
,
...
...
@@ -322,6 +333,14 @@ impl<'a> EinsumContext<'a> {
let
third
=
self
.substitute_new_dims
(
third
);
self
.intern_math_expr
(
MathExpr
::
Ternary
(
op
,
first
,
second
,
third
))
}
MathExpr
::
IntrinsicFunc
(
intrinsic
,
ref
args
)
=>
{
let
args
=
args
.clone
()
.iter
()
.map
(|
id
|
self
.substitute_new_dims
(
*
id
))
.collect
();
self
.intern_math_expr
(
MathExpr
::
IntrinsicFunc
(
intrinsic
,
args
))
}
_
=>
id
,
}
}
...
...
@@ -355,6 +374,9 @@ pub fn opaque_nodes_in_expr(env: &MathEnv, id: MathID) -> HashSet<NodeID> {
stack
.push
(
second
);
stack
.push
(
third
);
}
MathExpr
::
IntrinsicFunc
(
_
,
ref
args
)
=>
{
stack
.extend
(
args
);
}
}
}
set
...
...
@@ -412,5 +434,14 @@ pub fn debug_print_math_expr(id: MathID, env: &MathEnv) {
debug_print_math_expr
(
third
,
env
);
print!
(
")"
);
}
MathExpr
::
IntrinsicFunc
(
intrinsic
,
ref
args
)
=>
{
print!
(
"{}("
,
intrinsic
.lower_case_name
());
debug_print_math_expr
(
id
,
env
);
for
arg
in
args
{
print!
(
", "
);
debug_print_math_expr
(
*
arg
,
env
);
}
print!
(
")"
);
}
}
}
This diff is collapsed.
Click to expand it.
hercules_opt/src/utils.rs
+
7
−
0
View file @
0b1a9eb3
...
...
@@ -474,6 +474,13 @@ pub fn materialize_simple_einsum_expr(
third
,
})
}
MathExpr
::
IntrinsicFunc
(
intrinsic
,
ref
args
)
=>
{
let
args
=
args
.into_iter
()
.map
(|
id
|
materialize_simple_einsum_expr
(
edit
,
*
id
,
env
,
dim_substs
))
.collect
();
edit
.add_node
(
Node
::
IntrinsicCall
{
intrinsic
,
args
})
}
_
=>
panic!
(),
}
}
...
...
This diff is collapsed.
Click to expand it.
juno_samples/cava/src/cpu.sch
+
3
−
0
View file @
0b1a9eb3
...
...
@@ -102,6 +102,9 @@ simpl!(fuse4);
fork-unroll(fuse4@channel_loop);
simpl!(fuse4);
//fork-fusion(fuse4@channel_loop);
simpl!(fuse4);
array-slf(fuse4);
simpl!(fuse4);
fork-split(fuse4);
unforkify(fuse4);
...
...
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