GithubHelp home page GithubHelp logo

Comments (8)

opti-mix avatar opti-mix commented on May 24, 2024 1

OpenCL kernels should use only fixed width types in method signatures and never size_t, as its width is platform-dependent. For the time being, we should probably use uint64_t in ShapeNCHW and the like to match the OpenCL side.

from glow.

lygstate avatar lygstate commented on May 24, 2024

I suggest to add glow_size_t that can be controlled by use.
For some small model, size_t be uint32_t are enough, but for some big
model, we need uint64_t.

from glow.

nadavrot avatar nadavrot commented on May 24, 2024

@lygstate The problem that we ran into was that size_t on the device did not match the size of size_t on the host.

from glow.

lygstate avatar lygstate commented on May 24, 2024

@nadavrot thats why I add a predefined macro in my request

from glow.

lygstate avatar lygstate commented on May 24, 2024

@opti-mix Does uint64_t would affect the OpenCL performance?
cause it's a really big number. For some embbed OpenCL platform.
do uint64_t arithmatic would be costy, so I would suggest the size couuld be configurable.

from glow.

opti-mix avatar opti-mix commented on May 24, 2024

@lygstate get_global_id and the like return size_t according to the OpenCL specification. But size_t could be < 64bit on some OpenCL platforms.

I checked the code of kernels. We currently seem to pass integers as 32bits in signatures. But in inside function bodies we use size_t, ssize_t and inside ShapeNCHW we use 64bits. So, in principle, we could use smaller fixed-width types there.

do uint64_t arithmatic would be costy,

We currently use uint64_t only in ShapeNCHW when we pass the struct as kernel argument. Inside the kernels they are typically assigned to size_t variables.

Have you really seen any performance issues because of this?

so I would suggest the size could be configurable.

We could do this. PRs are welcome!

In any case, the fact you mentioned about the current inconsistency with regards to ShapeNHWC definitions in kernels.cl and in host's C++ is really an issue. They should be made consistent. The obvious fix would be to make the C++ definition use uint64_t for now. Once we provide a way to configure the width, we should use that configured width on both sides.

from glow.

lygstate avatar lygstate commented on May 24, 2024

I have already trying to modify the c++ code to be consistentence with opencl, but cause a lot of compiling errors, there is too much code need to modify, so I prefer modify the opencl code first, and after all, we use configured size in one step。

from glow.

pjaaskel avatar pjaaskel commented on May 24, 2024

#3542 this PR touches this since it changes "size_t" to a Glow-specific "dim_t" which can be fixed to 64b or 32b across Glow.

from glow.

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.