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

[SYCL][Matrix] Fix warnings about deprecated get_access for host accessor and deprecated host_buffer #1648

Merged
merged 3 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions SYCL/Matrix/Legacy/element_wise_all_ops_bf16_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
const float ref) {
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
const float ref) {
for (size_t i = 0; i < M; i++)
for (size_t j = 0; j < N; j++) {
auto diff = make_fp32(C[i][j]) - ref;
Expand Down Expand Up @@ -67,7 +66,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
N, matrix_layout::row_major);
}); // parallel for
}).wait();
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
}

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

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

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

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

static constexpr size_t MATRIX_M = TM * 2;
Expand Down
15 changes: 7 additions & 8 deletions SYCL/Matrix/Legacy/element_wise_all_ops_half_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
const float ref) {
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
const float ref) {
for (size_t i = 0; i < M; i++)
for (size_t j = 0; j < N; j++) {
auto diff = C[i][j] - ref;
Expand Down Expand Up @@ -53,7 +52,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
N, matrix_layout::row_major);
}); // parallel for
}).wait();
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
}

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

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

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

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

static constexpr size_t MATRIX_M = TM * 2;
Expand Down
14 changes: 6 additions & 8 deletions SYCL/Matrix/Legacy/element_wise_all_ops_int8_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
const int ref) {
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C, const int ref) {
for (size_t i = 0; i < M; i++)
for (size_t j = 0; j < N; j++) {
auto diff = C[i][j] - ref;
Expand Down Expand Up @@ -53,7 +51,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
N, matrix_layout::row_major);
}); // parallel for
}).wait();
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
}

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

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

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

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

static constexpr size_t MATRIX_M = TM * 2;
Expand Down
14 changes: 6 additions & 8 deletions SYCL/Matrix/Legacy/element_wise_all_ops_int8_packed_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
const int ref) {
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C, const int ref) {
for (size_t i = 0; i < M; i++)
for (size_t j = 0; j < N; j++) {
auto diff = C[i][j] - ref;
Expand Down Expand Up @@ -53,7 +51,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
N * 4, matrix_layout::row_major);
}); // parallel for
}).wait();
assert_ops_ref<T, M, N>(bufB.get_access<access::mode::read>(), ref);
assert_ops_ref<T, M, N>(bufB.get_host_access(read_only), ref);
}

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

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

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

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

static constexpr size_t MATRIX_M = TM * 2;
Expand Down
10 changes: 4 additions & 6 deletions SYCL/Matrix/Legacy/element_wise_irreg_sum_rows_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
};

template <typename T, size_t M, size_t N>
void sum_rows_ref(
accessor<T, 2, access::mode::read, access::target::host_buffer> B,
accessor<int, 1, access::mode::read, access::target::host_buffer>
sum_rows) {
void sum_rows_ref(host_accessor<T, 2, access::mode::read> B,
host_accessor<int, 1, access::mode::read> sum_rows) {
int sum_rows_ref[M] = {0};
for (size_t i = 0; i < M; i++) {
for (size_t j = 0; j < N; j++) {
Expand Down Expand Up @@ -78,8 +76,8 @@ void matrix_sum_rows(queue q, big_matrix<T, M, N> &B, nd_range<2> &r) {
}
}); // parallel for
}).wait();
sum_rows_ref<T, M, N>(bufB.get_access<access::mode::read>(),
sum_rows_v.get_access<access::mode::read>());
sum_rows_ref<T, M, N>(bufB.get_host_access(read_only),
sum_rows_v.get_host_access(read_only));
}

static constexpr size_t MATRIX_K = TK / 4 * 2;
Expand Down
15 changes: 7 additions & 8 deletions SYCL/Matrix/element_wise_all_ops_bf16_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
const float ref) {
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
const float ref) {
for (size_t i = 0; i < M; i++)
for (size_t j = 0; j < N; j++) {
auto diff = make_fp32(C[i][j]) - ref;
Expand Down Expand Up @@ -63,7 +62,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
N);
}); // parallel for
}).wait();
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
}

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

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

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

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

static constexpr size_t MATRIX_M = TM * 2;
Expand Down
15 changes: 7 additions & 8 deletions SYCL/Matrix/element_wise_all_ops_half_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(
accessor<T, 2, access::mode::read, access::target::host_buffer> C,
const float ref) {
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
const float ref) {
for (size_t i = 0; i < M; i++)
for (size_t j = 0; j < N; j++) {
auto diff = C[i][j] - ref;
Expand Down Expand Up @@ -54,7 +53,7 @@ void matrix_verify_add(queue q, big_matrix<T, M, N> &A, nd_range<2> &r,
N);
}); // parallel for
}).wait();
assert_ops_ref<T, M, N>(bufA.get_access<access::mode::read>(), ref);
assert_ops_ref<T, M, N>(bufA.get_host_access(read_only), ref);
}

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

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

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

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

static constexpr size_t MATRIX_M = TM * 2;
Expand Down
Loading