pytorch
b0c9762e - [pytorch][nnc] external function call to xnnpack ops (#59525)

Commit
4 years ago
[pytorch][nnc] external function call to xnnpack ops (#59525) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/59525 This PR added NNC external function call binding for two XNNPack ops: - prepacked::linear_clamp_run - prepacked::conv2d_clamp_run Both ops take two arguments: a regular input tensor and a prepacked context object that contains other parameters like weights/bias/etc. The prepacked context object's type is a custom class. NNC doesn't generate assembly code that reads the content of the prepacked object directly. It simply passes it into the XNNPack ops wrapper, so both NNC and the generated assembly code don't need to know the custom class type. At compilation time, we use a size-1 dummy tensor as the placeholder for the prepacked XNNPack context object. At runtime, we pass in the raw pointer of the XNNPack context object as if it were a regular tensor storage data pointer. Inside the external function call wrapper, we reinterpret_cast the raw pointer back to the custom class type before dispatching to the XNNPack ops. ghstack-source-id: 132135512 Test Plan: unit test Reviewed By: bertmaher Differential Revision: D28924934 fbshipit-source-id: 15326b35dc6c022f4c3f247a2037c361e06e80b4
Author
Parents
Loading