{"id":26276207,"url":"https://github.com/speakez-llc/fsharp-mlir-hello","last_synced_at":"2025-03-14T11:17:09.830Z","repository":{"id":282336237,"uuid":"948188847","full_name":"speakez-llc/fsharp-mlir-hello","owner":"speakez-llc","description":"Proof of Concept using MLIR and LLVM to build binaries from F# code","archived":false,"fork":false,"pushed_at":"2025-03-14T03:17:59.000Z","size":226,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T03:25:06.072Z","etag":null,"topics":["dotnet","fsharp","fsharp-console","llvm","mlir"],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/speakez-llc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-13T22:37:55.000Z","updated_at":"2025-03-14T03:18:03.000Z","dependencies_parsed_at":"2025-03-14T03:36:35.435Z","dependency_job_id":null,"html_url":"https://github.com/speakez-llc/fsharp-mlir-hello","commit_stats":null,"previous_names":["speakez-llc/fsharp-mlir-hello"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speakez-llc%2Ffsharp-mlir-hello","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speakez-llc%2Ffsharp-mlir-hello/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speakez-llc%2Ffsharp-mlir-hello/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/speakez-llc%2Ffsharp-mlir-hello/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/speakez-llc","download_url":"https://codeload.github.com/speakez-llc/fsharp-mlir-hello/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243565415,"owners_count":20311705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","fsharp","fsharp-console","llvm","mlir"],"created_at":"2025-03-14T11:17:09.273Z","updated_at":"2025-03-14T11:17:09.814Z","avatar_url":"https://github.com/speakez-llc.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# F# to Native Executable Compiler Pipeline\n\n![alt text](FSharp-MLIR-LLVM.png)\n\n## Project Overview\n\n### Toolchain Dependencies\n- MLIR libraries\n- LLVM infrastructure\n- F# Compiler Service\n- PowerShell (for build scripting)\n- MSYS2 or equivalent MinGW development environment\n\n\nThis project represents an experimental proof-of-concept for compiling F# directly to native executables using MLIR (Multi-Level Intermediate Representation) and LLVM, bypassing traditional .NET compilation infrastructure.\n\n![alt text](\u003cScreenshot 2025-03-13 211122.png\u003e)\n\n## MLIR and LLVM Toolchain Setup with MSYS2 Windows Installer\n\nThe MLIR and LLVM toolchain was acquired through the official MSYS2 Windows installer package, which provides a streamlined method for obtaining development tools and libraries for Windows.\n\n### Packages\n   Utilized the MSYS2 package manager (pacman) to install necessary development tools and libraries:\n   ```bash\n   pacman -Syu  # Update package database and core system packages\n   pacman -S mingw-w64-x86_64-toolchain\n   pacman -S mingw-w64-x86_64-llvm\n   pacman -S mingw-w64-x86_64-clang\n   pacman -S mingw-w64-x86_64-cmake\n   pacman -S mingw-w64-x86_64-ninja\n   ```\n\n### General Project Structure\n- `src/`: Source code for the compiler pipeline\n  - `Bindings/`: Native bindings for MLIR and LLVM\n  - `Conversion/`: AST conversion logic\n  - `Pipeline/`: Compilation pipeline implementation\n  - `Examples/`: Sample F# programs\n- `tools/`: Build and development scripts\n- `build/`: Compiled output directory\n\n### Compilation Architecture\n\nThe compiler pipeline consists of several critical stages:\n1. F# Source Parsing\n2. Abstract Syntax Tree (AST) Conversion\n3. MLIR Dialect Generation\n4. LLVM IR Lowering\n5. Native Code Generation\n\n## Build Notes\nCheck path settings to match your project and dependency locations\n\n### Compilation Caveats\n\n#### F# Compiler Service Integration\nThe project uses a standalone F# Compiler Service instance, which is intentionally decoupled from the standard .NET ecosystem. This approach introduces several non-standard elements:\n\n- The F# Compiler Service is compiled as a discrete library\n- Build scripts use direct PowerShell orchestration to compile\n- Type resolution and binding are hand-jammed in many cases\n\n**Warning**: This implementation is inherently experimental and should be considered a research prototype.\n\n## Build Process\n\nExecute the compilation pipeline using the provided PowerShell script:\n\n```powershell\n.\\tools\\build.ps1\n```\n\n### Build Stages\n1. Compile F# MLIR Bindings\n2. Compile MLIR Wrapper Modules\n3. Generate Conversion Modules\n4. Build Compilation Pipeline\n5. Create Example Executables\n\n\n## Limitations and Future Work\n\nCurrent limitations include:\n- Minimal language feature support\n- Experimental parsing mechanisms\n- Limited optimization strategies\n\nPotential future improvements:\n- Enhanced type system mapping\n- More comprehensive language construct support\n- Advanced optimization passes\n\n## Licensing and Contribution\n\nThis is an MIT licensed open-source research project. Contributions, discussions, and explorations are welcome.\n\n## Disclaimer\n\nThis compiler pipeline is a proof-of-concept. It is not intended for production use and represents an experimental approach to functional language compilation.\n\n## .NET 9 compilation sizes for the same functionality\n\n### Standard Debug Build\n\n![alt text](\u003cScreenshot 2025-03-13 224831.png\u003e)\n\n### Production build\n\n![alt text](\u003cScreenshot 2025-03-13 230147.png\u003e)\n\n![alt text](\u003cScreenshot 2025-03-13 225719.png\u003e)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspeakez-llc%2Ffsharp-mlir-hello","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspeakez-llc%2Ffsharp-mlir-hello","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspeakez-llc%2Ffsharp-mlir-hello/lists"}