Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ struct ConvolutionImplementationManager : public ImplementationManager {
return false;

bool f16_conv = everyone_is(data_types::f16, in_dt, wei_dt) && one_of(out_dt, {data_types::f16, data_types::f32, data_types::u8, data_types::i8});
bool u8s8_conv = one_of(in_dt, {data_types::i8, data_types::u8}) &&
wei_dt == data_types::i8 &&
bool int8_conv = one_of(in_dt, {data_types::i8, data_types::u8}) && one_of(wei_dt, {data_types::i8, data_types::u8}) &&
one_of(out_dt, {data_types::i32, data_types::f16, data_types::f32, data_types::u8, data_types::i8});

if (!f16_conv && !u8s8_conv)
if (!f16_conv && !int8_conv)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a unittest for this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 54638e5

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this int8_conv is little confusing, what about 8bit_conv or sth similar?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm it is good name

return false;

if (!is_supported_post_ops(conv_node))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4404,6 +4404,73 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_symmetric) {
}
}

TEST(convolution_int8_fw_gpu, quantized_convolution_u8u8f32_symmetric) {
auto& engine = get_test_engine();

auto input = engine.allocate_memory({ data_types::u8, format::bfyx, { 1, 1, 5, 4 } });
auto weights = engine.allocate_memory({ data_types::u8, format::bfyx, { 2, 1, 3, 3 } });
auto biases = engine.allocate_memory({ data_types::f32, format::bfyx, { 1, 2, 1, 1 } });

set_values<uint8_t>(input, { 1, 2, 3, 4, 5,
2, 2, 3, 4, 6,
3, 3, 3, 5, 1,
1, 1, 1, 1, 1 });
set_values<uint8_t>(weights, { 1, 2, 1,
2, 1, 2,
9, 7, 1,

9, 0, 4,
1, 3, 2,
0, 2, 5 });
set_values(biases, { -1.0f, -8.0f });

VVVF<float> output_vec = {
{
{ 70.0f, 100.0f, 25.0f },
{ 16.0f, 18.0f, 2.0f }
},
{
{ 48.0f, 81.0f, 43.0f },
{ 37.0f, 29.0f, 2.0f }
} };

topology topology(
input_layout("input", input->get_layout()),
data("weights", weights),
data("biases", biases),
convolution("conv", input_info("input"), "weights", "biases", 1, { 2, 2 }, { 1, 1 }, { 0, 0 }, { 1, 2 }, false),
reorder("out", input_info("conv"), format::bfyx, data_types::f32));

ExecutionConfig config = get_test_default_config(engine);
config.set_property(ov::intel_gpu::optimize_data(true));
network network(engine, topology, config);
network.set_input_data("input", input);

auto outputs = network.execute();
ASSERT_EQ(outputs.begin()->first, "out");

auto output_memory = outputs.at("out").get_memory();
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());

auto output_layout = output_memory->get_layout();
int y_size = output_layout.spatial(1);
int x_size = output_layout.spatial(0);
int f_size = output_layout.feature();
int b_size = output_layout.batch();
ASSERT_EQ(output_layout.format, format::bfyx);
ASSERT_EQ(y_size, 2);
ASSERT_EQ(x_size, 3);
ASSERT_EQ(f_size, 2);
ASSERT_EQ(b_size, 1);
for (int f = 0; f < f_size; f++)
for (int y = 0; y < y_size; ++y) {
for (int x = 0; x < x_size; ++x) {
ASSERT_NEAR(output_vec[f][y][x], ((float)output_ptr[f * y_size * x_size + y * x_size + x]), 1e-5f) <<
" x="<<x << " y=" << y << " f=" << f;
}
}
}

TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_weight_and_activations) {
auto& engine = get_test_engine();

Expand Down
Loading