Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Commits
9c5b9bce
Commit
9c5b9bce
authored
2 months ago
by
Richard Angersbach
Browse files
Options
Downloads
Patches
Plain Diff
Omit unnecessary type context creations for PsVecHorizontal
parent
508701f6
No related branches found
No related tags found
1 merge request
!438
Reduction Support
Pipeline
#78281
failed
2 months ago
Stage: Code Quality
Stage: Unit Tests
Stage: legacy_test
Stage: docs
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pystencils/backend/kernelcreation/typification.py
+11
-13
11 additions, 13 deletions
src/pystencils/backend/kernelcreation/typification.py
with
11 additions
and
13 deletions
src/pystencils/backend/kernelcreation/typification.py
+
11
−
13
View file @
9c5b9bce
...
@@ -584,34 +584,32 @@ class Typifier:
...
@@ -584,34 +584,32 @@ class Typifier:
# bin op consisting of a scalar and a vector that is converted to a scalar
# bin op consisting of a scalar and a vector that is converted to a scalar
# -> whole expression should be treated as scalar
# -> whole expression should be treated as scalar
scalar_op_tc
=
TypeContext
()
self
.
visit_expr
(
expr
.
scalar_operand
,
tc
)
self
.
visit_expr
(
expr
.
scalar_operand
,
scalar_op_tc
)
vector_op_tc
=
TypeContext
()
self
.
visit_expr
(
expr
.
vector_operand
,
tc
)
self
.
visit_expr
(
expr
.
vector_operand
,
vector_op_tc
)
if
scalar_op_
tc
.
target_type
is
None
or
vector_op_
tc
.
target_type
is
None
:
if
tc
.
target_type
is
None
or
tc
.
target_type
is
None
:
raise
TypificationError
(
raise
TypificationError
(
f
"
Unable to determine type of argument to vector horizontal:
{
expr
}
"
f
"
Unable to determine type of argument to vector horizontal:
{
expr
}
"
)
)
if
not
isinstance
(
scalar_op_
tc
.
target_type
,
PsScalarType
):
if
not
isinstance
(
tc
.
target_type
,
PsScalarType
):
raise
TypificationError
(
raise
TypificationError
(
f
"
Illegal type in scalar operand (op1) to vector horizontal:
{
scalar_op_
tc
.
target_type
}
"
f
"
Illegal type in scalar operand (op1) to vector horizontal:
{
tc
.
target_type
}
"
)
)
if
not
isinstance
(
vector_op_
tc
.
target_type
,
PsVectorType
):
if
not
isinstance
(
tc
.
target_type
,
PsVectorType
):
raise
TypificationError
(
raise
TypificationError
(
f
"
Illegal type in vector operand (op2) to vector horizontal:
{
vector_op_
tc
.
target_type
}
"
f
"
Illegal type in vector operand (op2) to vector horizontal:
{
tc
.
target_type
}
"
)
)
if
vector_op_
tc
.
target_type
.
scalar_type
is
not
scalar_op_
tc
.
target_type
:
if
tc
.
target_type
.
scalar_type
is
not
tc
.
target_type
:
raise
TypificationError
(
raise
TypificationError
(
f
"
Scalar type of vector operand
{
vector_op_
tc
.
target_type
}
"
f
"
Scalar type of vector operand
{
tc
.
target_type
}
"
f
"
does not correspond to type of scalar operand
{
scalar_op_
tc
.
target_type
}
"
f
"
does not correspond to type of scalar operand
{
tc
.
target_type
}
"
)
)
tc
.
apply_dtype
(
scalar_op_
tc
.
target_type
,
expr
)
tc
.
apply_dtype
(
tc
.
target_type
,
expr
)
case
PsBinOp
(
op1
,
op2
):
case
PsBinOp
(
op1
,
op2
):
self
.
visit_expr
(
op1
,
tc
)
self
.
visit_expr
(
op1
,
tc
)
...
...
This diff is collapsed.
Click to expand it.
Frederik Hennig
@da15siwa
mentioned in commit
4e688b86
·
2 months ago
mentioned in commit
4e688b86
mentioned in commit 4e688b867339c90a6fba3ad12c383d1e59211ed9
Toggle commit list
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