From 9838c1a6ff895eefd64df90d06bedef276cf7651 Mon Sep 17 00:00:00 2001 From: chenyu Date: Fri, 26 Jul 2024 14:00:23 -0400 Subject: [PATCH] update import style in runtime (#5735) --- tinygrad/runtime/ops_amd.py | 5 +---- tinygrad/runtime/ops_cuda.py | 2 +- tinygrad/runtime/ops_disk.py | 3 +-- tinygrad/runtime/ops_gpu.py | 2 +- tinygrad/runtime/ops_hip.py | 2 +- tinygrad/runtime/ops_nv.py | 5 ++--- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/tinygrad/runtime/ops_amd.py b/tinygrad/runtime/ops_amd.py index 1d5eab4571..38388bc8a4 100644 --- a/tinygrad/runtime/ops_amd.py +++ b/tinygrad/runtime/ops_amd.py @@ -6,10 +6,7 @@ from tinygrad.device import HCQCompiled, HCQAllocator, HCQBuffer, HWComputeQueue HCQSignal, HCQProgram, BufferOptions from tinygrad.helpers import getenv, to_mv, round_up, data64_le, DEBUG, mv_address from tinygrad.renderer.cstyle import AMDRenderer -import tinygrad.runtime.autogen.kfd as kfd -import tinygrad.runtime.autogen.hsa as hsa -import tinygrad.runtime.autogen.amd_gpu as amd_gpu -import tinygrad.runtime.autogen.libc as libc +from tinygrad.runtime.autogen import kfd, hsa, amd_gpu, libc from tinygrad.runtime.support.compiler_hip import AMDCompiler, disasm from tinygrad.runtime.support.elf import elf_loader if getenv("IOCTL"): import extra.hip_gpu_driver.hip_ioctl # noqa: F401 # pylint: disable=unused-import diff --git a/tinygrad/runtime/ops_cuda.py b/tinygrad/runtime/ops_cuda.py index 291ff3f102..8c323fe160 100644 --- a/tinygrad/runtime/ops_cuda.py +++ b/tinygrad/runtime/ops_cuda.py @@ -1,11 +1,11 @@ from __future__ import annotations import ctypes, ctypes.util, functools from typing import Tuple, Optional, List -import tinygrad.runtime.autogen.cuda as cuda from tinygrad.helpers import DEBUG, getenv, from_mv, init_c_var, init_c_struct_t from tinygrad.device import Compiled, BufferOptions, LRUAllocator from tinygrad.renderer.cstyle import CUDARenderer from tinygrad.renderer.assembly import PTXRenderer +from tinygrad.runtime.autogen import cuda from tinygrad.runtime.support.compiler_cuda import cuda_disassemble, pretty_ptx, CUDACompiler, PTXCompiler, PTX, check if getenv("IOCTL"): import extra.nv_gpu_driver.nv_ioctl # noqa: F401 # pylint: disable=unused-import diff --git a/tinygrad/runtime/ops_disk.py b/tinygrad/runtime/ops_disk.py index 24144e2059..9393082e97 100644 --- a/tinygrad/runtime/ops_disk.py +++ b/tinygrad/runtime/ops_disk.py @@ -3,8 +3,7 @@ import os, sys, mmap, _posixshmem, io, ctypes, ctypes.util, platform, contextlib from typing import Optional, Generator, Tuple, Callable, List from tinygrad.helpers import OSX, round_up from tinygrad.device import Compiled, Allocator -import tinygrad.runtime.autogen.io_uring as io_uring -import tinygrad.runtime.autogen.libc as libc +from tinygrad.runtime.autogen import io_uring, libc class DiskBuffer: def __init__(self, device:DiskDevice, size:int, offset=0): diff --git a/tinygrad/runtime/ops_gpu.py b/tinygrad/runtime/ops_gpu.py index d323b5ebe8..2330dace16 100644 --- a/tinygrad/runtime/ops_gpu.py +++ b/tinygrad/runtime/ops_gpu.py @@ -1,7 +1,7 @@ from __future__ import annotations from typing import Tuple, Optional, List, cast import ctypes, functools, hashlib -import tinygrad.runtime.autogen.opencl as cl +from tinygrad.runtime.autogen import opencl as cl from tinygrad.helpers import init_c_var, to_char_p_p, from_mv, OSX, DEBUG from tinygrad.renderer.cstyle import OpenCLRenderer from tinygrad.device import BufferOptions, LRUAllocator, Compiled, Compiler, CompileError diff --git a/tinygrad/runtime/ops_hip.py b/tinygrad/runtime/ops_hip.py index 00dafbbd76..e323d4eaee 100644 --- a/tinygrad/runtime/ops_hip.py +++ b/tinygrad/runtime/ops_hip.py @@ -1,9 +1,9 @@ from __future__ import annotations import ctypes, functools from typing import Tuple -import tinygrad.runtime.autogen.hip as hip from tinygrad.helpers import DEBUG, init_c_var, from_mv, init_c_struct_t from tinygrad.device import Compiled, LRUAllocator, BufferOptions +from tinygrad.runtime.autogen import hip from tinygrad.runtime.support.compiler_hip import AMDCompiler, disasm from tinygrad.renderer.cstyle import HIPRenderer diff --git a/tinygrad/runtime/ops_nv.py b/tinygrad/runtime/ops_nv.py index 339f812404..be2f5156c9 100644 --- a/tinygrad/runtime/ops_nv.py +++ b/tinygrad/runtime/ops_nv.py @@ -5,11 +5,10 @@ from dataclasses import dataclass from tinygrad.device import HCQCompiled, HCQAllocator, HCQBuffer, HWCommandQueue, HWComputeQueue, HWCopyQueue, hcq_command, \ HCQProgram, HCQSignal, BufferOptions from tinygrad.helpers import getenv, mv_address, init_c_struct_t, to_mv, round_up, data64, data64_le, DEBUG, prod +from tinygrad.renderer.assembly import PTXRenderer from tinygrad.renderer.cstyle import NVRenderer from tinygrad.runtime.support.compiler_cuda import CUDACompiler, PTXCompiler, PTX, NVPTXCompiler, NVCompiler -import tinygrad.runtime.autogen.nv_gpu as nv_gpu -from tinygrad.renderer.assembly import PTXRenderer -import tinygrad.runtime.autogen.libc as libc +from tinygrad.runtime.autogen import nv_gpu, libc from tinygrad.runtime.support.elf import elf_loader if getenv("IOCTL"): import extra.nv_gpu_driver.nv_ioctl # noqa: F401 # pylint: disable=unused-import if MOCKGPU:=getenv("MOCKGPU"): import extra.mockgpu.mockgpu # noqa: F401 # pylint: disable=unused-import