Skip to content

Commit 5ca3628

Browse files
Artem Gindinsonmaksimsab
andauthored
[SYCL] Fix DAE by avoiding creation of obsolete device images (#4977)
Due to an unintentional copy of the RTDeviceBinaryImage object that was happening in ProgramManager::build(), the NativePrograms map was getting populated by an extra entry. No duplicating entry was being created in the m_EliminatedKernelArgMasks, which made the image-based lookup in ProgramManager::getEliminatedKernelArgMask() exit early. The returned empty KernelArgMask led to errors during kernel argument setting whenever several native programs were created (e.g. for `kernel_bundle` or device code split use cases). Tested in intel/llvm-test-suite#575. Signed-off-by: Artem Gindinson <[email protected]> Co-authored-by: Maksim Sabianin <[email protected]>
1 parent cb5e8ae commit 5ca3628

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

sycl/include/CL/sycl/detail/device_binary_image.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ class RTDeviceBinaryImage : public pi::DeviceBinaryImage {
2323
: pi::DeviceBinaryImage(), ModuleHandle(ModuleHandle) {}
2424
RTDeviceBinaryImage(pi_device_binary Bin, OSModuleHandle ModuleHandle)
2525
: pi::DeviceBinaryImage(Bin), ModuleHandle(ModuleHandle) {}
26+
// Explicitly delete copy constructor/operator= to avoid unintentional copies
27+
RTDeviceBinaryImage(const RTDeviceBinaryImage &) = delete;
28+
RTDeviceBinaryImage &operator=(const RTDeviceBinaryImage &) = delete;
29+
// Explicitly retain move constructors to facilitate potential moves across
30+
// collections
31+
RTDeviceBinaryImage(RTDeviceBinaryImage &&) = default;
32+
RTDeviceBinaryImage &operator=(RTDeviceBinaryImage &&) = default;
33+
2634
OSModuleHandle getOSModuleHandle() const { return ModuleHandle; }
2735

2836
~RTDeviceBinaryImage() override {}

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ device_image_plain ProgramManager::build(const device_image_plain &DeviceImage,
17121712
SerializedObj SpecConsts = InputImpl->get_spec_const_blob_ref();
17131713

17141714
// TODO: Unify this code with getBuiltPIProgram
1715-
auto BuildF = [this, &Context, Img, &Devs, &CompileOpts, &LinkOpts,
1715+
auto BuildF = [this, &Context, &Img, &Devs, &CompileOpts, &LinkOpts,
17161716
&InputImpl, SpecConsts] {
17171717
applyOptionsFromImage(CompileOpts, LinkOpts, Img);
17181718
ContextImplPtr ContextImpl = getSyclObjImpl(Context);

0 commit comments

Comments
 (0)