Skip to content

Commit 012de53

Browse files
authored
Merge pull request #2317 from IntelPython/move-and-deprecate-dpctl-program
Move and deprecate dpctl program
2 parents 0bae6a8 + 1dfdd14 commit 012de53

43 files changed

Lines changed: 462 additions & 271 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ per-file-ignores =
2222
dpctl/_sycl_queue.pyx: E999, E225, E226, E227
2323
dpctl/_sycl_queue_manager.pyx: E999, E225
2424
dpctl/memory/_memory.pyx: E999, E225, E226, E227
25-
dpctl/program/_program.pyx: E999, E225, E226, E227
25+
dpctl/compiler/_compiler.pyx: E999, E225, E226, E227
2626
dpctl/tests/_cython_api.pyx: E999, E225, E227, E402
2727
dpctl/utils/_onetrace_context.py: E501, W505
2828
examples/cython/sycl_buffer/syclbuffer/_syclbuffer.pyx: E999, E225, E402

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
* Rewrote USM Python examples into a single example [gh-2292](https://github.com/IntelPython/dpctl/pull/2292)
2222
* Registered `DPCTL_PARTITION_AFFINITY_DOMAIN_UNKNOWN` enumerator when `DPCTLDevice_GetPartitionAffinityDomains` receives an unrecognized value from the SYCL runtime [gh-2324](https://github.com/IntelPython/dpctl/pull/2324)
2323

24+
### Deprecated
25+
* Deprecated `dpctl.program` submodule in favor of `dpctl.compiler`, which provides a better description of the purpose of the submodule in exposing DPC++ compilation-related functionality [gh-2317](https://github.com/IntelPython/dpctl/pull/2317)
26+
* Deprecated `DPCTL_ENABLE_L0_PROGRAM_CREATION` CMake option in favor of `DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION` [gh-2317](https://github.com/IntelPython/dpctl/pull/2317)
27+
28+
### Removed
29+
* Removed Cython API for `dpctl.program` submodule, as the submodule is now deprecated, with functionality migrated to `dpctl.compiler` [gh-2317](https://github.com/IntelPython/dpctl/pull/2317)
30+
2431
### Fixed
2532
* Fixed incorrect paths in `GetLevelZeroHeaders.cmake` [gh-2366](https://github.com/IntelPython/dpctl/pull/2366)
2633

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.. _dpctl_compiler_pyapi:
2+
3+
:py:mod:`dpctl.compiler`
4+
========================
5+
6+
:py:mod:`dpctl.compiler` provides a way to create a SYCL kernel
7+
from either an OpenCL* program source code represented as a string
8+
or a SPIR-V binary file.
9+
10+
It implements creation of interoperability
11+
``sycl::kernel_bundle<sycl::bundle_state::executable>`` (a collection of kernels),
12+
as well as creation of individual ``sycl::kernel``, suitable for submission for
13+
execution via :py:meth:`dpctl.SyclQueue.submit`.
14+
15+
.. py:module:: dpctl.compiler
16+
17+
.. currentmodule:: dpctl.compiler
18+
19+
.. autosummary::
20+
:toctree: generated
21+
:nosignatures:
22+
23+
create_kernel_bundle_from_source
24+
create_kernel_bundle_from_spirv
25+
create_kernel_bundle_from_sycl_source
26+
is_sycl_source_compilation_available
27+
28+
.. autosummary::
29+
:toctree: generated
30+
:nosignatures:
31+
32+
SyclKernelBundle
33+
SyclKernel
34+
SpecializationConstant
35+
36+
.. autosummary::
37+
:toctree: generated
38+
:nosignatures:
39+
40+
SyclKernelBundleCompilationError
41+
42+
:py:mod:`dpctl.compiler.utils`
43+
------------------------------
44+
45+
.. py:module:: dpctl.compiler.utils
46+
47+
.. currentmodule:: dpctl.compiler.utils
48+
49+
.. autofunction:: parse_spirv_specializations
50+
51+
.. autoclass:: SpecializationConstantInfo
52+
:members:

docs/doc_sources/api_reference/dpctl/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515
* - :py:mod:`dpctl.memory`
1616
- Unified Shared Memory operations
17-
* - :py:mod:`dpctl.program`
17+
* - :py:mod:`dpctl.compiler`
1818
- Support for working with SYCL kernels
19+
* - :py:mod:`dpctl.program`
20+
- (deprecated, use :py:mod:`dpctl.compiler`)
1921
* - :py:mod:`dpctl.utils`
2022
- A collection of utility functions
2123

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
.. _dpctl_program_pyapi:
22

3-
:py:mod:`dpctl.program`
4-
=======================
3+
:py:mod:`dpctl.program` (deprecated)
4+
=====================================
5+
6+
.. deprecated::
7+
:py:mod:`dpctl.program` is deprecated. Use :py:mod:`dpctl.compiler` instead.
58

69
:py:mod:`dpctl.program` provides a way to create a SYCL kernel
710
from an OpenCL* program source code represented as a string, SYCL
811
source code represented as a string, or a SPIR-V binary file.
912

1013
It implements creation of interoperability
11-
``sycl::kernel_bundle<sycl::bundle_state_executable>`` (a collection of kernels),
14+
``sycl::kernel_bundle<sycl::bundle_state::executable>`` (a collection of kernels),
1215
as well as creation of individual ``sycl::kernel``, suitable for submission for
1316
execution via :py:meth:`dpctl.SyclQueue.submit`.
1417

@@ -20,35 +23,8 @@ execution via :py:meth:`dpctl.SyclQueue.submit`.
2023
:toctree: generated
2124
:nosignatures:
2225

23-
create_kernel_bundle_from_source
24-
create_kernel_bundle_from_spirv
25-
create_kernel_bundle_from_sycl_source
2626
create_program_from_source
2727
create_program_from_spirv
28-
is_sycl_source_compilation_available
29-
30-
.. autosummary::
31-
:toctree: generated
32-
:nosignatures:
33-
34-
SyclKernelBundle
3528
SyclKernel
36-
SpecializationConstant
37-
38-
.. autosummary::
39-
:toctree: generated
40-
:nosignatures:
41-
42-
SyclKernelBundleCompilationError
43-
44-
:py:mod:`dpctl.program.utils`
45-
-----------------------------
46-
47-
.. py:module:: dpctl.program.utils
48-
49-
.. currentmodule:: dpctl.program.utils
50-
51-
.. autofunction:: parse_spirv_specializations
52-
53-
.. autoclass:: SpecializationConstantInfo
54-
:members:
29+
SyclProgram
30+
SyclProgramCompilationError

docs/doc_sources/api_reference/dpctl_cython.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
.. role:: python(code)
77
:language: python
88

9-
All Python modules of :py:mod:`dpctl` come with ``__init__.pxd`` alongside ``__init__.py`` files
10-
permitting doing both :python:`import dpctl` and :code:`cimport dpctl as c_dpctl`.
9+
Python modules of :py:mod:`dpctl` that expose a Cython API come with ``__init__.pxd`` alongside
10+
``__init__.py`` files, permitting doing both :python:`import dpctl` and :code:`cimport dpctl as c_dpctl`.
1111

1212
Locations of Cython declaration files in the package installation layout are as follows:
1313

@@ -24,12 +24,12 @@ Locations of Cython declaration files in the package installation layout are as
2424
_sycl_queue_manager.pxd
2525
sycl.pxd
2626
27+
compiler/__init__.pxd
28+
compiler/_compiler.pxd
29+
2730
memory/__init__.pxd
2831
memory/_memory.pxd
2932
30-
program/__init__.pxd
31-
program/_program.pxd
32-
3333
File ``_backend.pxd`` redefines symbols from :ref:`DPCTLSyclInterface library <libsyclinterface>` for Cython.
3434

3535
File ``sycl.pxd`` provides casters from opaque types in "DPCTLSyclInterface" C library to SYCL C++ object pointers.

docs/doc_sources/api_reference/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ The package ``dpctl`` provides
99
* Python language bindings for the DPC++ runtime
1010
- :ref:`API objects <dpctl_pyapi>` in :py:mod:`dpctl` namespace
1111
- :ref:`API objects <dpctl_memory_pyapi>` in :py:mod:`dpctl.memory` namespace
12-
- :ref:`API objects <dpctl_program_pyapi>` in :py:mod:`dpctl.program` namespace
12+
- :ref:`API objects <dpctl_compiler_pyapi>` in :py:mod:`dpctl.compiler` namespace
13+
- :ref:`API objects <dpctl_program_pyapi>` in :py:mod:`dpctl.program` namespace (deprecated, use :py:mod:`dpctl.compiler`)
1314
- :ref:`API objects <dpctl_utils_pyapi>` in :py:mod:`dpctl.utils` namespace
1415
* Python C API
1516
- :ref:`C API <dpctl_capi>` for working with Python classes defined in :mod:`dpctl`
@@ -31,6 +32,7 @@ The package ``dpctl`` provides
3132

3233
dpctl/index
3334
dpctl/memory
35+
dpctl/compiler
3436
dpctl/program
3537
dpctl/utils
3638
libsyclinterface/index

docs/doc_sources/contributor_guides/building.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ library.
250250
-DCMAKE_CXX_COMPILER=icpx \
251251
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
252252
-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
253-
-DDPCTL_ENABLE_L0_PROGRAM_CREATION=ON \
253+
-DDPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION=ON \
254254
-DDPCTL_BUILD_CAPI_TESTS=ON \
255255
-DDPCTL_GENERATE_COVERAGE=ON \
256256
..

dpctl/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,6 @@ build_dpctl_ext(${_trgt} ${_cy_file} "dpctl" SYCL)
203203
target_include_directories(${_trgt} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
204204
target_link_libraries(DpctlCAPI INTERFACE ${_trgt}_headers)
205205

206-
add_subdirectory(program)
206+
add_subdirectory(compiler)
207207
add_subdirectory(memory)
208208
add_subdirectory(utils)

dpctl/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
# add submodules
136136
__all__ += [
137137
"memory",
138+
"compiler",
138139
"program",
139140
"utils",
140141
]

0 commit comments

Comments
 (0)