{"id":13819252,"url":"https://github.com/spcl/open-earth-compiler","last_synced_at":"2025-04-13T12:11:15.146Z","repository":{"id":71628023,"uuid":"228001138","full_name":"spcl/open-earth-compiler","owner":"spcl","description":"development repository for the open earth compiler","archived":false,"fork":false,"pushed_at":"2021-02-19T15:16:53.000Z","size":1024,"stargazers_count":79,"open_issues_count":20,"forks_count":14,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-02-10T00:57:56.089Z","etag":null,"topics":["climate","compiler","high-performance-computing","mlir","stencil","weather"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2005.13014","language":"MLIR","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spcl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.TXT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-12-14T10:00:13.000Z","updated_at":"2025-01-17T15:31:18.000Z","dependencies_parsed_at":"2023-03-11T10:51:53.308Z","dependency_job_id":null,"html_url":"https://github.com/spcl/open-earth-compiler","commit_stats":{"total_commits":518,"total_committers":10,"mean_commits":51.8,"dds":0.2065637065637066,"last_synced_commit":"1e48dee6a1a021bc11d6621432450406349b3733"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spcl%2Fopen-earth-compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spcl%2Fopen-earth-compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spcl%2Fopen-earth-compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spcl%2Fopen-earth-compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spcl","download_url":"https://codeload.github.com/spcl/open-earth-compiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710445,"owners_count":21149190,"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":["climate","compiler","high-performance-computing","mlir","stencil","weather"],"created_at":"2024-08-04T08:00:43.484Z","updated_at":"2025-04-13T12:11:15.125Z","avatar_url":"https://github.com/spcl.png","language":"MLIR","funding_links":[],"categories":["MLIR"],"sub_categories":[],"readme":"# The Open Earth Compiler\n\nDevelopment repository for the Open Earth Compiler. The compiler implements a stencil dialect and transformations that lower stencil programs to efficient GPU code. \n\n## Publication\n\nA detailed discussion of the Open Earth Compiler can be found here:\n\n[Domain-Specific Multi-Level IR Rewriting for GPU](https://arxiv.org/abs/2005.13014)\n\n## Build Instructions\n\nThis setup assumes that you have built LLVM and MLIR in `$BUILD_DIR` and installed them to `$PREFIX`. To build and launch the tests, run\n```sh\nmkdir build \u0026\u0026 cd build\ncmake -G Ninja .. -DMLIR_DIR=$PREFIX/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit\ncmake --build . --target check-oec-opt\n```\nThe ROCM_BACKEND_ENABLED flag enables the support for AMDGPU targets. It requires an LLVM build including lld and we need to set the path to lld using the following flag:\n```sh\n-DLLD_DIR=$PREFIX/lib/cmake/lld\n```\nTo build the documentation from the TableGen description of the dialect operations, run\n```sh\ncmake --build . --target mlir-doc\n```\n**Note**: Make sure to pass `-DLLVM_INSTALL_UTILS=ON` when building LLVM with CMake in order to install `FileCheck` to the chosen installation prefix.\n\n## LLVM Build Instructions\n\nThe repository depends on a build of LLVM including MLIR. The Open Earth Compiler build has been tested with LLVM commit e59d336e75f4 using the following configuration:\n```\ncmake -G Ninja ../llvm -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD=\"host;NVPTX;AMDGPU\" -DCMAKE_INSTALL_PREFIX=\u003cinstall_root\u003e -DLLVM_ENABLE_PROJECTS='mlir;lld' -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_OCAMLDOC=OFF -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_INSTALL_UTILS=ON -DCMAKE_LINKER=\u003cpath_to_lld\u003e -DLLVM_PARALLEL_LINK_JOBS=2\n```\n**Note**: Apply all patches found in the patch folder using git apply:\n```\ngit apply ../stencil-dialect/patches/runtime.patch\n```\n\n## Compiling an Example Stencil Program\n\nThe following command lowers the laplace example stencil to NVIDIA GPU code:\n```\noec-opt --stencil-shape-inference --convert-stencil-to-std --cse --parallel-loop-tiling='parallel-loop-tile-sizes=128,1,1' --canonicalize --test-gpu-greedy-parallel-loop-mapping --convert-parallel-loops-to-gpu --canonicalize --lower-affine --convert-scf-to-std --stencil-kernel-to-cubin ../test/Examples/laplace.mlir \u003e laplace_lowered.mlir\n```\n**NOTE**: Use the command line flag --stencil-kernel-to-hsaco for AMD GPUs.\n\nThe tools mlir-translate and llc then convert the lowered code to an assembly file and/or object file:\n```\nmlir-translate --mlir-to-llvmir laplace_lowered.mlir \u003e laplace.bc\nllc -O3 laplace.bc -o laplace.s\nclang -c laplace.s -o laplace.o\n```\nThe generated object then exports the following method:\n```\nvoid _mlir_ciface_laplace(MemRefType3D *input, MemRefType3D *output);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspcl%2Fopen-earth-compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspcl%2Fopen-earth-compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspcl%2Fopen-earth-compiler/lists"}