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
ce3fb3e8
Commit
ce3fb3e8
authored
7 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
add another late constant folding pass
parent
a04c241b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!421
Refactor Field Modelling
Pipeline
#69785
passed
7 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/kernelcreation.py
+8
-2
8 additions, 2 deletions
src/pystencils/kernelcreation.py
with
8 additions
and
2 deletions
src/pystencils/kernelcreation.py
+
8
−
2
View file @
ce3fb3e8
...
@@ -132,7 +132,7 @@ def create_kernel(
...
@@ -132,7 +132,7 @@ def create_kernel(
f
"
Code generation for target
{
target
}
not implemented
"
f
"
Code generation for target
{
target
}
not implemented
"
)
)
#
Simplifying transformation
s
#
Fold and extract constant
s
elim_constants
=
EliminateConstants
(
ctx
,
extract_constant_exprs
=
True
)
elim_constants
=
EliminateConstants
(
ctx
,
extract_constant_exprs
=
True
)
kernel_ast
=
cast
(
PsBlock
,
elim_constants
(
kernel_ast
))
kernel_ast
=
cast
(
PsBlock
,
elim_constants
(
kernel_ast
))
...
@@ -151,10 +151,16 @@ def create_kernel(
...
@@ -151,10 +151,16 @@ def create_kernel(
select_functions
=
SelectFunctions
(
platform
)
select_functions
=
SelectFunctions
(
platform
)
kernel_ast
=
cast
(
PsBlock
,
select_functions
(
kernel_ast
))
kernel_ast
=
cast
(
PsBlock
,
select_functions
(
kernel_ast
))
# Lowering introduces new symbols, which have to be canonicalized
# Late canonicalization and constant elimination passes
# * Since lowering introduces new index calculations and indexing symbols into the AST,
# * these need to be handled here
canonicalize
=
CanonicalizeSymbols
(
ctx
,
True
)
canonicalize
=
CanonicalizeSymbols
(
ctx
,
True
)
kernel_ast
=
cast
(
PsBlock
,
canonicalize
(
kernel_ast
))
kernel_ast
=
cast
(
PsBlock
,
canonicalize
(
kernel_ast
))
late_fold_constants
=
EliminateConstants
(
ctx
,
extract_constant_exprs
=
False
)
kernel_ast
=
cast
(
PsBlock
,
late_fold_constants
(
kernel_ast
))
if
config
.
target
.
is_cpu
():
if
config
.
target
.
is_cpu
():
return
create_cpu_kernel_function
(
return
create_cpu_kernel_function
(
ctx
,
ctx
,
...
...
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