From 60ca0742cb4e75786ba20f553ca8704d5617ba68 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 24 Mar 2025 15:47:42 +0100 Subject: [PATCH] Benchmark: Support running benchmark with HW RT enabled Similar to the regression tests it is possible to append -RT suffix to the compute type to enable hardware ray-tracing. For example HIP_0 will run benchmark on first HIP device without hardware ray-tracing, HIP-RT_0 will run benchmark on the same device but will enable hardware ray-tracing. The downside of this change is that it will make it so METAL device will no longer use HW-RT on M3 and aboce, and explicit METAL-RT is to be used. This is because benchmark was relying on the Auto configuration which has different behavior depending on the device generation. Pull Request: https://projects.blender.org/blender/blender/pulls/136308 --- tests/performance/api/device.py | 2 ++ tests/performance/tests/cycles.py | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/performance/api/device.py b/tests/performance/api/device.py index 3da5eeec01d..01197accb87 100644 --- a/tests/performance/api/device.py +++ b/tests/performance/api/device.py @@ -40,6 +40,8 @@ def get_gpu_device(args: None) -> list: for device in devices: if device.type == device_type: result.append({'type': device.type, 'name': device.name, 'index': index}) + if device.type in {"HIP", "METAL", "ONEAPI"}: + result.append({'type': f"{device.type}-RT", 'name': device.name, 'index': index}) index += 1 return result diff --git a/tests/performance/tests/cycles.py b/tests/performance/tests/cycles.py index 6500d626297..a8310649c86 100644 --- a/tests/performance/tests/cycles.py +++ b/tests/performance/tests/cycles.py @@ -8,9 +8,13 @@ import api def _run(args): import bpy - device_type = args['device_type'] + device_type, suffix = (args['device_type'].split("-") + [""])[:2] + use_hwrt = (suffix == "RT") device_index = args['device_index'] + if suffix not in {"", "RT"}: + raise SystemExit(f"Unknown device type suffix {suffix}") + scene = bpy.context.scene scene.render.engine = 'CYCLES' scene.render.filepath = args['render_filepath'] @@ -45,6 +49,10 @@ def _run(args): else: index += 1 + cprefs.use_hiprt = use_hwrt + cprefs.use_oneapirt = use_hwrt + cprefs.metalrt = 'ON' if use_hwrt else 'OFF' + # Render bpy.ops.render.render(write_still=True)