Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
WASM
Zig
Javascript
GIMPLE
Ygen
ispc source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
ispc (trunk)
ispc 1.10.0
ispc 1.11.0
ispc 1.12.0
ispc 1.13.0
ispc 1.14.0
ispc 1.14.1
ispc 1.15.0
ispc 1.16.0
ispc 1.16.1
ispc 1.17.0
ispc 1.18.0
ispc 1.19.0
ispc 1.20.0
ispc 1.21.0
ispc 1.22.0
ispc 1.23.0
ispc 1.24.0
ispc 1.25.0
ispc 1.25.3
ispc 1.9.1
ispc 1.9.2
Options
Source code
export uniform float dot_product(const float* uniform a, const float* uniform b, uniform size_t size) { varying float acc = 0.0f; size = size & ~31; // let the compiler know size is multiple of 32 foreach(i = 0...size) { varying float suba = a[i]; varying float subb = b[i]; acc += suba * subb; } return reduce_add(acc); } export uniform float dot_product_multiple_acc(const float* uniform a, const float* uniform b, uniform size_t size) { varying float acc1 = 0.0f; varying float acc2 = 0.0f; size = size & ~31; // let the compiler know size is multiple of 32 for (uniform size_t base = 0; base < size; base += programCount * 2) { varying size_t i1 = base + programIndex; varying size_t i2 = base + programCount + programIndex; varying float suba1 = a[i1]; varying float subb1 = b[i1]; varying float suba2 = a[i2]; varying float subb2 = b[i2]; acc1 += suba1 * subb1; acc2 += suba2 * subb2; } return reduce_add(acc1 + acc2); }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
About the author
Statistics
Changelog
Version tree