diff --git a/dpctl-capi/include/dpctl_sycl_platform_interface.h b/dpctl-capi/include/dpctl_sycl_platform_interface.h index 9d428d7cfe..0e63679849 100644 --- a/dpctl-capi/include/dpctl_sycl_platform_interface.h +++ b/dpctl-capi/include/dpctl_sycl_platform_interface.h @@ -30,9 +30,18 @@ #include "Support/MemOwnershipAttrs.h" #include "dpctl_data_types.h" #include "dpctl_sycl_enum_types.h" +#include "dpctl_sycl_types.h" DPCTL_C_EXTERN_C_BEGIN +/*! + * @brief Deletes the DPCTLSyclProgramRef pointer. + * + * @param PRef An opaque pointer to a sycl::platform. + */ +DPCTL_API +void DPCTLPlatform_Delete(__dpctl_take DPCTLSyclPlatformRef PRef); + /*! * @brief Returns the number of non-host type sycl::platform available on the * system. diff --git a/dpctl-capi/source/dpctl_sycl_platform_interface.cpp b/dpctl-capi/source/dpctl_sycl_platform_interface.cpp index 8ab5e66b5e..c062949ade 100644 --- a/dpctl-capi/source/dpctl_sycl_platform_interface.cpp +++ b/dpctl-capi/source/dpctl_sycl_platform_interface.cpp @@ -26,6 +26,7 @@ #include "dpctl_sycl_platform_interface.h" #include "../helper/include/dpctl_utils_helper.h" +#include "Support/CBindingWrapping.h" #include #include #include @@ -36,6 +37,9 @@ using namespace cl::sycl; namespace { + +DEFINE_SIMPLE_CONVERSION_FUNCTIONS(platform, DPCTLSyclPlatformRef); + std::set get_set_of_non_hostbackends() { std::set be_set; @@ -64,6 +68,12 @@ std::set get_set_of_non_hostbackends() } // namespace +void DPCTLPlatform_Delete(__dpctl_take DPCTLSyclPlatformRef PRef) +{ + auto P = unwrap(PRef); + delete P; +} + /*! * Prints out the following sycl::info::platform attributes for each platform * found on the system: diff --git a/dpctl/_backend.pxd b/dpctl/_backend.pxd index 23836cb545..a9c95dec53 100644 --- a/dpctl/_backend.pxd +++ b/dpctl/_backend.pxd @@ -75,6 +75,7 @@ cdef extern from "dpctl_sycl_types.h": cdef struct DPCTLOpaqueSyclDeviceSelector cdef struct DPCTLOpaqueSyclEvent cdef struct DPCTLOpaqueSyclKernel + cdef struct DPCTLOpaqueSyclPlatform cdef struct DPCTLOpaqueSyclProgram cdef struct DPCTLOpaqueSyclQueue cdef struct DPCTLOpaqueSyclUSM @@ -84,6 +85,7 @@ cdef extern from "dpctl_sycl_types.h": ctypedef DPCTLOpaqueSyclDeviceSelector *DPCTLSyclDeviceSelectorRef ctypedef DPCTLOpaqueSyclEvent *DPCTLSyclEventRef ctypedef DPCTLOpaqueSyclKernel *DPCTLSyclKernelRef + ctypedef DPCTLOpaqueSyclPlatform *DPCTLSyclPlatformRef ctypedef DPCTLOpaqueSyclProgram *DPCTLSyclProgramRef ctypedef DPCTLOpaqueSyclQueue *DPCTLSyclQueueRef ctypedef DPCTLOpaqueSyclUSM *DPCTLSyclUSMRef @@ -138,6 +140,7 @@ cdef extern from "dpctl_sycl_kernel_interface.h": cdef extern from "dpctl_sycl_platform_interface.h": + cdef void DPCTLPlatform_Delete() cdef size_t DPCTLPlatform_GetNumNonHostPlatforms() cdef void DPCTLPlatform_DumpInfo() cdef size_t DPCTLPlatform_GetNumNonHostBackends()