Skip to content

Conversation

@csullivan
Copy link
Contributor

@csullivan csullivan commented Mar 18, 2021

This PR adds generic support for the use of storage scope in Relay's graph runtime lowering path. The key conceptual additions made are:

  • Introduce a target dependent CollectStorageInfo pass which returns a storage mapping for the outputs of each Expr in a Relay function. The consumers of the output storage scope annotations are:
    • The graph runtime memory planner, which can utilize the output storage scope when doing token allocation optimization
    • The graph runtime codegen, which annotates the graph json with these storage scopes.
    • The target dependent CollectBufferBinds packed function which translates these storage scopes into buffers to be bound when lowering a Relay primitive func in CompileEngine (via the binds field of tvm::lower/build)
    • Finally the graph runtime, which utilizes the storage scope annotations in the graph json when setting up data space storage

The two introduced CollectStorageInfo and CollectBufferBinds are dispatched to via a target dependent packed function. If no implementation exists for a given target, the storage scope of each Expr defaults to global scope and the runtime is unaffected.

See RFC here: https://discuss.tvm.apache.org/t/rfc-texture-memory-support/9467

and serialize/deserialize in graph_runtime.
use in graph memory planner.
persistent and reallocable via pools. This will need to
change but serves as a starting point.
can provide buffers to be bound during lower. The
packed func is specialized over target
(and target attr:device) type.
collection function (CollectStorageInfo) in memory planning.
This allows users to implement a target specific storage
mapping as part of memory planning that depends on the
target specific constraints.
@csullivan
Copy link
Contributor Author

Subsumed by #11875.

@csullivan csullivan closed this Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it status: need review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants