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

Refactor ck_tile fMHA forward example #1249

Draft
wants to merge 40 commits into
base: develop
Choose a base branch
from

Conversation

poyenc
Copy link
Contributor

@poyenc poyenc commented Apr 17, 2024

No description provided.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copyright (c) 2018-2023 -> 2024

CK_TILE_HOST void reference_batched_elementwise(const HostTensor<ADataType>& a_b_m_n,
const HostTensor<BDataType>& b_b_m_n,
HostTensor<CDataType>& c_b_m_n,
CK_TILE_HOST void reference_batched_elementwise(const ATensorView& a_b_m_n,
Copy link
Collaborator

@rocking5566 rocking5566 Apr 18, 2024

Choose a reason for hiding this comment

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

I suggest using Tensor instead of TensorView. Because we also have
struct tensor_view.
Using TensorView easily make reader confuse.

std::size_t GetOffsetFromMultiIndex(Is... is) const
std::enable_if_t<((std::is_integral_v<Is> && std::is_convertible_v<Is, std::size_t>)&&...),
std::size_t>
GetOffsetFromMultiIndex(Is... is) const
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to sync the naming style of funcion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, I will rename the functions

CK_TILE_HOST void reference_batched_gemm(const HostTensor<ADataType>& a_b_m_k,
const HostTensor<BDataType>& b_b_n_k,
HostTensor<CDataType>& c_b_m_n,
CK_TILE_HOST void reference_batched_gemm(const ATensorView& a_b_m_k,
Copy link
Collaborator

@rocking5566 rocking5566 Apr 18, 2024

Choose a reason for hiding this comment

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

TensorView -> Tensor

@@ -9,11 +9,13 @@

namespace ck_tile {

template <typename CDataType, typename MaskingType>
CK_TILE_HOST void reference_batched_masking(HostTensor<CDataType>& c_b_m_n, const MaskingType& mask)
template <typename CTensorView, typename MaskingType>
Copy link
Collaborator

Choose a reason for hiding this comment

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

TensorView->HostTensor

typename CompDataType,
typename BDataType,
template <typename CompDataType,
typename ATensorView,
Copy link
Collaborator

@rocking5566 rocking5566 Apr 18, 2024

Choose a reason for hiding this comment

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

TensorView->Tensor

rocking5566
rocking5566 previously approved these changes Apr 24, 2024
Copy link
Collaborator

@rocking5566 rocking5566 left a comment

Choose a reason for hiding this comment

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

LGTM

@poyenc
Copy link
Contributor Author

poyenc commented Apr 25, 2024

we need to wait for @danyao12 merge his fmha bwd & dropout changes then refactor all the updated example codes together.

@poyenc poyenc marked this pull request as draft April 25, 2024 01:17
@poyenc
Copy link
Contributor Author

poyenc commented Apr 25, 2024

I will continue developing the fmha fwd + KV cache reference function base on current design of HostTensor<>.

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.

2 participants