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
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
Andreas Klöckner
loopy
Commits
bae291e6
Commit
bae291e6
authored
12 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Add transform-arg-to-image.
parent
5eedbe24
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
MEMO
+12
-0
12 additions, 0 deletions
MEMO
doc/reference.rst
+4
-2
4 additions, 2 deletions
doc/reference.rst
loopy/__init__.py
+16
-0
16 additions, 0 deletions
loopy/__init__.py
loopy/kernel.py
+16
-13
16 additions, 13 deletions
loopy/kernel.py
with
48 additions
and
15 deletions
MEMO
+
12
−
0
View file @
bae291e6
...
...
@@ -49,6 +49,16 @@ To-do
- Make tests run on GPUs
- Streamline arg
- Fix timer / call code
- variant_prefetch_fields in test_dg
- make sure simple side effects in global work
- syntax for linear array access
Fixes:
- Group instructions by dependency/inames for scheduling, to
...
...
@@ -62,6 +72,8 @@ Fixes:
Future ideas
^^^^^^^^^^^^
- Put all OpenCL functions into mangler
- Fuse: store/fetch elimination?
- Expose iname-duplicate-and-rename as a primitive.
...
...
This diff is collapsed.
Click to expand it.
doc/reference.rst
+
4
−
2
View file @
bae291e6
...
...
@@ -168,8 +168,8 @@ Dealing with Substitution Rules
.. autofunction:: expand_subst
Precomputation and Prefetching
------------------------------
Caching,
Precomputation and Prefetching
------------------------------
---------
.. autofunction:: precompute
...
...
@@ -177,6 +177,8 @@ Precomputation and Prefetching
Uses :func:`extract_subst` and :func:`precompute`.
.. autofunction:: change_arg_to_image
Padding
-------
...
...
This diff is collapsed.
Click to expand it.
loopy/__init__.py
+
16
−
0
View file @
bae291e6
...
...
@@ -609,6 +609,22 @@ def add_dependency(kernel, insn_match, dependency):
# }}}
# {{{ change variable kinds
def
change_arg_to_image
(
knl
,
name
):
new_args
=
[]
for
arg
in
knl
.
args
:
if
arg
.
name
==
name
:
assert
arg
.
offset
==
0
assert
arg
.
shape
is
not
None
new_args
.
append
(
ImageArg
(
arg
.
name
,
dtype
=
arg
.
dtype
,
shape
=
arg
.
shape
))
else
:
new_args
.
append
(
arg
)
return
knl
.
copy
(
args
=
new_args
)
# }}}
...
...
This diff is collapsed.
Click to expand it.
loopy/kernel.py
+
16
−
13
View file @
bae291e6
...
...
@@ -198,30 +198,33 @@ class ConstantArg(_ShapedArg):
return
"
<ConstantArg
'
%s
'
of type %s and shape (%s)>
"
%
(
self
.
name
,
self
.
dtype
,
"
,
"
.
join
(
str
(
i
)
for
i
in
self
.
shape
))
class
ImageArg
(
object
):
class
ImageArg
(
Record
):
def
__init__
(
self
,
name
,
dtype
,
dimensions
=
None
,
shape
=
None
):
self
.
name
=
name
self
.
dtype
=
np
.
dtype
(
dtype
)
dtype
=
np
.
dtype
(
dtype
)
if
shape
is
not
None
:
if
dimensions
is
not
None
:
raise
RuntimeError
(
"
cannot specify both shape and dimensions
"
"
in ImageArg
"
)
self
.
dimensions
=
len
(
shape
)
self
.
shape
=
shape
if
dimensions
is
not
None
and
dimensions
!=
len
(
shape
):
raise
RuntimeError
(
"
cannot specify both shape and
"
"
disagreeing dimensions in ImageArg
"
)
dimensions
=
len
(
shape
)
else
:
if
not
isinstance
(
dimensions
,
int
):
raise
RuntimeError
(
"
ImageArg: dimensions must be an integer
"
)
self
.
dimensions
=
dimensions
Record
.
__init__
(
self
,
dimensions
=
dimensions
,
shape
=
shape
,
dtype
=
dtype
,
name
=
name
)
def
__repr__
(
self
):
return
"
<ImageArg
'
%s
'
of type %s>
"
%
(
self
.
name
,
self
.
dtype
)
class
ValueArg
(
object
):
class
ValueArg
(
Record
):
def
__init__
(
self
,
name
,
dtype
,
approximately
=
None
):
self
.
name
=
name
self
.
dtype
=
np
.
dtype
(
dtype
)
self
.
approximately
=
approximately
Record
.
__init__
(
self
,
name
=
name
,
dtype
=
np
.
dtype
(
dtype
),
approximately
=
approximately
)
def
__repr__
(
self
):
return
"
<ValueArg
'
%s
'
of type %s>
"
%
(
self
.
name
,
self
.
dtype
)
...
...
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