Comments (8)
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.
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.
@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.
@nadavrot thats why I add a predefined macro in my request
from glow.
@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.
@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.
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.
#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)
- [Bug] error on compiling an ONNX model
- Request release - This pull request was **exported** from Phabricator. Differential Revision: [D39456245](https://www.internalfb.com/diff/D39456245) HOT 1
- model-compiler missing HOT 1
- BatchedReduceAdd and BatchedReduceProd multi-axis support
- Where Glow invokes llvm ? HOT 2
- build_Debug error HOT 1
- Multiple tensorflow-lite models in one application
- Glow cmsis support on aarch64
- Typed pointers support will be dropped in LLVM 17 HOT 1
- Compile error when building glow HOT 6
- Error occurred during the compilation of Glow
- FAILED: bin/image-classifier during building glow
- Unable to access glow model HOT 3
- Adding a library for a new backend, CMSIS. HOT 1
- Adding Support for ELU Activation functions
- Evaluate Profile-Guided Optimization (PGO)
- How to build glow for Buildroot based Linux?
- Sunsetting Glow Active Development HOT 1
- Error building on Mac Ventura
- Cannot open connection when downloading pb file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from glow.