Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loopy
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ben Sepanski
loopy
Commits
1aacbf22
Commit
1aacbf22
authored
13 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Towards ILP: Implement ILP instance generation.
parent
6c1bee78
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
loopy/codegen/__init__.py
+1
-2
1 addition, 2 deletions
loopy/codegen/__init__.py
loopy/codegen/instruction.py
+29
-8
29 additions, 8 deletions
loopy/codegen/instruction.py
loopy/codegen/loop.py
+1
-0
1 addition, 0 deletions
loopy/codegen/loop.py
with
31 additions
and
10 deletions
loopy/codegen/__init__.py
+
1
−
2
View file @
1aacbf22
...
...
@@ -131,8 +131,7 @@ class CodeGenerationState(object):
def
fix
(
self
,
iname
,
aff
,
space
):
from
loopy.isl_helpers
import
iname_rel_aff
iname_plus_lb_aff
=
iname_rel_aff
(
space
,
iname
,
"
==
"
,
aff
)
iname_plus_lb_aff
=
iname_rel_aff
(
space
,
iname
,
"
==
"
,
aff
)
from
loopy.symbolic
import
pw_aff_to_expr
cns
=
isl
.
Constraint
.
equality_from_aff
(
iname_plus_lb_aff
)
...
...
This diff is collapsed.
Click to expand it.
loopy/codegen/instruction.py
+
29
−
8
View file @
1aacbf22
...
...
@@ -22,18 +22,21 @@ class ILPInstance(Record):
ilp_key
=
ilp_key
)
def
fix
(
self
,
iname
,
aff
):
dt
,
pos
=
aff
.
get_space
().
get_var_dict
()[
iname
]
iname_plus_lb_aff
=
aff
.
add_coefficient
(
dt
,
pos
,
-
1
)
from
loopy.isl_helpers
import
iname_rel_aff
iname_plus_lb_aff
=
iname_rel_aff
(
self
.
implemented_domain
.
get_space
(),
iname
,
"
==
"
,
aff
)
from
loopy.symbolic
import
pw_aff_to_expr
cns
=
isl
.
Constraint
.
equality_from_aff
(
iname_plus_lb_aff
)
expr
=
pw_aff_to_expr
(
aff
)
cns
=
isl
.
Constraint
.
equality_from_aff
(
iname_plus_lb_aff
)
new_assignments
=
self
.
assignments
.
copy
()
new_assignments
[
iname
]
=
expr
return
ILPInstance
(
implemented_domain
=
self
.
implemented_domain
.
add_constraint
(
cns
),
c_code_mapper
=
self
.
c_code_mapper
.
copy_and_assign
(
iname
,
expr
)
,
ilp_key
=
self
.
ilp_key
|
frozen
set
([(
iname
,
expr
)]))
assignments
=
new_assignments
,
ilp_key
=
self
.
ilp_key
|
set
([(
iname
,
expr
)]))
# }}}
...
...
@@ -55,8 +58,26 @@ def generate_ilp_instances(kernel, insn, codegen_state):
if
not
isinstance
(
tag
,
IlpTag
):
continue
from
warnings
import
warn
warn
(
"
implement ILP instance generation
"
)
bounds
=
kernel
.
get_iname_bounds
(
iname
)
from
loopy.isl_helpers
import
(
static_max_of_pw_aff
,
static_value_of_pw_aff
)
from
loopy.symbolic
import
pw_aff_to_expr
length
=
int
(
pw_aff_to_expr
(
static_max_of_pw_aff
(
bounds
.
size
,
constants_only
=
True
)))
lower_bound_aff
=
static_value_of_pw_aff
(
bounds
.
lower_bound_pw_aff
.
coalesce
(),
constants_only
=
False
)
new_result
=
[]
for
ilpi
in
result
:
for
i
in
range
(
length
):
idx_aff
=
lower_bound_aff
+
i
new_result
.
append
(
ilpi
.
fix
(
iname
,
idx_aff
))
result
=
new_result
# }}}
...
...
This diff is collapsed.
Click to expand it.
loopy/codegen/loop.py
+
1
−
0
View file @
1aacbf22
...
...
@@ -129,6 +129,7 @@ def generate_unroll_loop(kernel, sched_index, codegen_state):
tag
=
kernel
.
iname_to_tag
.
get
(
iname
)
bounds
=
kernel
.
get_iname_bounds
(
iname
)
from
loopy.isl_helpers
import
(
static_max_of_pw_aff
,
static_value_of_pw_aff
)
from
loopy.symbolic
import
pw_aff_to_expr
...
...
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