Skip to content

Add some CUDA-specific tests for EnzymeTestUtils#3105

Open
kshyatt wants to merge 7 commits into
mainfrom
ksh/cu2vec
Open

Add some CUDA-specific tests for EnzymeTestUtils#3105
kshyatt wants to merge 7 commits into
mainfrom
ksh/cu2vec

Conversation

@kshyatt

@kshyatt kshyatt commented May 15, 2026

Copy link
Copy Markdown
Collaborator

I'm really the dog-with-chemistry-set meme here but tried to actually test some of this and see if it works, it seems there is some stuff that isn't quite functioning?

@kshyatt kshyatt requested a review from wsmoses May 15, 2026 11:00
@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/lib/EnzymeTestUtils/ext/EnzymeTestUtilsGPUArraysCoreExt.jl b/lib/EnzymeTestUtils/ext/EnzymeTestUtilsGPUArraysCoreExt.jl
index ab3231ef..e50566f1 100644
--- a/lib/EnzymeTestUtils/ext/EnzymeTestUtilsGPUArraysCoreExt.jl
+++ b/lib/EnzymeTestUtils/ext/EnzymeTestUtilsGPUArraysCoreExt.jl
@@ -57,7 +57,7 @@ function EnzymeTestUtils.to_vec(x::AbstractGPUArray{<:Complex{<:EnzymeTestUtils.
         is_const && return x
         x_new = Core.Typeof(x)(undef, sz)
         x_vec_new_real = view(x_vec_new, 1:length(x))
-        x_vec_new_imag = view(x_vec_new, (length(x) + 1):(2*length(x)))
+        x_vec_new_imag = view(x_vec_new, (length(x) + 1):(2 * length(x)))
         x_vec_complex = reshape(complex.(x_vec_new_real, x_vec_new_imag), sz)
         x_new .= x_vec_complex
         seen_xs[x] = x_new

@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results

main 894c622... main / 894c622...
basics/make_zero/namedtuple 0.0554 ± 0.0041 μs 0.0547 ± 0.0032 μs 1.01 ± 0.096
basics/make_zero/struct 0.251 ± 0.0062 μs 0.249 ± 0.0064 μs 1.01 ± 0.036
basics/overhead 4.89 ± 0.001 ns 4.89 ± 0.001 ns 1 ± 0.00029
basics/remake_zero!/namedtuple 0.229 ± 0.0084 μs 0.235 ± 0.0092 μs 0.976 ± 0.052
basics/remake_zero!/struct 0.23 ± 0.01 μs 0.234 ± 0.01 μs 0.983 ± 0.062
fold_broadcast/multidim_sum_bcast/1D 10.4 ± 0.3 μs 10.5 ± 2.2 μs 0.985 ± 0.21
fold_broadcast/multidim_sum_bcast/2D 12.7 ± 0.39 μs 12.8 ± 0.37 μs 0.995 ± 0.042
time_to_load 1.09 ± 0.0068 s 1.09 ± 0.002 s 0.999 ± 0.0065

Benchmark Plots

A plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/27195096884/artifacts/7503162974.

Comment thread lib/EnzymeTestUtils/ext/EnzymeTestUtilsGPUArraysCoreExt.jl Outdated
Comment thread lib/EnzymeTestUtils/Project.toml Outdated
Comment thread lib/EnzymeTestUtils/test/runtests.jl
@wsmoses wsmoses requested a review from vchuravy May 27, 2026 05:53

function test_to_vec(x)
x_vec, from_vec = to_vec(x)
@test x_vec isa CuVector{<:AbstractFloat}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

alternatively you could maybe use jlarrays here to test on cpu?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

why not both 😈

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fair nuff

@kshyatt

kshyatt commented May 28, 2026

Copy link
Copy Markdown
Collaborator Author

lol ok the complex one needs help if anyone can spare a moment, it's cool this extension was just totally not working for months haha

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