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
91b9c7b4
Commit
91b9c7b4
authored
4 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
add missing type annotations
parent
c6e2ec20
No related branches found
No related tags found
1 merge request
!433
Consolidate codegen and JIT modules.
Pipeline
#71796
failed
4 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/codegen/driver.py
+13
-7
13 additions, 7 deletions
src/pystencils/codegen/driver.py
with
13 additions
and
7 deletions
src/pystencils/codegen/driver.py
+
13
−
7
View file @
91b9c7b4
...
...
@@ -80,7 +80,9 @@ def create_kernel(
return
driver
(
assignments
)
def
get_driver
(
cfg
:
CreateKernelConfig
,
*
,
retain_intermediates
:
bool
=
False
):
def
get_driver
(
cfg
:
CreateKernelConfig
,
*
,
retain_intermediates
:
bool
=
False
)
->
DefaultKernelCreationDriver
:
"""
Create a code generation driver object from the given configuration.
Args:
...
...
@@ -126,7 +128,7 @@ class DefaultKernelCreationDriver:
def
__call__
(
self
,
assignments
:
AssignmentCollection
|
Sequence
[
AssignmentBase
]
|
AssignmentBase
,
):
)
->
Kernel
:
kernel_body
=
self
.
parse_kernel_body
(
assignments
)
match
self
.
_platform
:
...
...
@@ -241,7 +243,7 @@ class DefaultKernelCreationDriver:
return
kernel_body
def
_transform_for_cpu
(
self
,
kernel_ast
:
PsBlock
):
def
_transform_for_cpu
(
self
,
kernel_ast
:
PsBlock
)
->
PsBlock
:
canonicalize
=
CanonicalizeSymbols
(
self
.
_ctx
,
True
)
kernel_ast
=
cast
(
PsBlock
,
canonicalize
(
kernel_ast
))
...
...
@@ -394,7 +396,7 @@ def create_cpu_kernel_function(
function_name
:
str
,
target_spec
:
Target
,
jit
:
JitBase
,
):
)
->
Kernel
:
undef_symbols
=
collect_undefined_symbols
(
body
)
params
=
_get_function_params
(
ctx
,
undef_symbols
)
...
...
@@ -413,7 +415,7 @@ def create_gpu_kernel_function(
function_name
:
str
,
target_spec
:
Target
,
jit
:
JitBase
,
):
)
->
GpuKernel
:
undef_symbols
=
collect_undefined_symbols
(
body
)
if
threads_range
is
not
None
:
...
...
@@ -436,7 +438,9 @@ def create_gpu_kernel_function(
return
kfunc
def
_get_function_params
(
ctx
:
KernelCreationContext
,
symbols
:
Iterable
[
PsSymbol
]):
def
_get_function_params
(
ctx
:
KernelCreationContext
,
symbols
:
Iterable
[
PsSymbol
]
)
->
list
[
Parameter
]:
params
:
list
[
Parameter
]
=
[]
from
pystencils.backend.memory
import
BufferBasePtr
...
...
@@ -456,7 +460,9 @@ def _get_function_params(ctx: KernelCreationContext, symbols: Iterable[PsSymbol]
return
params
def
_get_headers
(
ctx
:
KernelCreationContext
,
platform
:
Platform
,
body
:
PsBlock
):
def
_get_headers
(
ctx
:
KernelCreationContext
,
platform
:
Platform
,
body
:
PsBlock
)
->
set
[
str
]:
req_headers
=
collect_required_headers
(
body
)
req_headers
|=
platform
.
required_headers
req_headers
|=
ctx
.
required_headers
...
...
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