Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion kernel_tuner/backends/hip/hip.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def __init__(self, device=0, iterations=7, compiler_options=None, observers=None
env["pci_bus_id"] = props.pciBusID
env["pci_domain_id"] = props.pciDomainID
env["pci_device_id"] = props.pciDeviceID
env["uuid"] = str(uuid.UUID(bytes=props.uuid.bytes))
# GPUs without a UUID (e.g. iGPUs) report a placeholder that is shorter than the UUID buffer
env["uuid"] = None
if len(props.uuid.bytes) == props.uuid.c_sizeof():
env["uuid"] = str(uuid.UUID(bytes=props.uuid.bytes))
env["hip_driver_version"] = hip_check(hip.hipDriverGetVersion())
env["hip_runtime_version"] = hip_check(hip.hipRuntimeGetVersion())
env["device_properties"] = extract_safe_properties(props)
Expand Down
12 changes: 11 additions & 1 deletion test/test_hip_functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import ctypes
import uuid

import numpy as np
import pytest

Expand Down Expand Up @@ -159,4 +161,12 @@ def test_smem_args(env):
smem_args=dict(size=lambda p: p['block_size_x'] * 4),
verbose=True, lang="HIP")
tune_params = env[-1]
assert len(result) == len(tune_params["block_size_x"])
assert len(result) == len(tune_params["block_size_x"])

@skip_if_no_hip
def test_device_uuid():
"""The device UUID is either valid or None, for GPUs that do not report one (e.g. iGPUs)."""
dev = kt_hip.HipFunctions(0)

device_uuid = dev.env["uuid"]
assert device_uuid is None or isinstance(uuid.UUID(device_uuid), uuid.UUID)
Loading