Kernel_bundle class C wrapper

Overview

// global functions

DPCTL_API __dpctl_give DPCTLSyclKernelBundleRef
DPCTLKernelBundle_Copy(__dpctl_keep const DPCTLSyclKernelBundleRef KBRef);

DPCTL_API __dpctl_give DPCTLSyclKernelBundleRef
DPCTLKernelBundle_CreateFromOCLSource(
    __dpctl_keep const DPCTLSyclContextRef Ctx,
    __dpctl_keep const DPCTLSyclDeviceRef Dev,
    __dpctl_keep const char* Source,
    __dpctl_keep const char* CompileOpts
    );

DPCTL_API __dpctl_give DPCTLSyclKernelBundleRef
DPCTLKernelBundle_CreateFromSpirv(
    __dpctl_keep const DPCTLSyclContextRef Ctx,
    __dpctl_keep const DPCTLSyclDeviceRef Dev,
    __dpctl_keep const void* IL,
    size_t Length,
    const char* CompileOpts
    );

DPCTL_API void
DPCTLKernelBundle_Delete(__dpctl_take DPCTLSyclKernelBundleRef KBRef);

DPCTL_API __dpctl_give DPCTLSyclKernelRef
DPCTLKernelBundle_GetKernel(
    __dpctl_keep DPCTLSyclKernelBundleRef KBRef,
    __dpctl_keep const char* KernelName
    );

DPCTL_API bool
DPCTLKernelBundle_HasKernel(
    __dpctl_keep DPCTLSyclKernelBundleRef KBRef,
    __dpctl_keep const char* KernelName
    );

Detailed Documentation

Global Functions

DPCTL_API __dpctl_give DPCTLSyclKernelBundleRef
DPCTLKernelBundle_Copy(__dpctl_keep const DPCTLSyclKernelBundleRef KBRef)

Returns a copy of the DPCTLSyclKernelBundleRef object.

Parameters:

KBRef

DPCTLSyclKernelBundleRef object to be copied.

Returns:

A new DPCTLSyclKernelBundleRef created by copying the passed in DPCTLSyclKernelBundleRef object.

DPCTL_API __dpctl_give DPCTLSyclKernelBundleRef
DPCTLKernelBundle_CreateFromOCLSource(
    __dpctl_keep const DPCTLSyclContextRef Ctx,
    __dpctl_keep const DPCTLSyclDeviceRef Dev,
    __dpctl_keep const char* Source,
    __dpctl_keep const char* CompileOpts
    )

Create a Sycl kernel bundle from an OpenCL kernel source string.

Parameters:

Ctx

An opaque pointer to a sycl::context

Dev

An opaque pointer to a sycl::device

Source

OpenCL source string

CompileOpts

Extra compiler flags (refer Sycl spec.)

Returns:

A new SyclKernelBundleRef pointer if the program creation succeeded, else returns NULL.

DPCTL_API __dpctl_give DPCTLSyclKernelBundleRef
DPCTLKernelBundle_CreateFromSpirv(
    __dpctl_keep const DPCTLSyclContextRef Ctx,
    __dpctl_keep const DPCTLSyclDeviceRef Dev,
    __dpctl_keep const void* IL,
    size_t Length,
    const char* CompileOpts
    )

Create a Sycl kernel_bundle from an OpenCL SPIR-V binary file.

Uses SYCL2020 interoperability layer to create sycl::kernel_bundle object in executable state for OpenCL and Level-Zero backends from SPIR-V binary.

Parameters:

Ctx

An opaque pointer to a sycl::context

Dev

An opaque pointer to a sycl::device

IL

SPIR-V binary

Length

The size of the IL binary in bytes.

CompileOpts

Optional compiler flags used when compiling the SPIR-V binary.

Returns:

A new SyclKernelBundleRef pointer if the kernel_bundle creation succeeded, else returns NULL.

DPCTL_API void
DPCTLKernelBundle_Delete(__dpctl_take DPCTLSyclKernelBundleRef KBRef)

Frees the DPCTLSyclKernelBundleRef pointer.

Parameters:

KBRef

Opaque pointer to a sycl::kernel_bundle

DPCTL_API __dpctl_give DPCTLSyclKernelRef
DPCTLKernelBundle_GetKernel(
    __dpctl_keep DPCTLSyclKernelBundleRef KBRef,
    __dpctl_keep const char* KernelName
    )

Returns the SyclKernel with given name from the program, if not found then return NULL.

Parameters:

KBRef

Opaque pointer to a sycl::kernel_bundle

KernelName

Name of kernel

Returns:

A SyclKernel reference if the kernel exists, else NULL

DPCTL_API bool
DPCTLKernelBundle_HasKernel(
    __dpctl_keep DPCTLSyclKernelBundleRef KBRef,
    __dpctl_keep const char* KernelName
    )

Return True if a SyclKernel with given name exists in the program, if not found then returns False.

Parameters:

KBRef

Opaque pointer to a sycl::kernel_bundle

KernelName

Name of kernel

Returns:

True if the kernel exists, else False