Skip to content

Commit

Permalink
Merge pull request #2026 from igchor/benchmark_v2
Browse files Browse the repository at this point in the history
[Benchmark] use UR_ADAPTERS_FORCE_LOAD in benchmarks
  • Loading branch information
pbalcer authored Sep 4, 2024
2 parents 6cb61f1 + 2443646 commit cd92304
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/benchmarks_compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,17 @@ jobs:
- name: Build SYCL
run: cmake --build ${{github.workspace}}/sycl_build -j

- name: Set oneAPI Device Selector
run: |
echo "ONEAPI_DEVICE_SELECTOR=${{ matrix.adapter.str_name }}:${{ matrix.adapter.unit }}" >> $GITHUB_ENV
- name: Configure UR
working-directory: ${{github.workspace}}/ur-repo
run: >
cmake -DCMAKE_BUILD_TYPE=Release
-B${{github.workspace}}/ur-repo/build
-DUR_BUILD_TESTS=OFF
-DUR_BUILD_ADAPTER_L0=ON
-DUR_BUILD_ADAPTER_L0_V2=ON
- name: Build UR
run: cmake --build ${{github.workspace}}/ur-repo/build -j $(nproc)

- name: Run benchmarks
id: benchmarks
Expand Down
5 changes: 4 additions & 1 deletion scripts/benchmarks/benches/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
class Benchmark:
def __init__(self, directory):
self.directory = directory
self.adapter_path = os.path.join(options.ur_dir, 'build', 'lib', f"libur_adapter_{options.ur_adapter_name}.so")

def run_bench(self, command, env_vars):
return run(command=command, env_vars=env_vars, add_sycl=True, cwd=options.benchmark_cwd).stdout.decode()
env_vars_with_forced_adapter = env_vars.copy()
env_vars_with_forced_adapter.update({'UR_ADAPTERS_FORCE_LOAD': self.adapter_path})
return run(command=command, env_vars=env_vars_with_forced_adapter, add_sycl=True, cwd=options.benchmark_cwd).stdout.decode()

def create_data_path(self, name):
data_path = os.path.join(self.directory, "data", name)
Expand Down
7 changes: 0 additions & 7 deletions scripts/benchmarks/benches/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class ComputeBench:
def __init__(self, directory):
self.directory = directory
self.built = False
self.adapter_short_name = {'level_zero' : 'L0', "level_zero_v2" : 'L0_V2'}
return

def setup(self):
Expand All @@ -35,19 +34,16 @@ def setup(self):
f"-DALLOW_WARNINGS=ON",
f"-DBUILD_UR=ON",
f"-DUR_BUILD_TESTS=OFF",
f"-DUR_BUILD_ADAPTER_L0=ON",
f"-DUR_BUILD_TESTS=OFF",
f"-DUMF_DISABLE_HWLOC=ON",
f"-DBENCHMARK_UR_SOURCE_DIR={options.ur_dir}",
f"-DUR_BUILD_ADAPTER_{self.adapter_short_name[options.ur_adapter_name]}=ON"
]
run(configure_command, add_sycl=True)

run(f"cmake --build {build_path} -j", add_sycl=True)

self.built = True
self.bins = os.path.join(build_path, 'bin')
self.libs = os.path.join(build_path, 'lib')

class ComputeBenchmark(Benchmark):
def __init__(self, bench, name, test):
Expand Down Expand Up @@ -130,9 +126,6 @@ def name(self):
order = "in order" if self.ioq else "out of order"
return f"api_overhead_benchmark_ur SubmitKernel {order}"

def extra_env_vars(self) -> dict:
return {"UR_ADAPTERS_FORCE_LOAD" : os.path.join(self.bench.libs, f"libur_adapter_{options.ur_adapter_name}.so")}

def bin_args(self) -> list[str]:
return [
f"--Ioq={self.ioq}",
Expand Down

0 comments on commit cd92304

Please sign in to comment.