梁存铭Intel - Core - effeciency PDF
梁存铭Intel - Core - effeciency PDF
梁存铭Intel - Core - effeciency PDF
Liang Cunming
2015.04.21
Legal Disclaimer
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS
DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING
TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER
INTELLECTUAL PROPERTY RIGHT.
A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, in personal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION
CRITICAL APPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THE DIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS
COSTS, DAMAGES, AND EXPENSES AND REASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONAL INJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH
MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITS SUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITS PARTS.
Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined". Intel
reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize
a design with this information.
The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.
Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.
Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or go to: http://www.intel.com/design/literature.htm%20
Performance tests and ratings are measured using specific computer systems and/or components and reflect the approximate performance of Intel products as measured by those tests. Any difference in system hardware
or software design or configuration may affect actual performance. Buyers should consult other sources of information to evaluate the performance of systems or components they are considering purchasing. For more
information on performance tests and on the performance of Intel products, visit Intel Performance Benchmark Limitations
All products, computer systems, dates and figures specified are preliminary based on current expectations, and are subject to change without notice.
Celeron, Intel, Intel logo, Intel Core, Intel Inside, Intel Inside logo, Intel. Leap ahead., Intel. Leap ahead. logo, Intel NetBurst, Intel SpeedStep, Intel XScale, Itanium, Pentium, Pentium Inside, VTune, Xeon, and Xeon Inside are
trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.
IntelActive Management Technology requires the platform to have an IntelAMT-enabled chipset, network hardware and software, as well as connection with a power source and a corporate network connection. With
regard to notebooks, Intel AMT may not be available or certain capabilities may be limited over a host OS-based VPN or when connecting wirelessly, on battery power, sleeping, hibernating or powered off. For more
information, see http://www.intel.com/technology/iamt.
64-bit computing on Intel architecture requires a computer system with a processor, chipset, BIOS, operating system, device drivers and applications enabled for Intel64 architecture. Performance will vary depending on
your hardware and software configurations. Consult with your system vendor for more information.
No computer system can provide absolute security under all conditions. IntelTrusted Execution Technology is a security technology under development by Intel and requires for operation a computer system with Intel
Virtualization Technology, an Intel Trusted Execution Technology-enabled processor, chipset, BIOS, Authenticated Code Modules, and an Intel or other compatible measured virtual machine monitor. In addition, Intel Trusted
Execution Technology requires the system to contain a TPMv1.2 as defined by the Trusted Computing Group and specific software for some uses. See http://www.intel.com/technology/security/ for more information.
Hyper-Threading Technology (HT Technology) requires a computer system with an IntelPentium4 Processor supporting HT Technology and an HT Technology-enabled chipset, BIOS, and operating system. Performance
will vary depending on the specific hardware and software you use. See www.intel.com/products/ht/hyperthreading_more.htm for more information including details on which processors support HT Technology.
IntelVirtualization Technology requires a computer system with an enabled Intelprocessor, BIOS, virtual machine monitor (VMM) and, for some uses, certain platform software enabled for it. Functionality, performance or
other benefits will vary depending on hardware and software configurations and may require a BIOS update. Software applications may not be compatible with all operating systems. Please check with your application
vendor.
* Other names and brands may be claimed as the property of others.
Other vendors are listed by Intel as a convenience to Intel's general customer base, but Intel does not make any representations or warranties whatsoever regarding quality, reliability, functionality, or compatibility of these
devices. This list and/or these devices may be subject to change without notice.
Copyright 2014, Intel Corporation. All rights reserved.
Platform
Efficientcy
2
0
Latency
Virturlization
CPU Efficiency
1. Reducing stalled
cycles
2. Managing idle loop
3. Leverage HW offload
Practice Sharing
SIMD in Packet IO
AVX2 memcpy
Dynamic frequency adaption
Preemptive task switch
Interrupt Packet IO
Gain from csum offload
1. Stalled Cycles
1. Stalled Cycles
Vector Integer
Multiply
Store Data
Slow
Fast LEA
Shift
FP & INT
Shuffle
Branch
Port 7
Branch
Port 6
FMA / FP MUL/
FP Add
Load/STA
Port 5
FMA /
FP Multiply
Load/STA
Port 4
Fast LEA
Port 3
Shift
Divide
Port 2
Port 1
Port 0
Integer ALU &
Store Address
Vector Integer
Integer
Vector Integer
ALU
ALU
Vector Logical
Vector Logical
Vector Logical
Vector Shifts
Metric
Nehalem
SNB
HSW
Instruction Cache
32K
32K
32K
32K
32K
32K
4/5/7
4/5/7
4/5/7
No index / nominal
/ non-flat seg
16+16
32+16
64+32
2 loads + 1 store
256K
256K
256K
10
12
12
Nominal load
BW (bytes/cycle)
32
32
64
Bandwidth
(bytes/cycle)
L2 Unified Cache
(MLC)
https://www-ssl.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html
Comments
1. Stalled Cycles
Load
ALU
Store
Load
ALU
Store
Load
ALU
Store
Load
ALU
Store
+1
cycle cache
latency
Load
Stall
ALU
Store
Load
Stall
ALU
Store
Load
Stall
ALU
Store
Load
Load
ALU
Store
Store
Store
Store
Load
Load
ALU
ALU
ALU
+4
cycle cache
latency
Load
Stall
Stall
Stall
Stall
ALU
Store
+4
cycle cache
latency
Load
Load
Stall
Stall
Store
Store
Load
Load
Stall
Stall
ALU
ALU
ALU
ALU
hide latency
Store
Load
Stall
Stall
Stall
Stall
ALU
Stall
Store
ALU
Store
Store
Time
save half time
save ~60% time
1. Stalled Cycles
Straightforward
implementation
Linear execution
Check multiple
descriptors at a
time?
Vector copies?
What happens when you poll much faster than the rate at which
packets are coming in?
Every received packed will result in modification of a descriptor
cache line (to write new buffer address) likely in the same cache
line that the NIC is reading. These conflicts should be avoided.
Desc A
Desc B
Desc C
CACHE LINE
Desc D
1. Stalled Cycles
Loops unroll
Easy to do bulk copies
Easier to vectorize
1. Stalled Cycles
Growth
IPV4-COUNT-BURST
60
120.00%
50
100.00%
40
80.00%
IPV6-COUNT-BURST
40
35
30
Mbps
25
30
60.00%
20
40.00%
20
15
10
10
20.00%
0.00%
Base
Bulk
5
0
S-OLD
Vector
V-OLD
V-NEW
Disclaimer: Software and workloads used in performance tests may have been optimized for performance only
on Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific
computer systems, components, software, operations and functions. Any change to any of those factors may
cause the results to vary. You should consult other information and performance tests to assist you in fully
evaluating your contemplated purchases, including the performance of that product when combined with other
1. Stalled Cycles
Utilized 256-bit
load/store
Forced 32-byte aligned
store to improve
performance
Improved control flow to
reduce copy bytes
(Eliminate unnecessary
MOVs)
Resolved performance
issue at certain odd
sizes
32B aligned
C2C
new
current
glibc
1.85
1.24
1.00
C2M
4.57
4.06
1.00
M2C
1.26
1.14
1.00
M2M
2.62
2.41
1.00
2. Idle Loop
Effective Way
2. Idle Loop
123W
245W
100%
platform
power with
traffic
best
perf/wat
t
Idle Scenario
L3fwd busy-wait loop
consumes unnecessary cycles
and power
Linux power saving
mechanism totally not utilized!
Active Scenario
Manually set P-state at
different freq.
Freq. insensitive to I/O
intensive DPDK peak perf., but
sensitive to power consumption
Negligible peak perf.
degradation at lower freq.
On SNB, 1.7/1.8G freq. achieves
best perf/watt(considering
1C/2T for 2 ports)
Disclaimer: Software and workloads used in performance tests may
have been optimized for performance only on Intel microprocessors.
Performance tests, such as SYSmark and MobileMark, are measured
using specific computer systems, components, software, operations
and functions. Any change to any of those factors may cause the
results to vary. You should consult other information and performance
tests to assist you in fully evaluating your contemplated purchases,
including the performance of that product when combined with other
2. Idle Loop
1% perf.
down
L3fwd_opt
Platform Power
(idle)
123W
123W
Platform Power
(L3fwd w/o traffic)
245W
135W
CPU Utilization
(L3fwd w/o traffic)
100%
0.3%
Frequency
(L3fwd w/o traffic)
2701000 KHz
(Turbo Boost)
1200000 KHz
Idle Scenario
Sleep till incoming
traffic
Lowest core freq.
Power saving for tidal
effect
Active Scenario
Peak perf. degradation
for 64B only
~90W platform power
reduction for the most
of cases(different
packet sizes)
2. Idle Loop
lcore_2
pthread
lcore_3
pthread
lcore_4
pthread
lcore_0
pthread
lcore_5
pthread
Linux
CPU
Core 0
CPU
Core 1
EAL/nonEAL
thread n:m
affinity
EAL/nonEAL
thread n:1
affinity
EAL
thread n:1
affinity
30
%
20
%
10
%
40
%
pthread
A
pthread
B
lcore_6
pthread
40%
Group
with
Profile
(CQM)
60
%
pthread
D
pthread
C
lcore_7
pthread
Linux Scheduling
CPU
Core 2
CPU set
Core 3,4
horizontal
grouping
cgroup Pre-emptive multitasking
Cgroup manages CPU cycle accounting efficiently but what about other
2. Idle Loop
Core 0
Core 1
App
App
Core n
..
Core 1
App
App
Core n
..
2. Idle Loop
100.00%
80.00%
60.00%
Throughput
40.00%
20.00%
100.00%
0.00%
1c1pt
Throughput
80.00%
1c2pt
1c2pt w/ yield
2x10GE packet IO
60.00%
1c1pt
1c2pt
40.00%
1c4pt
20.00%
0.00%
testpmd
w/ yield
rxd=512
SNB Server 2.7GHz, No hyper-thread, No turboburst, 1 x Core, 4 x Niantic card, one port/card
computer systems, components, software, operations and functions. Any change to any of those factors may
cause the results to vary. You should consult other information and performance tests to assist you in fully
evaluating your contemplated purchases, including the performance of that product when combined with other
2. Idle Loop
wake up latency
average ~9us
~150pkts(14.8Mpps
* 10us) on 10GE
Packet Burst during
wake up
DPDK
Polling thread
epoll_wait()
User Space
epoll_wait()
return
FD
Kernel Space
7
igb_uio.ko/
vfio-pci.ko
pthread_creat
e
6
ISR
uio_event_notify()
vfio/uio.ko
Rx
interrupt
2
Polling
Rx packet
Turn ON or OFF
Rx interrupt
5
SNB Server 2.7GHz, 1x Niantic port
3. HW
offload
Leverage HW offload
Reduce CPU utilization by HW
Well known offload capability
RSS
FDIR
CSUM offload
Tunnel Encap/Decap
TSO
3. HW
offload
header
Outer
IP
header
Outer IP + Inner
IP + Inner UDP
UDP
header
VxLAN
header
Outer IP +
Inner IP
Inner
MAC
header
Outer IP +
Inner UDP
inner
IP
header
L4 packet
Outer IP + Inner
IP + Inner UDP
10
190
9.8
185
9.6
180
9.4
175
9.2
170
165
8.8
160
8.6
155
8.4
150
8.2
145
140
SOFTWARE ALL
HW IP
1S/1C/1T Mpps
HW UDP
1x40GE FVL
128Bytes packet
size
Tunneling packet,
VxLAN as sample
Offload do helps to
reduce CPU cycles
HW IP&UDP
cycles/packet
Disclaimer: Software and workloads used in performance tests may have been optimized for performance only
on Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific
computer systems, components, software, operations and functions. Any change to any of those factors may
cause the results to vary. You should consult other information and performance tests to assist you in fully
evaluating your contemplated purchases, including the performance of that product when combined with other
Envision/Future
Light weight thread (Co-operative multitask)
AVX2 vector packet IO
Interrupt mode packet IO on virtual ethdev
(virtio/vmxnet3)
Interrupt latency optimization
Thanks