[fix] Enhancement of AMD scheduler with WorkerGrid
*/
package uk.ac.manchester.tornado.drivers.opencl;
+import uk.ac.manchester.tornado.api.WorkerGrid;
import uk.ac.manchester.tornado.runtime.tasks.meta.TaskMetaData;
public class OCLAMDScheduler extends OCLKernelScheduler {
@@ -40,8 +41,16 @@ public class OCLAMDScheduler extends OCLKernelScheduler {
@Override
public int launch(OCLKernel kernel, TaskMetaData meta, int[] waitEvents, long batchThreads) {
+ if (meta.isWorkerGridAvailable()) {
+ WorkerGrid grid = meta.getWorkerGrid(meta.getId());
+ long[] global = grid.getGlobalWork();
+ long[] offset = grid.getGlobalOffset();
+ long[] local = grid.getLocalWork();
+ return deviceContext.enqueueNDRangeKernel(kernel, grid.dimension(), offset, global, local, waitEvents);
+ } else {
return deviceContext.enqueueNDRangeKernel(kernel, meta.getDims(), meta.getGlobalOffset(), meta.getGlobalWork(), null, waitEvents);
}
+ }
@Override
public void calculateGlobalWork(final TaskMetaData meta, long batchThreads) {
