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
356a8343
Commit
356a8343
authored
11 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
WIP: GPU thread range tests
parent
428424d1
No related branches found
No related tags found
1 merge request
!384
Fundamental GPU Support
Pipeline
#67185
failed
11 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/backend/platforms/sycl.py
+1
-1
1 addition, 1 deletion
src/pystencils/backend/platforms/sycl.py
tests/nbackend/kernelcreation/platform/test_gpu_platforms.py
+45
-0
45 additions, 0 deletions
tests/nbackend/kernelcreation/platform/test_gpu_platforms.py
with
46 additions
and
1 deletion
src/pystencils/backend/platforms/sycl.py
+
1
−
1
View file @
356a8343
...
@@ -19,7 +19,7 @@ from ...config import GpuIndexingConfig
...
@@ -19,7 +19,7 @@ from ...config import GpuIndexingConfig
class
SyclPlatform
(
GenericGpu
):
class
SyclPlatform
(
GenericGpu
):
def
__init__
(
def
__init__
(
self
,
ctx
:
KernelCreationContext
,
indexing_cfg
:
GpuIndexingConfig
|
None
self
,
ctx
:
KernelCreationContext
,
indexing_cfg
:
GpuIndexingConfig
|
None
=
None
):
):
super
().
__init__
(
ctx
)
super
().
__init__
(
ctx
)
self
.
_cfg
=
indexing_cfg
if
indexing_cfg
is
not
None
else
GpuIndexingConfig
()
self
.
_cfg
=
indexing_cfg
if
indexing_cfg
is
not
None
else
GpuIndexingConfig
()
...
...
This diff is collapsed.
Click to expand it.
tests/nbackend/kernelcreation/platform/test_
basic_gpu
.py
→
tests/nbackend/kernelcreation/platform/test_
gpu_platforms
.py
+
45
−
0
View file @
356a8343
#%%
import
pytest
import
pytest
from
pystencils.field
import
Field
from
pystencils.field
import
Field
...
@@ -11,18 +12,34 @@ from pystencils.backend.ast.structural import PsBlock, PsLoop, PsComment
...
@@ -11,18 +12,34 @@ from pystencils.backend.ast.structural import PsBlock, PsLoop, PsComment
from
pystencils.backend.ast.expressions
import
PsExpression
from
pystencils.backend.ast.expressions
import
PsExpression
from
pystencils.backend.ast
import
dfs_preorder
from
pystencils.backend.ast
import
dfs_preorder
from
pystencils.backend.platforms
import
CudaPlatform
from
pystencils.backend.platforms
import
CudaPlatform
,
SyclPlatform
@pytest.mark.parametrize
(
"
layout
"
,
[
"
fzyx
"
,
"
zyxf
"
,
"
c
"
,
"
f
"
])
@pytest.mark.parametrize
(
"
layout
"
,
[
"
fzyx
"
,
"
zyxf
"
,
"
c
"
,
"
f
"
])
def
test_loop_nest
(
layout
):
@pytest.mark.parametrize
(
"
platform_class
"
,
[
CudaPlatform
,
SyclPlatform
])
def
test_thread_range
(
platform_class
,
layout
):
ctx
=
KernelCreationContext
()
ctx
=
KernelCreationContext
()
body
=
PsBlock
([
PsComment
(
"
Loop
body goes here
"
)])
body
=
PsBlock
([
PsComment
(
"
Kernel
body goes here
"
)])
platform
=
CudaP
latform
(
ctx
)
platform
=
p
latform
_class
(
ctx
)
# FZYX Order
dim
=
3
archetype_field
=
Field
.
create_generic
(
"
fzyx_
field
"
,
spatial_dimensions
=
3
,
layout
=
layout
)
archetype_field
=
Field
.
create_generic
(
"
field
"
,
spatial_dimensions
=
dim
,
layout
=
layout
)
ispace
=
FullIterationSpace
.
create_with_ghost_layers
(
ctx
,
0
,
archetype_field
)
ispace
=
FullIterationSpace
.
create_with_ghost_layers
(
ctx
,
1
,
archetype_field
)
_
=
platform
.
materialize_iteration_space
(
body
,
ispace
)
_
,
threads_range
=
platform
.
materialize_iteration_space
(
body
,
ispace
)
assert
threads_range
.
dim
==
dim
loop_order
=
archetype_field
.
layout
for
i
in
range
(
dim
):
coordinate
=
loop_order
[
i
]
dimension
=
ispace
.
dimensions
[
coordinate
]
witems
=
threads_range
.
num_work_items
[
i
]
desired
=
(
dimension
.
stop
-
dimension
.
start
)
/
dimension
.
step
assert
witems
.
structurally_equal
(
desired
)
#%%
test_thread_range
(
CudaPlatform
,
"
fzyx
"
)
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