cbalint13 commented on code in PR #16513:
URL: https://github.com/apache/tvm/pull/16513#discussion_r1483200887
##########
src/target/parsers/cpu.cc:
##########
@@ -28,7 +28,24 @@ namespace target {
namespace parsers {
namespace cpu {
+Optional<String> DetectSystemTriple() {
+ auto pf = tvm::runtime::Registry::Get("target.llvm_get_system_triple");
+ if (pf->defined()) {
+ return (*pf)();
+ }
+ return {};
+}
+
TargetJSON ParseTarget(TargetJSON target) {
+ String kind = Downcast<String>(target.Get("kind"));
+ Optional<String> mtriple = Downcast<Optional<String>>(target.Get("mtriple"));
+ Optional<String> mcpu = Downcast<Optional<String>>(target.Get("mcpu"));
+
+ // Try to fill in the blanks by detecting target information from the system
+ if (kind == "llvm" && !mtriple.defined() && !mcpu.defined()) {
+ target.Set("mtriple", DetectSystemTriple().value_or(""));
+ }
Review Comment:
Uh oh, yes.
Well this is it, the best is to put this at the creation of host/target
(runs once), globally for all CPU targets.
I will try take a little time to add it there in a separate PR, for now this
can be removed from here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]