Repository navigation
Conversation
`gl.jit` reused `finch.finch_fused` and swapped in Galley's runtime by overwriting `defer`, `compute` and `maybedefer` in the generated function's globals. Copy the fused JIT (and the parts of `finch.symbolic` it needs) into `galley_jl_python.fused`, with Galley's runtime wired in directly, so the two packages can evolve independently. Also port finch-tensor's parser, CFG and liveness tests for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port fixes made to finch-tensor's finch_fused: - `|`/`&` were lowered to `or`/`and`, since both shared `operator.or_`/`and_`. - A for-loop target was never defined in the CFG, so using it in the body made it live on entry and raised UnboundLocalError. - `break` could not be parsed (it was matched as an expression) or lowered. - Bare call statements crashed the CFG builder. - Conditional expressions lowered to an unrepresentable lambda, and distinct callables sharing a `__name__` clobbered each other in the generated globals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Added 4aad33d, which ports finch-tensor's
Each has a regression test in |
`dtype` read the element type from the swizzle's body, which a lazy tensor does not have, so any elementwise operation between a lazy tensor and a Python scalar (e.g. `A * 2` inside `gl.jit`) raised a FieldError. Take `eltype` of the swizzle itself, which works for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Added f46ddde: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
gl.jitwas a thin wrapper aroundfinch.finch_fused.jit. It swapped in Galley's runtime by overwritingdefer,computeandmaybedeferin the generated function's globals. That ties galley-jl-python to finch-tensor's internals: any change to how finch-tensor's JIT calls its runtime breaks Galley. The finch-tensor JIT is about to change in exactly that way, as it gains fusion across function calls. Copying the JIT here lets the two packages evolve independently.What
galley_jl_python.fusedpackage, copied fromfinch.finch_fusedon finch-tensormain:nodes,parser,cfg_builder,dataflowandjit.defer/compute/maybedefernow live infused/dataflow.pyand are used directly, with no globals patching.result_type,ftype) are removed, since nothing in the pipeline reads them.fused/symbolic.pyholds the parts offinch.symbolicthe JIT needs: terms,Rewrite/PostWalk/Chain,Namespace,Context, and the CFG and dataflow classes.finch_fused.pyand thefinch-tensordependency.gl.jit(f, ctx=None)keeps its signature.ctxwas already ignored.Tests
tests/test_fused_compiler.py:gl.jitnever importsfinch.tests/test_fused.pyplus the new file, 17 passed. Full suite, excluding array-API, 966 passed, 45 skipped, 20 xfailed.🤖 Generated with Claude Code