You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Ensure that output is marked as global if single
consumer requires global input. Previous legalization
only ensured this if multiple consumers had differing
storage requirements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address itstatus: need review
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a target specific implementation of CollectStorageInfo and CollectBufferBinds for the
opencl --device=adrenotarget.CollectStorageInfo
CollectBufferBinds
tvm::lower/buildvia the binds field. If the provided buffers have texture scope, the TIR TextureFlattening pass will handle lowering the multidimensional accesses to two dimensions.See RFC here: https://discuss.tvm.apache.org/t/rfc-texture-memory-support/9467