Skip to content

fix: resolve FlyDSL MLIR symlinks for Python 3.12 in Docker#18

Closed
sunway513 wants to merge 1 commit intomainfrom
fix/docker-flydsl-py312
Closed

fix: resolve FlyDSL MLIR symlinks for Python 3.12 in Docker#18
sunway513 wants to merge 1 commit intomainfrom
fix/docker-flydsl-py312

Conversation

@sunway513
Copy link
Owner

Summary

  • Fix FlyDSL import failure in Docker containers caused by broken MLIR symlinks
  • The FlyDSL build creates symlinks from _mlir Python files (ir.py, dialects/*.py) into the MLIR source tree, which doesn't exist in runtime images
  • Dockerfile.wheels: dereference symlinks after wheel build and export source tree to /flydsl_src/
  • Dockerfile.clean: install FlyDSL as editable from exported source (includes kernels/ and tests/ for profiling)

Root Cause

The .flir/build/python_packages/flydsl/_mlir/ directory contains symlinks like:

ir.py -> /build/llvm-project/mlir_install/src/python/MLIRPythonSources.Core.Python/ir.py

These resolve inside the wheels builder stage but break in the clean runtime image where LLVM source is absent, causing:

ImportError: cannot import name 'ir' from '_mlir' (unknown location)

Test plan

  • Rebuilt atom:wheels — FlyDSL symlinks dereferenced, /flydsl_src/ exported
  • Rebuilt atom:clean-v3 — FlyDSL editable install works with cpython-312 .so files
  • Verified import flydsl and from _mlir import ir succeed
  • Verified FlyDSL softmax kernel compiles and runs correctly on MI300X GPU

The FlyDSL build creates symlinks from _mlir Python files (ir.py,
dialects/*.py, etc.) into the MLIR source tree. When the source tree
is unavailable in the runtime image, these break and FlyDSL fails to
import with "cannot import name 'ir' from '_mlir'".

Dockerfile.wheels:
- Dereference _mlir symlinks after wheel build so the source tree
  can be used standalone without the MLIR build artifacts
- Export FlyDSL source tree to /flydsl_src/ for use by clean image

Dockerfile.clean:
- Install FlyDSL as editable from the exported source tree instead
  of the wheel, giving access to kernels/ and tests/ for profiling
- Verify both flydsl import and kernel module availability
@sunway513 sunway513 closed this Feb 21, 2026
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.

1 participant