Skip to content

Commit 19189c5

Browse files
Merge branch 'master' of github.com:KernelTuner/kernel_tuner into pyatf-eval-count-fix
2 parents e1a42eb + 59d3293 commit 19189c5

File tree

8 files changed

+31
-18
lines changed

8 files changed

+31
-18
lines changed

.github/workflows/test-python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
strategy:
2323
matrix:
24-
os: [ubuntu-latest, macos-13]
24+
os: [ubuntu-latest, macos-latest]
2525

2626
steps:
2727
- uses: actions/checkout@v4

doc/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ tornado==6.5.1 ; python_version >= "3.9" and python_version < "3.15"
8282
traitlets==5.14.3 ; python_version >= "3.9" and python_version < "3.15"
8383
typing-extensions==4.12.2 ; python_version >= "3.9" and python_version < "3.15"
8484
tzdata==2025.1 ; python_version >= "3.9" and python_version < "3.15"
85-
urllib3==2.5.0 ; python_version >= "3.9" and python_version < "3.15"
85+
urllib3==2.6.0 ; python_version >= "3.9" and python_version < "3.15"
8686
wcwidth==0.2.13 ; python_version >= "3.9" and python_version < "3.15"
8787
webencodings==0.5.1 ; python_version >= "3.9" and python_version < "3.15"
8888
xmltodict==0.14.2 ; python_version >= "3.9" and python_version < "3.15"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .hip import *
Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from kernel_tuner.backends.backend import GPUBackend
1010
from kernel_tuner.observers.hip import HipRuntimeObserver
11+
from kernel_tuner.backends.hip.util import hip_check
1112

1213
try:
1314
from hip import hip, hiprtc
@@ -31,20 +32,6 @@
3132

3233
hipSuccess = 0
3334

34-
35-
def hip_check(call_result):
36-
"""helper function to check return values of hip calls"""
37-
err = call_result[0]
38-
result = call_result[1:]
39-
if len(result) == 1:
40-
result = result[0]
41-
if isinstance(err, hip.hipError_t) and err != hip.hipError_t.hipSuccess:
42-
_, error_name = hip.hipGetErrorName(err)
43-
_, error_str = hip.hipGetErrorString(err)
44-
raise RuntimeError(f"{error_name}: {error_str}")
45-
return result
46-
47-
4835
class HipFunctions(GPUBackend):
4936
"""Class that groups the HIP functions on maintains state about the device."""
5037

kernel_tuner/backends/hip/util.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
try:
2+
from hip import hip, hiprtc
3+
except (ImportError, RuntimeError):
4+
hip = None
5+
6+
7+
def hip_check(call_result):
8+
"""helper function to check return values of hip calls"""
9+
err = call_result[0]
10+
result = call_result[1:]
11+
if len(result) == 1:
12+
result = result[0]
13+
if isinstance(err, hip.hipError_t) and err != hip.hipError_t.hipSuccess:
14+
_, error_name = hip.hipGetErrorName(err)
15+
_, error_str = hip.hipGetErrorString(err)
16+
raise RuntimeError(f"{error_name}: {error_str}")
17+
return result
18+

kernel_tuner/observers/hip.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22

33
from kernel_tuner.observers.observer import BenchmarkObserver
4+
from kernel_tuner.backends.hip.util import hip_check
45

56
try:
67
from hip import hip, hiprtc
@@ -24,7 +25,7 @@ def __init__(self, dev):
2425

2526
def after_finish(self):
2627
# Time is measured in milliseconds
27-
EventElapsedTime = hip.hipEventElapsedTime(self.start, self.end)
28+
EventElapsedTime = hip_check(hip.hipEventElapsedTime(self.start, self.end))
2829
self.times.append(EventElapsedTime)
2930

3031
def get_results(self):

kernel_tuner/runners/simulation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from kernel_tuner import util
88
from kernel_tuner.runners.runner import Runner
99

10+
1011
_SimulationDevice = namedtuple("_SimulationDevice", ["max_threads", "env", "quiet"])
1112

1213

@@ -91,6 +92,11 @@ def run(self, parameter_space, tuning_options):
9192
if tuning_options.cache and x_int in tuning_options.cache:
9293
result = tuning_options.cache[x_int].copy()
9394

95+
# only compute metrics on configs that have not errored
96+
if tuning_options.metrics and not isinstance(result.get(tuning_options.objective), util.ErrorConfig):
97+
result = util.process_metrics(result, tuning_options.metrics)
98+
99+
94100
# Simulate behavior of sequential runner that when a configuration is
95101
# served from the cache by the sequential runner, the compile_time,
96102
# verification_time, and benchmark_time are set to 0.

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# set the test parameters
1717
verbose = False
18-
python_versions_to_test = ["3.10", "3.11", "3.12", "3.13"] # 3.14 has not yet been officially released so is not tested against, but is allowed by the pyproject.toml
18+
python_versions_to_test = ["3.11", "3.12", "3.13", "3.14"]
1919
nox.options.stop_on_first_error = True
2020
nox.options.error_on_missing_interpreters = True
2121
nox.options.default_venv_backend = 'virtualenv'

0 commit comments

Comments
 (0)