Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arraycontext
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
arraycontext
Commits
5500b905
Commit
5500b905
authored
2 years ago
by
Andreas Klöckner
Committed by
Andreas Klöckner
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use NameHint/PrefixNamed to generate better kernel names in pytato freeze
parent
37e142e7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#304468
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arraycontext/impl/pytato/__init__.py
+24
-6
24 additions, 6 deletions
arraycontext/impl/pytato/__init__.py
with
24 additions
and
6 deletions
arraycontext/impl/pytato/__init__.py
+
24
−
6
View file @
5500b905
...
...
@@ -309,20 +309,38 @@ class PytatoPyOpenCLArrayContext(_BasePytatoArrayContext):
try
:
pt_prg
=
self
.
_freeze_prg_cache
[
normalized_expr
]
except
KeyError
:
if
normalized_expr
in
self
.
_dag_transform_cache
:
transformed_dag
=
self
.
_dag_transform_cache
[
normalized_expr
]
else
:
try
:
transformed_dag
,
function_name
=
\
self
.
_dag_transform_cache
[
normalized_expr
]
except
KeyError
:
transformed_dag
=
self
.
transform_dag
(
normalized_expr
)
self
.
_dag_transform_cache
[
normalized_expr
]
=
transformed_dag
from
pytato.tags
import
PrefixNamed
name_hint_tags
=
[]
for
subary
in
key_to_pt_arrays
.
values
():
name_hint_tags
.
extend
(
subary
.
tags_of_type
(
PrefixNamed
))
from
pytools
import
common_prefix
name_hint
=
common_prefix
([
nh
.
prefix
for
nh
in
name_hint_tags
])
if
name_hint
:
# All name_hint_tags shared at least some common prefix.
function_name
=
f
"
frozen_
{
name_hint
}
"
else
:
function_name
=
"
frozen_result
"
self
.
_dag_transform_cache
[
normalized_expr
]
=
(
transformed_dag
,
function_name
)
pt_prg
=
pt
.
generate_loopy
(
transformed_dag
,
options
=
lp
.
Options
(
return_dict
=
True
,
no_numpy
=
True
),
cl_device
=
self
.
queue
.
device
)
cl_device
=
self
.
queue
.
device
,
function_name
=
function_name
)
pt_prg
=
pt_prg
.
with_transformed_program
(
self
.
transform_loopy_program
)
self
.
_freeze_prg_cache
[
normalized_expr
]
=
pt_prg
else
:
transformed_dag
=
self
.
_dag_transform_cache
[
normalized_expr
]
transformed_dag
,
function_name
=
\
self
.
_dag_transform_cache
[
normalized_expr
]
assert
len
(
pt_prg
.
bound_arguments
)
==
0
evt
,
out_dict
=
pt_prg
(
self
.
queue
,
**
bound_arguments
)
...
...
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