Hi everyone,
My requirement is to add a support for new hardware (a co-processor similar
to spu) into pocl implementation. Hence I want to generate a new libpocl.so
file.
I made following changes in pocl tree:
1. To detect the platform info I made the following changes in
clGetPlatformsInfo.c file inside lib/CL directory:
switch (param_name)
{
case CL_PLATFORM_PROFILE:
// TODO: figure this out depending on the native execution host.
// assume FULL_PROFILE for now.
POCL_RETURN_PLATFORM_INFO_STR("FULL_PROFILE");
case CL_PLATFORM_VERSION:
POCL_RETURN_PLATFORM_INFO_STR("OpenCL 1.2 pocl " PACKAGE_VERSION);
case CL_PLATFORM_NAME:
POCL_RETURN_PLATFORM_INFO_STR("*RCS*");
case CL_PLATFORM_VENDOR:
POCL_RETURN_PLATFORM_INFO_STR("*RCS*");
case CL_PLATFORM_EXTENSIONS:
// TODO: do we want to list all suppoted extensions *here*, or in
some header?.
// TODO: yes, it is better here: available through ICD Loader and
headers can be the ones from Khronos
#ifdef BUILD_ICD
POCL_RETURN_PLATFORM_INFO_STR("cl_khr_icd");
#else
POCL_RETURN_PLATFORM_INFO_STR("");
#endif
case CL_PLATFORM_ICD_SUFFIX_KHR:
POCL_RETURN_PLATFORM_INFO_STR("POCL");
default:
return CL_INVALID_VALUE;
}
2. To check whether driver library is present in our system, I made the
following changes in configure.ac file:
####################################################################
# Determine which device drivers to build.
----
----
----
*PKG_CHECK_MODULES([LIBRCSL], [librcsl],*
* [*
* AC_MSG_NOTICE([librcsl found.])*
* LIBRCSL_AVAILABLE=yes*
* OCL_DRIVERS="$OCL_DRIVERS rcs"*
* OCL_TARGETS="$OCL_TARGETS rcs"*
* AC_DEFINE([BUILD_RCS], [], [Defined when RCSL tools are found])*
* ],*
* [*
* AC_MSG_NOTICE([librcsl not found (by pkg-config). rcs driver not
built.])*
* LIBRCSL_AVAILABLE=no*
* ])*
*AM_CONDITIONAL([BUILD_RCS],[echo $OCL_DRIVERS | grep rcs])*
-----
-----
3. Then I added the following conditions in devices.c file inside
lib/CL/devices directory.
*#if defined(BUILD_RCS)*
* #include "rcs/rcs.h"*
* #endif*
#if defined TCE_AVAILABLE && defined BUILD_SPU
#define POCL_NUM_DEVICE_TYPES 4
#elif defined TCE_AVAILABLE || defined BUILD_SPU
#define POCL_NUM_DEVICE_TYPES 3
*#elif defined BUILD_RCS*
* #define POCL_NUM_DEVICE_TYPES 5*
* #else*
#define POCL_NUM_DEVICE_TYPES 2
#endif
/* All device drivers available to the pocl. */
static struct _cl_device_id pocl_device_types[POCL_NUM_DEVICE_TYPES] = {
POCL_DEVICES_PTHREAD,
POCL_DEVICES_BASIC,
#if defined(BUILD_SPU)
POCL_DEVICES_CELLSPU,
#endif
#if defined(TCE_AVAILABLE)
POCL_DEVICES_TTASIM,
#endif
*#if defined(BUILD_RCS)*
* POCL_DEVICES_RCS,*
* #endif*
};
4. then i created a new directory named as 'rcs' inside lib/CL/devices/.
5. then i wrote three files named as rcs.c, rcs.h and Makefile.am inside
'rcs' directory. The content of rcs.c file is similar to cellspu.c which
initializes the device info.
6. The content of Makefile.am inside lib/CL/devices/rcs directory is as
follows:
noinst_LTLIBRARIES = libpocl-devices-rcs.la
libpocl_devices_rcs_la_SOURCES = rcs.h rcs.c
libpocl_devices_rcs_la_CPPFLAGS = -I$(top_srcdir)/fix-include
-I$(top_srcdir)/include -I$(top_srcdir)/lib/CL/devices
-I$(top_srcdir)/lib/CL $(OCL_ICD_CFLAGS)
libpocl_devices_rcs_la_LDFLAGS = -lltdl @PTHREAD_CFLAGS@ --version-info
${LIB_VERSION}
7. After that I appended the following lines in Makefile.am inside
lib/CL/devices directory:
if BUILD_RCS
SUBDIRS += rcs
libpocl_devices_la_LIBADD += rcs/libpocl-devices-rcs.la
endif
8. after that I added the following lines in Makefile.am inside lib/Cl
directory:
if BUILD_RCS
libpocl_la_LIBADD += -lrcsl
endif
9. Finally I added the path of makefile inside configure.ac file as below:
AC_CONFIG_FILES([
------
------
lib/CL/devices/rcs/Makefile
-----
----
])
Now i have few doubts about how to build libpocl.so:
1. The modification in did in configure.ac file to check whether the needed
driver library is present or not. Is that modification is correct?
2. How to generate new configure script? What sequence of commands I have
to through to generate a new configure script?
3. Would above changes be sufficient to add a new driver?
4. What else I have to do to generate a new libpocl.so?
5. Shall I use pocl master code avialable from github or pocl-0.8.tar.gz
from http://pocl.sourceforge.net/download.html site?
Thanks and Regards,
Gopal
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel