Results 1 to 2 of 2

Thread: Can kernel #1 compute the work size for kernel #2?

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    3

    Can kernel #1 compute the work size for kernel #2?

    The short version: Is it possible to asynchronously enqueue two kernels such that one output of the first kernel is the global work size of the second kernel?

    A longer example: Suppose I have some kernel that does Real Work on a large, sparse dataset. It might be worthwhile to run a preprocess kernel that scanned the dataset for valid/non-empty work items and copied them to a smaller array, and then have my main kernel operate only on the smaller, non-sparse array of known valid data. One of the outputs of the preprocess kernel would naturally be the number of valid data elements, which would then be the global work size of the second kernel. Naively, this means the CPU needs to kick off the preprocessing kernel, wait for it to finish, read the number of valid data elements, and then kick off the Real Work kernel. It would of course be preferable to enqueue both kernels up front (using events to make sure the first kernel finishes before the second starts). Is that possible in OpenCL? It looks like the global work size needs to be specified when the kernel is enqueued; is there any way to tell the CL runtime to defer loading the global work size until just before it's needed?

    Thanks,
    - cort

  2. #2
    Senior Member
    Join Date
    Sep 2002
    Location
    Santa Clara
    Posts
    105

    Re: Can kernel #1 compute the work size for kernel #2?

    In OpenCL 1.0, it is not possible to enqueue a kernel whose global_work_size is specified by another kernel.

Similar Threads

  1. Kernel argument size
    By perlish in forum OpenCL
    Replies: 5
    Last Post: 09-03-2012, 05:55 AM
  2. Replies: 5
    Last Post: 06-04-2011, 08:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •