Skip to content

Commit 2ebb2fa

Browse files
committed
deprecate dpctl program in favor of dpctl compiler
1 parent 2c152ae commit 2ebb2fa

23 files changed

Lines changed: 230 additions & 81 deletions

‎.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/_program.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

‎dpctl/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ 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(compiler)
206207
add_subdirectory(program)
207208
add_subdirectory(memory)
208209
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
]

‎dpctl/apis/include/dpctl4pybind11.hpp‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class dpctl_capi
259259
this->Memory_GetNumBytes_ = Memory_GetNumBytes;
260260
this->Memory_Make_ = Memory_Make;
261261

262-
// dpctl.program API
262+
// dpctl.compiler API
263263
this->SyclKernel_GetKernelRef_ = SyclKernel_GetKernelRef;
264264
this->SyclKernel_Make_ = SyclKernel_Make;
265265
this->SyclKernelBundle_GetKernelBundleRef_ =
@@ -482,7 +482,7 @@ template <> struct type_caster<sycl::event>
482482
};
483483

484484
/* This type caster associates ``sycl::kernel`` C++ class with
485-
* :class:`dpctl.program.SyclKernel` for the purposes of generation of
485+
* :class:`dpctl.compiler.SyclKernel` for the purposes of generation of
486486
* Python bindings by pybind11.
487487
*/
488488
template <> struct type_caster<sycl::kernel>
@@ -501,7 +501,7 @@ template <> struct type_caster<sycl::kernel>
501501
}
502502
else {
503503
throw py::type_error("Input is of unexpected type, expected "
504-
"dpctl.program.SyclKernel");
504+
"dpctl.compiler.SyclKernel");
505505
}
506506
}
507507

@@ -514,12 +514,12 @@ template <> struct type_caster<sycl::kernel>
514514
return handle(reinterpret_cast<PyObject *>(tmp));
515515
}
516516

517-
DPCTL_TYPE_CASTER(sycl::kernel, _("dpctl.program.SyclKernel"));
517+
DPCTL_TYPE_CASTER(sycl::kernel, _("dpctl.compiler.SyclKernel"));
518518
};
519519

520520
/* This type caster associates
521521
* ``sycl::kernel_bundle<sycl::bundle_state::executable>`` C++ class with
522-
* :class:`dpctl.program.SyclKernelBundle` for the purposes of generation of
522+
* :class:`dpctl.compiler.SyclKernelBundle` for the purposes of generation of
523523
* Python bindings by pybind11.
524524
*/
525525
template <>
@@ -543,7 +543,7 @@ struct type_caster<sycl::kernel_bundle<sycl::bundle_state::executable>>
543543
}
544544
else {
545545
throw py::type_error("Input is of unexpected type, expected "
546-
"dpctl.program.SyclKernelBundle");
546+
"dpctl.compiler.SyclKernelBundle");
547547
}
548548
}
549549

@@ -558,7 +558,7 @@ struct type_caster<sycl::kernel_bundle<sycl::bundle_state::executable>>
558558
}
559559

560560
DPCTL_TYPE_CASTER(sycl::kernel_bundle<sycl::bundle_state::executable>,
561-
_("dpctl.program.SyclKernelBundle"));
561+
_("dpctl.compiler.SyclKernelBundle"));
562562
};
563563

564564
/* This type caster associates
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
file(GLOB _cython_sources *.pyx)
33
foreach(_cy_file ${_cython_sources})
44
get_filename_component(_trgt ${_cy_file} NAME_WLE)
5-
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/program" RELATIVE_PATH "..")
5+
build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/compiler" RELATIVE_PATH "..")
66
target_link_libraries(DpctlCAPI INTERFACE ${_trgt}_headers)
77
endforeach()

‎dpctl/compiler/__init__.pxd‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Data Parallel Control (dpctl)
2+
#
3+
# Copyright 2020-2025 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# distutils: language = c++
18+
# cython: language_level=3
19+
20+
"""Declares the extension types and functions for the Cython API
21+
implemented in dpctl.compiler._program.pyx.
22+
"""
23+
24+
25+
from dpctl.compiler._program cimport *

‎dpctl/compiler/__init__.py‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Data Parallel Control (dpctl)
2+
#
3+
# Copyright 2020-2025 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
"""
18+
**Data Parallel Control Compiler** provides a way to create a SYCL kernel
19+
from either an OpenCL program represented as a string or a SPIR-V binary
20+
file.
21+
22+
"""
23+
24+
from dpctl.compiler._program import (
25+
SpecializationConstant,
26+
SyclKernel,
27+
SyclKernelBundle,
28+
SyclKernelBundleCompilationError,
29+
create_kernel_bundle_from_source,
30+
create_kernel_bundle_from_spirv,
31+
create_program_from_source,
32+
create_program_from_spirv,
33+
)
34+
35+
__all__ = [
36+
"create_kernel_bundle_from_source",
37+
"create_kernel_bundle_from_spirv",
38+
"create_program_from_source",
39+
"create_program_from_spirv",
40+
"SyclKernel",
41+
"SyclKernelBundle",
42+
"SyclKernelBundleCompilationError",
43+
"SyclProgram",
44+
"SyclProgramCompilationError",
45+
"SpecializationConstant",
46+
]
47+
48+
# add submodules
49+
__all__ += [
50+
"utils",
51+
]
52+
53+
54+
def __getattr__(name):
55+
if name == "SyclProgram":
56+
from warnings import warn
57+
58+
warn(
59+
"dpctl.compiler.SyclProgram is deprecated and will be removed in a "
60+
"future release. Use dpctl.compiler.SyclKernelBundle instead.",
61+
DeprecationWarning,
62+
stacklevel=2,
63+
)
64+
return SyclKernelBundle
65+
if name == "SyclProgramCompilationError":
66+
from warnings import warn
67+
68+
warn(
69+
"dpctl.compiler.SyclProgramCompilationError is deprecated and will "
70+
"be removed in a future release. Use "
71+
"dpctl.compiler.SyclKernelBundleCompilationError instead.",
72+
DeprecationWarning,
73+
stacklevel=2,
74+
)
75+
return SyclKernelBundleCompilationError
76+
raise AttributeError(f"module {__name__} has no attribute {name}")

‎dpctl/compiler/utils/__init__.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Data Parallel Control (dpctl)
2+
#
3+
# Copyright 2020-2025 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
"""
18+
A collection of utility functions for dpctl.compiler module.
19+
"""
20+
21+
from dpctl.compiler.utils._utils import parse_spirv_specializations
22+
23+
__all__ = [
24+
"parse_spirv_specializations",
25+
]

0 commit comments

Comments
 (0)