C API

Typedefs

typedef struct _brisbane_task *iris_task
typedef struct _brisbane_mem *iris_mem
typedef struct _brisbane_kernel *iris_kernel
typedef struct _brisbane_graph *iris_graph
typedef int (*iris_host_task)(void *params, const int *device)
typedef int (*command_handler)(void *params, void *device)
typedef int (*hook_task)(void *task)
typedef int (*hook_command)(void *command)
typedef int (*iris_selector_kernel)(iris_task task, void *params, char *kernel_name)

Functions

int iris_init(int *argc, char ***argv, int sync)

Initializes the IRIS execution environment.

Parameters
  • argc – pointer to the number of arguments

  • argv – argument array

  • sync – 0: non-blocking, 1: blocking

Returns

All IRIS functions return an error value. IRIS_SUCCESS, IRIS_ERR

int iris_finalize()

Terminates the IRIS execution environment.

int iris_synchronize()

Waits for all the submitted tasks to complete.

int iris_env_set(const char *key, const char *value)

Sets an IRIS environment variable.

Parameters
  • key – key string

  • value – value to be stored into key

int iris_env_get(const char *key, char **value, size_t *vallen)

Gets an IRIS environment variable.

Parameters
  • key – key string

  • value – pointer to the value to be retrieved

  • vallen – size in bytes of value

int iris_platform_count(int *nplatforms)

Returns the number of platforms.

Parameters

nplatforms – pointer to the number of platform

int iris_platform_info(int platform, int param, void *value, size_t *size)

Returns the platform information.

Parameters
  • platform – platform number

  • param – information type

  • value – information value

  • size – size in bytes of value

int iris_device_count(int *ndevs)

Returns the number of devices.

Parameters

ndevs – pointer to the number of devices

int iris_device_info(int device, int param, void *value, size_t *size)

Returns the device information.

Parameters
  • device – device number

  • param – information type

  • value – information value

  • size – size in bytes of value

int iris_device_set_default(int device)
int iris_device_get_default(int *device)
int iris_device_synchronize(int ndevs, int *devices)

Waits for all the submitted tasks in a device to complete.

Parameters
  • ndevs – number of devices

  • devices – device array

int iris_register_policy(const char *lib, const char *name, void *params)

Registers a new device selector

Parameters
  • lib – shared library path

  • name – selector name

  • params – parameter to the selector init function

int iris_register_command(int tag, int device, command_handler handler)
int iris_register_hooks_task(hook_task pre, hook_task post)
int iris_register_hooks_command(hook_command pre, hook_command post)
int iris_kernel_create(const char *name, iris_kernel *kernel)
int iris_task_create(iris_task *task)

Creates a new task.

Parameters

task – pointer of the new task

int iris_task_depend(iris_task task, int ntasks, iris_task *tasks)

Adds a dependency to a task.

Parameters
  • task – source task

  • ntasks – number of tasks

  • tasks – target tasks array

int iris_task_h2d(iris_task task, iris_mem mem, size_t off, size_t size, void *host)

Adds a H2D command to the target task.

Parameters
  • task – target task

  • mem – target memory object

  • off – offset in bytes

  • size – size in bytes

  • host – source host address

int iris_task_d2h(iris_task task, iris_mem mem, size_t off, size_t size, void *host)

Adds a D2H command to the target task.

Parameters
  • task – target task

  • mem – source memory object

  • off – offset in bytes

  • size – size in bytes

  • host – target host address

int iris_task_h2d_full(iris_task task, iris_mem mem, void *host)

Adds a H2D command with the size of the target memory to the target task.

Parameters
  • task – target task

  • mem – target memory object

  • host – source host address

int iris_task_d2h_full(iris_task task, iris_mem mem, void *host)

Adds a D2H command with the size of the source memory to the target task.

Parameters
  • task – target task

  • mem – source memory object

  • host – target host address

int iris_task_kernel(iris_task task, const char *kernel, int dim, size_t *off, size_t *gws, size_t *lws, int nparams, void **params, int *params_info)

Launch a kernel

Parameters
  • task – target task

  • kernel – kernel name

  • dim – dimension

  • off – global workitem space offsets

  • gws – global workitem space

  • lws – local workitem space

  • nparams – number of kernel parameters

  • params – kernel parameters

  • params_info – kernel parameters information

int iris_task_kernel_v2(iris_task task, const char *kernel, int dim, size_t *off, size_t *gws, size_t *lws, int nparams, void **params, size_t *params_off, int *params_info)
int iris_task_kernel_v3(iris_task task, const char *kernel, int dim, size_t *off, size_t *gws, size_t *lws, int nparams, void **params, size_t *params_off, int *params_info, size_t *memranges)
int iris_task_custom(iris_task task, int tag, void *params, size_t params_size)
int iris_task_submit(iris_task task, int device, const char *opt, int sync)

Submits a task.

Parameters
  • task – target task

  • device – device_selector

  • opt – option string

  • sync – 0: non-blocking, 1: blocking

int iris_task_wait(iris_task task)

Waits for the task to complete.

Parameters

task – target task

int iris_task_wait_all(int ntasks, iris_task *tasks)

Waits for all the tasks to complete.

Parameters
  • ntasks – number of tasks

  • tasks – target tasks array

int iris_task_kernel_cmd_only(iris_task task)
int iris_task_release(iris_task task)

Releases a target.

Parameters

task – target task

int iris_task_info(iris_task task, int param, void *value, size_t *size)
int iris_mem_create(size_t size, iris_mem *mem)
int iris_mem_release(iris_mem mem)
int iris_timer_now(double *time)

Returns current time in seconds.

Parameters

time – pointer of time

C++ API

Fortran API

Python API