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
10f93736
Commit
10f93736
authored
3 weeks ago
by
Aaron Councilman
Browse files
Options
Downloads
Patches
Plain Diff
Clean-up cpu schedule
parent
aec9cf1f
No related branches found
No related tags found
1 merge request
!205
Fork reshape
Pipeline
#201882
passed
3 weeks ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
juno_samples/matmul/src/cpu.sch
+34
-20
34 additions, 20 deletions
juno_samples/matmul/src/cpu.sch
with
34 additions
and
20 deletions
juno_samples/matmul/src/cpu.sch
+
34
−
20
View file @
10f93736
...
...
@@ -10,27 +10,45 @@ macro optimize!(X) {
dce(X);
}
macro codegen!(X) {
gcm(*);
float-collections(*);
dce(*);
gcm(*);
macro codegen-prep!(X) {
optimize!(X);
gcm(X);
float-collections(X);
dce(X);
gcm(X);
}
optimize!(*);
macro forkify!(X) {
fixpoint {
forkify(X);
fork-guard-elim(X);
}
}
macro fork-tile {
fork-tile[n, 0, false, true](X);
}
macro parallelize!(X) {
parallel-fork(X);
parallel-reduce(X);
}
fixpoint panic after 20
{
fork
ify(matmul
);
fork
-guard-elim(matmul
);
macro unforkify!(X)
{
fork
-split(X
);
un
fork
ify(X
);
}
optimize!(*);
forkify!(*);
// Mark the whole loop nest as associative, any order of iterations is equivalent
associative(matmul@outer);
// Tile the outer 2 loops to create 16 parallel threads (each responsible for
// computing one block of the output
let par = matmul@outer \ matmul@inner;
fork-tile[4
, 0, false, true
](par);
fork-tile
!
[4](par);
fork-coalesce(par);
fork-interchange[0, 1](par);
fork-interchange[2, 3](par);
...
...
@@ -38,29 +56,25 @@ fork-interchange[1, 2](par);
let split = fork-split(*);
fork-coalesce(split.matmul.fj0 \ split.matmul.fj2);
parallel-fork(split.matmul.fj0 \ split.matmul.fj2);
parallelize!(split.matmul.fj0 \ split.matmul.fj2);
// Pull the body of the parallel loop out into its own device function
let body = outline(split.matmul.fj2);
cpu(body);
// Tile the loop nest for cache performance; 16x16x16 tile
fork-tile[16
, 0, false, true
](body);
fork-tile
!
[16](body);
fixpoint { fork-coalesce(body); }
fork-interchange[1, 2](body);
fork-interchange[3, 4](body);
fork-interchange[2, 3](body);
optimize!(*);
fork-split(body);
reduce-slf(*);
unforkify(body);
optimize!(*);
parallel-reduce(split.matmul.fj0);
xdot[true](*);
codegen!(*);
unforkify!(body);
codegen-prep!(*);
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