Comments (2)
google benchmark should also show similar results, but it needs to prevent optimizations carefully.
however, in general we could just rely on compiler auto-vectorization to optimize this. Using -O3 -ffast-math -march=native
can get much closer to the hand-written intrinsic performance.
#include <benchmark/benchmark.h>
static void BM_inv_sqrt(benchmark::State& state)
{
volatile float x = 4.f;
for (auto _ : state)
{
benchmark::DoNotOptimize(inv_sqrt(x));
benchmark::ClobberMemory();
}
}
static void BM_rsqrt(benchmark::State& state)
{
volatile float x = 4.f;
for (auto _ : state)
{
benchmark::DoNotOptimize(rsqrt(x));
benchmark::ClobberMemory();
}
}
BENCHMARK(BM_inv_sqrt);
BENCHMARK(BM_rsqrt);
BENCHMARK_MAIN();
from vowpal_wabbit.
from GCC doc: https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#x86-Options
-mrecip
This option enables use of RCPSS and RSQRTSS instructions (and their vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step to increase precision instead of DIVSS and SQRTSS (and their vectorized variants) for single-precision floating-point arguments. These instructions are generated only when -funsafe-math-optimizations is enabled together with -ffinite-math-only and -fno-trapping-math. Note that while the throughput of the sequence is higher than the throughput of the non-reciprocal instruction, the precision of the sequence can be decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
Note that GCC implements 1.0f/sqrtf(x) in terms of RSQRTSS (or RSQRTPS) already with -ffast-math (or the above option combination), and doesn’t need -mrecip.
Also note that GCC emits the above sequence with additional Newton-Raphson step for vectorized single-float division and vectorized sqrtf(x) already with -ffast-math (or the above option combination), and doesn’t need -mrecip.
from vowpal_wabbit.
Related Issues (20)
- Coin/FTRL/Pistol are not available via vw.get_config() HOT 1
- Detailed explanation on --explore_eval option for contextual bandits HOT 2
- Classification Multivariate time series : values both categorical and continues HOT 5
- Segmentation fault in CATS HOT 2
- Contextual Bandit vowpal_wabbit training dataset validation HOT 2
- New line is misinterpreted as example
- Binary File Inputs HOT 3
- Your domain is only being misused for illegal gambling promotions in Indonesia HOT 2
- --interact is not working HOT 3
- Slates Json parser error
- Segfault on ccb_explore_adf -cb_type dr HOT 7
- Support for multi-line featuers in --audit_regressor HOT 1
- New installation unable to find boost python lib LINK : fatal error LNK1104: cannot open file 'boost_python312-vc143-mt-x64-1_84.lib' HOT 2
- Sporadic failure in read_span_flatbuffer tests
- Request to daemon hands HOT 2
- Multiclass Classifier Consumes Large Memory HOT 1
- Unexpected predictions when training ccb-model HOT 8
- Incremental Training Best Practice HOT 1
- Cannot build on FreeBSD 13.3 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vowpal_wabbit.