Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit ff7da60

Browse files
authored
[SYCL][Matrix] Fix warnings about deprecated get_access for host accessor and deprecated host_buffer (#1648)
1 parent 100a9c2 commit ff7da60

10 files changed

+60
-76
lines changed

SYCL/Matrix/Legacy/element_wise_all_ops_bf16_impl.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
2727
};
2828

2929
template <typename T, size_t M, size_t N>
30-
void assert_ops_ref(
31-
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
32-
const float ref) {
30+
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
31+
const float ref) {
3332
for (size_t i = 0; i < M; i++)
3433
for (size_t j = 0; j < N; j++) {
3534
auto diff = make_fp32(C[i][j]) - ref;
@@ -67,7 +66,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
6766
N, matrix_layout::row_major);
6867
}); // parallel for
6968
}).wait();
70-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
69+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
7170
}
7271

7372
template <typename T, size_t M, size_t N>
@@ -100,7 +99,7 @@ void matrix_verify_sub(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
10099
N, matrix_layout::row_major);
101100
}); // parallel for
102101
}).wait();
103-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
102+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
104103
}
105104

106105
template <typename T, size_t M, size_t N>
@@ -133,7 +132,7 @@ void matrix_verify_mul(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
133132
N, matrix_layout::row_major);
134133
}); // parallel for
135134
}).wait();
136-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
135+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
137136
}
138137

139138
template <typename T, size_t M, size_t N>
@@ -166,7 +165,7 @@ void matrix_verify_div(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
166165
N, matrix_layout::row_major);
167166
}); // parallel for
168167
}).wait();
169-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
168+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
170169
}
171170

172171
template <typename T, size_t M, size_t N>
@@ -217,7 +216,7 @@ void matrix_verify_logic(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
217216
N, matrix_layout::row_major);
218217
}); // parallel for
219218
}).wait();
220-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
219+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
221220
}
222221

223222
static constexpr size_t MATRIX_M = TM * 2;

SYCL/Matrix/Legacy/element_wise_all_ops_half_impl.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
1313
};
1414

1515
template <typename T, size_t M, size_t N>
16-
void assert_ops_ref(
17-
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
18-
const float ref) {
16+
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
17+
const float ref) {
1918
for (size_t i = 0; i < M; i++)
2019
for (size_t j = 0; j < N; j++) {
2120
auto diff = C[i][j] - ref;
@@ -53,7 +52,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
5352
N, matrix_layout::row_major);
5453
}); // parallel for
5554
}).wait();
56-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
55+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
5756
}
5857

5958
template <typename T, size_t M, size_t N>
@@ -86,7 +85,7 @@ void matrix_verify_sub(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
8685
N, matrix_layout::row_major);
8786
}); // parallel for
8887
}).wait();
89-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
88+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
9089
}
9190

9291
template <typename T, size_t M, size_t N>
@@ -119,7 +118,7 @@ void matrix_verify_mul(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
119118
N, matrix_layout::row_major);
120119
}); // parallel for
121120
}).wait();
122-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
121+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
123122
}
124123

125124
template <typename T, size_t M, size_t N>
@@ -152,7 +151,7 @@ void matrix_verify_div(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
152151
N, matrix_layout::row_major);
153152
}); // parallel for
154153
}).wait();
155-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
154+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
156155
}
157156

158157
template <typename T, size_t M, size_t N>
@@ -204,7 +203,7 @@ void matrix_verify_logic(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
204203
N, matrix_layout::row_major);
205204
}); // parallel for
206205
}).wait();
207-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
206+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
208207
}
209208

210209
static constexpr size_t MATRIX_M = TM * 2;

SYCL/Matrix/Legacy/element_wise_all_ops_int8_impl.hpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
1313
};
1414

1515
template <typename T, size_t M, size_t N>
16-
void assert_ops_ref(
17-
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
18-
const int ref) {
16+
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C, const int ref) {
1917
for (size_t i = 0; i < M; i++)
2018
for (size_t j = 0; j < N; j++) {
2119
auto diff = C[i][j] - ref;
@@ -53,7 +51,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
5351
N, matrix_layout::row_major);
5452
}); // parallel for
5553
}).wait();
56-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
54+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
5755
}
5856

5957
template <typename T, size_t M, size_t N>
@@ -86,7 +84,7 @@ void matrix_verify_sub(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
8684
N, matrix_layout::row_major);
8785
}); // parallel for
8886
}).wait();
89-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
87+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
9088
}
9189

9290
template <typename T, size_t M, size_t N>
@@ -119,7 +117,7 @@ void matrix_verify_mul(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
119117
N, matrix_layout::row_major);
120118
}); // parallel for
121119
}).wait();
122-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
120+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
123121
}
124122

125123
template <typename T, size_t M, size_t N>
@@ -152,7 +150,7 @@ void matrix_verify_div(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
152150
N, matrix_layout::row_major);
153151
}); // parallel for
154152
}).wait();
155-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
153+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
156154
}
157155

158156
template <typename T, size_t M, size_t N>
@@ -200,7 +198,7 @@ void matrix_verify_logic(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
200198
N, matrix_layout::row_major);
201199
}); // parallel for
202200
}).wait();
203-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
201+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
204202
}
205203

206204
static constexpr size_t MATRIX_M = TM * 2;

SYCL/Matrix/Legacy/element_wise_all_ops_int8_packed_impl.hpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
1313
};
1414

1515
template <typename T, size_t M, size_t N>
16-
void assert_ops_ref(
17-
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
18-
const int ref) {
16+
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C, const int ref) {
1917
for (size_t i = 0; i < M; i++)
2018
for (size_t j = 0; j < N; j++) {
2119
auto diff = C[i][j] - ref;
@@ -53,7 +51,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
5351
N * 4, matrix_layout::row_major);
5452
}); // parallel for
5553
}).wait();
56-
assert_ops_ref<T, M, N>(bufB.get_access<access::mode::read>(), ref);
54+
assert_ops_ref<T, M, N>(bufB.get_host_access(read_only), ref);
5755
}
5856

5957
template <typename T, size_t M, size_t N>
@@ -86,7 +84,7 @@ void matrix_verify_sub(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
8684
N * 4, matrix_layout::row_major);
8785
}); // parallel for
8886
}).wait();
89-
assert_ops_ref<T, M, N>(bufB.get_access<access::mode::read>(), ref);
87+
assert_ops_ref<T, M, N>(bufB.get_host_access(read_only), ref);
9088
}
9189

9290
template <typename T, size_t M, size_t N>
@@ -119,7 +117,7 @@ void matrix_verify_mul(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
119117
N * 4, matrix_layout::row_major);
120118
}); // parallel for
121119
}).wait();
122-
assert_ops_ref<T, M, N>(bufB.get_access<access::mode::read>(), ref);
120+
assert_ops_ref<T, M, N>(bufB.get_host_access(read_only), ref);
123121
}
124122

125123
template <typename T, size_t M, size_t N>
@@ -152,7 +150,7 @@ void matrix_verify_div(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
152150
N * 4, matrix_layout::row_major);
153151
}); // parallel for
154152
}).wait();
155-
assert_ops_ref<T, M, N>(bufB.get_access<access::mode::read>(), ref);
153+
assert_ops_ref<T, M, N>(bufB.get_host_access(read_only), ref);
156154
}
157155

158156
template <typename T, size_t M, size_t N>
@@ -200,7 +198,7 @@ void matrix_verify_logic(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
200198
N * 4, matrix_layout::row_major);
201199
}); // parallel for
202200
}).wait();
203-
assert_ops_ref<T, M, N>(bufB.get_access<access::mode::read>(), ref);
201+
assert_ops_ref<T, M, N>(bufB.get_host_access(read_only), ref);
204202
}
205203

206204
static constexpr size_t MATRIX_M = TM * 2;

SYCL/Matrix/Legacy/element_wise_irreg_sum_rows_impl.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
1212
};
1313

1414
template <typename T, size_t M, size_t N>
15-
void sum_rows_ref(
16-
accessor<T, 2, access::mode::read, access::target::host_buffer> B,
17-
accessor<int, 1, access::mode::read, access::target::host_buffer>
18-
sum_rows) {
15+
void sum_rows_ref(host_accessor<T, 2, access::mode::read> B,
16+
host_accessor<int, 1, access::mode::read> sum_rows) {
1917
int sum_rows_ref[M] = {0};
2018
for (size_t i = 0; i < M; i++) {
2119
for (size_t j = 0; j < N; j++) {
@@ -78,8 +76,8 @@ void matrix_sum_rows(queue q, big_matrix<T, M, N> &B, nd_range<2> &r) {
7876
}
7977
}); // parallel for
8078
}).wait();
81-
sum_rows_ref<T, M, N>(bufB.get_access<access::mode::read>(),
82-
sum_rows_v.get_access<access::mode::read>());
79+
sum_rows_ref<T, M, N>(bufB.get_host_access(read_only),
80+
sum_rows_v.get_host_access(read_only));
8381
}
8482

8583
static constexpr size_t MATRIX_K = TK / 4 * 2;

SYCL/Matrix/element_wise_all_ops_bf16_impl.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
2121
};
2222

2323
template <typename T, size_t M, size_t N>
24-
void assert_ops_ref(
25-
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
26-
const float ref) {
24+
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
25+
const float ref) {
2726
for (size_t i = 0; i < M; i++)
2827
for (size_t j = 0; j < N; j++) {
2928
auto diff = make_fp32(C[i][j]) - ref;
@@ -63,7 +62,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
6362
N);
6463
}); // parallel for
6564
}).wait();
66-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
65+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
6766
}
6867

6968
template <typename T, size_t M, size_t N>
@@ -97,7 +96,7 @@ void matrix_verify_sub(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
9796
N);
9897
}); // parallel for
9998
}).wait();
100-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
99+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
101100
}
102101

103102
template <typename T, size_t M, size_t N>
@@ -130,7 +129,7 @@ void matrix_verify_mul(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
130129
N);
131130
}); // parallel for
132131
}).wait();
133-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
132+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
134133
}
135134

136135
template <typename T, size_t M, size_t N>
@@ -164,7 +163,7 @@ void matrix_verify_div(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
164163
N);
165164
}); // parallel for
166165
}).wait();
167-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
166+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
168167
}
169168

170169
template <typename T, size_t M, size_t N>
@@ -216,7 +215,7 @@ void matrix_verify_logic(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
216215
N);
217216
}); // parallel for
218217
}).wait();
219-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
218+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
220219
}
221220

222221
static constexpr size_t MATRIX_M = TM * 2;

SYCL/Matrix/element_wise_all_ops_half_impl.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
1313
};
1414

1515
template <typename T, size_t M, size_t N>
16-
void assert_ops_ref(
17-
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
18-
const float ref) {
16+
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
17+
const float ref) {
1918
for (size_t i = 0; i < M; i++)
2019
for (size_t j = 0; j < N; j++) {
2120
auto diff = C[i][j] - ref;
@@ -54,7 +53,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
5453
N);
5554
}); // parallel for
5655
}).wait();
57-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
56+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
5857
}
5958

6059
template <typename T, size_t M, size_t N>
@@ -88,7 +87,7 @@ void matrix_verify_sub(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
8887
N);
8988
}); // parallel for
9089
}).wait();
91-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
90+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
9291
}
9392

9493
template <typename T, size_t M, size_t N>
@@ -122,7 +121,7 @@ void matrix_verify_mul(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
122121
N);
123122
}); // parallel for
124123
}).wait();
125-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
124+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
126125
}
127126

128127
template <typename T, size_t M, size_t N>
@@ -156,7 +155,7 @@ void matrix_verify_div(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
156155
N);
157156
}); // parallel for
158157
}).wait();
159-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
158+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
160159
}
161160

162161
template <typename T, size_t M, size_t N>
@@ -209,7 +208,7 @@ void matrix_verify_logic(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
209208
N);
210209
}); // parallel for
211210
}).wait();
212-
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
211+
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
213212
}
214213

215214
static constexpr size_t MATRIX_M = TM * 2;

0 commit comments

Comments
 (0)