Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/arith/const_int_bound.cc
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,9 @@ class ConstIntBoundAnalyzer::Impl
} else if (op->op.same_as(tir::builtin::bitwise_and())) {
return VisitBitwiseAnd(op);
} else if (op->op.same_as(tir::builtin::vscale()) && TargetHasSVE()) {
return MakeBound(1, kAArch64VScaleValues.size());
unsigned int max_val =
*std::max_element(kAArch64VScaleValues.begin(), kAArch64VScaleValues.end());
return MakeBound(1, max_val);
} else {
return Everything(op->dtype);
}
Expand Down
3 changes: 1 addition & 2 deletions src/arith/scalable_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ namespace tvm {
namespace arith {

/*! \brief A list of known vscale values to try for an AArch64 SVE target. */
static const std::vector<unsigned int> kAArch64VScaleValues = {1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16};
static const std::vector<unsigned int> kAArch64VScaleValues = {1, 2, 4, 8, 16};

/*!
* \brief Check if an expr is a call to the vscale intrinsic.
Expand Down
6 changes: 4 additions & 2 deletions src/target/llvm/codegen_aarch64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ void CodeGenAArch64::SetTargetAttributes(llvm::Function* func) {
#if TVM_LLVM_VERSION >= 130
// Add vscale_range() function attribute when appropriate.
if (llvm_target_->TargetHasCPUFeature("sve") || llvm_target_->TargetHasCPUFeature("sme")) {
func->addFnAttr(llvm::Attribute::getWithVScaleRangeArgs(
*llvm_target_->GetContext(), 1, tvm::arith::kAArch64VScaleValues.size()));
unsigned int max_val =
*std::max_element(arith::kAArch64VScaleValues.begin(), arith::kAArch64VScaleValues.end());
func->addFnAttr(
llvm::Attribute::getWithVScaleRangeArgs(*llvm_target_->GetContext(), 1, max_val));
}
#endif
CodeGenCPU::SetTargetAttributes(func);
Expand Down