Update starch to upstream commit 521d7632a1076733030017a571facd1cd304e669

This commit is contained in:
Oliver Jowett 2021-02-02 11:34:37 +08:00
parent 2c7b331352
commit fdc1ac731d
3 changed files with 25 additions and 18 deletions

View File

@ -154,7 +154,6 @@ static void starch_benchmark_one_magnitude_uc8( starch_magnitude_uc8_regentry *
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -267,7 +266,6 @@ static void starch_benchmark_one_magnitude_uc8_aligned( starch_magnitude_uc8_ali
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -380,7 +378,6 @@ static void starch_benchmark_one_magnitude_power_uc8( starch_magnitude_power_uc8
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -493,7 +490,6 @@ static void starch_benchmark_one_magnitude_power_uc8_aligned( starch_magnitude_p
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -606,7 +602,6 @@ static void starch_benchmark_one_magnitude_sc16( starch_magnitude_sc16_regentry
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -719,7 +714,6 @@ static void starch_benchmark_one_magnitude_sc16_aligned( starch_magnitude_sc16_a
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -832,7 +826,6 @@ static void starch_benchmark_one_magnitude_sc16q11( starch_magnitude_sc16q11_reg
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -945,7 +938,6 @@ static void starch_benchmark_one_magnitude_sc16q11_aligned( starch_magnitude_sc1
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -1058,7 +1050,6 @@ static void starch_benchmark_one_mean_power_u16( starch_mean_power_u16_regentry
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -1171,7 +1162,6 @@ static void starch_benchmark_one_mean_power_u16_aligned( starch_mean_power_u16_a
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
@ -1253,7 +1243,7 @@ static void starch_benchmark_run_mean_power_u16_aligned( const uint16_t * arg0,
#define STARCH_BENCHMARK(_function) starch_ ## _function ## _benchmark
#define STARCH_BENCHMARK_VERIFY(_function) starch_ ## _function ## _benchmark_verify
#define STARCH_BENCHMARK_RUN(_function, ...) starch_benchmark_run_ ## _function ( __VA_ARGS__ )
#define STARCH_BENCHMARK_ALLOC(_count, _type) starch_benchmark_aligned_alloc(1, alignof(_type), (_count) * sizeof(_type))
#define STARCH_BENCHMARK_ALLOC(_count, _type) ((_type *) starch_benchmark_aligned_alloc(1, alignof(_type), (_count) * sizeof(_type)))
#define STARCH_BENCHMARK_FREE(_ptr) starch_benchmark_aligned_free(_ptr)
#include "../benchmark/magnitude_sc16_benchmark.c"
@ -1281,7 +1271,7 @@ static void starch_benchmark_run_mean_power_u16_aligned( const uint16_t * arg0,
#define STARCH_BENCHMARK(_function) starch_ ## _function ## _aligned_benchmark
#define STARCH_BENCHMARK_VERIFY(_function) starch_ ## _function ## _aligned_benchmark_verify
#define STARCH_BENCHMARK_RUN(_function, ...) starch_benchmark_run_ ## _function ## _aligned ( __VA_ARGS__ )
#define STARCH_BENCHMARK_ALLOC(_count, _type) starch_benchmark_aligned_alloc(STARCH_MIX_ALIGNMENT, alignof(_type), (_count) * sizeof(_type))
#define STARCH_BENCHMARK_ALLOC(_count, _type) ((_type *) starch_benchmark_aligned_alloc(STARCH_MIX_ALIGNMENT, alignof(_type), (_count) * sizeof(_type)))
#define STARCH_BENCHMARK_FREE(_ptr) starch_benchmark_aligned_free(_ptr)
#include "../benchmark/magnitude_sc16_benchmark.c"

View File

@ -42,6 +42,8 @@ static starch_benchmark_flavor_list *starch_benchmark_flavor_whitelist = NULL;
static starch_benchmark_flavor_list *starch_benchmark_flavor_blacklist = NULL;
static bool starch_benchmark_list_only = false;
static bool starch_benchmark_validate_only = false;
static bool starch_benchmark_validation_failed = false;
static bool starch_benchmark_top_only = false;
static unsigned starch_benchmark_iterations = 1;
@ -149,6 +151,11 @@ static void starch_benchmark_one_subtract_n( starch_subtract_n_regentry * _entry
/* verify correctness of the output */
if (! starch_subtract_n_benchmark_verify ( arg0, arg1, arg2, arg3 )) {
fprintf(stderr, "skipped (verification failed)\n");
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
}
@ -256,6 +263,11 @@ static void starch_benchmark_one_subtract_n_aligned( starch_subtract_n_aligned_r
/* verify correctness of the output */
if (! starch_subtract_n_aligned_benchmark_verify ( arg0, arg1, arg2, arg3 )) {
fprintf(stderr, "skipped (verification failed)\n");
starch_benchmark_validation_failed = true;
return;
}
if (starch_benchmark_validate_only) {
fprintf(stderr, "validation ok\n");
return;
}
@ -335,7 +347,7 @@ static void starch_benchmark_run_subtract_n_aligned( const uint16_t * arg0, unsi
#define STARCH_BENCHMARK(_function) starch_ ## _function ## _benchmark
#define STARCH_BENCHMARK_VERIFY(_function) starch_ ## _function ## _benchmark_verify
#define STARCH_BENCHMARK_RUN(_function, ...) starch_benchmark_run_ ## _function ( __VA_ARGS__ )
#define STARCH_BENCHMARK_ALLOC(_count, _type) starch_benchmark_aligned_alloc(1, alignof(_type), (_count) * sizeof(_type))
#define STARCH_BENCHMARK_ALLOC(_count, _type) ((_type *) starch_benchmark_aligned_alloc(1, alignof(_type), (_count) * sizeof(_type)))
#define STARCH_BENCHMARK_FREE(_ptr) starch_benchmark_aligned_free(_ptr)
#include "../benchmark/subtract_n_benchmark.c"
@ -359,7 +371,7 @@ static void starch_benchmark_run_subtract_n_aligned( const uint16_t * arg0, unsi
#define STARCH_BENCHMARK(_function) starch_ ## _function ## _aligned_benchmark
#define STARCH_BENCHMARK_VERIFY(_function) starch_ ## _function ## _aligned_benchmark_verify
#define STARCH_BENCHMARK_RUN(_function, ...) starch_benchmark_run_ ## _function ## _aligned ( __VA_ARGS__ )
#define STARCH_BENCHMARK_ALLOC(_count, _type) starch_benchmark_aligned_alloc(STARCH_MIX_ALIGNMENT, alignof(_type), (_count) * sizeof(_type))
#define STARCH_BENCHMARK_ALLOC(_count, _type) ((_type *) starch_benchmark_aligned_alloc(STARCH_MIX_ALIGNMENT, alignof(_type), (_count) * sizeof(_type)))
#define STARCH_BENCHMARK_FREE(_ptr) starch_benchmark_aligned_free(_ptr)
#include "../benchmark/subtract_n_benchmark.c"
@ -404,6 +416,7 @@ static void starch_benchmark_usage(const char *argv0)
" -N FLAVOR Add FLAVOR to blacklist\n"
" (default: no blacklist, run all runtime-supported flavors)\n"
" -l List compiled-in implementations but don't benchmark them\n"
" -V Run validation tests, but don't run benchmarks\n"
" -t Include only the top candidate per function in wisdom output\n"
" -i ITERS Run benchmark ITERS times and use the mean. If ITERS > 2, ignore\n"
" the smallest and largest runs when calculating the mean.\n"
@ -453,7 +466,7 @@ int main(int argc, char **argv)
const char *output_path = NULL;
int opt;
while ((opt = getopt(argc, argv, "r:o:F:N:i:lht")) != -1) {
while ((opt = getopt(argc, argv, "r:o:F:N:i:lhtV")) != -1) {
switch (opt) {
case 'r':
if (starch_read_wisdom(optarg) < 0) {
@ -495,6 +508,10 @@ int main(int argc, char **argv)
starch_benchmark_iterations = atoi(optarg);
break;
case 'V':
starch_benchmark_validate_only = true;
break;
case 'h':
starch_benchmark_usage(argv[0]);
return 0;
@ -565,5 +582,5 @@ int main(int argc, char **argv)
fprintf(stderr, "%s: wrote sorted wisdom to %s\n", argv[0], output_path);
}
return 0;
return starch_benchmark_validation_failed ? 1 : 0;
}

View File

@ -249,7 +249,7 @@ static void starch_benchmark_run_${function.name}( ${function.declaration_arglis
#define STARCH_BENCHMARK(_function) ${gen.symbol_prefix} ## _function ## _benchmark
#define STARCH_BENCHMARK_VERIFY(_function) ${gen.symbol_prefix} ## _function ## _benchmark_verify
#define STARCH_BENCHMARK_RUN(_function, ...) starch_benchmark_run_ ## _function ( __VA_ARGS__ )
#define STARCH_BENCHMARK_ALLOC(_count, _type) starch_benchmark_aligned_alloc(1, alignof(_type), (_count) * sizeof(_type))
#define STARCH_BENCHMARK_ALLOC(_count, _type) ((_type *) starch_benchmark_aligned_alloc(1, alignof(_type), (_count) * sizeof(_type)))
#define STARCH_BENCHMARK_FREE(_ptr) starch_benchmark_aligned_free(_ptr)
% for source in gen.benchmark_files:
@ -275,7 +275,7 @@ static void starch_benchmark_run_${function.name}( ${function.declaration_arglis
#define STARCH_BENCHMARK(_function) ${gen.symbol_prefix} ## _function ## _aligned_benchmark
#define STARCH_BENCHMARK_VERIFY(_function) ${gen.symbol_prefix} ## _function ## _aligned_benchmark_verify
#define STARCH_BENCHMARK_RUN(_function, ...) starch_benchmark_run_ ## _function ## _aligned ( __VA_ARGS__ )
#define STARCH_BENCHMARK_ALLOC(_count, _type) starch_benchmark_aligned_alloc(STARCH_MIX_ALIGNMENT, alignof(_type), (_count) * sizeof(_type))
#define STARCH_BENCHMARK_ALLOC(_count, _type) ((_type *) starch_benchmark_aligned_alloc(STARCH_MIX_ALIGNMENT, alignof(_type), (_count) * sizeof(_type)))
#define STARCH_BENCHMARK_FREE(_ptr) starch_benchmark_aligned_free(_ptr)
% for source in gen.benchmark_files: