Skip to content

Commit 97ba60e

Browse files
authored
Remove usage of torch.autograd.profiler_legacy for benchmarks; remove IPEX (#2149)
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent b9afb6c commit 97ba60e

24 files changed

+15
-565
lines changed

.github/actions/setup-ipex/action.yml

Lines changed: 0 additions & 84 deletions
This file was deleted.

.github/actions/setup-no-op-ipex/action.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/triton-benchmarks.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ on:
1616
description: The method used to obtain performance numbers
1717
type: choice
1818
options:
19-
- PYTORCH_LEGACY_PROFILER_USING_IPEX
2019
- ELAPSED_TIME
2120
- UPSTREAM_PYTORCH_PROFILER
2221
default: UPSTREAM_PYTORCH_PROFILER
@@ -54,7 +53,6 @@ permissions: read-all
5453
env:
5554
PYTHON_VERSION: "3.10"
5655
BENCHMARKING_METHOD: ${{ inputs.benchmarking_method || 'UPSTREAM_PYTORCH_PROFILER' }}
57-
USE_IPEX: ${{ (inputs.benchmarking_method || 'UPSTREAM_PYTORCH_PROFILER') == 'PYTORCH_LEGACY_PROFILER_USING_IPEX' && '1' || '0' }}
5856
TAG: ${{ inputs.tag || (github.event_name == 'pull_request' && format('pr-{0}', github.event.number)) || (github.event_name == 'schedule' && 'ci') || 'test' }}
5957

6058
jobs:
@@ -113,22 +111,11 @@ jobs:
113111
run: |
114112
pip install wheel cmake
115113
116-
- name: Setup PyTorch with IPEX
117-
if: ${{ env.USE_IPEX == '1' }}
118-
uses: ./.github/actions/setup-pytorch
119-
with:
120-
repository: Stonepia/pytorch
121-
122-
- name: Setup PyTorch without IPEX
123-
if: ${{ env.USE_IPEX == '0' }}
114+
- name: Setup PyTorch
124115
uses: ./.github/actions/setup-pytorch
125116
with:
126117
repository: pytorch/pytorch
127118

128-
- name: Setup IPEX
129-
if: ${{ env.USE_IPEX == '1' }}
130-
uses: ./.github/actions/setup-ipex
131-
132119
- name: Build Triton wheels
133120
uses: ./.github/actions/setup-triton
134121
with:

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ repos:
6767
- id: pylint
6868
name: pylint for scripts
6969
files: '^scripts/.*\.py$'
70-
# FIXME: will be deleted soon
71-
exclude: '^scripts/create-noop-ipex\.py$'
7270
args:
7371
- --check-quote-consistency=true
7472
# Max line length 120 is consistent with ruff's one in upstream

benchmarks/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ set(CMAKE_CXX_STANDARD 20)
44

55
project(TritonBenchmark)
66

7-
option(USE_IPEX "Use IPEX" ON)
8-
97
if(NOT WIN32)
108
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
119
endif()
@@ -16,11 +14,5 @@ find_package(Torch REQUIRED)
1614
find_library(TORCH_PYTHON_LIBRARY torch_python PATH "${TORCH_INSTALL_PREFIX}/lib")
1715
find_package(XeTLALibrary REQUIRED)
1816

19-
if(USE_IPEX)
20-
string(APPEND CMAKE_CXX_FLAGS " -DUSE_IPEX")
21-
find_package(IPEX REQUIRED)
22-
endif()
23-
24-
2517
# add the XeTLA kernel.
2618
add_subdirectory(xetla_kernel)

benchmarks/micro_benchmarks/conversion/float_conversion/float_conversion.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
import os
2-
31
import torch
42
import triton
53
import triton.language as tl
64

7-
if os.getenv('USE_IPEX', '1') == '1':
8-
import intel_extension_for_pytorch # type: ignore # noqa: F401
9-
105

116
@triton.jit
127
def float_trunc_kernel(

benchmarks/setup.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,15 @@ def __init__(self, build_lib, build_temp, debug=False, dry_run=False):
2828
self.extdir = build_lib + "/triton_kernels_benchmark"
2929
self.build_type = self.get_build_type(debug)
3030
self.cmake_prefix_paths = [torch.utils.cmake_prefix_path]
31-
self.use_ipex = False
3231
self.dry_run = dry_run
3332

3433
def get_build_type(self, debug):
3534
DEBUG_OPTION = os.getenv("DEBUG", "0")
3635
return "Debug" if debug or (DEBUG_OPTION == "1") else "Release"
3736

3837
def run(self):
39-
self.check_ipex()
4038
self.build_extension()
4139

42-
def check_ipex(self):
43-
self.use_ipex = os.getenv("USE_IPEX", "1") == "1"
44-
if not self.use_ipex:
45-
return
46-
try:
47-
import intel_extension_for_pytorch
48-
except ImportError:
49-
log.warn("ipex is not installed trying to build without ipex")
50-
self.use_ipex = False
51-
return
52-
self.cmake_prefix_paths.append(intel_extension_for_pytorch.cmake_prefix_path)
53-
5440
def check_call(self, *popenargs, **kwargs):
5541
log.info(" ".join(popenargs[0]))
5642
if not self.dry_run:
@@ -67,7 +53,6 @@ def build_extension(self):
6753
"-DCMAKE_MAKE_PROGRAM=" +
6854
ninja_dir, # Pass explicit path to ninja otherwise cmake may cache a temporary path
6955
"-DCMAKE_PREFIX_PATH=" + ";".join(self.cmake_prefix_paths),
70-
f"-DUSE_IPEX={int(self.use_ipex)}",
7156
"-DCMAKE_INSTALL_PREFIX=" + self.extdir,
7257
"-DPython3_ROOT_DIR:FILEPATH=" + sys.exec_prefix,
7358
"-DCMAKE_C_COMPILER=icx",
@@ -141,7 +126,6 @@ def get_git_commit_hash(length=8):
141126
},
142127
ext_modules=[CMakeExtension("triton_kernels_benchmark.xetla_kernel")],
143128
extras_require={
144-
"ipex": ["numpy<=2.0", "intel-extension-for-pytorch==2.1.10"],
145129
"pytorch": ["torch>=2.6"],
146130
},
147131
)

benchmarks/triton_kernels_benchmark/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from .benchmark_testing import do_bench, assert_close, perf_report, Benchmark, USE_IPEX_OPTION, BENCHMARKING_METHOD # type: ignore # noqa: F401
1+
from .benchmark_testing import do_bench, assert_close, perf_report, Benchmark, BENCHMARKING_METHOD # type: ignore # noqa: F401
22

3-
if USE_IPEX_OPTION or BENCHMARKING_METHOD == "UPSTREAM_PYTORCH_PROFILER":
3+
if BENCHMARKING_METHOD == "UPSTREAM_PYTORCH_PROFILER":
44
from triton.runtime import driver
55
from . import benchmark_driver
66
# replace the launcher with the profilier hook.

benchmarks/triton_kernels_benchmark/benchmark_driver.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
import torch
1313

14-
from .benchmark_testing import USE_IPEX_OPTION
15-
1614
_dirname = os.getenv("ZE_PATH", default="/usr/local")
1715

1816
include_dir = [
@@ -31,13 +29,6 @@
3129
library_dir = [os.path.join(_dirname, "lib"), os.path.join(torch.utils.cmake_prefix_path, "../../lib")]
3230
libraries = ["ze_loader", "sycl", "torch"]
3331

34-
if USE_IPEX_OPTION:
35-
import intel_extension_for_pytorch
36-
37-
include_dir.append(os.path.join(intel_extension_for_pytorch.cmake_prefix_path, "../../include"))
38-
library_dir.append(os.path.join(intel_extension_for_pytorch.cmake_prefix_path, "../../lib"))
39-
libraries.append("intel-ext-pt-gpu")
40-
4132

4233
def compile_module_from_src(src, name):
4334
key = hashlib.sha256(src.encode("utf-8")).hexdigest()
@@ -144,14 +135,6 @@ def format_of(ty):
144135
fmt = "iiiOOOOOO" + args_format
145136
args_list = ", " + ", ".join(f"&_arg{i}" for i, ty in signature.items()) if len(signature) > 0 else ""
146137

147-
record_function_header = "#include <ATen/record_function.h>"
148-
ipex_header = ""
149-
xpu_profiler_record = ""
150-
if USE_IPEX_OPTION:
151-
record_function_header = "#include <torch/extension.h>"
152-
ipex_header = "#include <ipex.h>"
153-
xpu_profiler_record = "xpu::profiler_record(kernel_name, event);"
154-
155138
# generate glue code
156139
src = f"""
157140
#include <cstddef>
@@ -160,8 +143,7 @@ def format_of(ty):
160143
#include <iomanip>
161144
#include <level_zero/ze_api.h>
162145
#include <sycl/sycl.hpp>
163-
{record_function_header}
164-
{ipex_header}
146+
#include <ATen/record_function.h>
165147
166148
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
167149
#include <Python.h>
@@ -302,7 +284,6 @@ def format_of(ty):
302284
}}
303285
}};
304286
auto event = stream.submit(cgf);
305-
{xpu_profiler_record}
306287
}}
307288
// end sycl
308289
static PyObject* launch(PyObject* self, PyObject* args) {{

0 commit comments

Comments
 (0)