This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][GPU] Add 16-bit version of cudaMemset in cudaRuntimeWrappers
ClosedPublic

Authored by navdeepkk on May 28 2023, 11:25 PM.

Details

Summary

Add 16-bit version of cudaMemset in cudaRuntimeWrappers and update the GPU to LLVM lowering.

Diff Detail

Event Timeline

navdeepkk created this revision.May 28 2023, 11:25 PM
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
navdeepkk requested review of this revision.May 28 2023, 11:25 PM
bondhugula requested changes to this revision.May 29 2023, 12:17 AM
bondhugula added inline comments.
mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
203

Please add in sorted order. One place above.

1376–1380

This logic is wrong and would simply crash. Check if it's int or float first before getting the width.

This revision now requires changes to proceed.May 29 2023, 12:17 AM
navdeepkk updated this revision to Diff 526411.May 29 2023, 1:18 AM
navdeepkk marked 2 inline comments as done.

[MLIR][GPU] Add 16-bit version of cudaMemset in cudaRuntimeWrappers

Add 16-bit version of cudaMemset in cudaRuntimeWrappers and update the GPU to LLVM lowering.

bondhugula added inline comments.May 31 2023, 10:29 PM
mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
1377–1378

Nit: Avoid multiple calls to getIntOr...

bondhugula added inline comments.May 31 2023, 10:31 PM
mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
1396–1398

Use ternary operator for the builder ref: ...& builder = .... ? memset32.... : memset16...; to avoid duplication.

navdeepkk updated this revision to Diff 527772.Jun 2 2023, 1:15 AM
navdeepkk marked 2 inline comments as done.

Address comments.

bondhugula accepted this revision.Jun 3 2023, 1:18 AM
bondhugula added inline comments.
mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
1396–1398

This isn't what I meant -- this won't save anything in terms of duplication. Use the ternary operator to assign the right builder.

This revision is now accepted and ready to land.Jun 3 2023, 1:18 AM
navdeepkk updated this revision to Diff 528280.Jun 4 2023, 10:11 PM
navdeepkk marked an inline comment as done.

Resolve comments

bondhugula accepted this revision.Jun 4 2023, 11:38 PM