• Aucun résultat trouvé

Towards Compositional and Generative Tensor Optimizations

N/A
N/A
Protected

Academic year: 2021

Partager "Towards Compositional and Generative Tensor Optimizations"

Copied!
2
0
0

Texte intégral

(1)

HAL Id: hal-01666818

https://hal-mines-paristech.archives-ouvertes.fr/hal-01666818

Submitted on 18 Dec 2017

HAL is a multi-disciplinary open access

archive for the deposit and dissemination of sci-entific research documents, whether they are pub-lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

Towards Compositional and Generative Tensor Optimizations

Adilla Susungi, Norman Rink, Jerónimo Castrillón, Immo Huismann, Albert Cohen, Claude Tadonki, Jörg Stiller, Jochen Fröhlich

To cite this version:

Adilla Susungi, Norman Rink, Jerónimo Castrillón, Immo Huismann, Albert Cohen, et al.. Towards Compositional and Generative Tensor Optimizations. ACM SIGPLAN conference on Systems, Pro-gramming, Languages and Applications: Software for Humanity (SPLASH), Oct 2017, Vancouver, Canada. 2017. �hal-01666818�

(2)

Towards Compositional and Generative Tensor Optimizations

Adilla Susungi, Norman A. Rink, Jer´

onimo Castrill´

on, Immo Huismann, Albert Cohen, Claude Tadonki, J¨

org Stiller and Jochen Fr¨

ohlich

adilla.susungi@mines-paristech.fr — norman.rink@tu-dresden.de

Tensors in Computational Fluid Dynamics (CFD) Loop characteristics:

3 to 4 dimensions nesting

Few iterations per dimension (e.g., 17 or 33 iterations)

Type of computations: Tensor contractions Outer products

Element-wise multiplications

Computations on each element of a structured mesh

Inverse Helmholtz

tijk = X

l,m,n

ATkn · ATjm · ATil · ulmn pijk = Dijk · tijk

vijk = X

l,m,n

Akn · Ajm · Ail · plmn

Tensor Optimization Frameworks

Domain-specific expressivity Flexible/Adaptive optimization heuristics Generic expressivity

Hidden and/or rigid optimization

heuristics

Related Work

Different levels of expressiveness and control on optimizations

Specific Generic Hidden/rigid Flexible/adaptive Chill • Pluto • TensorFlow • TVM •

Tensor Contraction Engine •

Numpy •

Tensor Algebra Compiler •

Optimizing CFD Kernels with Existing Tools Several limitations

Few opportunities for adaptations

Unadapted constructs Unadapted heuristics Limited optimizations

Limited expressivity

Should we create yet another domain-specific solution?

Goal

A cross-domain intermediate language for tensor optimizations

Intermediate Language Modular constructs First-class citizens: Arrays Tensor operators Loop iterators Transformations Envisioned Tool Meta-programming Intermediate language Source file (C or DSL) Optimized C Iterative search Generic expressivity Flexible/Adaptive optimization heuristics

Search Space Exploration Evaluation order of tensor

contractions Fusions Permutations Vectorization Collapsing Unrolling Inverse Helmholtz by Example

# Basic array declaration

A = array(2, double, [N, N]) u = array(3, double, [N, N, N]) D = array(3, double, [N, N, N]) # Transposition At = vtranspose(A, 1, 2) # Tensor contractions tmp1 = contract(At, u, [2, 1]) tmp2 = contract(At, tmp1, [2, 2]) tmp3 = contract(At, tmp2, [2, 3]) # Element-wise multiplication tmp4 = entrywise(D, tmp3) # Tensor contractions tmp5 = contract(A, tmp4, [2, 1]) tmp6 = contract(A, tmp5, [2, 2]) v = contract(A, tmp6, [2, 3]) # Iterator declaration i1 = iterator(0, N, 1) i2 = iterator(0, N, 1)

# ... other iterator declarations

# Association of iterators # to computations

build(D, [td1, td2, td3])

build(tmp1, [i1, i2, i3, i4])

# Also applies to tmp2, ..., tmp6 build(v, [k12, k22, k32, k42]) # Loop interchanges interchange(i4, i3) interchange(i4, i2) interchange(j2, j1) interchange(j1, j4) # Transpositions tmp2t = vtranspose(tmp2, 1, 2) replace_array(j3, tmp2, tmp2t) replace_array(k4, tmp2, tmp2t) tmp3t = vtranspose(tmp3, 1, 3) replace_array(k4, tmp3, tmp3t) interchange(k3, k2) # ... other optimizations

Example of assessment: Different heuristics of loop interchanges (+ parallelization)

L1 L2 L3 8 9 10 11 9 8 11 Sp eed-up Variant L1: Loop interchanges only; Variant L2: Loop interchanges + data transpositions with copying; Variant L3: Loop interchanges + data transpositions without copying.

Baseline: sequential execution (3.32s). Machine: 24-core Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz (Haswell)

Future Work

Applications to other domains Syntax refinement

Formal semantics

Références

Documents relatifs

Analyse du plutonium en solution par spectrophotométrie d’absorption: vue d’ensemble des techniques mises en oeuvre au Laboratoire de Conversion des Actinides et

Ces tendances se retrouvent chez le chien, pour lesquels les antiparasitaires représentent également à eux seuls plus de la moitié des cas déclarés d’usages hors AMM, avec des

This study aimed to identify DPs according to generation and sex using reduced-rank regression (RRR) with metabolic syndrome components as intermediate markers and assess

Quelle est la situation en matière d'approvisionnement en bois des industries ? Les scieurs de Midi-Pyrénées se plaignent de difficultés d'approvisionnement et souhaitent

Martor (The Museum of the Romanian Peasant Anthropology Journal) is a peer-reviewed academic journal established in 1996, with a focus on cultural and visual

Unlike the winter demonstrations, who were ca rried out by the inhabitants of Bucharest, the on es taking place on the stadium, on the 23rd of August, were carried out by

Et cet art dont on parle, veut dire qu’il ne s’agit pas là de recréer les images que le roman peut nous fournir, ou encore de respecter totalement les dialogues comme a choisi de

Écrire ensemble : réseaux et pratiques d’écriture dans les revues francophones du XX e siècle.. Writing ensembles: Network and Writing Practices in Twentieth-Century