@@ -297,15 +297,15 @@ inline memory::dim right_padding(memory::dim i, memory::dim o, memory::dim k,
297
297
298
298
template <typename data_t >
299
299
struct acc_t {
300
- typedef data_t type;
300
+ using type = data_t ;
301
301
};
302
302
template <>
303
303
struct acc_t <int8_t > {
304
- typedef int type;
304
+ using type = int ;
305
305
};
306
306
template <>
307
307
struct acc_t <uint8_t > {
308
- typedef int type;
308
+ using type = int ;
309
309
};
310
310
311
311
// Smart pointer for map/unmap operations with unique_ptr semantics
@@ -314,9 +314,8 @@ struct mapped_ptr_t {
314
314
using nonconst_type = typename std::remove_cv<T>::type;
315
315
316
316
mapped_ptr_t (std::nullptr_t ) : mem_(nullptr ), ptr_(nullptr ) {}
317
- mapped_ptr_t (const memory *mem) : mem_(mem) {
318
- ptr_ = mem->map_data <nonconst_type>();
319
- }
317
+ mapped_ptr_t (const memory *mem)
318
+ : mem_(mem), ptr_(mem->map_data<nonconst_type>()) {}
320
319
mapped_ptr_t (mapped_ptr_t &&other) : mem_(other.mem_), ptr_(other.ptr_) {
321
320
other.mem_ = nullptr ;
322
321
other.ptr_ = nullptr ;
@@ -368,12 +367,12 @@ void check_zero_tail(int set_zero_flag, const memory &src) {
368
367
369
368
for (memory::dim i = 0 ; i < nelems; ++i) {
370
369
memory::dim off = 0 ;
371
- bool flag = 0 ;
370
+ bool flag = false ;
372
371
for (int j = 0 ; j < ndims; ++j) {
373
372
off += idx[j] * str[j];
374
- if (idx[j] >= dims[ndims - j - 1 ]) flag = 1 ;
373
+ if (idx[j] >= dims[ndims - j - 1 ]) flag = true ;
375
374
}
376
- if (flag == 1 ) {
375
+ if (flag == true ) {
377
376
memory::dim blk_off = mdw.off_l (off, true );
378
377
if (set_zero_flag) {
379
378
src_data[blk_off] = 0.0 ;
@@ -391,8 +390,8 @@ void check_zero_tail(int set_zero_flag, const memory &src) {
391
390
}
392
391
}
393
392
394
- inline memory::desc create_md (memory::dims dims, memory::data_type data_type ,
395
- memory::format_tag fmt_tag) {
393
+ inline memory::desc create_md (const memory::dims & dims,
394
+ memory::data_type data_type, memory:: format_tag fmt_tag) {
396
395
return memory::desc (dims, data_type, fmt_tag);
397
396
}
398
397
@@ -566,7 +565,8 @@ inline dnnl_status_t get_conv_impl_status(
566
565
const_dnnl_primitive_desc_t pd, const char *match_str) {
567
566
const char *conv_str = query_impl_info (pd);
568
567
569
- if (strstr (conv_str, match_str) != NULL ) return dnnl_status_t ::dnnl_success;
568
+ if (strstr (conv_str, match_str) != nullptr )
569
+ return dnnl_status_t ::dnnl_success;
570
570
return dnnl_status_t ::dnnl_unimplemented;
571
571
};
572
572
@@ -608,7 +608,7 @@ struct test_convolution_attr_t {
608
608
609
609
bool is_def () const { return policy != NONE; }
610
610
611
- scale_t (float s, policy_t p = NONE) : scale(s) { policy = p; }
611
+ scale_t (float s, policy_t p = NONE) : policy(p), scale(s) {}
612
612
613
613
policy_t policy;
614
614
float scale;
@@ -632,7 +632,7 @@ struct test_convolution_attr_t {
632
632
633
633
test_convolution_attr_t (
634
634
float s, scale_t ::policy_t p = scale_t ::policy_t ::NONE)
635
- : src_scale(s, p), wei_scale(s, p), dst_scale(s, p), dnnl_attr() {}
635
+ : src_scale(s, p), wei_scale(s, p), dst_scale(s, p) {}
636
636
637
637
test_convolution_attr_t () : test_convolution_attr_t (1 .f) {}
638
638
@@ -785,7 +785,7 @@ static char *test_malloc(size_t size) {
785
785
#else
786
786
int rc = ::posix_memalign (&ptr, align, padded_size);
787
787
#endif /* _WIN32 */
788
- return rc == 0 ? (char *)ptr + TEST_MALLOC_OFFSET : 0 ;
788
+ return rc == 0 ? (char *)ptr + TEST_MALLOC_OFFSET : nullptr ;
789
789
}
790
790
791
791
static void test_free (char *ptr) {
@@ -801,11 +801,11 @@ static void test_free(char *ptr) {
801
801
// NOLINTNEXTLINE(readability-identifier-naming)
802
802
class test_memory {
803
803
public:
804
- test_memory (const memory::desc &d, const dnnl::engine &e) {
804
+ test_memory (const memory::desc &d, const dnnl::engine &e)
805
+ : size_(d.get_size()) {
805
806
bool is_cpu_native = (e.get_kind () == dnnl::engine::kind::cpu)
806
807
&& DNNL_CPU_RUNTIME != DNNL_RUNTIME_SYCL;
807
808
808
- size_ = d.get_size ();
809
809
if (is_cpu_native) {
810
810
data_.reset (test_malloc (size_), test_free);
811
811
mem_ = test::make_memory (d, e, data_.get ());
@@ -1091,10 +1091,9 @@ void test_bwd_pd_allow_empty(const pd_t &pd, const hint_pd_t &hint,
1091
1091
1092
1092
// Note: requires a valid primitive descriptor!
1093
1093
template <typename pd_t , typename hint_pd_t , typename ... prim_params_t >
1094
- void test_bwd_pd_constructors (const pd_t &pd, const hint_pd_t &hint ,
1094
+ void test_bwd_pd_constructors (const pd_t &pd, const hint_pd_t &hint_pd ,
1095
1095
const allows_attr_t &aa, const prim_params_t &...prim_params) {
1096
1096
auto test_pd = pd_t ();
1097
- auto hint_pd = hint;
1098
1097
auto eng = pd.get_engine ();
1099
1098
// ctor from C pd, should not throw
1100
1099
ASSERT_NO_THROW (test_pd = pd_t (pd.get ()));
@@ -1112,7 +1111,7 @@ void test_bwd_pd_constructors(const pd_t &pd, const hint_pd_t &hint,
1112
1111
test_bwd_pd_allow_empty<pd_t >(test_pd, hint_pd, prim_params...);
1113
1112
}
1114
1113
1115
- inline dnnl::stream make_stream (dnnl::engine engine,
1114
+ inline dnnl::stream make_stream (const dnnl::engine & engine,
1116
1115
dnnl::stream::flags flags = dnnl::stream::flags::default_flags) {
1117
1116
#if DNNL_CPU_THREADING_RUNTIME == DNNL_RUNTIME_THREADPOOL
1118
1117
if (engine.get_kind () == dnnl::engine::kind::cpu)
0 commit comments