Skip to content

Commit 44954af

Browse files
author
Alexander Batashev
authored
[SYCL] Force Clang to emit complete object constructor for SYCLMemObjT (#1652)
GCC produces two symbols for one of SYCLMemObjT's constructors: ``` _ZN2cl4sycl6detail11SYCLMemObjTC1EP7_cl_memRKNS0_7contextEmNS0_5eventESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteISA_E _ZN2cl4sycl6detail11SYCLMemObjTC2EP7_cl_memRKNS0_7contextEmNS0_5eventESt10unique_ptrINS1_19SYCLMemObjAllocatorESt14default_deleteISA_E ``` Those are complete object constructor and base object constructor. The difference is that complete object constructor initializes vtable, while base object constructor accepts it from a derived class. On the other hand, Clang is smart enough to see that SYCLMemObjT is a pure virtual class, and its complete object constructor can be dropped. This patch adds dumb implementation for missing member functions to SYCLMemObjT to force Clang behave the same way GCC does. Signed-off-by: Ivan Karachun <[email protected]>
1 parent f706624 commit 44954af

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

sycl/include/CL/sycl/detail/sycl_mem_obj_i.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SYCLMemObjI {
2929
public:
3030
virtual ~SYCLMemObjI() = default;
3131

32-
enum MemObjType { BUFFER, IMAGE };
32+
enum MemObjType { BUFFER, IMAGE, UNDEFINED };
3333

3434
virtual MemObjType getType() const = 0;
3535

sycl/include/CL/sycl/detail/sycl_mem_obj_t.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,13 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
261261
static size_t getBufSizeForContext(const ContextImplPtr &Context,
262262
cl_mem MemObject);
263263

264+
void *allocateMem(ContextImplPtr Context, bool InitFromUserData,
265+
void *HostPtr, RT::PiEvent &InteropEvent) override {
266+
throw runtime_error("Not implemented", PI_INVALID_OPERATION);
267+
}
268+
269+
MemObjType getType() const override { return UNDEFINED; }
270+
264271
protected:
265272
// Allocator used for allocation memory on host.
266273
unique_ptr_class<SYCLMemObjAllocator> MAllocator;

0 commit comments

Comments
 (0)