- 
                Notifications
    You must be signed in to change notification settings 
- Fork 79
          EnzymeTestUtils: GPUArray support
          #2692
        
          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
Conversation
| Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@           Coverage Diff           @@
##             main    #2692   +/-   ##
=======================================
  Coverage   72.57%   72.57%           
=======================================
  Files          58       58           
  Lines       18739    18740    +1     
=======================================
+ Hits        13600    13601    +1     
  Misses       5139     5139           ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
| Benchmark Results
 Benchmark PlotsA plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/18851649289/artifacts/4385420597. | 
| Your PR requires formatting changes to meet the project's style guidelines. Click here to view the suggested changes.diff --git a/lib/EnzymeTestUtils/ext/EnzymeTestUtilsGPUArraysCoreExt.jl b/lib/EnzymeTestUtils/ext/EnzymeTestUtilsGPUArraysCoreExt.jl
index efd4baa8..4d64dcfd 100644
--- a/lib/EnzymeTestUtils/ext/EnzymeTestUtilsGPUArraysCoreExt.jl
+++ b/lib/EnzymeTestUtils/ext/EnzymeTestUtilsGPUArraysCoreExt.jl
@@ -7,7 +7,7 @@ using Enzyme
 function EnzymeTestUtils.acopyto!(dst, src::AbstractGPUArray)
     temp = Array{eltype(src)}(undef, size(src))
     Base.copyto!(temp, src)
-    EnzymeTestUtils.acopyto!(dst, temp)
+    return EnzymeTestUtils.acopyto!(dst, temp)
 end
 
 # basic containers: loop over defined elements, recursively converting them to vectors
@@ -55,11 +55,11 @@ function to_vec(x::AbstractGPUArray{<:Complex{<:EnzymeTestUtils.ElementType}}, s
         end
         has_seen && return reshape(seen_xs[x], size(x))
         is_const && return x
-	x_new = Array{eltype(x)}(undef, sz)
+        x_new = Array{eltype(x)}(undef, sz)
         @inbounds @simd for i in 1:length(x)
             x_new[i] = eltype(x)(x_vec_new[i], x_vec_new[i + length(x)])
         end
-	x_new = Core.Typeof(x)(x_new)
+        x_new = Core.Typeof(x)(x_new)
         seen_xs[x] = x_new
         return x_new
     end
@@ -98,7 +98,7 @@ function to_vec(x::AbstractGPUArray, seen_vecs::EnzymeTestUtils.AliasDict)
         end
         has_seen && return reshape(seen_xs[x], size(x))
         is_const && return x
-	x_new = Array{eltype(x_vew_new)}(undef, size(x))
+        x_new = Array{eltype(x_vew_new)}(undef, size(x))
         k = 1
         for i in eachindex(x)
             isassigned(x, i) || continue
@@ -106,7 +106,7 @@ function to_vec(x::AbstractGPUArray, seen_vecs::EnzymeTestUtils.AliasDict)
             x_new[i] = xi
             k += 1
         end
-	x_new = Core.Typeof(x)(x_new)
+        x_new = Core.Typeof(x)(x_new)
         seen_xs[x] = x_new
         return x_new
     end
diff --git a/lib/EnzymeTestUtils/src/to_vec.jl b/lib/EnzymeTestUtils/src/to_vec.jl
index cd6a595e..d974de91 100644
--- a/lib/EnzymeTestUtils/src/to_vec.jl
+++ b/lib/EnzymeTestUtils/src/to_vec.jl
@@ -103,7 +103,7 @@ function append_or_merge(prev::Union{Nothing, Tuple{AbstractVector, Bool}}, newv
         else
             res = Vector{ET2}(undef, length(prev[1]) + length(newv))
             acopyto!(@view(res[1:length(prev[1])]), prev[1])
-            acopyto!(@view(res[length(prev[1])+1:end]), newv)
+            acopyto!(@view(res[(length(prev[1]) + 1):end]), newv)
             return (res, true)
         end
     end | 
| Shouldn't this also support AMDGPU arrays since it's all  | 
GPUArray support
      
No description provided.