[iluvatar] runtime path imports pytest: triton/spec/iluvatar/triton/testing.py::nvsmi reaches triton._internal_testing

Open Beginner friendly
#1,142 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend, compilers

Research direction

Start with triton/spec/iluvatar/triton/testing.py::nvsmi and compare its is_corex dependency with the vendor triton testing.py implementation described in the issue. Check triton/_internal_testing.py to confirm the pytest import path, then verify that the production nvsmi call path can load without pytest; done means the runtime no longer requires pytest for this path.

Written by the indexing model from the issue text.

Description

Summary

triton/spec/iluvatar/triton/testing.py::nvsmi imports triton._internal_testing for is_corex, and that module does import pytest at module level. nvsmi is reachable from a production call path (no test involvement), so on an iluvatar box without pytest, serving a model dies with ModuleNotFoundError: No module named 'pytest'.

Version

flagtree==0.6.1+iluvatar3.6 (the wheel installed into flagos-runtime-iluvatar-corex4.5.0:2.1.2, python 3.12).

Call path
flag_gems _iluvatar mm/addmm tuned configs carry
    prune_configs_by={"perf_model": estimate_matmul_time, ...}
  -> triton/runtime/autotuner.py::prune_configs
  -> triton/ops/matmul_perf_model.py::estimate_matmul_time
  -> triton/ops/matmul_perf_model.py::get_tflops
  -> triton/ops/matmul_perf_model.py::get_tensorcore_tflops
  -> triton/ops/matmul_perf_model.py::get_clock_rate_in_khz
  -> triton/spec/iluvatar/triton/testing.py::nvsmi          <-- here
  -> from triton._internal_testing import is_corex
  -> triton/_internal_testing.py:31  import pytest            <-- fails

Observed while serving Qwen3-4B on sglang 0.5.18 (decode attention autotuning):

File "/opt/flagtree/triton/ops/matmul_perf_model.py", line 14, in get_clock_rate_in_khz
    return nvsmi(['clocks.max.sm'])[0] * 1e3
File "/opt/flagtree/triton/spec/iluvatar/triton/testing.py", line 8, in nvsmi
    from triton._internal_testing import is_corex
File "/opt/flagtree/triton/_internal_testing.py", line 31, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'
Why it is a packaging defect rather than a caller problem

The equivalent helper in the vendor triton this stack also ships (triton==3.2.0+corex.4.5.0.20260804) defines is_corex() locally in triton/testing.py and imports nothing from _internal_testing:

def is_corex():
    import torch
    return hasattr(torch, "corex") and torch.corex == True

So the spec overlay reaches into a test-support module for a one-line predicate, and by doing so drags a test framework into the runtime dependency set of every flagtree+iluvatar install.

Suggested fix

Define is_corex() locally in triton/spec/iluvatar/triton/testing.py (as vendor triton does), or move is_corex out of _internal_testing.py into a module that does not import pytest.

Workaround in use

Installing pytest into the image. FlagOS carries it until this is fixed — tracked as an explicit app dependency with a pointer back to this issue.

Dominant language
Python
Stars
353
Forks
152
Avg merge
2d 22h
Merged PRs (30d)
92

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from flagos-ai/FlagTree

All issues in flagos-ai/FlagTree

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.