Skip to content

Commit 21e483c

Browse files
Merge branch 'main' into whitneywhtsang/prefetch_mask
2 parents 33558fa + 9ef82e2 commit 21e483c

74 files changed

Lines changed: 1724 additions & 1211 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-test-reusable.yml

Lines changed: 74 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ env:
7474
jobs:
7575
integration-tests:
7676
name: Integration tests
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
suite:
81+
- core
82+
- rest
7783
timeout-minutes: 720
7884
runs-on: ${{ fromJson(inputs.runner_label && format('["linux", "{0}"]', inputs.runner_label) || format('["linux", "{0}", "{1}", "{2}"]', inputs.device, inputs.driver_version, inputs.runner_version)) }}
7985
defaults:
@@ -111,31 +117,23 @@ jobs:
111117
with:
112118
python-version: ${{ inputs.python_version }}
113119

114-
- name: Identify Python version
115-
run: |
116-
PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info[0]}.{ sys.version_info[1]}")')"
117-
echo "PYTHON_VERSION=$PYTHON_VERSION" | tee -a $GITHUB_ENV
118-
119120
- name: Setup PyTorch
120121
uses: ./.github/actions/setup-pytorch
121122
with:
122123
ref: ${{ inputs.pytorch_ref }}
123124
mode: ${{ inputs.pytorch_mode }}
124125

125-
- name: Install pass_rate dependencies
126-
run: |
127-
pip install defusedxml setproctitle==1.3.5
128-
129126
- name: Setup Triton
130127
uses: ./.github/actions/setup-triton
131128
with:
132129
build_llvm: ${{ inputs.build_llvm }}
133130
use_spirv_backend: ${{ inputs.use_spirv_backend }}
134131

135132
- name: Report environment details
133+
if: matrix.suite == 'core'
136134
run: |
137-
source ./scripts/capture-hw-details.sh --quiet
138-
cat <<EOF | tee .env
135+
mkdir -p reports
136+
cat <<EOF | tee reports/.env
139137
TIMESTAMP=$(date '+%Y%m%d%H%M%S')
140138
GITHUB_RUN_ID=$GITHUB_RUN_ID
141139
GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER
@@ -145,11 +143,8 @@ jobs:
145143
PYTORCH_COMMIT_ID=$PYTORCH_COMMIT_ID
146144
PYTORCH_VERSION=$PYTORCH_VERSION
147145
TRITON_REPO=$GITHUB_REPOSITORY
148-
LIBIGC1_VERSION=$LIBIGC1_VERSION
149-
LEVEL_ZERO_VERSION=$LEVEL_ZERO_VERSION
150-
GPU_DEVICE=$GPU_DEVICE
151-
AGAMA_VERSION=$AGAMA_VERSION
152146
EOF
147+
./scripts/capture-hw-details.sh | tee -a reports/.env
153148
154149
- name: Create test-triton command line
155150
run: |
@@ -169,43 +164,54 @@ jobs:
169164
170165
{
171166
echo SKIPLIST="$skiplist"
172-
echo TRITON_TEST_CMD="bash -x scripts/test-triton.sh --warning-reports --skip-pytorch-install --reports-dir $GITHUB_WORKSPACE/reports ${{ inputs.ignore_errors && '--ignore-errors' || '' }} $skiplist"
167+
echo TRITON_TEST_CMD="bash -x scripts/test-triton.sh --skip-pip-install --warning-reports --skip-pytorch-install --reports-dir $GITHUB_WORKSPACE/reports ${{ inputs.ignore_errors && '--ignore-errors' || '' }} $skiplist"
173168
} | tee -a $GITHUB_ENV
174169
170+
- name: Install test dependencies
171+
run: |
172+
pip install -r scripts/requirements-test.txt git+https://github.com/kwasd/pytest-capturewarnings-ng@v1.2.0
173+
175174
- name: Run Proton tests
176-
if: ${{ inputs.driver_version == 'rolling' && inputs.device == 'max1100' }}
175+
if: matrix.suite == 'rest' && inputs.driver_version == 'rolling' && inputs.device == 'max1100'
177176
run: |
178177
cd third_party/proton/test
179178
pytest test_api.py test_lib.py test_profile.py test_viewer.py test_record.py -s -v
180179
cd ..
181180
182181
- name: Run unit tests
182+
if: matrix.suite == 'rest'
183183
run: |
184184
${{ env.TRITON_TEST_CMD }} --unit
185185
186186
- name: Run core tests
187+
if: matrix.suite == 'core'
187188
run: |
188-
${{ env.TRITON_TEST_CMD }} --core --skip-pip-install
189+
${{ env.TRITON_TEST_CMD }} --core
189190
190191
- name: Run interpreter tests
192+
if: matrix.suite == 'rest'
191193
run: |
192-
${{ env.TRITON_TEST_CMD }} --interpreter --skip-pip-install
194+
${{ env.TRITON_TEST_CMD }} --interpreter
193195
194196
- name: Run Tutorials
197+
if: matrix.suite == 'rest'
195198
run: |
196-
${{ env.TRITON_TEST_CMD }} --tutorial --skip-pip-install
199+
${{ env.TRITON_TEST_CMD }} --tutorial
197200
198201
- name: Run instrumentation tests
202+
if: matrix.suite == 'rest'
199203
run: |
200-
${{ env.TRITON_TEST_CMD }} --instrumentation --skip-pip-install
204+
${{ env.TRITON_TEST_CMD }} --instrumentation
201205
202206
- name: Get transformers version
207+
if: matrix.suite == 'rest'
203208
run: |
204209
cd pytorch
205210
TRANSFORMERS_VERSION="$(<.ci/docker/ci_commit_pins/huggingface.txt)"
206211
echo "TRANSFORMERS_VERSION=$TRANSFORMERS_VERSION" | tee -a $GITHUB_ENV
207212
208213
- name: Install transformers
214+
if: matrix.suite == 'rest'
209215
uses: ./.github/actions/install-dependency
210216
with:
211217
package: transformers
@@ -214,8 +220,9 @@ jobs:
214220
try-tag-prefix: v
215221

216222
- name: Run E2E test
223+
if: matrix.suite == 'rest'
217224
run: |
218-
${{ env.TRITON_TEST_CMD }} --inductor --skip-pip-install
225+
${{ env.TRITON_TEST_CMD }} --inductor
219226
220227
- name: Save pip cache
221228
if: ${{ steps.pip-cache.outputs.status == 'miss' }}
@@ -224,9 +231,52 @@ jobs:
224231
path: ${{ steps.pip-cache.outputs.path }}
225232
dest: ${{ steps.pip-cache.outputs.dest }}
226233

234+
- name: Upload test reports
235+
uses: actions/upload-artifact@v4
236+
with:
237+
name: test-reports-${{ matrix.suite }}-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
238+
include-hidden-files: true
239+
path: reports
240+
241+
reports:
242+
name: Reports
243+
runs-on:
244+
- linux
245+
needs: integration-tests
246+
steps:
247+
- name: Checkout repository
248+
uses: actions/checkout@v4
249+
250+
- name: Load pip cache
251+
id: pip-cache
252+
uses: ./.github/actions/load
253+
env:
254+
# Increase this value to reset cache
255+
CACHE_NUMBER: 1
256+
with:
257+
path: $HOME/.cache/pip
258+
key: pip-${{ inputs.python_version }}-${{ hashFiles('python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }}
259+
260+
- name: Download test reports
261+
uses: actions/download-artifact@v4
262+
with:
263+
pattern: test-reports-*-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
264+
path: reports
265+
merge-multiple: true
266+
267+
- name: Install Python (using actions/setup-python) ${{ inputs.python_version }}
268+
uses: actions/setup-python@v5
269+
with:
270+
python-version: ${{ inputs.python_version }}
271+
272+
- name: Install pass_rate dependencies
273+
run: |
274+
pip install defusedxml
275+
227276
- name: Pass rate
228277
run: |
229-
source ./scripts/capture-hw-details.sh
278+
ls -la reports
279+
source ./reports/.env
230280
python scripts/pass_rate.py --reports reports
231281
python scripts/pass_rate.py --reports reports --json > pass_rate.json
232282
python scripts/pass_rate.py --reports reports --suite tutorials --json > pass_rate_tutorials.json
@@ -247,11 +297,4 @@ jobs:
247297
include-hidden-files: true
248298
path: |
249299
reports/*/*.csv
250-
.env
251-
252-
- name: Upload test reports
253-
if: inputs.upload_test_reports
254-
uses: actions/upload-artifact@v4
255-
with:
256-
name: test-reports-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }}
257-
path: reports
300+
reports/.env

.github/workflows/build-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
name: Integration tests matrix
101101

102102
strategy:
103+
fail-fast: false
103104
matrix:
104105
python:
105106
- "3.9"

.github/workflows/integration-tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
if: env.enable_integration == 'true'
115115
run: |
116116
if [ x"${{ github.repository }}" == x"triton-lang/triton" ]; then
117-
echo '::set-output name=matrix-CUDA::[["a100-runner-set"], ["h100-runner-set"], ["gb200-runner-set"]]'
117+
echo '::set-output name=matrix-CUDA::[["nvidia-a100"], ["nvidia-h100"], ["nvidia-gb200"]]'
118118
echo '::set-output name=matrix-HIP::[["self-hosted", "gfx90a"], ["amd-gfx942"]]'
119119
echo '::set-output name=matrix-MACOS::[["macos-latest"]]'
120120
else
@@ -232,7 +232,7 @@ jobs:
232232
env:
233233
CUDA_HOME: "/usr/local/cuda"
234234
run: |
235-
if [ "${{ matrix.runner[0] }}" == "gb200-runner-set" ]; then
235+
if [ "${{ matrix.runner[0] }}" == "nvidia-gb200" ]; then
236236
source /venv/bin/activate
237237
fi
238238
echo "PATH is '$PATH'"
@@ -244,23 +244,23 @@ jobs:
244244
run: make test-lit
245245
- name: Run python tests on CUDA
246246
run: |
247-
if [ "${{ matrix.runner[0] }}" == "gb200-runner-set" ]; then
247+
if [ "${{ matrix.runner[0] }}" == "nvidia-gb200" ]; then
248248
source /venv/bin/activate
249249
fi
250250
make test-unit
251251
- name: Run interpreter tests
252-
if: ${{ matrix.runner[0] == 'h100-runner-set' }}
252+
if: ${{ matrix.runner[0] == 'nvidia-h100' }}
253253
run: make test-interpret
254254
- name: Run regression tests
255255
run: |
256-
if [ "${{ matrix.runner[0] }}" == "gb200-runner-set" ]; then
256+
if [ "${{ matrix.runner[0] }}" == "nvidia-gb200" ]; then
257257
source /venv/bin/activate
258258
fi
259259
make test-regression
260260
- name: Run C++ unittests
261261
run: make test-cpp
262262
- name: Run Proton tests
263-
if: ${{ matrix.runner[0] != 'gb200-runner-set' }}
263+
if: ${{ matrix.runner[0] != 'nvidia-gb200' }}
264264
run: make test-proton
265265
- name: Inspect cache directories
266266
run: |
@@ -409,7 +409,7 @@ jobs:
409409
cd python/test/regression
410410
python3 -m pytest -s -n 8 ./test_cast_matmul.py
411411
- name: Run Proton tests
412-
if: ${{ matrix.runner[0] != 'gb200-runner-set' }}
412+
if: ${{ matrix.runner[0] != 'nvidia-gb200' }}
413413
run: make test-proton
414414
- name: Run C++ unittests
415415
run: make test-cpp

.github/workflows/integration-tests.yml.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ jobs:
123123
if: env.enable_integration == 'true'
124124
run: |
125125
if [ x"${{ github.repository }}" == x"triton-lang/triton" ]; then
126-
echo '::set-output name=matrix-CUDA::[["a100-runner-set"], ["h100-runner-set"], ["gb200-runner-set"]]'
126+
echo '::set-output name=matrix-CUDA::[["nvidia-a100"], ["nvidia-h100"], ["nvidia-gb200"]]'
127127
echo '::set-output name=matrix-HIP::[["self-hosted", "gfx90a"], ["amd-gfx942"]]'
128128
echo '::set-output name=matrix-MACOS::[["macos-latest"]]'
129129
else
@@ -264,7 +264,7 @@ jobs:
264264
env:
265265
CUDA_HOME: "/usr/local/cuda"
266266
run: |
267-
if [ "${{ matrix.runner[0] }}" == "gb200-runner-set" ]; then
267+
if [ "${{ matrix.runner[0] }}" == "nvidia-gb200" ]; then
268268
source /venv/bin/activate
269269
fi
270270
echo "PATH is '$PATH'"
@@ -281,18 +281,18 @@ jobs:
281281

282282
- name: Run python tests on CUDA
283283
run: |
284-
if [ "${{ matrix.runner[0] }}" == "gb200-runner-set" ]; then
284+
if [ "${{ matrix.runner[0] }}" == "nvidia-gb200" ]; then
285285
source /venv/bin/activate
286286
fi
287287
make test-unit
288288

289289
- name: Run interpreter tests
290-
if: ${{ matrix.runner[0] == 'h100-runner-set' }}
290+
if: ${{ matrix.runner[0] == 'nvidia-h100' }}
291291
run: make test-interpret
292292

293293
- name: Run regression tests
294294
run: |
295-
if [ "${{ matrix.runner[0] }}" == "gb200-runner-set" ]; then
295+
if [ "${{ matrix.runner[0] }}" == "nvidia-gb200" ]; then
296296
source /venv/bin/activate
297297
fi
298298
make test-regression
@@ -303,7 +303,7 @@ jobs:
303303

304304
- &run-proton-tests-step
305305
name: Run Proton tests
306-
if: ${{ matrix.runner[0] != 'gb200-runner-set' }}
306+
if: ${{ matrix.runner[0] != 'nvidia-gb200' }}
307307
run: make test-proton
308308

309309
- *inspect-cache-directories-step

bench/bench/bench_mlp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
import triton.profiler as proton
44
import torch
55
import triton_bench.swiglu
6-
from triton_bench.mxfp import downcast_to_mxfp
6+
from triton_bench.numerics_details.mxfp import downcast_to_mxfp
77
from triton_bench.matmul_ogs import MicroscalingCtx, matmul_ogs, PrecisionConfig, FlexCtx
88
from triton_bench.numerics import InFlexData
99
from triton_bench.routing import routing
10-
from triton_bench.meta import cuda_capability_geq, is_hip, get_cdna_version
10+
from triton_bench.target_info import is_hip, get_cdna_version
1111

1212
if torch.cuda.is_available() and not is_hip():
1313
from triton._C.libtriton import nvidia
@@ -152,5 +152,5 @@ def bench_mlp(batch, dim1, dim2, n_expts_tot, n_expts_act, x_dtype, w_dtype,
152152
qxdtype = "fp8" if has_native_mx4 else "bf16"
153153
print(bench_mlp(8192, 8192, 8192, 1, 1, "fp8", "fp8", TP=1, EP=1, name="dense"))
154154
print(bench_mlp(8192, 8192, 8192, 1, 1, qxdtype, "mx4", TP=1, EP=1, name="dense"))
155-
print(bench_mlp(2048, 5120, 8192, 128, 4, "fp8", "fp8", TP=4, EP=2, name="llama4"))
156-
print(bench_mlp(2048, 5120, 8192, 128, 4, qxdtype, "mx4", TP=4, EP=2, name="llama4"))
155+
print(bench_mlp(2048, 5120, 8192, 128, 4, "fp8", "fp8", TP=4, EP=1, name="llama4"))
156+
print(bench_mlp(2048, 5120, 8192, 128, 4, qxdtype, "mx4", TP=4, EP=1, name="llama4"))
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
import torch
3-
from triton_bench.compact import masked_compact, masked_compact_torch
3+
from triton_bench.compaction import compaction, compaction_torch
44

55

66
@pytest.mark.parametrize("n_tokens, n_cols, k, p", [
@@ -9,7 +9,7 @@
99
(131, 128, 16, 0.6),
1010
(496, 128, 16, 0.),
1111
])
12-
def test_masked_compact(n_tokens, n_cols, k, p):
12+
def test_compaction(n_tokens, n_cols, k, p):
1313
device = "cuda"
1414
yi = torch.rand((n_tokens, n_cols), device=device).argsort(dim=-1)
1515
yi = yi[:, :k].to(torch.int32)
@@ -23,7 +23,7 @@ def test_masked_compact(n_tokens, n_cols, k, p):
2323
chunks = mask.view(*mask.shape[:-1], -1, 32)
2424
weights = (1 << torch.arange(32, dtype=torch.int32, device=device))
2525
bitmask = (chunks.int() * weights).sum(dim=-1)
26-
yv_ref, yi_ref = masked_compact_torch(yv, yi, bitmask)
27-
yv_tri, yi_tri = masked_compact(yv, yi, bitmask)
26+
yv_ref, yi_ref = compaction_torch(yv, yi, bitmask)
27+
yv_tri, yi_tri = compaction(yv, yi, bitmask)
2828
assert torch.all(yi_ref == yi_tri)
2929
assert torch.all(yv_ref == yv_tri)

bench/tests/test_matmul.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
from triton_bench.matmul_ogs import matmul_ogs, matmul_ogs_torch
1212
# numerics utilities
1313
from triton_bench.numerics import InFlexData, OutFlexData
14-
from triton_bench.mxfp import downcast_to_mxfp, upcast_from_mxfp
14+
from triton_bench.numerics_details.mxfp import downcast_to_mxfp, upcast_from_mxfp
1515
# testing utilities
1616
from triton_bench.testing import assert_close, compute_actual_scale
1717
# target-specific utilities
18-
from triton_bench.meta import is_hip
18+
from triton_bench.target_info import is_hip
1919

2020
# ---------------
2121
# initialize data

0 commit comments

Comments
 (0)