CourseCode_L2T1H1-12_CellSoftwareDevelopment

Download Report

Transcript CourseCode_L2T1H1-12_CellSoftwareDevelopment

Systems and Technology Group
Cell Software Development Environment
Course Code: L2T1H1-12
Cell Ecosystem Solutions Enablement
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Class Objectives – Things you will learn
 Cell software development environment
– Standards
• Language extensions, SPU ABI, and Linux reference ABI
– Development Environment
• Code development tools, debug tools, performance tools,
and other miscellaneous tools
– Execution Environment
• Linux and CBE extensions, SPE management library, SPE
optimized function libraries, system level simulator, samples,
workloads, and demos
2
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Class Agenda

Cell Software Development Environment

CBE standards
– Application Binary Interface Specifications
– SPE C/C++ Language Extensions
– SPE Assembly Language Specification

System Level Simulator
– SW stack in simulation
– Cell simulator debugging environment

Cell Extensions to Linux

SPE Management Library

Optimized SPE and Multimedia Extension Libraries

Code Development Tools

Bring up Debugging Tools

Performance Tools

IDL Compiler

Sample Source Code

Software Development Kit
References
 Daniel Brokenshire, Cell Broadband Engine, Programming Models and Software Overview
Trademarks - Cell Broadband Engine ™ is a trademark of Sony Computer Entertainment, Inc.
3
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Cell Alpha Software Development Environment
Programmer
Experience
Distributed on IBM alphaworks & Barcelona Super Computer sites
Documentation
End-User
Experience
Code Dev Tools
Development
Environment
Development
Tools Stack
Samples
Workloads
Demos
Debug Tools
Execution
Environment
SPE Optimized Function
LIbraries
Performance Tools
SPE Management Lib
Linux PPC64 with CBE Extensions
Miscellaneous Tools
Standards:
4
System Level Simulator
Language extensions
SPU ABI, Linux Reference ABI
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
CBE Standards
Standards
 Application Binary Interface Specifications
– Defines such things as data types, register usage, calling conventions,
and object formats to ensure compatibility of code generators and
portability of code.
• SPE ABI
• Linux for CBE Reference Implementation ABI
 SPE C/C++ Language Extensions
– Defines standardized data types, compiler directives, and language
intrinsics used to exploit SIMD capabilities in the core.
– Data types and Intrinsics styled to be similar to Altivec/VMX.
 SPE Assembly Language Specification
5
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
System Level Simulator - systemsim
Execution Environment
 Cell BE – full system simulator
– Uni-Cell and multi-Cell simulation
– User Interfaces – TCL and GUI
– Cycle accurate SPU simulation (pipeline mode)
– Emitter facility for tracing and viewing simulation events
6
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
SW Stack in Simulation
Execution Environment
Standard Terminal
Application Source Code
Programming Tools
Modified
Development
Environment:
Programming Model
OpenMP
MPI
Compilers
Modified
Software Stack:
Running
On Mambo
Executables
Runtime and libraries
System Software: Hypervisor, Linux/PPC or K42
System Activity Monitors
CellSim:
Simulation of
hardware
Real Systems:
7
Course Code: L2T1H1-12 Cell Software Development Environment
Traces
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Cell Simulator Debugging Environment
Execution Environment
8
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Verification Hypervisor (vHype)
Execution Environment
 Seamless Integration of Dual
Environments
Logical Partitioning RTOS/Linux
–Low overhead – small
footprint
Networked
Apps.
–Realtime Resource
management
–SPE management
Conventional
Network
OS
(Linux)
I/O Hosting
–Separate policy manager
–Pre-emptive partition
switching on high priority
interrupts
Real time Open Source / Proprietary
OS
Hypervisor
Inter-partition Communications
(Hypervisor - Multi-Partition Resource Allocation / Reservation /Protection)
 Not part of public SDK public
9
Course Code: L2T1H1-12 Cell Software Development Environment
Hardware
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Linux on CBE
 Provided as patched to the 2.6.15 PPC64 Kernel
Execution Environment
– Added heterogeneous lwp/thread model
•
•
•
•
•
SPE thread API created (similar to pthreads library)
User mode direct and indirect SPE access models
Full pre-emptive SPE context management
spe_ptrace() added for gdb support
spe_schedule() for thread to physical SPE assignment
– currently FIFO – run to completion
– SPE threads share address space with parent PPE process (through DMA)
• Demand paging for SPE accesses
• Shared hardware page table with PPE
– PPE proxy thread allocated for each SPE thread to:
• Provide a single namespace for both PPE and SPE threads
• Assist in SPE initiated C99 and POSIX-1 library services
– SPE Error, Event and Signal handling directed to parent PPE thread
– SPE elf objects wrapped into PPE shared objects with extended gld
– All patches for Cell in architecture dependent layer (subtree of PPC64)
10
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Operating System Runtime Strategy
Application Source
& Libraries
 Heterogeneous Multi-Threading Model
PPE Threads, SPE Threads
SPE DMA EA = PPE Process EA Space
OS supports Create/Destroy SPE tasks
Atomic Update Primitives used for Mutex
SPE Context Fully Managed
Context Save/Restore for Debug
Virtualization Mode (indirect access)
Direct Access Mode (realtime)
OS assignment of SPE threads to SPEs
Programmer directed using affinity
mask
SPE Compilers use SPE Management Lib.
11
PPE object files
SPE object files
Cell AwareOS ( Linux)
SPE Virtualization / Scheduling Layer (m->n SPE threads)
Existing PPE
tasks/threads
New SPE tasks/threads
PPE
MT1 MT2
SPE SPE SPE SPE
SPE SPE SPE SPE
Physical PPE
Physical SPEs
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
CBE Extensions to Linux
PPC32 Apps.
Cell32 Workloads
Cell64 Workloads
PPC64 Apps.
• SPE
LibrarySubsystem,
– spe tasks
Programming
ModelsManagement
Offered: RPC, Device
Direct/Indirect Access
• SPUFS
Hetergenous
Single SPU, SPU Groups, Shared Memory
create
group,Threads
create --thread
Filesystem /spu/thread#/
•spe
•open, read, write, close
•spe get/set affinity, get/set context
•mem – access to local storage
SPE
Management
Management Runtime
•spe
get event, get Runtime
group, get_ls, get_ps_area, SPE
get_threads
•regs – access to 128 – 128 bit registers
Library
(32-bit)
Library (64-bit)
•spe get
set priority,
get policy
•/ SPE
Task
Control
System Calls
•mbox – spe->ppe mailbox
•spe group defaults, group
max an spe
•Sys_spu_create_thread
– allocates
•Iiox - spe-> ppe interrupt mailbox
std.
PPC32
std. PPC64
SPE Object Loader
task/context
and
creates
a
directory
in spufs
•spe kill / wait
•xbox_stat - obtain mailbox status
•Sys_spu_run
activates
on a
•spe open
/ –close
imagean SPE task.contextServices
elf interp
elf notification
interp
•signal1 – signal
1 access
physical
SPE
and
blocks
in
the
kernel
as
a
proxy
thread
•spe write signal, read in_mbox, write out_mbox, read mbox
status
64-bit
GNU notification
Libs (glibc) 2 access
•signal2
– signal
32-bit GNU
Libs (glibc,etc)
to handle
SPE events,
mmu faults and errors
•ppe initiated
spe DMAs
•signalx_type – signal type to OR or overwrite
LP64 Processes
ILP32 Processes
System Call Interface
exec Loader
Misc format bin
SPU Object
Loader Extension
64-bit Linux Kernel
File System
Framework
Device
Framework
Network
Framework
Privileged
Kernel
Extensions
• SPUFS
Filesystem
/spu/thread#/
•npc
- read/write
SPE next
program counter
•open,
mmap,
close
•Fpcr – spe floating point control/status register
SPU
Management
Streams
•mem
– spe
problem
state
access to Local Storage
•Decr
–
decrementer
Framework
Framework
•signal1
– direct
application
access
to Signal 1
•decr_status
– spe
decrementer
status
SPUFS
•signal2
– direct –application
Signal 2
•spu_tag_mask
access tagaccess
query to
mask
Filesystem
•cntl
– direct application
access
to SPE controls, DMA
•Event_mask
– access spe
event_mask
SPU Allocation, Scheduling
Queues, mailboxes
•Srr0 – access spe state restore register 0
& Dispatch Extension
Cell BE Architecture Specific Code
Multi-large page, SPE event & fault handling, IIC & IOMMU support
Firmware / Hypervisor
Cell Reference System Hardware
12
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
SPE Management Library
Execution Environment
 SPEs are exposed as threads
– SPE thread model interface is similar to POSIX threads.
– SPE thread consists of the local store, register file, program counter,
and MFC-DMA queue.
– Associated with a single Linux task.
– Features include:
• Threads - create, groups, wait, kill, set affinity, set context
• Thread Queries - get local store pointer, get problem state area pointer, get
affinity, get context
• Groups - create, set group defaults, destroy, memory map/unmap, madvise.
• Group Queries - get priority, get policy, get threads, get max threads per
group, get events.
• SPE image files - opening and closing
 SPE Executable
– Standalone SPE program managed by a PPE executive.
– Executive responsible for loading and executing SPE program. It also
services assisted requests for I/O (eg, fopen, fwrite, fprintf) and
memory requests (eg, mmap, shmat, …).
13
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Optimized SPE and Multimedia Extension Libraries

Execution Environment
Standard SPE C library subset
– optimized SPE C99 functions including stdlib c lib, math and etc.
– subset of POSIX.1 Functions – PPE assisted
14

Audio resample - resampling audio signals

FFT - 1D and 2D fft functions

gmath - mathematic functions optimized for gaming environment

image - convolution functions

intrinsics - generic intrinsic conversion functions

large-matrix - functions performing large matrix operations

matrix - basic matrix operations

mpm - multi-precision math functions

noise - noise generation functions

oscillator - basic sound generation functions

sim – simulator only function including print, profile checkpoint, socket I/O, etc …

surface - a set of bezier curve and surface functions

sync - synchronization library

vector - vector operation functions
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Code Development Tools
 GNU based binutils
Development Environment
– From Sony Computer Entertainment
– gas SPE assembler
– gld SPE ELF object linker
•
ppu-embedspu script for embedding SPE object modules in PPE executables
– misc bin utils (ar, nm, ...) targeting SPE modules
 GNU based C/C++ compiler targeting SPE
– From Sony Computer Entertainment
– retargeted compiler to SPE
– Supports common SPE Language Extensions and ABI (ELF/Dwarf2)
 Cell Broadband Engine Optimizing Compiler (executable)
– IBM XLC C/C++ for PowerPC (Tobey)
– IBM XLC C retargeted to SPE assembler (including vector intrinsics) - highly optimizing
– Prototype CBE Programmer Productivity Aids
•
Auto-Vectorization (auto-SIMD) for SPE and PPE Multimedia Extension code
– spu_timing Timing Analysis Tool
15
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Bringup Debug Tools
Development Environment
• GNU gdb
– Multi-core Application source level debugger supporting
PPE multithreading, SPE multithreading, interacting PPE
and SPE threads
– Three modes of debugging SPU threads
• Standalone SPE debugging
• Attach to SPE thread
– Thread ID output when SPU_DEBUG_START=1
 RISCwatch (not publicly released)
– Low level hardware (JTAG) debugger
16
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
SPE Performance Tools (executables)
Development Environment
 Static analysis (spu_timing)
– Annotates assembly source with instruction pipeline state
 Dynamic analysis (CBE System Simulator)
– Generates statistical data on SPE execution
•
•
•
•
•
Cycles, instructions, and CPI
Single/Dual issue rates
Stall statistics
Register usage
Instruction histogram
 pmcount
– Tool to access to HW performance counters
– Not currently public – being ported to oprofile interface
standard
17
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Miscellaneous Tools – IDL Compiler
Development Environment
18
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Sample Source
Execution Environment
 cesof - the samples for the CBE embedded SPU object format usage
 spu_clean - cleans the SPU register and local store
 spu_entry - sample SPU entry function (crt0)
 spu_interrupt - SPU first level interrupt handler sample
 spulet - direct invocation of a spu program from Linux shell
 sync
 simpleDMA / DMA
 tutorial - example source code from the tutorial
 SDK test suite
– 57 tests
– Exercising all packages in the SDK
19
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Workloads
 FFT16M – optimized 16 M point complex FFT
Execution Environment
 Oscillator - audio signal generator
 Matrix Multiply – matrix multiplication workload
 VSE_subdiv - variable sharpness subdivision algorithm
20
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Bringup Workloads / Demos
 Numerous code samples
provided to demonstrate
system design constructs
Execution Environment
Geometry Engine
 Complex workloads and
demos used to evaluate
and demonstrate system
performance
Physics Simulation
Subdivision Surfaces
Terrain Rendering Engine
21
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Subsystem Sample – Geometry Engine
 OpenGL-like geometry engine
Execution Environment
–Geometry processing is offloaded to compile-time configurable SPE
“vertex shader”
–User Queue communication model consisting of 4KB blocks for SPU
command requests with command headers in SPE Mailbox FIFO
–Not released in public SDK
PPE
SPE
G
E
PPE
Application
22
L
I
B
System
Memory
User
Queues
GE
Shader
Course Code: L2T1H1-12 Cell Software Development Environment
Viewer
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
CBE Software Developers Kit Release

alphaWorks site: All ILA and CPL packages
–
IBM Full System Simulator for the CBE Processor
•
–
gcc and binutils for the Cell Broadband Engine
•
–
–
–
23
Executable - ILA for early release program
Barcelona Super Computer Center (GPL,LGPL)
–

Source - CPL v1.0
IBM SPU instruction timing tool
•

Executable - ILA for early release program
IBM CBE Software Samples and Libraries
•
–
Execution Environment
IBM XL C Alpha Edition for the CBE Processor
•
–
Executable - ILA for early release program
From Sony Computer Entertainment
Cell Broadband Engine SPE Management Library
Linux Patches for Cell Broadband Engine
SDK Installation Script
IBM developerWorks (CBE documentation)
– Getting Started with CBE – Installing the CBE Programming Environment
– Cell Broadband Engine Standards and Documentation
• Linux CBE Reference Implementation ABI Specification
• CBE Registers
• CBE Architecture v1.0
• SPU Instruction Set Architecture v1.0
• SPU ABI Specification v1.4
• SPU Assembly Language Specification v1.3
• SPU C/C++ Language Extension Specification v2.1
• PowerPC Architecture Books 1-3 v2.02
• PowerPC Vector/SIMD Multimedia Extension Technology PEM
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
Testing Environment for Public SDK
Simulator only
Hardware only
Same binary
Native Dev Env.
System tests
System tests
Sample / Libraries / Workloads
Sample / Libraries / Workloads
Passthru
24
(Sys. SIM subset)
(Sys. SIM subset) Full App Env.
Libspe
Libspe
Kernel (2.6.14)
Kernel (2.6.14)
Simulator Firmware
Cell Blade Firmware
Sim. devices + drivers
IDE/Ethernet devices + drivers
Sys. SIM / x86
CBE on Cell Blade
Cell Simulator
Native platform
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation
Systems and Technology Group
(c) Copyright International Business Machines Corporation 2006.
All Rights Reserved. Printed in the United Sates September 2006.
The following are trademarks of International Business Machines Corporation in the United States, or other countries, or both.
IBM
IBM Logo
Power Architecture
Other company, product and service names may be trademarks or service marks of others.
All information contained in this document is subject to change without notice. The products described in this document are
NOT intended for use in applications such as implantation, life support, or other hazardous uses where malfunction could result
in death, bodily injury, or catastrophic property damage. The information contained in this document does not affect or change
IBM product specifications or warranties. Nothing in this document shall operate as an express or implied license or indemnity
under the intellectual property rights of IBM or third parties. All information contained in this document was obtained in specific
environments, and is presented as an illustration. The results obtained in other operating environments may vary.
While the information contained herein is believed to be accurate, such information is preliminary, and should not be relied
upon for accuracy or completeness, and no representations or warranties of accuracy or completeness are made.
THE INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED ON AN "AS IS" BASIS. In no event will IBM be liable
for damages arising directly or indirectly from any use of the information contained in this document.
IBM Microelectronics Division
1580 Route 52, Bldg. 504
Hopewell Junction, NY 12533-6351
25
The IBM home page is http://www.ibm.com
The IBM Microelectronics Division home page is
http://www.chips.ibm.com
Course Code: L2T1H1-12 Cell Software Development Environment
7/7/2015
© 2006 IBM Corporation