Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/setup_python.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# TVM_FFI_REF=v0.2.0 # Test a specific tag

# Uncomment to override TVM-FFI version:
# TVM_FFI_REF=
TVM_FFI_REF=v0.1.10-rc2

# Uncomment to override nvidia-cutlass-dsl version:
# CUTLASS_DSL_VERSION=
5 changes: 5 additions & 0 deletions scripts/task_jit_run_tests_part1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ if [ "$SKIP_INSTALL" = "0" ]; then
pip install -e . -v
fi

# Print TVM-FFI version just before running tests
echo "Checking TVM-FFI version before tests..."
python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
echo ""

Comment on lines +16 to +20
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify remaining non-fatal TVM-FFI diagnostics in CI scripts
rg -nP --type=sh 'import tvm_ffi;.*\|\|\s*true'

Repository: flashinfer-ai/flashinfer

Length of output: 595


🏁 Script executed:

cat -n scripts/task_jit_run_tests_part1.sh | head -50

Repository: flashinfer-ai/flashinfer

Length of output: 1102


🏁 Script executed:

rg -nP 'TVM_FFI_REF' --type=sh

Repository: flashinfer-ai/flashinfer

Length of output: 333


🏁 Script executed:

cat -n scripts/setup_test_env.sh | head -100

Repository: flashinfer-ai/flashinfer

Length of output: 1192


🏁 Script executed:

cat -n scripts/task_test_jit_cache_package_build_import.sh | sed -n '70,125p'

Repository: flashinfer-ai/flashinfer

Length of output: 2084


🏁 Script executed:

cat -n scripts/task_run_unit_tests.sh | sed -n '85,100p'

Repository: flashinfer-ai/flashinfer

Length of output: 693


Fail the TVM-FFI version check when dependency override is active.

The || true on line 18 suppresses import errors that should block the test when TVM_FFI_REF is set. Testing a custom dependency ref should fail fast if the override is broken, not silently continue.

Suggested fix
 # Print TVM-FFI version just before running tests
 echo "Checking TVM-FFI version before tests..."
-python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
+if [ -n "${TVM_FFI_REF:-}" ]; then
+  python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')"
+else
+  python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
+fi
 echo ""

Note: The same issue exists at scripts/task_test_jit_cache_package_build_import.sh:77,118 and scripts/task_run_unit_tests.sh:92.

πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Print TVM-FFI version just before running tests
echo "Checking TVM-FFI version before tests..."
python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
echo ""
# Print TVM-FFI version just before running tests
echo "Checking TVM-FFI version before tests..."
if [ -n "${TVM_FFI_REF:-}" ]; then
python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')"
else
python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
fi
echo ""
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/task_jit_run_tests_part1.sh` around lines 16 - 20, The current python
import line uses "|| true", which suppresses import errors even when an override
is active; change the behavior so import failures are allowed to fail fast when
TVM_FFI_REF is set: detect the TVM_FFI_REF env var and run the python -c "import
tvm_ffi; ..." without "|| true" when TVM_FFI_REF is non-empty, otherwise keep
the existing tolerant behavior (retain "|| true") when no override is active;
update the python import invocation (the line containing python -c "import
tvm_ffi; print(...)") and remove or conditionally apply the "|| true"
accordingly (apply same fix to the other occurrences referenced).

# Run each test file separately to isolate CUDA memory issues
pytest -s tests/attention/test_logits_cap.py
pytest -s tests/attention/test_sliding_window.py
Expand Down
8 changes: 8 additions & 0 deletions scripts/task_run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck disable=SC1091 # File exists, checked separately
source "${SCRIPT_DIR}/test_utils.sh"

# Source test environment setup (handles package overrides like TVM-FFI)
source "${SCRIPT_DIR}/setup_test_env.sh"

# Find and filter test files based on pytest.ini exclusions
find_test_files() {
echo "Reading pytest.ini for excluded directories..."
Expand Down Expand Up @@ -84,6 +87,11 @@ main() {
# Find test files (unique to unit tests - auto-discovery)
find_test_files

# Print TVM-FFI version just before test execution for traceability
echo "Checking TVM-FFI version before tests..."
python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
echo ""

# Execute tests or dry run
if [ "$DRY_RUN" == "true" ]; then
execute_dry_run "$TEST_FILES"
Expand Down
10 changes: 10 additions & 0 deletions scripts/task_test_jit_cache_package_build_import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ python -c "import torch; print(torch.__version__)"
CUDA_VERSION=$(python3 -c 'import torch; print(torch.version.cuda)' | cut -d'.' -f1,2 | tr -d '.')
echo "Detected CUDA version: cu${CUDA_VERSION}"

echo ""
echo "Checking TVM-FFI version before verification tests..."
python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
echo ""

Comment on lines +75 to +79
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor

Fix the first TVM-FFI log label to match execution point.

On Line 76, the message says β€œbefore verification tests,” but this block runs before package installation. That can mislead CI debugging.

Proposed wording fix
-echo "Checking TVM-FFI version before verification tests..."
+echo "Checking TVM-FFI version before package installation..."
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo ""
echo "Checking TVM-FFI version before verification tests..."
python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
echo ""
echo ""
echo "Checking TVM-FFI version before package installation..."
python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
echo ""
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/task_test_jit_cache_package_build_import.sh` around lines 75 - 79,
Update the echo message that precedes the TVM-FFI import to accurately reflect
when it runs: change the string "Checking TVM-FFI version before verification
tests..." to something like "Checking TVM-FFI version before package
installation..." so the log matches the execution point just before the python
-c "import tvm_ffi; ..." check; adjust only the echo text near the python
invocation to avoid confusing CI logs.

echo ""
echo "========================================"
echo "Installing flashinfer package"
Expand Down Expand Up @@ -108,6 +113,11 @@ echo "βœ“ Flashinfer-jit-cache wheel installed successfully"
cd ..

# Verify installation
echo ""
echo "Checking TVM-FFI version before verification tests..."
python -c "import tvm_ffi; print(f'TVM-FFI version: {tvm_ffi.__version__}')" || true
echo ""

echo ""
echo "========================================"
echo "Running verification tests"
Expand Down
Loading