@@ -33,8 +33,10 @@ namespace dnnl {
3333namespace impl {
3434
3535status_t fill_blocked (memory_desc_t &md, std::vector<int > &perm,
36- std::vector<int > &inner_blks,
37- std::vector<int > &inner_idxs);
36+ std::vector<int > &inner_blks, std::vector<int > &inner_idxs);
37+
38+ status_t fill_blocked (memory_desc_t &md, std::vector<dim_t > &perm,
39+ std::vector<dim_t > &inner_blks, std::vector<dim_t > &inner_idxs);
3840
3941/* * thin wrapper class over \struct memory_desc_t which allows easy
4042 * manipulations with underlying C structure, which is taken by reference */
@@ -323,13 +325,20 @@ struct memory_desc_wrapper : public c_compatible {
323325 const size_t metadata = padded_dims ()[0 ] * padded_dims ()[1 ] / 64
324326 * sizeof (uint64_t );
325327 using comp_tile_len_type = int ;
326- size_t comp_tile_data_size = ceil (static_cast <float >(padded_dims ()[0 ] * padded_dims ()[1 ])
327- / (64 * 64 * (64 / sizeof (comp_tile_len_type)))) * 64 ;
328- return comp_tile_data_size + (padded_dims ()[0 ] * padded_dims ()[1 ] * data_type_size ())
328+ size_t comp_tile_data_size
329+ = ceil (static_cast <float >(
330+ padded_dims ()[0 ] * padded_dims ()[1 ])
331+ / (64 * 64
332+ * (64 / sizeof (comp_tile_len_type))))
333+ * 64 ;
334+ return comp_tile_data_size
335+ + (padded_dims ()[0 ] * padded_dims ()[1 ]
336+ * data_type_size ())
329337 + metadata + 1000 ;
330- // todo: [av] why 1000?
338+ // todo: [av] why 1000?
331339 } else {
332- printf (" encoding:%d\n " , (int )sparse_desc ().encoding ), fflush (stdout);
340+ printf (" encoding:%d\n " , (int )sparse_desc ().encoding ),
341+ fflush (stdout);
333342 assert (!" unknown sparse encoding" );
334343 return 0 ;
335344 }
@@ -446,7 +455,8 @@ struct memory_desc_wrapper : public c_compatible {
446455 if (utils::one_of (format_kind (), format_kind::undef, format_kind::any))
447456 return false ;
448457 if (has_runtime_dims_or_strides () || has_broadcast ()) return false ;
449- return utils::div_up (nelems (with_padding)* data_type_size (), sub_byte_data_type_multiplier ())
458+ return utils::div_up (nelems (with_padding) * data_type_size (),
459+ sub_byte_data_type_multiplier ())
450460 == size (0 , /* include_additional_size = */ false );
451461 }
452462
@@ -530,8 +540,9 @@ struct memory_desc_wrapper : public c_compatible {
530540 * following statement might be true: lhs == rhs && !lhs.similar_to(rhs) */
531541 /* TODO: revise */
532542 bool similar_to (const memory_desc_wrapper &rhs, bool with_padding = true ,
533- bool with_data_type = true , int dim_start = 0 , bool use_weak_cmp = false ,
534- bool check_off0 = false , uint64_t stride_mask = 0xffffffffffffffff ) const ;
543+ bool with_data_type = true , int dim_start = 0 ,
544+ bool use_weak_cmp = false , bool check_off0 = false ,
545+ uint64_t stride_mask = 0xffffffffffffffff ) const ;
535546
536547 /* * returns true if one memory can be reordered to another */
537548 bool consistent_with (const memory_desc_wrapper &rhs) const ;
@@ -670,9 +681,8 @@ struct memory_desc_wrapper : public c_compatible {
670681 memory_desc_t &memory_desc, format_tag_t tag);
671682
672683 static status_t compute_blocking (format_tag_t tag,
673- std::vector<size_t > &perm,
674- std::vector<size_t > &inner_blks,
675- std::vector<size_t > &inner_idxs);
684+ std::vector<size_t > &perm, std::vector<size_t > &inner_blks,
685+ std::vector<size_t > &inner_idxs);
676686
677687private:
678688 /* TODO: put logical_offset in utils */
@@ -703,7 +713,8 @@ struct memory_desc_wrapper : public c_compatible {
703713};
704714
705715inline bool memory_desc_wrapper::similar_to (const memory_desc_wrapper &rhs,
706- bool with_padding, bool with_data_type, int dim_start, bool use_weak_cmp, bool check_off0, uint64_t stride_mask) const {
716+ bool with_padding, bool with_data_type, int dim_start,
717+ bool use_weak_cmp, bool check_off0, uint64_t stride_mask) const {
707718 using namespace utils ;
708719
709720 if (one_of (format_kind (), format_kind::undef, format_kind::any))
@@ -718,12 +729,16 @@ inline bool memory_desc_wrapper::similar_to(const memory_desc_wrapper &rhs,
718729 auto custom_cpm = use_weak_cmp ? array_cmp_weak : array_cmp<dnnl_dim_t >;
719730 auto cmp_strides = [&]() {
720731 if (0xffffffffffffffff == stride_mask) {
721- return custom_cpm (blk.strides + ds, r_blk.strides + ds, ndims () - ds);
732+ return custom_cpm (
733+ blk.strides + ds, r_blk.strides + ds, ndims () - ds);
722734 } else {
723735 for (int i = 0 ; i < ndims (); ++i) {
724736 if (stride_mask & (1 << i)) {
725737 if (blk.strides [i] != r_blk.strides [i]
726- && IMPLICATION (use_weak_cmp, (blk.strides [i] != DNNL_RUNTIME_DIM_VAL && r_blk.strides [i] != DNNL_RUNTIME_DIM_VAL))) {
738+ && IMPLICATION (use_weak_cmp,
739+ (blk.strides [i] != DNNL_RUNTIME_DIM_VAL
740+ && r_blk.strides [i]
741+ != DNNL_RUNTIME_DIM_VAL))) {
727742 return false ;
728743 }
729744 }
@@ -736,8 +751,7 @@ inline bool memory_desc_wrapper::similar_to(const memory_desc_wrapper &rhs,
736751 && format_kind () == rhs.format_kind ()
737752 && IMPLICATION (with_data_type, data_type () == rhs.data_type ())
738753 && custom_cpm (dims () + ds, rhs.dims () + ds, ndims () - ds)
739- && cmp_strides ()
740- && blk.inner_nblks == r_blk.inner_nblks
754+ && cmp_strides () && blk.inner_nblks == r_blk.inner_nblks
741755 && array_cmp (blk.inner_blks , r_blk.inner_blks , blk.inner_nblks )
742756 && array_cmp (blk.inner_idxs , r_blk.inner_idxs , blk.inner_nblks )
743757 && IMPLICATION (with_padding,
@@ -746,7 +760,10 @@ inline bool memory_desc_wrapper::similar_to(const memory_desc_wrapper &rhs,
746760 rhs.padded_dims () + ds, ndims () - ds)
747761 && custom_cpm (padded_offsets () + ds,
748762 rhs.padded_offsets () + ds, ndims () - ds))
749- && IMPLICATION (check_off0, (offset0 () == DNNL_RUNTIME_DIM_VAL || rhs.offset0 () ==DNNL_RUNTIME_DIM_VAL || offset0 () == rhs.offset0 ()));
763+ && IMPLICATION (check_off0,
764+ (offset0 () == DNNL_RUNTIME_DIM_VAL
765+ || rhs.offset0 () == DNNL_RUNTIME_DIM_VAL
766+ || offset0 () == rhs.offset0 ()));
750767}
751768
752769inline bool memory_desc_wrapper::consistent_with (
0 commit comments