Page MenuHomePhabricator

[mlir] make the bitwidth of device side index computations configurable
ClosedPublic

Authored by gysit on Wed, Jun 24, 9:10 AM.

Details

Summary

The patch makes the index type lowering of the GPU to NVVM/ROCDL conversion configurable. It introduces a pass option that controls the bitwidth used when lowering index computations and uses the LowerToLLVMOptions structure to control the Standard to LLVM lowering.

This patch fixes a use-after-free bug in the reverted patch (https://reviews.llvm.org/D80285). It implements the following changes:

  • Added a getDefaultOptions method to the LowerToLLVMOptions struct that returns a reference to statically allocated default options.
  • Use the getDefaultOptions method to provide default LowerToLLVMOptions (instead of an initializer list).
  • Added comments to clarify the required lifetime of the LowerToLLVMOptions (ConvertStandardToLLVM.h:378 and ConvertStandardToLLVMPass.h:65)

Diff Detail

Event Timeline

gysit created this revision.Wed, Jun 24, 9:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptWed, Jun 24, 9:10 AM
ftynse accepted this revision.Fri, Jun 26, 6:54 AM
ftynse added inline comments.
mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
36

thread_local ?

mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
111

Nit: be consistent with spaces after */

mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
127

Please comply with clang-tidy (drop trailing underscore)

This revision is now accepted and ready to land.Fri, Jun 26, 6:54 AM
gysit updated this revision to Diff 273734.Fri, Jun 26, 7:45 AM

Adressed Alex's comments:

  • make default configuration thread_local
  • fixed clang tidy issues
  • removed unnecessary spaces
gysit marked 3 inline comments as done.Fri, Jun 26, 7:46 AM
rriddle added inline comments.Fri, Jun 26, 12:05 PM
mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
36

These don't need to be thread_local, static initialization is already thread safe.

gysit updated this revision to Diff 273888.Sat, Jun 27, 1:31 AM
  • revert to using static instead of thread_local
  • removed more inconsistent spaces
gysit marked an inline comment as done.Sat, Jun 27, 1:32 AM
This revision was automatically updated to reflect the committed changes.