Skip to content

[OclRuntime] Added gpuMemCopy() function #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/gc/ExecutionEngine/OpenCLRuntime/OpenCLRuntimeWrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#ifdef _WIN32
#define OCL_RUNTIME_EXPORT __declspec(dllexport)
#else
#define OCL_RUNTIME_EXPORT
#define OCL_RUNTIME_EXPORT __attribute__((visibility("default")))
#endif // _WIN32

namespace {
Expand Down Expand Up @@ -73,7 +73,7 @@ struct CLExtTable {
clSharedMemAllocINTEL_fn allocShared;
clMemBlockingFreeINTEL_fn blockingFree;
clSetKernelArgMemPointerINTEL_fn setKernelArgMemPtr;
clEnqueueMemcpyINTEL_fn enqueneMemcpy;
clEnqueueMemcpyINTEL_fn enqueueMemcpy;
CLExtTable() = default;
CLExtTable(cl_platform_id plat) {
allocDev =
Expand All @@ -84,7 +84,7 @@ struct CLExtTable {
(clMemBlockingFreeINTEL_fn)queryCLExtFunc(plat, MemBlockingFreeName);
setKernelArgMemPtr = (clSetKernelArgMemPointerINTEL_fn)queryCLExtFunc(
plat, SetKernelArgMemPointerName);
enqueneMemcpy =
enqueueMemcpy =
(clEnqueueMemcpyINTEL_fn)queryCLExtFunc(plat, EnqueueMemcpyName);
}
};
Expand Down Expand Up @@ -390,6 +390,14 @@ extern "C" OCL_RUNTIME_EXPORT void gpuMemFree(GPUCLQUEUE *queue, void *ptr) {
}
}

extern "C" OCL_RUNTIME_EXPORT void gpuMemCopy(GPUCLQUEUE *queue, void *dst,
void *src, uint64_t size) {
auto func = queue->ext_table_ ? queue->ext_table_->enqueueMemcpy
: (clEnqueueMemcpyINTEL_fn)queryCLExtFunc(
queue->device_, EnqueueMemcpyName);
CL_SAFE_CALL(func(queue->queue_, true, dst, src, size, 0, nullptr, nullptr));
}

extern "C" OCL_RUNTIME_EXPORT cl_program
gpuModuleLoad(GPUCLQUEUE *queue, const unsigned char *data, size_t dataSize) {
if (queue) {
Expand Down