This is an archive of the discontinued LLVM Phabricator instance.

[TTI] Return a TypeSize from getRegisterBitWidth.
ClosedPublic

Authored by sdesmalen on Mar 18 2021, 9:38 AM.

Details

Summary

This patch changes the interface to take a RegisterKind, to indicate
whether the register bitwidth of a scalar register, fixed-width vector
register, or scalable vector register must be returned.

Diff Detail

Event Timeline

sdesmalen created this revision.Mar 18 2021, 9:38 AM
sdesmalen requested review of this revision.Mar 18 2021, 9:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2021, 9:38 AM
paulwalker-arm added inline comments.Mar 18 2021, 9:49 AM
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
111

I don't think you intended this change. getMinSVEVectorSizeInBits is used to enable larger fixed length vectors and so belongs with the request for RGK_FixedWidthVector.

Moved code using getMinSVEVectorSizeInBits to RGK_FixedWidthVector.

sdesmalen marked an inline comment as done.Mar 18 2021, 10:02 AM
paulwalker-arm accepted this revision.Mar 19 2021, 9:57 AM
paulwalker-arm added inline comments.
llvm/lib/Target/ARM/ARMTargetTransformInfo.h
157–158

Happy as is but do think the following looks nicer:

if (ST->hasNEON())
  return TypeSize::getFixed(128);
if (ST->hasMVEIntegerOps())
  return TypeSize::getFixed(128);
return TypeSize::getFixed(0);
This revision is now accepted and ready to land.Mar 19 2021, 9:57 AM
This revision was landed with ongoing or failed builds.Mar 24 2021, 7:45 AM
This revision was automatically updated to reflect the committed changes.
sdesmalen marked an inline comment as done.Mar 24 2021, 7:45 AM
gulfem added a subscriber: gulfem.Mar 24 2021, 9:53 AM

I think this commit caused an issue in one of the files in polly.
Please see the error message below:

[3469/3899] Building CXX object tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o
FAILED: tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o 
/b/s/w/ir/cache/goma/client/gomacc /b/s/w/ir/x/w/cipd/bin/clang++ --sysroot=/b/s/w/ir/x/w/cipd/linux -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/polly/lib -I/b/s/w/ir/x/w/llvm-project/polly/lib -Itools/polly/include -I/b/s/w/ir/x/w/llvm-project/polly/lib/External -I/b/s/w/ir/x/w/llvm-project/polly/lib/External/pet/include -I/b/s/w/ir/x/w/llvm-project/polly/lib/External/isl/include -Itools/polly/lib/External/isl/include -I/b/s/w/ir/x/w/llvm-project/polly/include -Iinclude -I/b/s/w/ir/x/w/llvm-project/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -ffile-prefix-map=/b/s/w/ir/x/w/staging/llvm_build=../staging/llvm_build -ffile-prefix-map=/b/s/w/ir/x/w/llvm-project/= -no-canonical-prefixes -fno-exceptions -fno-rtti -O3   -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -UNDEBUG -std=c++14 -MD -MT tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o -MF tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o.d -o tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o -c /b/s/w/ir/x/w/llvm-project/polly/lib/Transform/ScheduleOptimizer.cpp
/b/s/w/ir/x/w/llvm-project/polly/lib/Transform/ScheduleOptimizer.cpp:1220:49: error: cannot initialize a parameter of type 'llvm::TargetTransformInfo::RegisterKind' with an rvalue of type 'bool'
    RegisterBitwidth = TTI->getRegisterBitWidth(true);
                                                ^~~~
/b/s/w/ir/x/w/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h:926:45: note: passing argument to parameter 'K' here
  TypeSize getRegisterBitWidth(RegisterKind K) const;

I think this commit caused an issue in one of the files in polly.
Please see the error message below:

[3469/3899] Building CXX object tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o
FAILED: tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o 
/b/s/w/ir/cache/goma/client/gomacc /b/s/w/ir/x/w/cipd/bin/clang++ --sysroot=/b/s/w/ir/x/w/cipd/linux -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/polly/lib -I/b/s/w/ir/x/w/llvm-project/polly/lib -Itools/polly/include -I/b/s/w/ir/x/w/llvm-project/polly/lib/External -I/b/s/w/ir/x/w/llvm-project/polly/lib/External/pet/include -I/b/s/w/ir/x/w/llvm-project/polly/lib/External/isl/include -Itools/polly/lib/External/isl/include -I/b/s/w/ir/x/w/llvm-project/polly/include -Iinclude -I/b/s/w/ir/x/w/llvm-project/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -ffile-prefix-map=/b/s/w/ir/x/w/staging/llvm_build=../staging/llvm_build -ffile-prefix-map=/b/s/w/ir/x/w/llvm-project/= -no-canonical-prefixes -fno-exceptions -fno-rtti -O3   -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -UNDEBUG -std=c++14 -MD -MT tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o -MF tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o.d -o tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScheduleOptimizer.cpp.o -c /b/s/w/ir/x/w/llvm-project/polly/lib/Transform/ScheduleOptimizer.cpp
/b/s/w/ir/x/w/llvm-project/polly/lib/Transform/ScheduleOptimizer.cpp:1220:49: error: cannot initialize a parameter of type 'llvm::TargetTransformInfo::RegisterKind' with an rvalue of type 'bool'
    RegisterBitwidth = TTI->getRegisterBitWidth(true);
                                                ^~~~
/b/s/w/ir/x/w/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h:926:45: note: passing argument to parameter 'K' here
  TypeSize getRegisterBitWidth(RegisterKind K) const;

Thanks for pointing that out, I must have missed that one! I'll push a fix for it.