onnxruntime/onnxruntime/test/shared_lib
Adrian Lizarraga b02d5e6d76
[CPU EP] Int4 support for QuantizeLinear, DequantizeLinear, and Transpose (#20362)
### Description
- 4-bit QuantizeLinear(21). **Blocked quantization still missing (i.e.,
do not support the new `block_size` attribute)**
- 4-bit DequantizeLinear(21). **Blocked dequantization still missing
(i.e., do not support the new `block_size` attribute)**
- 4-bit Transpose(21).
- Update quantization tool with int4 types.
- Disable QDQ fusions for 4-bit types. See:
https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/core/optimizer/qdq_transformer/selectors_actions/qdq_selector_action_transformer.cc
- MLAS 4-bit quantization kernels for intel, neon, powerpc.

##### Notes
To calculate a tensor's storage size, we normally get the number of
elements from the shape (i.e., `tensor_shape.Size()`) and multiply by
the size of a single element. This does not directly work for sub-byte
elements like int4 as each element in a `Tensor<Int4x2>` stores **two**
packed int4 elements in a byte. The `Tensor::
CalculateTensorStorageSize` should be called to perform the correct
calculation for any tensor element type.

### Motivation and Context
ONNX 1.16 added the int4 and uint4 types. This initial PR adds the int4
type to ORT and adds int4 implementations for the Quant, Dequant, and
Transpose ops on CPU EP. We still need to add int4 support for many ops
and execution providers. See the ONNX 1.16 release notes:
https://github.com/onnx/onnx/releases.
2024-05-30 18:56:24 -07:00
..
cuda_ops.cu
custom_op_utils.cc Create a new C API KernelContext_GetAllocator() for Custom Op scenario (#15591) 2023-04-23 21:54:35 -07:00
custom_op_utils.h Single-schema-multi-kernel (#15184) 2023-04-27 13:39:59 -07:00
fns_candy_style_transfer.c
onnx_protobuf.h
rocm_ops.hip EP context for custom op (#16454) 2023-08-16 13:03:40 -07:00
test_allocator.cc Run clang-format in CI (#15524) 2023-04-18 09:26:58 -07:00
test_fixture.h Run clang-format in CI (#15524) 2023-04-18 09:26:58 -07:00
test_inference.cc [CPU EP] Int4 support for QuantizeLinear, DequantizeLinear, and Transpose (#20362) 2024-05-30 18:56:24 -07:00
test_io_types.cc Run clang-format in CI (#15524) 2023-04-18 09:26:58 -07:00
test_model_loading.cc fix android build issue (#20389) 2024-04-19 14:21:34 -07:00
test_nontensor_types.cc [C#, CPP] Introduce Float16/BFloat16 support and tests for C#, C++ (#16506) 2023-07-14 10:46:52 -07:00
test_ort_format_models.cc Enable Address Sanitizer in CI (#19073) 2024-01-12 07:24:40 -08:00
test_run_options.cc
test_session_options.cc Add new SessionOptions config entry to disable specific transformers and rules (#20135) 2024-04-02 16:33:05 -07:00
utils.cc
utils.h