Skip to content

Commit 3eb0c92

Browse files
authored
Merge branch 'main' into issue2662
2 parents 494d897 + 8382e76 commit 3eb0c92

File tree

91 files changed

+2832
-1149
lines changed

Some content is hidden

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

91 files changed

+2832
-1149
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Report a bug
2+
description: Report triton failing to compile a kernel, or giving incorrect results
3+
labels: ["bug"]
4+
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
#### Disclaimer
10+
The core triton team is small and has very limited capacity. We may not have time to look into your report.
11+
For the best results, please:
12+
- Avoid submitting duplicates. Search through [the existing and past issues](https://github.com/triton-lang/triton/issues?q=is%3Aissue+sort%3Acreated-desc+) first to see if it's been reported previously.
13+
- Check if the issue persists with a build from the latest source.
14+
- Provide all relevant information in the initial report, to prevent unnecessary back and forth discussion.
15+
- If you can, try to diagnose and/or fix the issue yourself. We welcome high quality contributions.
16+
- type: textarea
17+
attributes:
18+
label: Describe the bug
19+
description: |
20+
Please provide a clear and concise description of what the bug is.
21+
22+
If relevant, add a [minimal complete example](https://stackoverflow.com/help/minimal-reproducible-example) that reproduces the bug. It is very important for the snippet to be as simple as possible, so please take time to trim down any irrelevant code to help us debug efficiently. We are going to copy-paste your code and we expect to get the same result as you did, so include both the kernel and launching code as well as any relevant imports.
23+
24+
If the code is too long (hopefully, it isn't), feel free to put it in a public gist and link it in the issue: https://gist.github.com.
25+
26+
Please also paste or describe the results you observe instead of the expected results. If you observe an error, please paste the error message including the **full** traceback of the exception. It may be relevant to wrap error messages in ```` ```triple quotes blocks``` ````.
27+
placeholder: |
28+
A clear and concise description of what the bug is.
29+
30+
```python
31+
# Sample code to reproduce the problem
32+
```
33+
34+
```
35+
The error message you got, with the full traceback.
36+
```
37+
validations:
38+
required: true
39+
- type: textarea
40+
attributes:
41+
label: Environment details
42+
description: |
43+
Please include any relevant context about how you're running the reproducer e.g. which version of triton, and what GPU you are using.
44+
placeholder: |
45+
Triton: ...
46+
GPU: ...
47+
validations:
48+
required: true

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Community help
4+
url: https://discord.gg/gpumode
5+
about: GPU-mode discord community has a triton channel which is a great resource for help writing/learning triton
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Report a performance issue
2+
description: Report cases where triton is generating sub-optimal (but functionally correct) PTX/LLVM IR
3+
labels: ["performance"]
4+
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
#### Disclaimer
10+
The core triton team is small and has very limited capacity. We may not have time to look into your report.
11+
For the best results, please:
12+
- Avoid submitting duplicates. Search through [the existing and past issues](https://github.com/triton-lang/triton/issues?q=is%3Aissue+sort%3Acreated-desc+) first to see if it's been reported previously.
13+
- Check if the issue persists with a build from the latest source.
14+
- Provide all relevant information in the initial report, to prevent unnecessary back and forth discussion.
15+
- If you can, try to diagnose and/or fix the issue yourself. We welcome high quality contributions.
16+
- type: textarea
17+
attributes:
18+
label: Describe the issue
19+
description: |
20+
Please provide a clear and concise description of the issue.
21+
22+
Include a [minimal complete example](https://stackoverflow.com/help/minimal-reproducible-example) that reproduces the issue. It is very important for the snippet to be as simple as possible, so please take time to trim down any irrelevant code to help us debug efficiently. We are going to copy-paste your code and we expect to get the same result as you did.
23+
24+
A reproducer could be a python program that runs a triton kernel and prints out the relevant suboptimal IR, or an IR file with an accompanying triton-opt command.
25+
26+
If the code is too long (hopefully, it isn't), feel free to put it in a public gist and link it in the issue: https://gist.github.com.
27+
placeholder: |
28+
A clear and concise description of the issue.
29+
30+
```python
31+
# Sample code to reproduce the problem
32+
```
33+
validations:
34+
required: true
35+
- type: textarea
36+
attributes:
37+
label: Environment details
38+
description: |
39+
Please include any relevant context about how you're running the reproducer e.g. which version of triton, and what GPU you are using.
40+
placeholder: |
41+
Triton: ...
42+
GPU: ...
43+
validations:
44+
required: true

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
<!---
12
The core Triton is a small number of people, and we receive many PRs (thank
23
you!). To help us review your code more quickly, **if you are a new
34
contributor (less than 3 PRs merged) we ask that you complete the following
45
tasks and include the filled-out checklist in your PR description.**
56
67
Complete the following tasks before sending your PR, and replace `[ ]` with
78
`[x]` to indicate you have done them.
9+
-->
810

11+
# New contributor declaration
912
- [ ] I am not making a trivial change, such as fixing a typo in a comment.
1013

1114
- [ ] I have written a PR description following these

.github/workflows/integration-tests.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ jobs:
141141
- name: Check pre-commit
142142
run: |
143143
python3 -m pip install --upgrade pre-commit
144-
# TODO: ignore the first yapf failure until https://github.com/google/yapf/issues/1164 is fixed
145-
python3 -m pre_commit run --all-files --verbose yapf &> /dev/null || true
146-
# If first run of yapf worked and made changes reset the tree to the original state
147-
git reset --hard
148144
python3 -m pre_commit run --all-files --verbose
149145
- name: Print diff of changes if pre-commit failed
150146
if: failure()

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,6 @@ jobs:
155155
- name: Check pre-commit
156156
run: |
157157
python3 -m pip install --upgrade pre-commit
158-
# TODO: ignore the first yapf failure until https://github.com/google/yapf/issues/1164 is fixed
159-
python3 -m pre_commit run --all-files --verbose yapf &> /dev/null || true
160-
# If first run of yapf worked and made changes reset the tree to the original state
161-
git reset --hard
162158
python3 -m pre_commit run --all-files --verbose
163159

164160
- name: Print diff of changes if pre-commit failed

.github/workflows/llvm-build.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
config:
2929
- {runner: 'Ubuntu 20.04', runs_on: 'ubuntu-20.04', target-os: 'ubuntu', arch: 'x64'}
3030
- {runner: 'Ubuntu 20.04 ARM64', runs_on: 'ubuntu-20.04', target-os: 'ubuntu', arch: 'arm64'}
31+
- {runner: 'CentOS 7', runs_on: ['self-hosted', 'CPU'], target-os: 'centos', arch: 'x64'}
3132
- {runner: 'AlmaLinux 8', runs_on: ['self-hosted', 'CPU'], target-os: 'almalinux', arch: 'x64'}
3233
- {runner: 'MacOS X64', runs_on: 'macos-12', target-os: 'macos', arch: 'x64'}
3334
- {runner: 'MacOS ARM64', runs_on: 'macos-12', target-os: 'macos', arch: 'arm64'}
@@ -233,15 +234,16 @@ jobs:
233234
234235
tar czf "${{ env.llvm_install_dir }}.tar.gz" "${{ env.llvm_install_dir }}"
235236
236-
- name: Configure, Build, Test, and Install LLVM (AlmaLinux)
237-
if: matrix.config.target-os == 'almalinux'
237+
238+
- name: Configure, Build, Test, and Install LLVM (CentOS)
239+
if: matrix.config.target-os == 'centos'
238240
run: |
239241
# if this step crashes, it can leave behind a stale docker container
240242
docker container prune -f
241243
docker rmi -f $(docker images -q)
242244
243245
docker build --tag llvm-build --build-arg llvm_dir=llvm-project \
244-
-f llvm-build/.github/workflows/llvm-build/almalinux.Dockerfile .
246+
-f llvm-build/.github/workflows/llvm-build/centos.Dockerfile .
245247
246248
# Create temporary container to copy cache and installed artifacts.
247249
CONTAINER_ID=$(docker create llvm-build)
@@ -256,6 +258,31 @@ jobs:
256258
257259
docker rm "${CONTAINER_ID}"
258260
261+
- name: Configure, Build, Test, and Install LLVM (AlmaLinux)
262+
if: matrix.config.target-os == 'almalinux'
263+
run: |
264+
# if this step crashes, it can leave behind a stale docker container
265+
docker container prune -f
266+
docker rmi -f $(docker images -q)
267+
268+
docker build --tag llvm-build --build-arg llvm_dir=llvm-project \
269+
-f llvm-build/.github/workflows/llvm-build/almalinux.Dockerfile .
270+
271+
# Create temporary container to copy cache and installed artifacts.
272+
CONTAINER_ID=$(docker create llvm-build)
273+
274+
# We remove the existing directories, otherwise docker cp will
275+
# create a subdirectory inside the existing directory.
276+
rm -rf "${{ env.SCCACHE_DIR }}" "${{ env.llvm_install_dir }}"
277+
278+
docker cp "${CONTAINER_ID}:/install" "${{ env.llvm_install_dir }}"
279+
tar czf "${{ env.llvm_install_dir }}.tar.gz" "${{ env.llvm_install_dir }}"
280+
281+
docker cp "${CONTAINER_ID}:/sccache" "${{ env.SCCACHE_DIR }}"
282+
sudo chown -R "$(id -u -n):$(id -g -n)" "${{ env.SCCACHE_DIR }}"
283+
284+
docker rm "${CONTAINER_ID}"
285+
259286
- name: Upload Build Artifacts
260287
uses: actions/upload-artifact@v4
261288
with:
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
FROM centos:7
2+
ARG llvm_dir=llvm-project
3+
# Add the cache artifacts and the LLVM source tree to the container
4+
ADD sccache /sccache
5+
ADD "${llvm_dir}" /source/llvm-project
6+
ENV SCCACHE_DIR="/sccache"
7+
ENV SCCACHE_CACHE_SIZE="2G"
8+
9+
RUN echo -e "[llvmtoolset-build]\nname=LLVM Toolset 13.0 - Build\nbaseurl=https://buildlogs.centos.org/c7-llvm-toolset-13.0.x86_64/\ngpgcheck=0\nenabled=1" > /etc/yum.repos.d/llvmtoolset-build.repo
10+
11+
# Note: This is required patch since CentOS have reached EOL
12+
# otherwise any yum install setp will fail
13+
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
14+
RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
15+
RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
16+
17+
# Install build dependencies
18+
RUN yum install --assumeyes centos-release-scl
19+
20+
# The definition of insanity is doing the same thing and expecting a different result
21+
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
22+
RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
23+
RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
24+
25+
RUN yum install --assumeyes --nogpgcheck llvm-toolset-13.0
26+
RUN yum install --assumeyes rh-python38-python-devel rh-python38-python-pip
27+
SHELL [ "/usr/bin/scl", "enable", "llvm-toolset-13.0", "rh-python38" ]
28+
29+
RUN python3 -m pip install --upgrade pip
30+
RUN python3 -m pip install --upgrade cmake ninja sccache
31+
32+
# Install MLIR's Python Dependencies
33+
RUN python3 -m pip install -r /source/llvm-project/mlir/python/requirements.txt
34+
35+
# Configure, Build, Test, and Install LLVM
36+
RUN cmake -GNinja -Bbuild \
37+
-DCMAKE_BUILD_TYPE=Release \
38+
-DCMAKE_C_COMPILER=clang \
39+
-DCMAKE_CXX_COMPILER=clang++ \
40+
-DCMAKE_ASM_COMPILER=clang \
41+
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
42+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
43+
-DCMAKE_CXX_FLAGS="-Wno-everything" \
44+
-DCMAKE_LINKER=lld \
45+
-DCMAKE_INSTALL_PREFIX="/install" \
46+
-DLLVM_BUILD_UTILS=ON \
47+
-DLLVM_BUILD_TOOLS=ON \
48+
-DLLVM_ENABLE_ASSERTIONS=ON \
49+
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
50+
-DLLVM_ENABLE_PROJECTS=mlir \
51+
-DLLVM_ENABLE_TERMINFO=OFF \
52+
-DLLVM_INSTALL_UTILS=ON \
53+
-DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU" \
54+
/source/llvm-project/llvm
55+
56+
RUN ninja -C build install

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ For detailed instructions on how to debug Triton's frontend, please refer to thi
176176
kernels. Use `MLIR_ENABLE_DUMP=kernelName` to dump for a specific kernel only.
177177
- Triton cache can interfere with the dump. In cases where `MLIR_ENABLE_DUMP=1` does not work, try cleaning your triton cache: `rm -r ~/.triton/cache/*`
178178
- `LLVM_IR_ENABLE_DUMP=1` dumps the IR before every pass run over the LLVM IR.
179+
- `TRITON_REPRODUCER_PATH=<reproducer_path>` will generate an MLIR reproducer file
180+
at `<reproducer_path>` before each MLIR compiler stage. If any of the stages fail,
181+
`<reproducer_path>` will be a local MLIR reproducer captured right before the failing pass.
179182
- `TRITON_INTERPRET=1` uses the Triton interpreter instead of running on the
180183
GPU. You can insert Python breakpoints in your kernel code!
181184
- `TRITON_ENABLE_LLVM_DEBUG=1` passes `-debug` to LLVM, printing a lot of

cmake/AddTritonUnitTest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ function(add_triton_ut)
3535
# Without the TEST_DISCOVERY_TIMEOUT, the tests randomly time out on my mac
3636
# laptop. I think the issue may be that the very first time you run a program
3737
# it's a bit slow.
38-
gtest_discover_tests(${__NAME} PROPERTIES TEST_DISCOVERY_TIMEOUT 60)
38+
gtest_discover_tests(${__NAME} DISCOVERY_TIMEOUT 60)
3939
endfunction()

0 commit comments

Comments
 (0)