Skip to content

Commit

Permalink
[SYCL] [Joint Matrix] Modularized tests (#13730)
Browse files Browse the repository at this point in the history
This is part 1 of 2 to improve reuse of common functions in the Joint
Matrix test set. This changes focuses on removing functions, aliases and
types from individual tests and relying on them being present in
`common.hpp`.
  • Loading branch information
artemrad authored May 14, 2024
1 parent 5e8085d commit 9beb70b
Show file tree
Hide file tree
Showing 30 changed files with 24 additions and 246 deletions.
2 changes: 1 addition & 1 deletion sycl/test-e2e/Matrix/SG32/element_wise_abc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <cstddef>
#include "../common.hpp"

constexpr size_t SG_SZ = 32;
constexpr size_t TN = 16;
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/SG32/element_wise_all_ops_half.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::intel;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "../common.hpp"

constexpr size_t SG_SZ = 32;
constexpr size_t TN = 16;
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/SG32/element_wise_all_ops_int8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::intel;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "../common.hpp"

constexpr size_t SG_SZ = 32;
constexpr size_t TN = 16;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@

// This test stores the matrix B that is VNNIed (packed).

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::intel;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "../common.hpp"

constexpr size_t SG_SZ = 32;
constexpr size_t TN = 16;
Expand Down
8 changes: 1 addition & 7 deletions sycl/test-e2e/Matrix/SG32/element_wise_all_ops_tf32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "../common.hpp"

constexpr size_t SG_SZ = 32;
constexpr size_t TN = 16;
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/SG32/element_wise_all_sizes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::oneapi::experimental::matrix;
using bfloat16 = sycl::ext::oneapi::bfloat16;
#include "../common.hpp"

constexpr size_t SG_SZ = 32;

Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/SG32/joint_matrix_apply_bf16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::oneapi::experimental::matrix;
using bfloat16 = sycl::ext::oneapi::bfloat16;
#include "../common.hpp"

constexpr size_t SG_SZ = 32;
constexpr size_t TN = 16;
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/Matrix/XMX8/element_wise_abc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <cstddef>
#include "../common.hpp"

#define SG_SZ 8
constexpr size_t TN = 8;
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/XMX8/element_wise_all_ops_half.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::intel;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "../common.hpp"

#define SG_SZ 8
constexpr size_t TN = 8;
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/XMX8/element_wise_all_ops_int8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::intel;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "../common.hpp"

#define SG_SZ 8
constexpr size_t TN = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@

// This test stores the matrix B that is VNNIed (packed).

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::intel;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "../common.hpp"

#define SG_SZ 8
constexpr size_t TN = 8;
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/XMX8/element_wise_all_sizes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::oneapi::experimental::matrix;
using bfloat16 = sycl::ext::oneapi::bfloat16;
#include "../common.hpp"

#define SG_SZ 8
constexpr size_t TN = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@
// RUN: %{build} -fsycl-device-code-split=off -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::oneapi::experimental::matrix;
using bfloat16 = sycl::ext::oneapi::bfloat16;
#include "../common.hpp"

#define SG_SZ 8
constexpr size_t TN = 8;
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/XMX8/joint_matrix_apply_bf16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::oneapi::experimental::matrix;
using bfloat16 = sycl::ext::oneapi::bfloat16;
#include "../common.hpp"

#define SG_SZ 8
constexpr size_t TN = 8;
Expand Down
2 changes: 1 addition & 1 deletion sycl/test-e2e/Matrix/element_wise_abc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <cstddef>
#include "common.hpp"

#define SG_SZ 16
constexpr size_t TN = 16;
Expand Down
10 changes: 0 additions & 10 deletions sycl/test-e2e/Matrix/element_wise_abc_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ using namespace sycl::ext::oneapi::experimental::matrix;
#define TM 8
#define TK 32

template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
public:
T *mat;

public:
T *get_data() { return mat; }
void set_data(T *data) { mat = data; }
big_matrix(T *data) : mat(data) {}
};

template <typename T1, typename T2, size_t M, size_t N, size_t K,
int vnniFactor>
void matrix_elem_wise_ops(big_matrix<T1, M, N> &C, big_matrix<T2, M, K> &A,
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/element_wise_all_ops_half.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::intel;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "common.hpp"

#define SG_SZ 16
constexpr size_t TN = 16;
Expand Down
10 changes: 0 additions & 10 deletions sycl/test-e2e/Matrix/element_wise_all_ops_half_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
#define TM 8
#define TK 16

template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
private:
T *mat;

public:
T *get_data() { return mat; }
void set_data(T *data) { mat = data; }
big_matrix(T *data) : mat(data) {}
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
const float ref) {
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/element_wise_all_ops_int8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::intel;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "common.hpp"

#define SG_SZ 16
constexpr size_t TN = 16;
Expand Down
10 changes: 0 additions & 10 deletions sycl/test-e2e/Matrix/element_wise_all_ops_int8_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
#define TM 8
#define TK 32

template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
public:
T *mat;

public:
T *get_data() { return mat; }
void set_data(T *data) { mat = data; }
big_matrix(T *data) : mat(data) {}
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C, const int ref) {
for (size_t i = 0; i < M; i++)
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/element_wise_all_ops_int8_packed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@

// This test stores the matrix B that is VNNIed (packed).

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::intel;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "common.hpp"

#define SG_SZ 16
constexpr size_t TN = 16;
Expand Down
10 changes: 0 additions & 10 deletions sycl/test-e2e/Matrix/element_wise_all_ops_int8_packed_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
#define TM 8
#define TK 32

template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
public:
T *mat;

public:
T *get_data() { return mat; }
void set_data(T *data) { mat = data; }
big_matrix(T *data) : mat(data) {}
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C, const int ref) {
for (size_t i = 0; i < M; i++)
Expand Down
8 changes: 1 addition & 7 deletions sycl/test-e2e/Matrix/element_wise_all_ops_tf32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::oneapi::experimental::matrix;
#include "common.hpp"

#define SG_SZ 16
constexpr size_t TN = 16;
Expand Down
11 changes: 1 addition & 10 deletions sycl/test-e2e/Matrix/element_wise_all_ops_tf32_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
#define TM 8
#define TK 8

template <typename T, size_t NUM_ROWS, size_t NUM_COLS> struct big_matrix {
public:
T *mat;

public:
T *get_data() { return mat; }
void set_data(T *data) { mat = data; }
big_matrix(T *data) : mat(data) {}
};

template <typename T, size_t M, size_t N>
void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
const float ref) {
Expand All @@ -29,6 +19,7 @@ void assert_ops_ref(host_accessor<T, 2, access::mode::read> C,
std::numeric_limits<float>::epsilon());
}
}

template <typename T, typename Ts, size_t M, size_t K>
void matrix_verify_add(queue q, big_matrix<Ts, M, K> &A, nd_range<2> &r,
const float ref) {
Expand Down
9 changes: 1 addition & 8 deletions sycl/test-e2e/Matrix/element_wise_all_sizes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <iostream>
#include <random>
#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/matrix/matrix.hpp>

using namespace sycl;
using namespace sycl::ext::oneapi::experimental::matrix;
using bfloat16 = sycl::ext::oneapi::bfloat16;
#include "common.hpp"

#define SG_SZ 16

Expand Down
Loading

0 comments on commit 9beb70b

Please sign in to comment.