DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
cl::sycl::detail::ProgramManager Class Reference

#include <detail/program_manager/program_manager.hpp>

Public Types

using KernelArgMask = std::vector< bool >
 

Public Member Functions

RTDeviceBinaryImagegetDeviceImage (OSModuleHandle M, const std::string &KernelName, const context &Context, const device &Device, bool JITCompilationIsRequired=false)
 
RT::PiProgram createPIProgram (const RTDeviceBinaryImage &Img, const context &Context, const device &Device)
 
std::pair< RT::PiProgram, bool > getOrCreatePIProgram (const RTDeviceBinaryImage &Img, const context &Context, const device &Device, const std::string &CompileAndLinkOptions, SerializedObj SpecConsts)
 Creates a PI program using either a cached device code binary if present in the persistent cache or from the supplied device image otherwise. More...
 
RT::PiProgram getBuiltPIProgram (OSModuleHandle M, const ContextImplPtr &ContextImpl, const DeviceImplPtr &DeviceImpl, const std::string &KernelName, const program_impl *Prg=nullptr, bool JITCompilationIsRequired=false)
 Builds or retrieves from cache a program defining the kernel with given name. More...
 
RT::PiProgram getBuiltPIProgram (OSModuleHandle M, const context &Context, const device &Device, const std::string &KernelName, const property_list &PropList, bool JITCompilationIsRequired=false)
 
std::tuple< RT::PiKernel, std::mutex *, RT::PiProgramgetOrCreateKernel (OSModuleHandle M, const ContextImplPtr &ContextImpl, const DeviceImplPtr &DeviceImpl, const std::string &KernelName, const program_impl *Prg)
 
RT::PiProgram getPiProgramFromPiKernel (RT::PiKernel Kernel, const ContextImplPtr Context)
 
void addImages (pi_device_binaries DeviceImages)
 
void debugPrintBinaryImages () const
 
void flushSpecConstants (const program_impl &Prg, pi::PiProgram NativePrg=nullptr, const RTDeviceBinaryImage *Img=nullptr)
 Resolves given program to a device binary image and requests the program to flush constants the image depends on. More...
 
uint32_t getDeviceLibReqMask (const RTDeviceBinaryImage &Img)
 
KernelArgMask getEliminatedKernelArgMask (OSModuleHandle M, pi::PiProgram NativePrg, const std::string &KernelName)
 Returns the mask for eliminated kernel arguments for the requested kernel within the native program. More...
 
kernel_id getSYCLKernelID (const std::string &KernelName)
 
std::vector< kernel_idgetAllSYCLKernelIDs ()
 
kernel_id getBuiltInKernelID (const std::string &KernelName)
 
std::vector< device_image_plaingetSYCLDeviceImagesWithCompatibleState (const context &Ctx, const std::vector< device > &Devs, bundle_state TargetState)
 
void bringSYCLDeviceImagesToState (std::vector< device_image_plain > &DeviceImages, bundle_state TargetState)
 
std::vector< device_image_plaingetSYCLDeviceImages (const context &Ctx, const std::vector< device > &Devs, bundle_state State)
 
std::vector< device_image_plaingetSYCLDeviceImages (const context &Ctx, const std::vector< device > &Devs, const DevImgSelectorImpl &Selector, bundle_state TargetState)
 
std::vector< device_image_plaingetSYCLDeviceImages (const context &Ctx, const std::vector< device > &Devs, const std::vector< kernel_id > &KernelIDs, bundle_state TargetState)
 
device_image_plain compile (const device_image_plain &DeviceImage, const std::vector< device > &Devs, const property_list &PropList)
 
std::vector< device_image_plainlink (const std::vector< device_image_plain > &DeviceImages, const std::vector< device > &Devs, const property_list &PropList)
 
device_image_plain build (const device_image_plain &DeviceImage, const std::vector< device > &Devs, const property_list &PropList)
 
std::pair< RT::PiKernel, std::mutex * > getOrCreateKernel (const context &Context, const std::string &KernelName, const property_list &PropList, RT::PiProgram Program)
 
 ProgramManager ()
 
 ~ProgramManager ()=default
 
bool kernelUsesAssert (OSModuleHandle M, const std::string &KernelName) const
 

Static Public Member Functions

static ProgramManagergetInstance ()
 
static std::string getProgramBuildLog (const RT::PiProgram &Program, const ContextImplPtr Context)
 

Detailed Description

Definition at line 70 of file program_manager.hpp.

Member Typedef Documentation

◆ KernelArgMask

Definition at line 73 of file program_manager.hpp.

Constructor & Destructor Documentation

◆ ProgramManager()

cl::sycl::detail::ProgramManager::ProgramManager ( )

◆ ~ProgramManager()

cl::sycl::detail::ProgramManager::~ProgramManager ( )
default

Member Function Documentation

◆ addImages()

◆ bringSYCLDeviceImagesToState()

void cl::sycl::detail::ProgramManager::bringSYCLDeviceImagesToState ( std::vector< device_image_plain > &  DeviceImages,
bundle_state  TargetState 
)

◆ build()

◆ compile()

◆ createPIProgram()

◆ debugPrintBinaryImages()

void cl::sycl::detail::ProgramManager::debugPrintBinaryImages ( ) const

◆ flushSpecConstants()

void cl::sycl::detail::ProgramManager::flushSpecConstants ( const program_impl Prg,
pi::PiProgram  NativePrg = nullptr,
const RTDeviceBinaryImage Img = nullptr 
)

Resolves given program to a device binary image and requests the program to flush constants the image depends on.

Parameters
Prgthe program object to get spec constant settings from. Passing program_impl by raw reference is OK, since it is not captured anywhere once the function returns.
NativePrgthe native program, target for spec constant setting; if not null then overrides the native program in Prg
ImgA source of the information about which constants need setting and symboling->integer spec constnant ID mapping. If not null, overrides native program->binary image binding maintained by the program manager.

Definition at line 1200 of file program_manager.cpp.

References cl::sycl::detail::DbgProgMgr, cl::sycl::detail::program_impl::flush_spec_constants(), cl::sycl::detail::program_impl::get(), cl::sycl::detail::program_impl::getHandleRef(), cl::sycl::detail::RTDeviceBinaryImage::getRawData(), cl::sycl::detail::program_impl::hasSetSpecConstants(), PI_INVALID_OPERATION, and cl::sycl::detail::RTDeviceBinaryImage::supportsSpecConstants().

◆ getAllSYCLKernelIDs()

std::vector< kernel_id > cl::sycl::detail::ProgramManager::getAllSYCLKernelIDs ( )

Definition at line 1336 of file program_manager.cpp.

◆ getBuiltInKernelID()

kernel_id cl::sycl::detail::ProgramManager::getBuiltInKernelID ( const std::string &  KernelName)

Definition at line 1347 of file program_manager.cpp.

◆ getBuiltPIProgram() [1/2]

RT::PiProgram cl::sycl::detail::ProgramManager::getBuiltPIProgram ( OSModuleHandle  M,
const context Context,
const device Device,
const std::string &  KernelName,
const property_list PropList,
bool  JITCompilationIsRequired = false 
)

◆ getBuiltPIProgram() [2/2]

RT::PiProgram cl::sycl::detail::ProgramManager::getBuiltPIProgram ( OSModuleHandle  M,
const ContextImplPtr ContextImpl,
const DeviceImplPtr DeviceImpl,
const std::string &  KernelName,
const program_impl Prg = nullptr,
bool  JITCompilationIsRequired = false 
)

Builds or retrieves from cache a program defining the kernel with given name.

Parameters
Midenfies the OS module the kernel comes from (multiple OS modules may have kernels with the same name)
Contextthe context to build the program with
Devicethe device for which the program is built
KernelNamethe kernel's name
Prgprovides build context information, such as current specialization constants settings; can be nullptr. Passing as a raw pointer is OK, since it is not captured anywhere once the function returns.
JITCompilationIsRequiredIf JITCompilationIsRequired is true add a check that kernel is compiled, otherwise don't add the check.

Definition at line 439 of file program_manager.cpp.

References cl::sycl::detail::KernelProgramCache::acquireCachedPrograms(), cl::sycl::detail::applyOptionsFromEnvironment(), cl::sycl::detail::applyOptionsFromImage(), cl::sycl::build(), cl::sycl::detail::enableITTAnnotationsIfNeeded(), cl::sycl::detail::pi::DeviceBinaryImage::get(), cl::sycl::detail::program_impl::get_build_options(), cl::sycl::detail::pi::DeviceBinaryImage::getFormat(), cl::sycl::detail::plugin::getPiPlugin(), cl::sycl::detail::getRawSyclObjImpl(), PI_DEVICE_BINARY_TYPE_SPIRV, _pi_plugin::PiFunctionTable, cl::sycl::detail::program_impl::stableSerializeSpecConstRegistry(), and cl::sycl::detail::RTDeviceBinaryImage::supportsSpecConstants().

Referenced by cl::sycl::detail::program_impl::build_with_kernel_name().

◆ getDeviceImage()

RTDeviceBinaryImage & cl::sycl::detail::ProgramManager::getDeviceImage ( OSModuleHandle  M,
const std::string &  KernelName,
const context Context,
const device Device,
bool  JITCompilationIsRequired = false 
)

◆ getDeviceLibReqMask()

◆ getEliminatedKernelArgMask()

ProgramManager::KernelArgMask cl::sycl::detail::ProgramManager::getEliminatedKernelArgMask ( OSModuleHandle  M,
pi::PiProgram  NativePrg,
const std::string &  KernelName 
)

Returns the mask for eliminated kernel arguments for the requested kernel within the native program.

Parameters
Midentifies the OS module the kernel comes from (multiple OS modules may have kernels with the same name).
NativePrgthe PI program associated with the kernel.
KernelNamethe name of the kernel.

Definition at line 1253 of file program_manager.cpp.

Referenced by cl::sycl::detail::enqueueImpKernel().

◆ getInstance()

ProgramManager & cl::sycl::detail::ProgramManager::getInstance ( )
static

◆ getOrCreateKernel() [1/2]

std::pair< RT::PiKernel, std::mutex * > cl::sycl::detail::ProgramManager::getOrCreateKernel ( const context Context,
const std::string &  KernelName,
const property_list PropList,
RT::PiProgram  Program 
)

◆ getOrCreateKernel() [2/2]

◆ getOrCreatePIProgram()

std::pair< RT::PiProgram, bool > cl::sycl::detail::ProgramManager::getOrCreatePIProgram ( const RTDeviceBinaryImage Img,
const context Context,
const device Device,
const std::string &  CompileAndLinkOptions,
SerializedObj  SpecConsts 
)

Creates a PI program using either a cached device code binary if present in the persistent cache or from the supplied device image otherwise.

Parameters
ImgThe device image to find a cached device code binary for or create the PI program with.
ContextThe context to find or create the PI program with.
DeviceThe device to find or create the PI program for.
CompileAndLinkOptionsThe compile and linking options to be used for building the PI program. These options must appear in the mentioned order. This parameter is used as a partial key in the cache and has no effect if no cached device code binary is found in the persistent cache.
SpecConstsSpecialization constants associated with the device image. This parameter is used as a partial key in the cache and has no effect if no cached device code binary is found in the persistent cache.
Returns
A pair consisting of the PI program created with the corresponding device code binary and a boolean that is true if the device code binary was found in the persistent cache and false otherwise.

Definition at line 415 of file program_manager.cpp.

References cl::sycl::detail::pi::DeviceBinaryImage::PropertyRange::begin(), cl::sycl::detail::createBinaryProgram(), cl::sycl::detail::pi::DeviceBinaryImage::getProgramMetadata(), and cl::sycl::detail::getSyclObjImpl().

◆ getPiProgramFromPiKernel()

RT::PiProgram cl::sycl::detail::ProgramManager::getPiProgramFromPiKernel ( RT::PiKernel  Kernel,
const ContextImplPtr  Context 
)

◆ getProgramBuildLog()

std::string cl::sycl::detail::ProgramManager::getProgramBuildLog ( const RT::PiProgram Program,
const ContextImplPtr  Context 
)
static

◆ getSYCLDeviceImages() [1/3]

std::vector< device_image_plain > cl::sycl::detail::ProgramManager::getSYCLDeviceImages ( const context Ctx,
const std::vector< device > &  Devs,
bundle_state  State 
)

Definition at line 1497 of file program_manager.cpp.

◆ getSYCLDeviceImages() [2/3]

std::vector< device_image_plain > cl::sycl::detail::ProgramManager::getSYCLDeviceImages ( const context Ctx,
const std::vector< device > &  Devs,
const DevImgSelectorImpl Selector,
bundle_state  TargetState 
)

Definition at line 1508 of file program_manager.cpp.

◆ getSYCLDeviceImages() [3/3]

std::vector< device_image_plain > cl::sycl::detail::ProgramManager::getSYCLDeviceImages ( const context Ctx,
const std::vector< device > &  Devs,
const std::vector< kernel_id > &  KernelIDs,
bundle_state  TargetState 
)

Definition at line 1527 of file program_manager.cpp.

References cl::sycl::make_error_code().

◆ getSYCLDeviceImagesWithCompatibleState()

std::vector< device_image_plain > cl::sycl::detail::ProgramManager::getSYCLDeviceImagesWithCompatibleState ( const context Ctx,
const std::vector< device > &  Devs,
bundle_state  TargetState 
)

◆ getSYCLKernelID()

kernel_id cl::sycl::detail::ProgramManager::getSYCLKernelID ( const std::string &  KernelName)

Definition at line 1325 of file program_manager.cpp.

References PI_INVALID_KERNEL_NAME.

◆ kernelUsesAssert()

bool cl::sycl::detail::ProgramManager::kernelUsesAssert ( OSModuleHandle  M,
const std::string &  KernelName 
) const

◆ link()

std::vector< device_image_plain > cl::sycl::detail::ProgramManager::link ( const std::vector< device_image_plain > &  DeviceImages,
const std::vector< device > &  Devs,
const property_list PropList 
)

The documentation for this class was generated from the following files: