You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "sunggg (via GitHub)" <gi...@apache.org> on 2023/08/15 04:01:47 UTC
[GitHub] [tvm] sunggg opened a new pull request, #15556: [Unity][BYOC] CoreML Scaffolding
sunggg opened a new pull request, #15556:
URL: https://github.com/apache/tvm/pull/15556
This PR lands P4 of [CoreML tracker](https://github.com/apache/tvm/issues/15245).
Although it produces the right results, its CPU performance is currently quite worse than expected on my Macbook with Intel chips.
For more performance analysis on more recent Apple silicon, I'd like to land the functionality first and then iterate over to identify the performance issue as the next step (P5).
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] tqchen commented on pull request #15556: [Unity][BYOC] CoreML Scaffolding
Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on PR #15556:
URL: https://github.com/apache/tvm/pull/15556#issuecomment-1697875365
@vinx13 @yelite do you mind take a look at this pr
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] yelite commented on a diff in pull request #15556: [Unity][BYOC] CoreML Scaffolding
Posted by "yelite (via GitHub)" <gi...@apache.org>.
yelite commented on code in PR #15556:
URL: https://github.com/apache/tvm/pull/15556#discussion_r1310856356
##########
src/relax/transform/run_codegen.cc:
##########
@@ -86,14 +86,17 @@ class CodeGenRunner : ExprMutator {
};
if (auto it = extern_funcs_.find(gvar_node); it != extern_funcs_.end()) {
- return create_call_dps_packed(it->second.first, it->second.second);
+ auto call = create_call_dps_packed(it->second.first, it->second.second);
+ LOG(INFO) << call;
Review Comment:
Should changes in this file be reverted? Looks like it's just for visibility in debugging.
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Unity][BYOC] CoreML Scaffolding [tvm]
Posted by "vinx13 (via GitHub)" <gi...@apache.org>.
vinx13 merged PR #15556:
URL: https://github.com/apache/tvm/pull/15556
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] tvm-bot commented on pull request #15556: [Unity][BYOC] CoreML Scaffolding
Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #15556:
URL: https://github.com/apache/tvm/pull/15556#issuecomment-1678397230
<!---bot-comment-->
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
<!--bot-comment-ccs-start-->
* cc @billishyahao, @quic-sanirudh <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
<sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] sunggg commented on a diff in pull request #15556: [Unity][BYOC] CoreML Scaffolding
Posted by "sunggg (via GitHub)" <gi...@apache.org>.
sunggg commented on code in PR #15556:
URL: https://github.com/apache/tvm/pull/15556#discussion_r1294166327
##########
tests/python/relax/test_codegen_coreml.py:
##########
@@ -0,0 +1,315 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import numpy as np
+import pytest
+
+import tvm
+import tvm.testing
+from tvm import relax
+from tvm.relax.backend.contrib.coreml import partition_for_coreml
+
+requires_coremltools = tvm.testing.requires_package("coremltools")
+target, dev = "llvm", tvm.cpu()
+
+
+def _has_xcode():
+ try:
+ tvm.contrib.xcode.xcrun([])
+ return True
+ except FileNotFoundError:
+ pass
+
+ return False
+
+
+@pytest.mark.skipif(not _has_xcode(), reason="Xcode is not available")
+@tvm.testing.uses_gpu
+@requires_coremltools
+def verify(mod, inputs):
+ mod1 = partition_for_coreml(mod)
+ mod1 = relax.transform.RunCodegen()(mod1)
+ assert relax.analysis.well_formed(mod1)
+ assert mod1.attrs, "Should exist if offloaded successfully."
+ assert "external_mods" in mod1.attrs, "Should exist if offloaded successfully."
+ mod1 = relax.transform.LegalizeOps()(mod1)
+ assert relax.analysis.well_formed(mod1)
+
+ ex1 = relax.build(mod1, target=target)
+ vm1 = relax.VirtualMachine(ex1, dev, profile=True)
+ out1 = vm1["main"](*inputs)
+
+ mod2 = relax.transform.LegalizeOps()(mod)
+ ex2 = relax.build(mod2, target=target)
+ vm2 = relax.VirtualMachine(ex2, dev, profile=True)
+ out2 = vm2["main"](*inputs)
+
+ tvm.testing.assert_allclose(out1.numpy(), out2.numpy(), rtol=1e-3, atol=1e-3)
Review Comment:
Please note that current error margin is bit higher than our usual setting for CPU computations (`rtol=1e-7, atol=1e-7`), but lower than the one for GPU libraries (cutlass: `rtol=1e-2, atol=1e-2`)
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] sunggg commented on a diff in pull request #15556: [Unity][BYOC] CoreML Scaffolding
Posted by "sunggg (via GitHub)" <gi...@apache.org>.
sunggg commented on code in PR #15556:
URL: https://github.com/apache/tvm/pull/15556#discussion_r1325024121
##########
src/relax/transform/run_codegen.cc:
##########
@@ -86,14 +86,17 @@ class CodeGenRunner : ExprMutator {
};
if (auto it = extern_funcs_.find(gvar_node); it != extern_funcs_.end()) {
- return create_call_dps_packed(it->second.first, it->second.second);
+ auto call = create_call_dps_packed(it->second.first, it->second.second);
+ LOG(INFO) << call;
Review Comment:
Thank you for the catch! This is fixed.
--
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: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org