Skip to content

Make Compiler scripts and tests portable across checkouts - #68

Closed
Happymic wants to merge 5 commits into
mainfrom
agent/portable-compiler-tooling
Closed

Make Compiler scripts and tests portable across checkouts#68
Happymic wants to merge 5 commits into
mainfrom
agent/portable-compiler-tooling

Conversation

@Happymic

@Happymic Happymic commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • Replace the standalone assembler parser's developer-specific input file with an explicit asm_file command-line argument.
  • Replace developer-specific Python and PYTHONPATH examples in 12 TileLang test docstrings with repository-relative module invocations.
  • Keep the GPT-OSS reference test compatible with both the two-value router API in Transformers 4.57.x and the three-value API on current Transformers main.

Why

The checked-in entry point and test examples referenced individual developers' home directories. They could not be reused from another checkout. The GPT-OSS test also depended on one specific Transformers API shape even though both shapes are still encountered in supported development environments.

Scope

The parser change affects only its direct __main__ entry point; library callers of parse_asm_file are unchanged. The TileLang changes are documentation-only. The GPT-OSS change is confined to the Hugging Face cross-check in one test.

Validation

  • PYTHONPATH=. python -m pytest -q aten/tests -m 'not slow': 60 passed, 1 deselected.
  • PYTHONPATH=. python -m pytest -q assembler/tests: 4 passed.
  • PYTHONPATH=. python -m pytest -q aten/tests/test_gpt_oss_moe_reference.py: 11 passed with Transformers 4.57.6.
  • python assembler/parser.py --help: command-line interface renders correctly.
  • git diff --check: passed.

The TileLang suite was not executed locally because this checkout's Python environment does not include TVM. The only changed lines in those files are the Run: docstrings; no TileLang test logic changed.

@Happymic
Happymic force-pushed the agent/portable-compiler-tooling branch from 29fdbc1 to 1a26215 Compare July 25, 2026 17:34
Happymic and others added 5 commits August 3, 2026 17:23
Restore the TVM interpreter in the TileLang run instructions, tighten the
GPT-OSS router version dispatch, and put both under CI.

TileLang docstrings (13 files):
- Replacing the developer-specific path with a bare `python` dropped the
  signal that these tests need the Python 3.11 TVM venv (see
  tilelang_tvm_compiler/__main__.py) and its LD_LIBRARY_PATH="" convention
  (see test_helper.py).  Use the repo-relative `.venv-tvm/bin/python` form
  instead, which is portable and keeps both constraints.
- Apply the same form to test_loop_slice.py, which still carried a
  redacted absolute PYTHONPATH, so the directory is now consistent.
- Drop PYTHONPATH entirely: `-m` puts the repository root on sys.path.

aten/tests/test_gpt_oss_moe_reference.py:
- transformers 4.x never exposes raw router logits, so recomputing them
  with F.linear from the router's own weights made the router_logits
  assertion compare golden's matmul against an identical local matmul.
  Skip that assertion on the 4.x path and cross-check the dense score
  matrix against HF's actual output instead.
- Guard the tuple type before dispatching on arity: len() on a bare
  Tensor return yields the token count and could match an arm.
- Drop the squeeze(0) on the MLP scores; GptOssMLP.forward returns the
  same 2D (tokens, num_experts) matrix the router produced, so the
  squeeze was a no-op that would break for a single-token fixture.

CI:
- Neither aten/tests nor assembler/tests ran in CI, so the transformers
  compatibility this test provides was unverified while `pip install
  transformers` stays unpinned.  Run the two suites this PR touches.
  The golden_b tests are excluded because they import plena_quant from
  the sibling PLENA_Tools checkout, absent in this workflow.
- Register the `slow` marker that -m 'not slow' relies on.

assembler/parser.py:
- Add help text for asm_file and report a missing file through
  ArgumentParser.error instead of an unhandled FileNotFoundError.

tilelang_tvm_compiler/scripts/run_flash_attention_midir.py:
- Drop PYTHONPATH=compiler, which assumed a superproject layout.

Verified with pytest against transformers 5.14.1 (three-value router) and
4.57.1 (two-value router), in a checkout with the sibling repository
removed: 13 passed, 2 deselected on both.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Instruction.__init__ accepted an rflag argument but never assigned it,
storing self.rmask = rstride instead, while __repr__ reads self.rflag.
Every repr(Instruction) therefore raised AttributeError, so the
`python assembler/parser.py <file>` entry point crashed on its first
printed instruction.

Pre-existing on main and out of the scope of this branch, but it blocks
the entry point this branch exists to make runnable, and `--help` alone
does not reach the failing path.  Kept as a separate commit so it can be
dropped independently.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The previous commit wires this file into the unit-tests job, so the
stage-attribution guard now flags its exemption entry as stale.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants