7 #ifndef Blink_Library_Blink_h
8 #define Blink_Library_Blink_h
21 typedef BlinkComputeDeviceID ComputeDeviceID;
22 typedef BlinkCodegenFlags CodegenFlags;
23 typedef BlinkDataType DataType;
25 typedef BlinkErrorCode ErrorCode;
26 typedef BlinkErrorRef ErrorRef;
27 typedef BlinkMemoryType MemoryType;
29 typedef BlinkKernelType KernelType;
30 typedef BlinkKernelGranularity KernelGranularity;
31 typedef BlinkImageAccessType ImageAccessType;
32 typedef BlinkImagePatternType ImagePatternType;
33 typedef BlinkImageEdgeType ImageEdgeType;
42 DeviceMemory(MemoryType type,
void* memoryBasePtr,
unsigned long long memoryBaseSize,
unsigned long long offset);
86 std::string
name()
const;
117 void setSource(
const char* source);
135 Rect(
int x1,
int y1,
int x2,
int y2);
163 unsigned int rowStepBytes,
164 unsigned int componentStepBytes);
266 KernelInfo(
const std::string& name, KernelType type,
267 KernelGranularity granularity);
269 std::string getName()
const;
270 KernelType getType()
const;
271 KernelGranularity getGranularity()
const;
285 ImagePatternType patternType, ImageEdgeType edgeType);
287 std::string getName()
const;
288 ImageAccessType getAccessType()
const;
289 ImagePatternType getPatternType()
const;
290 ImageEdgeType getEdgeType()
const;
306 unsigned getNumParameters();
308 std::string getName()
const;
309 DataType getDataType()
const;
310 unsigned getNComponents()
const;
311 unsigned getNElements()
const;
322 unsigned getNumImages()
const;
323 unsigned getNumParameters()
const;
327 std::vector<KernelImageInfo> getImagesInfo()
const;
329 std::vector<KernelParameterInfo> getParametersInfo()
const;
346 void setParamValue(
const std::string& name,
bool value);
347 void setParamValue(
const std::string& name,
float value);
348 void setParamValue(
const std::string& name,
int value);
351 void setParamValue(
const std::string& name,
const char* value,
unsigned int count);
352 void setParamValue(
const std::string& name,
const float* value,
unsigned int count);
353 void setParamValue(
const std::string& name,
const int* value,
unsigned int count);
355 void getParamValue(
const std::string& name,
char* value,
unsigned int count);
356 void getParamValue(
const std::string& name,
float* value,
unsigned int count);
357 void getParamValue(
const std::string& name,
int* value,
unsigned int count);
359 std::vector<Blink::ImageAccessDesc> getInputRanges(
void);
380 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
390 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
399 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
407 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
416 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
435 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
443 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
453 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
461 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
468 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
472 #include "BlinkImpl.h"
BlinkDataType dataType
Data type.
Definition: BlinkTypes.h:65
Reference to a device used for Blink computation.
Definition: Blink.h:68
Parameter information.
Definition: Blink.h:296
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:62
Device independent class holding source to a program.
Definition: Blink.h:109
Definition: BlinkTypes.h:88
Kernel Iteration Controller.
Definition: Blink.h:38
Pixel information.
Definition: BlinkTypes.h:59
Definition: BlinkTypes.h:150
Exception thrown when device runs out of memory.
Definition: Blink.h:386
ImageInfo info() const
Fetch info for image.
void clear()
Clear reference to image.
Static image information.
Definition: Blink.h:277
Exception thrown when parameters for image construction are invalid.
Definition: Blink.h:403
Scoped lock for Blink device.
Definition: Blink.h:100
Image()
Image ref not pointing to any data.
Kernel information.
Definition: Blink.h:259
Reference to a Blink image.
Definition: Blink.h:203
Base class for all Kernels.
Definition: Blink.h:315
void copyToBuffer(void *buffer, const BufferDesc &bufferDesc) const
Copy the contents of the image to the provided buffer.
Kernel Iteration Controller.
Definition: Blink.h:144
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:457
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:124
General information about a kernel.
Definition: BlinkTypes.h:110
Exception thrown when there is an error on a device.
Definition: Blink.h:439
Kernel for a specific device.
Definition: Blink.h:336
int lineNumber() const
Line number of first error.
Defines some constants for use with the Blink API.
Definition: BlinkTypes.h:95
Image iteration description.
Definition: BlinkTypes.h:79
struct BlinkPixelInfo pixelInfo
Pixel format.
Definition: BlinkTypes.h:75
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:127
Pixel information.
Definition: Blink.h:170
Exception thrown when kernel fails to run.
Definition: Blink.h:395
Exception thrown when attempt to build kernel fails.
Definition: Blink.h:412
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:69
void copyFromBuffer(const void *buffer, const BufferDesc &bufferDesc) const
Copy provided buffer to the image.
Buffer layout description.
Definition: Blink.h:156
Image information.
Definition: Blink.h:181
Exception thrown when attempt to parse kernel fails.
Definition: Blink.h:422
static ComputeDevice CurrentCPUDevice()
Fetch the currently selected CPU.
bool available() const
Returns true if this device can be used.
Definition: BlinkTypes.h:139
struct BlinkRect bounds
Bounds of iteration.
Definition: BlinkTypes.h:83
Base exception for Blink API.
Definition: Blink.h:372
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:449