Warn when --iree-llvmcpu-target-cpu
defaults to "generic".
#18587
+59
−42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Progress on #18561.
We have these high level flags (and MLIR attributes) controlling what code the llvm-cpu compiler target generates using LLVM:
--iree-llvmcpu-target-triple
x86_64-pc-windows-msvc
--iree-llvmcpu-target-cpu
znver2
--iree-llvmcpu-target-cpu-features
+prfchw,-cldemote,+avx,+aes,+sahf,+pclmul,-xop,...
Some targets (x86 and riscv64) in LLVM can infer the "features" for a given "cpu" with the
getFeaturesForCPU()
functions. Other targets may be able to look up available features on the host viallvm::sys::getHostCPUFeatures()
. Short of either of those, we must fall back to having users explicitly list the features they want the compiler to use.If the target CPU and target CPU features are both omitted, we currently fall back to "generic", meaning no "features". This PR sends more warning information to stderr if that case is detected. We could go a step further and make the default case propagate an error through the compiler, requiring users to explicit set "host", "generic", a known cpu type, or a known list of features.
TODO
docs/website/docs/guides/deployment-configurations/cpu.md
)--iree-hal-target-backends=llvm-cpu
that is missing an explicit--iree-llvmcpu-target-cpu
or--iree-llvmcpu-target-cpu-features
Debugging tips while working on this:
--debug-only=iree-llvm-cpu-target
to see the computedLLVMTarget
get loggeddefaultOptions_
forgetDefaultExecutableTargets()
andgetVariantTarget
/loadFromConfigAttr
that may come from already constructed IR. We want error handling for all of them.