Skip to content

Commit 6304e48

Browse files
committed
chore: Update Lean to 4.23
1 parent 0372139 commit 6304e48

24 files changed

+130
-297
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -57,137 +57,3 @@ jobs:
5757

5858
- name: List library dependencies
5959
run: ./bin/check-libs ./.lake/build/bin/klr
60-
61-
# temporarily disabled until after prod release
62-
#- name: Install Python
63-
# uses: actions/setup-python@v5
64-
# with:
65-
# python-version: '3.x'
66-
# cache: 'pip'
67-
68-
#- name: Install dependencies
69-
# working-directory: ./interop
70-
# run: |
71-
# python -m pip install --upgrade pip
72-
# pip install -r requirements.txt
73-
74-
# temporarily disabled until we fix klr gather
75-
#- name: Run pytest
76-
# working-directory: ./interop
77-
# run: |
78-
# pytest
79-
80-
# temporarily disabled until after prod release
81-
#- name: Make a wheel
82-
# # https://github.com/pypa/cibuildwheel
83-
# # Hit this: https://github.com/pypa/cibuildwheel/discussions/1926
84-
# env:
85-
# # https://github.com/leanprover/lean4/pull/6631/files
86-
# MACOSX_DEPLOYMENT_TARGET: 99.0
87-
# CIBW_BUILD_VERBOSITY: 1
88-
# run: |
89-
# pip install cibuildwheel build
90-
# bin/make-wheel
91-
#- uses: actions/upload-artifact@v4
92-
# with:
93-
# name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
94-
# path: ./.wheel/wheelhouse/*.whl
95-
96-
# Only upload sdist from an x64 linux machine.
97-
# In a normal python package the sdist would be identical regardless of which
98-
# platform/arch generated it. But we want to include klr.bin, which is
99-
# platform specific and currently built outside the normal python tool ecosystem.
100-
# So let's include the one platform-arch that's most useful to us right now.
101-
#- name: Upload sdist (Ubuntu x64 only)
102-
# if: matrix.os == 'ubuntu-latest'
103-
# uses: actions/upload-artifact@v4
104-
# with:
105-
# name: sdist-${{ matrix.os }}-${{ strategy.job-index }}
106-
# path: ./.wheel/wheelhouse/*.tar.gz
107-
108-
# Mostly followed guides here:
109-
# - https://github.com/pypa/gh-action-pypi-publish?tab=readme-ov-file
110-
# - https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
111-
# NB: I needed to set the trusted publisher to repo NKL, not KLR, since that was its original name. Scary detail! No idea how I'd figure that out without knowing the original name.
112-
publish-to-testpypi:
113-
name: Publish Python 🐍 distribution 📦 to TestPyPI
114-
needs:
115-
- build
116-
if: startsWith(github.ref, 'refs/tags/') # only publish to pypi on tag pushes
117-
runs-on: ubuntu-latest
118-
119-
# The `environment` just restricts the scope of trusted publishing. You
120-
# add this to the things you trust in the pypi UI.
121-
environment:
122-
name: testpypi
123-
124-
permissions:
125-
id-token: write # IMPORTANT: mandatory for trusted publishing
126-
127-
steps:
128-
- uses: actions/checkout@v4 # for scripts
129-
130-
- name: Download all the dists
131-
uses: actions/download-artifact@v4
132-
with:
133-
# name: python-package-distributions
134-
# # unpacks all CIBW artifacts into dist/
135-
# pattern: cibw-*
136-
path: dist/
137-
merge-multiple: true
138-
139-
- name: List the wheels
140-
run: |
141-
ls -1 dist/
142-
143-
- name: Rename OSX wheels
144-
working-directory: ./dist
145-
run: ../bin/rename-wheels # .. because we are starting in ./dist
146-
147-
- name: Publish distribution 📦 to TestPyPI
148-
uses: pypa/gh-action-pypi-publish@release/v1
149-
with:
150-
repository-url: https://test.pypi.org/legacy/
151-
verbose: true
152-
skip-existing: true
153-
154-
# For this step to succeed, you must have bumped the klr version in interop/pyproject.toml
155-
publish-to-pypi:
156-
name: Publish Python 🐍 distribution 📦 to PyPI
157-
needs:
158-
- build
159-
if: startsWith(github.ref, 'refs/tags/') # only publish to pypi on tag pushes
160-
runs-on: ubuntu-latest
161-
162-
# The `environment` just restricts the scope of trusted publishing. You
163-
# add this to the things you trust in the pypi UI.
164-
environment:
165-
name: pypi
166-
167-
permissions:
168-
id-token: write # IMPORTANT: mandatory for trusted publishing
169-
170-
steps:
171-
- uses: actions/checkout@v4 # for scripts
172-
173-
- name: Download all the dists
174-
uses: actions/download-artifact@v4
175-
with:
176-
# name: python-package-distributions
177-
# # unpacks all CIBW artifacts into dist/
178-
# pattern: cibw-*
179-
path: dist/
180-
merge-multiple: true
181-
182-
- name: List the wheels
183-
run: |
184-
ls -1 dist/
185-
186-
- name: Rename OSX wheels
187-
working-directory: ./dist
188-
run: ../bin/rename-wheels # .. because we are starting in ./dist
189-
190-
- name: Publish distribution 📦 to TestPyPI
191-
uses: pypa/gh-action-pypi-publish@release/v1
192-
with:
193-
verbose: true

KLR/Core/Indexing.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ structure FreeSpans (d : Nat) where
451451

452452
def FreeSpans.get! {d : Nat} (f : FreeSpans d) (c : Coord d) : Coord d where
453453
coords := List.zipWith (IndexSpan.get! · ·) f.spans c.coords
454-
coords_dim := by simp [FreeSpans.spans_dim, Coord.coords_dim, Nat.min_self]
454+
coords_dim := by simp [FreeSpans.spans_dim, Coord.coords_dim]
455455

456456
/- ## Composition -/
457457

@@ -470,7 +470,7 @@ def comp {d} (f : FreeSpans d) (l : Layout d) : Layout d where
470470
offset := Int.toNat <| offset f l
471471
steps := steps f l
472472
nums := l.nums
473-
steps_dim := by simp [FreeSpans.spans_dim, Layout.steps_dim, Nat.min_self, steps]
473+
steps_dim := by simp [FreeSpans.spans_dim, Layout.steps_dim, steps]
474474
nums_dim := l.nums_dim
475475

476476
end lcomp

KLR/Extract/lake-manifest.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@
3939
"type": "git",
4040
"subDir": null,
4141
"scope": "",
42-
"rev": "e75c008a471a29793ef323cd15ac1ae6258085df",
42+
"rev": "d8137a41053423de98c528d75a5fa1a01fa58567",
4343
"name": "TensorLib",
4444
"manifestFile": "lake-manifest.json",
45-
"inputRev": "v0.0.15",
45+
"inputRev": "v0.0.16",
4646
"inherited": true,
4747
"configFile": "lakefile.lean"},
4848
{"url": "https://github.com/leanprover-community/plausible",
4949
"type": "git",
5050
"subDir": null,
5151
"scope": "",
52-
"rev": "c4aa78186d388e50a436e8362b947bae125a2933",
52+
"rev": "a22e7c1fa7707fb7ea75f2f9fd6b14de2b7b87a9",
5353
"name": "plausible",
5454
"manifestFile": "lake-manifest.json",
55-
"inputRev": "v4.21.0",
55+
"inputRev": "v4.23.0",
5656
"inherited": true,
5757
"configFile": "lakefile.toml"},
5858
{"type": "path",
@@ -73,10 +73,10 @@
7373
"type": "git",
7474
"subDir": null,
7575
"scope": "",
76-
"rev": "7c6aef5f75a43ebbba763b44d535175a1b04c9e0",
76+
"rev": "41c5d0b8814dec559e2e1441171db434fe2281cc",
7777
"name": "Cli",
7878
"manifestFile": "lake-manifest.json",
79-
"inputRev": "v4.21.0",
79+
"inputRev": "v4.23.0",
8080
"inherited": true,
8181
"configFile": "lakefile.toml"},
8282
{"type": "path",
@@ -86,34 +86,34 @@
8686
"inherited": true,
8787
"dir": "../../KLR/Util/Archive",
8888
"configFile": "lakefile.lean"},
89-
{"url": "https://github.com/leanprover-community/quote4",
89+
{"url": "https://github.com/leanprover-community/aesop",
9090
"type": "git",
9191
"subDir": null,
92-
"scope": "leanprover-community",
93-
"rev": "e9c65db4823976353cd0bb03199a172719efbeb7",
94-
"name": "Qq",
92+
"scope": "",
93+
"rev": "247ff80701c76760523b5d7c180b27b7708faf38",
94+
"name": "aesop",
9595
"manifestFile": "lake-manifest.json",
96-
"inputRev": "stable",
96+
"inputRev": "v4.23.0",
9797
"inherited": true,
9898
"configFile": "lakefile.toml"},
99-
{"url": "https://github.com/leanprover-community/aesop",
99+
{"url": "https://github.com/leanprover-community/quote4",
100100
"type": "git",
101101
"subDir": null,
102-
"scope": "",
103-
"rev": "8ff27701d003456fd59f13a9212431239d902aef",
104-
"name": "aesop",
102+
"scope": "leanprover-community",
103+
"rev": "e9c65db4823976353cd0bb03199a172719efbeb7",
104+
"name": "Qq",
105105
"manifestFile": "lake-manifest.json",
106-
"inputRev": "v4.21.0",
106+
"inputRev": "stable",
107107
"inherited": true,
108108
"configFile": "lakefile.toml"},
109109
{"url": "https://github.com/leanprover-community/batteries",
110110
"type": "git",
111111
"subDir": null,
112-
"scope": "leanprover-community",
113-
"rev": "8d2067bf518731a70a255d4a61b5c103922c772e",
112+
"scope": "",
113+
"rev": "d117e2c28cba42e974bc22568ac999492a34e812",
114114
"name": "batteries",
115115
"manifestFile": "lake-manifest.json",
116-
"inputRev": "v4.21.0",
116+
"inputRev": "v4.23.0",
117117
"inherited": true,
118118
"configFile": "lakefile.toml"},
119119
{"type": "path",

KLR/NRT/Main.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ def runNeffCmd := `[Cli|
6565

6666
ARGS:
6767
neffFile : String; "NEFF file"
68-
...inputFiles : String; "Pairs of names and input files corresponding to the tensor inputs in the NEFF." ++
69-
"For example, run-neff /tmp/foo.neff a_tensor /tmp/a.tensor b_tensor /var/b.tensor" ++
70-
"would map `a_tensor` which is expected by the NEFF to the bytes in `/tmp/a.tensor`, etc." ++
71-
"Currently only files of bytes are supported. NumPy format (.npy) files seem supported by " ++
72-
"the runtime, but we haven't got them to work yet. You can generate bytes from an ndarray by calling " ++
73-
" with open('a_tensor', 'wb') as f:" ++
74-
" arr.tofile(f)"
68+
...inputFiles : String; "Pairs of names and input files corresponding to the tensor inputs in the NEFF.
69+
For example, run-neff /tmp/foo.neff a_tensor /tmp/a.tensor b_tensor /var/b.tensor
70+
would map `a_tensor` which is expected by the NEFF to the bytes in `/tmp/a.tensor`, etc.
71+
Currently only files of bytes are supported. NumPy format (.npy) files seem supported by
72+
the runtime, but we haven't got them to work yet. You can generate bytes from an ndarray by calling
73+
with open('a_tensor', 'wb') as f:
74+
arr.tofile(f)"
7575
]
7676

7777
def runTests (_ : Parsed) : IO UInt32 := do

KLR/NRT/lake-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"type": "git",
1313
"subDir": null,
1414
"scope": "",
15-
"rev": "7c6aef5f75a43ebbba763b44d535175a1b04c9e0",
15+
"rev": "41c5d0b8814dec559e2e1441171db434fe2281cc",
1616
"name": "Cli",
1717
"manifestFile": "lake-manifest.json",
18-
"inputRev": "v4.21.0",
18+
"inputRev": "v4.23.0",
1919
"inherited": false,
2020
"configFile": "lakefile.toml"}],
2121
"name": "NRT",

KLR/NRT/lakefile.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ lean_exe nrt where
4141
root := `Main
4242

4343
require Cli from git
44-
"https://github.com/leanprover/lean4-cli.git" @ "v4.21.0"
44+
"https://github.com/leanprover/lean4-cli.git" @ "v4.23.0"
4545

4646
require FFIUtil from "../Util/FFIUtil"

KLR/Serde/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ TODO: lift this constraint.
677677
def cborTag (typeTag valTag len : Nat) : ByteArray :=
678678
assert! len < 0x18
679679
let len := 0x80 ||| len
680-
.mk #[ 0xd9, typeTag.toUInt8, valTag.toUInt8, len]
680+
.mk #[ 0xd9, typeTag.toUInt8, valTag.toUInt8, len.toUInt8]
681681

682682
def parseCBORTag (arr : ByteArray) : Err (Nat × Nat × Nat × ByteArray) := do
683683
if h:arr.size > 4 then

KLR/Trace/FromNKI.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ instance : FromNKI Immediate where
106106
fromNKI?
107107
| .bool true => return .int 1
108108
| .bool false => return .int 0
109-
| .int i => return .int i
109+
| .int i => return .int i.toInt32
110110
| .float f => return .float f.toFloat32
111111
| t => throw s!"expecting int or 'float', got '{Term.kindStr t}'"
112112

KLR/Trace/ISA.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ nki builtin.isa.sendrecv
805805
src := .abstract src,
806806
sendToRank := send_to_rank,
807807
recvFromRank := recv_from_rank,
808-
pipeId := .int pipe_id,
808+
pipeId := .int pipe_id.toInt32,
809809
useGpsimdDma := use_gpsimd_dma
810810
}) name
811811
return .none
@@ -825,7 +825,7 @@ nki builtin.isa.sendrecv_cce
825825
src := <- src.mapM (fun x => return .abstract x),
826826
sendToRank := send_to_rank,
827827
recvFromRanks := recv_from_ranks,
828-
pipeId := .int pipe_id,
828+
pipeId := .int pipe_id.toInt32,
829829
op := op
830830
}) name
831831
return .none

KLR/Trace/Term.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def listAccess (l : List Term) : List Term -> Err Term
308308
let e := if e < 0 then l.length + e else e
309309
if start < 0 || start > l.length || e < 0 || e > l.length then
310310
throw "slice index out of bounds"
311-
let sliced := List.range ((e - start + step - 1) / step).toNat |>.map (fun i => l.get! (start.toNat + i * step.toNat))
311+
let sliced := List.range ((e - start + step - 1) / step).toNat |>.map (fun i => l[start.toNat + i * step.toNat]!)
312312
return .list sliced.toArray
313313
| e => throw s!"index must be an integer or slice, got {repr e}"
314314

0 commit comments

Comments
 (0)