-
Notifications
You must be signed in to change notification settings - Fork 113
Return vector for output alias #4540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
0f2ba3b
9f17a2d
f905985
7257328
f61a10f
ce51c3d
d64b5ae
4517550
409bb90
3ed20a5
63bd6e8
aafb7aa
a8d1f63
c2fcfe5
5cdabad
91aac43
ea8fa59
11c34db
ededd25
77c8aa9
4912071
2f32aae
be5bc74
352301e
4d7c782
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| /* | ||
| * The MIT License (MIT) | ||
| * | ||
| * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. | ||
| * Copyright (c) 2015-2026 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 | ||
|
|
@@ -70,11 +70,14 @@ void eliminate_concat::apply(module& m) const | |
| // Where are the allocations for the tensors to be concatenated? | ||
| std::vector<instruction_ref> allocations; | ||
|
|
||
| std::transform( | ||
| ins->inputs().begin(), | ||
| std::prev(ins->inputs().end()), | ||
| std::back_inserter(allocations), | ||
| [&](instruction_ref x) { return instruction::get_output_alias(x, true); }); | ||
| std::transform(ins->inputs().begin(), | ||
| std::prev(ins->inputs().end()), | ||
| std::back_inserter(allocations), | ||
| [&](instruction_ref x) { | ||
| auto aliases = instruction::get_output_alias(x, true); | ||
| // cppcheck-suppress returnDanglingLifetime | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should be suppressing this. Make this a separate issue to fix later and a TODO above it
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a false positive, there is not dangling lifetime so we have to suppress this. This is a bug in cppcheck.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add that to the comment to make that clear. |
||
| return aliases.front(); | ||
| }); | ||
|
|
||
| if(std::any_of(allocations.begin(), allocations.end(), [&](auto x) { | ||
| return x->name() != concat_opt.allocate(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| /* | ||
| * The MIT License (MIT) | ||
| * | ||
| * Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. | ||
| * Copyright (c) 2015-2026 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 | ||
|
|
@@ -83,7 +83,7 @@ struct broadcast_for_dot | |
| return args[0].reshape(dyn_out.computed_shape); | ||
| } | ||
|
|
||
| std::ptrdiff_t output_alias(const std::vector<shape>&) const { return 0; } | ||
| std::vector<std::size_t> output_alias(const std::vector<shape>&) const { return {0}; } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some comment as above, is there a reason why we've change this all to size_t? We're making this unsigned now instead of ptrdiff_t allowing for negative values |
||
|
|
||
| value attributes() const { return {{"fillcolor", "#9ACD32" /* yellowgreen */}}; } | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not return vector of ptrdiff_t here? Reason for changing from signed to unsigned now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The index is always positive. We only used
ptrdiff_tso we could write-1as saying there wasnt an output alias, but that was a hack.