Giter VIP home page Giter VIP logo

db-benchmark-rust's Introduction

DB Benchmark

Auto-vectorisation

Given the following example:

pub fn f(a: &[i32; 4], b: &[i32; 4], c: &mut [i32; 4]) {
  c[0] = a[0] + b[0]
  c[1] = a[1] + b[1]
  c[2] = a[2] + b[2]
  c[3] = a[3] + b[3]
}

The Rust compiler rustc provides two direct flags that control auto-vectorisation. However, rustc does not do any auto-vectorization on its own but uses LLVM for that. However, rustc provides the information to LLVM that allows it to decide which instructions get vectorized.

enabled

example::f:
        movdqu  xmm0, xmmword ptr [rdi]
        movdqu  xmm1, xmmword ptr [rsi]
        paddd   xmm1, xmm0
        movdqu  xmmword ptr [rdx], xmm1
        ret

-no-vectorize-slp

example::f:
        mov     eax, dword ptr [rsi]
        add     eax, dword ptr [rdi]
        mov     dword ptr [rdx], eax
        mov     eax, dword ptr [rsi + 4]
        add     eax, dword ptr [rdi + 4]
        mov     dword ptr [rdx + 4], eax
        mov     eax, dword ptr [rsi + 8]
        add     eax, dword ptr [rdi + 8]
        mov     dword ptr [rdx + 8], eax
        mov     eax, dword ptr [rsi + 12]
        add     eax, dword ptr [rdi + 12]
        mov     dword ptr [rdx + 12], eax
        ret

Since the function does not include a loop, setting no-vectorize-loops has no impact.

To make the comparisons fair, we set both no-vectorize-loops and no-vectorize-slp in our Cargo.toml.

db-benchmark-rust's People

Contributors

nick-lehmann avatar

Watchers

 avatar

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.