This is an archive of the discontinued LLVM Phabricator instance.

[RISCV]Add basic cost model for vector reduce for scalable vector
AbandonedPublic

Authored by liaolucy on May 25 2022, 5:36 AM.

Details

Summary

Fix crash. LLVM ERROR: Invalid size request on a scalable vector, which causing the crash on CodeMetrics:analyzeBasicBlock.

The cost model just reference D93639.

Diff Detail

Event Timeline

liaolucy created this revision.May 25 2022, 5:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 5:36 AM
liaolucy requested review of this revision.May 25 2022, 5:36 AM
liaolucy edited the summary of this revision. (Show Details)May 25 2022, 5:38 AM

Can we test some illegal type here (e.g. vscale x 16 x i64). The patch includes logic for that so it may be worth having it.

llvm/test/Analysis/CostModel/RISCV/scalable-reduce.ll
64

This doesn't seem very realistic (I assume these reductions must be done linearly) but I guess the cost here is measuring number of instructions required rather than latency, right?

liaolucy updated this revision to Diff 432488.May 27 2022, 1:37 AM
  1. Add a illegal checks. Invalid types will crash.
if(!isTypeLegal(VTy))
  return BaseT::getArithmeticReductionCost(Opcode, VTy, FMF, CostKind);
  1. Remove deadcode.
llvm/test/Analysis/CostModel/RISCV/scalable-reduce.ll
64

This doesn't seem very realistic (I assume these reductions must be done linearly) but I guess the cost here is measuring number of instructions required rather than latency, right?

Yes, I don't know where to find the latency information of instructions, just count instructions (are not accurate).

liaolucy abandoned this revision.Aug 30 2022, 7:27 PM