Merge OpenAI Triton commit c393f1b#7572
Open
wdziurdz wants to merge 31 commits into
Open
Conversation
Restores the correctness portion of #10922 for ClusterBarrierInsertion, a tiny fix in a lowering, and proper typing of the barriers in CLC.
CPU Chrome events currently carry Proton's internal trace event ID for CPU-to-GPU flow matching, but that ID is not exposed by Python proton.scope. Preserve and export the original scope ID so an external tracer can deterministically link its scope-entry flow to the corresponding CPU event. This allows us to do something like lightseekorg/tokenspeed#740 (comment) --------- Signed-off-by: Lei Zhang <antiagainst@gmail.com>
Fixes several gfx1250 gluon test issues around async waits and input ranges and cache mods.
```
commit 909ba8d3508cf7177da65a4d1399f7bc5a3a4b98
Author: Changpeng Fang <changpeng.fang@amd.com>
Date: Thu Jul 16 12:30:39 2026 -0700
[AMDGPU] Select upper 16-bits for inline constants in packed BF16 (#209861)
From gfx1250 software programming guide, v_pk_*_bf16 instructions using
inline constants must use OPSEL to select the upper 16-bits.
Fixes: LCOMPILER-2445
```
PR description written by Codex Cluster barrier `arrive` and `wait` don't work under warp specialization, aren't modeled by consan, gsan, etc. and generally have ill-defined semantics. Presently, they are only used by low-level lowering (TMEM allocation/deallocation). The mbarrier init fence is also inserted automatically by the compiler. Remove them from the public Gluon API to prevent misuse.
PR description written by Codex Atomics get cluster barriers, and also broadcast their result across CTAs in multi-CTA kernels. When those atomic ops are converted to GSAN instrumented ops, the corresponding GSAN ops aren't lowered the same way. Introduce an `AtomicOpInterface` and unify the atomic lowering logic. Without this, multi-CTA kernels with atomics miscompile under GSAN.
Before this PR scaled_upcast required unpacked scales which did result in unnecessary reshape + convert_layout, which did cause a roundtrip to LDS in some cases. With this PR we can do a `scaled_upcast` which directly feeds a dot without any expensive `convert_layouts` (they will be nops). The lowering is generalized to build a map from 8-packed elements to their scales value instead of hardcoding the distribution of scales to registers. This allows us to handle arbitrary "BLOCK_SCALE" values along the axis dim, the only real requirement is that 8 contiguous fp4 values use the same scale (intrinsic requirement). The verifier is extended to infer the scale layout from the output encoding which will also be used to verify the passed layout from Gluon. Note that we remove broadcasting dims for the comparison since the lowering will do the coordinate based lookup so broadcasting dims will be ignored anyways. The intrinsic also supports `opsel` to densely pack/select the fp8 scales into/from registers, this will be added in a follow up PR and will be done purely in the lowering of the op.
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/setup-python/releases">actions/setup-python's releases</a>.</em></p> <blockquote> <h2>v7.0.0</h2> <h2>What's Changed</h2> <h3>Enhancements</h3> <ul> <li>Migrate to ESM and upgrade dependencies by <a href="https://github.com/priyagupta108"><code>@priyagupta108</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1330">actions/setup-python#1330</a></li> <li>Pin SHA commits and update docs with latest versions by <a href="https://github.com/HarithaVattikuti"><code>@HarithaVattikuti</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1338">actions/setup-python#1338</a></li> <li>Remove the pip-install input by <a href="https://github.com/gowridurgad"><code>@gowridurgad</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1336">actions/setup-python#1336</a></li> </ul> <h3>Bug Fix</h3> <ul> <li>Fix to Classify stderr warning messages as warnings instead of errors in annotations by <a href="https://github.com/lmvysakh"><code>@lmvysakh</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1335">actions/setup-python#1335</a></li> <li>Validate and retry manifest fetch to prevent silent failures by <a href="https://github.com/priyagupta108"><code>@priyagupta108</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1332">actions/setup-python#1332</a></li> </ul> <h3>Dependency Upgrade</h3> <ul> <li>Bump certifi from 2020.6.20 to 2024.7.4 in /<strong>tests</strong>/data by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1328">actions/setup-python#1328</a></li> <li>Remove EOL Python versions and Bumps numpy text fixture by <a href="https://github.com/priya-kinthali"><code>@priya-kinthali</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1333">actions/setup-python#1333</a></li> <li>Upgrade <code>@actions/cache</code> to 6.2.0 by <a href="https://github.com/philip-gai"><code>@philip-gai</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1337">actions/setup-python#1337</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/lmvysakh"><code>@lmvysakh</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-python/pull/1335">actions/setup-python#1335</a></li> <li><a href="https://github.com/philip-gai"><code>@philip-gai</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-python/pull/1337">actions/setup-python#1337</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/setup-python/compare/v6...v7.0.0">https://github.com/actions/setup-python/compare/v6...v7.0.0</a></p> <h2>v6.3.0</h2> <h2>What's Changed</h2> <h3>Enhancement</h3> <ul> <li>Add RHEL support and include Linux distro in cache keys by <a href="https://github.com/priyagupta108"><code>@priyagupta108</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1323">actions/setup-python#1323</a></li> <li>Fix pip cache error handling on Windows by <a href="https://github.com/priyagupta108"><code>@priyagupta108</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1040">actions/setup-python#1040</a></li> </ul> <h3>Dependency update</h3> <ul> <li>Upgrade minimatch from 3.1.2 to 3.1.5 by <a href="https://github.com/dependabot"><code>@dependabot</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1281">actions/setup-python#1281</a></li> <li>Upgrade actions dependencies by <a href="https://github.com/gowridurgad"><code>@gowridurgad</code></a> with <a href="https://github.com/Copilot"><code>@Copilot</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1303">actions/setup-python#1303</a></li> <li>Upgrade <code>@actions/cache</code> to 5.1.0, log cache write denied by <a href="https://github.com/jasongin"><code>@jasongin</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1324">actions/setup-python#1324</a></li> <li>Upgrade dependency versions and test workflow configuration by <a href="https://github.com/HarithaVattikuti"><code>@HarithaVattikuti</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1322">actions/setup-python#1322</a></li> </ul> <h3>Documentation</h3> <ul> <li>Update advanced-usage.md by <a href="https://github.com/Dunky-Z"><code>@Dunky-Z</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/811">actions/setup-python#811</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/gowridurgad"><code>@gowridurgad</code></a> with <a href="https://github.com/Copilot"><code>@Copilot</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-python/pull/1303">actions/setup-python#1303</a></li> <li><a href="https://github.com/jasongin"><code>@jasongin</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-python/pull/1324">actions/setup-python#1324</a></li> <li><a href="https://github.com/Dunky-Z"><code>@Dunky-Z</code></a> made their first contribution in <a href="https://redirect.github.com/actions/setup-python/pull/811">actions/setup-python#811</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/setup-python/compare/v6.2.0...v6.3.0">https://github.com/actions/setup-python/compare/v6.2.0...v6.3.0</a></p> <h2>v6.2.0</h2> <h2>What's Changed</h2> <h3>Dependency Upgrades</h3> <ul> <li>Upgrade dependencies to Node 24 compatible versions by <a href="https://github.com/salmanmkc"><code>@salmanmkc</code></a> in <a href="https://redirect.github.com/actions/setup-python/pull/1259">actions/setup-python#1259</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/actions/setup-python/commit/5fda3b95a4ea91299a34e894583c3862153e4b97"><code>5fda3b9</code></a> Pin SHA commits and update docs with latest versions (<a href="https://redirect.github.com/actions/setup-python/issues/1338">#1338</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/4ab7e95f05e168b4356aebde89dd84f59c283d8e"><code>4ab7e95</code></a> Merge pull request <a href="https://redirect.github.com/actions/setup-python/issues/1337">#1337</a> from actions/philip-gai/bump-actions-cache-6-2-0</li> <li><a href="https://github.com/actions/setup-python/commit/0f3a009f475dbea83c0371cd85d099690fee8c5c"><code>0f3a009</code></a> Remove the pip-install input (<a href="https://redirect.github.com/actions/setup-python/issues/1336">#1336</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/f8cf4291c8b8e273ddd26e569454615c7315d932"><code>f8cf429</code></a> Migrate to ESM and upgrade dependencies (<a href="https://redirect.github.com/actions/setup-python/issues/1330">#1330</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/54baeea5b34417d10a7479663a23cca53ea209b5"><code>54baeea</code></a> Validate and retry manifest fetch to prevent silent failures (<a href="https://redirect.github.com/actions/setup-python/issues/1332">#1332</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/c7092773a316760f4ecfe498e4af668a4dafeac5"><code>c709277</code></a> Annotation code fix (<a href="https://redirect.github.com/actions/setup-python/issues/1335">#1335</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/6849080452e69b330395e8a6d23cf90f56d76a1a"><code>6849080</code></a> remove EOL Python versions and Bumps numpy text fixture (<a href="https://redirect.github.com/actions/setup-python/issues/1333">#1333</a>)</li> <li><a href="https://github.com/actions/setup-python/commit/0903b469fbf4441aadfe4f4b249dc5b1fba3a73e"><code>0903b46</code></a> Bump certifi from 2020.6.20 to 2024.7.4 in /<strong>tests</strong>/data (<a href="https://redirect.github.com/actions/setup-python/issues/1328">#1328</a>)</li> <li>See full diff in <a href="https://github.com/actions/setup-python/compare/v6...v7">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
PR description written by Codex Refactors recurring LinearLayout operations into a small set of reusable utilities: - input and output basis masks; - checked optional `lstsq` factorization; - maximal identity-prefix factoring; and - order-preserving dimension renaming. The existing specialized `f2reduce` implementations stay in place. This PR does not add a general matrix subsystem or change memdesc semantics. ## Stack Merge bottom-up: - [ ] #10946 (this PR) - [ ] #10947
…h-size recompiles) (#10875) Fixes #10872. `topk_forward` allocates the bitmatrix with `stride(1) = cdiv(n_rows, 32) * 32`, but `_topk_forward` and `_sum_bitmatrix_rows` declare their bitmatrix strides `tl.constexpr`, so every new 32-row bucket of `n_rows` triggers a full recompile at run time (~700ms each). In LLM serving `n_rows` is the per-batch token count, so this fires continually on the request path — originally observed as recurring ~1s TTFT stalls on a production gpt-oss-120b deployment (4×H100, TP4; details and standalone repro in #10872). The strides only feed address arithmetic: `stride_rm == 1` still specializes to a constexpr via the `==1` rule, and `stride_rn` is always a multiple of 32 so the divisibility-16 specialization keeps the alignment facts. Generated PTX is unchanged for both kernels (identical global memory-op histograms; neither kernel has any vectorised access involving these strides — the only wide loads are the logits reads on a literal stride-1 axis), kernel timing is flat, and outputs are bit-identical. Controlled serving A/B (sglang `triton_kernel` MoE backend, gpt-oss-20b on 1×H100 — same kernels/quantization as 120b, sized for paired experiments; cold engine, identical 200-request varied-length sequences at 1 QPS): - steady state: stalls from these two kernels drop to zero — stock still hits fresh recompiles indefinitely as new lengths arrive (p99 TTFT 682ms, stalls ongoing after 200 warmup requests); fixed: p99 316ms = p50, no stalls. - whole cold run including startup: 66/200 → 14/200 requests >500ms. The residual 14 are first-encounter compiles of unrelated kernels' bounded config space (matmul block_m/split_k variants): 9 in the initial burst plus 5 isolated later first-touches — at identical request positions with near-identical durations whether or not this PR's patches are applied (and present in the stock run at the same positions), confirming they are independent of these two kernels. Zero events in the subsequent 100-request phase. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
On pre-Rubin we just emit one arrive instruction that's executed from the first `num_ctas` threads. On Rubin, we use the new `multitcast` arrive.
We found this interesting problem with in multicta consan where you
have a pattern that looks as follows in the CLC partition:
``` python
@gluon.jit
def consumer(slot, sink, consumed, layout: ttgl.constexpr):
value = slot.load(layout)
sink.store(value)
mbarrier.arrive(consumed, count=1)
@gluon.jit
def clc_partition(slot, result, clc_bar, consumed):
mbarrier.wait(consumed, 0, deps=[slot])
mbarrier.expect(clc_bar, 16)
clc.try_cancel(result, clc_bar)
mbarrier.wait(clc_bar, 0)
clc.load_result(result)
slot.store(gl.full([1], 1, gl.int64, layout=layout))
```
Assume the kernel has 2 CTAs.
Then, the way that CLC works on multicast is that CTA0 tries to cancel
a block, and if it manages to do so, multicasts the result to all CTAs
(into `result` in this example).
What's rather surprising is that waiting on CTA1 on the the `clc_bar`
where
this arrive is broadcasted DOES NOT transfer the visibility of the
`slot.load` from CTA0 to CTA1 so it sees `slot.store` as a race.
This is quite crazy as clearly there isn't a way for `slot.store` to
execute before the `slot.load` in the `consumer` partition has finished!
According to codex:
```
In this case there is an operational chain:
load finishes
→ consumed arrival
→ consumed wait finishes
→ CLC is issued
→ CLC completes
→ CLC wait finishes
→ store executes
so it is entirely reasonable to conclude that the load/store cannot physically overlap.
What PTX declines to infer is a transitive memory-synchronization edge through CLC.
CLC guarantees completion and visibility of its own response writes; it does not say
that completion publishes arbitrary operations that happened before the request was issued.
This is intentional conservatism in the model, not an internal contradiction: completion/execution
order and cross-thread memory causality are separate concepts. In fact, the official CLC
example explicitly inserts synchronization between iterations before reusing the response storage;
it does not rely on CLC completion to order prior accesses. PTX CLC example
```
This PR adds a `0 <= mask < num_ctas` whose on-bits represent the bits
of the CTA that we shall use as the origin of the arrive / expect. In
other words, we predicate the instruction by `cta_id & mask`. This
allows us in this case to send the arrive / expect from CTA0 to all CTAs
effectively sending the frontier visibility from CTA0 to all other CTAs
when they wait on the barrier.
e.g. for 8 CTAS and `mask = 0x011`:
```
CTA0 -> CTA0, CTA4
CTA1 -> CTA1, CTA5
CTA2 -> CTA2, CTA6
CTA3 -> CTA3, CTA7
CTA4-7 -> predicated
```
and 8CTAs for `mask = 0b110`:
```
CTA0 -> CTA0, CTA1
CTA1 -> predicated
CTA2 -> CTA2, CTA3
CTA3 -> predicated
CTA4 -> CTA4, CTA5
CTA5 -> predicated
CTA6 -> CTA6, CTA7
CTA7 -> predicated
...
I also renamed and reordered the masks that `arrive` may receive.
…ng the same accumulator" (#10988) reland triton-lang/triton#10858. It was revert due to a wrong bisect.
## Summary Add an opt-in `TRITON_FPSAN_HOMOMORPHIC_CASTS` compilation flag that restores truncating FPSan payload downcasts. The default FPSan behavior remains unchanged. When enabled, narrowing drops the high payload bits without folding them into the retained bits, allowing independently computed BF16 matmul partials to be combined bitwise: ```python x @ w == x[:, :half] @ w[:half, :] + x[:, half:] @ w[half:, :] ``` This permits distributed BF16 reductions to retain the normal FP32 matmul accumulator while preserving FPSan parity across sharding layouts. The flag can be configured programmatically: ```python triton.knobs.compilation.fpsan_homomorphic_casts = True ``` or through the environment: ```bash TRITON_FPSAN_HOMOMORPHIC_CASTS=1 ``` and is included in the compiler cache key. ## Test plan Added a deterministic BF16-dot sharding test using a payload carry witness: ```text 0x00ff * 0x0101 + 1 = 0x00010000 ``` The test is strict-XFAIL with the flag disabled and passes with it enabled. Validated on GB300: ```text 13 passed, 1 xfailed FPSan lit checks: PASS ```
PR description written by Codex Allow non-duplicating cast/broadcast layout-conversion hoists when rematerialization splitting is disabled, while retaining the existing multi-use guard. This fixes four ConSan matmul compilations whose shared-memory requirement was 236,764 bytes; SM100 compilation now requires 228,572 bytes with the same 12-warp, 2-CTA configuration. The focused removal, ConSan, and FPSan lit tests pass. This draft intentionally keeps the change scoped: forward layout-conflict resolution is still not shared-memory-aware and can increase conversion scratch for unrelated multi-layout cases. ## Stack Merge bottom-up: - [ ] #11003 (this PR)
…#10850) In hex mode, bitcast floating-point operands to same-width integers before printf promotion so their raw IEEE-754 bits live on NVIDIA and AMD backends. Format interpreter hex output using the operand dtype width and view floating-point values as unsigned integers. Extend device_print hex coverage to float16, float32, and float64, verify exact interpreter bit patterns, and check hard-coded fp32 canonical values for 1.0, negative zero, and positive and negative infinity. Tested with make and the full test_print matrix: 35 GPU tests and 35 interpreter tests pass. <!--- The core Triton is a small number of people, and we receive many PRs (thank you!). To help us review your code more quickly, **if you are a new contributor (less than 3 PRs merged) we ask that you complete the following tasks and include the filled-out checklist in your PR description.** Complete the following tasks before sending your PR, and replace `[ ]` with `[x]` to indicate you have done them. --> # New contributor declaration - [x] I am not making a trivial change, such as fixing a typo in a comment. - [x] I have written a PR description following these [rules](https://cbea.ms/git-commit/#why-not-how). - [x] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`. - Select one of the following. - [x] I have added tests. - `/test` for `lit` tests - `/unittest` for C++ tests - `/python/test` for end-to-end tests - [ ] This PR does not need a test because `FILL THIS IN`. - Select one of the following. - [x] I have not added any `lit` tests. - [ ] The `lit` tests I have added follow these [best practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices), including the "tests should be minimal" section. (Usually running Python code and using the instructions it generates is not minimal.)
… contiguosu subviews (#10997) PR description written by Codex As per title ## Stack Merge bottom-up: - [ ] #11006 - [ ] #10997 (this PR)
PR description written by Codex Fix multibuffer shared-memory subslices when the leading pipelining dimension is outside the layout rank, including physical offsets and buffer-region analysis. Allow tensor-memory scale subviews, centralize pipelining-dimension handling, and preserve the existing reinterpret and subview restrictions. Validated with the focused lit, C++ layout, Gluon GPU, and ConSan suites on GB300. ## Stack Merge bottom-up: - [ ] #10856 (this PR) --------- Co-authored-by: lezcano <lezcano-93@hotmail.com>
# New contributor declaration - [x] I am not making a trivial change, such as fixing a typo in a comment. - [x] I have written a PR description following these [rules](https://cbea.ms/git-commit/#why-not-how). - [x] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`. - Select one of the following. - [x] I have added tests. - `/test` for `lit` tests - `/unittest` for C++ tests - `/python/test` for end-to-end tests - Select one of the following. - [x] I have not added any `lit` tests. --- A fractional autotune `top_k` describes the fraction of candidate configurations to benchmark. When `early_config_prune` was also configured, the autotuner calculated that fraction from the original configuration list instead of the surviving list. ```text 10 configured | v 6 survive early pruning | +-- old: top_k = 50% of 10 -> benchmark 5 | +-- new: top_k = 50% of 6 -> benchmark 3 ``` This change calculates fractional `top_k` from `pruned_configs`, the set produced by `early_config_prune`. Integer `top_k`, performance-model ordering, and the existing guarantee that a fractional value retains at least one configuration are unchanged. The new `test_prune_configs_fractional_top_k_after_early_prune` exercises `Autotuner.run()` and verifies that early pruning retains 6 of 10 configurations, the performance model evaluates all 6 survivors, and `top_k=0.5` benchmarks exactly the fastest 3. Before the fix: ```text assert [1, 2, 3, 4, 5] == [1, 2, 3] 1 failed ``` After the fix: ```text 1 passed ``` ## Test plan - `test_prune_configs_fractional_top_k_after_early_prune` (`1 passed`) - `pre-commit run --from-ref origin/main --to-ref HEAD` - `git diff --check` Fixes #10964.
PR description written by Codex Synchronize participating warps after sampling the virtual cluster-barrier phase so they cannot wait for different rendezvous epochs. Cover implicit kernel-exit and explicit cluster barriers in two-CTA and four-CTA warp-specialized kernels. ## Stack Merge bottom-up: - [ ] #11010 (this PR)
Allow `@aggregate` types to participate in operator resolution with clear rules on resolution precedence for forward and reversed operators. Actual functional diff is +92, -57. Big test case adds an example on how to automatically decompose non-power-of-2 tensors using metaprogramming.
…32 (#10883)
## Summary
`computation_type_impl` already upcast `float16`/`bfloat16` to `float32`
for `/` and `%`, because those operations have no native form below
fp32. But the fp8 rule and the scalar branch didn't apply the same
logic, so `fp8 / fp8`, `fp8 % fp8`, and `scalar / fp8_tensor` kept
fp8/fp16 types for division and modulo.
Per lezcano's review, this PR now unifies the rule instead of patching
per-dtype: a single rule between rules 1 and 2 —
```python
# 2) if we have a div or a mod we upcast to `fp32` as div and mod are
# not supported for floats with bitwidth < 32
if div_or_mod and (a_ty.is_floating() or b_ty.is_floating()):
return tl.float32
```
— and removes the per-dtype `div_or_mod` branches it subsumes. The
scalar branch now checks `tensor_ty.is_floating()` so scalar-vs-fp8
division is covered by the same rule. `triton-semantics.rst` documents
the fp32 upcast for div/mod.
## Test plan
- New `test_fp8_div_mod_promotion` covers the matrix: fp8 same/mixed,
fp16, bf16, int (keeps integer promotion for `//` and `%`), and
scalar-vs-tensor operands, for both `/`/`%` and non-division ops.
- Verified on Linux with no GPU: the full 18-case type matrix through
`computation_type_impl` passes, and the parser-level `static_assert`
kernel passes.
This changes how GSan models stream synchronization. Each stream maintains a ring buffer of three vector clocks, and each kernel receives a monotonically increasing `kernel_id`. - At kernel completion, each CTA publishes its vector clock using an atomic max on `stream_clock[kernel_id % 3]`. - For a normal launch, the kernel initializes its clock from `stream_clock[(kernel_id - 1) % 3]`, acquiring the previous kernel’s aggregated clock. - For a PDL launch, the kernel initializes from `stream_clock[(kernel_id - 2) % 3]`, acquiring the kernel from two launches ago. - When a PDL kernel executes `gdc_wait`, it acquires `stream_clock[(kernel_id - 1) % 3]`, synchronizing with its immediate predecessor. This also completely removes the need for the separate `synchronize_launch_stream` function.
Currently containsLocalBarrier also assumes that the barrier happens before any memory effects, so an atomic with acquire effects which has the barrier after the memory effect is not handled correctly. This splits it into 3 stages: 1. beforeMemoryEffects -> e.g. atomic with release semantics 2. betweenMemoryEffects -> e.g. a cross-warp convert layout 3. afterMemoryEffects -> e.g. atomic_poll without a timeout Doing this allows us to model the outgoing memory effects more precisely, but not unconditionally skip inserting barriers before the op.
This PR is best reviewed commit by commit! We allow reshapes of subslices. The rules are: - The dst type may not be a subslice itself - The range covered by the dst type should be a contiguous chunk of memory owned by src - An memdesc without a subview is considered contiguous in all its image. If it does not cover all its image (because it has broadcasting) that's fine, because the allocator will always allocate a full contiguous chunk of memory for a given tensor. We also tighten a number of verifiers here and there. --------- Co-authored-by: lezcano <lezcano-93@hotmail.com>
This spiraled a little bit from noting that `getAllocationShapePerCTA` was incorrect for `SharedLinearLayout`s with broadcasting. I also noted that we never really need the "allocation shape" as it's not even a well defined concept in the presence of broadcasting. Instead, we compute the number of elements that we need to allocate, which is just the number of `kOffset` bases of the layout (+ pipelining) We also kill `getMemDescSize` which had similar issues. There is probably a bigger clean-up around computing shapes and things around shapes as we have a million helpers that compute similar but subtly different quantities without using the associated LinearLayouts, but I'm leaving that one for another day.
wdziurdz
force-pushed
the
dev/wdziurdz/merge-53
branch
from
July 24, 2026 11:30
7df3c97 to
a36a4cd
Compare
wdziurdz
force-pushed
the
dev/wdziurdz/merge-53
branch
from
July 24, 2026 11:40
a36a4cd to
a6b01bf
Compare
…++ arg-eval order GCC and Clang emit the xor operands in different order, so pin the two swappable ops with CHECK-DAG. Signed-off-by: Witold Dziurdz <witold.dziurdz@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes the Triton base from 215af05 to c393f1b (Jul 23) .
Pass rate: 99.32%->