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


##########
.agents/scripts/monitor_gpu.sh:
##########
@@ -23,7 +38,7 @@ while [[ $# -gt 0 ]]; do
     --interval) INTERVAL="$2"; shift 2 ;;
     --log) LOG="$2"; shift 2 ;;
     -h|--help)
-      sed -n '2,12p' "$0" | sed 's/^# \{0,1\}//'
+      sed -n '18,27p' "$0" | sed 's/^# \{0,1\}//'

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Hardcoding line numbers in `sed` to print the help message is fragile and 
will break if any lines (such as license headers or comments) are added, 
removed, or modified at the top of the file. Using a standard heredoc is much 
more robust and maintainable.
   
   ```suggestion
         cat <<'EOF'
   Watch a single GPU for foreign processes appearing during a long-running
   test. This is intended as a companion to the tir-test skill.
   
   Usage:
     monitor_gpu.sh                       # uses $CUDA_VISIBLE_DEVICES, 
defaults to 0
     monitor_gpu.sh --gpu 3               # watch GPU 3
     monitor_gpu.sh --gpu 3 --interval 2  # poll every 2 seconds
     monitor_gpu.sh --log /tmp/gpu.log    # also tee to a log file
   EOF
   ```



##########
AGENTS.md:
##########
@@ -0,0 +1,100 @@
+<!--
+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.
+-->
+
+# AGENTS.md
+
+This file provides vendor-neutral guidance for agentic coding tools working
+with Apache TVM. Tool-specific workflows should live under `.agents/skills/`
+instead of vendor-specific command directories.
+
+## Repository Overview
+
+Apache TVM is an open-source machine learning compiler stack. The repository
+contains the C++ compiler/runtime, Python bindings, TIR/Relax IRs, scheduling
+and lowering passes, target code generators, runtime integrations, tests,
+documentation, and application examples.
+
+## Repository Structure
+
+- `include/tvm/` - public C++ headers
+- `src/` - C++ implementation
+- `python/tvm/` - Python package
+- `tests/` - C++, Python, integration, and lint tests
+- `cmake/` - CMake modules and default configuration
+- `3rdparty/` - vendored dependencies and submodules
+- `docs/` - documentation source
+- `apps/` - application examples
+- `.agents/skills/` - reusable agent workflows for this repository
+
+## Build
+
+Use an existing `build/` directory when present:
+
+```bash
+cmake --build build -j$(nproc)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `nproc` is not portable to macOS, where `nproc` is not available by 
default. A more portable and modern way to build in parallel using all 
available cores is to use `cmake --build build --parallel` (or `cmake --build 
build -j`), which is supported by CMake 3.12+ and works seamlessly across 
Linux, macOS, and Windows.
   
   ```suggestion
   cmake --build build --parallel
   ```



##########
.agents/skills/tir-build/SKILL.md:
##########
@@ -0,0 +1,49 @@
+---
+name: tir-build
+description: Build TVM from the current worktree
+---
+
+<!--
+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.
+-->
+
+# TIR Build
+
+Use this skill when a task needs a local TVM build from the current worktree.
+
+## Steps
+
+1. Check whether `build/` already exists.
+
+2. If `build/` exists, run an incremental build:
+
+   ```bash
+   cmake --build build -j$(nproc)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `nproc` is not portable to macOS. Use `cmake --build build --parallel` 
for a portable parallel build across Linux, macOS, and Windows.
   
   ```suggestion
      cmake --build build --parallel
   ```



##########
AGENTS.md:
##########
@@ -0,0 +1,100 @@
+<!--
+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.
+-->
+
+# AGENTS.md
+
+This file provides vendor-neutral guidance for agentic coding tools working
+with Apache TVM. Tool-specific workflows should live under `.agents/skills/`
+instead of vendor-specific command directories.
+
+## Repository Overview
+
+Apache TVM is an open-source machine learning compiler stack. The repository
+contains the C++ compiler/runtime, Python bindings, TIR/Relax IRs, scheduling
+and lowering passes, target code generators, runtime integrations, tests,
+documentation, and application examples.
+
+## Repository Structure
+
+- `include/tvm/` - public C++ headers
+- `src/` - C++ implementation
+- `python/tvm/` - Python package
+- `tests/` - C++, Python, integration, and lint tests
+- `cmake/` - CMake modules and default configuration
+- `3rdparty/` - vendored dependencies and submodules
+- `docs/` - documentation source
+- `apps/` - application examples
+- `.agents/skills/` - reusable agent workflows for this repository
+
+## Build
+
+Use an existing `build/` directory when present:
+
+```bash
+cmake --build build -j$(nproc)
+```
+
+For a fresh checkout, initialize submodules and configure CMake first:
+
+```bash
+git submodule update --init --recursive
+mkdir -p build
+cp cmake/config.cmake build/config.cmake
+cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
+cmake --build build -j$(nproc)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `nproc` is not portable to macOS. Use `cmake --build build --parallel` 
for a portable parallel build across Linux, macOS, and Windows.
   
   ```suggestion
   cmake --build build --parallel
   ```



##########
.agents/skills/tir-build/SKILL.md:
##########
@@ -0,0 +1,49 @@
+---
+name: tir-build
+description: Build TVM from the current worktree
+---
+
+<!--
+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.
+-->
+
+# TIR Build
+
+Use this skill when a task needs a local TVM build from the current worktree.
+
+## Steps
+
+1. Check whether `build/` already exists.
+
+2. If `build/` exists, run an incremental build:
+
+   ```bash
+   cmake --build build -j$(nproc)
+   ```
+
+3. If `build/` does not exist, initialize and configure first:
+
+   ```bash
+   git submodule update --init --recursive
+   mkdir -p build
+   cp cmake/config.cmake build/config.cmake
+   cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
+   cmake --build build -j$(nproc)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `nproc` is not portable to macOS. Use `cmake --build build --parallel` 
for a portable parallel build across Linux, macOS, and Windows.
   
   ```suggestion
      cmake --build build --parallel
   ```



##########
.agents/skills/tir-test/SKILL.md:
##########
@@ -0,0 +1,80 @@
+---
+name: tir-test
+description: Run the TIRX test suite with GPU isolation checks
+---
+
+<!--
+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.
+-->
+
+# TIR Test
+
+Use this skill when a task needs the full TIRX test suite.
+
+## Steps
+
+1. Select the least busy GPU:
+
+   ```bash
+   export CUDA_VISIBLE_DEVICES=$(nvidia-smi --query-gpu=index,memory.used 
--format=csv,noheader,nounits | sort -t',' -k2 -n | head -1 | cut -d',' -f1 | 
tr -d ' ')
+   ```
+
+2. Start the GPU monitor in the background so foreign GPU usage can be
+   detected during the run:
+
+   ```bash
+   GPU_LOG="/tmp/tir_test_gpu_${CUDA_VISIBLE_DEVICES}.log"
+   bash .agents/scripts/monitor_gpu.sh --gpu "$CUDA_VISIBLE_DEVICES" 
--interval 5 --log "$GPU_LOG" &
+   MON_PID=$!
+   trap 'kill $MON_PID 2>/dev/null' EXIT
+   ```
+
+3. Run the full test suite:
+
+   ```bash
+   pytest tests/python/tirx/ -n 16

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Hardcoding `-n 16` for `pytest-xdist` can cause resource contention on 
smaller machines (such as CI runners or local laptops) or underutilize larger 
machines. Using `-n auto` is a more robust and portable best practice that 
automatically scales to the number of available CPU cores.
   
   ```suggestion
      pytest tests/python/tirx/ -n auto
   ```



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