mirror of
https://github.com/ROCm/ROCm.git
synced 2026-02-21 03:00:39 -05:00
I've add an option to yapf to do what we want for long lines, see https://github.com/google/yapf/pull/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. --------- Co-authored-by: Phil Tillet <phil@openai.com>
21 lines
400 B
Python
21 lines
400 B
Python
from __future__ import annotations
|
|
|
|
import torch
|
|
|
|
import triton
|
|
import triton.language as tl
|
|
|
|
|
|
def test_annotations(device):
|
|
|
|
@triton.jit
|
|
def _kernel(X: torch.Tensor, N: int, BLOCK_SIZE: tl.constexpr):
|
|
pass
|
|
|
|
x = torch.empty(1, device=device)
|
|
_kernel[(1, )](x, x.shape[0], 32)
|
|
try:
|
|
_kernel[(1, )](x.shape[0], x.shape[0], 32)
|
|
except AttributeError:
|
|
pass
|