Skip to content
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

Reformat Python code with yapf. #2589

Merged
merged 4 commits into from
Nov 3, 2023
Merged

Reformat Python code with yapf. #2589

merged 4 commits into from
Nov 3, 2023

Commits on Nov 3, 2023

  1. Reformat Python code with yapf.

    I've add an option to yapf to do what we want for long lines, see
    google/yapf#1177.  We can now have a real Python
    formatter, yay!
    
    To make this PR, I ran my modified yapf over the repository, then looked
    over the full diff.  Where yapf was mangling the param list of long
    function decls/calls (mostly kernels), I manually added `#` to put
    linebreaks where we want.  I fixed up other formatting too -- mostly
    adding or removing a trailing comma from lists.
    
    Overall, trailing `#` was sufficient to get formatting similar to our
    current code.  I didn't have to disable yapf anywhere.
    jlebar committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    7e27146 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e8615d9 View commit details
    Browse the repository at this point in the history
  3. Don't auto-format test_line_info.

    We don't want to auto-format this file, because the test depends on the
    exact formatting of the code in the file.
    jlebar committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    63562f1 View commit details
    Browse the repository at this point in the history
  4. Add a blank line to code_generator.py.

    Without this, the line-info test fails.
    
      python -m pytest python/triton/compiler/code_generator.py
    
    Fails 10/10 times without this blank line, passes 10/10 times with the
    blank line.
    
    The failure is in call_noinline and multi_files, both of which generate
    incorrect line numbers.
    
    I have absolutely no idea what is going on.
    jlebar committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    9ad6ab8 View commit details
    Browse the repository at this point in the history