OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[GPU] Use `[[fallthrough]]` in tensor flattening switch (#33957)
Arseniy Obolenskiyf9e738b23b9c
diff --git a/src/plugins/intel_gpu/src/kernel_selector/tensor_type.cpp b/src/plugins/intel_gpu/src/kernel_selector/tensor_type.cppindex 868b5fb98cf..8129fe93b04 100644--- a/src/plugins/intel_gpu/src/kernel_selector/tensor_type.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/tensor_type.cpp@@ -443,14 +443,7 @@ DataTensor DataTensor::FlattenFeatureAndSpatials() const {case Tensor::fyxb:targetLayout = Tensor::fb;-- // TODO: [FUTURE] Use C++17 [[fallthrough]] instead of code duplication to get portable warning avoidance.- if (f.pitch == y.v * x.v * x.pitch) { // no padding in X/Y axis- l = targetLayout;- break;- }- throw std::runtime_error("Unsupported - cannot flatten with padding");-+ [[fallthrough]];case Tensor::bfyx:if (f.pitch == y.v * x.v * x.pitch) { // no padding in X/Y axisl = targetLayout;@@ -472,16 +465,7 @@ DataTensor DataTensor::FlattenFeatureAndSpatials() const {throw std::runtime_error("Unsupported - cannot flatten with padding");case Tensor::yxfb:targetLayout = Tensor::fb;-- // TODO: [FUTURE] Use C++17 [[fallthrough]] instead of code duplication to get portable warning avoidance.- if ((x.pitch == f.pitch && y.pitch == x.v * x.pitch) || // YX - no Features (val/pitch)- (y.v == 1 && x.v == 1 && x.pitch == f.pitch && y.pitch == f.pitch) || // Feature only- (f.v * f.pitch == x.pitch && f.v * f.pitch == y.pitch && y.v == 1 && x.v == 1)) { // Feature only- l = targetLayout;- break;- }- throw std::runtime_error("Unsupported - cannot flatten yxf to f if f/yx != 1");-+ [[fallthrough]];case Tensor::byxf:if ((x.pitch == f.pitch && y.pitch == x.v * x.pitch) || // YX - no Features (val/pitch)(y.v == 1 && x.v == 1 && x.pitch == f.pitch && y.pitch == f.pitch) || // Feature only