Forráskód Böngészése

Add dummy XXX_GET_DEV_HANDLE and XXX_GET_OFFSET macros for the interfaces.

Users can use them in OpenCL code, and they will not have to edit it once we
implement filters for complex interfaces.

Not doing this for the multiformat interface: there will never be generic
filters for this interface, since we do not know the layout of the data
manipulated by this interface.
Cyril Roelandt 12 éve
szülő
commit
767521cd73
2 módosított fájl, 97 hozzáadás és 0 törlés
  1. 73 0
      doc/chapters/basic-api.texi
  2. 24 0
      include/starpu_data_interfaces.h

+ 73 - 0
doc/chapters/basic-api.texi

@@ -796,6 +796,16 @@ Return a pointer to the variable designated by @var{interface}.
 Return the size of the variable designated by @var{interface}.
 @end defmac
 
+@defmac STARPU_VARIABLE_GET_DEV_HANDLE ({void *}@var{interface})
+Return a device handle for the variable designated by @var{interface}, to be
+used on OpenCL. The offset documented below has to be used in addition to this.
+@end defmac
+
+@defmac STARPU_VARIABLE_GET_OFFSET ({void *}@var{interface})
+Return the offset in the variable designated by @var{interface}, to be used
+with the device handle.
+@end defmac
+
 @node Accessing Vector Data Interfaces
 @subsubsection Vector Data Interfaces
 
@@ -1018,14 +1028,36 @@ Return the number of non-zero values in the matrix designated by @var{interface}
 Return a pointer to the non-zero values of the matrix designated by @var{interface}.
 @end defmac
 
+@defmac STARPU_BCSR_GET_NZVAL_DEV_HANDLE ({void *}@var{interface})
+Return a device handle for the array of non-zero values in the matrix designated
+by @var{interface}. The offset documented below has to be used in addition to 
+this.
+@end defmac
+
 @defmac STARPU_BCSR_GET_COLIND ({void *}@var{interface})
 Return a pointer to the column index of the matrix designated by @var{interface}.
 @end defmac
 
+@defmac STARPU_BCSR_GET_COLIND_DEV_HANDLE ({void *}@var{interface})
+Return a device handle for the column index of the matrix designated by
+@var{interface}. The offset documented below has to be used in addition to
+this.
+@end defmac
+
 @defmac STARPU_BCSR_GET_ROWPTR ({void *}@var{interface})
 Return a pointer to the row pointer array of the matrix designated by @var{interface}.
 @end defmac
 
+@defmac STARPU_CSR_GET_ROWPTR_DEV_HANDLE ({void *}@var{interface})
+Return a device handle for the row pointer array of the matrix designated by
+@var{interface}. The offset documented below has to be used in addition to
+this.
+@end defmac
+
+@defmac STARPU_BCSR_GET_OFFSET ({void *}@var{interface})
+Return the offset in the arrays (coling, rowptr, nzval) of the matrix
+designated by @var{interface}, to be used with the device handles.
+@end defmac
 
 @node Accessing CSR Data Interfaces
 @subsubsection CSR Data Interfaces
@@ -1071,14 +1103,37 @@ Return the size of the row pointer array of the matrix designated by @var{interf
 Return a pointer to the non-zero values of the matrix designated by @var{interface}.
 @end defmac
 
+@defmac STARPU_CSR_GET_NZVAL_DEV_HANDLE ({void *}@var{interface})
+Return a device handle for the array of non-zero values in the matrix designated
+by @var{interface}. The offset documented below has to be used in addition to 
+this.
+@end defmac
+
 @defmac STARPU_CSR_GET_COLIND ({void *}@var{interface})
 Return a pointer to the column index of the matrix designated by @var{interface}.
 @end defmac
 
+@defmac STARPU_CSR_GET_COLIND_DEV_HANDLE ({void *}@var{interface})
+Return a device handle for the column index of the matrix designated by
+@var{interface}. The offset documented below has to be used in addition to
+this.
+@end defmac
+
 @defmac STARPU_CSR_GET_ROWPTR ({void *}@var{interface})
 Return a pointer to the row pointer array of the matrix designated by @var{interface}.
 @end defmac
 
+@defmac STARPU_CSR_GET_ROWPTR_DEV_HANDLE ({void *}@var{interface})
+Return a device handle for the row pointer array of the matrix designated by
+@var{interface}. The offset documented below has to be used in addition to
+this.
+@end defmac
+
+@defmac STARPU_CSR_GET_OFFSET ({void *}@var{interface})
+Return the offset in the arrays (colind, rowptr, nzval) of the matrix
+designated by @var{interface}, to be used with the device handles.
+@end defmac
+
 @defmac STARPU_CSR_GET_FIRSTENTRY ({void *}@var{interface})
 Return the index at which all arrays (the column indexes, the row pointers...)
 of the @var{interface} start.
@@ -1095,13 +1150,31 @@ Return the size of the elements registered into the matrix designated by @var{in
 Return a pointer to the column array of the matrix designated by
 @var{interface}.
 @end defmac
+@defmac STARPU_COO_GET_COLUMNS_DEV_HANDLE({void *}@var{interface})
+Return a device handle for the column array of the matrix designated by
+@var{interface}, to be used on OpenCL. The offset documented below has to be
+used in addition to this.
+@end defmac
 @defmac STARPU_COO_GET_ROWS (interface)
 Return a pointer to the rows array of the matrix designated by @var{interface}.
 @end defmac
+@defmac STARPU_COO_GET_ROWS_DEV_HANDLE({void *}@var{interface})
+Return a device handle for the row array of the matrix designated by
+@var{interface}, to be used on OpenCL. The offset documented below has to be
+used in addition to this.
+@end defmac
 @defmac STARPU_COO_GET_VALUES (interface)
 Return a pointer to the values array of the matrix designated by
 @var{interface}.
 @end defmac
+@defmac STARPU_COO_GET_VALUES_DEV_HANDLE({void *}@var{interface})
+Return a device handle for the value array of the matrix designated by
+@var{interface}, to be used on OpenCL. The offset documented below has to be
+used in addition to this.
+@end defmac
+@defmac STARPU_COO_GET_OFFSET({void *}@var{itnerface})
+Return the offset in the arrays of the COO matrix designated by @var{interface}.
+@end defmac
 @defmac STARPU_COO_GET_NX (interface)
 Return the number of elements on the x-axis of the matrix designated by
 @var{interface}.

+ 24 - 0
include/starpu_data_interfaces.h

@@ -217,10 +217,17 @@ starpu_coo_data_register(starpu_data_handle_t *handleptr, uint32_t home_node,
 
 #define STARPU_COO_GET_COLUMNS(interface) \
 	(((struct starpu_coo_interface *)(interface))->columns)
+#define STARPU_COO_GET_COLUMNS_DEV_HANDLE(interface) \
+	(((struct starpu_coo_interface *)(interface))->columns)
 #define STARPU_COO_GET_ROWS(interface) \
 	(((struct starpu_coo_interface *)(interface))->rows)
+#define STARPU_COO_GET_ROWS_DEV_HANDLE(interface) \
+	(((struct starpu_coo_interface *)(interface))->rows)
 #define STARPU_COO_GET_VALUES(interface) \
 	(((struct starpu_coo_interface *)(interface))->values)
+#define STARPU_COO_GET_VALUES_DEV_HANDLE(interface) \
+	(((struct starpu_coo_interface *)(interface))->values)
+#define STARPU_COO_GET_OFFSET 0
 #define STARPU_COO_GET_NX(interface) \
 	(((struct starpu_coo_interface *)(interface))->nx)
 #define STARPU_COO_GET_NY(interface) \
@@ -302,6 +309,9 @@ uintptr_t starpu_variable_get_local_ptr(starpu_data_handle_t handle);
 /* helper methods */
 #define STARPU_VARIABLE_GET_PTR(interface)	(((struct starpu_variable_interface *)(interface))->ptr)
 #define STARPU_VARIABLE_GET_ELEMSIZE(interface)	(((struct starpu_variable_interface *)(interface))->elemsize)
+#define STARPU_VARIABLE_GET_DEV_HANDLE(interface) \
+	(((struct starpu_variable_interface *)(interface))->ptr)
+#define STARPU_VARIABLE_GET_OFFSET 0
 
 /* void interface. There is no data really associated to that interface, but it
  * may be used as a synchronization mechanism. It also permits to express an
@@ -338,8 +348,15 @@ size_t starpu_csr_get_elemsize(starpu_data_handle_t handle);
 #define STARPU_CSR_GET_NNZ(interface)	(((struct starpu_csr_interface *)(interface))->nnz)
 #define STARPU_CSR_GET_NROW(interface)	(((struct starpu_csr_interface *)(interface))->nrow)
 #define STARPU_CSR_GET_NZVAL(interface)	(((struct starpu_csr_interface *)(interface))->nzval)
+#define STARPU_CSR_GET_NZVAL_DEV_HANDLE \
+	(((struct starpu_csr_interface *)(interface))->nnz)
 #define STARPU_CSR_GET_COLIND(interface)	(((struct starpu_csr_interface *)(interface))->colind)
+#define STARPU_CSR_GET_COLIND_DEV_HANDLE(interface) \
+	(((struct starpu_csr_interface *)(interface))->colind)
 #define STARPU_CSR_GET_ROWPTR(interface)	(((struct starpu_csr_interface *)(interface))->rowptr)
+#define STARPU_CSR_GET_ROWPTR_DEV_HANDLE \
+	(((struct starpu_csr_interface *)(interface))->rowptr)
+#define STARPU_CSR_GET_OFFSET 0
 #define STARPU_CSR_GET_FIRSTENTRY(interface)	(((struct starpu_csr_interface *)(interface))->firstentry)
 #define STARPU_CSR_GET_ELEMSIZE(interface)	(((struct starpu_csr_interface *)(interface))->elemsize)
 
@@ -370,8 +387,15 @@ void starpu_bcsr_data_register(starpu_data_handle_t *handle, uint32_t home_node,
 
 #define STARPU_BCSR_GET_NNZ(interface)        (((struct starpu_bcsr_interface *)(interface))->nnz)
 #define STARPU_BCSR_GET_NZVAL(interface)      (((struct starpu_bcsr_interface *)(interface))->nzval)
+#define STARPU_BCSR_GET_NZVAL_DEV_HANDLE(interface) \
+	(((struct starpu_bcsr_interface *)(interface))->nnz)
 #define STARPU_BCSR_GET_COLIND(interface)     (((struct starpu_bcsr_interface *)(interface))->colind)
+#define STARPU_BCSR_GET_COLIND_DEV_HANDLE(interface) \
+	(((struct starpu_bcsr_interface *)(interface))->colind)
 #define STARPU_BCSR_GET_ROWPTR(interface)     (((struct starpu_bcsr_interface *)(interface))->rowptr)
+#define STARPU_BCSR_GET_ROWPTR_DEV_HANDLE(interface) \
+	(((struct starpu_bcsr_interface *)(interface))->rowptr)
+#define STARPU_BCSR_GET_OFFSET 0
 uint32_t starpu_bcsr_get_nnz(starpu_data_handle_t handle);
 uint32_t starpu_bcsr_get_nrow(starpu_data_handle_t handle);
 uint32_t starpu_bcsr_get_firstentry(starpu_data_handle_t handle);