AES-NI enhancements to NSS on Sandy Bridge systems

RESOLVED FIXED

Status

NSS
Libraries
RESOLVED FIXED
6 years ago
7 months ago

People

(Reporter: Aleksey, Unassigned)

Tracking

({perf})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

6 years ago
Created attachment 577519 [details] [diff] [review]
Enhancement patch

In Sandy Bridge, the AES round instructions have a throughput of one cycle and latency of eight cycles. Compared to the Westmere, where these instructions have throughput of two cycles and a latency of six cycles,  Sandy Bridge offers a two fold increase in the throughput, with some additional latency. As a result, the AES encryption/decryption throughput can be significantly increased, for parallel modes of operation (IntelĀ® 64 and IA-32 Architectures Optimization Reference Manual, page 310, paragraph 2). 


In NSS, parallel mode is already implemented for eight blocks (it's optimum). But without loop unrolling, which also can increase results for CBC decrypt and ECB encrypt/decrypt for various key sizes. The bug contains implementation of unrolled version of CBC decrypt and ECB encrypt/decrypt.

Platforms: Sandy Bridge (RHEL 6, gcc 4.4.4), Westmere (RHEL 5.5, gcc 4.1.2).
NSS: Mozilla nss 3.12.11 with nspr 4.8.9.
JDK: b147-x64.
Microbenchmark: written on Java // warmup: 2 minutes; iteration: 3 minutes; score =  number of operations (CBC decrypt, ECB decrypt or ECB encrypt) / time iteration [ops/m].

Testing results: the results show performance improve on Sandy Bridge:

Ratio Unrolled/Original on 1 thread
Cipher/Key_Size	128-bit	192-bit	256-bit
CBC decrypt		1.238		1.247		1.297
ECB decrypt		1.280		1.320		1.300
ECB encrypt		1.185		1.212		1.165

Ratio Unrolled/Original on 4 threads
Cipher/Key Size	128-bit	192-bit	256-bit
CBC decrypt		1.201		1.242		1.277
ECB decrypt		1.228		1.293		1.269
ECB encrypt		1.160		1.170		1.151

There is no performance impact on Westmere platform.
Micro benchmark, intel-aes.s patch with loop unrolling and howto in attach.
(Reporter)

Comment 1

6 years ago
Created attachment 577520 [details]
Micro benchmark
(Reporter)

Comment 2

6 years ago
Created attachment 577521 [details]
howto
(Reporter)

Updated

6 years ago
Keywords: perf
(Reporter)

Comment 3

6 years ago
Link to Optimization Notice http://software.intel.com/en-us/articles/optimization-notice
(Reporter)

Updated

5 years ago
Version: 3.12.11 → 3.13
Status: UNCONFIRMED → NEW
Ever confirmed: true
Who needs to review this to move this along?

Any interdependency with bug 540986?
(Reporter)

Comment 5

5 years ago
The enhancement proposed in this bug is for Linux only, #540986 is a port to  Windows and seems not to be related to Linux intel-aes implementation.

Updated

5 years ago
Attachment #577519 - Attachment is patch: true

Updated

5 years ago
Attachment #577519 - Flags: review?(rrelyea)

Comment 6

5 years ago
Comment on attachment 577519 [details] [diff] [review]
Enhancement patch

r+ rrelyea
Attachment #577519 - Flags: review?(rrelyea) → review+

Comment 7

5 years ago
Patch applied in the trunk: 
revision 1.7
date: 2012/05/03 00:51:37;  author: emaldona%redhat.com;  state: Exp;  lines: +1011 -159
Bug 706024 - AES-NI enhancements to NSS on Sandy Bridge system,
author=aleksey.v.ignatenko@intel.com, r=rrelyea

Updated

5 years ago
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.