Comments (4)
In Example1Generator the innermost dimension in memory of the output buffer is 'c'. That's a small dimension - probably length five in practice given that you're muxing together five things. That means any use of SIMD (vectorization) is going to need to do a strided store to memory instead of a dense vector store, which is very bad for performance.
So if Example1Generator is slow it's probably due to the memory layout of your output buffer. It looks like you're using an autoscheduler, but this is not something an autoscheduler can help with because the memory layout of the output buffer is controlled by the caller.
A fast version of Example1Generator would look like:
Var x("x"), y("y"), c("c");
Func f1;
f1(x, y) = input(x, y) + 10;
Func f2;
f2(x, y) = input(x, y) + 20;
Func f3;
f3(x, y) = input(x, y) + 30;
Func f4;
f4(x, y) = input(x, y) + 40;
Func f5;
f5(x, y) = input(x, y) + 50;
output(x, y, c) = mux(c, {f1(x, y), f2(x, y), f3(x, y), f4(x, y), f5(x, y)});
output.reorder(c, x, y).bound(c, 0, 5).unroll(c).vectorize(x, 16).parallel(y, 8);
Note that 'reorder' just reorders the loops, not the memory layout.
from halide.
It's nothing to do with dimensionality. It's because calling Example2Generator five times reads the input from memory five times, and calling Example1Generator once reads the input from memory once (and then does five things with it). You'd see the same effect in C.
from halide.
Calling Example2Generator once takes about 3ms, but calling Example1Generator once takes 160ms. This is the confusing part for me.
from halide.
Thank you very much for your suggestion, it's very helpful.
from halide.
Related Issues (20)
- Wrong error message when trying to hoist_storage() out a parallel for.
- Metal shader generation should expose needed float16 intrinsics
- Add a Python bindings tutorial example that uses JIT and an autoscheduler? HOT 1
- We should make a cleanly-vectorizing fast-approximation for atan2f. HOT 2
- Runtime error (ambiguous function call) for float16 on Metal backend
- Internal Error at .../anderson2021/SearchSpace.cpp:486 ... Condition failed: !parallel_tilings.empty(): zero parallel tilings HOT 2
- vulkan backend is broken HOT 1
- Build Failure on Ubuntu 20.04 with LLVM 18.0.0 and Halide Main Branch:: Data Layout Mismatch Errors HOT 3
- Anderson2021 autoscheduler fails on inputs larger than 199993 elements HOT 1
- Anderson2021 autoscheduler fails with: Condition failed: at_or_inside_block()
- OpenCL intrinsics for float16 seem to have neg_inf and inf switched
- [vulkan] Broken SIMT mappings for block & thread IDs in CodeGen
- Autoschedulers fail on indirect loads HOT 9
- Introspection segfaults on golang executables HOT 2
- fuzz-cse failure HOT 8
- We should revisit FuncValueBounds depending on the LHS of the Func
- Signed integer overflow occurred during constant-folding caused by autoschedulers
- Invalid schedule generated by Adams2019 autoscheduler
- Internal Error Symbol not found generated by Li2018 autoscheduler
- Error: Atomic predicated store is not supported from Li2018 autoscheduler
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 halide.