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
60cd3aad
Commit
60cd3aad
authored
9 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Introduce a notion of 'scope' for temporary variables, in preparation for global temporaries
parent
8d294c35
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/ref_kernel.rst
+2
-0
2 additions, 0 deletions
doc/ref_kernel.rst
loopy/__init__.py
+2
-2
2 additions, 2 deletions
loopy/__init__.py
loopy/kernel/data.py
+24
-0
24 additions, 0 deletions
loopy/kernel/data.py
with
28 additions
and
2 deletions
doc/ref_kernel.rst
+
2
−
0
View file @
60cd3aad
...
@@ -345,6 +345,8 @@ Temporary Variables
...
@@ -345,6 +345,8 @@ Temporary Variables
Temporary variables model OpenCL's ``private`` and ``local`` address spaces. Both
Temporary variables model OpenCL's ``private`` and ``local`` address spaces. Both
have the lifetime of a kernel invocation.
have the lifetime of a kernel invocation.
.. autoclass:: temp_var_scope
.. autoclass:: TemporaryVariable
.. autoclass:: TemporaryVariable
:members:
:members:
:undoc-members:
:undoc-members:
...
...
This diff is collapsed.
Click to expand it.
loopy/__init__.py
+
2
−
2
View file @
60cd3aad
...
@@ -42,7 +42,7 @@ from loopy.kernel.data import (
...
@@ -42,7 +42,7 @@ from loopy.kernel.data import (
ValueArg
,
GlobalArg
,
ConstantArg
,
ImageArg
,
ValueArg
,
GlobalArg
,
ConstantArg
,
ImageArg
,
memory_ordering
,
memory_scope
,
VarAtomicity
,
AtomicInit
,
AtomicUpdate
,
memory_ordering
,
memory_scope
,
VarAtomicity
,
AtomicInit
,
AtomicUpdate
,
InstructionBase
,
Assignment
,
ExpressionInstruction
,
CInstruction
,
InstructionBase
,
Assignment
,
ExpressionInstruction
,
CInstruction
,
TemporaryVariable
,
temp_var_scope
,
TemporaryVariable
,
SubstitutionRule
)
SubstitutionRule
)
from
loopy.kernel
import
LoopKernel
,
kernel_state
from
loopy.kernel
import
LoopKernel
,
kernel_state
...
@@ -129,7 +129,7 @@ __all__ = [
...
@@ -129,7 +129,7 @@ __all__ = [
"
memory_ordering
"
,
"
memory_scope
"
,
"
VarAtomicity
"
,
"
memory_ordering
"
,
"
memory_scope
"
,
"
VarAtomicity
"
,
"
AtomicInit
"
,
"
AtomicUpdate
"
,
"
AtomicInit
"
,
"
AtomicUpdate
"
,
"
ValueArg
"
,
"
ScalarArg
"
,
"
GlobalArg
"
,
"
ArrayArg
"
,
"
ConstantArg
"
,
"
ImageArg
"
,
"
ValueArg
"
,
"
ScalarArg
"
,
"
GlobalArg
"
,
"
ArrayArg
"
,
"
ConstantArg
"
,
"
ImageArg
"
,
"
TemporaryVariable
"
,
"
temp_var_scope
"
,
"
TemporaryVariable
"
,
"
SubstitutionRule
"
,
"
SubstitutionRule
"
,
"
InstructionBase
"
,
"
Assignment
"
,
"
ExpressionInstruction
"
,
"
CInstruction
"
,
"
InstructionBase
"
,
"
Assignment
"
,
"
ExpressionInstruction
"
,
"
CInstruction
"
,
...
...
This diff is collapsed.
Click to expand it.
loopy/kernel/data.py
+
24
−
0
View file @
60cd3aad
...
@@ -267,6 +267,19 @@ class ValueArg(KernelArgument):
...
@@ -267,6 +267,19 @@ class ValueArg(KernelArgument):
# {{{ temporary variable
# {{{ temporary variable
class
temp_var_scope
:
"""
Storage location of a temporary
.. attribute:: PRIVATE
.. attribute:: LOCAL
.. attribute:: GLOBAL
"""
PRIVATE
=
0
LOCAL
=
1
GLOBAL
=
2
class
TemporaryVariable
(
ArrayBase
):
class
TemporaryVariable
(
ArrayBase
):
__doc__
=
ArrayBase
.
__doc__
+
"""
__doc__
=
ArrayBase
.
__doc__
+
"""
.. attribute:: storage_shape
.. attribute:: storage_shape
...
@@ -281,6 +294,8 @@ class TemporaryVariable(ArrayBase):
...
@@ -281,6 +294,8 @@ class TemporaryVariable(ArrayBase):
The name of a storage array that is to be used to actually
The name of a storage array that is to be used to actually
hold the data in this temporary.
hold the data in this temporary.
.. autoattribute:: scope
"""
"""
min_target_axes
=
0
min_target_axes
=
0
...
@@ -318,6 +333,15 @@ class TemporaryVariable(ArrayBase):
...
@@ -318,6 +333,15 @@ class TemporaryVariable(ArrayBase):
storage_shape
=
storage_shape
,
storage_shape
=
storage_shape
,
base_storage
=
base_storage
)
base_storage
=
base_storage
)
@property
def
scope
(
self
):
"""
One of :class:`loopy.temp_var_scope`.
"""
if
self
.
is_local
:
return
temp_var_scope
.
LOCAL
else
:
return
temp_var_scope
.
PRIVATE
@property
@property
def
nbytes
(
self
):
def
nbytes
(
self
):
shape
=
self
.
shape
shape
=
self
.
shape
...
...
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