Skip to content

Commit

Permalink
Add NoFree to __catalyst_inactive_callback && Update Enzyme to versio…
Browse files Browse the repository at this point in the history
…n 0.0.130 (#898)

**Context:**
Update to use latest Enzyme release.
**Description of the Change:**
I added `NoFree` attribute to the function
`__catalyst_inactive_callback` in order to be compatible with Enzyme
changes in this PR EnzymeAD/Enzyme#1687.
  • Loading branch information
rmoyard committed Jul 5, 2024
1 parent 1e8e821 commit 6b925c2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .dep-versions
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
jax=0.4.23
mhlo=4611968a5f6818e6bdfb82217b9e836e0400bba9
llvm=cd9a641613eddf25d4b25eaa96b2c393d401d42c
enzyme=1beb98b51442d50652eaa3ffb9574f4720d611f1
enzyme=v0.0.130

# Always remove custom PL/LQ versions before release.
pennylane=d90137dd8f6af46699653deda5f839c27701769f
Expand Down
6 changes: 6 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

<h3>Improvements</h3>

* Catalyst is now compatible with Enzyme `v0.0.130`
[(#898)](https://github.com/PennyLaneAI/catalyst/pull/898)

* Added support for the jax.numpy.argsort function so it works when compiled with qjit.
[(#901)](https://github.com/PennyLaneAI/catalyst/pull/901)

Expand All @@ -18,6 +21,9 @@
* The function `inactive_callback` was renamed `__catalyst_inactive_callback`.
[(#899)](https://github.com/PennyLaneAI/catalyst/pull/899)

* The function `__catalyst_inactive_callback` has the nofree attribute.
[(#898)](https://github.com/PennyLaneAI/catalyst/pull/898)

<h3>Contributors</h3>

This release contains contributions from (in alphabetical order):
Expand Down
2 changes: 1 addition & 1 deletion mlir/Enzyme
Submodule Enzyme updated 222 files
5 changes: 4 additions & 1 deletion mlir/lib/Catalyst/Transforms/catalyst_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,10 @@ struct DefineCallbackOpPattern : public OpConversionPattern<CallbackOp> {
LLVM::LLVMFuncOp customCallFnOp = mlir::LLVM::lookupOrCreateFn(
mod, "__catalyst_inactive_callback", {/*args=*/i64, i64, i64},
/*ret_type=*/voidType, isVarArg);

SmallVector<Attribute> passthroughs;
auto keyAttr = StringAttr::get(ctx, "nofree");
passthroughs.push_back(keyAttr);
customCallFnOp.setPassthroughAttr(ArrayAttr::get(ctx, passthroughs));
// TODO: remove redundant alloca+store since ultimately we'll receive struct*
for (auto arg : op.getArguments()) {
Type structTy = typeConverter->convertType(arg.getType());
Expand Down
1 change: 1 addition & 0 deletions mlir/test/Catalyst/ConversionTest.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ module @test0 {
// CHECK-LABEL: @test1
module @test1 {
catalyst.callback @callback_1(memref<f64>, memref<f64>) attributes {argc = 1 : i64, id = 1 : i64, resc = 1 : i64}
// CHECK: __catalyst_inactive_callback(i64, i64, i64, ...) attributes {passthrough = ["nofree"]}
// CHECK-LABEL: func.func private @foo(
// CHECK-SAME: [[arg0:%.+]]: tensor<f64>
// CHECK-SAME:)
Expand Down

0 comments on commit 6b925c2

Please sign in to comment.