You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "tlopex (via GitHub)" <gi...@apache.org> on 2026/06/17 19:55:50 UTC

[PR] [Relax][Frontend][NN] Fix SourceModule include resolution for installed wheels [tvm]

tlopex opened a new pull request, #19822:
URL: https://github.com/apache/tvm/pull/19822

   `SourceModule.get_includes()` hardcoded `tvm_home()/3rdparty/tvm-ffi/...` paths that only exist in a source checkout. In a wheel the tvm-ffi/DLPack headers ship in the separate `tvm_ffi` package, so the existence assert failed and `nn.SourceModule` could not compile extern sources.
   
   This pr resolves includes via libinfo (`libinfo.find_include_path()`, `tvm_ffi.libinfo.find_include_path()`, `find_dlpack_include_path()`), matching `runtime/module.py` and `rpc/minrpc.py`.


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] [Relax][Frontend][NN] Fix SourceModule include resolution for installed wheels [tvm]

Posted by "tlopex (via GitHub)" <gi...@apache.org>.
tlopex commented on PR #19822:
URL: https://github.com/apache/tvm/pull/19822#issuecomment-4735672296

   @tvm-bot rerun


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] [Relax][Frontend][NN] Fix SourceModule include resolution for installed wheels [tvm]

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen merged PR #19822:
URL: https://github.com/apache/tvm/pull/19822


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] [Relax][Frontend][NN] Fix SourceModule include resolution for installed wheels [tvm]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #19822:
URL: https://github.com/apache/tvm/pull/19822#discussion_r3431063548


##########
python/tvm/relax/frontend/nn/extern.py:
##########
@@ -306,13 +308,13 @@ def get_includes(tvm_pkg: list[str] | None = None) -> list[Path]:
         includes : List[pathlib.Path]
             The list of include paths.
         """
-        tvm_home = SourceModule.tvm_home()
         results = [
-            tvm_home / "include",
-            tvm_home / "3rdparty/tvm-ffi/include",
-            tvm_home / "3rdparty/tvm-ffi/3rdparty/dlpack/include",
+            Path(libinfo.find_include_path()),
+            Path(tvm_ffi.libinfo.find_include_path()),
+            Path(tvm_ffi.libinfo.find_dlpack_include_path()),
         ]
         if tvm_pkg:
+            tvm_home = SourceModule.tvm_home()
             for relative in tvm_pkg:
                 results.append(tvm_home / "3rdparty" / relative)
         for path in results:

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The include paths resolved from `libinfo` and `tvm_ffi.libinfo` can sometimes overlap or be identical depending on the environment setup (e.g., in monolithic or developer builds). To prevent redundant compiler `-I` flags and duplicate assertion checks, we should deduplicate the list of paths while preserving their search order. Using `dict.fromkeys` is an efficient and order-preserving way to achieve this in Python 3.7+.
   
   ```suggestion
           results = [
               Path(libinfo.find_include_path()),
               Path(tvm_ffi.libinfo.find_include_path()),
               Path(tvm_ffi.libinfo.find_dlpack_include_path()),
           ]
           if tvm_pkg:
               tvm_home = SourceModule.tvm_home()
               for relative in tvm_pkg:
                   results.append(tvm_home / "3rdparty" / relative)
           results = list(dict.fromkeys(results))
           for path in results:
   ```



-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org