7 #ifndef Blink_Library_Blink_h
8 #define Blink_Library_Blink_h
20 typedef BlinkComputeDeviceID ComputeDeviceID;
21 typedef BlinkCodegenFlags CodegenFlags;
22 typedef BlinkDataType DataType;
24 typedef BlinkErrorCode ErrorCode;
25 typedef BlinkErrorRef ErrorRef;
26 typedef BlinkMemoryType MemoryType;
28 typedef BlinkKernelType KernelType;
29 typedef BlinkKernelGranularity KernelGranularity;
30 typedef BlinkImageAccessType ImageAccessType;
31 typedef BlinkImagePatternType ImagePatternType;
32 typedef BlinkImageEdgeType ImageEdgeType;
40 DeviceMemory(MemoryType type,
void* memoryBasePtr,
unsigned long long memoryBaseSize,
unsigned long long offset);
83 std::string
name()
const;
111 void setSource(
const char* source);
128 Rect(
int x1,
int y1,
int x2,
int y2);
154 unsigned int rowStepBytes,
155 unsigned int componentStepBytes);
254 KernelInfo(
const std::string& name, KernelType type,
255 KernelGranularity granularity);
257 std::string getName()
const;
258 KernelType getType()
const;
259 KernelGranularity getGranularity()
const;
272 ImagePatternType patternType, ImageEdgeType edgeType);
274 std::string getName()
const;
275 ImageAccessType getAccessType()
const;
276 ImagePatternType getPatternType()
const;
277 ImageEdgeType getEdgeType()
const;
292 unsigned getNumParameters();
294 std::string getName()
const;
295 DataType getDataType()
const;
296 unsigned getNComponents()
const;
297 unsigned getNElements()
const;
307 unsigned getNumImages()
const;
308 unsigned getNumParameters()
const;
312 std::vector<KernelImageInfo> getImagesInfo()
const;
314 std::vector<KernelParameterInfo> getParametersInfo()
const;
330 void setParamValue(
const std::string& name,
bool value);
331 void setParamValue(
const std::string& name,
float value);
332 void setParamValue(
const std::string& name,
int value);
335 void setParamValue(
const std::string& name,
const char* value,
unsigned int count);
336 void setParamValue(
const std::string& name,
const float* value,
unsigned int count);
337 void setParamValue(
const std::string& name,
const int* value,
unsigned int count);
339 void getParamValue(
const std::string& name,
char* value,
unsigned int count);
340 void getParamValue(
const std::string& name,
float* value,
unsigned int count);
341 void getParamValue(
const std::string& name,
int* value,
unsigned int count);
343 std::vector<Blink::ImageAccessDesc> getInputRanges(
void);
364 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
374 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
383 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
391 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
400 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
418 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
426 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
436 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
444 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
451 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
455 #include "BlinkImpl.h"
BlinkDataType dataType
Data type.
Definition: BlinkTypes.h:63
Reference to a device used for Blink computation.
Definition: Blink.h:65
Parameter information.
Definition: Blink.h:283
Definitions required for building with the Blink API.
Image makeLike(const ComputeDevice &dev)
Return a reference to a new image with the same layout on the specified device.
int nComponents
Number of components.
Definition: BlinkTypes.h:60
Device independent class holding source to a program.
Definition: Blink.h:105
Definition: BlinkTypes.h:84
Kernel Iteration Controller.
Definition: Blink.h:37
Pixel information.
Definition: BlinkTypes.h:58
Definition: BlinkTypes.h:141
Exception thrown when device runs out of memory.
Definition: Blink.h:370
ImageInfo info() const
Fetch info for image.
void clear()
Clear reference to image.
Static image information.
Definition: Blink.h:265
Exception thrown when parameters for image construction are invalid.
Definition: Blink.h:387
Scoped lock for Blink device.
Definition: Blink.h:97
Image()
Image ref not pointing to any data.
Kernel information.
Definition: Blink.h:248
Reference to a Blink image.
Definition: Blink.h:191
Base class for all Kernels.
Definition: Blink.h:301
void copyToBuffer(void *buffer, const BufferDesc &bufferDesc) const
Copy the contents of the image to the provided buffer.
Kernel Iteration Controller.
Definition: Blink.h:137
std::string parseError() const
Error generated if line number is valid.
Image distributeTo(const ComputeDevice &dev)
Return a reference to the image with the same data on the specified device performing a copy if neces...
Namespace for all things in Blink.
Definition: Blink.h:18
Rectangle.
Definition: BlinkTypes.h:50
Exception thrown when images are incompatible such as in copy operation.
Definition: Blink.h:440
std::string name() const
Return the name of the device.
std::string userMessage() const
Get description of error.
void copyFrom(const Image &src)
Copies the data from src on any device into this image. The formats of the images must match...
Definition: BlinkTypes.h:117
General information about a kernel.
Definition: BlinkTypes.h:104
Exception thrown when there is an error on a device.
Definition: Blink.h:422
Kernel for a specific device.
Definition: Blink.h:321
int lineNumber() const
Line number of first error.
Defines some constants for use with the Blink API.
Definition: BlinkTypes.h:90
Image iteration description.
Definition: BlinkTypes.h:76
struct BlinkPixelInfo pixelInfo
Pixel format.
Definition: BlinkTypes.h:72
Kernel(const ProgramSource &programSource, ComputeDevice &dev, const std::vector< Image > &images, CodegenFlags flags=kBlinkCodegenDefault)
Fetch a kernel Fetch a kernel for the program to execute on the specified device with images with the...
Rectangle.
Definition: Blink.h:121
Pixel information.
Definition: Blink.h:161
Exception thrown when kernel fails to run.
Definition: Blink.h:379
Exception thrown when attempt to build kernel fails.
Definition: Blink.h:396
static ComputeDevice DeviceWithID(ComputeDeviceID id)
This function may change before release. Do not use.
The main header file for Blink Library versioning.
bool isEmpty() const
Returns true if there is no underlying data.
Image description.
Definition: BlinkTypes.h:67
void copyFromBuffer(const void *buffer, const BufferDesc &bufferDesc) const
Copy provided buffer to the image.
Buffer layout description.
Definition: Blink.h:148
Image information.
Definition: Blink.h:171
Exception thrown when attempt to parse kernel fails.
Definition: Blink.h:406
static ComputeDevice CurrentCPUDevice()
Fetch the currently selected CPU.
bool available() const
Returns true if this device can be used.
Definition: BlinkTypes.h:131
struct BlinkRect bounds
Bounds of iteration.
Definition: BlinkTypes.h:79
Base exception for Blink API.
Definition: Blink.h:356
static ComputeDevice CurrentGPUDevice()
Fetch the currently selected GPU.
Defines some types used by the Blink API.
Exception throw when parameter is set/get with incorrect parameters.
Definition: Blink.h:432