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

Simplify conversions. #368

Merged
merged 1 commit into from
Jul 23, 2021
Merged

Simplify conversions. #368

merged 1 commit into from
Jul 23, 2021

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Jul 23, 2021

Just rely on a constructor to do the AbstractArray -> <:AbstractGPUArray conversion (coverage indicated these weren't used anyway). I hope to one day reinstate those actual constructors, i.e. what was removed in #169, but those are very tricky (wrt. ambiguities, and there being no interface to go from a ::Type{<:AbstractGPUArray{T,N}} to a concrete <:AbstractGPUArray{S,N}).

@maleadt maleadt merged commit 285ba92 into master Jul 23, 2021
@bors bors bot deleted the tb/convert branch July 23, 2021 08:05
@@ -1,5 +1,14 @@
# convenience and indirect construction

# conversions from CPU arrays rely on constructors
Base.convert(::Type{T}, a::AbstractArray) where {T<:AbstractGPUArray} = a isa T ? a : T(a)
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a potential for a lot of invalidations. Was that checked?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I didn't check for that. We did used to have a Base.convert(AT::Type{<: AbstractGPUArray}, iter) method though, which is worse (right?), and I don't remember this convert method standing out when I had a quick look at invalidations a couple of weeks ago.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this should at least be better. Interesting.

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