![]() |
Shamrock 2025.10.0
Astrophysical Code
|
Integer ALU throughput benchmark (multiply chains vs add chains). More...
#include "shambase/time.hpp"#include "shambackends/DeviceBuffer.hpp"#include "shambackends/DeviceScheduler.hpp"#include <type_traits>Go to the source code of this file.
Classes | |
| struct | sham::benchmarks::int_chains_result |
| Structure containing the results of an int_chains benchmark. More... | |
Namespaces | |
| namespace | sham |
| namespace for backends this one is named only sham since shambackends is too long to write | |
Macros | |
| #define | IMAD_4(x, y) |
| #define | IMAD_16(x, y) |
| #define | IADD_4(x, y) |
| #define | IADD_16(x, y) |
Enumerations | |
| enum class | sham::benchmarks::IntChainOp { Mul , Add } |
| Which integer operation a chain is built from. More... | |
Functions | |
| template<class T, IntChainOp op> | |
| void | sham::benchmarks::int_chains (u32 i, int nrotation, T y0, T *__restrict in, T *__restrict out) |
| Kernel for the int_chains benchmark. | |
| template<class T, IntChainOp op> | |
| int_chains_result | sham::benchmarks::int_chains_bench (DeviceScheduler_ptr sched, int N, f64 time_threshold) |
| Run the int_chains benchmark. | |
Integer ALU throughput benchmark (multiply chains vs add chains).
Mirrors the structure of fma_chains.hpp, but on unsigned integers. Running the multiply and the add variants gives the multiply/add throughput ratio, which differs strongly across vendors: GCN-derived architectures issue a 32 bit integer multiply at a fraction of the rate of an add, while architectures with a dedicated integer pipe do not.
Definition in file int_chains.hpp.
| #define IADD_16 | ( | x, | |
| y ) |
Definition at line 55 of file int_chains.hpp.
| #define IADD_4 | ( | x, | |
| y ) |
Definition at line 50 of file int_chains.hpp.
| #define IMAD_16 | ( | x, | |
| y ) |
Definition at line 44 of file int_chains.hpp.
| #define IMAD_4 | ( | x, | |
| y ) |
Definition at line 39 of file int_chains.hpp.
|
strong |
Which integer operation a chain is built from.
| Enumerator | |
|---|---|
| Mul | multiply-add chains, 16 multiplies + 16 adds per rotation |
| Add | add-only chains, 32 adds per rotation |
Definition at line 32 of file int_chains.hpp.
|
inline |
Kernel for the int_chains benchmark.
Dependent integer chains, long enough to hide memory latency and expose the integer issue rate. T must be unsigned so that the wraparound the chains rely on is defined behaviour.
| T | value type of the input and output vectors |
| op | operation the chain is built from |
| i | index of the element to process |
| nrotation | number of chain rotations to apply |
| y0 | initial value of the second chain register |
| in | input vector |
| out | output vector |
Definition at line 77 of file int_chains.hpp.
|
inline |
Run the int_chains benchmark.
| T | unsigned value type used in the benchmark |
| op | operation the chains are built from |
| sched | scheduler for the target device |
| N | number of elements (independent chains) to process |
| time_threshold | minimum wall-clock time to run the benchmark in seconds |
Definition at line 116 of file int_chains.hpp.