diff options
author | nickjsanders <nick.j.sanders@gmail.com> | 2022-10-26 12:16:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 12:16:37 -0700 |
commit | 9146a8bfe3e3daefa95f7a61b75183e5fc64af2c (patch) | |
tree | 91da983bc32127b381f604fc32ead55f039d38b5 | |
parent | c497e64fa6d312e38a2fbfa221e3c76660c8e871 (diff) | |
parent | c17f97d9e57976ddb5a585fbced3f88494143666 (diff) |
Merge pull request #99 from stressapptest/new-asm
New asm
-rw-r--r-- | Android.bp | 75 | ||||
-rw-r--r-- | Android.mk | 29 | ||||
-rw-r--r-- | src/adler32memcpy.cc | 58 | ||||
-rw-r--r-- | src/os.cc | 1 | ||||
-rw-r--r-- | src/os.h | 1 | ||||
-rw-r--r-- | src/stressapptest_config_android.h | 88 | ||||
-rw-r--r-- | src/worker.cc | 6 |
7 files changed, 116 insertions, 142 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..0ad0558 --- /dev/null +++ b/Android.bp @@ -0,0 +1,75 @@ +package { + default_applicable_licenses: ["external_stressapptest_license"], +} +// Added automatically by a large-scale-change that took the approach of +// 'apply every license found to every target'. While this makes sure we respect +// every license restriction, it may not be entirely correct. +// +// e.g. GPL in an MIT project might only apply to the contrib/ directory. +// +// Please consider splitting the single license below into multiple licenses, +// taking care not to lose any license_kind information, and overriding the +// default license using the 'licenses: [...]' property on targets as needed. +// +// For unused files, consider creating a 'filegroup' with "//visibility:private" +// to attach the license to, and including a comment whether the files may be +// used in the current project. +// +// large-scale-change included anything that looked like it might be a license +// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. +// +// Please consider removing redundant or irrelevant files from 'license_text:'. +// http://go/android-license-faq +license { + name: "external_stressapptest_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-Apache-2.0", + "SPDX-license-identifier-MIT", + "legacy_notice", + ], + license_text: [ + "COPYING", + "NOTICE", + ], +} +cc_binary { + name: "stressapptest", + srcs: [ + "src/main.cc", + "src/adler32memcpy.cc", + "src/disk_blocks.cc", + "src/error_diag.cc", + "src/finelock_queue.cc", + "src/logger.cc", + "src/os.cc", + "src/os_factory.cc", + "src/pattern.cc", + "src/queue.cc", + "src/sat.cc", + "src/sat_factory.cc", + "src/worker.cc", + ], + arch: { + arm: { cflags: ["-DSTRESSAPPTEST_CPU_ARMV7A"] }, + arm64: { cflags: ["-DSTRESSAPPTEST_CPU_AARCH64"] }, + x86: { + enabled: false, + }, + x86_64: { + enabled: false, + }, + }, + cflags: [ + "-DHAVE_CONFIG_H", + "-DANDROID", + "-DNDEBUG", + "-UDEBUG", + "-DCHECKOPTS", + "-Wall", + "-Werror", + "-Wno-unused-parameter", + "-Wno-#warnings", + "-Wno-implicit-fallthrough", + ], +} diff --git a/Android.mk b/Android.mk deleted file mode 100644 index db434cf..0000000 --- a/Android.mk +++ /dev/null @@ -1,29 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - src/main.cc \ - src/adler32memcpy.cc \ - src/disk_blocks.cc \ - src/error_diag.cc \ - src/finelock_queue.cc \ - src/logger.cc \ - src/os.cc \ - src/os_factory.cc \ - src/pattern.cc \ - src/queue.cc \ - src/sat.cc \ - src/sat_factory.cc \ - src/worker.cc - -# Build 64 bit by default -# LOCAL_MULTILIB := 32 -LOCAL_MODULE:= stressapptest -LOCAL_MODULE_TAGS := optional - -LOCAL_CFLAGS := -DHAVE_CONFIG_H -DANDROID -DNDEBUG -UDEBUG -DCHECKOPTS - -LOCAL_CPP_EXTENSION := .cc - -include $(BUILD_EXECUTABLE) diff --git a/src/adler32memcpy.cc b/src/adler32memcpy.cc index 264f51a..d67a362 100644 --- a/src/adler32memcpy.cc +++ b/src/adler32memcpy.cc @@ -403,7 +403,7 @@ bool AdlerMemcpyAsm(uint64 *dstmem64, uint64 *srcmem64, #if defined(STRESSAPPTEST_CPU_AARCH64) #define src_r "x3" #define dst_r "x4" -#define blocks_r "x5" +#define blocks_r "w5" #define crc_r "x6" #else #define src_r "r3" @@ -433,7 +433,7 @@ bool AdlerMemcpyAsm(uint64 *dstmem64, uint64 *srcmem64, "mov " src_r ", %[src];\n" "mov " dst_r ", %[dst];\n" "mov " crc_r ", %[crc];\n" - "mov " blocks_r ", %[blocks];\n" + "mov " blocks_r ", %w[blocks];\n" // Loop over block count. "cmp " blocks_r ", #0;\n" // Compare counter to zero. @@ -448,8 +448,8 @@ bool AdlerMemcpyAsm(uint64 *dstmem64, uint64 *srcmem64, "prfm pldl1strm, [" src_r ", #256];\n" // Init checksum - "ld1.2d {v0}, [" crc_r "];\n" - "dup.2d v1, xzr;\n" + "ld1 {v0.2d}, [" crc_r "];\n" + "dup v1.2d, xzr;\n" // Start of the loop which copies 64 bytes from source to dst each time. "TOP:\n" @@ -462,15 +462,15 @@ bool AdlerMemcpyAsm(uint64 *dstmem64, uint64 *srcmem64, // We are using 2 words out of 4 words in each qX register, // word index 0 and word index 2. We'll swizzle them in a bit. // Copy it. - "ld1.2d {v8, v9, v10, v11}, [" src_r "], #64;\n" - "st1.2d {v8, v9, v10, v11}, [" dst_r "], #64;\n" + "ld1 {v8.2d, v9.2d, v10.2d, v11.2d}, [" src_r "], #64;\n" + "st1 {v8.2d, v9.2d, v10.2d, v11.2d}, [" dst_r "], #64;\n" // Arrange it. - "dup.4s v12, wzr; \n" - "dup.4s v13, wzr; \n" - "dup.4s v14, wzr; \n" - "dup.4s v15, wzr; \n" - "dup.4s v16, wzr; \n" + "dup v12.4s, wzr; \n" + "dup v13.4s, wzr; \n" + "dup v14.4s, wzr; \n" + "dup v15.4s, wzr; \n" + "dup v16.4s, wzr; \n" // This exchenges words 1,3 in the filled registers with // words 0,2 in the empty registers. "trn1 v12.4s, v8.4s, v12.4s; \n" @@ -487,23 +487,23 @@ bool AdlerMemcpyAsm(uint64 *dstmem64, uint64 *srcmem64, // Overflow can occur only if there are more // than 2^16 additions => more than 2^17 words => more than 2^19 bytes so // if size_in_bytes > 2^19 than overflow occurs. - "add.2d v0, v0, v12;\n" - "add.2d v1, v1, v0;\n" - "add.2d v0, v0, v8;\n" - "add.2d v1, v1, v0;\n" - "add.2d v0, v0, v13;\n" - "add.2d v1, v1, v0;\n" - "add.2d v0, v0, v9;\n" - "add.2d v1, v1, v0;\n" - - "add.2d v0, v0, v14;\n" - "add.2d v1, v1, v0;\n" - "add.2d v0, v0, v10;\n" - "add.2d v1, v1, v0;\n" - "add.2d v0, v0, v15;\n" - "add.2d v1, v1, v0;\n" - "add.2d v0, v0, v11;\n" - "add.2d v1, v1, v0;\n" + "add v0.2d, v0.2d, v12.2d;\n" + "add v1.2d, v1.2d, v0.2d;\n" + "add v0.2d, v0.2d, v8.2d;\n" + "add v1.2d, v1.2d, v0.2d;\n" + "add v0.2d, v0.2d, v13.2d;\n" + "add v1.2d, v1.2d, v0.2d;\n" + "add v0.2d, v0.2d, v9.2d;\n" + "add v1.2d, v1.2d, v0.2d;\n" + + "add v0.2d, v0.2d, v14.2d;\n" + "add v1.2d, v1.2d, v0.2d;\n" + "add v0.2d, v0.2d, v10.2d;\n" + "add v1.2d, v1.2d, v0.2d;\n" + "add v0.2d, v0.2d, v15.2d;\n" + "add v1.2d, v1.2d, v0.2d;\n" + "add v0.2d, v0.2d, v11.2d;\n" + "add v1.2d, v1.2d, v0.2d;\n" // Increment counter and loop. "sub " blocks_r ", " blocks_r ", #1;\n" @@ -516,7 +516,7 @@ bool AdlerMemcpyAsm(uint64 *dstmem64, uint64 *srcmem64, // 64 bit numbers and have to be converted to 64 bit numbers) // seems like Adler128 (since size of each part is 4 byte rather than // 1 byte). - "st1.2d {v0, v1}, [" crc_r "]; \n" + "st1 {v0.2d, v1.2d}, [" crc_r "]; \n" // Output registers. : @@ -212,7 +212,6 @@ void OsLayer::GetFeatures() { // TODO(nsanders): add detect from /proc/cpuinfo or /proc/self/auxv. // For now assume neon and don't run -W if you don't have it. has_vector_ = true; // NEON. -#warning "Unsupported CPU type ARMV7A: unable to determine feature set." #else #warning "Unsupported CPU type: unable to determine feature set." #endif @@ -355,6 +355,7 @@ class OsLayer { virtual bool AdlerMemcpyWarm(uint64 *dstmem, uint64 *srcmem, unsigned int size_in_bytes, AdlerChecksum *checksum); + bool has_vector() const { return has_vector_; } // Store a callback to use to print // app-specific info about the last error location. diff --git a/src/stressapptest_config_android.h b/src/stressapptest_config_android.h index c3bf78f..3a6fcc8 100644 --- a/src/stressapptest_config_android.h +++ b/src/stressapptest_config_android.h @@ -1,222 +1,152 @@ /* src/stressapptest_config.h. Generated from stressapptest_config.h.in by configure. */ /* src/stressapptest_config.h.in. Generated from configure.ac by autoheader. */ - /* Define to 1 if the `closedir' function returns void instead of `int'. */ #define CLOSEDIR_VOID 1 - /* Define to 1 if you have the <arpa/inet.h> header file. */ #define HAVE_ARPA_INET_H 1 - /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #define HAVE_DECL_STRERROR_R 1 - /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #define HAVE_DIRENT_H 1 - /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ /* #undef HAVE_DOPRNT */ - /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 - /* Define to 1 if you have the `ftruncate' function. */ #define HAVE_FTRUNCATE 1 - /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 - /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 - /* Define to 1 if you have the <libaio.h> header file. */ /* #undef HAVE_LIBAIO_H */ - /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 - /* Define to 1 if you have the `memset' function. */ #define HAVE_MEMSET 1 - /* Define to 1 if you have the `mmap64' function. */ /* #undef HAVE_MMAP64 */ - /* Define to 1 if you have the `munmap' function. */ #define HAVE_MUNMAP 1 - /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ /* #undef HAVE_NDIR_H */ - /* Define to 1 if you have the <netdb.h> header file. */ #define HAVE_NETDB_H 1 - /* Define to 1 if you have the `posix_memalign' function. */ #define HAVE_POSIX_MEMALIGN 1 - +/* Define to 1 if the system has `pthread_barrier'. */ +#define HAVE_PTHREAD_BARRIERS 1 /* Define to 1 if you have the <pthread.h> header file. */ #define HAVE_PTHREAD_H 1 - /* Define to 1 if you have the `rand_r' function. */ /* #undef HAVE_RAND_R */ - /* Define to 1 if you have the `sched_getaffinity' function. */ #define HAVE_SCHED_GETAFFINITY 1 - /* Define to 1 if you have the `select' function. */ #define HAVE_SELECT 1 - /* Define to 1 if you have the `socket' function. */ #define HAVE_SOCKET 1 - /* Define to 1 if stdbool.h conforms to C99. */ -/* #undef HAVE_STDBOOL_H */ - +#define HAVE_STDBOOL_H 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 - /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 - /* Define to 1 if you have the `strerror_r' function. */ #define HAVE_STRERROR_R 1 - /* Define to 1 if you have the <strings.h> header file. */ #define HAVE_STRINGS_H 1 - /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 - /* Define to 1 if you have the `strtol' function. */ #define HAVE_STRTOL 1 - /* Define to 1 if you have the `strtoull' function. */ #define HAVE_STRTOULL 1 - /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */ /* #undef HAVE_SYS_DIR_H */ - /* Define to 1 if you have the <sys/ioctl.h> header file. */ #define HAVE_SYS_IOCTL_H 1 - /* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. */ /* #undef HAVE_SYS_NDIR_H */ - /* Define to 1 if you have the <sys/select.h> header file. */ #define HAVE_SYS_SELECT_H 1 - /* Define to 1 if you have the <sys/shm.h> header file. */ /* #undef HAVE_SYS_SHM_H */ - /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 - /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 - /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 - /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 - /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 - /* Define to 1 if you have the `vprintf' function. */ #define HAVE_VPRINTF 1 - /* Define to 1 if the system has the type `_Bool'. */ #define HAVE__BOOL 1 - /* Name of package */ #define PACKAGE "stressapptest" - /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "opensource@google.com" - /* Define to the full name of this package. */ #define PACKAGE_NAME "stressapptest" - /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "stressapptest 1.0.4_autoconf" - +#define PACKAGE_STRING "stressapptest 1.0.9_autoconf" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "stressapptest" - /* Define to the home page for this package. */ #define PACKAGE_URL "" - /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.0.4_autoconf" - +#define PACKAGE_VERSION "1.0.9_autoconf" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void - /* Define to the type of arg 1 for `select'. */ #define SELECT_TYPE_ARG1 int - /* Define to the type of args 2, 3 and 4 for `select'. */ #define SELECT_TYPE_ARG234 (fd_set *) - /* Define to the type of arg 5 for `select'. */ #define SELECT_TYPE_ARG5 (struct timeval *) - /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 - /* Define to 1 if strerror_r returns char *. */ /* #undef STRERROR_R_CHAR_P */ - /* Defined if the target CPU is armv7a */ -#define STRESSAPPTEST_CPU_ARMV7A /**/ - +/* #define STRESSAPPTEST_CPU_ARMV7A */ /* Defined if the target CPU is i686 */ /* #undef STRESSAPPTEST_CPU_I686 */ - -/* Defined if the target CPU is MIPS */ -/* #undef STRESSAPPTEST_CPU_MIPS */ - /* Defined if the target CPU is PowerPC */ /* #undef STRESSAPPTEST_CPU_PPC */ - /* Defined if the target CPU is x86_64 */ /* #undef STRESSAPPTEST_CPU_X86_64 */ - /* Defined if the target OS is BSD based */ /* #undef STRESSAPPTEST_OS_BSD */ - /* Defined if the target OS is OSX */ /* #undef STRESSAPPTEST_OS_DARWIN */ - /* Defined if the target OS is Linux */ #define STRESSAPPTEST_OS_LINUX /**/ - /* Timestamp when ./configure was executed */ #ifndef STRESSAPPTEST_TIMESTAMP #define STRESSAPPTEST_TIMESTAMP "Android version" #endif - /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #define TIME_WITH_SYS_TIME 1 - /* Version number of package */ -#define VERSION "1.0.4_autoconf" - +#define VERSION "1.0.9_autoconf" /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ - /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus /* #undef inline */ #endif - /* Define to `int' if <sys/types.h> does not define. */ /* #undef pid_t */ - /* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported directly. */ @@ -230,17 +160,13 @@ # define _Restrict # define __restrict__ #endif - /* Define to `unsigned int' if <sys/types.h> does not define. */ /* #undef size_t */ - /* Define to `int' if <sys/types.h> does not define. */ /* #undef ssize_t */ - /* Define to the type of an unsigned integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ /* #undef uint16_t */ - /* Define to empty if the keyword `volatile' does not work. Warning: valid code using `volatile' can become incorrect without. Disable with care. */ /* #undef volatile */ diff --git a/src/worker.cc b/src/worker.cc index 7f201ec..745a816 100644 --- a/src/worker.cc +++ b/src/worker.cc @@ -1525,8 +1525,10 @@ bool CopyThread::Work() { bool result = true; int64 loops = 0; - logprintf(9, "Log: Starting copy thread %d: cpu %s, mem %x\n", - thread_num_, cpuset_format(&cpu_mask_).c_str(), tag_); + logprintf(9, "Log: Starting copy thread %d: cpu %s, " + "mem %x, warm: %d, has_vector: %d\n", + thread_num_, cpuset_format(&cpu_mask_).c_str(), tag_, + sat_->warm(), os_->has_vector()); while (IsReadyToRun()) { // Pop the needed pages. |