-
Notifications
You must be signed in to change notification settings - Fork 1k
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
generic:sycl: Inner Product Backward #2360
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.
A couple of edits suggested. Please incorporate as you see fit, thanks!
88fa721
to
ac134aa
Compare
The Failure in
|
This is a flaky test. Issue tracked in #2303. |
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.
The test part seems fine by me, but please correct the propagation kind checks in implementation.
Less important things:
- For init functions, please don't hesitate to use the VDISPATCH macros, as those help debug and analyse user issues (you can find an example here).
- Regarding implementation in header file, could you move as much of those as possible to cpp file?
make test |
4bce05e
to
aca98ca
Compare
This was a good suggestion, thanks @mgouicem .
Moved almost everything to the cpp file |
make test |
aca98ca
to
aad22a9
Compare
make test |
aad22a9
to
8ab19b9
Compare
make test |
@oneapi-src/onednn-arch gentle ping. |
The CI failures related to Inner product are because the |
I can confirm that the CI failures are unrelated to the inner product implementation. |
assert(!"wrong number of dimensions for inner product"); | ||
return format_tag::undef; | ||
} | ||
} |
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.
dnnl::impl::get_abx_tag()
does the same. Please reuse.
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.
Done
std::shared_ptr<primitive_desc_t> &pd) { | ||
|
||
primitive_desc_iterator_t it(engine, op_desc, attributes, nullptr); | ||
if (!it.is_initialized()) return status::invalid_arguments; |
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.
Please restore out_of_memory error status. It's used everywhere for this condition.
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.
Apologies forgot to reply to this, this was covered as a part of the latest commit
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.
It feels the statuses got flipped.
if (!initialized) return status::out_of_memory;
...
if (!assigned) return status::unimplemented;
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.
aha yes, corrected it now
const bool ok = (set_default_params() == status::success); | ||
if (!ok) { return status::unimplemented; } |
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.
VDISPATCH_INNER_PRODUCT support?
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.
using VDISPATCH_INNER_PRODUCT now
= detail::get_cfirst_format_from_ndims(wei_wrapper.ndims()); | ||
} | ||
} else { | ||
if (!src_needs_reorder |
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.
!src_needs_reorder
is secured with else
.
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.
Missed replying to this, this was addressed in one of the previous commits
|
||
case 5: wei_reordered_tag = format_tag::acdeb; break; | ||
default: | ||
assert(!"Wrong number of dimensions for inner product"); |
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.
dnnl::impl::get_axb_format()
does the same. Please reuse.
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.
Done
8ab19b9
to
1d0b87c
Compare
1d0b87c
to
e5852cb
Compare
if (*it) { | ||
assigned = true; | ||
pd = *it; | ||
break; |
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.
You could just return status::success here without adding a new variable.
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.
Done
std::shared_ptr<primitive_desc_t> &pd) { | ||
|
||
primitive_desc_iterator_t it(engine, op_desc, attributes, nullptr); | ||
if (!it.is_initialized()) return status::invalid_arguments; |
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.
It feels the statuses got flipped.
if (!initialized) return status::out_of_memory;
...
if (!assigned) return status::unimplemented;
&& src_strides[0] == src_reshaped.dims[1]; | ||
bool is_not_strided = ((src_strides[0] == 1 || src_strides[1] == 1) | ||
&& src_wrapper.ndims() == 2); // check for strided plain layouts | ||
is_favourable_layout = is_favourable_layout & is_not_strided; |
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.
It's not a bitwise logic or operation.
is_favourable_layout = is_favourable_layout & is_not_strided; | |
is_favourable_layout = is_favourable_layout && is_not_strided; |
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.
Done
auto src_reorder_scratchpad | ||
= ctx.get_scratchpad_grantor().get_memory_storage( | ||
memory_tracking::names::key_iprod_src_reorder); | ||
// An md should not be required to simply access the scratchpad storage |
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.
Is this comment relevant? There's one more like this below.
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.
Yes, it's to signify that we are passing a dummy memory descriptor so that we can simply extract the pointer, and a valid memory descriptor is not required.
I added the comment to avoid any confusion in the future in case someone else is dealing with this section of the code
e5852cb
to
e8c9745
Compare
Since this PR has the required approvals and I have addressed all the comment, I will be going ahead and merging this PR |
Description
Adds the backward_data and the backward_weight of the inner product for the generic backend and supports all possible layouts of inputs / outputs. To enable the same, this PR also enables the forward pass supporting different possible layouts of inputs / outputs, which was previously missing.
Checklist
General
make test
andmake test_benchdnn_*
) pass locally for each commit?