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
422a2494
Commit
422a2494
authored
5 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
add dry-dock tests for SYCL codegen
parent
1dff4610
No related branches found
No related tags found
1 merge request
!453
Clean up kernel creation code in `codegen.driver`. Fix and dry-test SYCL codegen.
Pipeline
#74264
passed
5 months ago
Stage: Code Quality
Stage: Unit Tests
Stage: legacy_test
Stage: docs
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pystencils/codegen/driver.py
+12
-13
12 additions, 13 deletions
src/pystencils/codegen/driver.py
tests/kernelcreation/test_sycl_codegen.py
+45
-0
45 additions, 0 deletions
tests/kernelcreation/test_sycl_codegen.py
with
57 additions
and
13 deletions
src/pystencils/codegen/driver.py
+
12
−
13
View file @
422a2494
...
...
@@ -436,23 +436,11 @@ class DefaultKernelCreationDriver:
f
"
No platform is currently available for CPU target
{
self
.
_target
}
"
)
elif
Target
.
_GPU
in
self
.
_target
:
elif
self
.
_target
.
is_gpu
()
:
gpu_opts
=
self
.
_cfg
.
gpu
omit_range_check
:
bool
=
gpu_opts
.
get_option
(
"
omit_range_check
"
)
match
self
.
_target
:
case
Target
.
SYCL
:
from
..backend.platforms
import
SyclPlatform
auto_block_size
:
bool
=
self
.
_cfg
.
sycl
.
get_option
(
"
automatic_block_size
"
)
return
SyclPlatform
(
self
.
_ctx
,
omit_range_check
=
omit_range_check
,
automatic_block_size
=
auto_block_size
,
)
case
Target
.
CUDA
:
from
..backend.platforms
import
CudaPlatform
...
...
@@ -467,6 +455,17 @@ class DefaultKernelCreationDriver:
omit_range_check
=
omit_range_check
,
thread_mapping
=
thread_mapping
,
)
elif
self
.
_target
==
Target
.
SYCL
:
from
..backend.platforms
import
SyclPlatform
auto_block_size
:
bool
=
self
.
_cfg
.
sycl
.
get_option
(
"
automatic_block_size
"
)
omit_range_check
=
self
.
_cfg
.
gpu
.
get_option
(
"
omit_range_check
"
)
return
SyclPlatform
(
self
.
_ctx
,
omit_range_check
=
omit_range_check
,
automatic_block_size
=
auto_block_size
,
)
raise
NotImplementedError
(
f
"
Code generation for target
{
self
.
_target
}
not implemented
"
...
...
This diff is collapsed.
Click to expand it.
tests/kernelcreation/test_sycl_codegen.py
0 → 100644
+
45
−
0
View file @
422a2494
"""
Since we don
'
t have a JIT compiler for SYCL, these tests can only
perform dry-dock testing.
If the SYCL target should ever become non-experimental, we need to
find a way to properly test SYCL kernels in execution.
These tests primarily check that the code generation driver runs
successfully for the SYCL target.
"""
import
sympy
as
sp
from
pystencils
import
(
create_kernel
,
Target
,
fields
,
Assignment
,
CreateKernelConfig
,
)
def
test_sycl_kernel_static
():
src
,
dst
=
fields
(
"
src, dst: [2D]
"
)
asm
=
Assignment
(
dst
.
center
(),
sp
.
sin
(
src
.
center
())
+
sp
.
cos
(
src
.
center
()))
cfg
=
CreateKernelConfig
(
target
=
Target
.
SYCL
)
kernel
=
create_kernel
(
asm
,
cfg
)
code_string
=
kernel
.
get_c_code
()
assert
"
sycl::id< 2 >
"
in
code_string
assert
"
sycl::sin(
"
in
code_string
assert
"
sycl::cos(
"
in
code_string
def
test_sycl_kernel_manual_block_size
():
src
,
dst
=
fields
(
"
src, dst: [2D]
"
)
asm
=
Assignment
(
dst
.
center
(),
sp
.
sin
(
src
.
center
())
+
sp
.
cos
(
src
.
center
()))
cfg
=
CreateKernelConfig
(
target
=
Target
.
SYCL
)
cfg
.
sycl
.
automatic_block_size
=
False
kernel
=
create_kernel
(
asm
,
cfg
)
code_string
=
kernel
.
get_c_code
()
assert
"
sycl::nd_item< 2 >
"
in
code_string
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