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
This commit is contained in:
Sergey Sharybin
2025-03-24 15:47:42 +01:00
committed by Sergey Sharybin
parent b524d0fe39
commit 60ca0742cb
2 changed files with 11 additions and 1 deletions

View File

@@ -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

View File

@@ -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)