Skip to content

Commit

Permalink
z
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcl committed Feb 8, 2025
1 parent 620775a commit 6eff035
Show file tree
Hide file tree
Showing 49 changed files with 13 additions and 20 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# macos-13 is x86
# macos-latest is arm64
# ubuntu-latest is x64
os: [macos-latest]
os: [ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}

Expand All @@ -25,23 +25,20 @@ jobs:
# Build (and test) Lean. Tests are all via #guard macros
# now so you can't really build without testing.
- uses: leanprover/lean-action@v1
with:
lake-package-directory: ./Lean
- name: Run tests
working-directory: ./Lean
run: lake exe klr
# Run pytest
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- name: Install dependencies
working-directory: ./Python
working-directory: ./interop
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run pytest
working-directory: ./Python
working-directory: ./interop
run: |
pytest
- name: Make a wheel
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/klr
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

ROOT=$(dirname $(dirname $(readlink -f $0)))

$ROOT/Lean/.lake/build/bin/klr $@
$ROOT/.lake/build/bin/klr $@
10 changes: 2 additions & 8 deletions bin/make-wheel
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ trap "kill 0" SIGINT SIGTERM

ROOT=$(dirname $(dirname $(readlink -f $0)))
WHEEL_DIR=$ROOT/.wheel/
LEAN_DIR=$ROOT/Lean
PYTHON_DIR=$ROOT/Python
PYTHON_DIR=$ROOT/interop
rm -rf $WHEEL_DIR
mkdir -p $WHEEL_DIR/{klr,bin}

# Build Lean code
pushd .
cd $LEAN_DIR
lake build
popd

# Get klr binary
cp $LEAN_DIR/.lake/build/bin/klr $WHEEL_DIR/bin/klr
cp .lake/build/bin/klr $WHEEL_DIR/bin/klr

# Get Python packages
cp -R $PYTHON_DIR/* $WHEEL_DIR
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions Python/klr/parser.py → interop/klr/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def up(f, n):
for _ in range(n):
d = os.path.dirname(d)
return d


def run_klr(infile, outfile):
# For development, pick up the klr binary from the project dir
Expand All @@ -29,8 +29,7 @@ def run_klr(infile, outfile):
if not os.path.isfile(bin):
# For regular pip users, pick up the klr from the wheel. While the type of `bin` here is
# PosixPath rather than string, they both work as the first argument to subprocess.run
#bin = files('klr').joinpath('bin/klr')
raise Exception("no file: " + bin)
bin = files('klr').joinpath('bin/klr')
subprocess.run([bin, 'parse-json', infile.name], stdout=outfile, check=True)


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions Python/pyproject.toml → interop/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ authors = [
]
description = "Intermediate langauge for tensor compilers"
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE" }
keywords = ["trainium", "tpu", "pallas", "triton", "gpu"]

Expand All @@ -37,8 +36,12 @@ testpaths = [
]

[tool.setuptools]
packages = ["bin", "klr", "nki", 'nki.isa', 'nki.language'] # Required to have 2 top level packages
packages = ["bin", "klr", "nki", 'nki.isa', 'nki.language'] # This field is tequired to have more than 1 top level packages (nki/klr). It's not beautiful but it works.

# Build a fake C file to trick the `build` command to make an arch-specific wheel
# We need this because we hide our `klr` Lean binary in the wheel but Python tools
# don't know about it. I couldn't find another way to stop Python from generating
# a generic `any` wheel.
[[tool.setuptools.ext-modules]]
name = "noop"
sources = ["noop.c"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6eff035

Please sign in to comment.