DPCT Namespace Usage Guide
--usm-level=noneoption of Intel® DPC++ Compatibility Tool is used, then
DPCT_USM_LEVEL_NONEis defined before DPCT namespace helper header files are included into migrated code. By default, this macro is not defined. If
DPCT_USM_LEVEL_NONEis defined, corresponding helper functions guarded by this macro are active, and the resulting migrated code will use buffer-based memory functions instead of USM-based memory functions.
--sycl-named-lambdaoption of Intel® DPC++ Compatibility Tool is used, then
DPCT_NAMED_LAMBDAis defined before DPCT namespace helper header files are included in migrated code. By default, this macro is not defined. If
DPCT_NAMED_LAMBDAis defined, corresponding helper code guarded by this macro is active and the resulting migrated code is using it.
DPCT_COMPATIBILITY_TEMPis defined as an integer number in helper header files, and is inserted into migrated code by the Intel® DPC++ Compatibility Tool. You can replace this macro in the generated code or change the value of
DPCT_COMPATIBILITY_TEMPaccording to your needs.
Atomic Helper Functions
Device Helper Functions
Device Helper Function Classes
device_infois used to present information enumerated by SYCL device information descriptors.
device_extis a subclass of SYCL device class
device_extadds a default SYCL queue associated with the device on top of SYCL device, along with interface to query device information, and initializes
dev_mgris a singleton, intended to manage all SYCL-capable devices available on the system (for example CPU or GPU).
dev_mgrselects one of the available devices as current device, according to the behavior of SYCL default device selector. Display the current device using
current_device(), and change the current device using
Returns the current device in the device manager.
Returns the default queue associated with the current device in the device manager.
get_device(unsigned int id)
device_extobject by integer id.
device_extobject associated with the SYCL CPU device.
Returns the SYCL context of the default queue associated with the current device in device manager.
Memory Helper Functions
SYCL Buffer-Based Memory Model Helper Functions
Device Memory Manager (
Device memory manager is a singleton, intended to assist with migration of memory API calls if a SYCL buffer-based memory model is used. It provides API to allocate and free host virtual address space bound to
cl::sycl::buffer, and transform between the host virtual address and
cl::sycl::buffer. By default, the
mem_mgrmaintains 128GB of virtual memory space. You can change virtual memory space as required by changing the value of
Helper Functions to Get SYCL Buffer From the Host Virtual Address
get_buffer_and_offset(const void *ptr)
ptris the host virtual address. This function returns the
cl::sycl::bufferbound to the host virtual address, and the offset of the host virtual address in the
get_buffer(const void *ptr)
ptris the host virtual address. Returns the
sycl::bufferbound to the host virtual address.
Represents a SYCL global memory variable.
Represents a SYCL constant memory variable.
Represents memory that can be accessed by host and device, in the same way as SYCL USM shared memory.
Main Member Functions of Memory Classes
Returns memory pointer of the memory object. It is a virtual pointer when buffer-based memory model is used, and it is a device pointer when a USM memory model is used.
Returns the size of a memory object.
Returns the accessor to the memory object. If a USM memory model is used, this function returns a
dpct_accessor_tobject for the device memory object.
dpct_accessor_tis a helper type, which contains the data pointer, data dimension information, and provides a method to access the memory. If a buffer-based memory model is used, this function returns
cl::sycl::accessorfor the device memory object.
Allocates memory after a SYCL device is selected, and initializes device memory if it has initial value. This API should be called after the SYCL device is selected.
Kernel Helper Functions
Image Helper Functions
The wrapper of
cl::sycl::image. It provides methods to attach/detach 1D/2D/3D data to/from
get_access()to return the SYCL image accessor.
Wraps SYCL sampler and SYCL image accessor together. Provides the
read()method to read data from the accessor.
Represents the data used to create a
cl::sycl::imageobject. Supports the following data types:
Represents 2D/3D matrix data for an image. It contains the image channel information, dimensions, size of each dimension, and the raw data pointer.
Represents the 2D/3D pitched data for an image.
Keeps image channel information; including order, data width, and type information.
Image sampling information; including addressing mode, filtering mode, and normalization mode.
Creates an object of the helper image class according to the parameters provided.
Intel® oneAPI DPC++ Library Specific Utility Helper functions
Implementation of the C++ standard library algorithm that accepts an execution policy, enabling parallel execution.
Applies a unary operation to every element in the input for which the predicate provided returns true. A mask-predicated version of the function is also provided.
Extends the C++ standard library algorithm by accepting a step in addition to the input iterators and initial value. The step is used to compute the next value in the sequence generated.
Implementation of the C++ standard library algorithm that accepts an execution policy, enabling parallel execution. The binary operation provided for reduction must be associative and commutative.
Assigns each element in the input range provided the result of the unary operator invoked with the element’s index in the input range.
Memory Helper Function Classes
Pointer type that points to memory stored on a device.
Iterator type returned by
device_vectorbegin and end methods.
Reference type returned by
device_vectorelement access operator.
Memory Helper Functions
Allocates memory for use on a device.
Deallocates memory allocated with
Allocates memory for use on a device large enough to hold the requested number of elements of the type specified.
Deallocates memory allocated using
device_pointerfrom a raw pointer.
Returns a raw pointer from a
Contains the implementation of the function objects used in the definitions of the algorithm functions described above.
Provides an implementation of
constant_iterator, an iterator that is constructed with a value and when dereferenced will only return that value.
Provides an implementation of
device_vector, a container for managing data elements stored in device memory.
Utility Helper Functions
Common utility helper functions.
BLAS-specific utility helper functions.