Add base.arm_crc32_u32 type

On a Raspberry Pi 4 (32-bit armv7l) with -march=native and -mfpu=neon
("native" means "armv8-a+crc+simd"):

wuffs_crc32_ieee_10k/clang9                                825MB/s ± 0%  6802MB/s ± 0%  +724.00%  (p=0.008 n=5+5)
wuffs_crc32_ieee_100k/clang9                               837MB/s ± 0%  6199MB/s ± 0%  +640.25%  (p=0.008 n=5+5)

wuffs_crc32_ieee_10k/gcc8                                  960MB/s ± 0%  4495MB/s ± 0%  +368.35%  (p=0.016 n=4+5)
wuffs_crc32_ieee_100k/gcc8                                 961MB/s ± 0%  4447MB/s ± 0%  +363.01%  (p=0.016 n=5+4)

mimic_crc32_ieee_10k                                       638MB/s ± 0%   631MB/s ± 0%    -1.17%  (p=0.008 n=5+5)
mimic_crc32_ieee_100k                                      639MB/s ± 0%   639MB/s ± 0%    +0.02%  (p=0.008 n=5+5)

wuffs_gzip_decode_10k/clang9                              83.0MB/s ± 0%  90.7MB/s ± 0%    +9.26%  (p=0.008 n=5+5)
wuffs_gzip_decode_100k/clang9                              100MB/s ± 0%   112MB/s ± 0%   +11.91%  (p=0.008 n=5+5)

wuffs_gzip_decode_10k/gcc8                                86.1MB/s ± 0%  91.9MB/s ± 0%    +6.72%  (p=0.008 n=5+5)
wuffs_gzip_decode_100k/gcc8                                102MB/s ± 0%   112MB/s ± 0%    +9.34%  (p=0.008 n=5+5)

mimic_gzip_decode_10k                                     98.8MB/s ± 0%  98.2MB/s ± 0%    -0.60%  (p=0.008 n=5+5)
mimic_gzip_decode_100k                                     128MB/s ± 0%   128MB/s ± 0%    -0.08%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/clang9                    67.6MB/s ± 0%  70.8MB/s ± 0%    +4.72%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/clang9                   92.8MB/s ± 0%  98.8MB/s ± 0%    +6.49%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/clang9                     255MB/s ± 0%   269MB/s ± 0%    +5.44%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/clang9   123MB/s ± 0%   123MB/s ± 0%    +0.13%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/clang9   110MB/s ± 0%   112MB/s ± 0%    +1.46%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/clang9                 88.4MB/s ± 0%  92.8MB/s ± 0%    +4.90%  (p=0.008 n=5+5)

wuffs_png_decode_image_19k_8bpp/gcc8                      67.2MB/s ± 0%  70.8MB/s ± 0%    +5.37%  (p=0.008 n=5+5)
wuffs_png_decode_image_40k_24bpp/gcc8                     94.0MB/s ± 0%  98.2MB/s ± 0%    +4.45%  (p=0.008 n=5+5)
wuffs_png_decode_image_77k_8bpp/gcc8                       236MB/s ± 0%   248MB/s ± 0%    +4.84%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_ignore_checksum/gcc8     114MB/s ± 0%   115MB/s ± 0%    +1.11%  (p=0.008 n=5+5)
wuffs_png_decode_image_552k_32bpp_verify_checksum/gcc8     102MB/s ± 0%   104MB/s ± 0%    +2.17%  (p=0.008 n=5+5)
wuffs_png_decode_image_4002k_24bpp/gcc8                   88.8MB/s ± 0%  94.3MB/s ± 0%    +6.21%  (p=0.008 n=5+5)

mimic_png_decode_image_19k_8bpp                           43.7MB/s ± 1%  43.4MB/s ± 1%      ~     (p=0.095 n=5+5)
mimic_png_decode_image_40k_24bpp                          54.6MB/s ± 0%  53.9MB/s ± 0%    -1.25%  (p=0.008 n=5+5)
mimic_png_decode_image_77k_8bpp                            125MB/s ± 0%   124MB/s ± 0%    -0.73%  (p=0.008 n=5+5)
mimic_png_decode_image_552k_32bpp_ignore_checksum               skipped
mimic_png_decode_image_552k_32bpp_verify_checksum          102MB/s ± 0%   101MB/s ± 0%    -0.95%  (p=0.008 n=5+5)
mimic_png_decode_image_4002k_24bpp                        81.3MB/s ± 0%  81.0MB/s ± 0%    -0.46%  (p=0.016 n=4+5)
This commit is contained in:
Nigel Tao committed 2021-02-13 22:54:47 +11:00
1 parent 81ba41e251
commit 84f3592dbe
10 files changed
+94 -106

No files matched your search

+11
View File
@@ -245,6 +245,7 @@ var Types = []string{
// ----
"arm_crc32_u32",
"x86_m128i",
}
@@ -531,6 +532,16 @@ var Funcs = []string{
"pixel_swizzler.swizzle_interleaved_transparent_black!(" +
"dst: slice u8, dst_palette: slice u8, num_pixels: u64) u64",
// ---- arm_crc32_u32
"arm_crc32_u32.create(a: u32) arm_crc32_u32",
"arm_crc32_u32.value() u32",
"arm_crc32_u32._crc32b(b: u8) arm_crc32_u32",
"arm_crc32_u32._crc32h(b: u16) arm_crc32_u32",
"arm_crc32_u32._crc32w(b: u32) arm_crc32_u32",
"arm_crc32_u32._crc32d(b: u64) arm_crc32_u32",
// ---- x86_m128i
"x86_m128i.load_u32!(a: u32)",
+4 -2
View File
@@ -75,7 +75,8 @@ var (
typeExprDecodeFrameOptions = a.NewTypeExpr(0, t.IDBase, t.IDDecodeFrameOptions, nil, nil, nil)
typeExprX86M128I = a.NewTypeExpr(0, t.IDBase, t.IDX86M128I, nil, nil, nil)
typeExprARMCRC32U32 = a.NewTypeExpr(0, t.IDBase, t.IDARMCRC32U32, nil, nil, nil)
typeExprX86M128I = a.NewTypeExpr(0, t.IDBase, t.IDX86M128I, nil, nil, nil)
typeExprSliceU8 = a.NewTypeExpr(t.IDSlice, 0, 0, nil, nil, typeExprU8)
typeExprTableU8 = a.NewTypeExpr(t.IDTable, 0, 0, nil, nil, typeExprU8)
@@ -125,7 +126,8 @@ var builtInTypeMap = typeMap{
t.IDDecodeFrameOptions: typeExprDecodeFrameOptions,
t.IDX86M128I: typeExprX86M128I,
t.IDARMCRC32U32: typeExprARMCRC32U32,
t.IDX86M128I: typeExprX86M128I,
}
func (c *Checker) parseBuiltInFuncs(m map[t.QQID]*a.Func, ss []string) error {
+9 -1
View File
@@ -25,7 +25,9 @@ import (
type cpuArchBits uint32
const (
cpuArchBitsX86SSE42 = cpuArchBits(0x00000001)
cpuArchBitsARMCRC32 = cpuArchBits(0x00000001)
cpuArchBitsARMNeon = cpuArchBits(0x00000002)
cpuArchBitsX86SSE42 = cpuArchBits(0x00000004)
)
func calcCPUArchBits(n *a.Func) (ret cpuArchBits) {
@@ -35,6 +37,10 @@ func calcCPUArchBits(n *a.Func) (ret cpuArchBits) {
continue
}
switch o.Condition().RHS().AsExpr().Ident() {
case t.IDARMCRC32:
ret |= cpuArchBitsARMCRC32
case t.IDARMNeon:
ret |= cpuArchBitsARMNeon
case t.IDX86SSE42:
ret |= cpuArchBitsX86SSE42
}
@@ -46,6 +52,8 @@ func (q *checker) tcheckCPUArchBits(cab cpuArchBits, typ *a.TypeExpr) error {
if qid := typ.Innermost().QID(); qid[0] == t.IDBase {
need := cpuArchBits(0)
switch qid[1] {
case t.IDARMCRC32U32:
need = cpuArchBitsARMCRC32
case t.IDX86M128I:
need = cpuArchBitsX86SSE42
}
+4
View File
@@ -668,6 +668,8 @@ const (
IDARMCRC32 = ID(0x300)
IDARMNeon = ID(0x301)
IDARMCRC32U32 = ID(0x308)
IDX86SSE42 = ID(0x320)
IDX86AVX2 = ID(0x321)
@@ -1087,6 +1089,8 @@ var builtInsByID = [nBuiltInIDs]string{
IDARMCRC32: "arm_crc32",
IDARMNeon: "arm_neon",
IDARMCRC32U32: "arm_crc32_u32",
IDX86SSE42: "x86_sse42",
IDX86AVX2: "x86_avx2",