Hi,

On 04/04/2014 11:43 AM, Clément Léger wrote:
> In order to add a more flexible device detection some rework, is needed.
> Currently, the device probing is "simulated" using POCL_DEVICES
> environement variable.

Like Kalle mentioned at IRC, there should still be a way to
force the device setup. We use the POCL_DEVICES all the time in
our (simulated) setups of N heterogeneous devices. But I'm not
sure forcing the ordering of the device list (at least between
device types) is that important.

> In order to achieve more flexibility, here is a proposition.
> Each device driver would have a "probe" operation:
>
> unsigned int (*probe)();

What about the CPU drivers 'basic' and 'pthread', for example? This
is a case of two drivers being able to "drive" the same device (in this case
a CPU). pthread is preferred as it can utilize multicore/multithread,
so some kind of fallback/priority mechanism in the probe could be in
place? We want to use 'basic' when we want to ensure ordering between 
work-groups etc. This is used usually only in testing at this moment,
but is a good fallback driver / starting point when running on
non-pthread systems.

> This operation will be call once in the execution init and will return
> the number of available devices for this driver.
> With this setup, pthread could for instance use a PTRHEAD_DEVICE_COUNT
> env var to specify the number of devices in probe function  whereas a
> driver using PCIe cards could probe them procedurally and return the
> number of detected cards.
> Regarding arguments, each driver could then implement the argument
> parsing by itself and hence remove the non-standard POCL_DEVICES*
> environnement variables.
> For instance pthread could use PTHREAD_DEVICE0_ARGS to get arguments for
> pthread device 0.

OK, these should cover our use case.

> Finally, device init operation would also be called only on
> clGetDeviceIds/clCreateContext when requesting a specific device in
> order to speedup the initialization and use less ressources.
>
> Ideas and comments are welcomed

For backwards compatibility with the testsuite tests and other (out of
tree) scripts it would be ideal in case the current POCL_DEVICES syntax
could be still supported (at least to limit the set of queried device
types, e.g., forcing the 'basic' driver instead of 'pthread' driver).

-- 
Pekka

------------------------------------------------------------------------------
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel

Reply via email to