Skip to content

AITER test_compile_constexpr_mutation.py Triton Test Fails with 99%+ Mismatched Elements #3398

Description

@jayfurmanek

🐛 Describe the bug

Problem Description

At a fixed AITER commit (ROCm/aiter@de79999), Triton unit test op_tests/triton_tests/torch_compile/test_compile_constexpr_mutation.py fails with a big accuracy mismatch in all cases:

AssertionError: Tensor-likes are not close!
Mismatched elements 99%+

At first glance, it's a simple RMSNorm kernel:

@triton.jit
def _rmsnorm_constexpr_kernel(
    x_ptr,
    weight_ptr,
    out_ptr,
    eps,
    stride_x,
    stride_out,
    N: tl.constexpr,
    BLOCK_N: tl.constexpr,
):
    row = tl.program_id(0)
    cols = tl.arange(0, BLOCK_N)
    mask = cols < N

    x = tl.load(x_ptr + row * stride_x + cols, mask=mask, other=0.0).to(tl.float32)
    variance = tl.sum(x * x, axis=0) / N
    x_hat = x / tl.sqrt(variance + eps)

    w = tl.load(weight_ptr + cols, mask=mask, other=0.0).to(tl.float32)
    tl.store(out_ptr + row * stride_out + cols, (x_hat * w).to(tl.float16), mask=mask)

It's possible to get the test passing, keeping AITER code base the same and changing Triton compiler.

Software Commits

It was possible to determine these commits through bisection of Triton compiler:

Date Status Commit
Dec 02 2005 Good triton-lang/triton@8ea50fa
Dec 02 2025 First bad triton-lang/triton@454ec9e
May 07 2026 v3.7.0 tag, still bad triton-lang/triton@5f3f125
Jun 24 2026 Current TOT, still bad triton-lang/triton@7917e3f

Environment

  • OS: Ubuntu 24.04.4 LTS (Noble Numbat)
  • CPU: AMD EPYC 9575F
  • GPU: AMD Instinct MI355X (gfx950) and AMD Instinct MI300X (gfx942)
  • ROCm 7.2.4

Steps to Reproduce

1. Setup reproducer container

Run on host:

docker pull rocm/pytorch:latest && \
docker run -dt \
    --device /dev/kfd \
    --device /dev/dri \
    --shm-size 16g \
    --network host \
    --ipc host \
    --cap-add SYS_PTRACE \
    --security-opt seccomp=unconfined \
    --user root \
    --group-add $(getent group video | cut -d: -f3) \
    --workdir /workspace \
    --name triton_internal_issue_1883 \
    rocm/pytorch:latest && \
docker exec -it triton_internal_issue_1883 bash

2. Compile Triton (at good commit)

pushd /workspace && \
git clone https://github.com/triton-lang/triton.git && \
pushd /workspace/triton && \
git checkout 8ea50fa4098642ee0a6afc0b932f83a38e37719a && \
pip uninstall --yes triton && \
pip install --requirement python/requirements.txt && \
pip install --verbose --no-build-isolation --editable . && \
pip show triton && \
python python/tutorials/01-vector-add.py && \
popd && popd

3. Compile AITER

pushd /workspace && \
git clone --recursive https://github.com/ROCm/aiter.git && \
pushd /workspace/aiter && \
pip uninstall --yes amd-aiter && \
AITER_USE_SYSTEM_TRITON=1 python setup.py develop && \
pip show amd-aiter && \
python -c 'import aiter' && \
popd && popd

4. Verify good commit

pushd /workspace/aiter && \
rm -rf ~/.triton/cache && \
pytest op_tests/triton_tests/torch_compile/test_compile_constexpr_mutation.py && \
popd

Expected result: 6 passed, 14 warnings

5. Checkout bad commit and compile Triton again

pushd /workspace/triton && \
git checkout 454ec9eea6cf6deab971ed66dad45d957c561fe4 && \
pip uninstall --yes triton && \
git clean -xdf && \
pip install --requirement python/requirements.txt && \
pip install --verbose --no-build-isolation --editable . && \
pip show triton && \
python python/tutorials/01-vector-add.py && \
popd

6. Reproduce failure at bad commit

pushd /workspace/aiter && \
rm -rf ~/.triton/cache && \
pytest op_tests/triton_tests/torch_compile/test_compile_constexpr_mutation.py && \
popd

Expected result: 6 failed, 14 warnings

AssertionError: Tensor-likes are not close!
Mismatched elements 99%+

7. Export reproducer container

docker commit triton_internal_issue_1883 rocm/pytorch-private:triton_internal_issue_1883
docker login -u rocmshared
docker push rocm/pytorch-private:triton_internal_issue_1883
docker logout

You can go straight to step 6 after pulling the container exported in step 7.

Matching Triton issue here: https://github.com/AMD-Triton/triton-tickets/issues/1883

Error logs

No response

Versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions