Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
defc264
Move _memory.pyx
PokhodenkoSA Sep 15, 2020
8b811c5
Import setuptools before Cython. Otherwise, both might disagree about…
PokhodenkoSA Sep 15, 2020
0704258
Add dppl._memory Cython module.
PokhodenkoSA Sep 15, 2020
e57927d
Run dppl/tests/dppl_tests too when run all unit tests.
PokhodenkoSA Sep 15, 2020
267492f
Add tests for memory manager.
PokhodenkoSA Sep 15, 2020
5ff3eb0
Split tests for memory. One test one context (no, CPU, GPU).
PokhodenkoSA Sep 15, 2020
902bc8a
[opt] Rename getpyexts() to extensions().
PokhodenkoSA Sep 15, 2020
5d81879
Adds C and Cython API for portions of Sycl queue, device, context int…
diptorupd Sep 15, 2020
758aacc
Add C-API stub library for sycl memory.
PokhodenkoSA Sep 16, 2020
35a4674
Add missing DPPL_API.
diptorupd Sep 16, 2020
7bb5faf
Move platform specific functions into a separate file.
diptorupd Sep 16, 2020
4a11490
Create a single utility function to delete C strings.
diptorupd Sep 16, 2020
6e246fb
Update backends/source/dppl_utils.cpp
PokhodenkoSA Sep 17, 2020
97b53ca
Merge branch 'pr/30' into feature/usm
PokhodenkoSA Sep 17, 2020
abcf6f3
Add _sycl_core.pxd file.
PokhodenkoSA Sep 17, 2020
039b794
Remove using of PyCapsule in _memory.pyx.
PokhodenkoSA Sep 17, 2020
dc72b03
Small style fixes in _memory.pyx.
PokhodenkoSA Sep 17, 2020
b5ab5d6
Moved functions from _memory.pyx to C-API interface library.
PokhodenkoSA Sep 17, 2020
c57c05c
Move Cython definitions for backend to single pxd file.
PokhodenkoSA Sep 17, 2020
c075f0c
Remove SyclQueue from _memory.pyx
PokhodenkoSA Sep 17, 2020
708fd1f
Use SyclQueue from
PokhodenkoSA Sep 17, 2020
5d3db20
Remove cl::sycl::queue from _memory.pyx
PokhodenkoSA Sep 17, 2020
6747080
Removed commented code from _memory.pyx
PokhodenkoSA Sep 17, 2020
56241ef
Eliminate temporary context object.
PokhodenkoSA Sep 17, 2020
7fabbe4
Fix style.
PokhodenkoSA Sep 17, 2020
abd373b
Add MemoryUSM* classes.
PokhodenkoSA Sep 18, 2020
ba3e497
Add __getbuffer__ to Shared and Host MemoryUSM classes.
PokhodenkoSA Sep 18, 2020
00d63b0
Rename C-API types for USM.
PokhodenkoSA Sep 18, 2020
28f0496
Add DPPLUSM_GetPointerType and remove types from CL/sycl.hpp from _me…
PokhodenkoSA Sep 18, 2020
80cec2a
Clean unused code from _memory_.pyx
PokhodenkoSA Sep 18, 2020
debc2eb
Merge branch 'master' into feature/usm
PokhodenkoSA Sep 18, 2020
8ef95df
Small fixes.
PokhodenkoSA Sep 18, 2020
fa585da
Remove unused code.
PokhodenkoSA Sep 18, 2020
533e74b
Fix style.
PokhodenkoSA Sep 18, 2020
ab7a9ba
Fix style
PokhodenkoSA Sep 18, 2020
b5674b4
Use wrap().
PokhodenkoSA Sep 19, 2020
5e93d6e
Store context instead of queue in Memory class.
PokhodenkoSA Sep 19, 2020
6bd1756
Pass queue as parameter to constructor. If queue is None then get dpp…
PokhodenkoSA Sep 19, 2020
1333676
Add comment about casting memory_ptr to char*.
PokhodenkoSA Sep 19, 2020
b82eab5
Remove pointer property from Memory.
PokhodenkoSA Sep 19, 2020
1b5f804
Rename file with usm tests.
PokhodenkoSA Sep 19, 2020
722c8cf
Standardize the names of DPPL functions on DPPLXXX_FuncName.
diptorupd Sep 19, 2020
1b92c15
Merge branch 'feature/usm' into rename_functions
diptorupd Sep 19, 2020
a9b1011
Merge branch 'master' into rename_functions
diptorupd Sep 19, 2020
0c67a99
Fix files.
diptorupd Sep 19, 2020
3802f53
Rename the CString deleter to follow convention in rest of the library.
diptorupd Sep 22, 2020
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
8 changes: 4 additions & 4 deletions backends/include/dppl_sycl_context_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ DPPL_C_EXTERN_C_BEGIN
/*!
* @brief Returns true if this SYCL context is a host context.
*
* @param CtxtRef A opaque pointer to a sycl::context.
* @param CtxRef A opaque pointer to a sycl::context.
* @return True if the SYCL context is a host context, else False.
*/
DPPL_API
bool DPPLIsHostContext (__dppl_keep const DPPLSyclContextRef CtxtRef);
bool DPPLContext_IsHost (__dppl_keep const DPPLSyclContextRef CtxRef);

/*!
* @brief Delete the pointer after casting it to sycl::context
*
* @param CtxtRef The DPPLSyclContextRef pointer to be deleted.
* @param CtxRef The DPPLSyclContextRef pointer to be deleted.
*/
DPPL_API
void DPPLDeleteSyclContext (__dppl_take DPPLSyclContextRef CtxtRef);
void DPPLContext_Delete (__dppl_take DPPLSyclContextRef CtxRef);

DPPL_C_EXTERN_C_END
20 changes: 10 additions & 10 deletions backends/include/dppl_sycl_device_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ typedef enum
* @param DRef A DPPLSyclDeviceRef pointer.
*/
DPPL_API
void DPPLDumpDeviceInfo (__dppl_keep const DPPLSyclDeviceRef DRef);
void DPPLDevice_DumpInfo (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Deletes a DPPLSyclDeviceRef pointer after casting to to sycl::device.
*
* @param DRef The DPPLSyclDeviceRef pointer to be freed.
*/
DPPL_API
void DPPLDeleteSyclDevice (__dppl_take DPPLSyclDeviceRef DRef);
void DPPLDevice_Delete (__dppl_take DPPLSyclDeviceRef DRef);

/*!
* @brief Returns true if this SYCL device is an OpenCL device and the device
Expand All @@ -75,7 +75,7 @@ void DPPLDeleteSyclDevice (__dppl_take DPPLSyclDeviceRef DRef);
* @return True if the device type is an accelerator, else False.
*/
DPPL_API
bool DPPLDeviceIsAccelerator (__dppl_keep const DPPLSyclDeviceRef DRef);
bool DPPLDevice_IsAccelerator (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Returns true if this SYCL device is an OpenCL device and the device
Expand All @@ -85,7 +85,7 @@ bool DPPLDeviceIsAccelerator (__dppl_keep const DPPLSyclDeviceRef DRef);
* @return True if the device type is a cpu, else False.
*/
DPPL_API
bool DPPLDeviceIsCPU (__dppl_keep const DPPLSyclDeviceRef DRef);
bool DPPLDevice_IsCPU (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Returns true if this SYCL device is an OpenCL device and the device
Expand All @@ -95,7 +95,7 @@ bool DPPLDeviceIsCPU (__dppl_keep const DPPLSyclDeviceRef DRef);
* @return True if the device type is a gpu, else False.
*/
DPPL_API
bool DPPLDeviceIsGPU (__dppl_keep const DPPLSyclDeviceRef DRef);
bool DPPLDevice_IsGPU (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Returns true if this SYCL device is a host device.
Expand All @@ -104,7 +104,7 @@ bool DPPLDeviceIsGPU (__dppl_keep const DPPLSyclDeviceRef DRef);
* @return True if the device is a host device, else False.
*/
DPPL_API
bool DPPLDeviceIsHost (__dppl_keep const DPPLSyclDeviceRef DRef);
bool DPPLDevice_IsHost (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Returns the OpenCL software driver version as a C string.
Expand All @@ -115,7 +115,7 @@ bool DPPLDeviceIsHost (__dppl_keep const DPPLSyclDeviceRef DRef);
*/
DPPL_API
__dppl_give const char*
DPPLGetDeviceDriverInfo (__dppl_keep const DPPLSyclDeviceRef DRef);
DPPLDevice_GetDriverInfo (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Returns a C string for the device name.
Expand All @@ -125,7 +125,7 @@ DPPLGetDeviceDriverInfo (__dppl_keep const DPPLSyclDeviceRef DRef);
*/
DPPL_API
__dppl_give const char*
DPPLGetDeviceName (__dppl_keep const DPPLSyclDeviceRef DRef);
DPPLDevice_GetName (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Returns a C string corresponding to the vendor name.
Expand All @@ -135,7 +135,7 @@ DPPLGetDeviceName (__dppl_keep const DPPLSyclDeviceRef DRef);
*/
DPPL_API
__dppl_give const char*
DPPLGetDeviceVendorName (__dppl_keep const DPPLSyclDeviceRef DRef);
DPPLDevice_GetVendorName (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Returns True if the device and the host share a unified memory
Expand All @@ -146,6 +146,6 @@ DPPLGetDeviceVendorName (__dppl_keep const DPPLSyclDeviceRef DRef);
* with the host.
*/
DPPL_API
bool DPPLGetDeviceHostUnifiedMemory (__dppl_keep const DPPLSyclDeviceRef DRef);
bool DPPLDevice_IsHostUnifiedMemory (__dppl_keep const DPPLSyclDeviceRef DRef);

DPPL_C_EXTERN_C_END
6 changes: 3 additions & 3 deletions backends/include/dppl_sycl_queue_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ DPPL_C_EXTERN_C_BEGIN
*/
DPPL_API
__dppl_give DPPLSyclContextRef
DPPLGetContextFromQueue (__dppl_keep const DPPLSyclQueueRef QRef);
DPPLQueue_GetContext (__dppl_keep const DPPLSyclQueueRef QRef);

/*!
* @brief returns the Sycl device for the queue.
Expand All @@ -53,14 +53,14 @@ DPPLGetContextFromQueue (__dppl_keep const DPPLSyclQueueRef QRef);
*/
DPPL_API
__dppl_give DPPLSyclDeviceRef
DPPLGetDeviceFromQueue (__dppl_keep const DPPLSyclQueueRef QRef);
DPPLQueue_GetDevice (__dppl_keep const DPPLSyclQueueRef QRef);

/*!
* @brief Delete the pointer after casting it to sycl::queue.
*
* @param QRef A DPPLSyclQueueRef pointer that gets deleted.
*/
DPPL_API
void DPPLDeleteSyclQueue (__dppl_take DPPLSyclQueueRef QRef);
void DPPLQueue_Delete (__dppl_take DPPLSyclQueueRef QRef);

DPPL_C_EXTERN_C_END
38 changes: 19 additions & 19 deletions backends/include/dppl_sycl_queue_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ DPPL_C_EXTERN_C_BEGIN
* wrapped inside an opaque DPPLSyclQueueRef pointer.
*/
DPPL_API
__dppl_give DPPLSyclQueueRef DPPLGetCurrentQueue ();
__dppl_give DPPLSyclQueueRef DPPLQueueMgr_GetCurrentQueue ();

/*!
* @brief Get a sycl::queue object of the specified type and device id.
Expand All @@ -63,8 +63,8 @@ __dppl_give DPPLSyclQueueRef DPPLGetCurrentQueue ();
* raised if no such device exists.
*/
DPPL_API
__dppl_give DPPLSyclQueueRef DPPLGetQueue (DPPLSyclDeviceType DeviceTy,
size_t DNum);
__dppl_give DPPLSyclQueueRef DPPLQueueMgr_GetQueue (DPPLSyclDeviceType DeviceTy,
size_t DNum);

/*!
* @brief Get the number of activated queues not including the global or
Expand All @@ -73,23 +73,23 @@ __dppl_give DPPLSyclQueueRef DPPLGetQueue (DPPLSyclDeviceType DeviceTy,
* @return The number of activated queues.
*/
DPPL_API
size_t DPPLGetNumActivatedQueues ();
size_t DPPLQueueMgr_GetNumActivatedQueues ();

/*!
* @brief Get the number of GPU queues available on the system.
*
* @return The number of available GPU queues.
*/
DPPL_API
size_t DPPLGetNumGPUQueues ();
size_t DPPLQueueMgr_GetNumGPUQueues ();

/*!
* @brief Get the number of CPU queues available on the system.
*
* @return The number of available CPU queues.
*/
DPPL_API
size_t DPPLGetNumCPUQueues ();
size_t DPPLQueueMgr_GetNumCPUQueues ();

/*!
* @brief Set the default DPPL queue to the sycl::queue for the given device.
Expand All @@ -100,8 +100,8 @@ size_t DPPLGetNumCPUQueues ();
* @param DNum Device id for the device (defaults to 0)
*/
DPPL_API
void DPPLSetAsDefaultQueue (DPPLSyclDeviceType DeviceTy,
size_t DNum);
void DPPLQueueMgr_SetAsDefaultQueue (DPPLSyclDeviceType DeviceTy,
size_t DNum);

/*!
* @brief Pushes a new sycl::queue object to the top of DPPL's thread-local
Expand All @@ -110,11 +110,11 @@ void DPPLSetAsDefaultQueue (DPPLSyclDeviceType DeviceTy,
* DPPL maintains a thread-local stack of sycl::queue objects to facilitate
* nested parallelism. The sycl::queue at the top of the stack is termed as the
* currently activated queue, and is always the one returned by
* DPPLGetCurrentQueue(). DPPLPushSyclQueueToStack creates a new sycl::queue
* corresponding to the specified device and pushes it to the top of the stack.
* A copy of the sycl::queue is returned to the caller wrapped inside the
* opaque DPPLSyclQueueRef pointer. A runtime_error exception is thrown when
* a new sycl::queue could not be created for the specified device.
* DPPLQueueMgr_GetCurrentQueue(). DPPLPushSyclQueueToStack creates a new
* sycl::queue corresponding to the specified device and pushes it to the top
* of the stack. A copy of the sycl::queue is returned to the caller wrapped
* inside the opaque DPPLSyclQueueRef pointer. A runtime_error exception is
* thrown when a new sycl::queue could not be created for the specified device.
*
* @param DeviceTy The type of Sycl device (sycl_device_type)
* @param DNum Device id for the device (defaults to 0)
Expand All @@ -123,21 +123,21 @@ void DPPLSetAsDefaultQueue (DPPLSyclDeviceType DeviceTy,
* stack of sycl::queue objects.
*/
DPPL_API
__dppl_give DPPLSyclQueueRef DPPLPushSyclQueue (DPPLSyclDeviceType DeviceTy,
size_t DNum);
__dppl_give DPPLSyclQueueRef
DPPLQueueMgr_PushQueue (DPPLSyclDeviceType DeviceTy, size_t DNum);

/*!
* @brief Pops the top of stack element from DPPL's stack of activated
* sycl::queue objects.
*
* DPPLPopSyclQueue only removes the reference from the DPPL stack of
* sycl::queue objects. Any instance of the popped queue that were previously
* acquired by calling DPPLPushSyclQueue() or DPPLGetCurrentQueue() needs to be
* freed separately. In addition, a runtime_error is thrown when the stack
* contains only one sycl::queue, i.e., the default queue.
* acquired by calling DPPLPushSyclQueue() or DPPLQueueMgr_GetCurrentQueue()
* needs to be freed separately. In addition, a runtime_error is thrown when
* the stack contains only one sycl::queue, i.e., the default queue.
*
*/
DPPL_API
void DPPLPopSyclQueue ();
void DPPLQueueMgr_PopQueue ();

DPPL_C_EXTERN_C_END
2 changes: 1 addition & 1 deletion backends/include/dppl_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ DPPL_C_EXTERN_C_BEGIN
* @param str C string to be deleted
*/
DPPL_API
void DPPLDeleteCString (__dppl_take const char* str);
void DPPLCString_Delete (__dppl_take const char* str);

DPPL_C_EXTERN_C_END
8 changes: 4 additions & 4 deletions backends/source/dppl_sycl_context_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ namespace
* @param CtxtRef My Param doc
* @return {return} My Param doc
*/
bool DPPLIsHostContext (__dppl_keep const DPPLSyclContextRef CtxtRef)
bool DPPLContext_IsHost (__dppl_keep const DPPLSyclContextRef CtxRef)
{
return unwrap(CtxtRef)->is_host();
return unwrap(CtxRef)->is_host();
}

/*!
* @brief
*
* @param CtxtRef My Param doc
*/
void DPPLDeleteSyclContext (__dppl_take DPPLSyclContextRef CtxtRef)
void DPPLContext_Delete (__dppl_take DPPLSyclContextRef CtxRef)
{
delete unwrap(CtxtRef);
delete unwrap(CtxRef);
}
20 changes: 10 additions & 10 deletions backends/source/dppl_sycl_device_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,41 +66,41 @@ void dump_device_info (const device & Device)
* vendor, and device profile are printed out. More attributed may be added
* later.
*/
void DPPLDumpDeviceInfo (__dppl_keep const DPPLSyclDeviceRef DRef)
void DPPLDevice_DumpInfo (__dppl_keep const DPPLSyclDeviceRef DRef)
{
auto Device = unwrap(DRef);
dump_device_info(*Device);
}


void DPPLDeleteSyclDevice (__dppl_take DPPLSyclDeviceRef DRef)
void DPPLDevice_Delete (__dppl_take DPPLSyclDeviceRef DRef)
{
delete unwrap(DRef);
}

bool DPPLDeviceIsAccelerator (__dppl_keep const DPPLSyclDeviceRef DRef)
bool DPPLDevice_IsAccelerator (__dppl_keep const DPPLSyclDeviceRef DRef)
{
return unwrap(DRef)->is_accelerator();
}

bool DPPLDeviceIsCPU (__dppl_keep const DPPLSyclDeviceRef DRef)
bool DPPLDevice_IsCPU (__dppl_keep const DPPLSyclDeviceRef DRef)
{
return unwrap(DRef)->is_cpu();
}

bool DPPLDeviceIsGPU (__dppl_keep const DPPLSyclDeviceRef DRef)
bool DPPLDevice_IsGPU (__dppl_keep const DPPLSyclDeviceRef DRef)
{
return unwrap(DRef)->is_gpu();
}


bool DPPLDeviceIsHost (__dppl_keep const DPPLSyclDeviceRef DRef)
bool DPPLDevice_IsHost (__dppl_keep const DPPLSyclDeviceRef DRef)
{
return unwrap(DRef)->is_host();
}

__dppl_give const char*
DPPLGetDeviceName (__dppl_keep const DPPLSyclDeviceRef DRef)
DPPLDevice_GetName (__dppl_keep const DPPLSyclDeviceRef DRef)
{
auto name = unwrap(DRef)->get_info<info::device::name>();
auto cstr_name = new char [name.length()+1];
Expand All @@ -109,7 +109,7 @@ DPPLGetDeviceName (__dppl_keep const DPPLSyclDeviceRef DRef)
}

__dppl_give const char*
DPPLGetDeviceVendorName (__dppl_keep const DPPLSyclDeviceRef DRef)
DPPLDevice_GetVendorName (__dppl_keep const DPPLSyclDeviceRef DRef)
{
auto vendor = unwrap(DRef)->get_info<info::device::name>();
auto cstr_vendor = new char [vendor.length()+1];
Expand All @@ -118,15 +118,15 @@ DPPLGetDeviceVendorName (__dppl_keep const DPPLSyclDeviceRef DRef)
}

__dppl_give const char*
DPPLGetDeviceDriverInfo (__dppl_keep const DPPLSyclDeviceRef DRef)
DPPLDevice_GetDriverInfo (__dppl_keep const DPPLSyclDeviceRef DRef)
{
auto driver = unwrap(DRef)->get_info<info::device::driver_version>();
auto cstr_driver = new char [driver.length()+1];
std::strcpy (cstr_driver, driver.c_str());
return cstr_driver;
}

bool DPPLGetDeviceHostUnifiedMemory (__dppl_keep const DPPLSyclDeviceRef DRef)
bool DPPLDevice_IsHostUnifiedMemory (__dppl_keep const DPPLSyclDeviceRef DRef)
{
return unwrap(DRef)->get_info<info::device::host_unified_memory>();
}
6 changes: 3 additions & 3 deletions backends/source/dppl_sycl_queue_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ namespace
} /* end of anonymous namespace */

__dppl_give DPPLSyclDeviceRef
DPPLGetDeviceFromQueue (__dppl_keep const DPPLSyclQueueRef QRef)
DPPLQueue_GetDevice (__dppl_keep const DPPLSyclQueueRef QRef)
{
auto Q = unwrap(QRef);
auto Device = new device(Q->get_device());
return reinterpret_cast<DPPLSyclDeviceRef>(Device);
}

__dppl_give DPPLSyclContextRef
DPPLGetContextFromQueue (__dppl_keep const DPPLSyclQueueRef QRef)
DPPLQueue_GetContext (__dppl_keep const DPPLSyclQueueRef QRef)
{
auto Q = unwrap(QRef);
auto Context = new context(Q->get_context());
Expand All @@ -57,7 +57,7 @@ DPPLGetContextFromQueue (__dppl_keep const DPPLSyclQueueRef QRef)
/*!
* Delete the passed in pointer after verifying it points to a sycl::queue.
*/
void DPPLDeleteSyclQueue (__dppl_take DPPLSyclQueueRef QRef)
void DPPLQueue_Delete (__dppl_take DPPLSyclQueueRef QRef)
{
delete unwrap(QRef);
}
Loading