Skip to content

Commit be1e924

Browse files
Add how to use C++ wrapper with X86InductorQuantizer (#2716)
* Add how to use C++ wrapper with X86InductorQuantizer * add benefits of C++ wrapper --------- Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
1 parent d1ebbd3 commit be1e924

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

prototype_source/pt2e_quant_ptq_x86_inductor.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Prerequisites
88

99
- `PyTorch 2 Export Post Training Quantization <https://pytorch.org/tutorials/prototype/pt2e_quant_ptq.html>`_
1010
- `TorchInductor and torch.compile concepts in PyTorch <https://pytorch.org/tutorials/intermediate/torch_compile_tutorial.html>`_
11+
- `Inductor C++ Wrapper concepts <https://pytorch.org/tutorials/prototype/inductor_cpp_wrapper_tutorial.html>`_
1112

1213
Introduction
1314
^^^^^^^^^^^^^^
@@ -161,7 +162,18 @@ After these steps, we finished running the quantization flow and we will get the
161162
3. Lower into Inductor
162163
------------------------
163164

164-
After we get the quantized model, we will further lower it to the inductor backend.
165+
After we get the quantized model, we will further lower it to the inductor backend. The default Inductor wrapper
166+
generates Python code to invoke both generated kernels and external kernels. Additionally, Inductor supports
167+
C++ wrapper that generates pure C++ code. This allows seamless integration of the generated and external kernels,
168+
effectively reducing Python overhead. In the future, leveraging the C++ wrapper, we can extend the capability
169+
to achieve pure C++ deployment. For more comprehensive details about C++ Wrapper in general, please refer to the
170+
dedicated tutorial on `Inductor C++ Wrapper Tutorial <https://pytorch.org/tutorials/prototype/inductor_cpp_wrapper_tutorial.html>`_.
171+
172+
::
173+
174+
# Optional: using the C++ wrapper instead of default Python wrapper
175+
import torch._inductor.config as config
176+
config.cpp_wrapper = True
165177

166178
::
167179

0 commit comments

Comments
 (0)