View Javadoc
1   package net.bmahe.genetics4j.gpu.spec.fitness.multistage;
2   
3   import java.util.Map;
4   
5   import org.immutables.value.Value;
6   
7   import net.bmahe.genetics4j.gpu.spec.fitness.cldata.DataLoader;
8   import net.bmahe.genetics4j.gpu.spec.fitness.cldata.LocalMemoryAllocator;
9   import net.bmahe.genetics4j.gpu.spec.fitness.cldata.ResultAllocator;
10  import net.bmahe.genetics4j.gpu.spec.fitness.kernelcontext.KernelExecutionContextComputer;
11  
12  /**
13   * Fully describes how to execute a specific stage with OpenCL
14   *
15   */
16  @Value.Immutable
17  public interface StageDescriptor {
18  
19  	/**
20  	 * Kernel name
21  	 * 
22  	 * @return
23  	 */
24  	String kernelName();
25  
26  	/**
27  	 * Computer for the kernel execution context (ex: globak work size)
28  	 * 
29  	 * @return
30  	 */
31  	KernelExecutionContextComputer kernelExecutionContextComputer();
32  
33  	/**
34  	 * Association of kernel argument index and a data loader
35  	 * 
36  	 * @return
37  	 */
38  	Map<Integer, DataLoader> dataLoaders();
39  
40  	/**
41  	 * Association of kernel argument index and a local memory allocator
42  	 * 
43  	 * @return
44  	 */
45  	Map<Integer, LocalMemoryAllocator> localMemoryAllocators();
46  
47  	/**
48  	 * Association of kernel argument index and a result allocator
49  	 * 
50  	 * @return
51  	 */
52  	Map<Integer, ResultAllocator> resultAllocators();
53  
54  	/**
55  	 * Association of the kernel argument used for a result of the previous stage to the kernel argument for this
56  	 * execution
57  	 * 
58  	 * @return
59  	 */
60  	Map<Integer, Integer> reusePreviousResultAsArguments();
61  
62  	/**
63  	 * Association of the size of the data from the result of the previous stage to the kernel argument for this
64  	 * execution
65  	 * 
66  	 * @return
67  	 */
68  	Map<Integer, Integer> reusePreviousResultSizeAsArguments();
69  
70  	/**
71  	 * Association of static data to a kernel argument index
72  	 */
73  	Map<String, Integer> mapStaticDataAsArgument();
74  
75  	static class Builder extends ImmutableStageDescriptor.Builder {
76  	}
77  
78  	static Builder builder() {
79  		return new Builder();
80  	}
81  }