Coder Social home page Coder Social logo

Comments (4)

zcfh avatar zcfh commented on June 5, 2024

I also got the same error when I ran LlvmPropellerProfileWriterTest. Is it a problem with my build environment or is it due to other reasons?

from autofdo.

zcfh avatar zcfh commented on June 5, 2024

According to the comment information, I adjusted

       if (r == kBuildIdNoteName) {
         // Or use shdr.sh_addralign instead of 0?
-        llvm::ArrayRef<uint8_t> build_id = note.getDesc(/*Align=*/0);
+        llvm::ArrayRef<uint8_t> build_id = note.getDesc(/*Align=*/shdr.sh_addralign);
         std::string build_id_str(build_id.size() * 2, '0');
         int k = 0;
template <class ELFT>
struct Elf_Nhdr_Impl {
  LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
  Elf_Word n_namesz;
  Elf_Word n_descsz;
...

If Align = 0, getDesc will use the offset of n_namesz, this seems to be a bug?

But a new error occurred.

#0 0x00007f9031e48387 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007f9031e48387 in raise () from /lib64/libc.so.6
#1 0x00007f9031e49a78 in abort () from /lib64/libc.so.6
#2 0x00007f9031e411a6 in __assert_fail_base () from /lib64/libc.so.6
#3 0x00007f9031e41252 in __assert_fail () from /lib64/libc.so.6
#4 0x000000000046db9c in llvm::object::BBAddrMap::getFunctionAddress (this=0x7f9028002a10)
     at autofdo/third_party/llvm-project/llvm/include/llvm/Object/ELFTypes.h:924
#5 0x00000000004f052a in devtools_crosstool_autofdo::PropellerWholeProgramInfo::DropNonSelectedFunctions (this=0x29f9270, selected_functions=...)
     at autofdo/llvm_propeller_whole_program_info.cc:584
#6 0x00000000004f1349 in devtools_crosstool_autofdo::PropellerWholeProgramInfo::SelectFunctions (this=0x29f9270,
     cfg_creation_mode=devtools_crosstool_autofdo::CfgCreationMode::kOnlyHotFunctions, lbr_aggregation=0x7fff41e6a808)
     at autofdo/llvm_propeller_whole_program_info.cc:689
#7 0x00000000004f1a57 in devtools_crosstool_autofdo::PropellerWholeProgramInfo::CreateCfgs (this=0x29f9270,
     cfg_creation_mode=devtools_crosstool_autofdo::CfgCreationMode::kOnlyHotFunctions)
     at autofdo/llvm_propeller_whole_program_info.cc:748
#8 0x00000000004dae4c in devtools_crosstool_autofdo::PropellerProfWriter::Create (options=..., perf_data_provider=..., frontend_status=0x29f1440)
     at autofdo/llvm_propeller_profile_writer.cc:158
#9 0x00000000004da8f4 in devtools_crosstool_autofdo::GeneratePropellerProfiles (opts=..., perf_data_provider=...)
     at autofdo/llvm_propeller_profile_writer.cc:121
#10 0x00000000004da56b in devtools_crosstool_autofdo::GeneratePropellerProfiles (opts=...)
     at autofdo/llvm_propeller_profile_writer.cc:92
#11 0x0000000000440b09 in main (argc=8, argv=0x7fff41e6c2f8) at autofdo/create_llvm_prof.cc:197

from autofdo.

zcfh avatar zcfh commented on June 5, 2024

llvm_propeller_whole_program_info.cc

void PropellerWholeProgramInfo::DropNonSelectedFunctions(
    const absl::btree_set<int> &selected_functions) {
  for (int i = 0; i != bb_addr_map_.size(); ++i) {
    if (selected_functions.contains(i))
      continue;
    bb_addr_map_[i].BBRanges.clear();
    bb_addr_map_[i].BBRanges.shrink_to_fit();
    if (!options_.keep_frontend_intermediate_data())
      symtab_.erase(bb_addr_map_[i].getFunctionAddress());
  }
}

In the new llvm api, getFunctionAddress core dumps due to bb_addr_map_[i].BBRanges.clear();.
The address should be saved before call BBRanges.clear();

    uint64_t getFunctionAddress() const {
      assert(!BBRanges.empty());
      Return BBRanges.front().BaseAddress;
    }

from autofdo.

shenhanc78 avatar shenhanc78 commented on June 5, 2024

Fixed buildid and getFunctionAddress problems (so we can drop the --profiled_binary_name flag) with #192 . And as to the performance, we are running experiments to see whether this regress the origin results. Will report back shortly.

from autofdo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.