This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Improve code size cost model (part 2)
ClosedPublic

Authored by dfukalov on Oct 30 2019, 10:26 AM.

Details

Summary

Added estimations for ShuffleVector, some cast and arithmetic instructions

Diff Detail

Event Timeline

dfukalov created this revision.Oct 30 2019, 10:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 30 2019, 10:26 AM
arsenm added inline comments.Oct 30 2019, 10:35 AM
llvm/include/llvm/CodeGen/BasicTTIImpl.h
668 ↗(On Diff #227138)

This seems to now be duplicated in two different places now? Except the other version uses int and is const?

dfukalov updated this revision to Diff 227882.EditedNov 5 2019, 8:08 AM

Address comment

This revision is now accepted and ready to land.Nov 5 2019, 10:14 AM
This revision was automatically updated to reflect the committed changes.
foad added a subscriber: foad.Nov 6 2019, 5:35 AM

@dfukalov this is breaking some of our internal tests. Here's an example:

define amdgpu_kernel void @shufflevector_xxx(<4 x i8> addrspace(1)* %out, <2 x i8> addrspace(1)* %vaddr) {
  %vec = load <2 x i8>, <2 x i8> addrspace(1)* %vaddr
  %shuf = shufflevector <2 x i8> %vec, <2 x i8> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
  store <4 x i8> %shuf, <4 x i8> addrspace(1)* %out
  ret void
}

I get:

opt: /home/jayfoad2/git/llvm-project/llvm/lib/Analysis/TargetTransformInfo.cpp:206: int llvm::TargetTransformInfo::getUserCost(const llvm::User *, ArrayRef<const llvm::Value *>) const: Assertion `Cost >= 0 && "TTI should not produce negative costs!"' failed.

Can you take a look please?

@foad thanks for report!
fixed in 6e8251046b96