From e5fed32cc51c7c637bf155ea571732a815e42f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Thu, 4 Jun 2026 05:43:10 -0500 Subject: [PATCH 1/3] add Reactant backend --- src/backends.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backends.jl b/src/backends.jl index 3b5a29aa..20b5d783 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -78,3 +78,12 @@ const StridedBackend = Union{StridedNative, StridedBLAS} Backend for tensor operations that is based on the NVIDIA cuTENSOR library. """ struct cuTENSORBackend <: AbstractBackend end + +# Reactant backend +#----------------- +""" + ReactantBackend + +Backend for tensor operations that works on top of Reactant.jl library. +""" +struct ReactantBackend <: AbstractBackend end From 67c8bdab65557d1e77e093cad90a27a6b230ab9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Thu, 4 Jun 2026 06:13:06 -0500 Subject: [PATCH 2/3] add `ReactantAllocator` --- src/implementation/allocator.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/implementation/allocator.jl b/src/implementation/allocator.jl index 7ac5ea8b..77d0ebb6 100644 --- a/src/implementation/allocator.jl +++ b/src/implementation/allocator.jl @@ -70,6 +70,15 @@ mutable struct BufferAllocator{Storage} end end +""" + ReactantAllocator{IsTraced} + +Allocator for Reactant-backed arrays. If `IsTraced=true`, it is supposed that Reactant is +tracing the code and thus, it will return a `TracedRArray`.Otherwise, it will allocate a +`ConcreteRArray`. +""" +struct ReactantAllocator{IsTraced} end + const DefaultStorageType = @static isdefined(Core, :Memory) ? Memory{UInt8} : Vector{UInt8} BufferAllocator(; kwargs...) = BufferAllocator{DefaultStorageType}(; kwargs...) From 68aee655fc5844e4eef9918ee8feb1efa8b025f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Thu, 4 Jun 2026 10:59:51 -0500 Subject: [PATCH 3/3] add link to Reactant repo in comments --- src/backends.jl | 2 +- src/implementation/allocator.jl | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 20b5d783..cd9969a5 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -84,6 +84,6 @@ struct cuTENSORBackend <: AbstractBackend end """ ReactantBackend -Backend for tensor operations that works on top of Reactant.jl library. +Backend for tensor operations that work on top of [Reactant.jl](https://github.com/EnzymeAD/Reactant.jl) library. """ struct ReactantBackend <: AbstractBackend end diff --git a/src/implementation/allocator.jl b/src/implementation/allocator.jl index 77d0ebb6..6244cfea 100644 --- a/src/implementation/allocator.jl +++ b/src/implementation/allocator.jl @@ -73,8 +73,9 @@ end """ ReactantAllocator{IsTraced} -Allocator for Reactant-backed arrays. If `IsTraced=true`, it is supposed that Reactant is -tracing the code and thus, it will return a `TracedRArray`.Otherwise, it will allocate a +Allocator for [Reactant](https://github.com/EnzymeAD/Reactant.jl)-backed arrays. +If `IsTraced=true`, it is supposed that [Reactant](https://github.com/EnzymeAD/Reactant.jl) +is tracing the code and thus, it will return a `TracedRArray`. Otherwise, it will allocate a `ConcreteRArray`. """ struct ReactantAllocator{IsTraced} end