Skip to content

Commit

Permalink
Address lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhan committed Feb 26, 2024
1 parent 8c8885a commit a239298
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 24 deletions.
6 changes: 3 additions & 3 deletions onnxruntime/python/tools/kernel_explorer/kernel_explorer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,23 @@ KE_REGISTER(m) {
#ifdef USE_COMPOSABLE_KERNEL
return true;
#else
return false;
return false;
#endif
});

m.def("is_hipblaslt_available", []() {
#ifdef USE_HIPBLASLT
return true;
#else
return false;
return false;
#endif
});

m.def("is_float8_available", []() {
#ifndef DISABLE_FLOAT8_TYPES
return true;
#else
return false;
return false;
#endif
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# --------------------------------------------------------------------------

import os
import sys
from dataclasses import dataclass
from itertools import product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the MIT License.
# --------------------------------------------------------------------------

import sys
from dataclasses import dataclass

import kernel_explorer as ke
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# --------------------------------------------------------------------------

import re
import sys
from dataclasses import dataclass
from itertools import product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the MIT License.
# --------------------------------------------------------------------------

import sys
from dataclasses import dataclass
from itertools import product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the MIT License.
# --------------------------------------------------------------------------

import sys
from dataclasses import dataclass

import kernel_explorer as ke
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


import os
import sys
from dataclasses import dataclass
from itertools import product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the MIT License.
# --------------------------------------------------------------------------

import sys
from dataclasses import dataclass
from itertools import product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# --------------------------------------------------------------------------

import re
import sys
from dataclasses import dataclass
from itertools import product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
"""This file provides wrapper for native _kernel_explorer.so library and benchmark reporter for operator"""

from __future__ import annotations
from typing import Callable

import ctypes
import os
import json
import os
import sys
from abc import abstractmethod
from argparse import ArgumentParser, Action
from argparse import Action, ArgumentParser
from contextlib import contextmanager
from dataclasses import dataclass
from fnmatch import fnmatch
from functools import wraps
from typing import Callable

build_dir = os.environ.get("KERNEL_EXPLORER_BUILD_DIR", None)
if build_dir is None:
Expand Down Expand Up @@ -71,7 +71,7 @@
del library_files_to_load, library_to_load

# pylint: disable=wrong-import-position, disable=unused-import
import _kernel_explorer # noqa: E402, F401
import _kernel_explorer # noqa: E402

# pylint: disable=wrong-import-position, disable=unused-import, disable=wildcard-import
from _kernel_explorer import * # noqa: F403, E402
Expand All @@ -84,8 +84,8 @@ class _KeContext:
pattern = "*"

# mapping the module to dispatch to
dispatchable = {}
instance_dispatchable = {} # can be filter with pattern
dispatchable: dict | None = None
instance_dispatchable: dict | None = None # can be filter with pattern

dispatch_depth = 0

Expand All @@ -94,6 +94,8 @@ class _KeContext:


_ke_context = _KeContext()
_ke_context.dispatchable = {}
_ke_context.instance_dispatchable = {}


# Benchmark Reporter
Expand Down Expand Up @@ -300,7 +302,8 @@ def wrap_dispatch(f, *args, **kwargs):
if _ke_context.save_tuning_results is not None:
try:
trs = _kernel_explorer.get_collected_tuning_results()
json.dump(trs, open(_ke_context.save_tuning_results, "x"))
with open(_ke_context.save_tuning_results, "x") as f:
json.dump(trs, f)
finally:
pass

Expand All @@ -313,8 +316,9 @@ def wrap_dispatch(f, *args, **kwargs):
return ret
try:
trs = _kernel_explorer.get_collected_tuning_results()
finally:
return trs
finally:
pass

return ret

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the MIT License.
# --------------------------------------------------------------------------

import sys
from dataclasses import dataclass

import kernel_explorer as ke
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# --------------------------------------------------------------------------

import re
import sys
from dataclasses import dataclass
from itertools import product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# --------------------------------------------------------------------------

import re
import sys
from dataclasses import dataclass
from itertools import product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# --------------------------------------------------------------------------

import os
import sys
from dataclasses import dataclass
from itertools import product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the MIT License.
# --------------------------------------------------------------------------

import sys
from dataclasses import dataclass

import kernel_explorer as ke
Expand Down

0 comments on commit a239298

Please sign in to comment.