Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial import of Jasc. #790

Merged
merged 21 commits into from
Feb 8, 2024

Conversation

ingomueller-net
Copy link
Collaborator

@ingomueller-net ingomueller-net commented Dec 5, 2023

This PR imports Jasc, an MLIR-based compiler for JAX kernels, to the repo. Most functionality works, but some doesn't, and some shortcuts have been taken. In particular:

  • The GPU tests fail, and I haven't investigated why beyond the fact that it can't run on my machine without GPU. Maybe we need a better mechanism to choose the backend before we can make GPUs work in OSS.
  • I have completely removed support for sparse and the related tests.
  • I have removed several tools that aren't supported in OSS.
  • The BUILD files are quite hacky and need to be cleaned up. They currently contain remains of two different approaches I tried, one with several shared object files and one with a single one. The latter is the one that is currently used but I think that the former can also work; I just gave up that approach at some point due to a weird error only to find out that the same error also occurs with the other approach and is unrelated. (Update: They BUILD files are still extremely hacky but they are now the closest to minimal I was able to achieve.)
  • I have also not made any attempt yet to reduce the diff between this repository and our internal version but there are a few easy things we could do to make potential future syncs easier.
  • I have not added copyright and license information yet. (Update: License information added.)

What does work, though, is to compile everything and run the tests (some of which fail are skipped):

bazel build //...
bazel test test:*

This PR imports Jasc, an MLIR-based compiler for JAX kernels, to the
repo. Most functionality works, but some doesn't, and some shortcuts
have been taken. In particular:

* The GPU tests fail, and I haven't investigated why beyond the fact
  that it can't run on my machine without GPU. Maybe we need a better
  mechanism to choose the backend before we can make GPUs work in OSS.
* I have completely removed support for sparse and the related tests.
* I have removed several tools that aren't supported in OSS.
* The BUILD files are quite hacky and need to be cleaned up. They
  currently contain remains of two different approaches I tried, one
  with several shared object files and one with a single one. The latter
  is the one that is currently used but I *think* that the former can
  also work; I just gave up that approach at some point due to a weird
  error only to find out that the same error also occurs with the other
  approach and is unrelated.
* I have also not made any attempt yet to reduce the diff between this
  repository and our internal version but there are a few easy things we
  could do to make potential future syncs easier.
* I have not added copyright and license information yet.

What does work, though, is to compile everything and run the tests (some
of which fail):

    bazel build //...
    bazel test test:*
Copy link
Contributor

@ftynse ftynse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we want license headers in all source files.

jasc/.bazelrc Outdated Show resolved Hide resolved
jasc/.bazelrc Outdated Show resolved Hide resolved
jasc/.bazelrc Outdated Show resolved Hide resolved
jasc/BUILD Outdated Show resolved Hide resolved
jasc/BUILD Outdated Show resolved Hide resolved
jasc/dialect/dialect.td Outdated Show resolved Hide resolved
jasc/external/requirements.txt Outdated Show resolved Hide resolved
jasc/gpu_lowering_passes.h Outdated Show resolved Hide resolved
jasc/mlir_lowering.h Outdated Show resolved Hide resolved
jasc/patches/apply.sh Outdated Show resolved Hide resolved
I am using version 6.4.0 because it is the latest current version below
7.0.0, plus it is LTS. Several other minor versions of version 6 have
worked as well. Bazel 7.0.0 does not work, probably due to some
incompatibility in one of the many dependencies. At least one dependency
requires Bazel 5.4.0 or higher.
Otherwise, for some weird reason, the file is expected in `external/`,
and putting it there may collide with some Bazel internals.
This sets up the following command, which creates/updates the
`compile_commands.json` file, which is useful for auto-completion and
other tools:

    bazel run @hedron_compile_commands//:refresh_all
I tried half a day to make CUDA integrate with bazel -- in vain. We can
try again in some future iteration.
The reductions are related to:

* abseil's VLOG,
* LLVM's dropping of opaque pointers,
* random new lines.
I put all new constructs into question again. Turns out that many were
not needed and some were even plain unused.
The patches still added things to several dependencies that are actually
not needed. This commit removes those. I also created a fresh patch that
"squashes" several `diff` sections to the same file into a single
section (i.e., I recreated the patch files from scratch).
Copy link
Collaborator Author

@ingomueller-net ingomueller-net left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ftynse: Thanks a lot for the helpful comments! I think I addressed them all, plus a few of the TODOs I had listed, plus some general clean-up. Please give it another look.

Edit: I have "resolved" all conversation but you may want to look at some of my comments (and re-open if you aren't happy).

jasc/.bazelrc Outdated Show resolved Hide resolved
jasc/WORKSPACE Outdated Show resolved Hide resolved
jasc/external/requirements.txt Outdated Show resolved Hide resolved
jasc/BUILD Outdated Show resolved Hide resolved
jasc/WORKSPACE Show resolved Hide resolved
jasc/dialect/BUILD Outdated Show resolved Hide resolved
jasc/dialect/BUILD Outdated Show resolved Hide resolved
jasc/BUILD Outdated Show resolved Hide resolved
jasc/.bazelrc Outdated Show resolved Hide resolved
@ftynse
Copy link
Contributor

ftynse commented Feb 8, 2024

Sorry, I forgot about this change. Don't hesitate to ping me by email when I do.

@ingomueller-net ingomueller-net merged commit 43c5bfd into iree-org:main Feb 8, 2024
3 checks passed
@ingomueller-net
Copy link
Collaborator Author

Sorry, I forgot about this change. Don't hesitate to ping me by email when I do.

Thanks for the final round! Addressed and merged :)

No worries! I was not in hurry with this PR and had other things on my mind as well...

@ingomueller-net ingomueller-net deleted the import-jasc-pr branch February 15, 2024 08:41
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.

2 participants