Skip to content
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

[SYCLomatic] Enable migration for CUBLASLT_EPILOGUE_DGELU & EPILOGUE_BGRADB #2449

Closed
wants to merge 2 commits into from

Conversation

abhilash1910
Copy link
Contributor

@abhilash1910 abhilash1910 requested a review from a team as a code owner November 5, 2024 12:43
float alpha, float beta) {

auto alg = ::dnnl::algorithm::eltwise_gelu_erf;
const memory_desc_ext &dst_desc = new memory_desc_ext();
Copy link
Contributor

Choose a reason for hiding this comment

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

where to "delete" dst_desc and src_desc?

@@ -44,6 +44,19 @@ using matmul_desc_ptr = matmul_desc_t *;
class transform_desc_t;
using transform_desc_ptr = transform_desc_t *;

template <typename primitive_type, typename... args_type>
inline
typename primitive_type::primitive_desc dgelu_epilogue_(
Copy link
Contributor

Choose a reason for hiding this comment

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

The function name looks like a type name, please refine it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

const memory_desc_ext &dst_desc = new memory_desc_ext();
const memory_desc_ext &src_desc = new memory_desc_ext();
return create_primitive_desc<primitive_type>(
::dnnl::prop_kind::backward, alg, src_desc.get_desc(),
Copy link
Contributor

Choose a reason for hiding this comment

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

For src_desc and dst_desc, is it OK to pass to the create_primitive_desc directly?
No need to fill data?

Copy link
Contributor

@zhiweij1 zhiweij1 left a comment

Choose a reason for hiding this comment

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

Please refine the PR.

@abhilash1910 abhilash1910 changed the title [SYCLomatic] Enable migration for CUBLASLT_EPILOGUE_DGELU [SYCLomatic] Enable migration for CUBLASLT_EPILOGUE_DGELU & EPILOGUE_BGRADB Nov 7, 2024
Copy link
Contributor

@zhiweij1 zhiweij1 left a comment

Choose a reason for hiding this comment

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

Please submit E2E test PR first.

Comment on lines +235 to +255
typename primitive_type::primitive_desc sync_gelu_backward(
float alpha, float beta, const::dnnl::memory_desc_ext &src_desc,
const ::dnnl::memory_desc_ext &dest_desc) {

auto alg = ::dnnl::algorithm::eltwise_gelu_erf;
return create_primitive_desc<primitive_type>(
::dnnl::prop_kind::backward, alg, src_desc.get_desc(),
dst_desc.get_desc(), alpha, beta);
}

template <typename primitive_type, typename... args_type>
inline
typename primitive_type::primitive_desc bias_backward(
float alpha, float beta, const dnnl::memory_desc_ext &src_desc,
const ::dnnl::memory_desc_ext &dest_desc) {

auto alg = ::dnnl::algorithm::reduction_sum;
return create_primitive_desc<primitive_type>(
::dnnl::prop_kind::backward, alg, src_desc.get_desc(),
dst_desc.get_desc(), alpha, beta);
}
Copy link
Contributor

@zhiweij1 zhiweij1 Dec 4, 2024

Choose a reason for hiding this comment

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

For backward primitives, it needs a forward primitive object as a constructor argument. https://github.com/oneapi-src/oneDNN/blob/main/include/oneapi/dnnl/dnnl.hpp#L7476

@abhilash1910
Copy link
Contributor Author

Transfer to @zhiweij1 . Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants