Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
27997410
Commit
27997410
authored
Sep 20, 2023
by
Umang Yadav
Browse files
rename threshold to tolerance
parent
97226839
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
25 additions
and
23 deletions
+25
-23
src/driver/main.cpp
src/driver/main.cpp
+1
-1
src/driver/verify.cpp
src/driver/verify.cpp
+4
-4
src/driver/verify.hpp
src/driver/verify.hpp
+3
-3
src/include/migraphx/verify.hpp
src/include/migraphx/verify.hpp
+4
-4
src/include/migraphx/verify_args.hpp
src/include/migraphx/verify_args.hpp
+1
-1
src/verify_args.cpp
src/verify_args.cpp
+2
-2
test/gpu/quantization.cpp
test/gpu/quantization.cpp
+1
-1
test/quantization.cpp
test/quantization.cpp
+1
-1
test/ref/dot_op.cpp
test/ref/dot_op.cpp
+2
-2
test/ref/multinomial.cpp
test/ref/multinomial.cpp
+1
-1
test/ref/random_uniform.cpp
test/ref/random_uniform.cpp
+1
-1
test/ref/rnn_ops.cpp
test/ref/rnn_ops.cpp
+4
-2
No files found.
src/driver/main.cpp
View file @
27997410
...
...
@@ -536,7 +536,7 @@ struct params : command<params>
struct
verify
:
command
<
verify
>
{
compiler
c
;
migraphx
::
verify
::
t
hreshold
tols
;
migraphx
::
verify
::
t
olerance
tols
;
bool
per_instruction
=
false
;
bool
reduce
=
false
;
void
parse
(
argument_parser
&
ap
)
...
...
src/driver/verify.cpp
View file @
27997410
...
...
@@ -77,7 +77,7 @@ void verify_program(const std::string& name,
compile_options
options
,
precision
quantize
,
const
parameter_map
&
inputs
,
verify
::
t
hreshold
tols
)
verify
::
t
olerance
tols
)
{
auto
x
=
run_ref
(
p
,
inputs
);
auto
y
=
run_target
(
p
,
t
,
options
,
quantize
,
inputs
);
...
...
@@ -93,7 +93,7 @@ void verify_instructions(const program& prog,
const
target
&
t
,
compile_options
options
,
precision
quantize
,
verify
::
t
hreshold
tols
)
verify
::
t
olerance
tols
)
{
const
auto
*
mm_prog
=
prog
.
get_main_module
();
for
(
auto
&&
ins
:
(
*
mm_prog
))
...
...
@@ -140,7 +140,7 @@ void verify_reduced(program p,
compile_options
options
,
precision
quantize
,
const
parameter_map
&
inputs
,
verify
::
t
hreshold
tols
)
verify
::
t
olerance
tols
)
{
auto
*
mm
=
p
.
get_main_module
();
auto
last
=
std
::
prev
(
mm
->
end
(),
n
+
1
);
...
...
@@ -155,7 +155,7 @@ void verify_reduced_program(const program& p,
compile_options
options
,
precision
quantize
,
const
parameter_map
&
inputs
,
verify
::
t
hreshold
tols
)
verify
::
t
olerance
tols
)
{
const
auto
*
mm
=
p
.
get_main_module
();
auto
n
=
std
::
distance
(
mm
->
begin
(),
mm
->
end
());
...
...
src/driver/verify.hpp
View file @
27997410
...
...
@@ -38,18 +38,18 @@ void verify_program(const std::string& name,
compile_options
options
=
compile_options
{},
precision
quantize
=
precision
::
fp32
,
const
parameter_map
&
inputs
=
{},
verify
::
t
hreshold
tols
=
verify
::
t
hreshold
{});
verify
::
t
olerance
tols
=
verify
::
t
olerance
{});
void
verify_instructions
(
const
program
&
prog
,
const
target
&
t
,
compile_options
options
=
compile_options
{},
precision
quantize
=
precision
::
fp32
,
verify
::
t
hreshold
tols
=
verify
::
t
hreshold
{});
verify
::
t
olerance
tols
=
verify
::
t
olerance
{});
void
verify_reduced_program
(
const
program
&
p
,
const
target
&
t
,
compile_options
options
=
compile_options
{},
precision
quantize
=
precision
::
fp32
,
const
parameter_map
&
inputs
=
{},
verify
::
t
hreshold
tols
=
verify
::
t
hreshold
{});
verify
::
t
olerance
tols
=
verify
::
t
olerance
{});
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace driver
...
...
src/include/migraphx/verify.hpp
View file @
27997410
...
...
@@ -214,7 +214,7 @@ struct expected
template
<
class
T
>
expected
(
const
T
&
)
->
expected
<
T
>
;
struct
t
hreshold
struct
t
olerance
{
double
rms_tol
=
0.001
;
double
atol
=
0.001
;
...
...
@@ -222,7 +222,7 @@ struct threshold
};
template
<
class
R1
,
class
R2
>
bool
allclose
(
const
R1
&
r1
,
const
R2
&
r2
,
t
hreshold
thres
)
bool
allclose
(
const
R1
&
r1
,
const
R2
&
r2
,
t
olerance
thres
)
{
std
::
size_t
n
=
range_distance
(
r1
);
if
(
n
==
range_distance
(
r2
))
...
...
@@ -256,7 +256,7 @@ bool verify_range(const R1& r1,
template
<
class
R1
,
class
R2
>
bool
verify_range_with_threshold
(
const
R1
&
r1
,
const
expected
<
R2
>&
r2
,
t
hreshold
tols
=
t
hreshold
{},
t
olerance
tols
=
t
olerance
{},
double
*
out_error
=
nullptr
)
{
auto
rms_error
=
rms_range
(
r1
,
r2
.
data
());
...
...
@@ -272,7 +272,7 @@ bool verify_range_with_threshold(const R1& r1,
template
<
class
R1
,
class
R2
>
bool
verify_range_with_threshold
(
const
expected
<
R1
>&
r1
,
const
R2
&
r2
,
t
hreshold
tols
=
t
hreshold
{},
t
olerance
tols
=
t
olerance
{},
double
*
out_error
=
nullptr
)
{
return
verify_range
(
r2
,
r1
,
tols
,
out_error
);
...
...
src/include/migraphx/verify_args.hpp
View file @
27997410
...
...
@@ -34,7 +34,7 @@ inline namespace MIGRAPHX_INLINE_NS {
MIGRAPHX_EXPORT
bool
verify_args_with_threshold
(
const
std
::
string
&
name
,
const
argument
&
ref_arg
,
const
argument
&
target_arg
,
verify
::
t
hreshold
);
verify
::
t
olerance
);
MIGRAPHX_EXPORT
bool
verify_args
(
const
std
::
string
&
name
,
const
argument
&
target_arg
,
...
...
src/verify_args.cpp
View file @
27997410
...
...
@@ -30,7 +30,7 @@ inline namespace MIGRAPHX_INLINE_NS {
bool
verify_args_with_threshold
(
const
std
::
string
&
name
,
const
argument
&
target_arg
,
const
argument
&
ref_arg
,
verify
::
t
hreshold
tols
)
verify
::
t
olerance
tols
)
{
bool
passed
=
true
;
visit_all
(
ref_arg
,
target_arg
)([
&
](
auto
ref
,
auto
target
)
{
...
...
@@ -100,7 +100,7 @@ bool verify_args(const std::string& name,
{
double
rms_tol
=
0.001
;
target_arg
.
visit
([
&
](
auto
ta
)
{
rms_tol
=
verify
::
get_rms_tol
(
ta
,
tolerance
);
});
verify
::
t
hreshold
tols
{
rms_tol
};
verify
::
t
olerance
tols
{
rms_tol
};
return
verify_args_with_threshold
(
name
,
target_arg
,
ref_arg
,
tols
);
}
...
...
test/gpu/quantization.cpp
View file @
27997410
...
...
@@ -120,7 +120,7 @@ TEST_CASE(int8_quantization)
EXPECT
(
migraphx
::
verify
::
verify_range_with_threshold
(
gpu_result
,
migraphx
::
verify
::
expected
{
ref_result
},
migraphx
::
verify
::
t
hreshold
{
0.01
}));
migraphx
::
verify
::
t
olerance
{
0.01
}));
else
EXPECT
(
migraphx
::
verify
::
verify_range
(
gpu_result
,
ref_result
));
}
...
...
test/quantization.cpp
View file @
27997410
...
...
@@ -1080,7 +1080,7 @@ TEST_CASE(int8_quantization_dot)
EXPECT
(
migraphx
::
verify
::
verify_range_with_threshold
(
quant_result
,
migraphx
::
verify
::
expected
{
no_quant_result
},
migraphx
::
verify
::
t
hreshold
{
0.003
}));
migraphx
::
verify
::
t
olerance
{
0.003
}));
}
}
...
...
test/ref/dot_op.cpp
View file @
27997410
...
...
@@ -79,7 +79,7 @@ void dot_2d_test()
2.16294914e+00
,
-
1.48101497e-01
};
EXPECT
(
migraphx
::
verify
::
verify_range_with_threshold
(
results_vector
,
migraphx
::
verify
::
expected
{
gold
},
migraphx
::
verify
::
t
hreshold
{
9e-6
}));
results_vector
,
migraphx
::
verify
::
expected
{
gold
},
migraphx
::
verify
::
t
olerance
{
9e-6
}));
}
TEST_CASE_REGISTER
(
dot_2d_test
<
float
>
)
TEST_CASE_REGISTER
(
dot_2d_test
<
double
>
)
...
...
@@ -131,7 +131,7 @@ void dot_4d_test()
std
::
vector
<
T
>
results_vector
;
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
EXPECT
(
migraphx
::
verify
::
verify_range_with_threshold
(
results_vector
,
migraphx
::
verify
::
expected
{
gold
},
migraphx
::
verify
::
t
hreshold
{
9e-6
}));
results_vector
,
migraphx
::
verify
::
expected
{
gold
},
migraphx
::
verify
::
t
olerance
{
9e-6
}));
}
TEST_CASE_REGISTER
(
dot_4d_test
<
float
>
)
...
...
test/ref/multinomial.cpp
View file @
27997410
...
...
@@ -79,5 +79,5 @@ TEST_CASE(multinomial_test)
return
static_cast
<
double
>
(
n
)
/
res_dist_sum
;
});
EXPECT
(
migraphx
::
verify
::
verify_range_with_threshold
(
res_norm
,
migraphx
::
verify
::
expected
{
norm
},
migraphx
::
verify
::
t
hreshold
{
0.01
}));
res_norm
,
migraphx
::
verify
::
expected
{
norm
},
migraphx
::
verify
::
t
olerance
{
0.01
}));
}
test/ref/random_uniform.cpp
View file @
27997410
...
...
@@ -70,7 +70,7 @@ TEST_CASE(random_uniform_test)
std
::
generate
(
rand_samples
.
begin
(),
rand_samples
.
end
(),
[
&
]()
{
return
dis
(
gen
);
});
EXPECT
(
migraphx
::
verify
::
verify_range_with_threshold
(
result_vec
,
migraphx
::
verify
::
expected
{
rand_samples
},
migraphx
::
verify
::
t
hreshold
{
0.00001
}));
migraphx
::
verify
::
t
olerance
{
0.00001
}));
}
TEST_CASE
(
random_uniform_int_test
)
...
...
test/ref/rnn_ops.cpp
View file @
27997410
...
...
@@ -1009,7 +1009,9 @@ TEST_CASE(rnn_fp16)
std
::
vector
<
float
>
last_output_data_gold
{
0.2935145
,
-
0.23719997
,
-
0.31123261
,
-
0.18357255
,
0.
,
0.
,
0.
,
0.
};
EXPECT
(
migraphx
::
verify
::
verify_range_with_threshold
(
last_output_data
,
migraphx
::
verify
::
expected
{
last_output_data_gold
},
migraphx
::
verify
::
threshold
{
0.005
}));
last_output_data
,
migraphx
::
verify
::
expected
{
last_output_data_gold
},
migraphx
::
verify
::
tolerance
{
0.005
}));
}
TEST_CASE
(
gru_forward
)
...
...
@@ -2985,7 +2987,7 @@ TEST_CASE(gru_fp16)
-
0.21944991
,
0.4535257
,
-
0.13735442
,
0.51757574
,
0.50380427
};
EXPECT
(
migraphx
::
verify
::
verify_range_with_threshold
(
hs_data
,
migraphx
::
verify
::
expected
{
hs_data_gold
},
migraphx
::
verify
::
t
hreshold
{
0.005
}));
hs_data
,
migraphx
::
verify
::
expected
{
hs_data_gold
},
migraphx
::
verify
::
t
olerance
{
0.005
}));
}
TEST_CASE
(
lstm_forward
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment