Revision history   OpenPOWER Library

 B.1.2. User Job Initiation

 The CAIA does not define how job initiation should be performed. Job initiation is application specific. The following example is a very high-level example on how an application might initiate a job on the accelerator and receiving completion status.

 In this example, the work element descriptor provided to the operating system during the allocation and initialization sequence is an effective address (EA) pointer to a job queue located in the application's memory space. Figure B.1, “ Figure B-1. Application Job Queue (User)” illustrates the job and completion queue.

 

Figure B.1.  Figure B-1. Application Job Queue (User)


 After initialization, the head and tail pointers for the job and status queues are set to the start of the corresponding queue, the length of the circular queues are set, and the headers for each queue entry are set to zero. The occupancy of both queues is controlled by the job header. The job queue and status queue contain the same number of entries and are allocated in pairs.

 To initiate a new job, the application first checks the status headers at the tail of the queue to ensure a job control/status block pair is available (that is the valid bit (V) in the job header is zero). It then fills in the job parameters and sets the valid bit (V) in the job control block. The application's tail pointer is then moved to the next control/status block pair, wrapping back to the start of the job queue if necessary.

[Note]Note

To prevent the AFU from wrapping around the queue and starting a job that has already been completed, the application ensures that the tail pointer points to an invalid job control block after initiating a job. This implies there must be two or more control/status block pairs available in the queues before a new job can be initiated.

 After being started, the AFU begins monitoring the job header at the head pointer for work to be performed. When the valid bit (V) in the job header is set, the AFU reads the full control block, starts the acceleration job, and sets the started bit (S) in the corresponding status header. When the acceleration job is complete, the AFU sets the complete bit (C) in the status header, moves the head pointer to the next control bock (wrapping back to the start of the job queue if necessary), and begins monitoring the job header for the "V" bit to be set.

 Jobs are not required to complete in queue order. Applications monitor the completion bits in the status headers for job completion. The application can request a completion notification from the AFU (either an interrupt or a write to a shared cache line to wake a processor thread) to avoid a software polling loop. When a job is complete, the application reads the status information, clears the "V" bit in the corresponding job header, and sets the status header to zero (in that order).


loading table of contents...