Packing - the next BLIS Fron5er? Tze Meng Low BLIS - - PDF document

packing the next blis fron5er
SMART_READER_LITE
LIVE PREVIEW

Packing - the next BLIS Fron5er? Tze Meng Low BLIS - - PDF document

9/29/17 Packing - the next BLIS Fron5er? Tze Meng Low BLIS Retreat 2017 5 th loop around micro-kernel Looking back n C n C += C j A B j


slide-1
SLIDE 1

9/29/17 ¡ 1 ¡

Packing ¡-­‑ ¡the ¡next ¡BLIS ¡Fron5er? ¡

Tze ¡Meng ¡Low ¡ BLIS ¡Retreat ¡2017 ¡

Looking ¡back ¡

§ Original ¡Goals ¡ ¡ § Increase ¡Produc7vity ¡ § Extensible ¡ Etc… ¡

3rd ¡loop ¡around ¡micro-­‑kernel ¡ 4th ¡loop ¡around ¡micro-­‑kernel ¡ 5th ¡loop ¡around ¡micro-­‑kernel ¡ mR mR 1

+= ¡ += ¡ += ¡ += ¡ += ¡ += ¡

nC nC kC kC mC mC

1

nR kC

nR

Pack Ai → Ai

~

Pack Bp → Bp

~

nR

A Bj Cj Ap Bp Cj A

i

~

Bp

~ B

p

~ Ci Ci

kC

L3 ¡cache ¡ L2 ¡cache ¡ L1 ¡cache ¡ registers ¡ main ¡memory ¡

1st ¡loop ¡around ¡micro-­‑kernel ¡ 2nd ¡loop ¡around ¡micro-­‑kernel ¡ micro-­‑kernel ¡

Ai

¡ The ¡BLAS-­‑like ¡Library ¡Instan7a7on ¡ SoNware ¡(BLIS) ¡framework ¡is ¡a ¡new ¡ infrastructure ¡for ¡rapidly ¡instan7a7ng ¡ Basic ¡Linear ¡Algebra ¡Subprograms ¡ (BLAS) ¡func7onality. ¡…. ¡

F.G. ¡Van ¡Zee, ¡R. ¡van ¡de ¡Geijn, ¡BLIS: ¡A ¡Framework ¡for ¡Rapidly ¡Instan7a7ng ¡BLAS ¡Func7onality, ¡ACM ¡TOMS ¡2015 ¡

slide-2
SLIDE 2

9/29/17 ¡ 2 ¡

Ease ¡of ¡use ¡

§ What ¡happens ¡with ¡a ¡new ¡architecture? ¡

– Write/Generate ¡micro-­‑kernel ¡

¡ ¡ ¡

– Use ¡analy7cal ¡modeling ¡for ¡parameters ¡ ¡ ¡

kc = CArNL1CL1 mrSdata CAr ≤

  • mr

mr + nr (WL1 − 1) ⌫

T.M. ¡Low, ¡F. ¡Igual, ¡T. ¡ ¡M. ¡Smith, ¡E. ¡Quintana-­‑Or7s, ¡Analy7cal ¡Modeling ¡is ¡Sufficient ¡for ¡High ¡Performance ¡BLIS, ¡ACM ¡TOMS, ¡2017 ¡

Ease ¡of ¡use ¡

§ Actual ¡work ¡

– Create ¡directory ¡(recursive ¡copy ¡and ¡rename) ¡ – Edit ¡bli_kernel.h – Drop ¡your ¡kernel(s) ¡into ¡kernels/3

– ./configure new_kernel & make install

¡

¡ ¡

slide-3
SLIDE 3

9/29/17 ¡ 3 ¡

Unexpected ¡benefits ¡

§ More ¡than ¡just ¡BLAS ¡

Linkage ¡Disequilibrium ¡ 010101… ¡ 010011… ¡ ¡ 010001… ¡ ¡ ¡ ¡ ¡2 ¡

SNP ¡A ¡ SNP ¡B ¡

¡

Comm ¡

k ¡

  • N. ¡Alachio7s, ¡Popovici, ¡T.M. ¡Low, ¡Efficient ¡Computa7on ¡of ¡

Linkage ¡Disequilibria ¡as ¡Dense ¡Linear ¡Algebra ¡Opera7ons, ¡ HiCOMB ¡2016 ¡

kNN ¡ DNA ¡Fingerprin5ng ¡ APSP ¡

What ¡everyone ¡is ¡saying… ¡

PACKING ¡

slide-4
SLIDE 4

9/29/17 ¡ 4 ¡

Reasons ¡for ¡packing ¡

§ Work ¡with ¡different ¡data ¡layouts ¡ ¡ § Hide ¡addi7onal ¡opera7ons ¡ ¡ § Generalize ¡the ¡framework ¡

C = f ((A ⌦ B) C) Work ¡with ¡Different ¡Data ¡Layout ¡

§ Limited ¡SIMD ¡support ¡for ¡complex ¡mul7plica7on ¡ § Interleaved ¡vs ¡Non-­‑interleaved ¡ § Switch ¡format ¡during ¡packing ¡

0 ¡ 10 ¡ 20 ¡ 30 ¡ 40 ¡ 50 ¡ 60 ¡ 70 ¡

16 ¡ 48 ¡ 80 ¡ 112 ¡ 144 ¡ 176 ¡ 208 ¡ 240 ¡ 272 ¡ 304 ¡ 336 ¡ 368 ¡ 400 ¡ 432 ¡ 464 ¡ 496 ¡ 528 ¡ 560 ¡ 592 ¡ 624 ¡ 656 ¡ 688 ¡ 720 ¡ 752 ¡ 784 ¡ 816 ¡ 848 ¡ 880 ¡ 912 ¡ 944 ¡ 976 ¡ 1008 ¡

GFlop/s ¡ k ¡(m ¡= ¡n ¡= ¡1000) ¡ Performance ¡on ¡Intel ¡Kaby ¡Lake ¡7770K ¡

BLIS ¡+ ¡Mixed ¡format ¡ Na5ve ¡BLIS ¡zgemm ¡

  • D. ¡Popovici, ¡F. ¡Franchek, ¡T.M. ¡Low, ¡Mixed ¡Data ¡Format ¡for ¡Vectorized ¡Complex ¡Kernel, ¡HPEC, ¡2017 ¡
slide-5
SLIDE 5

9/29/17 ¡ 5 ¡

Hide ¡addi5onal ¡opera5ons ¡

§ Finite ¡Field ¡over ¡large ¡primes ¡ ¡

– Reuse ¡BLAS ¡& ¡LAPACK ¡for ¡finite ¡fields ¡

Input ¡ Type ¡ Conversion ¡ GEMM ¡ Modulo ¡p ¡ Type ¡ Conversion ¡ Output ¡

  • J. ¡Johnson, ¡T.M. ¡Low, ¡M. ¡Lambert, ¡P. ¡Oostema, ¡B. ¡D. ¡Saunders, ¡High-­‑Performance ¡Kernels ¡for ¡Exact ¡Linear ¡Algebra, ¡ACA ¡2017 ¡

Hide ¡addi5onal ¡opera5ons ¡

§ Finite ¡Field ¡over ¡large ¡primes ¡ ¡

– Reuse ¡BLAS ¡& ¡LAPACK ¡for ¡finite ¡fields ¡

Input ¡ Type ¡ Conversion ¡ GEMM ¡ Modulo ¡p ¡ Type ¡ Conversion ¡ Output ¡

  • J. ¡Johnson, ¡T.M. ¡Low, ¡M. ¡Lambert, ¡P. ¡Oostema, ¡B. ¡D. ¡Saunders, ¡High-­‑Performance ¡Kernels ¡for ¡Exact ¡Linear ¡Algebra, ¡ACA ¡2017 ¡

Packing ¡ Kernel ¡

slide-6
SLIDE 6

9/29/17 ¡ 6 ¡

Generalize ¡the ¡framework ¡

§ Finite ¡fields ¡for ¡small ¡primes ¡

– 4 ¡Russians ¡Method ¡

Table ¡Crea5on ¡ Compute ¡with ¡A ¡as ¡index ¡

  • J. ¡Johnson, ¡T.M. ¡Low, ¡M. ¡Lambert, ¡P. ¡Oostema, ¡B. ¡D. ¡Saunders, ¡High-­‑Performance ¡Kernels ¡for ¡Exact ¡Linear ¡Algebra, ¡ACA ¡2017 ¡

Performance ¡

0 ¡ 500 ¡ 1000 ¡ 1500 ¡ 2000 ¡ 1024 ¡ 4096 ¡ 16384 ¡

Bits ¡Ops ¡/ ¡Cycle ¡ N ¡= ¡M ¡= ¡K ¡

4R ¡-­‑ ¡BLIS ¡ m4ri ¡(4 ¡bit ¡tables) ¡ O(n^3) ¡ Naive ¡Peak ¡ 4R ¡-­‑ ¡Peak ¡(4 ¡bit ¡tables) ¡

Need ¡Packing ¡for ¡A ¡

  • J. ¡Johnson, ¡T.M. ¡Low, ¡M. ¡Lambert, ¡P. ¡Oostema, ¡B. ¡D. ¡Saunders, ¡High-­‑Performance ¡Kernels ¡for ¡Exact ¡Linear ¡Algebra, ¡ACA ¡2017 ¡
slide-7
SLIDE 7

9/29/17 ¡ 7 ¡

What ¡everyone ¡is ¡NOT ¡saying… ¡

PACKING ¡

Remember ¡how ¡easy ¡to ¡add ¡kernels? ¡

slide-8
SLIDE 8

9/29/17 ¡ 8 ¡

Introducing ¡packing ¡is ¡not ¡easy ¡

§ Files ¡edited ¡or ¡added ¡

frame/1m/packm/bli_packm_blk_var2.c ¡ frame/1m/packm/bli_packm_blk_var2.h ¡ frame/1m/packm/bli_packm_cxk_cmu.c ¡ frame/1m/packm/bli_packm_cxk_cmu.h ¡ frame/1m/packm/bli_packm_struc_cxk_cmu.c ¡ frame/1m/packm/bli_packm_struc_cxk_cmu.h ¡ frame/1m/packm/ukernels/bli_packm_cxk_cmu_ref.c ¡ frame/1m/packm/ukernels/bli_packm_cxk_cmu_ref.h ¡ frame/ind/include/bli_packm_cmu_macro_defs.h ¡ frame/1m/bli_l1m_N.h ¡ frame/1m/bli_l1m_ker.h ¡ frame/1m/packm/bli_packm.h ¡ frame/1m/packm/bli_packm_cxk.c ¡ frame/include/bli_kernel_macro_defs.h ¡ frame/include/bli_kernel_pre_macro_defs.h ¡ frame/include/bli_kernel_prototypes.h ¡ frame/ind/include/bli_kernel_ind_macro_defs.h ¡ frame/ind/include/bli_packm_ind_pre_macro_defs.h ¡ frame/3/gemm/bli_gemm_cntl.c ¡

Calling ¡sequence ¡

slide-9
SLIDE 9

9/29/17 ¡ 9 ¡

My ¡wish ¡list ¡

§ As ¡easy ¡as ¡adding ¡kernels ¡ § Files ¡to ¡edit ¡or ¡add ¡ § Move ¡from ¡frame ¡to ¡kernel

frame/1m/packm/bli_packm_blk_var2.c ¡ frame/1m/packm/bli_packm_blk_var2.h ¡ frame/1m/packm/bli_packm_cxk_cmu.c ¡ frame/1m/packm/bli_packm_cxk_cmu.h ¡ frame/1m/packm/bli_packm_struc_cxk_cmu.c ¡ frame/1m/packm/bli_packm_struc_cxk_cmu.h ¡ frame/1m/packm/ukernels/bli_packm_cxk_cmu_ref.c ¡ frame/1m/packm/ukernels/bli_packm_cxk_cmu_ref.h ¡ frame/ind/include/bli_packm_cmu_macro_defs.h ¡ frame/1m/bli_l1m_N.h ¡ frame/1m/bli_l1m_ker.h ¡ frame/1m/packm/bli_packm.h ¡ frame/1m/packm/bli_packm_cxk.c ¡ frame/include/bli_kernel_macro_defs.h ¡ frame/include/bli_kernel_pre_macro_defs.h ¡ frame/include/bli_kernel_prototypes.h ¡ frame/ind/include/bli_kernel_ind_macro_defs.h ¡ frame/ind/include/bli_packm_ind_pre_macro_defs.h ¡ frame/3/gemm/bli_gemm_cntl.c ¡

Summary ¡

§ Lighter ¡and ¡more ¡nimble ¡framework ¡ § Refactoring ¡of ¡the ¡packing ¡is ¡proposed ¡ § Inputs ¡from ¡BLIS ¡user ¡and ¡developers ¡wanted ¡

slide-10
SLIDE 10

9/29/17 ¡ 10 ¡

Discussion ¡