Giter VIP home page Giter VIP logo

Comments (6)

christiangnrd avatar christiangnrd commented on September 22, 2024 1

For now I think a decent solution would be to add Int128/UInt128 to check_eltype and then make adapt_storage specific to Float64 which would have the (intended) side-effect of BigFloat erroring for not being stored inline.

from metal.jl.

maleadt avatar maleadt commented on September 22, 2024

mtl[] does not seem to adapt datatypes like mtl([]) does

This functionality is terrible and should be removed. mtl is a function, mtl[...] is a horrible pun. I forgot I had ported that over from CUDA.jl, where IIRC I've removed it since.

from metal.jl.

christiangnrd avatar christiangnrd commented on September 22, 2024

I'm the one that ported it in #194. I probably noticed it didn't behave like CUDA and took the opportunity to "fix" it. My apologies. What about the second thing? If it's intended I'll repurpose the pull request to remove mtl[...] only.

from metal.jl.

maleadt avatar maleadt commented on September 22, 2024

Ah, I see. Unless you feel strongly, I would vote for removing it again (even though that would be a breaking change, so we should verify nobody is relying on it). It's IMO not a good API.

mtl(Float16[]) does not promote up to Float32 but mtl(ComplexF16[]) promotes up to ComplexF32

Yeah that seems wrong, neither should promote. I guess the same bug will exist in CUDA.jl as well, and I wonder if we shouldn't just restrict the scope of the promotion to only Float64->Float32 and the complex equivalents (so that it doesn't cover Float16 and whatever we add in the future): https://github.com/JuliaGPU/CUDA.jl/blob/7a9a0a2a6becc4fba27fc664d1051194037a41e6/src/array.jl#L737-L748

from metal.jl.

christiangnrd avatar christiangnrd commented on September 22, 2024

Ah, I see. Unless you feel strongly, I would vote for removing it again (even though that would be a breaking change, so we should verify nobody is relying on it). It's IMO not a good API.

Not at all. I've updated the PR to remove it.

I wonder if we shouldn't just restrict the scope of the promotion to only Float64->Float32 and the complex equivalents (so that it doesn't cover Float16 and whatever we add in the future)

Float16 promotion is explicitly covered here. Would explicitly preventing promotion on the supported types and then defaulting to promoting to Float64 for any other AbstractFloat be better? That way types like BigFloat also get converted to Float32.

from metal.jl.

maleadt avatar maleadt commented on September 22, 2024

That way types like BigFloat also get converted to Float32.

I know it behaves like that right now, but I'm not sure that's great. Generally, we're pretty strict wrt. (dis)allowing types in GPU kernels, so transparently supporting BigFloat when working with arrays (and losing a bunch of precision because of that conversion) seems questionable to me. The exception has been Float64->Float32 because of the massive performance difference on consumer hardware.

from metal.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.