add tests for clCommandSVMMemcpyKHR & clCommandSVMMemfillKHR (#1821)

* add tests for clCommandSVMMemcpyKHR & clCommandSVMMemfillKHR

* Fix typo SVMMemfill -> SVMMemFill

* fix clCommandSVMMemFillKHR calls to match extension

* add Khronos license + minor fixes

* review fixes
This commit is contained in:
Michal Babej
2023-10-10 19:22:50 +03:00
committed by GitHub
parent a7c33f8dc4
commit af2710355d
10 changed files with 342 additions and 11 deletions

View File

@@ -145,6 +145,48 @@ using clSamplerWrapper =
using clEventWrapper =
wrapper_details::Wrapper<cl_event, clRetainEvent, clReleaseEvent>;
class clSVMWrapper {
void *Ptr = nullptr;
cl_context Ctx = nullptr;
public:
clSVMWrapper() = default;
clSVMWrapper(cl_context C, size_t Size,
cl_svm_mem_flags F = CL_MEM_READ_WRITE)
: Ctx(C)
{
Ptr = clSVMAlloc(C, F, Size, 0);
}
clSVMWrapper &operator=(void *other) = delete;
clSVMWrapper(clSVMWrapper const &other) = delete;
clSVMWrapper &operator=(clSVMWrapper const &other) = delete;
clSVMWrapper(clSVMWrapper &&other)
{
Ptr = other.Ptr;
Ctx = other.Ctx;
other.Ptr = nullptr;
other.Ctx = nullptr;
}
clSVMWrapper &operator=(clSVMWrapper &&other)
{
Ptr = other.Ptr;
Ctx = other.Ctx;
other.Ptr = nullptr;
other.Ctx = nullptr;
return *this;
}
~clSVMWrapper()
{
if (Ptr) clSVMFree(Ctx, Ptr);
}
void *operator()() const { return Ptr; }
};
class clProtectedImage {
public:
clProtectedImage()