Skip to content

Commit 9f7d7e4

Browse files
Artem Gindinsonmaksimsab
andcommitted
[SYCL] Fix DAE by avoiding creation of obsolete device images
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 4f5fa0e commit 9f7d7e4

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 &&RHS) = 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
@@ -1688,7 +1688,7 @@ device_image_plain ProgramManager::build(const device_image_plain &DeviceImage,
16881688
SerializedObj SpecConsts = InputImpl->get_spec_const_blob_ref();
16891689

16901690
// TODO: Unify this code with getBuiltPIProgram
1691-
auto BuildF = [this, &Context, Img, &Devs, &CompileOpts, &LinkOpts,
1691+
auto BuildF = [this, &Context, &Img, &Devs, &CompileOpts, &LinkOpts,
16921692
&InputImpl, SpecConsts] {
16931693
applyOptionsFromImage(CompileOpts, LinkOpts, Img);
16941694
ContextImplPtr ContextImpl = getSyclObjImpl(Context);

0 commit comments

Comments
 (0)