Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions include/tvm/meta_schedule/postproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ class Postproc : public runtime::ObjectRef {
TVM_DLL static Array<Postproc, void> DefaultLLVM();
/*! \brief Create default postprocessors for x86 (AVX512 and VNNI) */
TVM_DLL static Array<Postproc, void> DefaultCPUTensorization();
/*! \brief Create default postprocessors for RISCV */
TVM_DLL static Array<Postproc, void> DefaultRISCV();
/*! \brief Create default postprocessors for CUDA */
TVM_DLL static Array<Postproc, void> DefaultCUDA();
/*! \brief Create default postprocessors for CUDA with TensorCore */
Expand Down
2 changes: 2 additions & 0 deletions include/tvm/meta_schedule/schedule_rule.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ class ScheduleRule : public runtime::ObjectRef {
TVM_DLL static Array<ScheduleRule, void> DefaultHexagon();
/*! \brief Create default schedule rules for ARM CPU (NEON and DOTPROD) */
TVM_DLL static Array<ScheduleRule, void> DefaultARM(const String& type);
/*! \brief Create default schedule rules for RISCV CPU (RVV) */
TVM_DLL static Array<ScheduleRule, void> DefaultRISCV(int vlen);

TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS(ScheduleRule, ObjectRef, ScheduleRuleNode);
};
Expand Down
8 changes: 8 additions & 0 deletions python/tvm/meta_schedule/tune_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from tvm.runtime import Object
from tvm.target import Target
from tvm.tir import PrimFunc, Schedule
from tvm.target.codegen import target_has_features

from . import _ffi_api
from .logging import Logger, get_logger, get_logging_func
Expand Down Expand Up @@ -117,6 +118,13 @@ def __init__(
if target is not None:
if not isinstance(target, Target):
target = Target(target)
if "riscv_cpu" in target.keys:
if target_has_features("v", target):
# Because the RVV intrinsics depend on the target, we register them here
# pylint: disable=import-outside-toplevel
from tvm.tir.tensor_intrin.riscv_cpu import register_riscv_tensor_intrinsics

register_riscv_tensor_intrinsics(target)
if space_generator is not None:
if not isinstance(space_generator, SpaceGenerator):
space_generator = SpaceGenerator.create(space_generator)
Expand Down
8 changes: 8 additions & 0 deletions python/tvm/target/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,14 @@ def riscv_cpu(model="sifive-u54", options=None):
"-mabi=lp64d",
# cc: riscv64-unknown-linux-gnu-g++ -march=rv64gc -mabi=lp64d -mcpu=sifive-u74
],
"bpi-f3": [
"-mtriple=riscv64-unknown-linux-gnu",
"-mcpu=generic",
"-mfloat-abi=hard",
"-num-cores=8",
"-mabi=lp64d",
"-mattr=+v,+zvl256b",
],
}
pre_defined_opt = trans_table.get(model, ["-model=%s" % model])

Expand Down
2 changes: 1 addition & 1 deletion python/tvm/tir/tensor_intrin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
from . import cuda

if enabled("llvm"):
from . import arm_cpu, x86, rocm, hexagon
from . import arm_cpu, x86, rocm, hexagon, riscv_cpu
Loading
Loading