[PyTorch Mobile] Create compile time string for passing in to the exception message instead of 4 arguments that will be concatenated at runtime (#52303)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52303
swolchok did some stellar work in D26372806 (https://github.com/pytorch/pytorch/commit/22b12179db15923007aaec80829766079bb0b9d1) (and friends) to simplify exception handling code-paths and outline uncommon code paths. In addition, non-inlined versions of exception handling functions were provided but only in case of specific cases where 1 (or 2?) arguments were passed in to the exception throwing macros.
This change hopes to take advantage of that infrastructure and only pass in a single `const char*` to `AT_ERROR` to leverage any current (or future) optimizations that may take place in this space.
Since this isn't yet in production, it won't have a size impact. However, my guess is that it will be a significant size win once we turn on tracing based selective build since the exception code path will be present in every kernel function multiple times over since most dtypes will be unselected.
ghstack-source-id: 122149806
Test Plan: Build + auto-generated unit tests for tracing based selective build.
Reviewed By: swolchok
Differential Revision: D26463089
fbshipit-source-id: 349160a37d43d629249b92fa24f12b5bd128df1c