tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[Target] Automatically detect system triple when not specified by the user

Open lhutton1 opened this issue 1 year ago • 1 comments

Currently, when a default compile target such as llvm is specified, it implies llvm -keys=cpu which tends to imply x86 related components being used during compilation e.g. the schedules registered in TOPI. This can be confusing for a user when compiling on other architectures, especially when other tools such as llc infer the default target based on the host.

When the target kind is llvm, this commit uses the "target.llvm_get_system_triple" functionality to automatically detect mtriple when one has not been provided in the target string. The target will be updated to one that uses the mtriple of the host: llvm -> llvm -mtriple=<system-triple>. When compiling on Arm(R)-based targets, this has the added benefit of automatically introducing -keys=arm_cpu to the target improving the schedule selection.

Lots of tests are currently using targets such as llvm or similar which has resulted in a lack of coverage of other targets such as arm_cpu. As part of this commit, failing test cases which have simple / obvious issues have been fixed. Others that likely need more thought have been skipped. In doing so, it reduces the number of modifications and simplifies the review for this change.

Note: ~This PR is marked as draft while checking and fixing other failures in CI. Tests marked as skipped containing "issue link" in the reason will have issues added and the related reason will be updated when CI is green.~

This commit is a follow up of the changes made in: #14981

Co-authored-by: Jack Frankland [email protected]

lhutton1 avatar Feb 02 '24 17:02 lhutton1

cc @ekalda @neildhickey @cbalint13 @kparzysz-quic would be good to hear your thoughts before I proceed with creating the issues for the failing tests (due to test coverage in CI increasing).

lhutton1 avatar Feb 06 '24 09:02 lhutton1

@tvm-bot rerun

ekalda avatar Mar 13 '24 15:03 ekalda

Thanks @lhutton1 @FranklandJack @cbalint13!

ekalda avatar Mar 14 '24 09:03 ekalda