[GPU][DG2] Fix fusings_gpu/gemm_2in_scale.basic/7 (#15353)

* Onednn only supports 2D/3D gemm but openvino GPU plugin policy enforces 4D~6D. 
  This API mismatch causes problems in the post-op axis and requires massive code changes. 
  Therefore we decided to insert throw code for now and fix this issue later 
   if some models require non-(per tensor/full tensor) post-ops.
* Specifically, per-channel(=f) axis in this testcase becomes y-axis 
   because onednn gemm merges b,f axes into one batch axis.
This commit is contained in:
Dohyun Kim (Felix) 2023-02-07 16:37:26 +09:00 committed by GitHub
parent 00d9ed0da4
commit 7659551d71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -301,6 +301,14 @@ public:
} }
static std::unique_ptr<primitive_impl> create(const gemm_node& arg, const kernel_impl_params& impl_params) { static std::unique_ptr<primitive_impl> create(const gemm_node& arg, const kernel_impl_params& impl_params) {
bool full_tensor_or_per_tensor = true;
for (auto prim : arg.get_fused_primitives()) {
full_tensor_or_per_tensor &=
prim.input_layout.count() == prim.output_layout.count() || prim.input_layout.count() == 1;
}
if (!full_tensor_or_per_tensor) {
IE_THROW() << "Unimplemented: per channel binary post-operation is not supported for onednn gemm. Refer PR(#15353) message.";
}
auto& engine = impl_params.prog->get_engine(); auto& engine = impl_params.prog->get_engine();
auto& config = impl_params.prog->get_config(); auto& config = impl_params.prog->get_config();
auto attr = arg.get_onednn_primitive_attributes(); auto attr = arg.get_onednn_primitive_attributes();

View File

@ -74,6 +74,11 @@ public:
} }
layout get_per_channel_layout(gemm_test_params& p) { layout get_per_channel_layout(gemm_test_params& p) {
// WA: per channel binary post-operation is not supported for onednn gemm. Use single value for such case.
if (engine.get_device_info().supports_immad){
std::cout << "per_channel layout for onednn gemm not supported." << std::endl;
return layout{p.default_type, p.default_format, tensor{1, 1, 1, 1}};
}
return layout{ p.default_type, p.default_format, tensor{ 1, p.in_shapes.at(0).feature[0], 1, 1 } }; return layout{ p.default_type, p.default_format, tensor{ 1, p.in_shapes.at(0).feature[0], 1, 1 } };
} }