Skip to content

Functional support mma.sync + ldmatrix for F16 datatype - #11817

Merged
manishucsd merged 26 commits into
iree-org:mainfrom
manishucsd:unrolling_mma_ops_jan_1
Jan 23, 2023
Merged

manishucsd merged 26 commits into
iree-org:mainfrom
manishucsd:unrolling_mma_ops_jan_1

Conversation

@manishucsd

@manishucsd manishucsd commented Jan 12, 2023 •

Copy link
Copy Markdown
Contributor

Adds native Tensor Core (F16) support for NVIDIA GPUs. Specifically, adds support to target mma.sync.aligned.m16n8k16.row.col.f16.f16.f16.f16 and ldmatrix instructions on NVIDIA A100 GPUs. For now, these instructions are not enabled by default and requires using (--iree-codegen-llvmgpu-use-mma-sync=true).

IREE runs row-row matmul and the native Tensor Core support requires ldmatrix for operandA and ldmatrix.trans for operandB. ldmatrix.trans transposes the data while loading to use Tensor Core mma*row.col* instruction.

There are LLVM/MLIR upstream pathes and previous IREE PRs that enable targeting native Tensor Core F16 support.

A few LLVM/MLIR upstream patches:

Previous IREE PRs:

@manishucsd
manishucsd force-pushed the unrolling_mma_ops_jan_1 branch 2 times, most recently from c6b091b to 5c298bd Compare January 12, 2023 20:05
@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

Drive by: Please add some description (people do see and appreciate PR hygeine)

@manishucsd
manishucsd force-pushed the unrolling_mma_ops_jan_1 branch 4 times, most recently from 65f4742 to 028a137 Compare January 12, 2023 23:19
@manishucsd

Copy link
Copy Markdown
Contributor Author

Drive by: Please add some description (people do see and appreciate PR hygeine)

Thank you for bringing this to my attention. I was hoping to start this PR and start CI pipelines, clean it, and add the description as I finalize the PR by fixing build issues and incorporating review comments. Not fully ready to merge yet, but added the description. I will add the description as the first thing from the next time :).

@manishucsd
manishucsd force-pushed the unrolling_mma_ops_jan_1 branch 6 times, most recently from 576a7d2 to 57d7211 Compare January 18, 2023 07:04

@ThomasRaoux ThomasRaoux left a comment

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.

Looks good!

@manishucsd

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look at this PR. We are waiting for iree llvm-integrate to include the latest upstream NGPU Bazel layering patch. Once the llvm-integrate has the Bazel patch, @manishucsd will rebase and merge this PR.

@manishucsd
manishucsd force-pushed the unrolling_mma_ops_jan_1 branch from f2e0559 to 6ae2f7f Compare January 21, 2023 01:29
@manishucsd
manishucsd merged commit 2231682 into iree-org:main Jan 23, 2023
qedawkins pushed a commit to qedawkins/iree that referenced this pull request Apr 2, 2023
…atrix] (iree-org#11817)

Adds native Tensor Core (F16) support for NVIDIA GPUs. Specifically,
adds support to target
`mma.sync.aligned.m16n8k16.row.col.f16.f16.f16.f16` and `ldmatrix`
instructions on NVIDIA A100 GPUs. For now, these instructions are not
enabled by default and requires using
(`--iree-codegen-llvmgpu-use-mma-sync=true`).

IREE runs row-row matmul and the native Tensor Core support requires
`ldmatrix` for operandA and `ldmatrix.trans` for operandB.
`ldmatrix.trans` transposes the data while loading to use Tensor Core
`mma*row.col*` instruction.

There are LLVM/MLIR upstream pathes and previous IREE PRs that enable
targeting native Tensor Core F16 support.

A few LLVM/MLIR upstream patches:
- [[mlir][NVGPU] Adding Support for cp_async_zfill via Inline
Asm](https://reviews.llvm.org/D132269)
- [[mlir][NVGPU] Handle Native mma.sync sizes and ldmatrix(x4) for
matrixB](https://reviews.llvm.org/D135749)
- [[mlir][NVGPU] Fix affine maps computing indices for LdMatrixOp
srcMemref](https://reviews.llvm.org/D138978)
- [[mlir][NVGPU] Fix NVGPU Bazel
Layering](https://reviews.llvm.org/D141982)


Previous IREE PRs:
- [Support GEMM Pipelining *without* Epilogue
Peeling](iree-org#10388)
- [Add support for GEMM e2e Test For CUDA backend on F16
input](iree-org#10842)
jpienaar pushed a commit that referenced this pull request May 1, 2023
…atrix] (#11817)

Adds native Tensor Core (F16) support for NVIDIA GPUs. Specifically,
adds support to target
`mma.sync.aligned.m16n8k16.row.col.f16.f16.f16.f16` and `ldmatrix`
instructions on NVIDIA A100 GPUs. For now, these instructions are not
enabled by default and requires using
(`--iree-codegen-llvmgpu-use-mma-sync=true`).

IREE runs row-row matmul and the native Tensor Core support requires
`ldmatrix` for operandA and `ldmatrix.trans` for operandB.
`ldmatrix.trans` transposes the data while loading to use Tensor Core
`mma*row.col*` instruction.

There are LLVM/MLIR upstream pathes and previous IREE PRs that enable
targeting native Tensor Core F16 support.

A few LLVM/MLIR upstream patches:
- [[mlir][NVGPU] Adding Support for cp_async_zfill via Inline
Asm](https://reviews.llvm.org/D132269)
- [[mlir][NVGPU] Handle Native mma.sync sizes and ldmatrix(x4) for
matrixB](https://reviews.llvm.org/D135749)
- [[mlir][NVGPU] Fix affine maps computing indices for LdMatrixOp
srcMemref](https://reviews.llvm.org/D138978)
- [[mlir][NVGPU] Fix NVGPU Bazel
Layering](https://reviews.llvm.org/D141982)


Previous IREE PRs:
- [Support GEMM Pipelining *without* Epilogue
Peeling](#10388)
- [Add support for GEMM e2e Test For CUDA backend on F16
input](#10842)
rengolin pushed a commit to plaidml/iree that referenced this pull request May 2, 2023
…atrix] (iree-org#11817)

Adds native Tensor Core (F16) support for NVIDIA GPUs. Specifically,
adds support to target
`mma.sync.aligned.m16n8k16.row.col.f16.f16.f16.f16` and `ldmatrix`
instructions on NVIDIA A100 GPUs. For now, these instructions are not
enabled by default and requires using
(`--iree-codegen-llvmgpu-use-mma-sync=true`).

IREE runs row-row matmul and the native Tensor Core support requires
`ldmatrix` for operandA and `ldmatrix.trans` for operandB.
`ldmatrix.trans` transposes the data while loading to use Tensor Core
`mma*row.col*` instruction.

There are LLVM/MLIR upstream pathes and previous IREE PRs that enable
targeting native Tensor Core F16 support.

A few LLVM/MLIR upstream patches:
- [[mlir][NVGPU] Adding Support for cp_async_zfill via Inline
Asm](https://reviews.llvm.org/D132269)
- [[mlir][NVGPU] Handle Native mma.sync sizes and ldmatrix(x4) for
matrixB](https://reviews.llvm.org/D135749)
- [[mlir][NVGPU] Fix affine maps computing indices for LdMatrixOp
srcMemref](https://reviews.llvm.org/D138978)
- [[mlir][NVGPU] Fix NVGPU Bazel
Layering](https://reviews.llvm.org/D141982)


Previous IREE PRs:
- [Support GEMM Pipelining *without* Epilogue
Peeling](iree-org#10388)
- [Add support for GEMM e2e Test For CUDA backend on F16
input](iree-org#10842)
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