iree-org / iree-org/iree

Quantized ONNX models on IREE with Vulkan backend

Open
#22,166 1 comment 0 reactions 1 assignee Claimed by @AGindinson View on GitHub
enhancement ➕
Dominant language
C++
Stars
3.9k
Forks
1k
Avg merge
4d 16h
Merged PRs (30d)
47

Description

I am interested in quantizing a YOLO-NAS model to run on an embedded GPU with a vulkan backend. To achieve better performance, I've performed Post-Training Quantization on the model, using a small calibration dataset.

I am starting with an ONNX format, which I import with _iree-import-onnx_ into a *.mlir format.
I notice that, on the MLIR file, most of the operands have been kept on a float 32 bits data type (Possibly ignored on quantization pass).

Then, I use the following to compile:
` iree-compile YOLO_NAS.mlir --iree-hal-target-device=vulkan --iree-vulkan-target=architecture_name --output-format=vm-bytecode -o YOLO_NAS.vmfb`

I saw there are some flags that can be used for compiling considering quantization, such as:
--iree-global-opt-enable-quantized-matmul-reassociation
--iree-input-demote-f32-to-f16
--iree-input-demote-i64-to-i32
--Iree-global-opt-enable-demote-contraction-inputs-to-bf16=all

However, even with those flags, the model still performs poorly on the GPU, taking too long to realize inferences.
Is there a preferred way on IREE to deal with quantized models that should increase performance? Especially for Vulkan backends.

Thanks for the support.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.