• No results found

Integrating Memory Demand

In this section, we show how to integrate the memory demand em

i into federated scheduling. Since em

i is the memory time for qi = 1 (full memory bandwidth), the memory time with qi = 1/2 (half memory bandwidth) is emi × 2. Thus, an upper bound on the makespan of Ti, when scheduled by any greedy work-conserving scheduler on mi dedicated cores and qi fraction of memory bandwidth, can be obtained as follows.

ei = em i qi +e x i − Li mi + Li (5.3)

In this bound, the memory time (em

i /qi) is safely assumed to be serialized without overlap- ping with computation. It is equivalent to say that the critical path Li is executed on one core without overlapping with computation on other cores. This bound is valid because the parallel task is assumed to unfold at run-time without knowing the order or even the mapping of tasks to cores and the order or the position of memory requests.

In (5.3), we use (ex

i − Li)/mi + Li as a coarse-grained bound on the computation makespan of Ti since we assume a greedy work-conserving scheduler similar to (5.1). As mentioned before, a static scheduling algorithm can be used instead. In this case, the bound on the computation makespan can be replaced by fi(mi). In Section5.8, we propose a static scheduling algorithm to execute a parallel task on its own cluster of cores.

Similar to before, a sufficient schedulability test for each Ti ∈ Γ can be established as ei ≤ Di. Thus, the bandwidth fraction qi can be derived from (5.3) as a function of mi as follows.

qi(mi) =

emi × mi

(Di− Li) × mi− (exi − Li)

(5.4) For ease of reference, we use the following notation.

∆i(mi) = qi(mi) − qi(mi+ 1). (5.5) Lemma 20. The function qi(mi) has the following two properties: ∆i(mi) > 0 and ∆i(mi) > ∆i(mi+ 1).

Proof. This can be proven by direct substitution of (5.4) in (5.5) and applying some alge- braic manipulation. Alternatively, we note that the first derivative of qi is negative and the second derivative is positive, meaning that the function is strictly decreasing and convex (decreasing slope). Since ∆i = −dqi/dmi, the lemma follows.

The proof is shown for the computation makespan bound we consider in (5.3). As we stated early, this bound can be replaced by fi(mi). For this case, the work in [123] has shown that these two properties can be fulfilled in many common cases of parallelization functions.

As per Lemma 20, qi(mi) is a decreasing function since ∆i(mi) > 0. In other words, giving Ti ∈ Γ more cores reduces its memory bandwidth demand. We can think of ∆i(mi) as the amount of reduction in bandwidth fraction when Ti ∈ Γ is given one more core. We illustrate the concept of trading cores for memory bandwidth by the following example. Example 3. Consider a task T1 with the following parameters: em1 = 50, ex1 = 100, D1 = 150 and for simplicity assume L1 = 0. If we assign T1 one core and full memory bandwidth, the makespan bound is e1 = 50 × 1 + 100/1 = 150 with zero slack time. Now, if we give T1 one extra core, the makespan bound becomes e1 = 50 × 1 + 100/2 = 100 with 50 slack time. This slack time can be used to relax the memory demand with half memory bandwidth, i.e., e1 = 50 × 2 + 100/2 = 150.

In this example, we give T1 one more core and gain half memory bandwidth which can be used by another task to meet its deadline. Our method presented in Section 5.5 finds the optimal choice to which tasks are taking the extra cores and which tasks are receiving the gained bandwidth.

Furthermore, the minimum number of cores to execute Ti ∈ Γ while assuming full memory bandwidth (qi = 1) can be derived from (5.3) as follows.

m∗i =  exi − Li Di− Li− emi  (5.6)

5.4.1

RR with (m) Request Buffers

In this section, we discuss how to bound the memory time on a system with per core request buffer and RR arbitration policy (mRR). In this configuration and m processor cores, each memory request can be delayed by m − 1 requests of other cores. In other words, the memory time can be bounded as em

i × m. However, since we assume in (5.3) that all memory requests within each cluster are serialized and served from one buffer, we observe the following better bound on the makespan.

ei = emi × (1 + X j6=imj) + ex i − Li mi + Li (5.7)

In this bound, we only account for P

j6=imj, the delay from buffers outside the cluster of Ti, and 1 for cluster under analysis Ti. That is, there is no interference from buffers within the same cluster as we assume in (5.3) that memory requests are served from one buffer. In mRR-Assign algorithm, we show how to assign cores to tasks. The algorithm starts by giving each task the minimum number of cores to execute assuming full memory bandwidth. Then, the algorithm computes the makespan for each task. Intuitively, if ei > Di for any task, the only flexible parameter with mRR is to give more cores. We note that find-one in Line 5 returns the index of any task with ei > Di. Since ei depends on mi of other tasks as in (5.7), we need to update ei of all tasks after each increment of mi.

mRR-Assign is an efficient algorithm with computational complexity of O(mn). The while loop iterates at most m times as we give one more core in each iteration as in Line 6. In each iteration, we update n tasks as in Line 7.

5.4.2

RR with (n) Request Buffers

We observe that the bound in (5.7) assumes all memory requests are served from one buffer for the cluster under analysis. On the other hand, the bound assumes the interference from

mRR-Assign 1 for each task Ti 2 mi = m∗i 3 compute ei as in (5.7) 4 while (mused≤ m) ∧ (∃T i : ei > Di) 5 j = find-one(Ti ∈ Γ : ei > Di) 6 mj = mj+ 1

7 update ei for all tasks 8 return (mused≤ m)

Table 5.1: Task set example.

em ex L D

T1 3552 14412 65 9254 T2 629 12505 478 4830

all buffers of other clusters. Thus, we propose to assign one buffer for each cluster of cores to improve the upper-bound on memory access time. In this case, each cluster introduces a delay of one regardless of its size. Since the number of clusters n ≤ mused, the per cluster bound is always better than the per core bound. We refer to RR with per cluster buffers as nRR, and we use it as a baseline to compare with other methods.

Unlike mRR, the bandwidth fraction in nRR is constant, qi = 1/n, and therefore mi can be computed using the following closed form formula.

mni =  exi − Li Di− Li − n × emi  (5.8)