portageetoptimisationd’applicationsde traitementd ... · fedora17,16goddr 4/26. kalray...

33
Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple Portage et optimisation d’applications de traitement d’images sur architecture Kalray Mppa-Manycore Journées de la Compilation Pierre Guillou Centre de recherche en informatique Mines ParisTech 4 décembre 2013 1 / 26

Upload: others

Post on 20-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Portage et optimisation d’applications detraitement d’images sur architecture Kalray

Mppa-ManycoreJournées de la Compilation

Pierre Guillou

Centre de recherche en informatiqueMines ParisTech

4 décembre 2013

1 / 26

Page 2: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

1 La société Kalray2 Le processeur Mppa-Manycore

ArchitectureProgrammation

3 Le langage Sigma-CAgentsSubgraphs

4 Développement d’agents pour l’analyse d’imageAccélération matérielleAgents pour analyse d’image

5 Génération de code par PipsL’existant - le framework FreiaApplication au Sigma-C

6 Interfaçage avec le framework FreiaGestion des transfertsArchitecture logicielle

7 ExempleL’application licensePlateRésultats obtenus

2 / 26

Page 3: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

KalrayConception de processeurs à haute efficacité énergétique

Mppa : Multi-Purpose Processor Array

3 / 26

Page 4: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

KalrayConception de processeurs à haute efficacité énergétique

processeur grande efficacitéénergétique256 cœurs de calculfaible consommationénergétique (5W)systèmes embarqués

4 / 26

Page 5: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

KalrayConception de processeurs à haute efficacité énergétique

suite logicielleIDE (plugin Eclipse)débuggerprofilersystème de traces

4 / 26

Page 6: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

KalrayConception de processeurs à haute efficacité énergétique

station de travailplate-forme de développementcomplèteMppa-Manycore sur carted’extension PCI-ExpressMppa-AccesscoreFedora 17, 16 Go DDR

4 / 26

Page 7: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Architecture

Network on Chip

Cluster d’entrée/sortie

Clusterd’entrée/sortie

Cluster d’entrée/sortie

Clusterd’entrée/sortie

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

Clusterde

calcul

16 clusters de calcul4 clusters d’entrée/sortieNoCgravure en 28 nm

5 / 26

Page 8: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Architecture

Clusters de calcul

Mémoirepartagée

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœurde

calcul

Cœursystème

Unité dedebug

Interface Interface

64 registres 32 bitsVLIW + vectorielMémoire partagée : 2Mo/clusterNodeOS

6 / 26

Page 9: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Architecture

Entrées/sorties

Mppa-Developer

Mppa Board

PuceMppa

Machine hôte(Fedora)

Mémoirevive

Réseauvia Ethernet

Autre puce Mppa

7 / 26

Page 10: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Architecture

Entrées/sorties

Mppa-Developer

Mppa Board

PuceMppa

Machine hôte(Fedora)

Mémoirevive

Réseauvia Ethernet

Autre puce Mppa

7 / 26

Page 11: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Programmation

Deux paradigmes

Explicitement parallèle (bas niveau)POSIX-ThreadsOpenMPMPI (portage en cours)OpenCL (portage en cours)

Dataflow (haut niveau)Langage Sigma-C

8 / 26

Page 12: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Agents

Le langage Sigma-C - les agents

Agententrée 1

entrée 0

sortie=⇒

agent ag_name ( parameters ) {interface {

in <input_t > input0 ;in <input_t > input1 ;out <output_t > output ;spec { { input0 [2]; output0 } ; { input1 } ; { output0 [3]} };

}...

}

9 / 26

Page 13: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Agents

Les agents, des machines à états

get 2 data from input0send 1 data to output0

get 1 data from input1

send 3 data to output0

interface {...spec { { input0 [2]; output0 } ; { input1 } ; { output0 [3]} };

}

void foo(int a) exchange ( input0 inp [2] , output0 outp) {outp = a*inp [0] + inp [1];

}...void start () {

foo (2);...

}

10 / 26

Page 14: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Subgraphs

Le langage Sigma-C - les subgraphs

Agent 1

Agent 2

Agent 3

Agent 4

Agent 5

subgraph subgr () {...map {

agent ag1 = new agname (...);agent ag2 = new agname (...);...connect (ag1.output0 , ag2. input );connect (ag1.output1 , ag3. input );...

}}

11 / 26

Page 15: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Accélération matérielle

Accélération matérielle sur Mppa-Manycore

Machine hôteClusters

d’entrée/sortieClustersde calcul

Lecture

Écriture

Transfert

Transfert

Traitement

12 / 26

Page 16: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Agents pour analyse d’image

Développement d’agents Sigma-C pour l’analyse d’images

Plusieurs types d’agents développésopérateurs arithmétiques

unaires (une image en entrée + un paramètre)binaires (deux images en entrée)

opérateurs morphologiquesérosion, dilation, convolutioncœur de boucle en assembleur (développé par Kalray)

opérateurs de mesuremin et max (avec ou sans leurs coordonnées), volume

13 / 26

Page 17: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

L’existant - le framework Freia

Freia, un framework pour l’analyse d’image

Applicationd’analysed’image

FrameworkFreia

Implémentations des opérateurs d’analyse d’image

Fulguro OpenCL SPoC Terapix

Mppa

Applicationoptimisée

Compilateur sourceà source Pips

Implémentationlogicielle Accélérateurs matériels

14 / 26

Page 18: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

L’existant - le framework Freia

Freia, un framework pour l’analyse d’image

Applicationd’analysed’image

FrameworkFreia

Implémentations des opérateurs d’analyse d’image

Fulguro OpenCL SPoC Terapix

Mppa

Applicationoptimisée

Compilateur sourceà source Pips

Implémentationlogicielle Accélérateurs matériels

14 / 26

Page 19: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

L’existant - le framework Freia

Freia, un framework pour l’analyse d’image

Applicationd’analysed’image

FrameworkFreia

Implémentations des opérateurs d’analyse d’image

Fulguro OpenCL SPoC Terapix Mppa

Applicationoptimisée

Compilateur sourceà source Pips

Implémentationlogicielle Accélérateurs matériels

14 / 26

Page 20: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Application au Sigma-C

Principe

Passer defreia_aipo_erode_8c (imerode , imin , kernel );freia_aipo_dilate_8c (imdilate , imerode , kernel );freia_aipo_and (imout , imdilate , imin );

àsubgraph foo () {

...int16_t kernel [9] = {0,1,0, 0,1,0, 0 ,1 ,0};...agent ero = new img_erode ( kernel );agent dil = new img_dilate ( kernel );agent and = new img_and_img ();...connect (ero.output , dil. input );connect (dil.output , and. input );...

}

15 / 26

Page 21: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Application au Sigma-C

Compilation de code Sigma-C

Structures intermédiairesDAG liste des sommets, entrées et sorties

vertex opération, paramètres, liste des successeurs

Génération de code Sigma-CPour chaque vertex :

déclarer les paramètresinstancier l’agent correspondant avec les bons paramètresconnecter l’agent à ses successeurs

insérer des agents de réplication si plus de sorties que spécifié

16 / 26

Page 22: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Gestion des transferts

Retour sur le modèle d’accélérateur matériel

Machine hôteClusters

d’entrée/sortieClustersde calcul

Lecture

Écriture

Transfert

Transfert

Traitement

17 / 26

Page 23: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Gestion des transferts

Inconvénients du modèle

Transferts inter clusterscommunications : 100 cyclesmémoire d’un cluster : 2 Mo

=⇒ transferts ligne à ligne

Transferts hôte - clustersTransferts + coûteux

transfert d’un seul tenant dans la mémoire vive de la pucestreaming ligne par ligne de la mémoire vers les clusters de calcul

18 / 26

Page 24: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Gestion des transferts

Inconvénients du modèle

Lecture et écriture sur disquegarder la dépendance à Freia

chargement et sauvegarde des imagesarchitecture en deux exécutables

Freia manipule les imagesSigma-C effectue les traitements

communications par pipes nommés (design de Kalray)

18 / 26

Page 25: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Architecture logicielle

Architecture d’une application Sigma-C - Freia

Machine hôteClusters

d’entrée/sortieClustersde calcul

binaire Freia

Agents SigmaC (code généré par Pips)

commun

icationpar

pipe

sno

mmés

LectureCréationdes pipes

Ordre demalloc Transfert Malloc

sur DDR

Envoi del’image Transfert Stockage

sur DDR

Lancementtraitement

Streamingde l’image

TransfertStockageen DDR

Retour del’image Transfert Envoi depuis

la DDR

Ordre de free Transfert Free sur DDR

Écriture

Traitement

19 / 26

Page 26: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

L’application licensePlate

Application licencePlate - présentation

20 / 26

Page 27: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

L’application licensePlate

Application licencePlate - présentation

20 / 26

Page 28: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

L’application licensePlate

Application licensePlate - DAG

Lecture

Ouverture 15

Fermeture 8

Seuillage

Seuillage

ET binaire

Ouverture 3Dilatation 3ET binaireÉcriture

21 / 26

Page 29: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

L’application licensePlate

Comparaison des temps de traitement

21

14

37

32

22

36

7.3

2.3

Mppa SPoC Terapix Inteldual-core

AMDquad-core

GeForce8800 GTX

Quadro 600 Tesla C2050

Temps

detraitement(m

s)

Performances des différentes cibles

22 / 26

Page 30: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

L’application licensePlate

Consommation énergétique

5 ? ?

65 60

120

40

240

Mppa SPoC Terapix Inteldual-core

AMDquad-core

GeForce8800 GTX

Quadro 600 Tesla C2050

Consom

mationénergétiq

ue(W

)Consommation énergétique

théorique des différentes cibles

23 / 26

Page 31: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Résultats obtenus

Résultats obtenus sur les autres applications

App. Mppa SPoC Terapix Inteldual-core

AMDquad-core

anr999 29 0.9 3.5 12.2 7.2licensePlate 21 13.6 36.8 32.2 21.9oop 35 124.6 63.3 12.3 8.3toggle 33 12.6 4.3 15.0 9.0

App. Mppa GeForce8800 GTX

Quadro600

TeslaC 2050

anr999 29 9.8 1.5 0.9licensePlate 21 36.6 7.3 2.3oop 35 5.8 1.8 1.0toggle 33 6.3 1.4 0.7

24 / 26

Page 32: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

En conclusion

bibliothèque d’agents Sigma-C pour l’analyse d’imagegénération via Pips de code applicatif intégré au framework Freiaplusieurs applications fonctionnellesoptimisations des temps d’exécutionfuture work :

amélioration performances,support d’autres applications. . .

25 / 26

Page 33: Portageetoptimisationd’applicationsde traitementd ... · Fedora17,16GoDDR 4/26. Kalray Mppa-Manycore Sigma-C Agentsd’analysed’image GénérationdecodeparPips InterfaçageavecFreia

Kalray Mppa-Manycore Sigma-C Agents d’analyse d’image Génération de code par Pips Interfaçage avec Freia Exemple

Portage et optimisation d’applications detraitement d’images sur architecture Kalray

Mppa-ManycoreJournées de la Compilation

Pierre Guillou

Centre de recherche en informatiqueMines ParisTech

4 décembre 2013

26 / 26