gemini-code-assist[bot] commented on code in PR #283:
URL: https://github.com/apache/tvm-ffi/pull/283#discussion_r2561778309


##########
python/tvm_ffi/cpp/extension.py:
##########
@@ -301,6 +316,19 @@ def _generate_ninja_build(  # noqa: PLR0915
         )
         ninja.append("")
 
+    # Add rules for object merging and cubin embedding (Unix only)
+    if not IS_WINDOWS:
+        if embed_cubin:
+            ninja.append("rule merge_objects")
+            ninja.append("  command = ld -r -o $out $in")
+            ninja.append("")
+
+            ninja.append("rule embed_cubin")
+            ninja.append(
+                "  command = python -m tvm_ffi.utils.embed_cubin --output-obj 
$out --input-obj $in --cubin $cubin --name $name"
+            )

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The `python` executable is hardcoded in the ninja build rule. This can lead 
to issues in environments with multiple Python installations or when using 
virtual environments, as it may not invoke the same interpreter that is running 
the build script. It's safer to use `sys.executable` to ensure the correct 
Python interpreter is used.
   
   ```suggestion
               ninja.append(
                   f"  command = {sys.executable} -m tvm_ffi.utils.embed_cubin 
--output-obj $out --input-obj $in --cubin $cubin --name $name"
               )
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to