{"id":18495936,"url":"https://github.com/leanprover/sherloc","last_synced_at":"2026-03-17T17:38:22.801Z","repository":{"id":253330095,"uuid":"843180377","full_name":"leanprover/SHerLOC","owner":"leanprover","description":"A StableHLO analyzer in Lean","archived":false,"fork":false,"pushed_at":"2024-10-09T18:32:59.000Z","size":135,"stargazers_count":15,"open_issues_count":1,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-12-25T17:10:10.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leanprover.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":"2024-08-16T00:31:50.000Z","updated_at":"2024-10-09T18:33:03.000Z","dependencies_parsed_at":"2024-08-28T19:34:48.269Z","dependency_job_id":"6fd7283c-7a60-443e-80d4-ec18b9779d41","html_url":"https://github.com/leanprover/SHerLOC","commit_stats":null,"previous_names":["leanprover/sherloc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2FSHerLOC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2FSHerLOC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2FSHerLOC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover%2FSHerLOC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanprover","download_url":"https://codeload.github.com/leanprover/SHerLOC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239212561,"owners_count":19600830,"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":[],"created_at":"2024-11-06T13:26:52.922Z","updated_at":"2026-03-17T17:38:22.781Z","avatar_url":"https://github.com/leanprover.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SHerLOC\n\nSHerLOC is a program analyzer for [StableHLO programs](https://openxla.org/stablehlo). It is written in [Lean](https://leanprover-community.github.io/index.html). \n\nSHerLOC aims to transform a StableHLO program written in concrete generic syntax into a well-formed, typed, abstract syntax tree. It also reports information such as use of undocumented/unspecified/underspecified/deprecated constructions and provides tools for analyzing and visualizing HLO programs.\n\n## Installation\n\nTo use SHerLOC, you must [install Lean](https://leanprover-community.github.io/get_started.html). If you want to use SHerLOC on StableHLO programs written in pretty syntax, you also need to [install StableHLO](https://github.com/openxla/stablehlo?tab=readme-ov-file#build-instructions) (note that you do not need to build the Python bindings).\n\nYou should then clone this repository.\n\n## Usage\n\nTo run SHerLOC, go to the SHerLOC directory and run \n\n```\nlake exe sherloc myprogram.mlir\n```\n\nThis will produce two files, `myprogram.mlir.ast` and `myprogram.mlir.report` that contain respectively a dump of the abstract syntax tree and the reported information about the program.\n\nIf the StableHLO program is in pretty syntax, you can convert it to generic syntax using `stablehlo-opt`\n\n```\nstablehlo-opt -mlir-print-op-generic myprogrampretty.mlir \u003e myprogramgeneric.mlir\n```\n\nOther subcommands are also available:\n\n`ops` - prints the operators used in the program:\n```bash\nlake exe sherloc ops myprogram.mlir\n```\n\n`graph` - prints the program in graphviz format for visualization\n```bash\nlake exe sherloc graph myprogram.mlir\n```\n\n## Exporting Models to StableHLO\n\nFor examples of how to produce a StableHLO program from a JAX model, see `export_hlo.py`. Example usage:\n\n```bash\npython export_hlo.py attention \u003e attention.mlir\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Fsherloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanprover%2Fsherloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover%2Fsherloc/lists"}