Skip to content
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

[onert] Introduce use-def chains into TrainableGraph #13317

Closed
ragmani opened this issue Jun 27, 2024 · 1 comment
Closed

[onert] Introduce use-def chains into TrainableGraph #13317

ragmani opened this issue Jun 27, 2024 · 1 comment

Comments

@ragmani
Copy link
Contributor

ragmani commented Jun 27, 2024

What

Let's introduce use-def chains and new index types for training into TrainableGraph and apply it for memory optimization.

Why

There was no use-def chains that could directly know dependencies between operations and operands in a TrainableGraph. So we were not even verifying whether TrainableGraph is a dag graph, and we were also unable to optimize memory for training.

Ways to support new index types for training

New types : TrainingOperationIndex, TrainingOperandIndex

  1. A way of distinguishing whether an operand or an operation is in forwarding and backwarding by using an existing index number and the information on whether it is in forwarding or in backwarding within the new index types.
  • An example
template <typename Index> class TrainingIndex
class TrainingIndex
{
...
private:
  Index _index;
  bool _is_forward;
}

using TrainingOperationIndex = TrainingIndex<OperationIndex>;
using TrainingOperandIndex = TrainingIndex<OperandIndex>;
  1. A way of distinguishing whether an operand or an operation is in forwarding and backwarding only by using an new index number within the new index types.
  • An example
using TrainingOperationIndex = ::onert::util::Index<uint32_t, TrainingOperationIndexTag>;
using TrainingOperandIndex = ::onert::util::Index<uint32_t, TrainingOperandIndexTag>;

I'm trying with the first way.

Draft : #13305

@ragmani ragmani changed the title [onert] [onert] Introduce use-def chains into TrainableGraph Jun 27, 2024
@ragmani
Copy link
Contributor Author

ragmani commented Aug 8, 2024

I'm closing this issue because memory usage for training reduces as #13282 (comment) on master branch(08cfdf5) now.

There are still parts that can be further optimized for memory.
For example,

  • Unifying planning of tensors for gradient, disposable, and extra.
  • Unifying planning of tensors for non-const and back-prop.

However, I won't proceed them unless there is any request since their effects are not expected to reduce memory usage dramatically.

@ragmani ragmani closed this as completed Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant