Skip to content

Commit 191fc46

Browse files
committed
benchdnn: fix large problem description parsing
The size of long integer is 4 bytes on Windows, so benchdnn failed to parse sizes that are larger than 2147483647.
1 parent 8c811df commit 191fc46

File tree

9 files changed

+35
-35
lines changed

9 files changed

+35
-35
lines changed

tests/benchdnn/bnorm/bnorm_aux.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2017-2024 Intel Corporation
2+
* Copyright 2017-2025 Intel Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -89,8 +89,8 @@ int str2desc(desc_t *desc, const char *str) {
8989
const char *s = str;
9090
assert(s);
9191

92-
auto mstrtol = [](const char *nptr, char **endptr) {
93-
return strtol(nptr, endptr, 10);
92+
auto mstrtoll = [](const char *nptr, char **endptr) {
93+
return strtoll(nptr, endptr, 10);
9494
};
9595

9696
#define CASE_NN(prb, c, cvfunc) \
@@ -120,11 +120,11 @@ int str2desc(desc_t *desc, const char *str) {
120120
#define CASE_N(c, cvfunc) CASE_NN(#c, c, cvfunc)
121121
while (*s) {
122122
int ok = 0;
123-
CASE_N(mb, mstrtol);
124-
CASE_N(ic, mstrtol);
125-
CASE_N(id, mstrtol);
126-
CASE_N(ih, mstrtol);
127-
CASE_N(iw, mstrtol);
123+
CASE_N(mb, mstrtoll);
124+
CASE_N(ic, mstrtoll);
125+
CASE_N(id, mstrtoll);
126+
CASE_N(ih, mstrtoll);
127+
CASE_N(iw, mstrtoll);
128128
CASE_N(eps, strtof);
129129
if (*s == 'n') {
130130
d.name = s + 1;

tests/benchdnn/conv/conv_aux.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int str2desc(desc_t *desc, const char *str) {
8282
ok = 1; \
8383
s += strlen(prb); \
8484
char *end_s; \
85-
d.c = strtol(s, &end_s, 10); \
85+
d.c = strtoll(s, &end_s, 10); \
8686
if (end_s == s) { \
8787
BENCHDNN_PRINT(0, \
8888
"ERROR: No value found for `%s` setting. Full " \

tests/benchdnn/deconv/deconv_aux.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int str2desc(desc_t *desc, const char *str) {
7878
ok = 1; \
7979
s += strlen(prb); \
8080
char *end_s; \
81-
d.c = strtol(s, &end_s, 10); \
81+
d.c = strtoll(s, &end_s, 10); \
8282
if (end_s == s) { \
8383
BENCHDNN_PRINT(0, \
8484
"ERROR: No value found for `%s` setting. Full " \

tests/benchdnn/gnorm/gnorm_aux.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2023-2024 Intel Corporation
2+
* Copyright 2023-2025 Intel Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,8 +53,8 @@ int str2desc(desc_t *desc, const char *str) {
5353
const char *s = str;
5454
assert(s);
5555

56-
auto mstrtol = [](const char *nptr, char **endptr) {
57-
return strtol(nptr, endptr, 10);
56+
auto mstrtoll = [](const char *nptr, char **endptr) {
57+
return strtoll(nptr, endptr, 10);
5858
};
5959

6060
#define CASE_NN(prb, c, cvfunc) \
@@ -84,12 +84,12 @@ int str2desc(desc_t *desc, const char *str) {
8484
#define CASE_N(c, cvfunc) CASE_NN(#c, c, cvfunc)
8585
while (*s) {
8686
int ok = 0;
87-
CASE_N(g, mstrtol);
88-
CASE_N(mb, mstrtol);
89-
CASE_N(ic, mstrtol);
90-
CASE_N(id, mstrtol);
91-
CASE_N(ih, mstrtol);
92-
CASE_N(iw, mstrtol);
87+
CASE_N(g, mstrtoll);
88+
CASE_N(mb, mstrtoll);
89+
CASE_N(ic, mstrtoll);
90+
CASE_N(id, mstrtoll);
91+
CASE_N(ih, mstrtoll);
92+
CASE_N(iw, mstrtoll);
9393
CASE_N(eps, strtof);
9494
if (*s == 'n') {
9595
d.name = s + 1;

tests/benchdnn/ip/ip_aux.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int str2desc(desc_t *desc, const char *str) {
4949
ok = 1; \
5050
s += strlen(prb); \
5151
char *end_s; \
52-
d.c = strtol(s, &end_s, 10); \
52+
d.c = strtoll(s, &end_s, 10); \
5353
if (end_s == s) { \
5454
BENCHDNN_PRINT(0, \
5555
"ERROR: No value found for `%s` setting. Full " \

tests/benchdnn/lrn/lrn_aux.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2017-2024 Intel Corporation
2+
* Copyright 2017-2025 Intel Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -66,8 +66,8 @@ int str2desc(desc_t *desc, const char *str) {
6666
const char *s = str;
6767
assert(s);
6868

69-
auto mstrtol = [](const char *nptr, char **endptr) {
70-
return strtol(nptr, endptr, 10);
69+
auto mstrtoll = [](const char *nptr, char **endptr) {
70+
return strtoll(nptr, endptr, 10);
7171
};
7272

7373
#define CASE_NN(prb, c, cvfunc) \
@@ -97,12 +97,12 @@ int str2desc(desc_t *desc, const char *str) {
9797
#define CASE_N(c, cvfunc) CASE_NN(#c, c, cvfunc)
9898
while (*s) {
9999
int ok = 0;
100-
CASE_N(mb, mstrtol);
101-
CASE_N(ic, mstrtol);
102-
CASE_N(id, mstrtol);
103-
CASE_N(ih, mstrtol);
104-
CASE_N(iw, mstrtol);
105-
CASE_N(ls, mstrtol);
100+
CASE_N(mb, mstrtoll);
101+
CASE_N(ic, mstrtoll);
102+
CASE_N(id, mstrtoll);
103+
CASE_N(ih, mstrtoll);
104+
CASE_N(iw, mstrtoll);
105+
CASE_N(ls, mstrtoll);
106106
CASE_N(alpha, strtof);
107107
CASE_N(beta, strtof);
108108
CASE_N(k, strtof);

tests/benchdnn/pool/pool_aux.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2019-2024 Intel Corporation
2+
* Copyright 2019-2025 Intel Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -87,7 +87,7 @@ int str2desc(desc_t *desc, const char *str) {
8787
ok = 1; \
8888
s += strlen(prb); \
8989
char *end_s; \
90-
d.c = strtol(s, &end_s, 10); \
90+
d.c = strtoll(s, &end_s, 10); \
9191
if (end_s == s) { \
9292
BENCHDNN_PRINT(0, \
9393
"ERROR: No value found for `%s` setting. Full " \

tests/benchdnn/resampling/resampling_aux.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2019-2024 Intel Corporation
2+
* Copyright 2019-2025 Intel Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ int str2desc(desc_t *desc, const char *str) {
8080
ok = 1; \
8181
s += strlen(prb); \
8282
char *end_s; \
83-
d.c = strtol(s, &end_s, 10); \
83+
d.c = strtoll(s, &end_s, 10); \
8484
if (end_s == s) { \
8585
BENCHDNN_PRINT(0, \
8686
"ERROR: No value found for `%s` setting. Full " \

tests/benchdnn/rnn/rnn_aux.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2018-2024 Intel Corporation
2+
* Copyright 2018-2025 Intel Corporation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -194,7 +194,7 @@ int str2desc(desc_t *desc, const char *str) {
194194
ok = 1; \
195195
s += strlen(prb); \
196196
char *end_s; \
197-
d.c = strtol(s, &end_s, 10); \
197+
d.c = strtoll(s, &end_s, 10); \
198198
if (end_s == s) { \
199199
BENCHDNN_PRINT(0, \
200200
"ERROR: No value found for `%s` setting. Full " \

0 commit comments

Comments
 (0)