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
45332d8f
Commit
45332d8f
authored
7 years ago
by
Matt Wala
Browse files
Options
Downloads
Patches
Plain Diff
Tuple private scalar assignment hack: Skip make_tuple().
parent
542e9756
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
loopy/preprocess.py
+25
-3
25 additions, 3 deletions
loopy/preprocess.py
with
25 additions
and
3 deletions
loopy/preprocess.py
+
25
−
3
View file @
45332d8f
...
...
@@ -773,6 +773,21 @@ def _hackily_ensure_multi_assignment_return_values_are_scoped_private(kernel):
FIRST_POINTER_ASSIGNEE_IDX
=
1
# noqa
param_dtypes
=
tuple
(
type_inf_mapper
(
param
)
for
param
in
insn
.
expression
.
parameters
)
func_id
=
insn
.
expression
.
function
from
pymbolic.primitives
import
Variable
if
isinstance
(
func_id
,
Variable
):
func_id
=
func_id
.
name
mangle_result
=
kernel
.
mangle_function
(
func_id
,
param_dtypes
)
if
mangle_result
.
target_name
==
"
loopy_make_tuple
"
:
# Skip loopy_make_tuple. This is lowered without a function call.
continue
assignee_dtypes
,
=
type_inf_mapper
(
insn
.
expression
,
return_tuple
=
True
,
return_dtype_set
=
True
)
...
...
@@ -806,7 +821,8 @@ def _hackily_ensure_multi_assignment_return_values_are_scoped_private(kernel):
new_temporaries
[
new_assignee_name
]
=
(
TemporaryVariable
(
name
=
new_assignee_name
,
dtype
=
assignee_dtypes
[
assignee_nr
],
dtype
=
assignee_dtypes
[
assignee_nr
].
with_target
(
kernel
.
target
),
scope
=
temp_var_scope
.
PRIVATE
))
from
pymbolic
import
var
...
...
@@ -985,12 +1001,18 @@ def realize_reduction(kernel, insn_id_filter=None, unknown_types_ok=True,
var_name_gen
(
id
+
"
_arg
"
+
str
(
i
))
for
i
in
range
(
nresults
)]
for
name
in
temp_var_names
:
from
loopy.type_inference
import
infer_arg_and_reduction_dtypes_for_reduction_expression
_
,
reduction_dtypes
=
(
infer_arg_and_reduction_dtypes_for_reduction_expression
(
temp_kernel
,
expr
,
unknown_types_ok
=
False
))
for
name
,
dtype
in
zip
(
temp_var_names
,
reduction_dtypes
):
from
loopy.kernel.data
import
TemporaryVariable
,
temp_var_scope
new_temporary_variables
[
name
]
=
TemporaryVariable
(
name
=
name
,
shape
=
(),
dtype
=
lp
.
auto
,
dtype
=
dtype
,
scope
=
temp_var_scope
.
PRIVATE
)
from
pymbolic
import
var
...
...
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