-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated CRC32 Power Optimization Changes #2716
Conversation
This pull request is in continuation to the work initiated in pull request #2353 |
@siying Kindly review the changes |
@siying has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@kamasubb can you figure out in Travis why the same .cc file is still built twice? g++ -DROCKSDB_USE_RTTI -g -W -Wextra -Wall -Wsign-compare -Wshadow -Wno-unused-parameter -Werror -I. -I./include -std=c++11 -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DSNAPPY -DGFLAGS=google -DZLIB -DBZIP2 -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -march=native -DROCKSDB_SUPPORT_THREAD_LOCAL -isystem ./third-party/gtest-1.7.0/fused-src -DTRAVIS -O2 -fno-omit-frame-pointer -momit-leaf-frame-pointer -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -c util/threadpool_imp.cc -o util/threadpool_imp.cc.o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend taking the C implementation from antonblanchard/crc32-vpmsum#4 to avoid the complexities of adding asm to the implementation.
The POWER8 references will look dated once P9 and future processors come to market.
rocksdb::SyncPoint::GetInstance()->ClearCallBack( | ||
"NewRandomAccessFile:O_DIRECT"); | ||
rocksdb::SyncPoint::GetInstance()->ClearCallBack( | ||
"NewWritableFile:O_DIRECT"); | ||
rocksdb::SyncPoint::GetInstance()->ClearCallBack("NewWritableFile:O_DIRECT"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add pointless whitespace changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the previous pull request I was asked to run "make format"
Below is the output from make format for your reference. I ran make format on my changes and it is adding these white space changes.
build_tools/format-diff.sh
Detect lines that doesn't follow the format rules:
--- db/db_test_util.cc (before formatting)
+++ db/db_test_util.cc (after formatting)
@@ -292,8 +292,7 @@
!defined(OS_AIX)
rocksdb::SyncPoint::GetInstance()->ClearCallBack(
"NewRandomAccessFile:O_DIRECT");
- rocksdb::SyncPoint::GetInstance()->ClearCallBack(
-
"NewWritableFile:O_DIRECT");
-
rocksdb::SyncPoint::GetInstance()->ClearCallBack("NewWritableFile:O_DIRECT");
#endifbool can_allow_mmap = IsMemoryMappedAccessSupported();
--- tools/db_stress.cc (before formatting)
+++ tools/db_stress.cc (after formatting)
@@ -2370,15 +2370,15 @@
#if !defined(NDEBUG) && !defined(OS_MACOSX) && !defined(OS_WIN) &&
!defined(OS_SOLARIS) && !defined(OS_AIX)
rocksdb::SyncPoint::GetInstance()->SetCallBack(
- "NewWritableFile:O_DIRECT", [&](void* arg) {
-
int* val = static_cast<int*>(arg);
-
*val &= ~O_DIRECT;
- });
-
"NewWritableFile:O_DIRECT", [&](void* arg) {
-
int* val = static_cast<int*>(arg);
-
*val &= ~O_DIRECT;
-
rocksdb::SyncPoint::GetInstance()->SetCallBack(
});
- "NewRandomAccessFile:O_DIRECT", [&](void* arg) {
-
int* val = static_cast<int*>(arg);
-
*val &= ~O_DIRECT;
- });
-
"NewRandomAccessFile:O_DIRECT", [&](void* arg) {
-
int* val = static_cast<int*>(arg);
-
*val &= ~O_DIRECT;
-
rocksdb::SyncPoint::GetInstance()->EnableProcessing();
});
#endif
Does this mean that either the code that got merged did was not run with the "make format" or there is a code bug the "make format"
}); | ||
"NewWritableFile:O_DIRECT", [&](void* arg) { | ||
int* val = static_cast<int*>(arg); | ||
*val &= ~O_DIRECT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add pointless whitespace changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my response above for "db/db_test_util.cc"
@@ -371,6 +394,7 @@ uint32_t ExtendImpl(uint32_t crc, const char* buf, size_t size) { | |||
} | |||
|
|||
// Detect if SS42 or not. | |||
#ifndef HAVE_POWER8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no point wrapping this. There already is a HAVE_SSE42 inside the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wrapping ensures that the function isSSE42() is not defined on Power platform.
If we don't add this, then the isSSE42() is defined which does not have relevance.
} | ||
#endif // __linux__ | ||
|
||
static bool isAltiVec() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return arch_ppc_probe(); would of been simpler and if its that simple why is this wrapped in a different function?
util/crc32c.cc
Outdated
} | ||
|
||
bool IsFastCrc32Supported() { | ||
return isSSE42(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DumpSupportInfo is the only place this is used. I suggest that maybe a string describing the implementation is now a better choice for its output now that there are a variety of implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea.
#define PPC_FEATURE2_VEC_CRYPTO 0x02000000 | ||
#endif | ||
|
||
#ifndef AT_HWCAP2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is always defined on linux. - can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my above comment on freebsd.
|
||
typedef uint32_t (*Function)(uint32_t, const char*, size_t); | ||
|
||
#if defined(HAVE_POWER8) && defined(HAS_ALTIVEC) | ||
uint32_t ExtendPPCImpl(uint32_t crc, const char *buf, size_t size) { | ||
return crc32c_ppc(crc, (const unsigned char *)buf, size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what the point of function wrapping here is.
#include <sys/auxv.h> | ||
|
||
#ifndef PPC_FEATURE2_VEC_CRYPTO | ||
#define PPC_FEATURE2_VEC_CRYPTO 0x02000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is always defined on powerpc64 linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These symbols are present in the header files just above. During an earlier round of review Daniel Axtens had me add these as a backup in case the headers are not found. For example, on powerpc64 freebsd (which doesn't have all the same headers as linux) we hit compilation errors in ceph and had to fix things like this to be more careful.
@siying The fix to it is |
@kamasubb the recent Travis build still has it built twice. |
@siying I am working on an approach that would reduce the changes required to Makefile. |
38bca31
to
95da7e1
Compare
@kamasubb updated the pull request - view changes - changes since last import |
95da7e1
to
de69ecf
Compare
@kamasubb updated the pull request - view changes - changes since last import |
@sagar0 AppVeyor build failed due to heap issue. Kindly resolve the resource/memory issue |
@sagar0 If the AppVeyor build fail issue has been resolved, kindly re-run the AppVeyor build |
@kamasubb Our Appveyor builds have been failing continuously for a few days now, and we haven't gotten to fixing it yet. |
@siying When you get a chance, please let us know if you agree this approach is better. This should hopefully be easier to maintain and should no longer have any problems with ccache or objects being built multiple times. The Makefile changes where the object files were being named .cc.o, .c.o, and .S.o are gone. Now they should all be named .o. |
@kestrels yes, I think not having two files with the same name but different extension .cc and .c sounds a good idea anyway. |
Support for PowerPC Architecture Detecting AltiVec Support
de69ecf
to
8310620
Compare
@kamasubb updated the pull request - view changes - changes since last import |
@siying When you get a chance, please review the new patch |
@siying has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Java build on PPC64le has been broken since a few months, due to #2716. Fixing it with the least amount of changes. (We should cleanup a little around this code when time permits). This should fix the build failures seen in http://140.211.168.68:8080/job/Rocksdb/ . Closes #3359 Differential Revision: D6712938 Pulled By: sagar0 fbshipit-source-id: 3046e8f072180693de2af4762934ec1ace309ca4
Summary: Java build on PPC64le has been broken since a few months, due to #2716. Fixing it with the least amount of changes. (We should cleanup a little around this code when time permits). This should fix the build failures seen in http://140.211.168.68:8080/job/Rocksdb/ . Closes #3359 Differential Revision: D6712938 Pulled By: sagar0 fbshipit-source-id: 3046e8f072180693de2af4762934ec1ace309ca4
Summary: Java build on PPC64le has been broken since a few months, due to facebook#2716. Fixing it with the least amount of changes. (We should cleanup a little around this code when time permits). This should fix the build failures seen in http://140.211.168.68:8080/job/Rocksdb/ . Closes facebook#3359 Differential Revision: D6712938 Pulled By: sagar0 fbshipit-source-id: 3046e8f072180693de2af4762934ec1ace309ca4
Support for PowerPC Architecture
Detecting AltiVec Support