Skip to content

Developer Guide

Deyuan Guo edited this page Oct 14, 2024 · 5 revisions

General Code Development

Code Format

  • Google C++ Style Guide: https://google.github.io/styleguide/cppguide.html
  • General code design
    • In general, keep it simple and straightforward
    • Name classes, functions and variables clearly
    • using namespace std; is not recommended. Using explicit std:: can help to differentiate builtin functions.
  • Some common format issues to avoid
    • Trailing spaces
    • Inconsistent indentation
    • Missing new line at the end of a file

Cross Platform Support

  • Tested platforms: Linux and OSX
  • Some details
    • Guard OpenMP dependent code with USE_OPENMP. #pragma is fine.
    • Printf uint64_t with "%llu" triggers warnings in Linux
    • Avoid using OS specific headers such as <immintrin.h>

Submitting A Pull Request (PR)

  • Before submitting a PR, ensure you have fetched the latest changes from the main branch and run make clean followed by make to build the entire project and verify that no existing functionality is broken.
  • A small, focused PR is highly recommended. While it's understood that certain key features may require larger changes, try to keep each PR as concise as possible for easier review.
  • Clear and descriptive commit messages explaining the purpose and scope of the changes is welcomed. And if you are wondering, we don't mind a dash of humor!
  • If your PR addresses a specific issue, be sure to reference it in the description (e.g., “Fixes #123”).
  • Make sure to test your changes and, if applicable, add or update any relevant tests to ensure coverage.
  • Review your code for style and consistency with the coding standards before submitting the PR.

Github Tips

  • Code conflict merging is common and important. When seeing a code conflict, please make sure to merge code properly without breaking others' work.

PIMeval

Pre-commit testing (strongly recommended)

  • When modifying PIMeval infrastructure, please run below tests to make sure all PIMeval behavior changes are well captured:
    • tests/test-functional/run-pre-commit-tests.sh
  • Detailed steps to follow before submitting code
    • Goto tests/test-functional/ directory
    • Run run-pre-commit-tests.sh
      • This script generates a result-local.txt which reflects your local code changes
      • This script compares your local outputs with a reference result-golden.txt, which is being tracked with git
    • If seeing PASSED message
      • PIMeval outputs are well kept
      • Note that this testing does not cover 100% of PIMeval behavior, so please validate more as needed
    • If seeing FAILED message
      • Diff results-golden.txt and results-local.txt, and review all diffs carefully
      • For any PIMeval behavior difference, debug code and understand root cause
        • Warning: Understanding root cause is a must. We don't accept behavior changes with unknown root cause.
      • If changes are not expected, please fix your code
      • If changes are expected, please re-golden results-golden.txt
        • cp result-local.txt results-golden.txt
        • git add results-golden.txt
        • commit results-golden.txt along with your changes that affect PIMeval behavior
        • Warning: Outdated results-golden.txt after a commit will lead to testing failures seen by all developers, with extra effort to root cause and re-golden.

PIMbench