Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
Change-Id: Ifc338ac65db118812affc782e08d32ca6a27516e
  • Loading branch information
jrbyrnes committed Jul 2, 2024
1 parent 6d60b39 commit c21160f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,21 @@ bool GCNTTIImpl::hasBranchDivergence(const Function *F) const {
return !F || !ST->isSingleLaneExecution(*F);
}

unsigned GCNTTIImpl::getNumberOfParts(Type *Tp) const {
unsigned GCNTTIImpl::getNumberOfParts(Type *Tp) {
// For certain 8 bit ops, we can pack a v4i8 into a single part
// (e.g. v4i8 shufflevectors -> v_perm v4i8, v4i8). Thus, we
// do not limit the numberOfParts for 8 bit vectors to the
// legalization costs of such. It is left up to other target
// queries (e.g. get*InstrCost) to decide the proper handling
// of 8 bit vectors.
if (FixedVectorType *VTy = dyn_cast<FixedVectorType>(Tp)) {
if (DL.getTypeSizeInBits(VTy->getElementType()) == 8) {
unsigned ElCount = VTy->getElementCount().getFixedValue();
return ElCount / 4;
}
}

std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Tp);
return LT.first.isValid() ? *LT.first.getValue() : 0;
return BaseT::getNumberOfParts(Tp);
}

unsigned GCNTTIImpl::getNumberOfRegisters(unsigned RCID) const {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
return TTI::PSK_FastHardware;
}

unsigned getNumberOfParts(Type *Tp) const;
unsigned getNumberOfParts(Type *Tp);
unsigned getNumberOfRegisters(unsigned RCID) const;
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind Vector) const;
unsigned getMinVectorRegisterBitWidth() const;
Expand Down

0 comments on commit c21160f

Please sign in to comment.