-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MatMul single core optimized kernels #1993
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
clang-format
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 451 to 456 in b324fdf
constexpr int t = 4; | |
// Since the kernel has been expanded twice for both A ('m' dimension) and B ('n' dimension), | |
// the following assertions veirify this even division for the single AIE MatMul dimensionality. | |
// Notice that 'k' dimension is not spatially expanded. | |
static_assert(m % (2*r) == 0); // 'm' dimension |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Line 458 in b324fdf
static_assert(n % (2*t) == 0); // 'n' dimension |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Line 461 in b324fdf
} |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 468 to 469 in b324fdf
int32 *__restrict pC) { | |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 473 to 482 in b324fdf
constexpr int s = 4; | |
constexpr int t = 4; | |
// Since the kernel has been expanded twice for both A ('m' dimension) and B ('n' dimension), | |
// the following assertions veirify this even division for the single AIE MatMul dimensionality | |
// Notice that 'k' dimension is not spatially expanded. | |
static_assert(m % (2*r) == 0); // 'm' dimension | |
static_assert(k % s == 0); // 'k' dimension | |
static_assert(n % (2*t) == 0); // 'n' dimension | |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Line 484 in b324fdf
} |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 492 to 493 in b324fdf
bfloat16 *__restrict pC) { | |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 498 to 503 in b324fdf
constexpr int t = 4; | |
// Since the kernel has been expanded 4 times for both A ('m' dimension) and B ('n' dimension), | |
// the following assertions veirify this even division for the single AIE MatMul dimensionality | |
// Notice that 'k' dimension is not spatially expanded. | |
static_assert(m % (4*r) == 0); // 'm' dimension |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Line 505 in b324fdf
static_assert(n % (4*t) == 0); // 'n' dimension |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 515 to 516 in b324fdf
float *__restrict pC) { | |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 520 to 529 in b324fdf
constexpr int s = 8; | |
constexpr int t = 4; | |
// Since the kernel has been expanded 4 times for both A ('m' dimension) and B ('n' dimension), | |
// the following assertions veirify this even division for the single AIE MatMul dimensionality | |
// Notice that 'k' dimension is not spatially expanded. | |
static_assert(m % (4*r) == 0); // 'm' dimension | |
static_assert(k % s == 0); // 'k' dimension | |
static_assert(n % (4*t) == 0); // 'n' dimension | |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Line 531 in b324fdf
} |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 538 to 539 in b324fdf
int8 *__restrict pC) { | |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 543 to 552 in b324fdf
constexpr int s = 8; | |
constexpr int t = 8; | |
// Since the kernel has been expanded 4 times for A ('m' dimension) and 2 times for B ('n' dimension), | |
// the following assertions veirify this even division for the single AIE MatMul dimensionality | |
// Notice that 'k' dimension is not spatially expanded. | |
static_assert(m % (4*r) == 0); // 'm' dimension | |
static_assert(k % s == 0); // 'k' dimension | |
static_assert(n % (2*t) == 0); // 'n' dimension | |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Line 554 in b324fdf
} |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 561 to 562 in b324fdf
int16 *__restrict pC) { | |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 567 to 572 in b324fdf
constexpr int t = 8; | |
// Since the kernel has been expanded 4 times for A ('m' dimension) and 2 times for B ('n' dimension), | |
// the following assertions veirify this even division for the single AIE MatMul dimensionality | |
// Notice that 'k' dimension is not spatially expanded. | |
static_assert(m % (4*r) == 0); // 'm' dimension |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Line 574 in b324fdf
static_assert(n % (2*t) == 0); // 'n' dimension |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Line 577 in b324fdf
} |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 584 to 585 in b324fdf
int32 *__restrict pC) { | |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 590 to 595 in b324fdf
constexpr int t = 8; | |
// Since the kernel has been expanded twice for both A ('m' dimension) and B ('n' dimension), | |
// the following assertions veirify this even division for the single AIE MatMul dimensionality | |
// Notice that 'k' dimension is not spatially expanded. | |
static_assert(m % (4*r) == 0); // 'm' dimension |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Line 597 in b324fdf
static_assert(n % (2*t) == 0); // 'n' dimension |
[clang-format] reported by reviewdog 🐶
mlir-aie/aie_kernels/aie2/mm.cc
Lines 600 to 601 in b324fdf
} | |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# defaults; overwrite if needed | ||
M?=512 | ||
K?=512 | ||
N?=512 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to delete these defaults?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found them confusing, because we already have the sizes in the separate makefiles. But we can keep them if you think they help!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me put some comments on the Makefiles for the GEMM sizes.
This PR merges changes in the mm.c (optimized single AIE MatMul kernels) along with associated changes in Makefiles. Also, trace.py file has been modified to allow capturing further events (not only the default ones).