1
1
/* ******************************************************************************
2
- * Copyright 2020-2024 Intel Corporation
2
+ * Copyright 2020-2025 Intel Corporation
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -30,19 +30,21 @@ using namespace dnnl::impl::graph;
30
30
using namespace dnnl ::graph::tests::unit::utils;
31
31
32
32
TEST (test_partition, CreateSimple) {
33
+ const graph::fpmath_t fpm {fpmath_mode::strict, false };
33
34
dnnl::impl::graph::dnnl_impl::dnnl_partition_impl_t p (
34
- engine_kind::cpu, fpmath_mode::strict , partition_kind_t ::undef);
35
+ engine_kind::cpu, fpm , partition_kind_t ::undef);
35
36
ASSERT_EQ (p.get_ops ().size (), 0U );
36
- ASSERT_EQ (p.get_fpmath_mode (), fpmath_mode::strict);
37
+ ASSERT_EQ (p.get_fpmath_mode (). mode_ , fpmath_mode::strict);
37
38
ASSERT_EQ (p.get_kind (), partition_kind_t ::undef);
38
39
}
39
40
40
41
TEST (test_partition, AddOps) {
41
42
std::vector<engine_kind_t > engine_kinds
42
43
= {engine_kind::cpu, engine_kind::gpu};
44
+ const graph::fpmath_t fpm {fpmath_mode::strict, false };
43
45
for (const auto &engine_kind : engine_kinds) {
44
46
dnnl::impl::graph::dnnl_impl::dnnl_partition_impl_t p (
45
- engine_kind, fpmath_mode::strict , partition_kind_t ::undef);
47
+ engine_kind, fpm , partition_kind_t ::undef);
46
48
size_t id = 100 ;
47
49
std::shared_ptr<op_t > n (new op_t (id, op_kind::Wildcard, " Wildcard" ));
48
50
p.add_op (n);
@@ -60,8 +62,9 @@ TEST(test_partition, AddOps) {
60
62
}
61
63
62
64
TEST (test_partition, GetOps) {
65
+ const graph::fpmath_t fpm {fpmath_mode::strict, false };
63
66
dnnl::impl::graph::dnnl_impl::dnnl_partition_impl_t p (
64
- engine_kind::cpu, fpmath_mode::strict , partition_kind_t ::undef);
67
+ engine_kind::cpu, fpm , partition_kind_t ::undef);
65
68
size_t id = 100 ;
66
69
std::shared_ptr<op_t > n (new op_t (id, op_kind::Wildcard, " Wildcard" ));
67
70
p.add_op (n);
@@ -73,9 +76,10 @@ TEST(test_partition, GetOps) {
73
76
TEST (test_partition, Init) {
74
77
std::vector<engine_kind_t > engine_kinds
75
78
= {engine_kind::cpu, engine_kind::gpu};
79
+ const graph::fpmath_t fpm {fpmath_mode::strict, false };
76
80
for (const auto &engine_kind : engine_kinds) {
77
81
dnnl::impl::graph::dnnl_impl::dnnl_partition_impl_t p (
78
- engine_kind, fpmath_mode::strict , partition_kind_t ::undef);
82
+ engine_kind, fpm , partition_kind_t ::undef);
79
83
std::shared_ptr<op_t > n (new op_t (0 , op_kind::Convolution, " Conv" ));
80
84
n->set_attr <int64_t >(op_attr::groups, 0 );
81
85
p.add_op (n);
@@ -87,9 +91,10 @@ TEST(test_partition, Init) {
87
91
TEST (test_partition, Clone) {
88
92
std::vector<engine_kind_t > engine_kinds
89
93
= {engine_kind::cpu, engine_kind::gpu};
94
+ const graph::fpmath_t fpm {fpmath_mode::strict, false };
90
95
for (const auto &engine_kind : engine_kinds) {
91
- dnnl::impl::graph::dnnl_impl::dnnl_partition_impl_t p (engine_kind,
92
- fpmath_mode::strict , partition_kind_t ::convolution_post_ops);
96
+ dnnl::impl::graph::dnnl_impl::dnnl_partition_impl_t p (
97
+ engine_kind, fpm , partition_kind_t ::convolution_post_ops);
93
98
auto n = std::make_shared<op_t >(op_kind::Convolution);
94
99
n->set_attr <int64_t >(op_attr::groups, 1 );
95
100
@@ -120,11 +125,10 @@ TEST(test_partition_op, AssignedPartition) {
120
125
op_t conv {0 , op_kind::Convolution, std::string (" convolution" )};
121
126
122
127
ASSERT_EQ (conv.get_partition (), nullptr );
123
-
128
+ const graph:: fpmath_t fpm {fpmath_mode::strict, false };
124
129
auto part = std::make_shared<
125
130
dnnl::impl::graph::dnnl_impl::dnnl_partition_impl_t >(
126
- engine_kind::cpu, fpmath_mode::strict,
127
- partition_kind_t ::convolution_post_ops);
131
+ engine_kind::cpu, fpm, partition_kind_t ::convolution_post_ops);
128
132
conv.set_partition (part.get ());
129
133
ASSERT_EQ (conv.get_partition (), part.get ());
130
134
}
@@ -133,9 +137,10 @@ TEST(test_partition, SetFpmathMode) {
133
137
engine_t *eng = get_engine ();
134
138
for (auto m : {fpmath_mode::strict, fpmath_mode::bf16 , fpmath_mode::f16 ,
135
139
fpmath_mode::any}) {
140
+ const graph::fpmath_t fpm {m, false };
136
141
dnnl::impl::graph::dnnl_impl::dnnl_partition_impl_t p (
137
- eng->kind (), m , partition_kind_t ::undef);
138
- ASSERT_EQ (p.get_fpmath_mode (), m);
142
+ eng->kind (), fpm , partition_kind_t ::undef);
143
+ ASSERT_EQ (p.get_fpmath_mode (). mode_ , m);
139
144
}
140
145
}
141
146
@@ -154,11 +159,10 @@ TEST(test_partition, InferShape) {
154
159
155
160
std::vector<const graph::logical_tensor_t *> inputs {<1, <2};
156
161
std::vector<graph::logical_tensor_t *> outputs {<3};
157
-
162
+ const graph:: fpmath_t fpm {fpmath_mode::strict, false };
158
163
auto par = std::make_shared<
159
164
dnnl::impl::graph::dnnl_impl::dnnl_partition_impl_t >(
160
- engine_kind, graph::fpmath_mode::strict,
161
- graph::partition_kind_t ::undef);
165
+ engine_kind, fpm, graph::partition_kind_t ::undef);
162
166
ASSERT_EQ (par->infer_shape (inputs, outputs), graph::status::success);
163
167
}
164
168
}
0 commit comments