Skip to content

Commit 44e429e

Browse files
maxnickluweizhou2016
authored andcommitted
[FIX] Desc similar_to routine consider start stride
1 parent 016a469 commit 44e429e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/common/memory_desc_wrapper.hpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,11 @@ inline bool memory_desc_wrapper::similar_to(const memory_desc_wrapper &rhs,
552552
if (is_wino_desc() || is_rnn_packed_desc()) return false;
553553

554554
const int ds = dim_start;
555-
if (stride_start == -1)
555+
if (stride_start == -1) {
556556
stride_start = ds;
557+
} else if (stride_start > ndims()) {
558+
stride_start = ndims();
559+
}
557560
const auto &blk = blocking_desc();
558561
const auto &r_blk = rhs.blocking_desc();
559562

@@ -562,7 +565,7 @@ inline bool memory_desc_wrapper::similar_to(const memory_desc_wrapper &rhs,
562565
&& format_kind() == rhs.format_kind()
563566
&& IMPLICATION(with_data_type, data_type() == rhs.data_type())
564567
&& custom_cpm(dims() + ds, rhs.dims() + ds, ndims() - ds)
565-
&& custom_cpm(blk.strides + ds, r_blk.strides + ds, ndims() - ds)
568+
&& custom_cpm(blk.strides + stride_start, r_blk.strides + stride_start, ndims() - stride_start)
566569
&& blk.inner_nblks == r_blk.inner_nblks
567570
&& array_cmp(blk.inner_blks, r_blk.inner_blks, blk.inner_nblks)
568571
&& array_cmp(blk.inner_idxs, r_blk.inner_idxs, blk.inner_nblks)

0 commit comments

Comments
 (0)