Comments (7)
These are good ideas. This is actually kind of along the lines of some of the stuff I have been thinking about recently.
And no, please don't stop - I really appreciate all input. Discussion is contribution IMO.
from emu.
If I understand the problem clearly (unability to see code outside of a macro), I see two solutions :
- incorporating iterators into the emu language (inside the
emu!
macro and thus perfectly visible) - using an attribute (
#[emu]
) on the rust functions that use the iterator (you can then extract the iterator and rewrite it).
(As an aside, excuse me for jumping in and offering suggestions about improvement on a project to which I am not contributing. You have done a great job with emu.)
from emu.
Not related to your question @timClicks but the approach I ultimately went with for v0.3.0 is similar to what @nestordemeure described. I don't try to determine the length of the iterator. Rather, I inspect the structure of the for loop and match on one of several pre-defined patterns.
For example, for i in start..end
where start
and end
are float literals is a pattern I handle. for x in &data
where data
is some expression is a pattern I don't yet handle but plan to. for x in data.enumerate().some_other_method()
is not a pattern that I will try to handle.
Basically, at compile-time, I try to come up with expressions that evaluate to a dimensions of the grid.
for i in 0..1000
-1000
for i in 0..(count * 100)
-(count * 100)
for x in &data
-data.len()
from emu.
Yes.
Multiple people have suggested to me letting the user use an iterator. But I can't produce OpenCL code without seeing the code inside the body of the for loop. The user would be limited in what code they can have inside the body of the for loop.
from emu.
@nestordemeure how would an iterator (with unknown length) know how to batch the data? e.g. generating the correct shape of CUDA blocks/grids
from emu.
Really interesting @calebwin. Will take a look into the implementation.
from emu.
Please do!
I have a 3:1 code-to-comment ratio according to loc
and I would be happy to further explain the architecture. Also, this "table of contents" may be helpful..
from emu.
Related Issues (20)
- README instructions have various issues HOT 4
- Benchmarks HOT 3
- Benchmarks + against WebGPU
- Compiling error HOT 8
- Add badges to readme.md HOT 2
- Work group sizes greater than 32 don't work on Intel integrated GPU
- Important internal optimizations, potential bug
- Implementing more traits for `DeviceBox`
- Questions regarding the project HOT 1
- Logo is an ostrich not an emu HOT 1
- Unable to run on Ubuntu 20.04 due to python command HOT 1
- Rustdoc documentation search bar does not work
- Example code given in readme doesn't seem to work HOT 6
- coreaudio-sys AudioUnit compile error on Windows & Linux HOT 2
- em compilation fails, traits not implemented, and some missing imports? HOT 2
- Khronos ML summit
- `.finish()` stage of the shader compilation segfaults on NVIDIA Vulkan driver HOT 1
- Example panics at runtime (`COPY_DST` flag) HOT 4
- How to pass a 2D array of floats? HOT 2
- Current Project Status Update? HOT 2
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 emu.