Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
8ad01ac
Bump product version 2025.4.0
akladiev Sep 23, 2025
98a833e
Merge pull request #38 from akladiev/bump_product_version
akladiev Sep 23, 2025
77688c0
wip
tkrupa-intel Oct 2, 2025
5db1ef5
wip
tkrupa-intel Oct 6, 2025
189f8e2
wip
tkrupa-intel Oct 7, 2025
c6406a6
Apply doesFunctionContainF8DynQuanPatterns() in place of a WA
tkrupa-intel Oct 7, 2025
ac4f8f4
Add tests
tkrupa-intel Oct 10, 2025
6d89957
Remove fusion code and enable running the standalone ocl kernel
tkrupa-intel Oct 13, 2025
480b3ea
Add xetla's f8 utils
tkrupa-intel Oct 14, 2025
d10a3e1
Add missing file
tkrupa-intel Oct 14, 2025
8498ebf
Add f8e8m0 utils
tkrupa-intel Oct 20, 2025
d9666c1
Minor fix
tkrupa-intel Oct 20, 2025
e286397
Fix ocl code
tkrupa-intel Oct 20, 2025
5b1cbc2
Enable fp8 for reorder
tkrupa-intel Oct 20, 2025
a298ae2
Fix cl code
tkrupa-intel Oct 20, 2025
b39da31
Fix typo
tkrupa-intel Oct 20, 2025
b26fa58
Change names
tkrupa-intel Oct 20, 2025
42f1335
Fix _intel_convert_e8m0_to_f32()
tkrupa-intel Oct 20, 2025
73d5248
Modify dyn quan kernels
tkrupa-intel Oct 20, 2025
243cf09
Fix typo
tkrupa-intel Oct 20, 2025
0240ea0
Add necessary convert func call
tkrupa-intel Oct 20, 2025
46384c5
Fix type
tkrupa-intel Oct 20, 2025
f30bdc7
Fix typo
tkrupa-intel Oct 20, 2025
73ed5fe
Fix typo
tkrupa-intel Oct 20, 2025
0523616
wip
tkrupa-intel Oct 22, 2025
82f549d
Disable GHA workflows
akladiev Oct 23, 2025
133e609
Disable GHA workflows
akladiev Oct 23, 2025
a8ce6ee
wip
tkrupa-intel Oct 24, 2025
4c21268
Fix f16 to f8e5m2 conversion functions
tkrupa-intel Oct 27, 2025
d4b43b6
Change unit tests' diff threshold for fp dtypes
tkrupa-intel Oct 27, 2025
7b5bb65
Add matmul weight decompression mxfp8 test (WIP)
tkrupa-intel Oct 28, 2025
f669ab5
Extend ConvertFCToCompressed tests with mxfp8 subgraph patterns
tkrupa-intel Oct 28, 2025
c84a4bd
Take optional Transpose into account in MarkDequantization callback
tkrupa-intel Oct 30, 2025
4f18328
Enable onednn FC for mxfp8
tkrupa-intel Oct 30, 2025
3af4d39
Add missing check in onednn interface
tkrupa-intel Oct 30, 2025
7cf15a2
Skip unrelated WA for mxfp
tkrupa-intel Oct 30, 2025
8635743
Temporarily turn off skipping dynquan (by default skipped with small …
tkrupa-intel Oct 31, 2025
f9b902e
Update embargo repo with OpenVINO master and preserve embargo workflo…
oonyshch Nov 14, 2025
1d1469b
WIP
merezman Nov 17, 2025
a8e6e1d
Add ov::hint::DynamicQuantizationDataType runtime option and enable f…
tkrupa-intel Nov 18, 2025
3b11b95
Change fp8/uint4 case to fp8/int4
tkrupa-intel Nov 18, 2025
6292aa0
Code cleanup part 1
tkrupa-intel Nov 18, 2025
10267d8
Change fp8 vector dtypes' design and use them with vstore
tkrupa-intel Nov 24, 2025
01d88a2
_intel_convert_e8m0_to_f32: handle special case
tkrupa-intel Nov 24, 2025
2e6581d
wip
tkrupa-intel Oct 2, 2025
c4bc8f9
wip
tkrupa-intel Oct 6, 2025
d37a799
wip
tkrupa-intel Oct 7, 2025
4fe705b
Apply doesFunctionContainF8DynQuanPatterns() in place of a WA
tkrupa-intel Oct 7, 2025
e02495a
Add tests
tkrupa-intel Oct 10, 2025
f95439a
Remove fusion code and enable running the standalone ocl kernel
tkrupa-intel Oct 13, 2025
a5dedbc
Add xetla's f8 utils
tkrupa-intel Oct 14, 2025
22a53e4
Add missing file
tkrupa-intel Oct 14, 2025
f753914
Add f8e8m0 utils
tkrupa-intel Oct 20, 2025
683b56b
Minor fix
tkrupa-intel Oct 20, 2025
3425ed0
Fix ocl code
tkrupa-intel Oct 20, 2025
683bf27
Enable fp8 for reorder
tkrupa-intel Oct 20, 2025
1524f65
Fix cl code
tkrupa-intel Oct 20, 2025
4679829
Fix typo
tkrupa-intel Oct 20, 2025
1f67d1f
Change names
tkrupa-intel Oct 20, 2025
a7cbb0f
Fix _intel_convert_e8m0_to_f32()
tkrupa-intel Oct 20, 2025
c501d43
Modify dyn quan kernels
tkrupa-intel Oct 20, 2025
ee846b2
Fix type
tkrupa-intel Oct 20, 2025
04da1bf
Fix typo
tkrupa-intel Oct 20, 2025
42ce11a
Fix typo
tkrupa-intel Oct 20, 2025
db34c5c
wip
tkrupa-intel Oct 22, 2025
4a7c37c
wip
tkrupa-intel Oct 24, 2025
9195ca1
Fix f16 to f8e5m2 conversion functions
tkrupa-intel Oct 27, 2025
b4bd3f1
Change unit tests' diff threshold for fp dtypes
tkrupa-intel Oct 27, 2025
06c8dc3
Add matmul weight decompression mxfp8 test (WIP)
tkrupa-intel Oct 28, 2025
5302e03
Extend ConvertFCToCompressed tests with mxfp8 subgraph patterns
tkrupa-intel Oct 28, 2025
57746b9
Take optional Transpose into account in MarkDequantization callback
tkrupa-intel Oct 30, 2025
a378bf4
Enable onednn FC for mxfp8
tkrupa-intel Oct 30, 2025
da277a1
Add missing check in onednn interface
tkrupa-intel Oct 30, 2025
1457f75
Temporarily turn off skipping dynquan (by default skipped with small …
tkrupa-intel Oct 31, 2025
281767c
Add ov::hint::DynamicQuantizationDataType runtime option and enable f…
tkrupa-intel Nov 18, 2025
eac198e
Change fp8/uint4 case to fp8/int4
tkrupa-intel Nov 18, 2025
e127b2f
Code cleanup part 1
tkrupa-intel Nov 18, 2025
1248dc8
Change fp8 vector dtypes' design and use them with vstore
tkrupa-intel Nov 24, 2025
91d5f6b
_intel_convert_e8m0_to_f32: handle special case
tkrupa-intel Nov 24, 2025
0231b4a
rebase
tkrupa-intel Nov 26, 2025
b766457
Switch to onednn with bdpas fix, enable json config file to pass DYNA…
tkrupa-intel Dec 1, 2025
643c1ec
Update
merezman Dec 2, 2025
3202a74
Rebase
merezman Dec 2, 2025
be52da8
Rebase
merezman Dec 2, 2025
0a3af66
Point oneDNN_gpu submodule to top of prv-gpu (#64)
oonyshch Dec 18, 2025
683277b
Add 2 fp4 values in 1 byte
merezman Dec 19, 2025
55b4a46
wip
tkrupa-intel Oct 2, 2025
7fcbe39
wip
tkrupa-intel Oct 6, 2025
89dd0ee
wip
tkrupa-intel Oct 7, 2025
9f38b69
Apply doesFunctionContainF8DynQuanPatterns() in place of a WA
tkrupa-intel Oct 7, 2025
3594fd5
Add tests
tkrupa-intel Oct 10, 2025
388460f
Remove fusion code and enable running the standalone ocl kernel
tkrupa-intel Oct 13, 2025
3a73bc6
Add xetla's f8 utils
tkrupa-intel Oct 14, 2025
8d148c5
Add missing file
tkrupa-intel Oct 14, 2025
1499913
Add f8e8m0 utils
tkrupa-intel Oct 20, 2025
009dda5
Minor fix
tkrupa-intel Oct 20, 2025
b167901
Fix ocl code
tkrupa-intel Oct 20, 2025
d2b0deb
Enable fp8 for reorder
tkrupa-intel Oct 20, 2025
8a7c27e
Fix cl code
tkrupa-intel Oct 20, 2025
5b2d394
Fix typo
tkrupa-intel Oct 20, 2025
4b5a87f
Change names
tkrupa-intel Oct 20, 2025
8781d87
Fix _intel_convert_e8m0_to_f32()
tkrupa-intel Oct 20, 2025
4770189
Modify dyn quan kernels
tkrupa-intel Oct 20, 2025
fb6db5e
Fix type
tkrupa-intel Oct 20, 2025
7daf5ef
Fix typo
tkrupa-intel Oct 20, 2025
aaa9f16
Fix typo
tkrupa-intel Oct 20, 2025
a6dcd80
wip
tkrupa-intel Oct 22, 2025
3604f23
wip
tkrupa-intel Oct 24, 2025
92ec6be
Fix f16 to f8e5m2 conversion functions
tkrupa-intel Oct 27, 2025
4de64f9
Change unit tests' diff threshold for fp dtypes
tkrupa-intel Oct 27, 2025
fd5b0ff
Add matmul weight decompression mxfp8 test (WIP)
tkrupa-intel Oct 28, 2025
ac57f45
Extend ConvertFCToCompressed tests with mxfp8 subgraph patterns
tkrupa-intel Oct 28, 2025
3442f69
Take optional Transpose into account in MarkDequantization callback
tkrupa-intel Oct 30, 2025
8d153eb
Enable onednn FC for mxfp8
tkrupa-intel Oct 30, 2025
36cebee
Add missing check in onednn interface
tkrupa-intel Oct 30, 2025
4d0c73c
Temporarily turn off skipping dynquan (by default skipped with small …
tkrupa-intel Oct 31, 2025
47f9848
Add ov::hint::DynamicQuantizationDataType runtime option and enable f…
tkrupa-intel Nov 18, 2025
27dac96
Change fp8/uint4 case to fp8/int4
tkrupa-intel Nov 18, 2025
582766b
Code cleanup part 1
tkrupa-intel Nov 18, 2025
dc29384
Change fp8 vector dtypes' design and use them with vstore
tkrupa-intel Nov 24, 2025
83c935b
_intel_convert_e8m0_to_f32: handle special case
tkrupa-intel Nov 24, 2025
81ff392
rebase
tkrupa-intel Nov 26, 2025
a5e67fb
Switch to onednn with bdpas fix, enable json config file to pass DYNA…
tkrupa-intel Dec 1, 2025
6b5d653
Fix infnan bug, change subgraph test values and dims to be more like …
tkrupa-intel Dec 2, 2025
152bc74
Fix nans in padding, enable f8 in log_memory_to_file()
tkrupa-intel Dec 4, 2025
d2a98b9
Code cleanup cont.
tkrupa-intel Dec 5, 2025
6e49c7b
Add more checks
tkrupa-intel Dec 5, 2025
4c39d57
Code cleanup cont.
tkrupa-intel Jan 14, 2026
4e14d09
Code cleanup cont.
tkrupa-intel Jan 14, 2026
6b53de1
Apply review suggestions
tkrupa-intel Feb 3, 2026
174b9db
Add a second MarkDequantization pass that's exclusive for integer-bas…
tkrupa-intel Feb 4, 2026
1a1ee34
Remove DynamicQuantizationDataType property and infer the value from …
tkrupa-intel Feb 5, 2026
9bdc874
Add second MarkDequantization in more places
tkrupa-intel Feb 9, 2026
bba227e
Refactor the MarkDequantization pairs so that they're more intuitivel…
tkrupa-intel Feb 13, 2026
846834d
Fix second MarkDequantization's precision list
tkrupa-intel Feb 17, 2026
367910b
Merge https://github.com/openvinotoolkit/openvino into merge_open_sou…
tkrupa-intel Feb 17, 2026
061aae2
Merge branch 'merge_open_source_main' into rebase_v2
tkrupa-intel Feb 18, 2026
96e76da
Merge open source main (#68)
tkrupa-intel Feb 23, 2026
9b51b67
Merge remote-tracking branch 'real_origin/main' into rebase
tkrupa-intel Feb 23, 2026
fc70302
Apply PR suggestions
tkrupa-intel Feb 24, 2026
2ae4b7d
Move from OCP-style scale calculation to more accurate NVIDIA-style s…
tkrupa-intel Feb 26, 2026
a8cf949
Rebase
merezman Mar 3, 2026
c618c84
Take f8e8m0 into account in the first MarkDequantization pass
tkrupa-intel Mar 3, 2026
6e7ee7a
Clean fp4_utils
merezman Mar 4, 2026
86aafe6
VIP
merezman Mar 4, 2026
69038a4
Rebase
merezman Mar 4, 2026
ed8a396
Clean
merezman Mar 4, 2026
4f2aafd
Clean kernels
merezman Mar 4, 2026
ca5af7f
Clean kernel and tests
merezman Mar 6, 2026
9ad9529
Clean
merezman Mar 12, 2026
6944324
Add regular FP4 tests
merezman Mar 12, 2026
d61a116
Merge open source (#106)
tkrupa-intel Mar 24, 2026
67b2864
[GPU][Xe3p] Enable dynamic quantization for MXFP8 & regular FP8 dtype…
tkrupa-intel Apr 10, 2026
e210ff4
Fix
merezman Apr 28, 2026
24e16b1
Merge main
merezman Apr 28, 2026
529aa6c
Fix
merezman Apr 30, 2026
be792c2
Move val
merezman May 26, 2026
0571bcf
Merge open source 6b94f3de7e
tkrupa-intel Jun 30, 2026
095fe85
Update ref kernel
merezman Jul 9, 2026
87ba77b
Fix typo
merezman Jul 9, 2026
a5302d3
Merge branch 'merge_open_source_6b94f3de7e' into merezman/dyn_quant_f…
merezman Jul 9, 2026
07834fa
Update onednn_gpu submodule URL to public repo
merezman Jul 10, 2026
83e1b26
Restore MOE to match origin/merge_open_source_6b94f3de7e (keep DNNL_A…
merezman Jul 10, 2026
a2dc63f
Restore missing FP4 support after merge
merezman Jul 10, 2026
98d0e80
Fix opt kernel
merezman Jul 14, 2026
ad4e851
Fix ref kernel
merezman Jul 14, 2026
e150d81
Move fp4_utils
merezman Jul 14, 2026
1bda28e
Merge master
merezman Jul 16, 2026
d4c1c61
Revert .github changes
merezman Jul 16, 2026
ae096cc
Clean changes
merezman Jul 16, 2026
2577ad6
Use atomic write in ref kernel
merezman Jul 17, 2026
f6b8211
Clean
merezman Jul 17, 2026
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 @@ -27,7 +27,7 @@ namespace pass {
namespace low_precision {
namespace precision_set {
LP_TRANSFORMATIONS_API const std::vector<element::Type>& get_int8_support();
LP_TRANSFORMATIONS_API const std::vector<element::Type>& get_fp8_support();
LP_TRANSFORMATIONS_API const std::vector<element::Type>& get_low_bit_float_support();
LP_TRANSFORMATIONS_API const std::vector<element::Type>& get_int8_int16_int32_support();
} // namespace precision_set
Comment on lines 27 to 32

Expand Down Expand Up @@ -59,7 +59,7 @@ class LP_TRANSFORMATIONS_API DataPrecision {
element::i8, element::u8,
element::i16, element::u16,
element::i32, element::u32,
element::f8e4m3, element::f8e5m2,
element::f8e4m3, element::f8e5m2, element::f4e2m1,
};
return lowPrecision.find(precision) != lowPrecision.end();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ const std::vector<element::Type>& precision_set::get_int8_support() {
return int8_support;
}

const std::vector<element::Type>& precision_set::get_fp8_support() {
static const std::vector<element::Type> fp8_support = {
ov::element::f8e4m3, ov::element::f8e5m2,
const std::vector<element::Type>& precision_set::get_low_bit_float_support() {
static const std::vector<element::Type> low_bit_float_support = {
ov::element::f8e4m3, ov::element::f8e5m2, ov::element::f4e2m1,
};
return fp8_support;
return low_bit_float_support;
}

const std::vector<element::Type>& precision_set::get_int8_int16_int32_support() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ MarkCompressedFloatConstants::MarkCompressedFloatConstants() {
return false;
if (const_node->get_output_element_type(0) != element::f16 &&
const_node->get_output_element_type(0) != element::bf16 &&
const_node->get_output_element_type(0) != element::f4e2m1 &&
const_node->get_output_element_type(0) != element::f8e4m3 &&
const_node->get_output_element_type(0) != element::f8e5m2 &&
const_node->get_output_element_type(0) != element::f8e8m0)
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/intel_gpu/src/graph/debug_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ void log_memory_to_file(memory::ptr mem, layout data_layout, stream& stream, std
dump<ov::float8_e5m2>(actual_mem, stream, file_stream, dump_raw);
else if (mem_dt == cldnn::data_types::f8e4m3)
dump<ov::float8_e4m3>(actual_mem, stream, file_stream, dump_raw);
else if (mem_dt == cldnn::data_types::f4e2m1)
dump<ov::float4_e2m1>(actual_mem, stream, file_stream, dump_raw);
else if (mem_dt == cldnn::data_types::f8e8m0)
dump<ov::float8_e8m0>(actual_mem, stream, file_stream, dump_raw);
Comment on lines 284 to 290
else if (mem_dt == cldnn::data_types::boolean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ attach_dynamic_quantize_impl::attach_dynamic_quantize_impl() {
data_types::f16,
data_types::i8,
data_types::u8,
data_types::f4e2m1,
data_types::f8e4m3,
data_types::f8e5m2,
data_types::f8e8m0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ kernel_selector::data_type to_data_type(data_types dt) {
return kernel_selector::data_type::F32;
case cldnn::data_types::bf16:
return kernel_selector::data_type::BF16;
case cldnn::data_types::f4e2m1:
return kernel_selector::data_type::F4E2M1;
case cldnn::data_types::f8e4m3:
return kernel_selector::data_type::F8E4M3;
case cldnn::data_types::f8e5m2:
Expand Down Expand Up @@ -301,6 +303,8 @@ data_types from_data_type(kernel_selector::data_type dt) {
return cldnn::data_types::f16;
case kernel_selector::data_type::F32:
return cldnn::data_types::f32;
case kernel_selector::data_type::F4E2M1:
return cldnn::data_types::f4e2m1;
case kernel_selector::data_type::F8E4M3:
return cldnn::data_types::f8e4m3;
case kernel_selector::data_type::F8E5M2:
Expand Down Expand Up @@ -330,6 +334,8 @@ kernel_selector::weights_type to_weights_type(data_types dt) {
return kernel_selector::weights_type::INT32;
case cldnn::data_types::bf16:
return kernel_selector::weights_type::BF16;
case cldnn::data_types::f4e2m1:
return kernel_selector::weights_type::F4E2M1;
case cldnn::data_types::f8e4m3:
return kernel_selector::weights_type::F8E4M3;
case cldnn::data_types::f8e5m2:
Expand Down Expand Up @@ -357,6 +363,8 @@ data_types from_weights_type(kernel_selector::weights_type dt) {
return data_types::f32;
case kernel_selector::weights_type::INT32:
return data_types::i32;
case kernel_selector::weights_type::F4E2M1:
return data_types::f4e2m1;
case kernel_selector::weights_type::F8E4M3:
return data_types::f8e4m3;
case kernel_selector::weights_type::F8E5M2:
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/intel_gpu/src/graph/impls/ocl_v2/utils/jitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,18 @@ JitConstants make_type_jit_constants(const std::string& name, const ov::element:
type_size = "4";
is_fp = true;
break;
case ov::element::f4e2m1:
type = "fp4e2m1_t";
max_val = "(fp4e2m1_t){as_uchar((uchar)0x7)}"; // 6.0
min_val = "(fp4e2m1_t){as_uchar((uchar)0xF)}"; // -6.0
val_one = "(fp4e2m1_t){as_uchar((uchar)0x2)}";
val_zero = "(fp4e2m1_t){as_uchar((uchar)0x0)}";
to_type = "_convert_fp4e2m1_t(v)";
to_type_sat = "_convert_fp4e2m1_t_sat(v)";
as_type = "as_fp4e2m1_t(v)";
type_size = "0.5f";
is_fp = true;
break;
case ov::element::f8e4m3:
type = "fp8e4m3_t";
max_val = "(fp8e4m3_t){as_char((char)0x7E)}"; // 448.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct fully_connected_onednn : typed_primitive_onednn_impl<fully_connected> {
}

const auto input_dt = instance.get_input_layout(0).data_type;
const bool is_dyn_quan_input = cldnn::one_of(input_dt, {data_types::i8, data_types::u8, data_types::f8e4m3, data_types::f8e5m2});
const bool is_dyn_quan_input = cldnn::one_of(input_dt, {data_types::i8, data_types::u8, data_types::f4e2m1, data_types::f8e4m3, data_types::f8e5m2});

if (is_dyn_quan_input && prim->activation_scale.is_valid()) {
const auto activation_scale_idx = idx++;
Expand Down Expand Up @@ -312,7 +312,7 @@ struct fully_connected_onednn : typed_primitive_onednn_impl<fully_connected> {
}

const auto input_dt = impl_params->get_input_layout(0).data_type;
const bool is_dyn_quan_input = cldnn::one_of(input_dt, {data_types::i8, data_types::u8, data_types::f8e4m3, data_types::f8e5m2});
const bool is_dyn_quan_input = cldnn::one_of(input_dt, {data_types::i8, data_types::u8, data_types::f4e2m1, data_types::f8e4m3, data_types::f8e5m2});
if (is_dyn_quan_input && dynamic_quantized_activation) {
auto src_scale_idx = ++idx;
auto partial_shape = impl_params->get_input_layout(0).get_partial_shape();
Expand Down Expand Up @@ -360,7 +360,7 @@ struct fully_connected_onednn : typed_primitive_onednn_impl<fully_connected> {

if (prim->compressed_weights) {
const auto input_dt = impl_params.get_input_layout(0).data_type;
const bool is_dyn_quan_input = cldnn::one_of(input_dt, {data_types::i8, data_types::u8, data_types::f8e4m3, data_types::f8e5m2});
const bool is_dyn_quan_input = cldnn::one_of(input_dt, {data_types::i8, data_types::u8, data_types::f4e2m1, data_types::f8e4m3, data_types::f8e5m2});
if (is_dyn_quan_input) {
OPENVINO_ASSERT(prim->input_size <= 3, "[GPU] Dynamic quantization for 4D matmul is not implemented");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ struct FullyConnectedImplementationManager : public ImplementationManager {
one_of(in0_dt, {data_types::f16, data_types::bf16, data_types::f32, data_types::i8, data_types::u8}) &&
one_of(wei_dt, {data_types::u8, data_types::i8, data_types::u4, data_types::i4}) &&
one_of(out_dt, {data_types::f16, data_types::bf16, data_types::f32, data_types::u8, data_types::i8});
const bool fp_compressed_case = fc_prim->compressed_weights && one_of(in0_dt, {data_types::f8e4m3, data_types::f8e5m2}) &&
one_of(wei_dt, {data_types::f8e4m3, data_types::f8e5m2}) && one_of(out_dt, {data_types::f16, data_types::f32});
const bool fp_compressed_case = fc_prim->compressed_weights && one_of(in0_dt, {data_types::f8e4m3, data_types::f4e2m1, data_types::f8e5m2}) &&
one_of(wei_dt, {data_types::f8e4m3, data_types::f4e2m1, data_types::f8e5m2}) && one_of(out_dt, {data_types::f16, data_types::f32});
if (!f16f16_case && !bf16bf16_case && !f32f32_case && !u8s8_case && !compressed_case && !fp_compressed_case)
LOG_AND_RETURN_FALSE(node);

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/intel_gpu/src/graph/impls/onednn/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ dnnl::memory::data_type convert_data_type(cldnn::data_types dt) {
case cldnn::data_types::i32: return dnnl::memory::data_type::s32;
case cldnn::data_types::i4: return dnnl::memory::data_type::s4;
case cldnn::data_types::u4: return dnnl::memory::data_type::u4;
case cldnn::data_types::f4e2m1: return dnnl::memory::data_type::f4_e2m1;
case cldnn::data_types::f8e4m3: return dnnl::memory::data_type::f8_e4m3;
case cldnn::data_types::f8e5m2: return dnnl::memory::data_type::f8_e5m2;
case cldnn::data_types::f8e8m0: return dnnl::memory::data_type::e8m0;
Expand Down Expand Up @@ -258,6 +259,7 @@ int64_t get_offset(const cldnn::layout& l, dnnl::memory::desc&& desc) {
switch (desc.get_data_type()) {
case dnnl::memory::data_type::s4:
case dnnl::memory::data_type::u4:
case dnnl::memory::data_type::f4_e2m1:
return offset / 2;
case dnnl::memory::data_type::s8:
case dnnl::memory::data_type::u8:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/primitive_inst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ void primitive_inst::update_shape() {

if (get_node().is_type<dynamic_quantize>() && get_flag(ExecutionFlags::SHAPE_CHANGED)) {
auto &layout = _impl_params->get_output_layout(0);
OPENVINO_ASSERT(one_of(layout.data_type, {data_types::f16, data_types::i8, data_types::u8, data_types::f8e4m3, data_types::f8e5m2}),
OPENVINO_ASSERT(one_of(layout.data_type, {data_types::f16, data_types::i8, data_types::u8, data_types::f4e2m1, data_types::f8e4m3, data_types::f8e5m2}),
"[GPU] Unsupported data type of dynamic_quantize: ", layout.data_type);
if (layout.data_type == data_types::f16)
set_can_be_optimized(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@
//

#define IS_F8 (F8E5M2_OUTPUT || F8E4M3_OUTPUT)
#define IS_F8_F4 (IS_F8 || F4E2M1_OUTPUT)

#include "include/batch_headers/fetch_data.cl"
#if IS_F8
#if IS_F8_F4
#include "include/batch_headers/common.cl"
#include "include/f8_utils.cl"
#include "include/f4_utils.cl"
#endif

#if F4E2M1_OUTPUT
#define ELEMENTS_PER_BYTE 2
#else
#define ELEMENTS_PER_BYTE 1
#endif

#if OUTPUT_DIMS != 4 && OUTPUT_DIMS != 2
#error "dynamic_quantize_gpu_opt.cl: Unsupported output dimension"
#endif

#if IS_F8
#if IS_F8_F4
#define SCALE_TYPE float
#define TO_SCALE_TYPE(x) _convert_float(x)
#define ACT_MIN_VAL 0.000000059604645h // min half dtype val
Expand All @@ -38,6 +47,18 @@
#define AS_TYPE_N(type, n, x) AS_TYPE_N_(type, n, x)
#define AS_INPUT_TYPE_N(x) AS_TYPE_N(INPUT0_TYPE, VEC_SIZE, x)

#if VEC_SIZE == 2
#define VSTORE_F4(vec, off, ptr) (*((ptr) + (off)) = (vec))
#elif VEC_SIZE == 4
#define VSTORE_F4(vec, off, ptr) vstore2(vec, off, ptr)
#elif VEC_SIZE == 8
#define VSTORE_F4(vec, off, ptr) vstore4(vec, off, ptr)
#elif VEC_SIZE == 16
#define VSTORE_F4(vec, off, ptr) vstore8(vec, off, ptr)
#else
#error "Unsupported VEC_SIZE for F4 packing"
#endif

#if GENERATE_PRECOMPUTED_REDUCTION
#define FOR_PRECOMPUTED_REDUCTION(x) x
#else
Expand Down Expand Up @@ -68,14 +89,14 @@ KERNEL(dynamic_quantize_gpu_opt)(
const uint b = get_global_id(0);
const uint f_grp = get_global_id(1);
const uint input_offset = INPUT0_GET_INDEX(b, f_grp * QUANTIZE_GROUP_SIZE, 0, 0);
const uint output_offset = OUTPUT_GET_INDEX(b, f_grp * QUANTIZE_GROUP_SIZE, 0, 0);
const uint output_offset = (OUTPUT_GET_INDEX(b, f_grp * QUANTIZE_GROUP_SIZE, 0, 0)) / ELEMENTS_PER_BYTE;
#else
const uint bf = get_global_id(0);
const uint b = bf / INPUT0_FEATURE_NUM;
const uint f = bf % INPUT0_FEATURE_NUM;
const uint y_grp = get_global_id(1);
const uint input_offset = INPUT0_GET_INDEX(b, f, y_grp * QUANTIZE_GROUP_SIZE, 0);
const uint output_offset = OUTPUT_GET_INDEX(b, f, y_grp * QUANTIZE_GROUP_SIZE, 0);
const uint output_offset = (OUTPUT_GET_INDEX(b, f, y_grp * QUANTIZE_GROUP_SIZE, 0)) / ELEMENTS_PER_BYTE;

#endif
const uint quantize_block = QUANTIZE_GROUP_SIZE / 4;
Expand All @@ -101,7 +122,12 @@ KERNEL(dynamic_quantize_gpu_opt)(
#endif // MXFP

unroll_for (uint i = 0 ; i < quantize_block; ++i) {
#if IS_F8
#if F4E2M1_OUTPUT
float4 val_f = convert_float4(input_0[i]) * (MAKE_VECTOR_TYPE(SCALE_TYPE, 4))quan_scale;
val_f = clamp(val_f, -_convert_float(OUTPUT_VAL_MAX), _convert_float(OUTPUT_VAL_MAX));
quantized_value[i] = TO_TYPE_N_SAT(OUTPUT_TYPE, 4, val_f);
vstore2(quantized_value[i].data, 0, (uchar*)(&output[output_offset + i * 2]));
#elif IS_F8
quantized_value[i] = TO_TYPE_N_SAT(OUTPUT_TYPE, 4, convert_float4(input_0[i]) * (MAKE_VECTOR_TYPE(SCALE_TYPE, 4))quan_scale);
vstore4(quantized_value[i].data, 0, (char*)(&output[output_offset + i * 4]));
#else
Expand All @@ -116,7 +142,7 @@ KERNEL(dynamic_quantize_gpu_opt)(
#else
const uint output_idx = OUTPUT1_GET_INDEX(b, f, y_grp, 0);
#endif
output_scale[output_idx] = TO_OUTPUT1_TYPE(1.0h / quan_scale);
output_scale[output_idx] = TO_OUTPUT1_TYPE(1.0f / quan_scale);

#if !(IS_MXFP)
FOR_PRECOMPUTED_REDUCTION(output_precomputed_reduction[output_idx] = precomputed_reduction);
Expand Down Expand Up @@ -151,10 +177,10 @@ KERNEL(dynamic_quantize_gpu_opt)(
const uint blockid = (uint)get_global_id(1) % (QUANTIZE_GROUP_SIZE / VEC_SIZE / SIMD);
#if OUTPUT_DIMS == 2
const uint input_offset = INPUT0_GET_INDEX (b, f_grp * QUANTIZE_GROUP_SIZE + VEC_SIZE * sglid, 0, 0);
const uint output_offset = OUTPUT_GET_INDEX(b, f_grp * QUANTIZE_GROUP_SIZE + VEC_SIZE * sglid, 0, 0);
const uint output_offset = (OUTPUT_GET_INDEX(b, f_grp * QUANTIZE_GROUP_SIZE + VEC_SIZE * sglid, 0, 0)) / ELEMENTS_PER_BYTE;
#else
const uint input_offset = INPUT0_GET_INDEX (0, b, f_grp * QUANTIZE_GROUP_SIZE + VEC_SIZE * sglid, 0);
const uint output_offset = OUTPUT_GET_INDEX(0, b, f_grp * QUANTIZE_GROUP_SIZE + VEC_SIZE * sglid, 0);
const uint output_offset = (OUTPUT_GET_INDEX(0, b, f_grp * QUANTIZE_GROUP_SIZE + VEC_SIZE * sglid, 0)) / ELEMENTS_PER_BYTE;
#endif

const uint block_size = SIMD * VEC_SIZE;
Expand Down Expand Up @@ -233,15 +259,22 @@ KERNEL(dynamic_quantize_gpu_opt)(
SCALE_TYPE scale = TO_SCALE_TYPE(OUTPUT_VAL_MAX) / max_value;
#endif

#if IS_F8
val = TO_TYPE_N(INPUT0_TYPE, VEC_SIZE, TO_TYPE_N(SCALE_TYPE, VEC_SIZE, val) * (MAKE_VECTOR_TYPE(SCALE_TYPE, VEC_SIZE))scale);
MAKE_VECTOR_TYPE(SCALE_TYPE, VEC_SIZE) val_scaled = TO_TYPE_N(SCALE_TYPE, VEC_SIZE, val) * (MAKE_VECTOR_TYPE(SCALE_TYPE, VEC_SIZE))scale;
#if F4E2M1_OUTPUT
val_scaled = clamp(val_scaled, -TO_SCALE_TYPE(OUTPUT_VAL_MAX), TO_SCALE_TYPE(OUTPUT_VAL_MAX));
MAKE_VECTOR_TYPE(OUTPUT_TYPE, VEC_SIZE) out_f4 = TO_TYPE_N_SAT(OUTPUT_TYPE, VEC_SIZE, val_scaled);
VSTORE_F4(out_f4.data, 0, (uchar*)(&output[output_offset + (blockid * block_size) / ELEMENTS_PER_BYTE]));
#elif IS_F8
val = TO_TYPE_N(INPUT0_TYPE, VEC_SIZE, val_scaled);
MAKE_VECTOR_TYPE(OUTPUT_TYPE, VEC_SIZE) out = TO_TYPE_N_SAT(OUTPUT_TYPE, VEC_SIZE, val);
VSTORE_N(out.data, 0, (char*)(&output[output_offset + (blockid * block_size)]));
#elif ASYMMETRIC_QUANTIZATION
val = TO_TYPE_N(INPUT0_TYPE, VEC_SIZE, val_scaled);
val *= scale;
val += zp;
VSTORE_N(CAT(CONVERT_UCHAR_N, _rte)(val), 0, output + output_offset + (blockid * block_size));
#else // i8 symmetric
val = TO_TYPE_N(INPUT0_TYPE, VEC_SIZE, val_scaled);
val *= scale;
VSTORE_N(CAT(CONVERT_CHAR_N, _rte)(val), 0, output + output_offset + (blockid * block_size));
#endif
Expand Down Expand Up @@ -322,6 +355,7 @@ KERNEL(dynamic_quantize_gpu_opt)(
const uint b_offset = bf * INPUT0_FEATURE_PITCH;
#endif
const uint offset = b_offset + VEC_SIZE * sglid;
const uint output_byte_offset = (b_offset + VEC_SIZE * sglid) / ELEMENTS_PER_BYTE;

const uint iteration = ALIGNED_BLOCK_NUM / BLOCK_NUM;

Expand Down Expand Up @@ -390,14 +424,21 @@ KERNEL(dynamic_quantize_gpu_opt)(
if ((local_id * iteration + i) >= TOTAL_BLOCK_NUM)
continue;

val[i] = TO_TYPE_N(INPUT0_TYPE, VEC_SIZE, TO_TYPE_N(SCALE_TYPE, VEC_SIZE, val[i]) * (MAKE_VECTOR_TYPE(SCALE_TYPE, VEC_SIZE))scale);
#if IS_F8
MAKE_VECTOR_TYPE(SCALE_TYPE, VEC_SIZE) val_scaled = TO_TYPE_N(SCALE_TYPE, VEC_SIZE, val[i]) * (MAKE_VECTOR_TYPE(SCALE_TYPE, VEC_SIZE))scale;
#if F4E2M1_OUTPUT
val_scaled = clamp(val_scaled, -TO_SCALE_TYPE(OUTPUT_VAL_MAX), TO_SCALE_TYPE(OUTPUT_VAL_MAX));
MAKE_VECTOR_TYPE(OUTPUT_TYPE, VEC_SIZE) out_f4 = TO_TYPE_N_SAT(OUTPUT_TYPE, VEC_SIZE, val_scaled);
VSTORE_F4(out_f4.data, 0, (uchar*)(&output[output_byte_offset + ((local_id * iteration + i) * block_size) / ELEMENTS_PER_BYTE]));
#elif IS_F8
val[i] = TO_TYPE_N(INPUT0_TYPE, VEC_SIZE, val_scaled);
MAKE_VECTOR_TYPE(OUTPUT_TYPE, VEC_SIZE) out = TO_TYPE_N_SAT(OUTPUT_TYPE, VEC_SIZE, val[i]);
VSTORE_N(out.data, 0, (char*)(&output[offset + ((local_id * iteration + i) * block_size)]));
#elif ASYMMETRIC_QUANTIZATION
val[i] = TO_TYPE_N(INPUT0_TYPE, VEC_SIZE, val_scaled);
val[i] += zp;
VSTORE_N(CAT(CONVERT_UCHAR_N, _rte)(val[i]), 0, output + offset + ((local_id * iteration + i) * block_size));
#else // i8 symmetric
val[i] = TO_TYPE_N(INPUT0_TYPE, VEC_SIZE, val_scaled);
VSTORE_N(CAT(CONVERT_CHAR_N, _rte)(val[i]), 0, output + offset + ((local_id * iteration + i) * block_size));
#endif
}
Expand Down
Loading
Loading