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
5 changes: 4 additions & 1 deletion python/tvm/relax/backend/cpu_generic/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

def library_dispatch_passes(target: tvm.target.Target): # pylint: disable=unused-argument
"""The default library dispatch passes for CPU backend."""
return []
return [
relax.backend.DispatchSampling(),
relax.backend.DispatchSortScan(),
]


def legalize_passes(target: tvm.target.Target): # pylint: disable=unused-argument
Expand Down
16 changes: 15 additions & 1 deletion python/tvm/relax/vm_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,21 @@ def _extract_attrs(mod: tvm.IRModule):

if relax_pipeline is not None:
if isinstance(relax_pipeline, str):
relax_pipeline = relax.get_pipeline(relax_pipeline)
# For GPU targets, prefer the target-specific pipeline which
# includes DLight scheduling. Without it, TIR functions generated
# from ops like Clip/ReLU6 lack thread bindings and fail
# VerifyMemory. CPU targets continue to use the generic pipeline
# since the CPU-specific pipeline applies fusion passes that can
# incorrectly remove call_pure_packed calls whose results are
# unused but whose side effects are relied upon.
_is_gpu = target is not None and "gpu" in target.keys
if relax_pipeline == "default" and _is_gpu:
try:
relax_pipeline = relax.get_default_pipeline(target)
except (ValueError, AttributeError):
relax_pipeline = relax.get_pipeline(relax_pipeline)
else:
relax_pipeline = relax.get_pipeline(relax_pipeline)
if target is None:
mod = relax_pipeline(mod)
else:
Expand Down
Loading