# On the Reliability Assessment of Artificial Neural Networks Running on AI-Oriented MPSoCs
## 3 Proposed Approach
### ILP-Based Optimal Scheduling  
We propose an ILP and variance-based scheduling with the aim of mitigating the ANN criticality by redistributing chunks of neurons over the existing PEs. An ILP model is built to feed a solver in charge of finding the optimal solution. The final optimized scheduling is deterministic and it is wholly decided at compile-time. Therefore, no choices are made at run-time during the network inference.  
The following method takes inspiration from the existing scheduling on parallel machines [52; 53; 54], where a set of identical machines \(M=\{1,\ldots,m\}\) has to process in parallel a set of jobs \(J=\{1,\ldots,j\}\). Jobs can be split into multiple sections that can be processed on several machines simultaneously, and each job \(j\in J\) has weight \(w_{j}\) and processing time \(pt_{j}\). In line with this, we may consider the machines \(m\in M\) as the processing elements \(p\in P\) of our NCS and the jobs \(j\in J\) as the layers \(l\in L\) of our ANN. From this point on, the terms machines and processing elements as well as jobs and layers are equivalent, i.e., \(m=p\) and \(j=l\). Hence, the problem looks very similar but we change the criterion adopted to find the optimal solution. Indeed, depending on the criteria defining the problem, an  
Figure 3: Static scheduling: Neurons assignment in a multiprocessor SoC.  
optimal scheduling solution can be provided by exploiting, for example, integer linear programming. For instance, if the goal is to to minimize the maximum completion time of machines, scheduling provides a solution for that purpose by assigning those jobs \(j\in J\) to the machines \(m\in M\). Although our problem is approaching very closely, our purpose is not to minimize the maximum completion time of machines; rather, it is to equalize the amount of critical neurons that each PE has to elaborate. Therefore, instead of considering the weights \(w_{j}\) or the processing time \(pt_{j}\), the criterion on which our scheduling is built is the variance \(\sigma^{2}_{\text{1,m}}\) of the job's sections (i.e., the chunks), that measures their criticality (4). In other words, the objective of the proposed method is to uniform the variance of the jobs over the machines.  
An optimal and deterministic solution for this problem can be obtained by resorting to optimization solvers. More formally, our approach formulates the problem as an ILP problem, which can be expressed through mathematical formulas. We built an ILP model by defining the decision variables, the objective function, and the constraints, all compliant with the following formulas. The optimal solution is the one that is able to minimize the distance  
* Each processing element \(p\) in each layer \(l\) has to process a single chunk \(k\): \[\sum_{k=1}^{K}(x_{\{(\text{L},p)\text{k}\}})=1,\forall l\in L,\forall p\in P\] (9)
* The cumulative variance elaborated by every PE must be close to the average one: \[\sum_{k=1}^{K}\sum_{l=1}^{L}(\sigma^{2}_{\text{(L,k)}}*x_{\{(\text{L},p)\text{ k}\}})\sim\frac{\sum_{p=1}^{P}\sigma^{2}_{\text{p}}{}^{\text{(TOT)}}}{P}, \forall l\in L\] (10)
* The cumulative variance of each layer must stay the same: \[\sum_{k=1}^{K}\sum_{p=1}^{P}(\sigma^{2}_{\text{(L,k)}}*x_{\{(\text{L},p)\text{ k}\}})=\sigma^{2}_{\text{l}}{}^{\text{(TOT)}},\forall l\in L\] (11)