This patch puts the individual target region information attributes into a struct so that the nested mappings are not needed and passing the information around is simplified.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LG, one suggestions, not necessary to address
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h | ||
---|---|---|
1826 | const & for all of them? |
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
3031 | Needed StringRef(EntryInfo.ParentName) for this to compile for me. |
This may have broken HWASAN buildbot:
https://lab.llvm.org/buildbot/#/builders/236/builds/786
Running a build just before and after to validate guess based on stack.
log snippet:
==956880==ERROR: HWAddressSanitizer: tag-mismatch on address 0xffffc09c0031 at pc 0xaaaab749fd64 READ of size 1 at 0xffffc09c0031 tags: c6/00 (ptr/mem) in thread T0 #0 0xaaaab749fd64 in djbHash /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/include/llvm/Support/DJB.h:22:24 #1 0xaaaab749fd64 in llvm::StringMapImpl::FindKey(llvm::StringRef) const /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/Support/StringMap.cpp:142:28 #2 0xaaaab6ab1128 in find /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/include/llvm/ADT/StringMap.h:225:18 #3 0xaaaab6ab1128 in lookup /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/include/llvm/ADT/StringMap.h:234:25 #4 0xaaaab6ab1128 in lookup /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/include/llvm/IR/ValueSymbolTable.h:78:17 #5 0xaaaab6ab1128 in llvm::Module::getNamedValue(llvm::StringRef) const /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/lib/IR/Module.cpp:111:58 #6 0xaaaab7c47d2c in clang::CodeGen::CGOpenMPRuntime::createOffloadEntriesAndInfoMetadata() /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp:3077:18 #7 0xaaaab7946c3c in clang::CodeGen::CodeGenModule::Release() /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:537:20 #8 0xaaaab86e223c in (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:286:18 #9 0xaaaab86de0d4 in clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:306:14 #10 0xaaaaba028aac in clang::ParseAST(clang::Sema&, bool, bool) /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/lib/Parse/ParseAST.cpp:196:13 #11 0xaaaab86db730 in clang::CodeGenAction::ExecuteAction() /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1144:30 #12 0xaaaab85971c0 in clang::FrontendAction::Execute() /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1055:8 #13 0xaaaab84ebd70 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1044:33 #14 0xaaaab86d43d4 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:25 #15 0xaaaab42e5520 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/tools/driver/cc1_main.cpp:250:15 #16 0xaaaab42e07f0 in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/tools/driver/driver.cpp:316:12 #17 0xaaaab42e01b8 in clang_main(int, char**) /b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/clang/tools/driver/driver.cpp:388:12 #18 0xffff8d6c73f8 (/lib/aarch64-linux-gnu/libc.so.6+0x273f8) (BuildId: f37f3aa07c797e333fd106472898d361f71798f5) #19 0xffff8d6c74c8 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x274c8) (BuildId: f37f3aa07c797e333fd106472898d361f71798f5) #20 0xaaaab42b5c6c in _start (/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build_hwasan/bin/clang-16+0x5a85c6c)
The bracket builds have finished and they seem to have a conclusive result. The test starts failing with this patch.
Built at this patch: https://lab.llvm.org/buildbot/#/builders/236/builds/803
Built at prior patch: https://lab.llvm.org/buildbot/#/builders/236/builds/804
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
3031 | StringRef(EntryInfo.ParentName) is ref to the scope-local EntryInfo info, so you have HWASAN report here |
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
3031 | Probably meant to change this to const llvm::TargetRegionEntryInfo &EntryInfo to match OffloadTargetRegionEntryInfoActTy? |
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
3031 | Yes, I think there was an inconsistency introduced when I was splitting up my patch. I will work on a fix. |
When I have a fix, is there a way for me to test my code on the buildbot? I don't seem to be able to reproduce the problem on my machine.
If you have access to valgrind it can be reproduced with that too:
clang -cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm-bc target_messages.cpp -o target_messages.cpp.tmp-ppc-host.bc -DREGION_HOST
valgrind clang -cc1 -fopenmp -fopenmp-version=45 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm target_messages.cpp -fopenmp-is-device -fopenmp-host-ir-file-path target_messages.cpp.tmp-ppc-host.bc -o - -DREGION_DEVICE
clang/lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
1909 | Just noticed this debug code left in here. |
Just noticed this debug code left in here.