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
009b410f
Commit
009b410f
authored
12 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Allow ()-shaped global args that work properly.
parent
4342e827
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
loopy/codegen/expression.py
+14
-3
14 additions, 3 deletions
loopy/codegen/expression.py
with
14 additions
and
3 deletions
loopy/codegen/expression.py
+
14
−
3
View file @
009b410f
...
...
@@ -63,15 +63,17 @@ class TypeInferenceMapper(CombineMapper):
pass
try
:
resul
t
=
self
.
temporary_variables
[
expr
.
name
]
.
dtype
t
v
=
self
.
temporary_variables
[
expr
.
name
]
except
KeyError
:
# name is not a temporary variable, ok
pass
else
:
from
loopy
import
infer_type
if
result
is
infer_type
:
if
tv
.
dtype
is
infer_type
:
raise
TypeInferenceFailure
(
"
attempted type inference on
"
"
variable requiring type inference
"
)
return
result
return
tv
.
dtype
if
expr
.
name
in
self
.
kernel
.
all_inames
():
return
np
.
dtype
(
np
.
int16
)
# don't force single-precision upcast
...
...
@@ -135,6 +137,12 @@ class LoopyCCodeMapper(CCodeMapper):
else
:
return
str
(
self
.
rec
(
self
.
var_subst_map
[
expr
.
name
],
prec
))
else
:
if
expr
.
name
in
self
.
kernel
.
arg_dict
:
arg
=
self
.
kernel
.
arg_dict
[
expr
.
name
]
from
loopy.kernel
import
_ShapedArg
if
isinstance
(
arg
,
_ShapedArg
)
and
arg
.
shape
==
():
return
"
*
"
+
expr
.
name
return
CCodeMapper
.
map_variable
(
self
,
expr
,
prec
)
def
map_tagged_variable
(
self
,
expr
,
enclosing_prec
):
...
...
@@ -183,6 +191,9 @@ class LoopyCCodeMapper(CCodeMapper):
expr
.
aggregate
.
name
,
expr
,
len
(
index_expr
),
len
(
ary_strides
)))
if
len
(
index_expr
)
==
0
:
return
"
*
"
+
expr
.
aggregate
.
name
from
pymbolic.primitives
import
Subscript
return
CCodeMapper
.
map_subscript
(
self
,
Subscript
(
expr
.
aggregate
,
arg
.
offset
+
sum
(
...
...
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