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
13d14c66
Commit
13d14c66
authored
Oct 24, 2023
by
Brian Pickrell
Browse files
Merge branch 'develop' into dyn_resize_gather
parents
f4e7d9d9
d1abf06f
Changes
420
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
271 additions
and
34 deletions
+271
-34
test/gpu/codegen_literal.cpp
test/gpu/codegen_literal.cpp
+1
-1
test/gpu/fuse_mlir.cpp
test/gpu/fuse_mlir.cpp
+3
-3
test/gpu/fuse_ops.cpp
test/gpu/fuse_ops.cpp
+107
-0
test/gpu/jit.cpp
test/gpu/jit.cpp
+10
-1
test/gpu/manage_host_buffer.cpp
test/gpu/manage_host_buffer.cpp
+2
-2
test/gpu/mlir.cpp
test/gpu/mlir.cpp
+2
-1
test/gpu/quantization.cpp
test/gpu/quantization.cpp
+6
-4
test/gpu/stream_sync.cpp
test/gpu/stream_sync.cpp
+1
-1
test/include/pointwise.hpp
test/include/pointwise.hpp
+16
-5
test/include/test.hpp
test/include/test.hpp
+2
-0
test/jit.cpp
test/jit.cpp
+1
-3
test/memory_coloring_test.cpp
test/memory_coloring_test.cpp
+1
-1
test/msgpack.cpp
test/msgpack.cpp
+83
-9
test/multi_target/multitarget_test.cpp
test/multi_target/multitarget_test.cpp
+0
-1
test/normalize_ops_test.cpp
test/normalize_ops_test.cpp
+1
-1
test/onnx/.onnxrt-commit
test/onnx/.onnxrt-commit
+1
-1
test/onnx/argmax_select_last_index_test.onnx
test/onnx/argmax_select_last_index_test.onnx
+0
-0
test/onnx/argmin_select_last_index_test.onnx
test/onnx/argmin_select_last_index_test.onnx
+0
-0
test/onnx/castlike_error_test.onnx
test/onnx/castlike_error_test.onnx
+14
-0
test/onnx/castlike_test.onnx
test/onnx/castlike_test.onnx
+20
-0
No files found.
test/gpu/codegen_literal.cpp
View file @
13d14c66
...
...
@@ -80,7 +80,7 @@ TEST_CASE(mul_literal_round_test)
migraphx
::
target
gpu_t
=
migraphx
::
make_target
(
"gpu"
);
run_prog
(
p
,
gpu_t
,
m
,
gpu_result
);
EXPECT
(
migraphx
::
verify
::
verify_range
(
ref
_result
,
gpu
_result
));
EXPECT
(
migraphx
::
verify
::
verify_
rms_
range
(
gpu
_result
,
ref
_result
));
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
test/gpu/fuse_mlir.cpp
View file @
13d14c66
...
...
@@ -34,7 +34,8 @@
void
run_pass
(
migraphx
::
program
&
p
)
{
migraphx
::
run_passes
(
p
,
{
migraphx
::
gpu
::
fuse_mlir
{},
migraphx
::
dead_code_elimination
{}});
migraphx
::
run_passes
(
p
,
{
migraphx
::
gpu
::
fuse_mlir
{.
enable_extra
=
true
},
migraphx
::
dead_code_elimination
{}});
}
template
<
class
F
>
...
...
@@ -151,7 +152,6 @@ TEST_CASE(int_quant_dot_tanh_fails)
int
main
(
int
argc
,
const
char
*
argv
[])
{
if
(
migraphx
::
gpu
::
mlir_enabled
())
test
::
run
(
argc
,
argv
);
test
::
run
(
argc
,
argv
);
return
0
;
}
test/gpu/fuse_ops.cpp
0 → 100644
View file @
13d14c66
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "make_precompile_op.hpp"
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/gpu/fuse_ops.hpp>
#include <migraphx/pass_manager.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/program.hpp>
#include <basic_ops.hpp>
#include <migraphx/make_op.hpp>
#include <test.hpp>
#include <pointwise.hpp>
void
run_pass
(
migraphx
::
program
&
p
)
{
migraphx
::
run_passes
(
p
,
{
migraphx
::
gpu
::
fuse_ops
{},
migraphx
::
dead_code_elimination
{}});
}
TEST_CASE
(
layernorm_pointwise
)
{
migraphx
::
shape
s
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
}};
auto
create_program
=
[
=
](
bool
first_arg_layernorm
)
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
y
=
mm
->
add_parameter
(
"y"
,
s
);
auto
z
=
mm
->
add_parameter
(
"z"
,
s
);
auto
alloc
=
migraphx
::
make_op
(
"allocate"
,
{{
"shape"
,
to_value
(
s
)}});
auto
alloc_ins
=
mm
->
add_instruction
(
alloc
);
auto
*
pw_add1
=
create_pointwise_module
(
p
,
"main:pointwise0"
,
{
x
,
y
},
single_pointwise
(
"add"
));
auto
add1
=
mm
->
add_instruction
(
make_precompile_op
(
"pointwise"
),
{
x
,
y
,
alloc_ins
},
{
pw_add1
});
auto
alloc_ins2
=
mm
->
add_instruction
(
alloc
);
auto
layernorm_ins
=
mm
->
add_instruction
(
make_precompile_op
(
"gpu::prelayernorm"
),
add1
,
alloc_ins2
);
std
::
vector
<
migraphx
::
instruction_ref
>
pw_inputs
=
{
layernorm_ins
,
z
};
if
(
not
first_arg_layernorm
)
{
pw_inputs
=
{
z
,
layernorm_ins
};
}
auto
*
pw_add2
=
create_pointwise_module
(
p
,
"main:pointwise1"
,
pw_inputs
,
single_pointwise
(
"add"
));
auto
alloc_ins3
=
mm
->
add_instruction
(
alloc
);
pw_inputs
.
push_back
(
alloc_ins3
);
auto
add2
=
mm
->
add_instruction
(
make_precompile_op
(
"pointwise"
),
pw_inputs
,
{
pw_add2
});
mm
->
add_return
({
add2
});
return
p
;
};
auto
create_fused_program
=
[
=
]()
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
s
);
auto
y
=
mm
->
add_parameter
(
"y"
,
s
);
auto
z
=
mm
->
add_parameter
(
"z"
,
s
);
auto
alloc
=
migraphx
::
make_op
(
"allocate"
,
{{
"shape"
,
to_value
(
s
)}});
auto
alloc_ins
=
mm
->
add_instruction
(
alloc
);
auto
*
pw_add1
=
create_pointwise_module
(
p
,
"main:pointwise0"
,
{
x
,
y
},
single_pointwise
(
"add"
));
auto
add1
=
mm
->
add_instruction
(
make_precompile_op
(
"pointwise"
),
{
x
,
y
,
alloc_ins
},
{
pw_add1
});
auto
alloc_ins2
=
mm
->
add_instruction
(
alloc
);
auto
*
pw_add2
=
create_pointwise_module
(
p
,
"main:pointwise1"
,
{
x
,
z
},
single_pointwise
(
"add"
));
auto
layernorm_ins
=
mm
->
add_instruction
(
make_precompile_op
(
"gpu::prelayernorm"
),
{
add1
,
z
,
alloc_ins2
},
{
pw_add2
});
mm
->
add_return
({
layernorm_ins
});
return
p
;
};
{
migraphx
::
program
p1
=
create_program
(
true
);
run_pass
(
p1
);
migraphx
::
program
p2
=
create_fused_program
();
EXPECT
(
p1
==
p2
);
}
{
migraphx
::
program
p1
=
create_program
(
false
);
run_pass
(
p1
);
migraphx
::
program
p2
=
create_fused_program
();
EXPECT
(
p1
==
p2
);
}
}
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
test/gpu/jit.cpp
View file @
13d14c66
...
...
@@ -155,7 +155,7 @@ int main() {}
migraphx
::
src_file
make_src_file
(
const
std
::
string
&
name
,
const
std
::
string
&
content
)
{
return
{
name
,
std
::
make_pair
(
content
.
data
(),
content
.
data
()
+
content
.
size
())
};
return
{
name
,
content
};
}
TEST_CASE
(
simple_compile_hip
)
...
...
@@ -218,6 +218,15 @@ TEST_CASE(compile_warnings)
#endif
}
TEST_CASE
(
has_flags
)
{
EXPECT
(
migraphx
::
gpu
::
hip_has_flags
({
"--std=c++17"
}));
EXPECT
(
not
migraphx
::
gpu
::
hip_has_flags
({
"--non-existent-flag-to-test-in-migraphx"
}));
EXPECT
(
migraphx
::
gpu
::
hip_has_flags
({
"-Wunused-parameter"
}));
EXPECT
(
not
migraphx
::
gpu
::
hip_has_flags
(
{
"-Wnon-existent-warnings-flag-to-test-in-migraphx"
,
"-Werror"
}));
}
TEST_CASE
(
code_object_hip
)
{
auto
binaries
=
migraphx
::
gpu
::
compile_hip_src
(
...
...
test/gpu/manage_host_buffer.cpp
View file @
13d14c66
...
...
@@ -53,7 +53,6 @@ TEST_CASE(host_same_buffer_copy)
migraphx
::
parameter_map
pp
;
std
::
vector
<
float
>
a_vec
(
ss
.
elements
(),
-
1
);
std
::
vector
<
float
>
b_vec
(
ss
.
elements
(),
2
);
std
::
vector
<
float
>
c_vec
(
ss
.
elements
(),
0
);
pp
[
"a"
]
=
migraphx
::
argument
(
ss
,
a_vec
.
data
());
pp
[
"b"
]
=
migraphx
::
argument
(
ss
,
b_vec
.
data
());
std
::
vector
<
float
>
gpu_result
;
...
...
@@ -64,7 +63,8 @@ TEST_CASE(host_same_buffer_copy)
auto
result
=
p
.
eval
(
pp
).
back
();
std
::
vector
<
float
>
results_vector
(
ss
.
elements
(),
-
1
);
result
.
visit
([
&
](
auto
output
)
{
results_vector
.
assign
(
output
.
begin
(),
output
.
end
());
});
EXPECT
(
migraphx
::
verify
::
verify_range
(
c_vec
,
results_vector
));
std
::
vector
<
float
>
gold_vec
(
ss
.
elements
(),
0
);
EXPECT
(
migraphx
::
verify
::
verify_rms_range
(
results_vector
,
gold_vec
));
}
TEST_CASE
(
arguments_lifetime
)
...
...
test/gpu/mlir.cpp
View file @
13d14c66
...
...
@@ -133,7 +133,8 @@ bool verify_mlir(const migraphx::module& mmlir)
auto
inputs
=
generate_params
(
ref
);
auto
mlir
=
create_program_from_mlir
(
mmlir
);
return
migraphx
::
verify_args
(
"mlir"
,
run_ref
(
ref
,
inputs
),
run_gpu
(
mlir
,
inputs
));
return
migraphx
::
verify_args_with_tolerance
(
"mlir"
,
run_gpu
(
mlir
,
inputs
),
migraphx
::
verify
::
expected
{
run_ref
(
ref
,
inputs
)});
}
TEST_CASE
(
conv
)
...
...
test/gpu/quantization.cpp
View file @
13d14c66
...
...
@@ -40,7 +40,6 @@
TEST_CASE
(
gpu_target_copy
)
{
migraphx
::
target
gpu_t
=
migraphx
::
make_target
(
"gpu"
);
migraphx
::
target
ref_t
=
migraphx
::
make_target
(
"ref"
);
migraphx
::
shape
s
{
migraphx
::
shape
::
int8_type
,
{
2
,
3
,
4
,
5
}};
auto
ref_arg_orig
=
migraphx
::
generate_argument
(
s
,
0x123456L
);
...
...
@@ -52,7 +51,7 @@ TEST_CASE(gpu_target_copy)
std
::
vector
<
int8_t
>
val_final
;
ref_arg_final
.
visit
([
&
](
auto
v
)
{
val_final
.
assign
(
v
.
begin
(),
v
.
end
());
});
EXPECT
(
migraphx
::
verify
::
verify_range
(
val_orig
,
val_final
));
EXPECT
(
migraphx
::
verify
::
verify_
rms_
range
(
val_orig
,
val_final
));
}
TEST_CASE
(
int8_quantization
)
...
...
@@ -118,9 +117,12 @@ TEST_CASE(int8_quantization)
// the regular pipeline uses the rewrite_quantization in the much
// earlier stage.
if
(
migraphx
::
gpu
::
mlir_enabled
())
EXPECT
(
migraphx
::
verify
::
verify_range
(
ref_result
,
gpu_result
,
1e5
));
EXPECT
(
migraphx
::
verify
::
verify_range_with_tolerance
(
gpu_result
,
migraphx
::
verify
::
expected
{
ref_result
},
migraphx
::
verify
::
tolerance
{
0.01
}));
else
EXPECT
(
migraphx
::
verify
::
verify_range
(
ref
_result
,
gpu
_result
));
EXPECT
(
migraphx
::
verify
::
verify_
rms_
range
(
gpu
_result
,
ref
_result
));
}
}
...
...
test/gpu/stream_sync.cpp
View file @
13d14c66
...
...
@@ -64,7 +64,7 @@ int main() {}
migraphx
::
src_file
make_src_file
(
const
std
::
string
&
name
,
const
std
::
string
&
content
)
{
return
{
name
,
std
::
make_pair
(
content
.
data
(),
content
.
data
()
+
content
.
size
())
};
return
{
name
,
content
};
}
hip_stream_ptr
get_stream
()
...
...
test/include/pointwise.hpp
View file @
13d14c66
...
...
@@ -24,16 +24,16 @@
#ifndef MIGRAPHX_GUARD_TEST_INCLUDE_POINTWISE_HPP
#define MIGRAPHX_GUARD_TEST_INCLUDE_POINTWISE_HPP
#include <migraphx/instruction_ref.hpp>
#include <migraphx/program.hpp>
#include <migraphx/module.hpp>
#include <migraphx/make_op.hpp>
template
<
class
F
>
migraphx
::
instruction_ref
add_pointwise
(
migraphx
::
program
&
p
,
migraphx
::
module_ref
mm
,
const
std
::
string
&
name
,
std
::
vector
<
migraphx
::
instruction_ref
>
inputs
,
F
f
)
migraphx
::
module_ref
create_pointwise_module
(
migraphx
::
program
&
p
,
const
std
::
string
&
name
,
std
::
vector
<
migraphx
::
instruction_ref
>
inputs
,
F
f
)
{
auto
*
pm
=
p
.
create_module
(
name
);
pm
->
set_bypass
();
...
...
@@ -44,6 +44,17 @@ migraphx::instruction_ref add_pointwise(migraphx::program& p,
});
auto
r
=
f
(
pm
,
params
);
pm
->
add_return
({
r
});
return
pm
;
}
template
<
class
F
>
migraphx
::
instruction_ref
add_pointwise
(
migraphx
::
program
&
p
,
migraphx
::
module_ref
mm
,
const
std
::
string
&
name
,
std
::
vector
<
migraphx
::
instruction_ref
>
inputs
,
F
f
)
{
auto
*
pm
=
create_pointwise_module
(
p
,
name
,
inputs
,
f
);
return
mm
->
add_instruction
(
migraphx
::
make_op
(
"pointwise"
),
inputs
,
{
pm
});
}
...
...
test/include/test.hpp
View file @
13d14c66
...
...
@@ -339,6 +339,8 @@ inline std::ostream& operator<<(std::ostream& os, const color& c)
static
const
bool
use_color
=
isatty
(
STDOUT_FILENO
)
!=
0
;
if
(
use_color
)
return
os
<<
"
\033
["
<<
static_cast
<
std
::
size_t
>
(
c
)
<<
"m"
;
#else
(
void
)
c
;
#endif
return
os
;
}
...
...
test/jit.cpp
View file @
13d14c66
...
...
@@ -48,9 +48,7 @@ compile_function(const std::string& src, const std::string& flags, const std::st
migraphx
::
src_compiler
compiler
;
compiler
.
flags
=
flags
+
"-std=c++14 -fPIC -shared"
;
compiler
.
output
=
"libsimple.so"
;
migraphx
::
src_file
f
;
f
.
path
=
"main.cpp"
;
f
.
content
=
std
::
make_pair
(
src
.
data
(),
src
.
data
()
+
src
.
size
());
migraphx
::
src_file
f
{
"main.cpp"
,
src
};
auto
image
=
compiler
.
compile
({
f
});
return
migraphx
::
dynamic_loader
{
image
}.
get_function
<
F
>
(
fname
);
}
...
...
test/memory_coloring_test.cpp
View file @
13d14c66
...
...
@@ -55,7 +55,7 @@ struct allocate
const
migraphx
::
shape
&
output_shape
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
{
return
{
output_shape
};
return
migraphx
::
argument
{
output_shape
};
}
};
...
...
test/msgpack.cpp
View file @
13d14c66
...
...
@@ -25,13 +25,37 @@
#include <migraphx/value.hpp>
#include <msgpack.hpp>
#include <map>
#include <numeric>
#include "test.hpp"
template
<
class
T
,
MIGRAPHX_REQUIRES
(
not
std
::
is_base_of
<
std
::
vector
<
std
::
uint8_t
>,
T
>
{})
>
void
write_msgpack
(
std
::
ostream
&
os
,
const
T
&
src
)
{
msgpack
::
pack
(
os
,
src
);
}
void
write_msgpack
(
std
::
ostream
&
os
,
const
std
::
vector
<
std
::
uint8_t
>&
src
)
{
const
auto
limit
=
std
::
numeric_limits
<
uint32_t
>::
max
()
-
1
;
std
::
vector
<
std
::
vector
<
std
::
uint8_t
>>
chunks
;
if
(
src
.
size
()
>
limit
)
{
// Only test two chunks
assert
(
std
::
distance
(
src
.
begin
()
+
limit
,
src
.
end
())
<
limit
);
chunks
.
emplace_back
(
src
.
begin
(),
src
.
begin
()
+
limit
);
chunks
.
emplace_back
(
src
.
begin
()
+
limit
,
src
.
end
());
}
else
{
chunks
=
{
src
};
}
write_msgpack
(
os
,
chunks
);
}
template
<
class
T
>
std
::
vector
<
char
>
msgpack_buffer
(
const
T
&
src
)
{
std
::
stringstream
buffer
;
msgpack
::
pack
(
buffer
,
src
);
write_msg
pack
(
buffer
,
src
);
buffer
.
seekg
(
0
);
std
::
string
str
=
buffer
.
str
();
return
std
::
vector
<
char
>
(
str
.
data
(),
str
.
data
()
+
str
.
size
());
// NOLINT
...
...
@@ -73,9 +97,12 @@ TEST_CASE(test_msgpack_bool)
TEST_CASE
(
test_msgpack_float
)
{
migraphx
::
value
v
=
3.0
;
// changed all double values in this code to not end with .0 because on msgpack for Windows if
// input type is double and ends with .0 it could be converted to uint64_t or int64_t and the
// goal of these functions is to test double without conversions
migraphx
::
value
v
=
3.01
;
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
3.0
));
EXPECT
(
buffer
==
msgpack_buffer
(
3.0
1
));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
}
...
...
@@ -105,10 +132,10 @@ TEST_CASE(test_msgpack_empty_array)
TEST_CASE
(
test_msgpack_object
)
{
migraphx
::
value
v
=
{{
"one"
,
1.0
},
{
"three"
,
3.0
},
{
"two"
,
2.0
}};
migraphx
::
value
v
=
{{
"one"
,
1.0
1
},
{
"three"
,
3.0
1
},
{
"two"
,
2.0
1
}};
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
std
::
map
<
std
::
string
,
double
>
{
{
"one"
,
1.0
},
{
"three"
,
3.0
},
{
"two"
,
2.0
}}));
{
"one"
,
1.0
1
},
{
"three"
,
3.0
1
},
{
"two"
,
2.0
1
}}));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
}
...
...
@@ -133,18 +160,65 @@ struct foo
TEST_CASE
(
test_msgpack_object_class
)
{
migraphx
::
value
v
=
{{
"a"
,
1.0
},
{
"b"
,
"abc"
}};
migraphx
::
value
v
=
{{
"a"
,
1.0
1
},
{
"b"
,
"abc"
}};
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
foo
{
1.0
,
"abc"
}));
EXPECT
(
buffer
==
msgpack_buffer
(
foo
{
1.0
1
,
"abc"
}));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
}
TEST_CASE
(
test_msgpack_array_class
)
{
migraphx
::
value
v
=
{{{
"a"
,
1.0
},
{
"b"
,
"abc"
}},
{{
"a"
,
3.0
},
{
"b"
,
"xyz"
}}};
migraphx
::
value
v
=
{{{
"a"
,
1.0
1
},
{
"b"
,
"abc"
}},
{{
"a"
,
3.0
1
},
{
"b"
,
"xyz"
}}};
auto
buffer
=
migraphx
::
to_msgpack
(
v
);
EXPECT
(
buffer
==
msgpack_buffer
(
std
::
vector
<
foo
>
{
foo
{
1.0
,
"abc"
},
foo
{
3.0
,
"xyz"
}}));
EXPECT
(
buffer
==
msgpack_buffer
(
std
::
vector
<
foo
>
{
foo
{
1.0
1
,
"abc"
},
foo
{
3.0
1
,
"xyz"
}}));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
v
);
}
TEST_CASE
(
test_msgpack_binary
)
{
migraphx
::
value
::
binary
bin
{
64
};
std
::
iota
(
bin
.
begin
(),
bin
.
end
(),
1
);
auto
buffer
=
migraphx
::
to_msgpack
(
bin
);
EXPECT
(
buffer
==
msgpack_buffer
(
bin
));
EXPECT
(
migraphx
::
from_msgpack
(
buffer
)
==
bin
);
}
#ifndef MIGRAPHX_DISABLE_LARGE_BUFFER_TESTS
TEST_CASE
(
test_msgpack_large_binary1
)
{
const
std
::
size_t
n
=
4LL
*
1024
*
1024
*
1024
+
2
;
const
char
fill_value
=
2
;
migraphx
::
value
v
;
{
std
::
vector
<
char
>
buffer
;
{
migraphx
::
value
::
binary
bin
{
n
};
std
::
fill
(
bin
.
begin
(),
bin
.
begin
()
+
n
/
2
,
fill_value
);
std
::
fill
(
bin
.
begin
()
+
n
/
2
,
bin
.
end
(),
fill_value
+
1
);
buffer
=
migraphx
::
to_msgpack
(
std
::
move
(
bin
));
}
v
=
migraphx
::
from_msgpack
(
buffer
);
}
EXPECT
(
v
.
is_binary
());
EXPECT
(
v
.
get_binary
().
size
()
==
n
);
EXPECT
(
std
::
all_of
(
v
.
get_binary
().
begin
(),
v
.
get_binary
().
begin
()
+
n
/
2
,
[](
auto
c
)
{
return
c
==
fill_value
;
}));
EXPECT
(
std
::
all_of
(
v
.
get_binary
().
begin
()
+
n
/
2
,
v
.
get_binary
().
end
(),
[](
auto
c
)
{
return
c
==
fill_value
+
1
;
}));
}
TEST_CASE
(
test_msgpack_binary2
)
{
const
std
::
size_t
n
=
4LL
*
1024
*
1024
*
1024
+
2
;
migraphx
::
value
::
binary
bin
{
n
};
std
::
size_t
i
=
0
;
std
::
generate
(
bin
.
begin
(),
bin
.
end
(),
[
&
]
{
i
++
;
return
i
%
256
;
});
EXPECT
(
migraphx
::
to_msgpack
(
bin
)
==
msgpack_buffer
(
bin
));
}
#endif
int
main
(
int
argc
,
const
char
*
argv
[])
{
test
::
run
(
argc
,
argv
);
}
test/multi_target/multitarget_test.cpp
View file @
13d14c66
...
...
@@ -37,7 +37,6 @@
#include <migraphx/make_op.hpp>
#include <migraphx/check_shapes.hpp>
#include <migraphx/functional.hpp>
#include <basic_ops.hpp>
#include <migraphx/compile_options.hpp>
#include <migraphx/register_target.hpp>
#include <migraphx/generate.hpp>
...
...
test/normalize_ops_test.cpp
View file @
13d14c66
...
...
@@ -57,7 +57,7 @@ struct normalize_test_op
const
migraphx
::
shape
&
output_shape
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
{
return
{
output_shape
};
return
migraphx
::
argument
{
output_shape
};
}
};
...
...
test/onnx/.onnxrt-commit
View file @
13d14c66
ae74a517b62baa6d973e46b5b51ac9a640512c46
635d3faa3b3908d2806d009dc6872152cfcfcdda
test/onnx/argmax_select_last_index_test.onnx
0 → 100644
View file @
13d14c66
File added
test/onnx/argmin_select_last_index_test.onnx
0 → 100644
View file @
13d14c66
File added
test/onnx/castlike_error_test.onnx
0 → 100644
View file @
13d14c66
castlike_error_test:M
0out"CastLikecastlike_error_testZ
0
b
out
B
\ No newline at end of file
test/onnx/castlike_test.onnx
0 → 100644
View file @
13d14c66
castlike_test:[
0
1out"CastLike castlike_testZ
0
Z
1
b
out
B
\ No newline at end of file
Prev
1
…
5
6
7
8
9
10
11
12
13
…
21
Next
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