public interface TornadoDevice
-
Method Summary
Modifier and TypeMethodDescriptionlongallocate(Object object, long batchSize, DeviceBufferState state, Access access) It allocates an object in the pre-defined heap of the target device.longallocateObjects(Object[] objects, long batchSize, DeviceBufferState[] states, Access[] accesses) voidclean()longdeallocate(DeviceBufferState state) voiddumpEvents(long executionPlanId) intenqueueBarrier(long executionPlanId) intenqueueBarrier(long executionPlanId, int[] events) intenqueueMarker(long executionPlanId) intenqueueMarker(long executionPlanId, int[] events) voidensureLoaded(long executionPlanId) ensurePresent(long executionPlanId, Object object, DeviceBufferState objectState, int[] events, long batchSize, long hostOffset) It allocates and copy in the content of the object to the target device.voidflush(long executionPlanId) voidflushEvents(long executionPlanId) default intReturns the number of processors available to the JVM.intlonglong[]longlongbooleanvoidmapDeviceRegion(long executionPlanId, Object destArray, Object srcArray, DeviceBufferState deviceStateSrc, DeviceBufferState deviceStateDest, long offset) resolveEvent(long executionPlanId, int event) It resolves a pending event.voidsetAtomicsMapping(ConcurrentHashMap<Object, Integer> mappingAtomics) Deprecated.streamIn(long executionPlanId, Object object, long batchSize, long hostOffset, DeviceBufferState objectState, int[] events) It always copies in the input data (object) from the host to the target device.intstreamOut(long executionPlanId, Object object, long hostOffset, DeviceBufferState objectState, int[] events) It copies a device buffer from the target device to the host.intstreamOutBlocking(long executionPlanId, Object object, long hostOffset, DeviceBufferState objectState, int[] events) It copies a device buffer from the target device to the host.voidsync(long executionPlanId)
-
Method Details
-
allocate
It allocates an object in the pre-defined heap of the target device. It also ensures that there is enough space for the input object.- Parameters:
object- to be allocatedbatchSize- size of the object to be allocated. If this value is invalid input: '<'= 0, then it allocates the sizeof(object).state- state of the object in the target deviceDeviceBufferState- Returns:
- an event ID
-
allocateObjects
long allocateObjects(Object[] objects, long batchSize, DeviceBufferState[] states, Access[] accesses) -
deallocate
-
ensurePresent
List<Integer> ensurePresent(long executionPlanId, Object object, DeviceBufferState objectState, int[] events, long batchSize, long hostOffset) It allocates and copy in the content of the object to the target device.- Parameters:
object- to be allocatedobjectState- state of the object in the target deviceDeviceBufferStateevents- list of pending events (dependencies)batchSize- size of the object to be allocated. If this value is invalid input: '<'= 0, then it allocates the sizeof(object).hostOffset- offset in bytes for the copy within the host input array (or object)- Returns:
- an event ID
-
streamIn
List<Integer> streamIn(long executionPlanId, Object object, long batchSize, long hostOffset, DeviceBufferState objectState, int[] events) It always copies in the input data (object) from the host to the target device.- Parameters:
object- to be copiedbatchSize- size of the object to be allocated. If this value is invalid input: '<'= 0, then it allocates the sizeof(object).hostOffset- offset in bytes for the copy within the host input array (or object)objectState- state of the object in the target deviceDeviceBufferStateevents- list of previous events- Returns:
- and event ID
-
streamOut
int streamOut(long executionPlanId, Object object, long hostOffset, DeviceBufferState objectState, int[] events) It copies a device buffer from the target device to the host. Copies are non-blocking- Parameters:
object- to be copied.hostOffset- offset in bytes for the copy within the host input array (or object)objectState- state of the object in the target deviceDeviceBufferStateevents- of pending events- Returns:
- and event ID
-
streamOutBlocking
int streamOutBlocking(long executionPlanId, Object object, long hostOffset, DeviceBufferState objectState, int[] events) It copies a device buffer from the target device to the host. Copies are blocking between the device and the host.- Parameters:
object- to be copied.hostOffset- offset in bytes for the copy within the host input array (or object)objectState- state of the object in the target deviceDeviceBufferStateevents- of pending events- Returns:
- and event ID
-
resolveEvent
It resolves a pending event.- Parameters:
event- ID- Returns:
- an object of type
Event
-
ensureLoaded
void ensureLoaded(long executionPlanId) -
flushEvents
void flushEvents(long executionPlanId) -
enqueueBarrier
int enqueueBarrier(long executionPlanId) -
enqueueBarrier
int enqueueBarrier(long executionPlanId, int[] events) -
enqueueMarker
int enqueueMarker(long executionPlanId) -
enqueueMarker
int enqueueMarker(long executionPlanId, int[] events) -
sync
void sync(long executionPlanId) -
flush
void flush(long executionPlanId) -
clean
void clean() -
dumpEvents
void dumpEvents(long executionPlanId) -
getDeviceName
String getDeviceName() -
getDescription
String getDescription() -
getPlatformName
String getPlatformName() -
getDeviceContext
TornadoDeviceContext getDeviceContext() -
getPhysicalDevice
TornadoTargetDevice getPhysicalDevice() -
getMemoryProvider
TornadoMemoryProvider getMemoryProvider() -
getDeviceType
TornadoDeviceType getDeviceType() -
getMaxAllocMemory
long getMaxAllocMemory() -
getMaxGlobalMemory
long getMaxGlobalMemory() -
getDeviceLocalMemorySize
long getDeviceLocalMemorySize() -
getDeviceMaxWorkgroupDimensions
long[] getDeviceMaxWorkgroupDimensions() -
getDeviceOpenCLCVersion
String getDeviceOpenCLCVersion() -
getDeviceInfo
Object getDeviceInfo() -
getBackendIndex
int getBackendIndex() -
getAvailableProcessors
default int getAvailableProcessors()Returns the number of processors available to the JVM. We need to overwrite this function only for Virtual Devices, where we read the value from the descriptor file. -
getAtomic
Object getAtomic() -
setAtomicsMapping
Deprecated. -
getTornadoVMBackend
TornadoVMBackendType getTornadoVMBackend() -
isSPIRVSupported
boolean isSPIRVSupported() -
mapDeviceRegion
void mapDeviceRegion(long executionPlanId, Object destArray, Object srcArray, DeviceBufferState deviceStateSrc, DeviceBufferState deviceStateDest, long offset)
-