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);
116 void setSource(
const char* source);
134 Rect(
int x1,
int y1,
int x2,
int y2);
162 unsigned int rowStepBytes,
163 unsigned int componentStepBytes);
265 KernelInfo(
const std::string& name, KernelType type,
266 KernelGranularity granularity);
268 std::string getName()
const;
269 KernelType getType()
const;
270 KernelGranularity getGranularity()
const;
284 ImagePatternType patternType, ImageEdgeType edgeType);
286 std::string getName()
const;
287 ImageAccessType getAccessType()
const;
288 ImagePatternType getPatternType()
const;
289 ImageEdgeType getEdgeType()
const;
305 unsigned getNumParameters();
307 std::string getName()
const;
308 DataType getDataType()
const;
309 unsigned getNComponents()
const;
310 unsigned getNElements()
const;
321 unsigned getNumImages()
const;
322 unsigned getNumParameters()
const;
326 std::vector<KernelImageInfo> getImagesInfo()
const;
328 std::vector<KernelParameterInfo> getParametersInfo()
const;
345 void setParamValue(
const std::string& name,
bool value);
346 void setParamValue(
const std::string& name,
float value);
347 void setParamValue(
const std::string& name,
int value);
350 void setParamValue(
const std::string& name,
const char* value,
unsigned int count);
351 void setParamValue(
const std::string& name,
const float* value,
unsigned int count);
352 void setParamValue(
const std::string& name,
const int* value,
unsigned int count);
354 void getParamValue(
const std::string& name,
char* value,
unsigned int count);
355 void getParamValue(
const std::string& name,
float* value,
unsigned int count);
356 void getParamValue(
const std::string& name,
int* value,
unsigned int count);
358 std::vector<Blink::ImageAccessDesc> getInputRanges(
void);
379 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
389 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
398 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
406 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
415 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
434 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
442 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
452 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
460 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
467 friend void TranslateBlinkError(ErrorCode errorCode, ErrorRef errorRef);
471#include "BlinkImpl.h"
Definitions required for building with the Blink API.
Defines some constants for use with the Blink API.
Defines some types used by the Blink API.
The main header file for Blink Library versioning.
Exception thrown when attempt to build kernel fails.
Definition: Blink.h:412
Scoped lock for Blink device.
Definition: Blink.h:101
Reference to a device used for Blink computation.
Definition: Blink.h:69
bool available() const
Returns true if this device can be used.
static ComputeDevice DeviceWithID(ComputeDeviceID id)
This function may change before release. Do not use.
std::string name() const
Return the name of the device.
static ComputeDevice CurrentCPUDevice()
Fetch the currently selected CPU.
static ComputeDevice CurrentGPUDevice()
Fetch the currently selected GPU.
Exception thrown when kernel fails to run.
Definition: Blink.h:395
Exception thrown when there is an error on a device.
Definition: Blink.h:439
Base exception for Blink API.
Definition: Blink.h:372
std::string userMessage() const
Get description of error.
Base class for all Kernels.
Definition: Blink.h:315
IKernel(const ProgramSource &programSource)
Introspect a Kernel.
Exception thrown when parameters for image construction are invalid.
Definition: Blink.h:403
Reference to a Blink image.
Definition: Blink.h:203
Image()
Image ref not pointing to any data.
Image makeLike(const ComputeDevice &dev)
Return a reference to a new image with the same layout on the specified device.
void copyFrom(const Image &src)
Copies the data from src on any device into this image. The formats of the images must match.
void copyFromBuffer(const void *buffer, const BufferDesc &bufferDesc) const
Copy provided buffer to the image.
bool isEmpty() const
Returns true if there is no underlying data.
void clear()
Clear reference to image.
ImageInfo info() const
Fetch info for image.
Image distributeTo(const ComputeDevice &dev)
Return a reference to the image with the same data on the specified device performing a copy if neces...
void copyToBuffer(void *buffer, const BufferDesc &bufferDesc) const
Copy the contents of the image to the provided buffer.
Image(const Image &src)
Copy reference to source image. Both images will point to the same data.
Exception thrown when images are incompatible such as in copy operation.
Definition: Blink.h:457
Kernel for a specific device.
Definition: Blink.h:336
void setParamValue(const std::string &name, const char *value, unsigned int count)
For setting multiple booleans.
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...
Exception thrown when device runs out of memory.
Definition: Blink.h:386
Exception throw when parameter is set/get with incorrect parameters.
Definition: Blink.h:449
Exception thrown when attempt to parse kernel fails.
Definition: Blink.h:422
int lineNumber() const
Line number of first error.
std::string parseError() const
Error generated if line number is valid.
Device independent class holding source to a program.
Definition: Blink.h:110
Namespace for all things in Blink.
Definition: Blink.h:19
Definition: BlinkTypes.h:89
Definition: BlinkTypes.h:96
Definition: BlinkTypes.h:151
Image description.
Definition: BlinkTypes.h:70
struct BlinkPixelInfo pixelInfo
Pixel format.
Definition: BlinkTypes.h:75
Definition: BlinkTypes.h:125
General information about a kernel.
Definition: BlinkTypes.h:111
Image iteration description.
Definition: BlinkTypes.h:80
struct BlinkRect bounds
Bounds of iteration.
Definition: BlinkTypes.h:83
Definition: BlinkTypes.h:140
Pixel information.
Definition: BlinkTypes.h:60
BlinkDataType dataType
Data type.
Definition: BlinkTypes.h:65
int nComponents
Number of components.
Definition: BlinkTypes.h:62
Rectangle.
Definition: BlinkTypes.h:51
Buffer layout description.
Definition: Blink.h:156
BufferDesc(unsigned int pixelStepBytes, unsigned int rowStepBytes, unsigned int componentStepBytes)
Constructor for creating a BufferDesc.
Kernel Iteration Controller.
Definition: Blink.h:39
Image information.
Definition: Blink.h:181
ImageInfo(const Rect &bounds, const PixelInfo &pixelInfo)
Constructor for creating a ImageInfo.
Static image information.
Definition: Blink.h:277
Kernel information.
Definition: Blink.h:259
Kernel Iteration Controller.
Definition: Blink.h:144
KernelIterationController(const Rect &bounds)
Constructor for creating a ImageInfo.
Parameter information.
Definition: Blink.h:296
Pixel information.
Definition: Blink.h:170
PixelInfo(int nComponents, DataType dataType)
Constructor for creating a PixelInfo.
Rectangle.
Definition: Blink.h:127
Rect(int x1, int y1, int x2, int y2)
Constructor for creating a Rect.