Skip to content

Commit ea135a4

Browse files
author
ssjia
committed
Update on "[ET-VK] Conv2d quantize/dequantize ops for conv2d activations"
## Context As title. Add shaders to quantize a floating point conv2d input tensor to packed int8 memory layout and dequantize a int8 conv2d output tensor back to floating point representation. Hooking it up to the export logic will be handled in a follow up diff. Differential Revision: [D82542335](https://our.internmc.facebook.com/intern/diff/D82542335/) [ghstack-poisoned]
2 parents db40f20 + d03e43c commit ea135a4

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

backends/vulkan/test/custom_ops/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,5 @@ if(TARGET vulkan_backend)
9595
add_operator_prototype(q8csw_conv2d)
9696
add_operator_prototype(q4gsw_linear)
9797
add_operator_prototype(choose_qparams_per_row)
98+
add_operator_prototype(qdq8ta_conv2d_activations)
9899
endif()

backends/vulkan/test/custom_ops/qdq8ta_conv2d_activations.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <algorithm>
1010
#include <cmath>
1111
#include <iostream>
12-
#include <random>
1312
#include <vector>
1413
#include "utils.h"
1514

@@ -58,15 +57,13 @@ TestCase create_test_case_from_config(
5857
input_dtype,
5958
storage_type,
6059
utils::kChannelsPacked, // Use channels packed for conv2d tensors
61-
DataGenType::RANDINT8);
60+
DataGenType::RANDOM);
6261

63-
// Randomized quantization parameters following q8csw_conv2d.cpp pattern
64-
// Generate random scale value
65-
float scale_val = 1.0;
62+
float scale_val = 0.007112;
6663
ValueSpec scale(scale_val);
6764

6865
// Generate random zero point within quantization range
69-
int32_t zero_point_val = 0;
66+
int32_t zero_point_val = -2;
7067
ValueSpec zero_point(zero_point_val);
7168

7269
// Output tensor (float) - same shape as input [N, C, H, W]

0 commit comments

Comments
 (0)