Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of torch.autograd.profiler_legacy for benchmarks #2149

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 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
8 changes: 7 additions & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ set(CMAKE_CXX_STANDARD 20)

project(TritonBenchmark)

option(USE_IPEX "Use IPEX" ON)
anmyachev marked this conversation as resolved.
Show resolved Hide resolved

if(NOT WIN32)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
endif()

find_package(Python3 COMPONENTS Interpreter)
find_package(Torch REQUIRED)
find_library(TORCH_PYTHON_LIBRARY torch_python PATH "${TORCH_INSTALL_PREFIX}/lib")
find_package(IPEX REQUIRED)

if(USE_IPEX)
string(APPEND CMAKE_CXX_FLAGS " -DUSE_IPEX")
find_package(IPEX REQUIRED)
endif()


# add the XeTLA kernel.
Expand Down
8 changes: 6 additions & 2 deletions benchmarks/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
from setuptools import setup

import torch
import intel_extension_for_pytorch

ipex_cmake_prefix_path = ""
if os.getenv("USE_IPEX", "1") == "1":
anmyachev marked this conversation as resolved.
Show resolved Hide resolved
import intel_extension_for_pytorch
ipex_cmake_prefix_path = f";{intel_extension_for_pytorch.cmake_prefix_path}"


class CMakeBuild():
Expand Down Expand Up @@ -43,7 +47,7 @@ def build_extension(self):
"Ninja", # Ninja is much faster than make
"-DCMAKE_MAKE_PROGRAM=" +
ninja_dir, # Pass explicit path to ninja otherwise cmake may cache a temporary path
f"-DCMAKE_PREFIX_PATH={torch.utils.cmake_prefix_path};{intel_extension_for_pytorch.cmake_prefix_path}",
f"-DCMAKE_PREFIX_PATH={torch.utils.cmake_prefix_path}{ipex_cmake_prefix_path}",
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
"-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=" + self.extdir,
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + self.extdir,
Expand Down
5 changes: 0 additions & 5 deletions benchmarks/triton_kernels_benchmark/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
from triton.runtime import driver
from . import benchmark_driver
from .benchmark_testing import do_bench, assert_close, perf_report, Benchmark # type: ignore # noqa: F401

# replace the launcher with the profilier hook.
driver.active.launcher_cls = benchmark_driver.XPULauncher
Loading
Loading