Skip to content

Commit

Permalink
Replace Cassette for an overlayed MethodTable (#40)
Browse files Browse the repository at this point in the history
* Replace Cassette with an overlayed `MethodTable`

* Fix typo in `ReactantInterpreter` constructor

* Rename `get_interence_world` to `get_world_counter`

* Complete `AbstractInterpreter` API implementation

* Refactor phrase

* Run traced function over custom interpreter

* Fix `OpaqueClosure` wrapping of interpreted closures

* Add comment

* Add `@hlo_override` macro

* Format code

* Rename `@hlo_override` to `@reactant_override`

* Fix interpreter for Julia 1.11

* Add `Symbol` case for `make_tracer`

* Try fix ghost argument in `OpaqueClosure`

* Fix argtypes of `OpaqueClosure` on closures with Julia 1.9

* Replace `*` for `sum` in `@code_hlo` test

* Fix return type type-unstability in `Base.:*`

* Refactor includes

---------

Co-authored-by: Sergio Sánchez Ramírez <sergio.sancnchez.ramirez+git@bsc.es>
  • Loading branch information
mofeing and Sergio Sánchez Ramírez authored Jul 16, 2024
1 parent 6b7d6bc commit 906395e
Show file tree
Hide file tree
Showing 6 changed files with 454 additions and 372 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ version = "0.1.7"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Cassette = "7057c7e9-c182-5462-911a-8362d720325c"
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
Expand All @@ -31,7 +30,6 @@ ReactantNNlibExt = "NNlib"
Adapt = "4"
ArrayInterface = "7.10"
CEnum = "0.4, 0.5"
Cassette = "0.3"
Enzyme = "0.11, 0.12"
NNlib = "0.9"
PackageExtensionCompat = "1"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
> [!WARNING]
> This package is under active development at the moment and may change its API and supported end systems at any time. End-users are advised to wait until a corresponding release with broader availability is made. Package developers are suggested to try out Reactant for integration, but should be advised of the same risks.
Reactant takes Julia function and compile it into MLIR and run fancy optimizations on top of it, including using EnzymeMLIR for automatic differentiation, and create relevant executables for CPU/GPU/TPU via XLA. It presently operates as a tracing system based off of Cassette. Compiled functions will assume the same control flow pattern as was original taken by objects used at compile time, and control flow (e.g. if, for) as well as any type instabilities will be removed. The benefits of this approach is immediately making all such code available for advanced optimization with little developer effort. This system and corresponding semantics is subject to change to a (potentially partial) source rewriter in the future.
Reactant takes Julia function and compile it into MLIR and run fancy optimizations on top of it, including using EnzymeMLIR for automatic differentiation, and create relevant executables for CPU/GPU/TPU via XLA. It presently operates as a tracing system. Compiled functions will assume the same control flow pattern as was original taken by objects used at compile time, and control flow (e.g. if, for) as well as any type instabilities will be removed. The benefits of this approach is immediately making all such code available for advanced optimization with little developer effort. This system and corresponding semantics is subject to change to a (potentially partial) source rewriter in the future.

Reactant provides two new array types at its core, a ConcreteRArray and a TracedRArray. A ConcreteRArray is an underlying buffer to whatever device data you wish to store and can be created by converting from a regular Julia Array.

Expand Down
Loading

0 comments on commit 906395e

Please sign in to comment.