forked from triton-lang/triton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
100 lines (78 loc) · 3.35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# This is not the build system, just a helper to run common development commands.
# Make sure to first initialize the build system with:
# make dev-install
PYTHON ?= python
BUILD_DIR := $(shell cd python; $(PYTHON) -c 'from build_helpers import get_cmake_dir; print(get_cmake_dir())')
TRITON_OPT := $(BUILD_DIR)/bin/triton-opt
PYTEST := $(PYTHON) -m pytest
# Incremental builds
.PHONY: all
all:
ninja -C $(BUILD_DIR)
.PHONY: triton-opt
triton-opt:
ninja -C $(BUILD_DIR) triton-opt
# Testing
.PHONY: test-lit
test-lit:
ninja -C $(BUILD_DIR) check-triton-lit-tests
.PHONY: test-cpp
test-cpp:
ninja -C $(BUILD_DIR) check-triton-unit-tests
.PHONY: test-python
.ONESHELL:
test-unit: all
cd python/test/unit
$(PYTEST) -s -n 8 --ignore=cuda/test_flashattention.py --ignore=language/test_line_info.py --ignore=language/test_subprocess.py --ignore=test_debug.py
$(PYTEST) -s -n 8 language/test_subprocess.py
$(PYTEST) -s -n 8 test_debug.py --forked
TRITON_DISABLE_LINE_INFO=0 $(PYTEST) -s language/test_line_info.py
# Run cuda/test_flashattention.py separately to avoid out of gpu memory
$(PYTEST) -s cuda/test_flashattention.py
TRITON_ALWAYS_COMPILE=1 TRITON_DISABLE_LINE_INFO=0 LLVM_PASS_PLUGIN_PATH=../../triton/instrumentation/libGPUInstrumentationTestLib.so \
$(PYTEST) --capture=tee-sys -rfs -vvv instrumentation/test_gpuhello.py
.PHONY: test-regression
test-regression: all
$(PYTEST) -s -n 8 python/test/regression
.PHONY: test-interpret
.ONESHELL:
test-interpret: all
cd python/test/unit
TRITON_INTERPRET=1 $(PYTEST) -s -n 16 -m interpreter language/test_core.py language/test_standard.py \
language/test_random.py language/test_block_pointer.py language/test_subprocess.py language/test_line_info.py \
runtime/test_autotuner.py::test_kwargs[False] \
../../tutorials/06-fused-attention.py::test_op --device=cpu
.PHONY: test-proton
test-proton: all
$(PYTEST) -s third_party/proton/test
.PHONY: test-python
test-python: test-unit test-regression test-interpret test-proton
.PHONY: test-nogpu
test-nogpu: test-lit test-cpp
.PHONY: test
test: test-lit test-cpp test-python
# pip install-ing
.PHONY: dev-install-requires
dev-install-requires:
$(PYTHON) -m pip install -r python/requirements.txt
$(PYTHON) -m pip install -r python/test-requirements.txt
.PHONY: dev-install-torch
dev-install-torch:
# install torch but ensure pytorch-triton isn't installed
$(PYTHON) -m pip install torch
$(PYTHON) -m pip uninstall triton pytorch-triton -y
.PHONY: dev-install-triton
dev-install-triton:
$(PYTHON) -m pip install -e python --no-build-isolation -v
.PHONY: dev-install
.NOPARALLEL: dev-install
dev-install: dev-install-requires dev-install-triton
# Updating lit tests
.PHONY: golden-samples
golden-samples: triton-opt
$(TRITON_OPT) test/TritonGPU/samples/simulated-grouped-gemm.mlir.in -tritongpu-loop-scheduling -tritongpu-pipeline -canonicalize | \
$(PYTHON) utils/generate-test-checks.py --source test/TritonGPU/samples/simulated-grouped-gemm.mlir.in --source_delim_regex="\bmodule" \
-o test/TritonGPU/samples/simulated-grouped-gemm.mlir
$(TRITON_OPT) test/TritonGPU/samples/descriptor-matmul-pipeline.mlir.in -tritongpu-loop-scheduling -tritongpu-pipeline -canonicalize | \
$(PYTHON) utils/generate-test-checks.py --source test/TritonGPU/samples/descriptor-matmul-pipeline.mlir.in --source_delim_regex="\bmodule" \
-o test/TritonGPU/samples/descriptor-matmul-pipeline.mlir