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);
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"
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:413
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:396
Exception thrown when there is an error on a device.
Definition: Blink.h:440
Base exception for Blink API.
Definition: Blink.h:373
std::string userMessage() const
Get description of error.
Base class for all Kernels.
Definition: Blink.h:316
IKernel(const ProgramSource &programSource)
Introspect a Kernel.
Exception thrown when parameters for image construction are invalid.
Definition: Blink.h:404
Reference to a Blink image.
Definition: Blink.h:204
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:458
Kernel for a specific device.
Definition: Blink.h:337
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:387
Exception throw when parameter is set/get with incorrect parameters.
Definition: Blink.h:450
Exception thrown when attempt to parse kernel fails.
Definition: Blink.h:423
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:157
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:182
ImageInfo(const Rect &bounds, const PixelInfo &pixelInfo)
Constructor for creating a ImageInfo.
Static image information.
Definition: Blink.h:278
Kernel information.
Definition: Blink.h:260
Kernel Iteration Controller.
Definition: Blink.h:145
KernelIterationController(const Rect &bounds)
Constructor for creating a ImageInfo.
Parameter information.
Definition: Blink.h:297
Pixel information.
Definition: Blink.h:171
PixelInfo(int nComponents, DataType dataType)
Constructor for creating a PixelInfo.
Rectangle.
Definition: Blink.h:128
Rect(int x1, int y1, int x2, int y2)
Constructor for creating a Rect.