mattgodbolt / pt-three-ways Goto Github PK
View Code? Open in Web Editor NEWPath tracing, done three ways
License: MIT License
Path tracing, done three ways
License: MIT License
I very much liked the talk.
I would be really interested in how these three techniques would compare performance-wise, if a bounding volume hierarchy, like a k-d tree were to be introduced.
My expectation is that all three versions will speed up dramatically; however I wonder which one of the three is able to benefit from it the most.
Not an issue but here my results. A bit more consistent as opposed to what you mentioned in the talk.
Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (governor performance)
Linux 5.1.11-300.fc30.x86_64
gcc 9.1.1
Test | 1 Thread | 6 Threads |
---|---|---|
cornell | ||
oo | 72 s | 26 s |
fp | 76 s | 28 s |
dod | 64 s | 22 s |
owl | ||
oo | 96 s | 21 s |
fp | 117 s | 30 s |
dod | 66 s | 15 s |
suzanne | ||
oo | 126 s | 193 s |
fp | 102 s | 173 s |
dod | 78 s | 129 s |
P.S. You should add the link to your talk to the Readme, and maybe instruction on how to build.
This worked for me (even without using clion):
git clone https://github.com/mattgodbolt/pt-three-ways.git
cd pt-three-ways
mkdir cmake-build-release
cd cmake-build-release
cmake .. -DCMAKE_BUILD_TYPE=Release
cd ..
scripts/bench-6t-cornell.sh
EDIT: suzanne st and 6t values were. Maybe we should use same sampling?
When building with clang, the Unpredictable::any
workaround will still cause multiple branches, playing havoc with the branch predictor.
Clang has a way to define a branch as being unpredictable and using that yields much better code and on the suzanne scene, my render time dropped from 81s -> 66s
The hacked way i did this was
#if __has_builtin(__builtin_unpredictable)
#define UNPREDICTABLE(x) __builtin_unpredictable(x)
#else
#define UNPREDICTABLE(x) x
#endif
if (UNPREDICTABLE(u < 0.0) || UNPREDICTABLE(u > 1.0)
|| UNPREDICTABLE(v < 0.0) || UNPREDICTABLE((u + v) > 1))
continue;
For the case when that isn't available, I tried using this(which works for gcc too), but clang still emitted branches here
#elif __has_builtin(__builtin_expect_with_probability)
#define UNPREDICTABLE(x) __builtin_expect_with_probability(x, 1, 0.5)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.