Skip to content

Commit 30bba23

Browse files
committed
remove and deprecate remaining references to program
1 parent cbc5588 commit 30bba23

12 files changed

Lines changed: 74 additions & 57 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222

2323
### Deprecated
2424
* 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)
25+
* 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)
2526

2627
### Maintenance
2728
* Updated pybind11 version used by `dpctl` and examples [gh-2357](https://github.com/IntelPython/dpctl/pull/2357)

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/apis/include/dpctl4pybind11.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class dpctl_capi
8888
DPCTLSyclQueueRef,
8989
PyObject *);
9090

91-
// program
91+
// compiler
9292
DPCTLSyclKernelRef (*SyclKernel_GetKernelRef_)(PySyclKernelObject *);
9393
PySyclKernelObject *(*SyclKernel_Make_)(DPCTLSyclKernelRef, const char *);
9494

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ def get_spirv_abspath(fn):
3232
return spirv_file
3333

3434

35-
def _check_cpython_api_SyclKernelBundle_GetKernelBundleRef(sycl_prog):
35+
def _check_cpython_api_SyclKernelBundle_GetKernelBundleRef(kb):
3636
"""Checks Cython-generated C-API function
37-
`SyclKernelBundle_GetKernelBundleRef` defined in _program.pyx"""
37+
`SyclKernelBundle_GetKernelBundleRef` defined in _compiler.pyx"""
3838
import ctypes
3939
import sys
4040

41-
assert type(sycl_prog) is dpc.SyclKernelBundle
42-
mod = sys.modules[sycl_prog.__class__.__module__]
41+
assert type(kb) is dpc.SyclKernelBundle
42+
mod = sys.modules[kb.__class__.__module__]
4343
# get capsule storing SyclKernelBundle_GetKernelBundleRef function ptr
4444
kb_ref_fn_cap = mod.__pyx_capi__["SyclKernelBundle_GetKernelBundleRef"]
4545
# construct Python callable to invoke "SyclKernelBundle_GetKernelBundleRef"
@@ -54,41 +54,41 @@ def _check_cpython_api_SyclKernelBundle_GetKernelBundleRef(sycl_prog):
5454
callable_maker = ctypes.PYFUNCTYPE(ctypes.c_void_p, ctypes.py_object)
5555
get_kernel_bundle_ref_fn = callable_maker(kb_ref_fn_ptr)
5656

57-
r2 = sycl_prog.addressof_ref()
58-
r1 = get_kernel_bundle_ref_fn(sycl_prog)
57+
r2 = kb.addressof_ref()
58+
r1 = get_kernel_bundle_ref_fn(kb)
5959
assert r1 == r2
6060

6161

62-
def _check_cpython_api_SyclKernelBundle_Make(sycl_prog):
62+
def _check_cpython_api_SyclKernelBundle_Make(kb):
6363
"""Checks Cython-generated C-API function
64-
`SyclKernelBundle_Make` defined in _program.pyx"""
64+
`SyclKernelBundle_Make` defined in _compiler.pyx"""
6565
import ctypes
6666
import sys
6767

68-
assert type(sycl_prog) is dpc.SyclKernelBundle
69-
mod = sys.modules[sycl_prog.__class__.__module__]
68+
assert type(kb) is dpc.SyclKernelBundle
69+
mod = sys.modules[kb.__class__.__module__]
7070
# get capsule storing SyclKernelBundle_Make function ptr
71-
make_prog_fn_cap = mod.__pyx_capi__["SyclKernelBundle_Make"]
71+
make_kb_fn_cap = mod.__pyx_capi__["SyclKernelBundle_Make"]
7272
# construct Python callable to invoke "SyclKernelBundle_Make"
7373
cap_ptr_fn = ctypes.pythonapi.PyCapsule_GetPointer
7474
cap_ptr_fn.restype = ctypes.c_void_p
7575
cap_ptr_fn.argtypes = [ctypes.py_object, ctypes.c_char_p]
76-
make_prog_fn_ptr = cap_ptr_fn(
77-
make_prog_fn_cap,
76+
make_kb_fn_ptr = cap_ptr_fn(
77+
make_kb_fn_cap,
7878
b"struct PySyclKernelBundleObject *(DPCTLSyclKernelBundleRef)",
7979
)
8080
# PYFUNCTYPE(result_type, *arg_types)
8181
callable_maker = ctypes.PYFUNCTYPE(ctypes.py_object, ctypes.c_void_p)
82-
make_prog_fn = callable_maker(make_prog_fn_ptr)
82+
make_kb_fn = callable_maker(make_kb_fn_ptr)
8383

84-
p2 = make_prog_fn(sycl_prog.addressof_ref())
85-
assert p2.has_sycl_kernel("add")
86-
assert p2.has_sycl_kernel("axpy")
84+
kb2 = make_kb_fn(kb.addressof_ref())
85+
assert kb2.has_sycl_kernel("add")
86+
assert kb2.has_sycl_kernel("axpy")
8787

8888

8989
def _check_cpython_api_SyclKernel_GetKernelRef(krn):
9090
"""Checks Cython-generated C-API function
91-
`SyclKernel_GetKernelRef` defined in _program.pyx"""
91+
`SyclKernel_GetKernelRef` defined in _compiler.pyx"""
9292
import ctypes
9393
import sys
9494

@@ -114,7 +114,7 @@ def _check_cpython_api_SyclKernel_GetKernelRef(krn):
114114

115115
def _check_cpython_api_SyclKernel_Make(krn):
116116
"""Checks Cython-generated C-API function
117-
`SyclKernel_Make` defined in _program.pyx"""
117+
`SyclKernel_Make` defined in _compiler.pyx"""
118118
import ctypes
119119
import sys
120120

@@ -149,7 +149,7 @@ def _check_cpython_api_SyclKernel_Make(krn):
149149
assert krn.work_group_size == k3.work_group_size
150150

151151

152-
def _check_multi_kernel_program(kb):
152+
def _check_multi_kernel_bundle(kb):
153153
assert type(kb) is dpc.SyclKernelBundle
154154

155155
assert type(kb.addressof_ref()) is int
@@ -206,7 +206,7 @@ def test_create_kernel_bundle_from_source_ocl():
206206
except dpctl.SyclQueueCreationError:
207207
pytest.skip("No OpenCL queue is available")
208208
kb = dpc.create_kernel_bundle_from_source(q, oclSrc)
209-
_check_multi_kernel_program(kb)
209+
_check_multi_kernel_bundle(kb)
210210

211211

212212
def test_create_kernel_bundle_from_spirv_ocl():
@@ -218,7 +218,7 @@ def test_create_kernel_bundle_from_spirv_ocl():
218218
with open(spirv_file, "rb") as fin:
219219
spirv = fin.read()
220220
kb = dpc.create_kernel_bundle_from_spirv(q, spirv)
221-
_check_multi_kernel_program(kb)
221+
_check_multi_kernel_bundle(kb)
222222

223223

224224
def test_create_kernel_bundle_from_spirv_l0():
@@ -230,7 +230,7 @@ def test_create_kernel_bundle_from_spirv_l0():
230230
with open(spirv_file, "rb") as fin:
231231
spirv = fin.read()
232232
kb = dpc.create_kernel_bundle_from_spirv(q, spirv)
233-
_check_multi_kernel_program(kb)
233+
_check_multi_kernel_bundle(kb)
234234

235235

236236
@pytest.mark.xfail(
@@ -251,7 +251,7 @@ def test_create_kernel_bundle_from_source_l0():
251251
c[index] = a[index] + d*b[index]; \
252252
}"
253253
kb = dpc.create_kernel_bundle_from_source(q, oclSrc)
254-
_check_multi_kernel_program(kb)
254+
_check_multi_kernel_bundle(kb)
255255

256256

257257
def test_create_kernel_bundle_from_invalid_src_ocl():

examples/pybind11/use_dpctl_sycl_kernel/example.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
with open("resource/double_it.spv", "br") as fh:
3131
il = fh.read()
3232

33-
# Build the program for the selected device
34-
pr = dpc.create_kernel_bundle_from_spirv(q, il, "")
35-
assert pr.has_sycl_kernel("double_it")
33+
# Build the kernel bundle for the selected device
34+
kb = dpc.create_kernel_bundle_from_spirv(q, il, "")
35+
assert kb.has_sycl_kernel("double_it")
3636

37-
# Retrieve the kernel from the problem
38-
krn = pr.get_sycl_kernel("double_it")
37+
# Retrieve the kernel from the kernel bundle
38+
krn = kb.get_sycl_kernel("double_it")
3939
assert krn.num_args == 2
4040

4141
# Construct the argument, and allocate memory for the result

libsyclinterface/CMakeLists.txt

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,26 @@ if(NOT DEFINED IntelSYCL_FOUND OR NOT IntelSYCL_FOUND)
1515
find_package(IntelSYCL REQUIRED)
1616
endif()
1717

18-
# Option to turn on support for creating Level Zero interoperability programs
19-
# from a SPIR-V binary file.
20-
option(DPCTL_ENABLE_L0_PROGRAM_CREATION
21-
"Enable Level Zero Program creation from SPIR-V"
18+
# Option to turn on support for creating Level Zero interoperability kernel
19+
# bundles from a SPIR-V binary file.
20+
option(DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION
21+
"Enable Level Zero kernel bundle creation from SPIR-V"
2222
ON
2323
)
24+
if(DEFINED DPCTL_ENABLE_L0_PROGRAM_CREATION)
25+
message(DEPRECATION
26+
"DPCTL_ENABLE_L0_PROGRAM_CREATION is deprecated and will be removed in "
27+
"a future release. Use DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION instead."
28+
)
29+
set(DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION
30+
${DPCTL_ENABLE_L0_PROGRAM_CREATION}
31+
CACHE BOOL
32+
"Enable Level Zero kernel bundle creation from SPIR-V"
33+
FORCE
34+
)
35+
unset(DPCTL_ENABLE_L0_PROGRAM_CREATION)
36+
unset(DPCTL_ENABLE_L0_PROGRAM_CREATION CACHE)
37+
endif()
2438
# Option to generate code coverage report using llvm-cov and lcov.
2539
option(DPCTL_GENERATE_COVERAGE
2640
"Build dpctl C API with coverage instrumentation"
@@ -59,8 +73,8 @@ else()
5973
find_package(IntelSyclCompiler REQUIRED)
6074
endif()
6175

62-
if(DPCTL_ENABLE_L0_PROGRAM_CREATION)
63-
set(DPCTL_ENABLE_L0_PROGRAM_CREATION 1)
76+
if(DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION)
77+
set(DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION 1)
6478
if(DPCTL_LEVEL_ZERO_INCLUDE_DIR)
6579
set(LEVEL_ZERO_INCLUDE_DIR ${DPCTL_LEVEL_ZERO_INCLUDE_DIR})
6680
else()
@@ -371,7 +385,7 @@ if (build_so_version)
371385
)
372386
endif()
373387

374-
if(DPCTL_ENABLE_L0_PROGRAM_CREATION)
388+
if(DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION)
375389
target_include_directories(DPCTLSyclInterface
376390
SYSTEM PRIVATE
377391
${LEVEL_ZERO_INCLUDE_DIR}

libsyclinterface/dbg_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cmake \
2020
-DCMAKE_CXX_FLAGS=-fsycl \
2121
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \
2222
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}" \
23-
-DDPCTL_ENABLE_L0_PROGRAM_CREATION=ON \
23+
-DDPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION=ON \
2424
-DDPCTL_BUILD_CAPI_TESTS=ON \
2525
-DDPCTL_GENERATE_COVERAGE=OFF \
2626
..

libsyclinterface/dbg_build_custom.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cmake \
1717
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}" \
1818
-DDPCTL_CUSTOM_DPCPP_INSTALL_DIR="${DPCPP_HOME}" \
1919
-DCMAKE_LINKER:PATH="${DPCPP_HOME}/bin/lld" \
20-
-DDPCTL_ENABLE_L0_PROGRAM_CREATION="${USE_LO_HEADERS}" \
20+
-DDPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION="${USE_LO_HEADERS}" \
2121
-DDPCTL_BUILD_CAPI_TESTS=ON \
2222
-DDPCTL_GENERATE_COVERAGE=ON \
2323
..

libsyclinterface/include/syclinterface/Config/dpctl_config.h.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525

2626
#pragma once
2727

28-
/* Defined when dpctl was built with level zero program creation enabled. */
29-
#cmakedefine DPCTL_ENABLE_L0_PROGRAM_CREATION 1
28+
/* Defined when dpctl was built with Level Zero kernel bundle creation
29+
* enabled. */
30+
#cmakedefine DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION 1
3031

3132
#define __SYCL_COMPILER_VERSION_REQUIRED 20221201L
3233

libsyclinterface/source/dpctl_sycl_kernel_bundle_interface.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <sycl/sycl.hpp> /* Sycl headers */
3939
#include <utility>
4040

41-
#ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION
41+
#ifdef DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION
4242
// Note: include ze_api.h before level_zero.hpp. Make sure clang-format does
4343
// not reorder the includes.
4444
// clang-format off
@@ -63,7 +63,7 @@ static const int clLibLoadFlags = RTLD_NOLOAD | RTLD_NOW | RTLD_LOCAL;
6363
static const char *clLoaderName = "OpenCL.dll";
6464
static const int clLibLoadFlags = 0;
6565
#else
66-
#error "OpenCL program compilation is unavailable for this platform"
66+
#error "OpenCL kernel bundle compilation is unavailable for this platform"
6767
#endif
6868

6969
#define CodeStringSuffix(code) \
@@ -408,7 +408,7 @@ _GetKernel_ocl_impl(const kernel_bundle<bundle_state::executable> &kb,
408408
}
409409
}
410410

411-
#ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION
411+
#ifdef DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION
412412

413413
#ifdef __linux__
414414
static const char *zeLoaderName = DPCTL_LIBZE_LOADER_FILENAME;
@@ -417,7 +417,7 @@ static const int zeLibLoadFlags = RTLD_NOLOAD | RTLD_NOW | RTLD_LOCAL;
417417
static const char *zeLoaderName = "ze_loader.dll";
418418
static const int zeLibLoadFlags = 0;
419419
#else
420-
#error "Level Zero program compilation is unavailable for this platform"
420+
#error "Level Zero kernel bundle compilation is unavailable for this platform"
421421
#endif
422422

423423
static constexpr sycl::backend ze_be = sycl::backend::ext_oneapi_level_zero;
@@ -676,7 +676,7 @@ bool _HasKernel_ze_impl(const kernel_bundle<bundle_state::executable> &kb,
676676
return false;
677677
}
678678

679-
#endif /* #ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION */
679+
#endif /* #ifdef DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION */
680680

681681
} /* end of anonymous namespace */
682682

@@ -691,19 +691,19 @@ DPCTLKernelBundle_CreateFromSpirv(__dpctl_keep const DPCTLSyclContextRef CtxRef,
691691
{
692692
DPCTLSyclKernelBundleRef KBRef = nullptr;
693693
if (!CtxRef) {
694-
error_handler("Cannot create program from SPIR-V as the supplied SYCL "
695-
"context is NULL.",
694+
error_handler("Cannot create kernel bundle from SPIR-V as the supplied "
695+
"SYCL context is NULL.",
696696
__FILE__, __func__, __LINE__);
697697
return KBRef;
698698
}
699699
if (!DevRef) {
700-
error_handler("Cannot create program from SPIR-V as the supplied SYCL "
701-
"device is NULL.",
700+
error_handler("Cannot create kernel bundle from SPIR-V as the supplied "
701+
"SYCL device is NULL.",
702702
__FILE__, __func__, __LINE__);
703703
return KBRef;
704704
}
705705
if ((!IL) || (length == 0)) {
706-
error_handler("Cannot create program from null SPIR-V buffer.",
706+
error_handler("Cannot create kernel bundle from null SPIR-V buffer.",
707707
__FILE__, __func__, __LINE__);
708708
return KBRef;
709709
}
@@ -720,7 +720,7 @@ DPCTLKernelBundle_CreateFromSpirv(__dpctl_keep const DPCTLSyclContextRef CtxRef,
720720
SpecConsts);
721721
break;
722722
case backend::ext_oneapi_level_zero:
723-
#ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION
723+
#ifdef DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION
724724
KBRef = _CreateKernelBundleWithIL_ze_impl(
725725
*SyclCtx, *SyclDev, IL, length, CompileOpts, NumSpecConsts,
726726
SpecConsts);
@@ -807,7 +807,7 @@ DPCTLKernelBundle_GetKernel(__dpctl_keep DPCTLSyclKernelBundleRef KBRef,
807807
case sycl::backend::opencl:
808808
return _GetKernel_ocl_impl(*SyclKB, KernelName);
809809
case sycl::backend::ext_oneapi_level_zero:
810-
#ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION
810+
#ifdef DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION
811811
return _GetKernel_ze_impl(*SyclKB, KernelName);
812812
#endif
813813
default:
@@ -837,7 +837,7 @@ bool DPCTLKernelBundle_HasKernel(__dpctl_keep DPCTLSyclKernelBundleRef KBRef,
837837
case sycl::backend::opencl:
838838
return _HasKernel_ocl_impl(*SyclKB, KernelName);
839839
case sycl::backend::ext_oneapi_level_zero:
840-
#ifdef DPCTL_ENABLE_L0_PROGRAM_CREATION
840+
#ifdef DPCTL_ENABLE_L0_KERNEL_BUNDLE_CREATION
841841
return _HasKernel_ze_impl(*SyclKB, KernelName);
842842
#endif
843843
default:

0 commit comments

Comments
 (0)