csullivan opened a new pull request #7689:
URL: https://github.com/apache/tvm/pull/7689
This PR adds a target specific implementation of CollectStorageInfo and
CollectBufferBinds for the `opencl --device=adreno` target.
**CollectStorageInfo**
- Returns a storage mapping for the outputs of each Expr in a Relay
function. For Adreno, the output storage is set to "texture" for primitive
functions containing a Conv2d with data and kernel layouts of NCHW4c and
OIHW4o, respectively, are.
- The output storage scope for Constants and Vars is inferred from the
output storage scope of their consumers.
- A legalization step occurs that ensures that the output of any primitive
function is set to global scope if one or more of its consumers requires global
scope for its output. This legalization step occurs after the storage scopes
have been collected and therefore is not transitive so that the global scope
does not propagate toward the inputs.
- An additional legalization step occurs to ensure that the global outputs
of the relay Function are marked as global scope. This can be removed if
CopyFromTo will support passing shape information for the source and
destination tensors, or if texture memory reuse is disabled
- The key issue is that the allocated texture space being read from for a
output tensor may be a pool, in which case pitch region and row pitch will be
required to correctly read the texture from the pool to the host. The region
and pitch information can be inferred from the shape of the src and dst tensors
if provided to CopyToFrom.
**CollectBufferBinds**
- Translates the storage scopes information provided by the memory planner
(and ultimately the above CollectStorageInfo pass) to tir::Buffers that can be
bound to te::Tensors when lowering Relay primitive functions. These buffers are
provided to CompileEngine and used in `tvm::lower/build` via the binds field.
If the provided buffers have texture scope, the TIR TextureFlattening pass will
handle lowering the multidimensional accesses to two dimensions.
RFC in progress, once posted I will add a link here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]