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
d0174a6c
"model/models/git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "ed443a03930a10bec6182c55091f0880baa1e620"
Commit
d0174a6c
authored
Aug 15, 2023
by
Ted Themistokleous
Browse files
Work in progress. Getting segfaults now with eval
parent
da81615c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
23 deletions
+22
-23
src/include/migraphx/op/reshape.hpp
src/include/migraphx/op/reshape.hpp
+3
-3
src/include/migraphx/op/reshape_lazy.hpp
src/include/migraphx/op/reshape_lazy.hpp
+1
-1
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+17
-18
src/tf/parse_reshape.cpp
src/tf/parse_reshape.cpp
+1
-1
No files found.
src/include/migraphx/op/reshape.hpp
View file @
d0174a6c
...
@@ -127,7 +127,7 @@ struct reshape
...
@@ -127,7 +127,7 @@ struct reshape
}
}
}
}
return
shape
{
inputs
.
front
().
type
(),
rdims
};
return
{
inputs
.
front
().
type
(),
rdims
};
}
}
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
shape
compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
...
@@ -152,9 +152,9 @@ struct reshape
...
@@ -152,9 +152,9 @@ struct reshape
assert
(
dyn_out
.
computed_shape
.
standard
());
assert
(
dyn_out
.
computed_shape
.
standard
());
argument
result
{
dyn_out
.
computed_shape
};
argument
result
{
dyn_out
.
computed_shape
};
auto
resh
=
args
[
0
]
.
reshape_lazy
(
dyn_out
.
computed_shape
);
//
auto resh = args[0](dyn_out.computed_shape);
visit_all
(
result
,
resh
)([
&
](
auto
output
,
auto
input
)
{
visit_all
(
result
,
args
[
0
]
)([
&
](
auto
output
,
auto
input
)
{
shape_for_each
(
output
.
get_shape
(),
[
&
](
const
auto
&
idx
)
{
shape_for_each
(
output
.
get_shape
(),
[
&
](
const
auto
&
idx
)
{
output
(
idx
.
begin
(),
idx
.
end
())
=
input
(
idx
.
begin
(),
idx
.
end
());
output
(
idx
.
begin
(),
idx
.
end
())
=
input
(
idx
.
begin
(),
idx
.
end
());
});
});
...
...
src/include/migraphx/op/reshape_lazy.hpp
View file @
d0174a6c
...
@@ -233,7 +233,7 @@ struct reshape_lazy
...
@@ -233,7 +233,7 @@ struct reshape_lazy
}
}
}
}
std
::
cout
<<
rdims
.
size
()
<<
std
::
endl
;
//
std::cout << rdims.size() << std::endl;
auto
s
=
reshape_lazy_dims
(
inputs
.
front
(),
rdims
);
auto
s
=
reshape_lazy_dims
(
inputs
.
front
(),
rdims
);
if
(
not
s
.
has_value
())
if
(
not
s
.
has_value
())
...
...
src/targets/gpu/lowering.cpp
View file @
d0174a6c
...
@@ -116,7 +116,7 @@ struct miopen_apply
...
@@ -116,7 +116,7 @@ struct miopen_apply
add_neg_op
();
add_neg_op
();
add_nms_op
();
add_nms_op
();
add_select_module_op
();
add_select_module_op
();
add_reshape_lazy_op
();
//
add_reshape_lazy_op();
}
}
void
copy_params
()
const
void
copy_params
()
const
...
@@ -380,29 +380,28 @@ struct miopen_apply
...
@@ -380,29 +380,28 @@ struct miopen_apply
}
}
/**
/**
* Adds reshape lazy to reshape ops that can be aliased instead of copied
* Adds reshape lazy to reshape ops that can be aliased instead of copied
*/
*/
void
add_reshape_lazy_op
()
/*
void add_reshape_lazy_op()
{
{
apply_map.emplace("reshape", [=](instruction_ref ins) {
apply_map.emplace("reshape", [=](instruction_ref ins) {
ins
->
debug_print
();
/* Attempt lazy reshape to allow for aliasing. Potentially throws in get_shape if unable
/* Attempt lazy reshape to allow for aliasing. Potentially throws in get_shape if unable to alias */
* to alias
return
mod
->
replace_instruction
(
ins
,
make_op
(
"reshape_lazy"
,
{{
"dims"
,
{
ins
->
get_operator
().
to_value
()}}}),
ins
->
inputs
(),
ins
->
module_inputs
());
try
try
{
{
auto lazy_ins = mod->replace_instruction(
ins,
make_op("reshape_lazy", {{"dims", {ins->get_operator().to_value().at("dims")}}}),
ins->inputs(),
ins->module_inputs());
return lazy_ins;
}
}
catch
(...)
catch(...)
{
{
//std::cout << "catch reshape_lazy_fail" << std::endl;
return ins;
/* can't alias so require an allocate for output and a contiguous */
auto
s
=
ins
->
get_shape
();
std
::
vector
<
instruction_ref
>
inputs
=
ins
->
inputs
();
auto
output
=
insert_allocation
(
ins
,
s
);
return
mod
->
insert_instruction
(
std
::
next
(
ins
),
make_op
(
"gpu::contiguous"
),
ins
,
output
);
}
}
});
});
}
}
*/
};
};
void
lowering
::
apply
(
module_pass_manager
&
mpm
)
const
void
lowering
::
apply
(
module_pass_manager
&
mpm
)
const
...
...
src/tf/parse_reshape.cpp
View file @
d0174a6c
...
@@ -46,7 +46,7 @@ struct parse_reshape : op_parser<parse_reshape>
...
@@ -46,7 +46,7 @@ struct parse_reshape : op_parser<parse_reshape>
std
::
vector
<
int64_t
>
dims
;
std
::
vector
<
int64_t
>
dims
;
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
dims
));
});
s
.
visit
([
&
](
auto
v
)
{
copy
(
v
,
std
::
back_inserter
(
dims
));
});
return
info
.
add_instruction
(
make_op
(
"reshape"
,
{{
"dims"
,
dims
}}),
return
info
.
add_instruction
(
make_op
(
"reshape"
,
{{
"dims"
,
dims
}}),
info
.
make_contiguous
(
args
[
0
]));
info
.
make_contiguous
(
args
[
0
]));
}
}
};
};
...
...
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