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
bd0ae5fa
"vscode:/vscode.git/clone" did not exist on "f77db747d07d5c90a3a9f70bb17f71d4573f329e"
Commit
bd0ae5fa
authored
Nov 17, 2023
by
Umang Yadav
Browse files
add some more tests
parent
76f03182
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
55 deletions
+33
-55
test/verify/test_concat_axis_0.cpp
test/verify/test_concat_axis_0.cpp
+11
-4
test/verify/test_gather.cpp
test/verify/test_gather.cpp
+9
-5
test/verify/test_gathernd_default.cpp
test/verify/test_gathernd_default.cpp
+7
-2
test/verify/test_isnan_float.cpp
test/verify/test_isnan_float.cpp
+6
-1
test/verify/test_isnan_half.cpp
test/verify/test_isnan_half.cpp
+0
-43
No files found.
test/verify/test_concat_axis_0.cpp
View file @
bd0ae5fa
...
@@ -27,16 +27,18 @@
...
@@ -27,16 +27,18 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
struct
test_concat_axis_0
:
verify_program
<
test_concat_axis_0
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_concat_axis_0
:
verify_program
<
test_concat_axis_0
<
DType
>>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
int
axis
=
0
;
int
axis
=
0
;
migraphx
::
shape
s0
{
migraphx
::
shape
::
int32_t
ype
,
{
2
,
2
}};
migraphx
::
shape
s0
{
DT
ype
,
{
2
,
2
}};
migraphx
::
shape
s1
{
migraphx
::
shape
::
int32_t
ype
,
{
3
,
2
}};
migraphx
::
shape
s1
{
DT
ype
,
{
3
,
2
}};
migraphx
::
shape
s2
{
migraphx
::
shape
::
int32_t
ype
,
{
1
,
2
}};
migraphx
::
shape
s2
{
DT
ype
,
{
1
,
2
}};
auto
l0
=
mm
->
add_parameter
(
"x"
,
s0
);
auto
l0
=
mm
->
add_parameter
(
"x"
,
s0
);
auto
l1
=
mm
->
add_parameter
(
"y"
,
s1
);
auto
l1
=
mm
->
add_parameter
(
"y"
,
s1
);
auto
l2
=
mm
->
add_parameter
(
"z"
,
s2
);
auto
l2
=
mm
->
add_parameter
(
"z"
,
s2
);
...
@@ -44,3 +46,8 @@ struct test_concat_axis_0 : verify_program<test_concat_axis_0>
...
@@ -44,3 +46,8 @@ struct test_concat_axis_0 : verify_program<test_concat_axis_0>
return
p
;
return
p
;
}
}
};
};
template
struct
test_concat_axis_0
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
template
struct
test_concat_axis_0
<
migraphx
::
shape
::
half_type
>;
template
struct
test_concat_axis_0
<
migraphx
::
shape
::
float_type
>;
template
struct
test_concat_axis_0
<
migraphx
::
shape
::
int32_type
>;
test/verify/test_gather.cpp
View file @
bd0ae5fa
...
@@ -27,14 +27,14 @@
...
@@ -27,14 +27,14 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
template
<
int
Axis
>
template
<
int
Axis
,
migraphx
::
shape
::
type_t
DType
>
struct
test_gather
:
verify_program
<
test_gather
<
Axis
>>
struct
test_gather
:
verify_program
<
test_gather
<
Axis
,
DType
>>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
s
{
migraphx
::
shape
::
float_t
ype
,
{
3
,
3
}};
migraphx
::
shape
s
{
DT
ype
,
{
3
,
3
}};
migraphx
::
shape
s_indices
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
}};
migraphx
::
shape
s_indices
{
migraphx
::
shape
::
int32_type
,
{
2
,
2
}};
std
::
vector
<
int
>
indices
{
1
,
2
,
2
,
1
};
std
::
vector
<
int
>
indices
{
1
,
2
,
2
,
1
};
auto
a0
=
mm
->
add_parameter
(
"data"
,
s
);
auto
a0
=
mm
->
add_parameter
(
"data"
,
s
);
...
@@ -46,6 +46,10 @@ struct test_gather : verify_program<test_gather<Axis>>
...
@@ -46,6 +46,10 @@ struct test_gather : verify_program<test_gather<Axis>>
};
};
// Standard gather test
// Standard gather test
template
struct
test_gather
<
0
>;
template
struct
test_gather
<
0
,
migraphx
::
shape
::
float_type
>;
template
struct
test_gather
<
0
,
migraphx
::
shape
::
half_type
>;
template
struct
test_gather
<
0
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
// Test Negative axis
// Test Negative axis
template
struct
test_gather
<-
2
>;
template
struct
test_gather
<-
2
,
migraphx
::
shape
::
float_type
>;
template
struct
test_gather
<-
2
,
migraphx
::
shape
::
half_type
>;
template
struct
test_gather
<-
2
,
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_gathernd_default.cpp
View file @
bd0ae5fa
...
@@ -26,13 +26,14 @@
...
@@ -26,13 +26,14 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
struct
test_gathernd_default
:
verify_program
<
test_gathernd_default
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_gathernd_default
:
verify_program
<
test_gathernd_default
,
DType
>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
{
{
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
ds
{
migraphx
::
shape
::
float_t
ype
,
{
2
,
2
}};
migraphx
::
shape
ds
{
DT
ype
,
{
2
,
2
}};
migraphx
::
shape
is
{
migraphx
::
shape
::
int64_type
,
{
2
,
2
}};
migraphx
::
shape
is
{
migraphx
::
shape
::
int64_type
,
{
2
,
2
}};
std
::
vector
<
int64_t
>
indices
{
0
,
0
,
1
,
1
};
std
::
vector
<
int64_t
>
indices
{
0
,
0
,
1
,
1
};
auto
a0
=
mm
->
add_parameter
(
"data"
,
ds
);
auto
a0
=
mm
->
add_parameter
(
"data"
,
ds
);
...
@@ -41,3 +42,7 @@ struct test_gathernd_default : verify_program<test_gathernd_default>
...
@@ -41,3 +42,7 @@ struct test_gathernd_default : verify_program<test_gathernd_default>
return
p
;
return
p
;
}
}
};
};
template
struct
test_gathernd_default
<
migraphx
::
shape
::
float_type
>;
template
struct
test_gathernd_default
<
migraphx
::
shape
::
half_type
>;
template
struct
test_gathernd_default
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_isnan_float.cpp
View file @
bd0ae5fa
...
@@ -27,7 +27,8 @@
...
@@ -27,7 +27,8 @@
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/make_op.hpp>
struct
test_isnan_float
:
verify_program
<
test_isnan_float
>
template
<
migraphx
::
shape
::
type_t
DType
>
struct
test_isnan
:
verify_program
<
test_isnan
<
DType
>>
{
{
migraphx
::
program
create_program
()
const
migraphx
::
program
create_program
()
const
{
{
...
@@ -40,3 +41,7 @@ struct test_isnan_float : verify_program<test_isnan_float>
...
@@ -40,3 +41,7 @@ struct test_isnan_float : verify_program<test_isnan_float>
return
p
;
return
p
;
}
}
};
};
template
struct
test_isnan
<
migraphx
::
shape
::
float_type
>;
template
struct
test_isnan
<
migraphx
::
shape
::
half_type
>;
template
struct
test_isnan
<
migraphx
::
shape
::
fp8e4m3fnuz_type
>;
test/verify/test_isnan_half.cpp
deleted
100644 → 0
View file @
76f03182
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 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 <limits>
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/half.hpp>
struct
test_isnan_half
:
verify_program
<
test_isnan_half
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
auto
x
=
mm
->
add_parameter
(
"x"
,
migraphx
::
shape
{
migraphx
::
shape
::
half_type
,
{
2
}});
auto
l0
=
mm
->
add_literal
(
std
::
numeric_limits
<
migraphx
::
half
>::
quiet_NaN
());
x
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"concat"
,
{{
"axis"
,
0
}}),
x
,
l0
);
mm
->
add_instruction
(
migraphx
::
make_op
(
"isnan"
),
x
);
return
p
;
}
};
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