diff --git a/src/arith/scalable_expression.cc b/src/arith/scalable_expression.cc index 5e3a65438db2..beb75c1f3e09 100644 --- a/src/arith/scalable_expression.cc +++ b/src/arith/scalable_expression.cc @@ -86,12 +86,14 @@ bool CanProveVscaleExpressionFromKnownValues(arith::Analyzer* analyzer, const Pr return can_prove_expr; } -bool TargetHasSVE(Target current_target) { - bool has_sve{false}; - if (current_target.defined()) { - has_sve = current_target->GetFeature("has_sve").value_or(Bool(false)); +bool TargetHasSVE(Optional target) { + if (!target.defined()) { + target = Target::Current(); } - return has_sve; + if (target.defined()) { + return Downcast(target)->GetFeature("has_sve").value_or(Bool(false)); + } + return false; } } // namespace arith diff --git a/src/arith/scalable_expression.h b/src/arith/scalable_expression.h index 06ff8104e928..d31e81fffc97 100644 --- a/src/arith/scalable_expression.h +++ b/src/arith/scalable_expression.h @@ -83,7 +83,7 @@ bool CanProveVscaleExpressionFromKnownValues(arith::Analyzer* analyzer, const Pr * \param target The target to check. * \return Whether SVE is supported */ -bool TargetHasSVE(Target target); +bool TargetHasSVE(Optional target = NullOpt); } // namespace arith } // namespace tvm