mirror of
https://github.com/ROCm/ROCm.git
synced 2026-04-05 03:01:17 -04: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>
69 lines
1.2 KiB
Python
69 lines
1.2 KiB
Python
"""isort:skip_file"""
|
|
__version__ = '2.1.0'
|
|
|
|
# ---------------------------------------
|
|
# Note: import order is significant here.
|
|
|
|
# submodules
|
|
from .runtime import (
|
|
autotune,
|
|
Config,
|
|
heuristics,
|
|
JITFunction,
|
|
KernelInterface,
|
|
reinterpret,
|
|
TensorWrapper,
|
|
OutOfResources,
|
|
MockTensor,
|
|
)
|
|
from .runtime.jit import jit
|
|
from .compiler import compile, CompilationError
|
|
|
|
from . import language
|
|
from . import testing
|
|
|
|
__all__ = [
|
|
"autotune",
|
|
"cdiv",
|
|
"CompilationError",
|
|
"compile",
|
|
"Config",
|
|
"heuristics",
|
|
"impl",
|
|
"jit",
|
|
"JITFunction",
|
|
"KernelInterface",
|
|
"language",
|
|
"MockTensor",
|
|
"next_power_of_2",
|
|
"ops",
|
|
"OutOfResources",
|
|
"reinterpret",
|
|
"runtime",
|
|
"TensorWrapper",
|
|
"testing",
|
|
"tools",
|
|
]
|
|
|
|
# -------------------------------------
|
|
# misc. utilities that don't fit well
|
|
# into any specific module
|
|
# -------------------------------------
|
|
|
|
|
|
def cdiv(x: int, y: int):
|
|
return (x + y - 1) // y
|
|
|
|
|
|
def next_power_of_2(n: int):
|
|
"""Return the smallest power of 2 greater than or equal to n"""
|
|
n -= 1
|
|
n |= n >> 1
|
|
n |= n >> 2
|
|
n |= n >> 4
|
|
n |= n >> 8
|
|
n |= n >> 16
|
|
n |= n >> 32
|
|
n += 1
|
|
return n
|