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
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
Andreas Klöckner
loopy
Commits
0a7c4263
Commit
0a7c4263
authored
7 years ago
by
Kaushik Kulkarni
Browse files
Options
Downloads
Patches
Plain Diff
Checked that the functions are scoped.
parent
47a73915
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!426
Discussion: kernel_callables_v3-edit2
,
!246
WIP: Kernel Callables
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
loopy/preprocess.py
+29
-0
29 additions, 0 deletions
loopy/preprocess.py
with
29 additions
and
0 deletions
loopy/preprocess.py
+
29
−
0
View file @
0a7c4263
...
...
@@ -37,6 +37,8 @@ from loopy.version import DATA_MODEL_VERSION
from
loopy.kernel.data
import
make_assignment
# for the benefit of loopy.statistics, for now
from
loopy.type_inference
import
infer_unknown_types
from
pymbolic.primitives
import
Variable
from
pymbolic.mapper
import
Collector
import
logging
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -2097,6 +2099,29 @@ def check_atomic_loads(kernel):
# }}}
# {{{ check for unscoped calls
class
UnScopedCallCollector
(
Collector
):
def
map_call
(
self
,
expr
):
if
isinstance
(
expr
.
function
,
Variable
):
return
set
([
expr
.
function
.
name
])
else
:
return
set
()
def
check_function_are_scoped
(
kernel
):
"""
Checks if all the calls in the instruction expression have been scoped,
otherwise indicate to what all calls we await signature.
"""
for
insn
in
kernel
.
instructions
:
unscoped_calls
=
UnScopedCallCollector
()(
insn
.
expression
)
if
unscoped_calls
:
raise
LoopyError
(
"
Unknown function obtained %s -- register a function
"
"
or a kernel corresponding to it.
"
%
unscoped_calls
[
0
])
# }}}
preprocess_cache
=
WriteOncePersistentDict
(
"
loopy-preprocess-cache-v2-
"
+
DATA_MODEL_VERSION
,
key_builder
=
LoopyKeyBuilder
())
...
...
@@ -2146,6 +2171,10 @@ def preprocess_kernel(kernel, device=None):
from
loopy.transform.subst
import
expand_subst
kernel
=
expand_subst
(
kernel
)
# Checking if all the functions being used in the kernel and scoped to a
# finite namespace
check_function_are_scoped
(
kernel
)
# Ordering restriction:
# Type inference and reduction iname uniqueness don't handle substitutions.
# Get them out of the way.
...
...
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