Skip to content

Commit be9ea33

Browse files
Applied pre-commit linter
1 parent 35df171 commit be9ea33

File tree

5 files changed

+31
-21
lines changed

5 files changed

+31
-21
lines changed

dpctl/apis/include/dpctl4pybind11.hpp

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ struct dpctl_capi
100100
DPCTLSyclKernelRef (*SyclKernel_GetKernelRef_)(PySyclKernelObject *);
101101
PySyclKernelObject *(*SyclKernel_Make_)(DPCTLSyclKernelRef);
102102

103-
DPCTLSyclKernelBundleRef (*SyclProgram_GetKernelBundleRef_)(PySyclProgramObject *);
103+
DPCTLSyclKernelBundleRef (*SyclProgram_GetKernelBundleRef_)(
104+
PySyclProgramObject *);
104105
PySyclProgramObject *(*SyclProgram_Make_)(DPCTLSyclKernelBundleRef);
105106

106107
// tensor
@@ -551,8 +552,8 @@ template <> struct type_caster<sycl::kernel>
551552
return true;
552553
}
553554
else {
554-
throw py::type_error(
555-
"Input is of unexpected type, expected dpctl.program.SyclKernel");
555+
throw py::type_error("Input is of unexpected type, expected "
556+
"dpctl.program.SyclKernel");
556557
}
557558
}
558559

@@ -567,22 +568,28 @@ template <> struct type_caster<sycl::kernel>
567568
DPCTL_TYPE_CASTER(sycl::kernel, _("dpctl.program.SyclKernel"));
568569
};
569570

570-
/* This type caster associates ``sycl::kernel_bundle<sycl::bundle_state::executable>`` C++ class with
571+
/* This type caster associates
572+
* ``sycl::kernel_bundle<sycl::bundle_state::executable>`` C++ class with
571573
* :class:`dpctl.program.SyclProgram` for the purposes of generation of
572574
* Python bindings by pybind11.
573575
*/
574-
template <> struct type_caster<sycl::kernel_bundle<sycl::bundle_state::executable>>
576+
template <>
577+
struct type_caster<sycl::kernel_bundle<sycl::bundle_state::executable>>
575578
{
576579
public:
577580
bool load(handle src, bool)
578581
{
579582
PyObject *source = src.ptr();
580583
auto &api = ::dpctl::detail::dpctl_capi::get();
581584
if (api.PySyclProgram_Check_(source)) {
582-
DPCTLSyclKernelBundleRef KBRef = api.SyclProgram_GetKernelBundleRef_(
583-
reinterpret_cast<PySyclProgramObject *>(source));
584-
value = std::make_unique<sycl::kernel_bundle<sycl::bundle_state::executable>>(
585-
*(reinterpret_cast<sycl::kernel_bundle<sycl::bundle_state::executable> *>(KBRef)));
585+
DPCTLSyclKernelBundleRef KBRef =
586+
api.SyclProgram_GetKernelBundleRef_(
587+
reinterpret_cast<PySyclProgramObject *>(source));
588+
value = std::make_unique<
589+
sycl::kernel_bundle<sycl::bundle_state::executable>>(
590+
*(reinterpret_cast<
591+
sycl::kernel_bundle<sycl::bundle_state::executable> *>(
592+
KBRef)));
586593
return true;
587594
}
588595
else {
@@ -591,15 +598,18 @@ template <> struct type_caster<sycl::kernel_bundle<sycl::bundle_state::executabl
591598
}
592599
}
593600

594-
static handle cast(sycl::kernel_bundle<sycl::bundle_state::executable> src, return_value_policy, handle)
601+
static handle cast(sycl::kernel_bundle<sycl::bundle_state::executable> src,
602+
return_value_policy,
603+
handle)
595604
{
596605
auto &api = ::dpctl::detail::dpctl_capi::get();
597-
auto tmp =
598-
api.SyclProgram_Make_(reinterpret_cast<DPCTLSyclKernelBundleRef>(&src));
606+
auto tmp = api.SyclProgram_Make_(
607+
reinterpret_cast<DPCTLSyclKernelBundleRef>(&src));
599608
return handle(reinterpret_cast<PyObject *>(tmp));
600609
}
601610

602-
DPCTL_TYPE_CASTER(sycl::kernel_bundle<sycl::bundle_state::executable>, _("dpctl.program.SyclProgram"));
611+
DPCTL_TYPE_CASTER(sycl::kernel_bundle<sycl::bundle_state::executable>,
612+
_("dpctl.program.SyclProgram"));
603613
};
604614
} // namespace detail
605615
} // namespace pybind11

dpctl/apis/include/dpctl_capi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "../program/_program.h"
4444
#include "../program/_program_api.h"
4545

46-
4746
// clang-format on
4847

4948
/*

dpctl/program/_program.pxd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,3 @@ cdef api class SyclProgram [object PySyclProgramObject, type PySyclProgramType]:
5959
cpdef create_program_from_source (SyclQueue q, unicode source, unicode copts=*)
6060
cpdef create_program_from_spirv (SyclQueue q, const unsigned char[:] IL,
6161
unicode copts=*)
62-

dpctl/program/_program.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ from libc.stdint cimport uint32_t
3030

3131
from dpctl._backend cimport ( # noqa: E211, E402;
3232
DPCTLCString_Delete,
33-
DPCTLKernel_Delete,
3433
DPCTLKernel_Copy,
34+
DPCTLKernel_Delete,
3535
DPCTLKernel_GetCompileNumSubGroups,
3636
DPCTLKernel_GetCompileSubGroupSize,
3737
DPCTLKernel_GetMaxNumSubGroups,
3838
DPCTLKernel_GetNumArgs,
3939
DPCTLKernel_GetPreferredWorkGroupSizeMultiple,
4040
DPCTLKernel_GetPrivateMemSize,
4141
DPCTLKernel_GetWorkGroupSize,
42+
DPCTLKernelBundle_Copy,
4243
DPCTLKernelBundle_CreateFromOCLSource,
4344
DPCTLKernelBundle_CreateFromSpirv,
4445
DPCTLKernelBundle_Delete,
45-
DPCTLKernelBundle_Copy,
4646
DPCTLKernelBundle_GetKernel,
4747
DPCTLKernelBundle_HasKernel,
4848
DPCTLSyclContextRef,
@@ -318,4 +318,4 @@ cdef api SyclProgram SyclProgram_Make(DPCTLSyclKernelBundleRef KBRef):
318318
instance from opaque sycl kernel bundle reference.
319319
"""
320320
cdef DPCTLSyclKernelBundleRef copied_KBRef = DPCTLKernelBundle_Copy(KBRef)
321-
return SyclProgram._create(copied_KBRef)
321+
return SyclProgram._create(copied_KBRef)

libsyclinterface/source/dpctl_sycl_kernel_bundle_interface.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,12 +746,14 @@ DPCTLKernelBundle_Copy(__dpctl_keep const DPCTLSyclKernelBundleRef KBRef)
746746
{
747747
auto Bundle = unwrap(KBRef);
748748
if (!Bundle) {
749-
error_handler("Cannot copy DPCTLSyclKernelBundleRef as input is a nullptr",
750-
__FILE__, __func__, __LINE__);
749+
error_handler(
750+
"Cannot copy DPCTLSyclKernelBundleRef as input is a nullptr",
751+
__FILE__, __func__, __LINE__);
751752
return nullptr;
752753
}
753754
try {
754-
auto CopiedBundle = new kernel_bundle<bundle_state::executable>(*Bundle);
755+
auto CopiedBundle =
756+
new kernel_bundle<bundle_state::executable>(*Bundle);
755757
return wrap(CopiedBundle);
756758
} catch (std::exception const &e) {
757759
error_handler(e, __FILE__, __func__, __LINE__);

0 commit comments

Comments
 (0)