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
f94d77fc
Commit
f94d77fc
authored
Aug 04, 2021
by
Khalique Ahmed
Browse files
Merge branch 'develop' of
https://github.com/ROCmSoftwarePlatform/AMDMIGraphX
into mi100_opts
parents
03929873
6403d482
Changes
126
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
6 deletions
+64
-6
test/verify/test_scatter0.cpp
test/verify/test_scatter0.cpp
+26
-0
test/verify/test_scatter1.cpp
test/verify/test_scatter1.cpp
+27
-0
tools/api.py
tools/api.py
+1
-1
tools/include/allocation_model.hpp
tools/include/allocation_model.hpp
+4
-1
tools/include/operation.hpp
tools/include/operation.hpp
+5
-3
tools/te.py
tools/te.py
+1
-1
No files found.
test/verify/test_scatter0.cpp
0 → 100644
View file @
f94d77fc
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_scatter0
:
verify_program
<
test_scatter0
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sd
{
migraphx
::
shape
::
float_type
,
{
3
,
3
}};
migraphx
::
shape
si
{
migraphx
::
shape
::
int32_type
,
{
2
,
3
}};
std
::
vector
<
int
>
vi
=
{
1
,
0
,
2
,
0
,
2
,
1
};
migraphx
::
shape
su
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
auto
pd
=
mm
->
add_parameter
(
"data"
,
sd
);
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
{
si
,
vi
});
auto
pu
=
mm
->
add_parameter
(
"update"
,
su
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatter"
,
{{
"axis"
,
-
1
}}),
pd
,
li
,
pu
);
mm
->
add_return
({
r
});
return
p
;
}
};
test/verify/test_scatter1.cpp
0 → 100644
View file @
f94d77fc
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
struct
test_scatter1
:
verify_program
<
test_scatter1
>
{
migraphx
::
program
create_program
()
const
{
migraphx
::
program
p
;
auto
*
mm
=
p
.
get_main_module
();
migraphx
::
shape
sd
{
migraphx
::
shape
::
float_type
,
{
3
,
3
}};
migraphx
::
shape
si
{
migraphx
::
shape
::
int32_type
,
{
2
,
3
}};
std
::
vector
<
int
>
vi
=
{
-
2
,
0
,
2
,
0
,
-
1
,
1
};
migraphx
::
shape
su
{
migraphx
::
shape
::
float_type
,
{
2
,
3
}};
auto
pd
=
mm
->
add_parameter
(
"data"
,
sd
);
auto
li
=
mm
->
add_literal
(
migraphx
::
literal
{
si
,
vi
});
auto
pu
=
mm
->
add_parameter
(
"update"
,
su
);
auto
r
=
mm
->
add_instruction
(
migraphx
::
make_op
(
"scatter"
,
{{
"axis"
,
-
2
}}),
pd
,
li
,
pu
);
mm
->
add_return
({
r
});
return
p
;
}
};
tools/api.py
100644 → 100755
View file @
f94d77fc
import
string
,
sys
,
re
,
os
,
runpy
import
string
,
sys
,
re
,
runpy
from
functools
import
wraps
type_map
=
{}
...
...
tools/include/allocation_model.hpp
View file @
f94d77fc
...
...
@@ -26,6 +26,8 @@ struct allocation_model
std
::
string
copy
()
const
;
/// Create an allocation operator for the given shape
operation
allocate
(
const
shape
&
s
)
const
;
/// Create a preallocated operator for the given shape
operation
preallocate
(
const
shape
&
s
,
const
std
::
string
&
id
)
const
;
};
#else
...
...
@@ -34,7 +36,8 @@ struct allocation_model
interface
(
'
allocation_model
'
,
virtual
(
'
name
'
,
returns
=
'
std
::
string
'
,
const
=
True
),
virtual
(
'
copy
'
,
returns
=
'
std
::
string
'
,
const
=
True
),
virtual
(
'
allocate
'
,
s
=
'
const
shape
&
'
,
returns
=
'
operation
'
,
const
=
True
)
virtual
(
'
allocate
'
,
s
=
'
const
shape
&
'
,
returns
=
'
operation
'
,
const
=
True
),
virtual
(
'
preallocate
'
,
s
=
'
const
shape
&
'
,
id
=
'
std
::
string
'
,
returns
=
'
operation
'
,
const
=
True
)
)
%>
...
...
tools/include/operation.hpp
View file @
f94d77fc
...
...
@@ -15,6 +15,7 @@
#include <migraphx/module_ref.hpp>
#include <migraphx/serialize.hpp>
#include <migraphx/auto_any_cast.hpp>
#include <migraphx/lifetime.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
...
...
@@ -435,9 +436,9 @@ void from_value_op(T& x, const value& v)
}
template
<
class
T
>
bool
is_borrowed
_op
(
const
T
&
)
lifetime
get_lifetime
_op
(
const
T
&
)
{
return
false
;
return
lifetime
::
local
;
}
}
// namespace detail
...
...
@@ -453,7 +454,8 @@ bool is_borrowed_op(const T&)
const
=
True
,
default
=
'
detail
::
need_normalization_op
'
),
virtual
(
'
has_finalize
'
,
returns
=
'
bool
'
,
const
=
True
,
default
=
'
detail
::
has_finalize_op
'
),
virtual
(
'
is_borrowed
'
,
returns
=
'
bool
'
,
const
=
True
,
default
=
'
detail
::
is_borrowed_op
'
),
virtual
(
'
get_lifetime
'
,
returns
=
'
lifetime
'
,
const
=
True
,
default
=
'
detail
::
get_lifetime_op
'
),
virtual
(
'
output_alias
'
,
returns
=
'
std
::
ptrdiff_t
'
,
input
=
'
const
std
::
vector
<
shape
>&
'
,
...
...
tools/te.py
100644 → 100755
View file @
f94d77fc
import
string
,
sys
,
re
,
os
import
string
,
sys
,
re
trivial
=
[
'std::size_t'
,
'instruction_ref'
]
...
...
Prev
1
…
3
4
5
6
7
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