Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils-sfg
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
Package registry
Model registry
Operate
Environments
Terraform modules
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-sfg
Commits
e4c257df
Commit
e4c257df
authored
2 months ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
add lang.gpu to api docs
parent
377bab57
No related branches found
No related tags found
1 merge request
!24
Extend Support for CUDA and HIP kernel invocations
Pipeline
#75702
passed
2 months ago
Stage: Code Quality
Stage: Tests
Stage: Documentation
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/source/api/lang.rst
+6
-0
6 additions, 0 deletions
docs/source/api/lang.rst
src/pystencilssfg/lang/gpu.py
+25
-10
25 additions, 10 deletions
src/pystencilssfg/lang/gpu.py
with
31 additions
and
10 deletions
docs/source/api/lang.rst
+
6
−
0
View file @
e4c257df
...
...
@@ -41,3 +41,9 @@ Implementation
.. automodule:: pystencilssfg.lang.cpp
:members:
GPU Runtime APIs
----------------
.. automodule:: pystencilssfg.lang.gpu
:members:
This diff is collapsed.
Click to expand it.
src/pystencilssfg/lang/gpu.py
+
25
−
10
View file @
e4c257df
...
...
@@ -5,38 +5,50 @@ from typing import Protocol
from
.expressions
import
CppClass
,
cpptype
,
AugExpr
class
_Dim3Base
(
CppClass
):
class
Dim3Interface
(
CppClass
):
"""
Interface definition for the ``dim3`` struct of Cuda and HIP.
"""
def
ctor
(
self
,
dim0
=
1
,
dim1
=
1
,
dim2
=
1
):
"""
Constructor invocation of ``dim3``
"""
return
self
.
ctor_bind
(
dim0
,
dim1
,
dim2
)
@property
def
x
(
self
):
def
x
(
self
)
->
AugExpr
:
"""
The `x` coordinate member.
"""
return
AugExpr
.
format
(
"
{}.x
"
,
self
)
@property
def
y
(
self
):
def
y
(
self
)
->
AugExpr
:
"""
The `y` coordinate member.
"""
return
AugExpr
.
format
(
"
{}.y
"
,
self
)
@property
def
z
(
self
):
def
z
(
self
)
->
AugExpr
:
"""
The `z` coordinate member.
"""
return
AugExpr
.
format
(
"
{}.z
"
,
self
)
@property
def
dims
(
self
):
"""
The dims property
.
"""
return
[
self
.
x
,
self
.
y
,
self
.
z
]
def
dims
(
self
)
->
tuple
[
AugExpr
,
AugExpr
,
AugExpr
]
:
"""
`x`, `y`, and `z` as a tuple
.
"""
return
(
self
.
x
,
self
.
y
,
self
.
z
)
class
ProvidesGpuRuntimeAPI
(
Protocol
):
"""
Protocol definition for a GPU runtime API provider.
"""
dim3
:
type
[
_Dim3Base
]
dim3
:
type
[
Dim3Interface
]
"""
The ``dim3`` struct type for this GPU runtime
"""
stream_t
:
type
[
AugExpr
]
"""
The ``stream_t`` type for this GPU runtime
"""
class
CudaAPI
(
ProvidesGpuRuntimeAPI
):
"""
Reflection of the CUDA runtime API
"""
class
dim3
(
Dim3Interface
):
"""
Implements `Dim3Interface` for CUDA
"""
class
dim3
(
_Dim3Base
):
template
=
cpptype
(
"
dim3
"
,
"
<cuda_runtime.h>
"
)
class
stream_t
(
CppClass
):
...
...
@@ -44,8 +56,11 @@ class CudaAPI(ProvidesGpuRuntimeAPI):
class
HipAPI
(
ProvidesGpuRuntimeAPI
):
"""
Reflection of the HIP runtime API
"""
class
dim3
(
Dim3Interface
):
"""
Implements `Dim3Interface` for HIP
"""
class
dim3
(
_Dim3Base
):
template
=
cpptype
(
"
dim3
"
,
"
<hip/hip_runtime.h>
"
)
class
stream_t
(
CppClass
):
...
...
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