Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
76 changes: 47 additions & 29 deletions sycl/include/CL/__spirv/spirv_ops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,88 +24,106 @@
#ifdef __SYCL_DEVICE_ONLY__
template <typename T, std::size_t R, std::size_t C,
__spv::MatrixLayout L = __spv::MatrixLayout::RowMajor,
__spv::MatrixUse U = __spv::MatrixUse::Unnecessary,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T, R, C, L, S> *
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T, R, C, L, U, S> *
__spirv_JointMatrixLoadINTEL(T *Ptr, std::size_t Stride,
__spv::MatrixLayout Layout = L,
__spv::Scope::Flag Sc = S, int MemOperand = 0);

template <typename T, std::size_t R, std::size_t C,
__spv::MatrixLayout L = __spv::MatrixLayout::RowMajor,
__spv::MatrixUse U = __spv::MatrixUse::Unnecessary,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL void __spirv_JointMatrixStoreINTEL(
T *Ptr, __spv::__spirv_JointMatrixINTEL<T, R, C, L, S> *Object,
T *Ptr, __spv::__spirv_JointMatrixINTEL<T, R, C, L, U, S> *Object,
std::size_t Stride, __spv::MatrixLayout Layout = L,
__spv::Scope::Flag Sc = S, int MemOperand = 0);

template <typename T1, typename T2, std::size_t M, std::size_t K, std::size_t N,
__spv::MatrixUse UA = __spv::MatrixUse::Unnecessary,
__spv::MatrixUse UB = __spv::MatrixUse::Unnecessary,
__spv::MatrixUse UC = __spv::MatrixUse::Unnecessary,
__spv::MatrixLayout LA = __spv::MatrixLayout::RowMajor,
__spv::MatrixLayout LB = __spv::MatrixLayout::RowMajor,
__spv::MatrixLayout LC = __spv::MatrixLayout::RowMajor,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T2, M, N, LC, S> *
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T2, M, N, LC, UC, S> *
__spirv_JointMatrixMadINTEL(
__spv::__spirv_JointMatrixINTEL<T1, M, K, LA, S> *A,
__spv::__spirv_JointMatrixINTEL<T1, K, N, LB, S> *B,
__spv::__spirv_JointMatrixINTEL<T2, M, N, LC, S> *C,
__spv::__spirv_JointMatrixINTEL<T1, M, K, LA, UA, S> *A,
__spv::__spirv_JointMatrixINTEL<T1, K, N, LB, UB, S> *B,
__spv::__spirv_JointMatrixINTEL<T2, M, N, LC, UC, S> *C,
__spv::Scope::Flag Sc = __spv::Scope::Flag::Subgroup);

template <typename T1, typename T2, typename T3, std::size_t M, std::size_t K,
std::size_t N, __spv::MatrixLayout LA = __spv::MatrixLayout::RowMajor,
std::size_t N, __spv::MatrixUse UA = __spv::MatrixUse::Unnecessary,
__spv::MatrixUse UB = __spv::MatrixUse::Unnecessary,
__spv::MatrixUse UC = __spv::MatrixUse::Unnecessary,
__spv::MatrixLayout LA = __spv::MatrixLayout::RowMajor,
__spv::MatrixLayout LB = __spv::MatrixLayout::RowMajor,
__spv::MatrixLayout LC = __spv::MatrixLayout::RowMajor,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T3, M, N, LC, S> *
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T3, M, N, LC, UC, S> *
__spirv_JointMatrixUUMadINTEL(
__spv::__spirv_JointMatrixINTEL<T1, M, K, LA, S> *A,
__spv::__spirv_JointMatrixINTEL<T2, K, N, LB, S> *B,
__spv::__spirv_JointMatrixINTEL<T3, M, N, LC, S> *C,
__spv::__spirv_JointMatrixINTEL<T1, M, K, LA, UA, S> *A,
__spv::__spirv_JointMatrixINTEL<T1, K, N, LB, UB, S> *B,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be T2, right?

__spv::__spirv_JointMatrixINTEL<T3, M, N, LC, UC, S> *C,
__spv::Scope::Flag Sc = __spv::Scope::Flag::Subgroup);

template <typename T1, typename T2, typename T3, std::size_t M, std::size_t K,
std::size_t N, __spv::MatrixLayout LA = __spv::MatrixLayout::RowMajor,
std::size_t N, __spv::MatrixUse UA = __spv::MatrixUse::Unnecessary,
__spv::MatrixUse UB = __spv::MatrixUse::Unnecessary,
__spv::MatrixUse UC = __spv::MatrixUse::Unnecessary,
__spv::MatrixLayout LA = __spv::MatrixLayout::RowMajor,
__spv::MatrixLayout LB = __spv::MatrixLayout::RowMajor,
__spv::MatrixLayout LC = __spv::MatrixLayout::RowMajor,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T3, M, N, LC, S> *
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T3, M, N, LC, UC, S> *
__spirv_JointMatrixUSMadINTEL(
__spv::__spirv_JointMatrixINTEL<T1, M, K, LA, S> *A,
__spv::__spirv_JointMatrixINTEL<T2, K, N, LB, S> *B,
__spv::__spirv_JointMatrixINTEL<T3, M, N, LC, S> *C,
__spv::__spirv_JointMatrixINTEL<T1, M, K, LA, UA, S> *A,
__spv::__spirv_JointMatrixINTEL<T1, K, N, LB, UB, S> *B,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T2

__spv::__spirv_JointMatrixINTEL<T3, M, N, LC, UC, S> *C,
__spv::Scope::Flag Sc = __spv::Scope::Flag::Subgroup);

template <typename T1, typename T2, typename T3, std::size_t M, std::size_t K,
std::size_t N, __spv::MatrixLayout LA = __spv::MatrixLayout::RowMajor,
std::size_t N, __spv::MatrixUse UA = __spv::MatrixUse::Unnecessary,
__spv::MatrixUse UB = __spv::MatrixUse::Unnecessary,
__spv::MatrixUse UC = __spv::MatrixUse::Unnecessary,
__spv::MatrixLayout LA = __spv::MatrixLayout::RowMajor,
__spv::MatrixLayout LB = __spv::MatrixLayout::RowMajor,
__spv::MatrixLayout LC = __spv::MatrixLayout::RowMajor,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T3, M, N, LC, S> *
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T3, M, N, LC, UC, S> *
__spirv_JointMatrixSUMadINTEL(
__spv::__spirv_JointMatrixINTEL<T1, M, K, LA, S> *A,
__spv::__spirv_JointMatrixINTEL<T2, K, N, LB, S> *B,
__spv::__spirv_JointMatrixINTEL<T3, M, N, LC, S> *C,
__spv::__spirv_JointMatrixINTEL<T1, M, K, LA, UA, S> *A,
__spv::__spirv_JointMatrixINTEL<T1, K, N, LB, UB, S> *B,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T2

__spv::__spirv_JointMatrixINTEL<T3, M, N, LC, UC, S> *C,
__spv::Scope::Flag Sc = __spv::Scope::Flag::Subgroup);

template <typename T, std::size_t R, std::size_t C,
__spv::MatrixLayout L = __spv::MatrixLayout::RowMajor,
__spv::MatrixUse U = __spv::MatrixUse::Unnecessary,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T, R, C, L, S> *
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T, R, C, L, U, S> *
__spirv_CompositeConstruct(const T v);

template <typename T, std::size_t R, std::size_t C, __spv::MatrixLayout U,
template <typename T, std::size_t R, std::size_t C, __spv::MatrixUse U,
__spv::MatrixLayout L,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL size_t __spirv_JointMatrixWorkItemLengthINTEL(
__spv::__spirv_JointMatrixINTEL<T, R, C, U, S> *);
__spv::__spirv_JointMatrixINTEL<T, R, C, L, U, S> *);

template <typename T, std::size_t R, std::size_t C, __spv::MatrixLayout U,
template <typename T, std::size_t R, std::size_t C, __spv::MatrixUse U,
__spv::MatrixLayout L,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL T __spirv_VectorExtractDynamic(
__spv::__spirv_JointMatrixINTEL<T, R, C, U, S> *, size_t i);
__spv::__spirv_JointMatrixINTEL<T, R, C, L, U, S> *, size_t i);

template <typename T, std::size_t R, std::size_t C, __spv::MatrixLayout U,
template <typename T, std::size_t R, std::size_t C, __spv::MatrixUse U,
__spv::MatrixLayout L,
__spv::Scope::Flag S = __spv::Scope::Flag::Subgroup>
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T, R, C, U, S> *
__spirv_VectorInsertDynamic(__spv::__spirv_JointMatrixINTEL<T, R, C, U, S> *,
extern SYCL_EXTERNAL __spv::__spirv_JointMatrixINTEL<T, R, C, L, U, S> *
__spirv_VectorInsertDynamic(__spv::__spirv_JointMatrixINTEL<T, R, C, L, U, S> *,
T val, size_t i);

#ifndef __SPIRV_BUILTIN_DECLARATIONS__
Expand Down
13 changes: 11 additions & 2 deletions sycl/include/CL/__spirv/spirv_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ enum class MatrixLayout : uint32_t {
PackedB = 3
};

enum class MatrixUse : uint32_t {
MatrixA = 0,
MatrixB = 1,
Accumulator = 2,
Unnecessary = 3
};

// TODO: replace the following W/A with a better solution when we have it.
// The following structure is used to represent the joint matrix type in the
// LLVM IR. The structure has a pointer to a multidimensional array member which
Expand All @@ -129,10 +136,12 @@ enum class MatrixLayout : uint32_t {
// information to SPIRV translator.
// The long term solution would be to introduce a matrix type in Clang and use
// it instead of this member.
template <typename T, std::size_t R, std::size_t C, MatrixLayout U,
template <typename T, std::size_t R, std::size_t C, MatrixLayout L, MatrixUse U,
Scope::Flag S = Scope::Flag::Subgroup>
struct __spirv_JointMatrixINTEL {
T (*Value)[R][C][static_cast<size_t>(U) + 1][static_cast<size_t>(S) + 1];
T(*Value)
[R][C][static_cast<size_t>(L) + 1][static_cast<size_t>(S) + 1]
[static_cast<size_t>(U) + 1];
};

} // namespace __spv
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/CL/sycl/feature_test.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace sycl {
// 2- provides JIT implementation (target agnostic) for the
// experimental matrix extension
#ifndef SYCL_EXT_ONEAPI_MATRIX
#define SYCL_EXT_ONEAPI_MATRIX 2
#define SYCL_EXT_ONEAPI_MATRIX 3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to 2

#endif
#define SYCL_EXT_ONEAPI_ASSERT 1
#define SYCL_EXT_ONEAPI_COMPLEX_ALGORITHMS 1
Expand Down
Loading