- 
                Notifications
    
You must be signed in to change notification settings  - Fork 15.1k
 
[StaticDataLayout][PGO]Implement reader and writer change for data access profiles #139997
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
Changes from 13 commits
6cd7d8d
              4727529
              80249bc
              b69c993
              6fe9b48
              df08094
              6dd04e4
              4045c94
              f63fea6
              c5d8fcf
              0fb3e6a
              d3443c7
              c9f1f2b
              5d0e236
              b14f1e2
              09eab64
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -17,10 +17,8 @@ | |
| #ifndef LLVM_PROFILEDATA_DATAACCESSPROF_H_ | ||
| #define LLVM_PROFILEDATA_DATAACCESSPROF_H_ | ||
| 
     | 
||
| #include "llvm/ADT/DenseMap.h" | ||
| #include "llvm/ADT/DenseMapInfoVariant.h" | ||
| #include "llvm/ADT/MapVector.h" | ||
| #include "llvm/ADT/STLExtras.h" | ||
| #include "llvm/ADT/SetVector.h" | ||
| #include "llvm/ADT/SmallVector.h" | ||
| #include "llvm/ADT/StringRef.h" | ||
| 
        
          
        
         | 
    @@ -35,12 +33,15 @@ | |
| 
     | 
||
| namespace llvm { | ||
| 
     | 
||
| namespace data_access_prof { | ||
| namespace memprof { | ||
| 
     | 
||
| /// The location of data in the source code. Used by profile lookup API. | ||
| struct SourceLocation { | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Re: line +38] Should we change this to memprof? Reasoning is that this is closely tied to the memprof profile data format and we don't intend to use it elsewhere. Wdyt? See this comment inline on Graphite. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this makes sense. Renamed namespace in this patch and I'm open to split renames to a separate patch before this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with keeping the rename in this patch.  | 
||
| SourceLocation(StringRef FileNameRef, uint32_t Line) | ||
| : FileName(FileNameRef.str()), Line(Line) {} | ||
| 
     | 
||
| // Empty constructor is used in yaml conversion. | ||
| SourceLocation() {} | ||
                
      
                  snehasish marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| /// The filename where the data is located. | ||
| std::string FileName; | ||
| /// The line number in the source code. | ||
| 
        
          
        
         | 
    @@ -53,6 +54,8 @@ namespace internal { | |
| // which strings are owned by `DataAccessProfData`. Used by `DataAccessProfData` | ||
| // to represent data locations internally. | ||
| struct SourceLocationRef { | ||
| SourceLocationRef(StringRef FileNameRef, uint32_t Line) | ||
| : FileName(FileNameRef), Line(Line) {} | ||
| // The filename where the data is located. | ||
| StringRef FileName; | ||
| // The line number in the source code. | ||
| 
          
            
          
           | 
    @@ -100,18 +103,21 @@ using SymbolHandle = std::variant<std::string, uint64_t>; | |
| /// The data access profiles for a symbol. | ||
| struct DataAccessProfRecord { | ||
| public: | ||
| DataAccessProfRecord(SymbolHandleRef SymHandleRef, | ||
| ArrayRef<internal::SourceLocationRef> LocRefs) { | ||
| DataAccessProfRecord(SymbolHandleRef SymHandleRef, uint64_t AccessCount, | ||
| ArrayRef<internal::SourceLocationRef> LocRefs) | ||
| : AccessCount(AccessCount) { | ||
| if (std::holds_alternative<StringRef>(SymHandleRef)) { | ||
| SymHandle = std::get<StringRef>(SymHandleRef).str(); | ||
| } else | ||
| SymHandle = std::get<uint64_t>(SymHandleRef); | ||
| 
     | 
||
| for (auto Loc : LocRefs) | ||
| Locations.push_back(SourceLocation(Loc.FileName, Loc.Line)); | ||
| Locations.emplace_back(SourceLocation(Loc.FileName, Loc.Line)); | ||
                
      
                  snehasish marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| } | ||
| // Empty constructor is used in yaml conversion. | ||
| DataAccessProfRecord() {} | ||
| SymbolHandle SymHandle; | ||
| 
     | 
||
| uint64_t AccessCount; | ||
| // The locations of data in the source code. Optional. | ||
| SmallVector<SourceLocation> Locations; | ||
| }; | ||
| 
          
            
          
           | 
    @@ -208,7 +214,7 @@ class DataAccessProfData { | |
| llvm::SetVector<StringRef> KnownColdSymbols; | ||
| }; | ||
| 
     | 
||
| } // namespace data_access_prof | ||
| } // namespace memprof | ||
| } // namespace llvm | ||
| 
     | 
||
| #endif // LLVM_PROFILEDATA_DATAACCESSPROF_H_ | ||
Uh oh!
There was an error while loading. Please reload this page.