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
85e4285d
Commit
85e4285d
authored
2 years ago
by
Kaushik Kulkarni
Committed by
Andreas Klöckner
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
pytato: avoid codegen when possible
parent
829f8929
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#422159
failed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arraycontext/impl/pytato/__init__.py
+20
-8
20 additions, 8 deletions
arraycontext/impl/pytato/__init__.py
with
20 additions
and
8 deletions
arraycontext/impl/pytato/__init__.py
+
20
−
8
View file @
85e4285d
...
...
@@ -486,6 +486,16 @@ class PytatoPyOpenCLArrayContext(_BasePytatoArrayContext):
# }}}
def
_to_frozen
(
key
:
Tuple
[
Any
,
...],
ary
)
->
TaggableCLArray
:
key_str
=
"
_ary
"
+
_ary_container_key_stringifier
(
key
)
return
key_to_frozen_subary
[
key_str
]
if
not
key_to_pt_arrays
:
# all cl arrays => no need to perform any codegen
return
with_array_context
(
rec_keyed_map_array_container
(
_to_frozen
,
array
),
actx
=
None
)
pt_dict_of_named_arrays
=
pt
.
make_dict_of_named_arrays
(
key_to_pt_arrays
)
normalized_expr
,
bound_arguments
=
_normalize_pt_expr
(
...
...
@@ -544,10 +554,6 @@ class PytatoPyOpenCLArrayContext(_BasePytatoArrayContext):
for
k
,
v
in
out_dict
.
items
()}
}
def
_to_frozen
(
key
:
Tuple
[
Any
,
...],
ary
)
->
TaggableCLArray
:
key_str
=
"
_ary
"
+
_ary_container_key_stringifier
(
key
)
return
key_to_frozen_subary
[
key_str
]
return
with_array_context
(
rec_keyed_map_array_container
(
_to_frozen
,
array
),
actx
=
None
)
...
...
@@ -800,6 +806,16 @@ class PytatoJAXArrayContext(_BasePytatoArrayContext):
# }}}
def
_to_frozen
(
key
:
Tuple
[
Any
,
...],
ary
)
->
jnp
.
ndarray
:
key_str
=
"
_ary
"
+
_ary_container_key_stringifier
(
key
)
return
key_to_frozen_subary
[
key_str
]
if
not
key_to_pt_arrays
:
# all cl arrays => no need to perform any codegen
return
with_array_context
(
rec_keyed_map_array_container
(
_to_frozen
,
array
),
actx
=
None
)
pt_dict_of_named_arrays
=
pt
.
make_dict_of_named_arrays
(
key_to_pt_arrays
)
transformed_dag
=
self
.
transform_dag
(
pt_dict_of_named_arrays
)
pt_prg
=
pt
.
generate_jax
(
transformed_dag
,
jit
=
True
)
...
...
@@ -812,10 +828,6 @@ class PytatoJAXArrayContext(_BasePytatoArrayContext):
for
k
,
v
in
out_dict
.
items
()}
}
def
_to_frozen
(
key
:
Tuple
[
Any
,
...],
ary
)
->
jnp
.
ndarray
:
key_str
=
"
_ary
"
+
_ary_container_key_stringifier
(
key
)
return
key_to_frozen_subary
[
key_str
]
return
with_array_context
(
rec_keyed_map_array_container
(
_to_frozen
,
array
),
actx
=
None
)
...
...
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