Giter Club home page Giter Club logo

pt-three-ways's Issues

Variant with bounding volume hierarchy such as a k-d tree?

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.

Sharing benchmarks

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?

Unpredictable::any doesn't produce efficient code with clang

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)

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.