Skip to content
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

Require GPUArrays instead of CUDA #1182

Closed
wants to merge 1 commit into from
Closed

Conversation

mcabbott
Copy link
Member

This replaces the special code for CUDA with that for GPUArrays, which is loaded by CUDA. One motivation is things like FluxML/OneHotArrays.jl#9, which runs GPU tests with JLArray.

Could be loaded unconditionally, but would need to check load times? Not the only use of Requires in Zygote.

Comment on lines +263 to -269
# else # CUDA >= 3.0 -- don't need cufunc(f).
# # Ordinary broadcasting calls broadcast_forward anyway when certain its' safe,
# # so perhaps this can be deleted? Possible edge case here:
# # https://github.com/FluxML/Zygote.jl/pull/1018#issuecomment-873629415

@eval @adjoint broadcasted(::CuArrayStyle, f, args...) =
broadcast_forward(f, args...)
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure it's safe to delete these.

Copy link
Member

Choose a reason for hiding this comment

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

If not, changing CuArrayStyle -> AbstractGPUArrayStyle seems pretty safe.


@adjoint (::Type{T})(xs::Array) where {T <: CUDA.CuArray} =
Copy link
Member

Choose a reason for hiding this comment

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

Good opportunity to change these over to rrule(::ZygoteRuleConfig, ...) instead? IME they're much easier to debug than @adjoint definitions.

@mcabbott mcabbott closed this Mar 12, 2022
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