Skip to content

[SYCLomatic] Enable migration for CUBLASLT_EPILOGUE_DGELU & EPILOGUE_BGRADB#2449

Closed
abhilash1910 wants to merge 2 commits intooneapi-src:SYCLomaticfrom
abhilash1910:dgelu
Closed

[SYCLomatic] Enable migration for CUBLASLT_EPILOGUE_DGELU & EPILOGUE_BGRADB#2449
abhilash1910 wants to merge 2 commits intooneapi-src:SYCLomaticfrom
abhilash1910:dgelu

Conversation

@abhilash1910
Copy link
Copy Markdown
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
Copy Markdown
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?

Comment thread clang/runtime/dpct-rt/include/dpct/blas_gemm_utils.hpp Outdated

template <typename primitive_type, typename... args_type>
inline
typename primitive_type::primitive_desc dgelu_epilogue_(
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.

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

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.

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
Copy Markdown
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?

Comment thread clang/runtime/dpct-rt/include/dpct/blas_gemm_utils.hpp
Comment thread clang/runtime/dpct-rt/include/dpct/blas_gemm_utils.hpp
Comment thread clang/runtime/dpct-rt/include/dpct/blas_gemm_utils.hpp
Comment thread clang/runtime/dpct-rt/include/dpct/blas_gemm_utils.hpp
Comment thread clang/runtime/dpct-rt/include/dpct/blas_gemm_utils.hpp
Comment thread clang/runtime/dpct-rt/include/dpct/blas_gemm_utils.hpp
Comment thread clang/runtime/dpct-rt/include/dpct/blas_gemm_utils.hpp
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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