Skip to content

Commit d38b351

Browse files
SYCL Unbound Teamprzemektmalon
authored andcommitted
[SYCL][Bindless][3/4] Add experimental implementation of SYCL bindless images extension
This commit stands as the third commit of four to make code review easier, mostly covering the changes made to the user-facing SYCL API for the bindless images extension. The bindless images extension provides a new interface for allocating, creating, and accessing images in SYCL. Image memory allocation is seperated from image handle creation, and image handles can be passed to kernels without requesting access through accessors. This approach provides much more flexibility to the user, as well as enabling programs to implement features that were impossible to implement using standard SYCL images, such as a texture atlas. In addition to providing a new interface for images, this extension also provides initial experimental support for importing external memory into SYCL. Co-authored-by: Isaac Ault <[email protected]> Co-authored-by: Hugh Bird <[email protected]> Co-authored-by: Duncan Brawley <[email protected]> Co-authored-by: Przemek Malon <[email protected]> Co-authored-by: Chedy Najjar <[email protected]> Co-authored-by: Sean Stirling <[email protected]> Co-authored-by: Peter Zuzek <[email protected]> Implement revision 4 of the bindless images extension proposal: #9842
1 parent 73d5c04 commit d38b351

19 files changed

+3413
-0
lines changed

sycl/include/sycl/detail/cg.hpp

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ class CG {
7373
CopyFromDeviceGlobal = 20,
7474
ReadWriteHostPipe = 21,
7575
ExecCommandBuffer = 22,
76+
CopyImage = 23,
77+
SemaphoreWait = 24,
78+
SemaphoreSignal = 25,
7679
};
7780

7881
struct StorageInitHelper {
@@ -496,6 +499,77 @@ class CGCopyFromDeviceGlobal : public CG {
496499
size_t getNumBytes() { return MNumBytes; }
497500
size_t getOffset() { return MOffset; }
498501
};
502+
/// "Copy Image" command group class.
503+
class CGCopyImage : public CG {
504+
void *MSrc;
505+
void *MDst;
506+
sycl::detail::pi::PiMemImageDesc MImageDesc;
507+
sycl::detail::pi::PiMemImageFormat MImageFormat;
508+
sycl::detail::pi::PiImageCopyFlags MImageCopyFlags;
509+
sycl::detail::pi::PiImageOffset MSrcOffset;
510+
sycl::detail::pi::PiImageOffset MDstOffset;
511+
sycl::detail::pi::PiImageRegion MHostExtent;
512+
sycl::detail::pi::PiImageRegion MCopyExtent;
513+
514+
public:
515+
CGCopyImage(void *Src, void *Dst, sycl::detail::pi::PiMemImageDesc ImageDesc,
516+
sycl::detail::pi::PiMemImageFormat ImageFormat,
517+
sycl::detail::pi::PiImageCopyFlags ImageCopyFlags,
518+
sycl::detail::pi::PiImageOffset SrcOffset,
519+
sycl::detail::pi::PiImageOffset DstOffset,
520+
sycl::detail::pi::PiImageRegion HostExtent,
521+
sycl::detail::pi::PiImageRegion CopyExtent,
522+
CG::StorageInitHelper CGData, detail::code_location loc = {})
523+
: CG(CopyImage, std::move(CGData), std::move(loc)), MSrc(Src), MDst(Dst),
524+
MImageDesc(ImageDesc), MImageFormat(ImageFormat),
525+
MImageCopyFlags(ImageCopyFlags), MSrcOffset(SrcOffset),
526+
MDstOffset(DstOffset), MHostExtent(HostExtent),
527+
MCopyExtent(CopyExtent) {}
528+
529+
void *getSrc() const { return MSrc; }
530+
void *getDst() const { return MDst; }
531+
sycl::detail::pi::PiMemImageDesc getDesc() const { return MImageDesc; }
532+
sycl::detail::pi::PiMemImageFormat getFormat() const { return MImageFormat; }
533+
sycl::detail::pi::PiImageCopyFlags getCopyFlags() const {
534+
return MImageCopyFlags;
535+
}
536+
sycl::detail::pi::PiImageOffset getSrcOffset() const { return MSrcOffset; }
537+
sycl::detail::pi::PiImageOffset getDstOffset() const { return MDstOffset; }
538+
sycl::detail::pi::PiImageRegion getHostExtent() const { return MHostExtent; }
539+
sycl::detail::pi::PiImageRegion getCopyExtent() const { return MCopyExtent; }
540+
};
541+
542+
/// "Semaphore Wait" command group class.
543+
class CGSemaphoreWait : public CG {
544+
sycl::detail::pi::PiInteropSemaphoreHandle MInteropSemaphoreHandle;
545+
546+
public:
547+
CGSemaphoreWait(
548+
sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle,
549+
CG::StorageInitHelper CGData, detail::code_location loc = {})
550+
: CG(SemaphoreWait, std::move(CGData), std::move(loc)),
551+
MInteropSemaphoreHandle(InteropSemaphoreHandle) {}
552+
553+
sycl::detail::pi::PiInteropSemaphoreHandle getInteropSemaphoreHandle() const {
554+
return MInteropSemaphoreHandle;
555+
}
556+
};
557+
558+
/// "Semaphore Signal" command group class.
559+
class CGSemaphoreSignal : public CG {
560+
sycl::detail::pi::PiInteropSemaphoreHandle MInteropSemaphoreHandle;
561+
562+
public:
563+
CGSemaphoreSignal(
564+
sycl::detail::pi::PiInteropSemaphoreHandle InteropSemaphoreHandle,
565+
CG::StorageInitHelper CGData, detail::code_location loc = {})
566+
: CG(SemaphoreSignal, std::move(CGData), std::move(loc)),
567+
MInteropSemaphoreHandle(InteropSemaphoreHandle) {}
568+
569+
sycl::detail::pi::PiInteropSemaphoreHandle getInteropSemaphoreHandle() const {
570+
return MInteropSemaphoreHandle;
571+
}
572+
};
499573

500574
/// "Execute command-buffer" command group class.
501575
class CGExecCommandBuffer : public CG {

0 commit comments

Comments
 (0)