# General OpPackage Central Migration Guidance

1) Avoid usage of the ultra-generic <cite>Tensor</cite> type when possible.
- When used for an input tensor, it assumes your implementation can handle ALL datatypes, layouts, and memory locations
- When used for an output tensor, it assumes the tensor ought to be in the Flat layout and located in Main Memory (not TCM)
- Ex: If you know your tensor ought to only ever contain Int32s and be in Crouton format, just use Int32CroutonTensor

2) Related to (1), try to enumerate ALL scenarios your implementation supports, or extend the implementation
- Even if you would prefer an implementation run exclusively in the fastest/lowest-footprint scenarios (TCM, Flat):

> 
> 
> - Maximize flexibility for the central layout and placement pass to work with
> - The central pass *does* bias toward making your impls run as fast as possible
> - Will make it more likely that you don’t experience failures due to exceeding memory thresholds
> - You can adjust the DEF\_TENSOR\_PROPERTIES to your liking *after* enumeration to reflect your preferences

3) Remove any additions/transformations of formatting/memory placement ops in favor of DEF\_TENSOR\_PROPERTIES where you can
-  We provide suggestions on where you can move such rules for our system to try and maximize compatibility, BUT…
-  In the fullness of time you shouldn’t write optimizations containing:

> 
> 
> - ForceFormat\_Flat
> - ForceFormat\_Crouton
> - flat\_from\_vtcm
> - flat\_to\_vtcm
> - crouton\_from\_vtcm
> - crouton\_to\_vtcm
> - ConvLayer.opt.activations\_to\_vtcm
> - ConvLayer.opt.activations\_from\_vtcm

- You should have a DEF\_TENSOR\_PROPERTIES written for any Op you define that might exist at the end of LAYOUT\_AND\_PLACEMENT
- **Failure to specify an ops tensor properties will lead to us assuming all tensors are Flat + MainMemory**

4) Please use DEF\_PACKAGE\_OPTIMIZATION, not DEF\_OPT for your rewrite rules.
- To maximize compatibility, we like to know when optimizations originate from an external OpPackage vs. internal optimizations

Do not worry if it still puzzles you, we will annouce a very helpful script tool to help you with this migration

Last Published: Jun 04, 2026

[Previous Topic
Writing QNN HTP Op Package](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/writing_op_package.md) [Next Topic
Op Package Migration Guide](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/writing_opPackage_migration_guide.md)