diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2018-12-18 21:01:42 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-12-18 21:01:42 +0000 |
commit | 6a1b06bcd4826f2de62b975535297d66da150b30 (patch) | |
tree | 0ccc6973d50c11c67de9b5e68b3f64248b6d2aa9 /clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | |
parent | deb54f1b24d72ace50c858787760325ed8f4cde0 (diff) | |
download | bcm5719-llvm-6a1b06bcd4826f2de62b975535297d66da150b30.tar.gz bcm5719-llvm-6a1b06bcd4826f2de62b975535297d66da150b30.zip |
[OPENMP][NVPTX]Emit shared memory buffer for reduction as 128 bytes
buffer.
Seems to me, nvlink has a bug with the proper support of the weakly
linked symbols. It does not allow to define several shared memory buffer
with the different sizes even with the weak linkage. Instead we always
use 128 bytes buffer to prevent nvlink from the error message emission.
llvm-svn: 349540
Diffstat (limited to 'clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp index 59086d219b0..5e2676bf167 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -4518,6 +4518,22 @@ void CGOpenMPRuntimeNVPTX::clear() { Records.UseSharedMemory->setInitializer( llvm::ConstantInt::get(CGM.Int16Ty, UseSharedMemory ? 1 : 0)); } + // Allocate SharedMemorySize buffer for the shared memory. + // FIXME: nvlink does not handle weak linkage correctly (object with the + // different size are reported as erroneous). + // Restore this code as sson as nvlink is fixed. + if (!SharedStaticRD->field_empty()) { + llvm::APInt ArySize(/*numBits=*/64, SharedMemorySize); + QualType SubTy = C.getConstantArrayType( + C.CharTy, ArySize, ArrayType::Normal, /*IndexTypeQuals=*/0); + auto *Field = FieldDecl::Create( + C, SharedStaticRD, SourceLocation(), SourceLocation(), nullptr, SubTy, + C.getTrivialTypeSourceInfo(SubTy, SourceLocation()), + /*BW=*/nullptr, /*Mutable=*/false, + /*InitStyle=*/ICIS_NoInit); + Field->setAccess(AS_public); + SharedStaticRD->addDecl(Field); + } SharedStaticRD->completeDefinition(); if (!SharedStaticRD->field_empty()) { QualType StaticTy = C.getRecordType(SharedStaticRD); |