Skip to content
Snippets Groups Projects
Commit ca1b46a3 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Scheduling: Complete EDF rewrite based on the ScheduleTaskGraphs

parent 6b427029
No related branches found
No related tags found
No related merge requests found
Showing
with 160 additions and 458 deletions
ResourceSchedule.java 95e59f034907941cad3a59b1468b319b099865b6 YELLOW
SMTStrictTTDecoder.java 4a1af427c4ad50937a16ad42225a8719d4f3f2da RED
StrictTTDecoder.java 2c589c84d1f2aa9a92bf903d1bbbbd8272f57aa2 RED
StrictTTDecoder.java e5586cf399d371e019a46475540df0b0c97b9ce7 RED
StrictTTSchedule.java 78f959f50ded117bab37316f15582b736e9acafb YELLOW
TTScheduleExploration.java 0fdd7edc70fbc56fc17e6b882e9ea983f489af45 RED
TimeSlot.java e66c3450ece05f201a318623e6a028e1a94dacbb RED
......@@ -18,8 +18,6 @@ package org.fortiss.af3.exploration.alg.feature.scheduling;
import static org.eclipse.core.runtime.Assert.isTrue;
import static org.fortiss.af3.exploration.alg.util.ExplorationAlgUtils.DSE_VALIDATE_SCHEDULE;
import java.math.BigDecimal;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.d3seext.decode.Decodes;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IExecutionUnitAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
......@@ -47,8 +45,6 @@ import com.google.inject.Provides;
*/
public class StrictTTDecoder<T extends IExecutionUnitAdapter, E extends TaskMappingEntry<ITaskAdapter, T>, M extends IMappingEncoding<ITaskAdapter, T, E, ?>>
extends DecoderModule<StrictTTSchedule<T, E, M>> {
/** Underlying EDF task scheduler */
private EDFSchedulerBase<T, E, M> simpleEDFScheduler;
/** Underlying bus scheduler */
private TDMABusScheduler simpleBusScheduler;
......@@ -60,8 +56,6 @@ public class StrictTTDecoder<T extends IExecutionUnitAdapter, E extends TaskMapp
@SuppressWarnings("unchecked")
@Inject
public StrictTTDecoder() {
// FIXME: HACK to create the scheduler.
simpleEDFScheduler = (EDFSchedulerBase<T, E, M>)new EDFScheduler();
simpleBusScheduler = new TDMABusScheduler();
}
......@@ -76,9 +70,11 @@ public class StrictTTDecoder<T extends IExecutionUnitAdapter, E extends TaskMapp
SharedMemAccessLatencyEncoding shMemEnc) {
// TODO: Externalize the validation such that the encoding is not required to be passed to
// the constructor (is there for validation purposes)
EDFSchedulerBase<T, E, M> simpleEDFScheduler =
(EDFSchedulerBase<T, E, M>)new EDFScheduler();
StrictTTSchedule<T, E, M> schedule =
new StrictTTSchedule<T, E, M>((M)itmEnc, BigDecimal.ZERO, (long)0);
simpleEDFScheduler.schedule(acycItgEnc, (M)itmEnc, shMemEnc, schedule);
simpleEDFScheduler.schedule(stgEnc, (M)itmEnc, shMemEnc);
if(DSE_VALIDATE_SCHEDULE) {
isTrue(schedule.validateSchedule(true));
}
......
IScheduleElement.java ac35b6d43b25e0f017e47bcefce020803bf708e1 YELLOW
IScheduleTask.java 95f0a12250a7f7d79e7df33cde8110f970433439 YELLOW
IScheduleElement.java aaa8232ef6a1df29ae48d1a2e37e34734643cca4 YELLOW
IScheduleTask.java a5e8333b2c4409e84fb910436bd94b59ad99efa8 YELLOW
ScheduleTaskGraph.java bdf793df8153fbc2759f2bf9b003313182494473 RED
ScheduleTaskGraphDecoder.java fa4b8a17e414dab07c3edc60736d5e9426028945 YELLOW
ScheduleTaskGraphEncoding.java 2775088ff9f76fc5bad8129d3c8692b32fa8eb05 YELLOW
ScheduledTask.java 067e36efbcd439b8c30d016f3c0eb98b1fe9bb15 YELLOW
ScheduleTaskGraphEncoding.java c37643768ab5a9fadaf0d6fcc5b28c1f6ac74e32 YELLOW
ScheduledTask.java 9d7761bb8f2ef65a72b0fe5b55f778111705cc27 RED
......@@ -31,8 +31,18 @@ public interface IScheduleElement {
Double getDeadline();
/**
* Returns the temporal offset at which the {@link ITaskAdapter} may be scheduled. Determined by
* period constraints.
* Returns time an {@link IScheduleElement} is ready to be scheduled. For instance, in the
* multi-period case, the ready time of a schedule task is the period-derived deadline of its
* predecessor instance.
*/
Double getReadyTime();
/**
* Returns the temporal offset at which the {@link ITaskAdapter} may be scheduled. It is an
* additional positive value on top of period of a task instance.
*/
Double getOffset();
/** Returns the instance number of a repeatedly executed task in the multi-rate case. */
Integer getInstanceCount();
}
......@@ -23,5 +23,8 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
* @author diewald
*/
public interface IScheduleTask extends ITaskAdapter, IScheduleElement {
// Composition interface.
/** Returns the wrapped object of a {@link IScheduleTask} (composition over inheritance). */
// TODO(AD): This could be extracted to a separate object composition interface.
ITaskAdapter getWrappedObject();
}
......@@ -15,6 +15,9 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.feature.scheduling.problem.graph;
import static java.util.Collections.unmodifiableCollection;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
......@@ -47,6 +50,11 @@ public class ScheduleTaskGraphEncoding extends PhenotypeBase {
taskScheduleGraphMap.putAll(encoding.taskScheduleGraphMap);
}
/** Returns all {@link ScheduleTaskGraph}s of this encoding. */
public Collection<ScheduleTaskGraph> getGraphs() {
return unmodifiableCollection(taskScheduleGraphMap.values());
}
/** Returns the ScheduleTaskGraph hosting the given {@link IScheduleTask}. */
public ScheduleTaskGraph getGraphOf(IScheduleTask task) {
return taskScheduleGraphMap.get(task);
......
......@@ -51,6 +51,8 @@ public class ScheduledTask implements InvocationHandler, IScheduleElement {
}
/** {@inheritDoc} */
// TODO(AD): Extract this method to a parent class for composing objects. Esp. the
// getWrappedObject call.
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Class<?>[] argTypes = null;
......@@ -58,6 +60,10 @@ public class ScheduledTask implements InvocationHandler, IScheduleElement {
Arrays.stream(args).map(a -> a.getClass()).toArray(size -> new Class[size]);
}
if(method.getName().equals("getWrappedObject")) {
return originTask;
}
// Object-local (unique) methods.
try {
Method delegateMethod = getClass().getMethod(method.getName(), argTypes);
......@@ -81,15 +87,29 @@ public class ScheduledTask implements InvocationHandler, IScheduleElement {
/** {@inheritDoc} */
@Override
public Double getDeadline() {
// TODO Auto-generated method stub
return null;
// TODO(AD): We must consider E2E deadlines here!
Double periodDeadline = originTask.getPeriod() * (getInstanceCount() + 1);
return periodDeadline;
}
/** {@inheritDoc} */
@Override
public Double getOffset() {
// TODO Auto-generated method stub
return null;
// TODO(AD): This needs to be passed through the input layer first.
return 0.0;
}
/** {@inheritDoc} */
@Override
public Double getReadyTime() {
return getInstanceCount() * originTask.getPeriod() + getOffset();
}
/** {@inheritDoc} */
@Override
public Integer getInstanceCount() {
// Must be adjusted for the multirate case.
return 0;
}
/** Just a dummy method to avoid unneeded warnings if an empty catch clause is desired. */
......
EDFScheduler.java d36ba21ce9d71bdc61ec3b59fcf229d56d74343c YELLOW
EDFSchedulerBase.java 2b69fa7697e14f3f103eb81298d237b448000f18 RED
EDFScheduler.java d4626a5aaf289073df1545c7a143e54cf9d7691c YELLOW
EDFSchedulerBase.java 6b353d3a55bdfabf688b0f78f7311c2a66f19a80 RED
SchedulerBase.java 243ad1db8f9fcf06c0113e9b1c4b92345d2e3414 RED
TDMABusScheduler.java ca798991165e0ffae22e675d56b06c6fefd7fe61 RED
......@@ -15,11 +15,11 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.feature.scheduling.scheduler;
import org.apfloat.Apfloat;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IExecutionUnitAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IMemAccessTask;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
import org.fortiss.af3.exploration.alg.feature.scheduling.problem.SharedMemAccessLatencyEncoding;
import org.fortiss.af3.exploration.alg.feature.scheduling.problem.graph.IScheduleTask;
import org.fortiss.af3.exploration.alg.feature.taskmapping.variable.TaskMappingEntry;
import org.fortiss.af3.exploration.alg.module.common.encoding.IMappingEncoding;
......@@ -38,13 +38,13 @@ public class EDFScheduler extends
* read/write operation block, the access /
*/
@Override
protected Apfloat getDuration(
protected Double getDuration(
IMappingEncoding<ITaskAdapter, IExecutionUnitAdapter, TaskMappingEntry<ITaskAdapter, IExecutionUnitAdapter>, ?> encoding,
SharedMemAccessLatencyEncoding shMemEnc, ITaskAdapter task,
SharedMemAccessLatencyEncoding shMemEnc, IScheduleTask schedTask,
TaskMappingEntry<ITaskAdapter, IExecutionUnitAdapter> entry) {
Apfloat executiontime = new Apfloat(task.getWcet(entry.getTarget()), DOUBLE_PRECISION);
if(task instanceof IMemAccessTask) {
executiontime = new Apfloat(shMemEnc.getLatencyOf(task));
Double executiontime = schedTask.getWcet(entry.getTarget());
if(schedTask instanceof IMemAccessTask) {
executiontime = shMemEnc.getLatencyOf(schedTask).doubleValue();
}
return executiontime;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment