cbalint13 commented on code in PR #16513:
URL: https://github.com/apache/tvm/pull/16513#discussion_r1479502313
##########
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:
One small nit, in this case would be nice to leave a message for the user
about facts:
* explicit mtriple and/or explict mcpu wasnt provided
* backend here detected an X mtriple and/or and Y mcpu
--
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]