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
9ecdddce
Commit
9ecdddce
authored
13 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Fix a variety of bugs in tagged subst rule use.
parent
655b07d2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
MEMO
+2
-0
2 additions, 0 deletions
MEMO
loopy/cse.py
+5
-5
5 additions, 5 deletions
loopy/cse.py
loopy/symbolic.py
+9
-3
9 additions, 3 deletions
loopy/symbolic.py
test/test_fem_assembly.py
+3
-4
3 additions, 4 deletions
test/test_fem_assembly.py
test/test_linalg.py
+1
-1
1 addition, 1 deletion
test/test_linalg.py
with
20 additions
and
13 deletions
MEMO
+
2
−
0
View file @
9ecdddce
...
...
@@ -57,6 +57,8 @@ To-do
- Scalar insn priority
- If finding a maximum proves troublesome, move parameters into the domain
- : (as in, Matlab full-sclice) in prefetches
Future ideas
...
...
This diff is collapsed.
Click to expand it.
loopy/cse.py
+
5
−
5
View file @
9ecdddce
...
...
@@ -396,12 +396,12 @@ def precompute(kernel, subst_use, dtype, sweep_inames=[],
else
:
subst_name_as_expr
=
use
if
isinstance
(
subst_name_as_expr
,
Variable
):
new_subst_name
=
subst_name_as_expr
.
name
new_subst_tag
=
None
elif
isinstance
(
subst_name_as_expr
,
TaggedVariable
):
if
isinstance
(
subst_name_as_expr
,
TaggedVariable
):
new_subst_name
=
subst_name_as_expr
.
name
new_subst_tag
=
subst_name_as_expr
.
tag
elif
isinstance
(
subst_name_as_expr
,
Variable
):
new_subst_name
=
subst_name_as_expr
.
name
new_subst_tag
=
None
else
:
raise
ValueError
(
"
unexpected type of subst_name
"
)
...
...
@@ -473,7 +473,7 @@ def precompute(kernel, subst_use, dtype, sweep_inames=[],
else
:
return
None
if
subst_tag
!=
tag
:
if
subst_tag
is
None
or
subst_tag
!=
tag
:
# use fall-back identity mapper
return
None
...
...
This diff is collapsed.
Click to expand it.
loopy/symbolic.py
+
9
−
3
View file @
9ecdddce
...
...
@@ -535,10 +535,10 @@ class SubstitutionCallbackMapper(IdentityMapper):
def
parse_name
(
self
,
expr
):
from
pymbolic.primitives
import
Variable
if
isinstance
(
expr
,
Variable
):
e_name
,
e_tag
=
expr
.
name
,
None
elif
isinstance
(
expr
,
TaggedVariable
):
if
isinstance
(
expr
,
TaggedVariable
):
e_name
,
e_tag
=
expr
.
name
,
expr
.
tag
elif
isinstance
(
expr
,
Variable
):
e_name
,
e_tag
=
expr
.
name
,
None
else
:
return
None
...
...
@@ -568,7 +568,13 @@ class SubstitutionCallbackMapper(IdentityMapper):
map_tagged_variable
=
map_variable
def
map_call
(
self
,
expr
):
from
pymbolic.primitives
import
Lookup
if
isinstance
(
expr
.
function
,
Lookup
):
raise
RuntimeError
(
"
dotted name
'
%s
'
not allowed as
"
"
function identifier
"
%
expr
.
function
)
parsed_name
=
self
.
parse_name
(
expr
.
function
)
if
parsed_name
is
None
:
return
IdentityMapper
.
map_call
(
self
,
expr
)
...
...
This diff is collapsed.
Click to expand it.
test/test_fem_assembly.py
+
3
−
4
View file @
9ecdddce
...
...
@@ -32,7 +32,7 @@ def test_laplacian_stiffness(ctx_factory):
"
dPsi(ij, dxi) := sum_float32(@ax_b,
"
"
jacInv[ax_b,dxi,K,q] * DPsi[ax_b,ij,q])
"
,
"
A[K, i, j] = sum_float32(q, w[q] * jacDet[K,q] * (
"
"
sum_float32(dx_axis, dPsi
.
one(i,dx_axis)*dPsi
.
two(j,dx_axis))))
"
"
sum_float32(dx_axis, dPsi
$
one(i,dx_axis)*dPsi
$
two(j,dx_axis))))
"
],
[
lp
.
ArrayArg
(
"
jacInv
"
,
dtype
,
shape
=
(
dim
,
dim
,
Nc_sym
,
Nq
),
order
=
order
),
...
...
@@ -79,7 +79,7 @@ def test_laplacian_stiffness(ctx_factory):
Ncloc
=
16
knl
=
lp
.
split_dimension
(
knl
,
"
K
"
,
Ncloc
,
outer_iname
=
"
Ko
"
,
inner_iname
=
"
Kloc
"
)
knl
=
lp
.
precompute
(
knl
,
"
dPsi
.
one
"
,
np
.
float32
,
[
"
dx_axis
"
],
default_tag
=
None
)
knl
=
lp
.
precompute
(
knl
,
"
dPsi
$
one
"
,
np
.
float32
,
[
"
dx_axis
"
],
default_tag
=
None
)
knl
=
lp
.
tag_dimensions
(
knl
,
{
"
j
"
:
"
ilp.seq
"
})
return
knl
,
[
"
Ko
"
,
"
Kloc
"
]
...
...
@@ -131,8 +131,7 @@ def test_laplacian_stiffness(ctx_factory):
lp
.
auto_test_vs_ref
(
seq_knl
,
ctx
,
kernel_gen
,
op_count
=
0
,
op_label
=
"
GFlops
"
,
parameters
=
{
"
Nc
"
:
Nc
},
print_ref_code
=
True
,
timing_rounds
=
30
)
parameters
=
{
"
Nc
"
:
Nc
},
print_ref_code
=
True
)
...
...
This diff is collapsed.
Click to expand it.
test/test_linalg.py
+
1
−
1
View file @
9ecdddce
...
...
@@ -89,7 +89,7 @@ def get_suitable_size(ctx):
def
check_float4
(
result
,
ref_result
):
for
comp
in
[
"
x
"
,
"
y
"
,
"
z
"
,
"
w
"
]:
return
np
.
allclose
(
ref_result
[
comp
],
result
[
comp
],
rtol
=
1e-3
,
atol
=
1e-3
)
return
np
.
allclose
(
ref_result
[
comp
],
result
[
comp
],
rtol
=
1e-3
,
atol
=
1e-3
)
,
None
def
test_axpy
(
ctx_factory
):
ctx
=
ctx_factory
()
...
...
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