IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Python function

set_virtual_cpu_target

set_virtual_cpu_target()

max.driver.set_virtual_cpu_target(cpu: str) → None

source

Sets the CPU target for host-independent kernel codegen.

When set before any CPU kernel compilation (e.g. before importing max._interpreter_ops), CPU kernels compile for this fixed target instead of the build host’s CPU, so the kernel cache can ship to and be reused on a different host. Mirrors set_virtual_device_target_arch() for GPUs.

Parameters:

cpu (str) – An LLVM target-CPU name (e.g. “x86-64-v3”, “neoverse-n1”), or “generic” for the most-portable baseline of the host arch family (“x86-64” on x86_64, the armv8-a baseline on AArch64; other families raise an error). Empty string restores host-CPU codegen. “native” is rejected because it would re-leak the build host’s CPU.