Skip to content

feat(nkigen): import NKIgen as a workspace member (revision of #55)#58

Open
shaojiex-aws wants to merge 2 commits into
aws-neuron:feat/kernelgenfrom
shaojiex-aws:feat/nkigen
Open

feat(nkigen): import NKIgen as a workspace member (revision of #55)#58
shaojiex-aws wants to merge 2 commits into
aws-neuron:feat/kernelgenfrom
shaojiex-aws:feat/nkigen

Conversation

@shaojiex-aws
Copy link
Copy Markdown

@shaojiex-aws shaojiex-aws commented May 20, 2026

NKIgen is the NumPy-trace -> NISA-dialect lowering frontend (formerly "NKIPyKernelGen"). Imported as a top-level workspace member of the nkipy monorepo, replacing the kernelgen/ subfolder previously proposed in #55.

Summary

This PR is a clean re-import addressing all of @vgene's feedback on #55. The diff goes from ~37K to ~32K lines (and from 230 to 176 files) by dropping internal scaffolding, deduplicating tests, and moving the Compiler Explorer wrapper out of scope.

Changes (vs. #55)

  • Drop compiler_explorer/, .claude/skills/, internal scratch dirs (issues/, docs/, tools/kernel_agent/, docker/, examples/qwen3_embedding/, Brazil Config). Compiler Explorer wrapper will land separately as a top-level component shared with other backends.
  • Drop the duplicated nkipy tests under tests/e2e/nkipy_tests/; the top-level /tests folder is the single source of truth.
  • Drop BIR-sim Mode and tests; device is the golden, matching how nkipy's main backend tests are structured.
  • Rename Python package nkipy_kernelgennkigen, harness decorator nkipy_kernelgen_testnkigen_test.
  • Make HardwareConstants.h target-aware: replace global MAX_PARTITION_DIM / MAX_FREE_DIM_MATMUL with getSbufNumPartitions(target) / getMatmulFreeDimTileCap(target). The per-target values mirror nki.backends.mlir_tracer.target_info in the public nki Python wheel. infer-layout, canonicalize-partition-dim, and legalize-layout each take a --target= option (default trn2).
  • Move project metadata into pyproject.toml; setup.py is now just the CMake build extension. Wire nkigen into the top-level uv workspace via pyproject.toml [tool.uv.workspace] members and [tool.uv.sources].
  • Drop tests/debug, tests/outputs, tests/python (LIT) — internal scaffolding that doesn't belong in the open-source merge.

Test plan

  • pytest tests/passes/ — 122 passed
  • pytest tests/unit/ — 128 passed
  • pytest tests/e2e/ — 52 passed, 10 skipped (HW-only on this trn1 box)
  • CI on aws-neuron/nkipy

Replaces

Closes #55.

…uron#55)

NKIgen is the NumPy-trace -> NISA-dialect lowering frontend (formerly
"NKIPyKernelGen"). Imported as a top-level workspace member of the nkipy
monorepo, replacing the kernelgen/ subfolder previously proposed in aws-neuron#55.

Addresses review feedback on aws-neuron#55:

- Drop compiler_explorer/, .claude/skills/, internal scratch dirs
  (issues/, docs/, tools/kernel_agent/, docker/, qwen3_embedding example,
  Brazil Config). Compiler Explorer wrapper will land separately as a
  top-level component shared with other backends.
- Drop the duplicated nkipy tests under tests/e2e/nkipy_tests/; the
  top-level /tests folder is the single source of truth.
- Drop BIR-sim Mode and tests; device is the golden, matching how
  nkipy's main backend tests are structured.
- Rename Python package nkipy_kernelgen -> nkigen, harness decorator
  nkipy_kernelgen_test -> nkigen_test.
- Make HardwareConstants.h target-aware: replace global
  MAX_PARTITION_DIM / MAX_FREE_DIM_MATMUL with
  getSbufNumPartitions(target) / getMatmulFreeDimTileCap(target).  The
  per-target values mirror nki.backends.mlir_tracer.target_info in the
  public nki Python wheel.  infer-layout, canonicalize-partition-dim,
  and legalize-layout each take a --target= option (default trn2).
- Move project metadata into pyproject.toml; setup.py is now just the
  CMake build extension.  Wire nkigen into the top-level uv workspace
  via pyproject.toml [tool.uv.workspace] members and [tool.uv.sources].
- Drop tests/debug, tests/outputs, tests/python (LIT) — internal
  scaffolding that doesn't belong in the open-source merge.
@shaojiex-aws
Copy link
Copy Markdown
Author

@vgene

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