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

Add Grouped Convolution and GEMM documentation #1719

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

bartekxk
Copy link
Contributor

@bartekxk bartekxk commented Dec 5, 2024

No description provided.

@bartekxk bartekxk self-assigned this Dec 5, 2024
@aosewski
Copy link
Collaborator

aosewski commented Dec 5, 2024

@bartekxk What about using BF16, FP16 and FP32 instead of bhalf_t half_t and float ?

@bartekxk bartekxk marked this pull request as ready for review December 9, 2024 12:30
Comment on lines +7 to +12
* **BLayout** - B layout (RowMajor/ColumnMajor).
* **CLayout** - C layout (RowMajor/ColumnMajor).
* **ADataType** - A data type.
* **BDataType** - B data type.
* **CDataType** - C data type.
Copy link
Collaborator

Choose a reason for hiding this comment

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

A/B/C Matrix

Comment on lines +13 to +15
* **BElementwiseOperation** - fused operation on tensor B.
* **CElementwiseOperation** - fused operation on tensor C.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's start from capital letter.

Comment on lines +13 to +14
* **BElementwiseOperation** - fused operation on tensor B.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Important to note this elementwise operation is done before multiplication of those two tensors - that is on their (A/B tensor) elements.

* **AElementwiseOperation** - fused operation on tensor A.
* **BElementwiseOperation** - fused operation on tensor B.
* **CElementwiseOperation** - fused operation on tensor C.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Operation is done on the output (result of two matrix multiplication) matrix elements.

* **CElementwiseOperation** - fused operation on tensor C.

For matrices with large K dimension `DeviceGemmSplitK` implementation is available. This implementation allows user to split K dimension between work groups. This implementation requires AtomicAdd operation on global memory (output buffer must be set to zeroes).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
For matrices with large K dimension `DeviceGemmSplitK` implementation is available. This implementation allows user to split K dimension between work groups. This implementation requires AtomicAdd operation on global memory (output buffer must be set to zeroes).
For matrices with large K dimension `DeviceGemmSplitK` implementation is available. This implementation allows user to split K dimension between work groups. This implementation uses `AtomicAdd` operation on global memory, thus need to zero-out output buffer for correct results.


For fused operations with additional tensor there are `DeviceGemmMultipleABD` or `DeviceGemmMultipleD` operation which require following parameters:
* **DsLayout** - layouts for additional tensors for fused operations.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add note that all DsLayout have to be the same as output matrix C layout.

* **DeviceGemmDl** - Device operation with DL instructions.
* **DeviceGemmDpp** - Device operation with DL instructions with DPP instructions during data load.
* **DeviceGemmWmma_CShuffle** - Device operation with WMMA instructions with CShuffle optimization for more optimized data store.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* **DeviceGemmWmma_CShuffle** - Device operation with WMMA instructions with CShuffle optimization for more optimized data store.
* **DeviceGemmWmma_CShuffle** - Device operation with WMMA instructions and CShuffle optimization for more optimized data store.

* **DeviceGemm_Xdl_CShuffleV2** - Device operation with XDL instructions with CShuffle optimization for more optimized data store. GEMM pipeline has been optimized compared to **DeviceGemm_Xdl_CShuffle**.
* **DeviceGemmXdlSkipBLds** - Device operation with XDL instructions. Load to shared memory has been skiped for B matrix.
* **DeviceGemm_Xdl_WaveletModel_CShuffle** - Device operation with XDL instructions with CShuffle optimization for more optimized data store.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please not is uses producer+consumer scheme cooperation between waves in workgroup.

* **DeviceGemmXdl** - Device operation with XDL instructions.

Table of supported cases by instance factory with XDL instruction for Row/Row/Row, Row/Column/Row, Column/Row/Row or Column/Column/Row:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you positive that we support all those layouts for all data types?

Comment on lines +89 to +99
* **BLayout** - B layout (RowMajor/ColumnMajor).
* **CLayout** - C layout (RowMajor/ColumnMajor).
* **ADataType** - A data type.
* **BDataType** - B data type.
* **CDataType** - C data type.
* **AElementwiseOperation** - fused operation on tensor A.
* **BElementwiseOperation** - fused operation on tensor B.
* **CElementwiseOperation** - fused operation on tensor C.

This implementation allows user to split K dimension between work groups. This implementation requires AtomicAdd operation on global memory (output buffer must be set to zeroes if splitK parameter is larger than one).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Like above.

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