IntroductionIntroduction toto IAIA--3232 andand IAIA--64:64: ArchitecturesArchitectures,, ToolsTools andand LibrariesLibraries

G. Hager (RRZE), H. Bast () Outline

ƒ IA-32 Architecture ƒ Architectural basics ƒ Optimization with SIMD operations

ƒ Why Multi-Core?

ƒ Intel IA64 () Architecture

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 2 IAIA--3232 IA-32 Architecture Basics – a Little History

ƒ IA-32 has roots dating back to the early 80s ƒ Intel‘s first 16-bit CPU: 8086 with 8087 math coprocessor ( is born) ƒ Even the latest 4 is still binary compatible with 8086 ƒ loads of advances over the last 20 years: ƒ addressing range (1MB → 16MB → 64 GB) ƒ protected mode (80286) ƒ 32 bit GPRs and usable protected mode (80386) ƒ on-chip caches (80486) ƒ SIMD extensions and superscalarity (Pentium) ƒ CISC-to-RISC translation and out-of-order superscalar processing () ƒ floating-point SIMD with SSE and SSE2 (Pentium III/4) ƒ Competitive High Performance Computing was only possible starting with Pentium III ƒ IA32 processors ( 2, AMD K10) are today rivaling all other established processor architectures

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 4 IA-32 Architecture Basics

ƒ IA-32 has a CISC instruction set ƒ „Complex Instruction Set Computing“ ƒ Operations like „load value from memory, add to register and store result in register“ are possible in one single machine instruction ƒ Huge number of assembler instructions ƒ Very compact code possible ƒ Hard to interpret for CPU hardware, difficulties with out-of-order processing ƒ Since Pentium Pro, CISC is translated to RISC (called μOps here) on the fly ƒ „Reduced Instruction Set Computing“ ƒ Very simple instructions like „load value from memory to register“ or „add two registers and store result in another“ ƒ RISC instructions are held in a reorder buffer for later out-of-order processing

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 5 IA-32 Architecture Basics: block diagram (one core) Intel Core 2 architecture ƒ Successor of Netburst ƒ Reduced pipeline length ƒ Improved instruction issue ƒ Double FP performance ƒ Instruction level parallelism: 4μops issue/cycle ƒ Desktop variants (45 nm) ƒ Core2Duo „Wolfdale“ ƒ Core2Quad „“ ƒ Top bin: 3 GHz

Source: Intel Corp.

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 6 IA-32 Architecture Basics: AMD K10 block diagram (one core) AMD K10 architecture ƒ To be used in first native Quad-Core („Barcelona“) ƒ L3 cache shared by all 4 cores ƒ There are only a few „Barcelona“ systems in field…(one at RRZE)

ƒ Top bin: 2.0 GHz

Source: AMD

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 7 IA-32 Architecture Basics

ƒ This seems to be quite an ordinary architecture. It features ƒ caches (instruction/data) ƒ register files ƒ functional units for integer & FP operations ƒ a memory

ƒ What‘s special about the Core 2 Duo / K10 ? ƒ high clock frequency (currently 3.0 / 2.0 GHz) ƒ special SIMD (Single Instruction Multiple Data) functional units and registers enable “vector computing for the masses” ƒ Architectural enhancements ƒ Low cache latencies ƒ Opcode fusion ƒ AMD: on-chip memory controllers ƒ Large caches

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 8 IA-32 Architecture Basics: Floating Point Operations and SIMD ƒ First SIMD implementation: Pentium MMX ƒ SIMD registers shared with FP stack ƒ Switch between SIMD and FP mode was expensive overhead ƒ Nobody should use this any more ƒ „Sensible SIMD“ came about with SSE (Pentium III) and SSE2 () – Streaming SIMD Extensions ƒ Register Model: ƒ Each register can be xmm0 xmm1 partitioned into several integer xmm2 or FP data types xmm3 xmm4 ƒ 8 to 128-bit integers … ƒ single (SSE) or double xmm14 precision (SSE2) floating point xmm15 ƒ SIMD instructions can operate 128 bits on the lowest or all partitions of a register at once

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 9 IA-32 Architecture Basics: SIMD Operations ƒ Possible data types in an SSE register

16x 8bit

8x 16bit

4x 32bit

2x 64bit integer

1x 128bit

4x 32 bit point

2x 64 bit floating

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 10 IA-32 Architecture Basics: Floating Point Operations and SIMD ƒ Example: Single precision FP packed vector addition

x3 x2 x1 x0 xmm0

y3 y2 y1 y0 xmm1

+ + + +

x3 + y3 x2 + y2 x1 + y1 x0 + y0 xmm1

ƒ xi and yi are single precision FP numbers (4 per SSE register) ƒ Four single precision FP additions are done in one single instruction ƒ Core 2: 4-cycle latency & 1-cycle throughput for double precision SSE2 MULT & ADD leading to a peak performance of 4 (DP) FLOPs/cycle

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 11 IA-32 Architecture Basics: Floating Point Operations and SIMD ƒ In addition to packed SIMD operations, scalar operations are also possible ƒ operate on lowest item only! ƒ alternative for non-vectorizable codes (still better than ) ƒ Observe alignment constraints ƒ Loads/stores exist in aligned (fast) and unaligned (slower) variants ƒ AMD K10: no penalty for unaligned loads on 8-byte boundaries ƒ Significant performance boost achievable by using SSE(2)! ƒ hardly any gain for out of cache performance expected (but see below) ƒ see later for compiler options concerning SSE ƒ Another SSE feature: Non-temporal stores ƒ Bypass all cache levels; must be aligned ƒ AMD K10: Scalar NT store available! ƒ Good for “streaming” applications with no temporal locality

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 12 IA-32 Architecture Basics Triads Performance: REPEAT[A(:) = B(:) + C(:) * D(:)]

Effect of packed SIMD loads

Theoretical limits (from cache/memory BW)

NT stores good NT stores bad for streaming in cache data

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 13 IA-32 Architecture Basics: Programming With SIMD Extensions ƒ When given correct options, compiler will automatically try to vectorize simple loops ƒ Rules for vectorizability similar as for SMP parallelization or "real" vector machines ƒ See compiler documentation ƒ SIMD can also be used directly by the programmer if compiler fails ƒ Several alternatives: ƒ Assembly language For experts only ƒ Compiler Intrinsics Map closely to assembler instructions, programmer is relieved of working with registers directly. ƒ C++ class data types and operators High-level interface to SIMD operations. Easy to use, but restricted to C++.

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 14 IA-32 Architecture Basics: Programming With SIMD Extensions ƒ Special C++ data types map to SSE registers ƒ FP types:

F32vec4 4 single-precision FP numbers F32vec1 1 single-precision FP number F64vec2 2 double-precision FP numbers

ƒ Integer types: Is32vec4, Is64vec2, etc. ƒ C++ operator+ and operator* are overloaded to accomodate operations on those types ƒ programmer must take care of remainder loops manually ƒ Alignment issues arise when using SSE data types ƒ compiler intrinsics and command line options control alignment ƒ uncontrolled unaligned access to SSE data will induce runtime exceptions!

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 15 IA-32 Architecture Basics: Programming With SIMD Extensions ƒ A simple example: vectorized array summation ƒ Original code (compiler-vectorizable): double asum(double *x, int n) { int i; double s = 0.0; for(i=0; i double asum_simd(double *x, int n) { int i; double s = 0.0; F64vec2 *vbuf = (F64vec2*)x; remainder loop F64vec2 accum(0.,0.); for(i=0; i

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 16 IA-32 Architecture Basics: Programming With SIMD Extensions ƒ Alignment issues ƒ alignment of arrays in SSE calculations should be on 16-byte boundaries ƒ other alternatives: use explicit unaligned load operations (not covered here) ƒ How is manual alignment accomplished? ƒ 2 alternatives ƒ manual alignment of structures and arrays with

__declspec(align(16)) ;

ƒ dynamic allocation of aligned memory (align=alignment boundary)

void* _mm_malloc (int size, int align); void _mm_free (void *p);

… or just use the standard memalign() 17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 17 SharedShared--MemoryMemory SystemSystem ArchitecturesArchitectures usingusing Intel64/AMD64Intel64/AMD64 ProcessorsProcessors AMD Opteron (K10) Systems

ƒ Typical cluster configuration: 2-socket node ƒ 8 cores ƒ 2 memory locality domains ƒ Connected via HyperTransport P P P P P P P P C C C C C C C C ƒ Shared L3 caches per socket C C C C C C C C C C ƒ ccNUMA MI MI ƒ Local vs. non-local memory access

ƒ Potential congestion Memory Memory ƒ Thread/process pinning is essential ƒ For details on ccNUMA programming, see the talk on Thursday

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 24 Intel “Woodcrest” (Ducl-Core Core2) Systems

ƒ Typical cluster configuration: 2-socket system ƒ 4 cores ƒ FSB1333 (10.7 GB/s) ƒ Theoretical bandwidth of 21.3 GB/s per system P P P P ƒ Application-level bandwidth C C C C of < 45% of peak C C ƒ Overall memory bandwidth does not scale perfectly Chipset from 1Æ2 sockets ƒ , but: ƒ Shared L2 per dual core Memory ƒ Makes thread placement an issue in spite of flat memory

ƒ End of 2008: Intel will “go ccNUMA” as well!

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 25 WhyWhy MultiMulti--Core?Core? Multi-core processors The party is over!

• Problem: Moore’s law is still valid but increasing clock speed hits a technical wall (heat) • Solution: Reduce clock speed of processor but put 2 (or more) processors (cores) on a single silicon die Clock speed of single core will decrease in future! (/Netburst: max. 3.73 GHz -> Xeon/Core: max. 3.0 GHz)

MainMS Memory

„DRAM Gap“ Processor chip L2 cache

L1 cache L1 cache

FP FP register register arithmetic arithmetic unit unit Intel Xeon / Core2 (“Woodcrest”)

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 27 Multi-core processors The party is over!

By courtesy of D. Vrsalovic, Intel

Performance Power

1.00x

Max Frequency

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 28 Multi-core processors The party is over!

By courtesy of D. Vrsalovic, Intel

1.73x Performance Power

1.13x 1.00x

Over-clocked Max Frequency (+20%)

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 29 Multi-core processors The party is over!

By courtesy of D. Vrsalovic, Intel

1.73x Performance Power

1.13x 1.00x 0.87x

0.51x

Over-clocked Max Frequency Under-clocked (+20%) (-20%)

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 30 Multi-core processors The party is over!

By courtesy of D. Vrsalovic, Intel

Dual-Core 1.73x Performance 1.73x Power

1.13x 1.00x 1.02x

Over-clocked Max Frequency Dual-core (+20%) (-20%)

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 31 Power dissipation in VLSI Circuits

ƒ In CMOS VLSIs, power dissipation is proportional to clock frequency: W ∝ fc

ƒ Moreover, it is proportional to 2 supply voltage squared: W ∝ Vcc

ƒ For reasons of noise immunity, supply voltage has to grow linearly with frequency, so: 3 W ∝ fc

ƒ Frequency reduction is the key to saving power with modern ƒ all other factors, e.g. manufacturing technology, unchanged ƒ This seems to contradict the verdict of ever-growing chip performance

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 32 Multi-Core Processors

ƒ Question: What fraction of performance must be sacrificed per core in order to benefit from m W + ΔW = (1+ ε )3W cores? f 3 ƒ Prerequisite: Overall power (1+ ε f ) m =1 dissipation should be unchanged

−1/3 ƒ W power dissipation ε f = m −1 p performance (1 core) p performance (m cores) m p = (1+ ε ) pm εf rel. frequency change ∆fc/fc m p εp rel. performance change ∆p/p 1 m number of cores p ≥ p ⇒ ε ≥ −1 m p m

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 33 Why Multi-Core?

ƒ Required relative frequency reduction vs. core count

ƒ

Available today

ƒ Remember the assumptions that go into this model!

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 34 Multi-core processors A challenging future ahead?

Courtesy of Intel

Scalar plus many core for Large, Scalar cores for highly threaded workloads high single-thread Intel Tera-Scale Computing performance Research Program

Many-core array • CMP with 10s-100s low power cores • Scalar cores • Capable of TFLOPS+ Multi-core array • Full System-on-Chip • CMP with ~10 cores • Servers, workstations, embedded… Dual core • Symmetric multithreading Evolution

Parallelization will be mandatory for everyone in the future ! 17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 35 IAIA--64:64: Intel'sIntel's ItaniumItanium ArchitectureArchitecture

H. Bast (Intel), G. Hager (RRZE) Itanium® Processor Architecture Selected Features

ƒ 64-bit Addressing Flat Memory Model ƒ Instruction Level Parallelism (6-way) ƒ Large Register Files ƒ Automatic Register Stack Engine ƒ Predication ƒ Software Pipelining Support ƒ Register Rotation ƒ Loop Control Hardware ƒ Sophisticated Branch Architecture ƒ Control & Data Speculation ƒ Powerful 64-bit Integer Architecture ƒ Advanced 82-bit Floating Point Architecture ƒ Multimedia Support (MMX™ Technology)

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 37 Traditional Architectures: Limited Parallelism

Original Source Sequential Machine Code Code Hardware

Compile parallelizedparallelized codecode

multiple functional units

Execution Units Available- . . . . Used Inefficiently . . . .

Consequence: Current processors are often 60% idle

17.03.2008 © LRZ/RRZE/Intel 2008 Intel Architectures Intel® Itanium® Architecture: Explicit Parallelism

Original Source Parallel Machine Code Code Compile

Compiler Hardware multiple functional units

Itanium Architecture More efficient use of . . . . compiler views . . . . execution resources . . . . wider scope EnhancesEnhances ParallelParallel ExecutionExecution

17.03.2008 © LRZ/RRZE/Intel 2008 Intel Architectures EPIC Instruction Parallelism

Source Code

Instruction Groups „ No RAW or WAW dependencies (series of bundles) dependencies „ Issued in parallel depending on resources

Instruction „ 3 instructions + Bundles template (3 Instructions) „ 3 x 41 bits + 5 bits = 128 bits

UpUp toto 66 instructionsinstructions executedexecuted perper clockclock

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 40 Instruction Level Parallelism

ƒ Instruction Groups ƒ No mutual dependencies instr 1 // 1st. group instr 2;; // 1st. group ƒ Delimited by ‘stops’ in assembly code instr 3 // 2nd. group ƒ Instructions in groups issued in parallel, depending on available resources. instr 4 // 2nd. group ƒ Instruction Bundles ƒ 3 instructions and 1 template in 128-bit bundle { .mii ld4 r28=[r8] // load ƒ Instruction dependencies by using ‘stops’ add r9=2,r1 // Int op. ƒ Instruction groups can span multiple bundles add r30=1,r1 // Int op. }

128 bits (bundle)

Instruction 2 Instruction 1 Instruction 0 template 41 bits 41 bits 41 bits 5 bits

MemoryMemory (M)(M) MemoryMemory (M)(M) IntegerInteger (I)(I) (MMI)

17.03.2008 © LRZ/RRZE/Intel 2008 Intel Architectures Large Register Set

General Floating-point Predicate Branch Registers Registers Registers Registers NaT 64-bit 82-bit 64-bit GR0 0 FR0 + 0.0 PR0 1 BR0 GR1 FR1 + 1.0 PR1 BR7 GR31 FR31 PR15 GR32 FR32 PR16 Application Registers 64-bit PR63 GR127 FR127 AR0 AR1

32 Static 32 Static 16 Static AR31 AR32 96 Stacked 96 Rotating 48 Rotating

AR127 17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 42 Predication

ƒ Predicate registers activate/inactivate instructions

ƒ Predicate Registers are set by Compare Instructions

ƒ Example: cmp.eq p1,p2 = r2,r3

ƒ (Almost) all instructions can be predicated:

(p1) ldfd f32=[r32],8 (p2) fmpy.d f36=f6,f36

ƒ Predication: ƒ eliminates branching in if/else logic blocks ƒ creates larger code blocks for optimization ƒ simplifies start up/shutdown of pipelined loops

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 43 Predication

ƒ Code Example: absolute difference of two numbers

Non-Predicated C Code if (r2 >= r3) Pseudo Code r4 = r2 - r3; cmpGE r2, r3 else jump_zero P2 r4 = r3 - r2; P1: sub r4 = r2, r3 jump end P2: sub r4 = r3, r2 Predicated Assembly Code end: ... cmp.ge p1,p2 = r2,r3 ;; (p1) sub r4 = r2,r3 (p2) sub r4 = r3, r2

PredicationPredication RemovesRemoves Branches,Branches, EnablesEnables ParallelParallel ExecutionExecution

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 44 Register Stack

ƒ GRs 0-31 are global to all procedures ƒ Stacked registers begin at GR32 and are local to each procedure 96 Stacked ƒ Each procedure’s register stack frame varies from 0 127 to 96 registers ƒ Only GRs implement a register stack PROC B ƒ The FRs, PRs, and BRs are global to all procedures Overlap ƒ Register Stack Engine (RSE) ƒ Upon stack overflow/underflow, registers are saved/restored PROC A to/from a backing store transparently 32 31 32 Global 0

OptimizesOptimizes thethe Call/ReturnCall/Return MechanismMechanism

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 45 Register Stack Engine at Work

ƒ Call changes frame to contain only the caller’s output ƒ Alloc instr. sets the frame region to the desired size ƒ Three architecture parameters: local, output, and rotating ƒ Return restores the stack frame of the caller

56 Outputs 48 Virtual Local 52 52 Outputs Outputs (Inputs) Outputs 46 32 32 46

Local Local

(Inputs) (Inputs) 32 Call Alloc Ret 32 PROC APROC B PROC B PROC A

Can improve performance for OOP (C++, Java)

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 46 Register rotation

ƒ Example: 8 general registers ƒ Floating point and predicate rotating, counted loop (br.ctop) registers ƒ Always rotate the same set of Before: After br.ctop taken: registers ƒ FR 32-127 gr32 gr32 123 29 ƒ Rotate in the same direction as 8189 123 gr33 gr33 general registers gr34 0 8189 gr34 ƒ highest rotates to lowest 99 0 gr35 gr35 register number gr36 abc 99 gr36 ƒ all other values rotate gr37 gr37 9ad6 abc towards larger register gr38 beef 9adc gr38 numbers gr39 29 Wraparound beef gr39 ƒ Rotate at the same time as 4567 4567 gr40 gr40 general registers (at the modulo- gr41 818 818 gr41 scheduled loop instruction) ......

......

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 47 Software Pipelining

Sequential Loop Software-Pipelined Loop load compute store Time Time Time Time

ƒ Traditional architectures use loop unrolling ƒ Results in code expansion and increased I-cache misses ƒ Itanium™ Software Pipelining uses rotating registers ƒ Allows overlapping execution of multiple loop instances ƒ compiler diagnostics help identify pipelining problems (later talk)

IIItanium™taniumtanium™™ providesprovides provides directdirectdirect supportsupportsupport forforfor SoftwareSoftwareSoftware PipeliningPipeliningPipelining 17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 48 Itanium® Hardware Data Types

64-bit Integer

2x32-bit SIMD Integer

4x16-bit SIMD Integer

8x8-bit SIMD Integer

64-bit DP F.P.

2x32-bit SP F.P.

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 53 SIMD - Integer

ƒ Exploits data parallelism with SIMD (Single Instruction Multiple Data) ƒ Performance boost for audio, video, imaging etc. functions ƒ GRs treated as 8x8, 4x16, or 2x32 bit elements ƒ Several instruction types 64 bits ƒ Addition and subtraction, multiply 8x8, 4x16, or 2x32 ƒ Pack/Unpack ƒ Left shift, signed/unsigned right shift a3 a2 a1 a0 ƒ Compatible with Intel MMX™ Technology + b3 b2 b1 b0 Available via compiler intrinsics! a3+b3 a2+b2 a1+b1 a0+b0

17.03.2008 © LRZ/RRZE/Intel 2008 Intel Architectures Floating-Point Architecture

ƒ 128 Floating Point registers (82 bit) ƒ Single, double, double-extended data types ƒ Full IEEE.754 compliance

ƒ Arithmetic ƒ FMA – Fused Multiply-Add instruction f = a * b + c ƒ 2 independent FP units ƒ up to 4 DP operations per cycle ƒ up to 4 DP FP operands loded per clock ƒ SW DIV / SQRT, provide high throughput, take advantage of wide FP machine ƒ MAX, MIN instructions for floating point

ƒ Data transfer ƒ load, store, GR ⇔ FR conversion; load pair to double data

17.03.2008 © LRZ/RRZE/Intel 2008 Intel Architectures Floating Point Features

2 stores/clk 6 x 82-bit operands

Up to even 128 entry 9MB L2 L3 82-bit Cache odd Cache RF

2 DP 4 DP Ops/clk Ops/clk (2 x Fld-pair) 2 x 82-bit results

L1D cache not used for FP data!

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 56 Some Floating Point Latencies

Operation Latency

FP Load (L2 Cache hit) 6

FMAC,FMISC 4

FP → Int (getf) 5

Int → FP (setf) 6

Fcmp to branch 2 Fcmp to qual pred 2

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 57 L2 and L3 Cache

ƒ L2: 256KB, 32GBs, 5-7 clk ƒ Data array is banked - 16 banks of 16KB each ƒ : Separation of Data/Instruction cache ƒ Non-blocking / out-of-order ƒ L2 queue (32 entries) - holds all in-flight load/stores ƒ out-of-order service - smoothes over load/store/bank conflicts, fills ƒ Can issue/retire 4 stores/loads per clock ƒ Can bypass L2 queue (5,7,9(5,7, clk bypass) if ƒ no address or bank conflicts in same issue group ƒ no prior ops in L2 queue want access to L2 data arrays ƒ Up to 9 (12) MB L3, 32GBs,12-13 clk cache on die ƒ Single ported – full cache line transfers

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 58 Itanium® 2 Caches – Summary

L1I L1D L2 L3 Size 16K 16K 256K 1.5/3/6M/9M on (1M L2I on Montecito) die Line Size 64B 64B 128B 128B Ways 4 4 8 4 or 2 per MB Replacement LRU NRU NRU NRU

Latency I-Fetch:1 INT:1 INT: 5 12/13 (load to use) FP: 6

Write Policy - WT (RA) WB (WA+RA) WB (WA)

Bandwidth R: 32 GBs R: 16 GBs R: 32 GBs R: 32 GBs W: 16 GBs W: 32 GBs W: 32 GBs

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 59 TLBs

ƒ 2-level TLB hierarchy ƒ DTC/ITC (32/32 entry, fully associative, 0.5 clk) ƒ Small fast translation caches tied to L1D/L1I ƒ Key to achieving very fast 1-clk L1D, L1I cache accesses ƒ DTLB/ITLB (128/128 entry, fully associative, 1 clk) ƒ All architected page sizes (4K to 4GB) ƒ standard page size = 16 kB → TLB can cache 2 MB ƒ Supports up to 64/64 ITR/DTRs ƒ TLB miss starts hardware page walker

SmallSmall fastfast TLBsTLBs enableenable lowlow latencylatency caches,caches, butbut TLBTLB missesmisses mightmight bebe anan issueissue

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 62 Itanium® 2 Block Diagram

L1 Instruction Cache and ECC ECC ITLB Fetch/Pre-fetch Engine IA-32 Branch Instruction Decode Prediction 8 bundles Queue and Control 11 Issue Ports B B B M M M M I I F F

Register Stack Engine / Re-Mapping

Branch & Predicate Registers 128 Integer Registers 128 FP Registers L3 Cache

Branch Integer Quad-Port Units and L1 L2 Cache – Quad Port MM Units Data Floating ALAT

,NaTs, Exceptions Cache Point Scoreboard, Predicate and Units ECC ECC DTLB

ECC ECC ECC Bus Controller

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 65 Itanium2: Intel´s current 64 Bit processor Application Performance Peculiarities ƒ Some dos and don'ts for Itanium2

ƒ Do try to use FMA where possible; formulate your inner loops in an FMA-friendly way ƒ Avoid very short, tight inner loops; if a short trip count cannot be avoided, try to unroll outer loops to make the body fatter ƒ When working in L2 cache, try different array paddings; due to banked L2 layout, significant performance boosts can be achieved by not hitting the same bank in every loop iteration ƒ With current Intel compilers, try to avoid too many synchronization points in OpenMP programs – locks and barriers tend to be slow ƒ Use !DIR$ IVDEP when applicable (indirect array access)

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 67 Itanium2: Intel´s current 64 Bit processor Triads Performance at Different Array Paddings

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 68 References

ƒ R. Gerber: The Software Optimization Cookbook. High Performance Recipes for the Intel Architecture. Intel Press (2002) ƒ good introduction, must be complemented with compiler and architecture documentation ƒ W. Triebel et al: Programming Itanium-based Systems. Developing High Performance Applications for Intel‘s New Architecture. Intel Press (2001) ƒ extremely detailed, suitable for assembler programmers ƒ slightly outdated ƒ http://developer.intel.com/ ƒ tutorials, manuals, white papers, discussion forums etc. ƒ c‘t Magazine 13/2003, several articles (25th birthday of Intel‘s x86 architecture)

17.03.2008 © LRZ/RRZE/Intel 2008Intel Architectures 69