LLVM IR and the IoT Dvid Juhsz david.juhasz@imsystech.com 4/2/2018 - - PowerPoint PPT Presentation

llvm ir and the iot
SMART_READER_LITE
LIVE PREVIEW

LLVM IR and the IoT Dvid Juhsz david.juhasz@imsystech.com 4/2/2018 - - PowerPoint PPT Presentation

A unique processor architecture meeting LLVM IR and the IoT Dvid Juhsz david.juhasz@imsystech.com 4/2/2018 1 FOSDEM 2018 LLVM devroom Compiling with LLVM High-Level Programming Language LLVM LLVM Front-end LLVM Assembly / IR LLVM


slide-1
SLIDE 1

A unique processor architecture meeting LLVM IR and the IoT

Dávid Juhász david.juhasz@imsystech.com

4/2/2018 FOSDEM 2018 LLVM devroom 1

slide-2
SLIDE 2

Compiling with LLVM

4/2/2018 FOSDEM 2018 LLVM devroom 2

LLVM

High-Level Programming Language LLVM Assembly / IR Your Typical Target ISA LLVM Front-end LLVM Back-end LLVM Middle-end

slide-3
SLIDE 3

Improving Efficiency by Lifting Target

4/2/2018 FOSDEM 2018 LLVM devroom 3

LLVM

High-Level Programming Language LLVM Assembly / IR Your Typical Target ISA LLVM Front-end LLVM Back-end LLVM Middle-end Imsys ISA for LLVM

slide-4
SLIDE 4

Agenda

  • 1. Imsys Company and the IoT
  • 2. Imsys Lean Processing Technology
  • 3. Imsys ISA for LLVM

4/2/2018 FOSDEM 2018 LLVM devroom 4

slide-5
SLIDE 5

Imsys AB

4/2/2018 FOSDEM 2018 LLVM devroom 5

Device Module IC IP

slide-6
SLIDE 6

Networked Embedded Controllers

4/2/2018 FOSDEM 2018 LLVM devroom 6

slide-7
SLIDE 7

Imsys EMBLA Single Controller Solution for the IoT

4/2/2018 FOSDEM 2018 LLVM devroom 7

slide-8
SLIDE 8

High-Level Software Platform

4/2/2018 FOSDEM 2018 LLVM devroom 8

Application Code C/C++ Java Executable Binary LLVM Integrated Development Environment

slide-9
SLIDE 9

Improving Efficiency by Reducing the ISA Gap

4/2/2018 FOSDEM 2018 LLVM devroom 9

LLVM

High-Level Programming Language LLVM Assembly / IR Your Typical Target ISA LLVM Front-end LLVM Back-end LLVM Middle-end Imsys ISA for LLVM

slide-10
SLIDE 10

Abstraction Layers

4/2/2018 FOSDEM 2018 LLVM devroom 10

Imsys Processor Core Imsys Instruction Set Support ISAL ISAJ Application Code JAVA Assembly/C/C++

slide-11
SLIDE 11

A Forgotten Layer of Abstraction

4/2/2018 FOSDEM 2018 LLVM devroom 11

Software Hardware

Software Microcode Hardware

slide-12
SLIDE 12

The Processor Architect’s Best Friend

4/2/2018 FOSDEM 2018 LLVM devroom 12

IO Microprogram Mult. ALU MEM Ctrl. Addr.

slide-13
SLIDE 13

4/2/2018 FOSDEM 2018 LLVM devroom 13

Microcode, what is it good for?

Complete Deterministic Control Flexibility Soft- Reconfigurability Minimal Hardware Maximum Efficiency

slide-14
SLIDE 14

Abstraction Layers Revisited

4/2/2018 FOSDEM 2018 LLVM devroom 14

Imsys Processor Core Imsys Instruction Set Support Application Code Software Microcode Hardware ISAL

slide-15
SLIDE 15

A Unique Balance between Hardware and Software

4/2/2018 FOSDEM 2018 LLVM devroom 15

Instruction Set Architecture Application

Compiler Microcode

Balanced Rich ISA Domain- specific Operations

Instruction Set Architecture Operation-Oriented Hardware Architecture

slide-16
SLIDE 16

Improving Efficiency by Matching LLVM Assembly

4/2/2018 FOSDEM 2018 LLVM devroom 16

LLVM

High-Level Programming Language LLVM Assembly / IR Your Typical Target ISA LLVM Front-end LLVM Back-end LLVM Middle-end Imsys ISA for LLVM

slide-17
SLIDE 17

4/2/2018 FOSDEM 2018 LLVM devroom 17

LLVM Assembly ISAL

Semantically matching instructions

LLVM back-end for ISAL

Simple, efficient, general LLVM

Matching LLVM Assembly

LLVM middle-end

Direct use of

  • ptimizations
slide-18
SLIDE 18

Meeting a Constrained Reality

4/2/2018 FOSDEM 2018 LLVM devroom 19

LLVM Assembly ISAL Operations Instructions & intrinsic functions Single Value Types Virtually unlimited Set of integer, floating point, pointer, and vector types Registers Unlimited Register windows Arguments Source and destination registers Registers with support of accumulating in source registers, immediate values Binary Representation Bitcode Custom dense binary coding Additional system operations

slide-19
SLIDE 19

Optimized Operation Sequences

4/2/2018 FOSDEM 2018 LLVM devroom 20

a ≔ a + b

  • pcode

dst src1 src2

Accumulating in source register

  • pcode

src1 src2

Immediate values

a ≔ a + 42 move b 42 add a a b add.imm a a 42 add.upd.imm a 42 add a a b add.upd a b

slide-20
SLIDE 20

Optimized Binary Representation

4/2/2018 FOSDEM 2018 LLVM devroom 21 50 100 150 200 250 300 350 400 450 500

Intstruction Lengths (Bytes)

7 198 465 258 161 11 1 4

Number of Instructions

1 2 3 4 5 6 7 8 9 10

Variable-length Instructions

Maximize Code Density Optimize Microcode Size Minimize Execution Time

slide-21
SLIDE 21

0,5 1 1,5 2 2,5 Imsys Cortex-M0+ Cortex-M4 x86 x64 4/2/2018 FOSDEM 2018 LLVM devroom 22

Average Binary Size of TI Suite

ARM Cortex requires 35%+ more, Intel 80%+ more program memory.

slide-22
SLIDE 22

4/2/2018 FOSDEM 2018 LLVM devroom 23

Dávid Juhász david.juhasz@imsystech.com

ISAL Imsys Processor Core Imsys Firmware

Imsys Lean Processing Technology

LLVM Assembly

LLVM back-end for ISAL

Imsys ISA for LLVM

Leaner is Meaner