diff options
author | Henning Baldersheim <balder@oath.com> | 2018-05-11 16:25:53 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-05-11 16:25:53 +0200 |
commit | 515525887fda6957ecbd0a5281a149c8cb545a24 (patch) | |
tree | b6bb2a25a6548e569cf94d9cfa49b8cbbc58962d | |
parent | 7e8c1b10482af25bc186a915491f9e8019c7c88e (diff) |
GC unused code
-rw-r--r-- | fastos/src/tests/.gitignore | 4 | ||||
-rw-r--r-- | fastos/src/tests/CMakeLists.txt | 7 | ||||
-rw-r--r-- | fastos/src/tests/prefetchtest.cpp | 153 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/prefetch.h | 69 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/prefetch_gcc_sparc.h | 41 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/prefetch_gcc_x86_64.h | 44 |
6 files changed, 0 insertions, 318 deletions
diff --git a/fastos/src/tests/.gitignore b/fastos/src/tests/.gitignore index 2af862d201e..ccb5f0210ab 100644 --- a/fastos/src/tests/.gitignore +++ b/fastos/src/tests/.gitignore @@ -3,10 +3,6 @@ /backtracetest.log /filetest /filetest.log -/gmtime -/gmtime.log -/prefetchtest -/prefetchtest.log /processtest /processtest.log /sockettest diff --git a/fastos/src/tests/CMakeLists.txt b/fastos/src/tests/CMakeLists.txt index 6166e4273e6..0a1eddf5262 100644 --- a/fastos/src/tests/CMakeLists.txt +++ b/fastos/src/tests/CMakeLists.txt @@ -5,13 +5,6 @@ vespa_add_executable(fastos_processtest_app TEST DEPENDS fastos ) -vespa_add_executable(fastos_prefetchtest_app TEST - SOURCES - prefetchtest.cpp - DEPENDS - fastos -) -vespa_add_test(NAME fastos_prefetchtest_app NO_VALGRIND COMMAND fastos_prefetchtest_app) vespa_add_executable(fastos_filetest_app TEST SOURCES filetest.cpp diff --git a/fastos/src/tests/prefetchtest.cpp b/fastos/src/tests/prefetchtest.cpp deleted file mode 100644 index fba57e4048f..00000000000 --- a/fastos/src/tests/prefetchtest.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/* - * FastOS_Prefetch test program. - * - * Author: Olaf Birkeland - */ - -#include "tests.h" -#include <vespa/fastos/time.h> -#include <vespa/fastos/prefetch.h> - -class PrefetchTestApp : public BaseTest -{ -public: - virtual ~PrefetchTestApp() {} - - bool PrefetchTest () - { - bool rc = false; - int j, size, *a; - int or1, or2; - FastOS_Time start, stop; - double timeVal; - - TestHeader("Prefetch Test"); - - // 32MB - size = 32; - size *= 1024*1024/sizeof(*a); - - if ((a = static_cast<int *>(calloc(size, sizeof(*a)))) != nullptr) - { - // Standard loop - start.SetNow(); - or1 = 1; - for(j=0; j<size; j++) - or1 |= a[j]; - stop.SetNow(); - timeVal = stop.MilliSecs() - start.MilliSecs(); - Progress(or1==1, "Result = %d", or1); - ProgressFloat(true, "%4.3f MB/s (standard loop)", - float(size*sizeof(*a)/(1E3*timeVal))); - - - // Unrolled loop - start.SetNow(); - or1 = or2 = 2; - for(j=0; j<size; j+=8) - { - or1 |= a[j+0]|a[j+1]|a[j+2]|a[j+3]; - or2 |= a[j+4]|a[j+5]|a[j+6]|a[j+7]; - } - or1 |= or2; - stop.SetNow(); - timeVal = stop.MilliSecs() - start.MilliSecs(); - Progress(or1 == 2, "Result = %d", or1); - ProgressFloat(true, "%4.3f MB/s (unrolled loop)", - float(size*sizeof(*a)/(1E3*timeVal))); - - - // Unrolled loop with prefetch - start.SetNow(); - or1 = or2 = 3; - for(j=0; j<size; j+=8) - { - FastOS_Prefetch::NT(&a[j+32]); - or1 |= a[j+0]|a[j+1]|a[j+2]|a[j+3]; - or2 |= a[j+4]|a[j+5]|a[j+6]|a[j+7]; - } - or1 |= or2; - stop.SetNow(); - timeVal = stop.MilliSecs() - start.MilliSecs(); - Progress(or1 == 3, "Result = %d", or1); - ProgressFloat(true, "%4.3f MB/s (unrolled loop with prefetch)", - float(size*sizeof(*a)/(1E3*timeVal))); - - // Unrolled loop - start.SetNow(); - or1 = or2 = 4; - for(j=0; j<size; j+=8) - { - or1 |= a[j+0]|a[j+1]|a[j+2]|a[j+3]; - or2 |= a[j+4]|a[j+5]|a[j+6]|a[j+7]; - } - or1 |= or2; - stop.SetNow(); - timeVal = stop.MilliSecs() - start.MilliSecs(); - Progress(or1 == 4, "Result = %d", or1); - ProgressFloat(true, "%4.3f MB/s (unrolled loop)", - float(size*sizeof(*a)/(1E3*timeVal))); - - - // Standard loop - start.SetNow(); - or1 = 5; - for(j=0; j<size; j++) - or1 |= a[j]; - stop.SetNow(); - timeVal = stop.MilliSecs() - start.MilliSecs(); - Progress(or1 == 5, "Result = %d", or1); - ProgressFloat(true, "%4.3f MB/s (standard loop)", - float(size*sizeof(*a)/(1E3*timeVal))); - - - // Unrolled loop with prefetch - start.SetNow(); - or1 = or2 = 6; - for(j=0; j<size; j+=8) - { - FastOS_Prefetch::NT(&a[j+32]); - or1 |= a[j+0]|a[j+1]|a[j+2]|a[j+3]; - or2 |= a[j+4]|a[j+5]|a[j+6]|a[j+7]; - } - or1 |= or2; - stop.SetNow(); - timeVal = stop.MilliSecs() - start.MilliSecs(); - Progress(or1 == 6, "Result = %d", or1); - ProgressFloat(true, "%4.3f MB/s (unrolled loop with prefetch)", - float(size*sizeof(*a)/(1E3*timeVal))); - - - free(a); - rc = true; - } - else - Progress(false, "Out of memory!!"); - - PrintSeparator(); - - return rc; - } - - int Main () override - { - int rc = 1; - printf("grep for the string '%s' to detect failures.\n\n", failString); - - if(PrefetchTest()) - rc = 0; - - printf("END OF TEST (%s)\n", _argv[0]); - - return rc; - } -}; - - -int main (int argc, char **argv) -{ - PrefetchTestApp app; - setvbuf(stdout, nullptr, _IOLBF, 8192); - return app.Entry(argc, argv); -} diff --git a/fastos/src/vespa/fastos/prefetch.h b/fastos/src/vespa/fastos/prefetch.h deleted file mode 100644 index 95a54fe4e1a..00000000000 --- a/fastos/src/vespa/fastos/prefetch.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -//************************************************************************ -/** - * @file - * Class definition for FastOS_PrefetchInterface. - * - * @author Olaf Birkeland - */ - -#pragma once - -// If a known architecture/compiler is found, PREFETCH_IMPLEMENTED is -// defined. - - -/** - * The prefetch functions are used to improve cache management. They - * will all try to bring data into cache before actually being needed by the - * code, thus avoiding cache misses. All functions take the address of the - * element to be prefetched as a parameter. An illegal address will NOT cause - * any exceptions, thus prefetch can be used speculatively. - * <p> - * Prefetch is always done in entire cache line sizes. The cache line size is - * platform dependent, and defined by the method @ref GetPrefetchSize() - * (in bytes), usually 32 or 64 bytes. Use this constant to scale the - * unroll-factor of loops etc. Prefetch is applied to the cache line - * surrounding the argument address, thus the argument does not need - * to be aligned in any way. - * <p> - * Prefetch has no side effects, and can be omitted without altering functional - * code behavior (e.g. for easier debugging). Not all implementations have all - * the defined cache levels, thus some functions will be aliases on some - * platforms. - * <p> - * Performance considerations:<br> - * <ul> - * <li>Prefetch only once for each cache line. Manual loop unrolling is thus - * likely to be needed.</li> - * <li>How far ahead prefetch should be used is platform and algorithm - * dependent.</li> - * <li>Prefetching too early can potentially decrease performance due to cache - * trashing.</li></ul> - */ -class FastOS_PrefetchInterface -{ -public: - virtual ~FastOS_PrefetchInterface(void) { } -}; - -#ifdef GCC_X86_64 -# include "prefetch_gcc_x86_64.h" -typedef FastOS_GCCX86_64_Prefetch FASTOS_PREFIX(Prefetch); -#else -/** - * Default fallback for unsupported architecture/compilers - */ -class FastOS_Dummy_Prefetch : public FastOS_PrefetchInterface -{ -public: - inline static int GetPrefetchSize () { return 32; }; - inline static void L0(const void *data) { (void)data; }; - inline static void L1(const void *data) { (void)data; }; - inline static void L2(const void *data) { (void)data; }; - inline static void NT(const void *data) { (void)data; }; -}; -typedef FastOS_Dummy_Prefetch FASTOS_PREFIX(Prefetch); - -#endif - diff --git a/fastos/src/vespa/fastos/prefetch_gcc_sparc.h b/fastos/src/vespa/fastos/prefetch_gcc_sparc.h deleted file mode 100644 index 4729dd83181..00000000000 --- a/fastos/src/vespa/fastos/prefetch_gcc_sparc.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -//************************************************************************ -/** - * Class definition for FastOS_GCCSPARC_Prefetch. - * - * @author Olaf Birkeland - */ - -#pragma once - - -// SPARC on GCC -class FastOS_GCCSPARC_Prefetch : public FastOS_PrefetchInterface -{ - enum Constants - { - PREFETCH_SIZE = 64 - }; - -public: - inline static int GetPrefetchSize () { return PREFETCH_SIZE; } - - inline static void L0 (const void *data) - { - __asm__ ("prefetch [%0], 0" : : "r" (data)); - } - inline static void L1 (const void *data) - { - __asm__ ("prefetch [%0], 0" : : "r" (data)); - } - inline static void L2 (const void *data) - { - __asm__ ("prefetch [%0], 4" : : "r" (data)); - } - inline static void NT (const void *data) - { - __asm__ ("prefetch [%0], 1" : : "r" (data)); - } -}; - - diff --git a/fastos/src/vespa/fastos/prefetch_gcc_x86_64.h b/fastos/src/vespa/fastos/prefetch_gcc_x86_64.h deleted file mode 100644 index 6a54d94af2c..00000000000 --- a/fastos/src/vespa/fastos/prefetch_gcc_x86_64.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -//************************************************************************ -/** - * Class definition for FastOS_GCCX86_64__Prefetch. - * - * @author Olaf Birkeland - */ - -#pragma once - - -// x86 on GCC -class FastOS_GCCX86_64_Prefetch : public FastOS_PrefetchInterface -{ - enum Constants - { - PREFETCH_SIZE = 64 - }; - -public: - inline static int GetPrefetchSize () { return PREFETCH_SIZE; } - - inline static void L0 (const void *data) - { - __asm__("prefetcht0 %0" : : "m" (data)); - } - - inline static void L1 (const void *data) - { - __asm__("prefetcht1 %0" : : "m" (data)); - } - - inline static void L2 (const void *data) - { - __asm__("prefetcht2 %0" : : "m" (data)); - } - - inline static void NT (const void *data) - { - __asm__("prefetchnta %0" : : "m" (data)); - } -}; - - |