Skip to content

[Bugfix] Workaround CI failure in flexattention compilation from Triton3.7 bump - #2723

Merged
Lucaskabela merged 1 commit into
pytorch:mainfrom
Lucaskabela:lucaskabela/fix_attention_tracing
Mar 26, 2026
Merged

Lucaskabela merged 1 commit into
pytorch:mainfrom
Lucaskabela:lucaskabela/fix_attention_tracing

Conversation

@Lucaskabela

@Lucaskabela Lucaskabela commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

From nightly bump, we notice CI started failing. This seems to be caused by Triton bump breaking llvm build for flexattention

For now, disable so that we can workaround

Rootcause

Workaround for Triton 3.7 LLVM SLP vectorizer crash on flex attention kernels. The Triton pin update (pytorch/pytorch#174896) ships an LLVM build whose SLP vectorizer hits an assertion (FromIdx <= ToIdx, "Bad index") when compiling certain flex attention Triton kernels. The crash occurs in llvm.optimize_module() during make_llir, which runs the LLVM O3 pipeline including SLP vectorization. There is no Python-level API to disable only the SLP vectorizer pass (optimize_module ignores its flags parameter, and DISABLE_LLVM_OPT= only sets flags to true). Setting DISABLE_LLVM_OPT=1 skips the LLVM O3 pipeline entirely; the MLIR-level optimizations still run, so GPU kernel performance impact is minimal.

Test plan

NGPU=4 LOG_RANK=0,1,2,3 ./run_train.sh  --module llama3 --config llama3_debugmodel_flex_attn --parallelism.data_parallel_shard_degree=4 --activation_checkpoint.mode='full'

Passes now!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 26, 2026
@Lucaskabela
Lucaskabela requested a review from joecummings March 26, 2026 21:14

@joecummings joecummings left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add a little more information about the root case / investigation in the Issue? or point to the Issue on pytorch/pytorch when you have it?

Stamping, but let's wait for CI :)

@Lucaskabela

Copy link
Copy Markdown
Contributor Author

Would it be possible to add a little more information about the root case / investigation in the Issue? or point to the Issue on pytorch/pytorch when you have it?

Stamping, but let's wait for CI :)

Will add once I have the issue in Pytorch main - working on the min repro now

@tianyu-l tianyu-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stamp

@Lucaskabela
Lucaskabela merged commit d84e83d into pytorch:main Mar 26, 2026
20 of 27 checks passed
@wconstab

Copy link
Copy Markdown
Contributor

we may want to add the triton pin file in pytorch/pytorch CI to the list of files that triggers torchtitan CI. This would ensure the triton pin change PR to fail in such cases (hopefully)

@Lucaskabela

Lucaskabela commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Here is the upstream issue btw: pytorch/pytorch#178554 with a very minimal repro

chelsea0x3b pushed a commit to chelsea0x3b/torchtitan that referenced this pull request Mar 30, 2026
…on3.7 bump (pytorch#2723)

## Summary 

From nightly bump, we notice CI started failing. This seems to be caused
by Triton bump breaking llvm build for flexattention

For now, disable so that we can workaround

### Rootcause

Workaround for Triton 3.7 LLVM SLP vectorizer crash on flex attention
kernels. The Triton pin update (pytorch/pytorch#174896) ships an LLVM
build whose SLP vectorizer hits an assertion (FromIdx <= ToIdx, "Bad
index") when compiling certain flex attention Triton kernels. The crash
occurs in llvm.optimize_module() during make_llir, which runs the LLVM
O3 pipeline including SLP vectorization. There is no Python-level API to
disable only the SLP vectorizer pass (optimize_module ignores its flags
parameter, and DISABLE_LLVM_OPT=<name> only sets flags to true). Setting
DISABLE_LLVM_OPT=1 skips the LLVM O3 pipeline entirely; the MLIR-level
optimizations still run, so GPU kernel performance impact is minimal.

## Test plan

```bash
NGPU=4 LOG_RANK=0,1,2,3 ./run_train.sh  --module llama3 --config llama3_debugmodel_flex_attn --parallelism.data_parallel_shard_degree=4 --activation_checkpoint.mode='full'
```

Passes now!
acisseJZhong pushed a commit that referenced this pull request Mar 31, 2026
…on3.7 bump (#2723)

## Summary 

From nightly bump, we notice CI started failing. This seems to be caused
by Triton bump breaking llvm build for flexattention

For now, disable so that we can workaround

### Rootcause

Workaround for Triton 3.7 LLVM SLP vectorizer crash on flex attention
kernels. The Triton pin update (pytorch/pytorch#174896) ships an LLVM
build whose SLP vectorizer hits an assertion (FromIdx <= ToIdx, "Bad
index") when compiling certain flex attention Triton kernels. The crash
occurs in llvm.optimize_module() during make_llir, which runs the LLVM
O3 pipeline including SLP vectorization. There is no Python-level API to
disable only the SLP vectorizer pass (optimize_module ignores its flags
parameter, and DISABLE_LLVM_OPT=<name> only sets flags to true). Setting
DISABLE_LLVM_OPT=1 skips the LLVM O3 pipeline entirely; the MLIR-level
optimizations still run, so GPU kernel performance impact is minimal.

## Test plan

```bash
NGPU=4 LOG_RANK=0,1,2,3 ./run_train.sh  --module llama3 --config llama3_debugmodel_flex_attn --parallelism.data_parallel_shard_degree=4 --activation_checkpoint.mode='full'
```

Passes now!
TXacs pushed a commit to McmillanTAC/torchtitan that referenced this pull request Apr 13, 2026
…on3.7 bump (pytorch#2723)

## Summary 

From nightly bump, we notice CI started failing. This seems to be caused
by Triton bump breaking llvm build for flexattention

For now, disable so that we can workaround

### Rootcause

Workaround for Triton 3.7 LLVM SLP vectorizer crash on flex attention
kernels. The Triton pin update (pytorch/pytorch#174896) ships an LLVM
build whose SLP vectorizer hits an assertion (FromIdx <= ToIdx, "Bad
index") when compiling certain flex attention Triton kernels. The crash
occurs in llvm.optimize_module() during make_llir, which runs the LLVM
O3 pipeline including SLP vectorization. There is no Python-level API to
disable only the SLP vectorizer pass (optimize_module ignores its flags
parameter, and DISABLE_LLVM_OPT=<name> only sets flags to true). Setting
DISABLE_LLVM_OPT=1 skips the LLVM O3 pipeline entirely; the MLIR-level
optimizations still run, so GPU kernel performance impact is minimal.

## Test plan

```bash
NGPU=4 LOG_RANK=0,1,2,3 ./run_train.sh  --module llama3 --config llama3_debugmodel_flex_attn --parallelism.data_parallel_shard_degree=4 --activation_checkpoint.mode='full'
```

Passes now!
ACharacterInASimulation pushed a commit to ACharacterInASimulation/torchtitan that referenced this pull request Apr 21, 2026
…on3.7 bump (pytorch#2723)

## Summary 

From nightly bump, we notice CI started failing. This seems to be caused
by Triton bump breaking llvm build for flexattention

For now, disable so that we can workaround

### Rootcause

Workaround for Triton 3.7 LLVM SLP vectorizer crash on flex attention
kernels. The Triton pin update (pytorch/pytorch#174896) ships an LLVM
build whose SLP vectorizer hits an assertion (FromIdx <= ToIdx, "Bad
index") when compiling certain flex attention Triton kernels. The crash
occurs in llvm.optimize_module() during make_llir, which runs the LLVM
O3 pipeline including SLP vectorization. There is no Python-level API to
disable only the SLP vectorizer pass (optimize_module ignores its flags
parameter, and DISABLE_LLVM_OPT=<name> only sets flags to true). Setting
DISABLE_LLVM_OPT=1 skips the LLVM O3 pipeline entirely; the MLIR-level
optimizations still run, so GPU kernel performance impact is minimal.

## Test plan

```bash
NGPU=4 LOG_RANK=0,1,2,3 ./run_train.sh  --module llama3 --config llama3_debugmodel_flex_attn --parallelism.data_parallel_shard_degree=4 --activation_checkpoint.mode='full'
```

Passes now!
@Lucaskabela
Lucaskabela deleted the lucaskabela/fix_attention_tracing branch May 6, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants