-
Notifications
You must be signed in to change notification settings - Fork 50
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
Extended Gemm interface to support mixed precision operations #500
Extended Gemm interface to support mixed precision operations #500
Conversation
Co-authored-by: pgorlani <[email protected]>
Co-authored-by: pgorlani <[email protected]>
Co-authored-by: pgorlani <[email protected]>
Co-authored-by: pgorlani <[email protected]>
Co-authored-by: pgorlani <[email protected]>
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.
Thank you for you work @OuadiElfarouki.
There is some confusion with element_in_t
and element_out_t
because you forget to update element_t
to one or the other. Can you please fix it? @hjabird highlighted many of them. In general, I agree that something like in_element_t
and out_element_t
would be more readable, please consider it.
if constexpr (is_half<element_in_t>::value || | ||
!std::is_same_v<element_in_t, element_out_t>) { | ||
#pragma unroll | ||
for (int v = 0; v < VectorSize; ++v) { |
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.
Can you elaborate why this loop is necessary?
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.
@s-Nick AdaptiveCpp doesn't support sycl::vecsycl::half for mad operation, so had to break it down to its elements through the loop
Co-authored-by: HJA Bird <[email protected]>
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.
From a quick look I don't have any major concern.
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.
LGTM!
…xed_precision_gemm
Extend Gemm operator interface to support mixed precision operations, namely by decoupling matrix A and B type
element_in_t
from output matrix C and scalars alpha and beta typeelement_out_t
.Following oneMKL's spec notation for Gemm API : https://spec.oneapi.io/versions/latest/elements/oneMKL/source/domains/blas/gemm.html#onemkl-blas-gemm, this PR enables (Ta==Tb) to be set independently from (Tc==Ts). This feature has been enabled at a first stage for Ta=Tb=sycl::half and Tc=Ts=float. Thus enabling half support also enables the mixed precision case of (half, float) for gemm.
Changes include:
Note :
Following oneMKL expected Gemm API, Support of
bfloat16-float
andstd::int8_t-float
would be straightforward afterwards, but the additional cases ofTa==Tb==Tc
whileTs
(alpha & beta) is separate will require additional decoupling & re-design work..