Skip to content

Commit 05348af

Browse files
committed
Merge remote-tracking branch 'origin/main' into quinnlp/fused-xeforge
2 parents 442783b + c9e94ee commit 05348af

120 files changed

Lines changed: 6163 additions & 1384 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-benchmarks-wheel.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
name: Build benchmarks wheel
22

3+
# Wheels are signed with keyless Sigstore (OIDC). Each *.whl is accompanied by a
4+
# *.whl.sigstore.json bundle in the benchmarks-wheel-py* artifacts.
5+
#
6+
# Verify a downloaded benchmarks wheel + bundle:
7+
# cosign verify-blob triton_kernels_benchmark-*.whl \
8+
# --bundle triton_kernels_benchmark-*.whl.sigstore.json \
9+
# --certificate-oidc-issuer https://token.actions.githubusercontent.com \
10+
# --certificate-identity-regexp \
11+
# 'https://github.com/intel/intel-xpu-backend-for-triton/.github/workflows/build-benchmarks-wheel.yml@.*'
12+
313
on:
414
workflow_dispatch:
515
workflow_call:
@@ -42,6 +52,9 @@ jobs:
4252
fail-fast: false
4353
max-parallel: 2
4454
timeout-minutes: 120
55+
permissions:
56+
id-token: write # required for keyless Sigstore/OIDC signing
57+
contents: read
4558
defaults:
4659
run:
4760
shell: bash -noprofile --norc -eo pipefail -c "source /opt/intel/oneapi/setvars.sh > /dev/null; source {0}"
@@ -66,6 +79,12 @@ jobs:
6679
cd benchmarks
6780
python -m build --wheel --no-isolation
6881
82+
- name: Sign wheels with Sigstore (keyless)
83+
# SHA-pinned for supply-chain safety; comment tracks the human-readable version.
84+
uses: sigstore/gh-action-sigstore-python@a5caf349bc536fbef3668a10ed7f5cd309a4b53d # v3.2.0
85+
with:
86+
inputs: benchmarks/dist/*.whl
87+
6988
- name: Install benchmarks wheel
7089
run: |
7190
# Uninstall first — see install-benchmarks/action.yml for full rationale.
@@ -81,4 +100,6 @@ jobs:
81100
uses: actions/upload-artifact@v7
82101
with:
83102
name: benchmarks-wheel-py${{ matrix.python }}
84-
path: benchmarks/dist/*.whl
103+
path: |
104+
benchmarks/dist/*.whl
105+
benchmarks/dist/*.whl.sigstore.json

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,6 @@ jobs:
389389
use_pyenv: ${{ inputs.use_pyenv_python }}
390390

391391
- name: Ensure job status
392-
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe
392+
uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35
393393
with:
394394
jobs: ${{ toJSON(needs) }}

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jobs:
104104
/opt/google/chrome/chrome --version
105105
106106
- name: Generate Security Report
107-
uses: rsdmike/github-security-report-action@v3.0.4
107+
uses: rsdmike/github-security-report-action@1df22b1e0a7e15b32f728ccf7bab259e46c80589 # v4.0.1
108108
with:
109109
template: report
110110
token: ${{ secrets.SECURITY_TOKEN }}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
TRITON_BUILD_WITH_CLANG_LLD: "TRUE"
4848
TRITON_USE_ASSERT_ENABLED_LLVM: "TRUE"
4949
TRITON_DISABLE_LINE_INFO: 1
50-
PROTON_SKIP_CUDAGRAPH_TEST: 1
5150
PROTON_SKIP_PC_SAMPLING_TEST: 1
51+
PROTON_SKIP_CUDAGRAPH_TEST: 1
5252
PYTHON: "python3"
5353
PYTEST_ADDOPTS: "-p triton._compile_warmup"
5454
CCACHE_COMPRESS: "true"
@@ -221,7 +221,7 @@ jobs:
221221
- name: Run Proton tests
222222
run: |
223223
unset HIP_VISIBLE_DEVICES
224-
make test-proton
224+
TRITON_DISABLE_LINE_INFO=0 make test-proton
225225
- name: Inspect cache directories
226226
run: |
227227
mkdir -p ~/.triton
@@ -346,7 +346,7 @@ jobs:
346346
fi
347347
done
348348
export LD_LIBRARY_PATH="$ROCM_SDK_LIB:$LD_LIBRARY_PATH"
349-
make test-proton
349+
TRITON_DISABLE_LINE_INFO=0 make test-proton
350350
- name: Inspect cache directories
351351
run: |
352352
mkdir -p ~/.triton

.github/workflows/nightly-wheels.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
name: Triton wheels
22

3+
# Wheels are signed with keyless Sigstore (OIDC). Each *.whl is accompanied by a
4+
# *.whl.sigstore.json bundle in the wheels-* artifacts.
5+
#
6+
# Verify a downloaded wheel + bundle:
7+
# cosign verify-blob <wheel_name>.whl \
8+
# --bundle <wheel_name>.whl.sigstore.json \
9+
# --certificate-oidc-issuer https://token.actions.githubusercontent.com \
10+
# --certificate-identity-regexp \
11+
# 'https://github.com/intel/intel-xpu-backend-for-triton/.github/workflows/nightly-wheels.yml@.*'
12+
313
on:
414
workflow_dispatch:
515
schedule:
@@ -41,9 +51,12 @@ jobs:
4151
- "3.12"
4252
- "3.13"
4353
- "3.14"
44-
- "3.15.0-beta.2"
54+
- "3.15.0-rc.1"
4555
fail-fast: false
4656
max-parallel: 2
57+
permissions:
58+
id-token: write # required for keyless Sigstore/OIDC signing
59+
contents: read
4760
defaults:
4861
run:
4962
shell: bash -noprofile --norc -eo pipefail -c "source /opt/intel/oneapi/setvars.sh > /dev/null; source {0}"
@@ -134,13 +147,26 @@ jobs:
134147
cp -L timm*/dist/*.whl wheels/ 2>/dev/null || true
135148
ls -lh wheels/
136149
150+
- name: Sign PyTorch-related wheels with Sigstore (keyless)
151+
# SHA-pinned for supply-chain safety; comment tracks the human-readable version.
152+
uses: sigstore/gh-action-sigstore-python@a5caf349bc536fbef3668a10ed7f5cd309a4b53d # v3.2.0
153+
with:
154+
inputs: wheels/*.whl
155+
137156
- name: Prepare vLLM wheels for upload
138157
if: contains(fromJSON('["3.10", "3.11", "3.12"]'), matrix.python)
139158
run: |
140159
mkdir -p wheels-vllm
141160
cp -L vllm-xpu-kernels/dist/*.whl wheels-vllm/
142161
ls -lh wheels-vllm/
143162
163+
- name: Sign vLLM wheels with Sigstore (keyless)
164+
if: contains(fromJSON('["3.10", "3.11", "3.12"]'), matrix.python)
165+
# SHA-pinned for supply-chain safety; comment tracks the human-readable version.
166+
uses: sigstore/gh-action-sigstore-python@a5caf349bc536fbef3668a10ed7f5cd309a4b53d # v3.2.0
167+
with:
168+
inputs: wheels-vllm/*.whl
169+
144170
- name: Report environment details
145171
run: |
146172
reports_file="wheels/.env"

.github/workflows/vllm-tests-reusable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
- vllm-tdesc
145145
- vllm-rest
146146
runs-on: ${{ fromJSON((inputs.runner_label == '' || startsWith(inputs.runner_label, 'max')) && format('["linux", "rolling", "{0}"]', inputs.runner_label || 'max1100') || format('["linux", "{0}"]', inputs.runner_label)) }}
147-
timeout-minutes: 180
147+
timeout-minutes: 240
148148
defaults:
149149
run:
150150
shell: bash -noprofile --norc -eo pipefail -c "source /opt/intel/oneapi/setvars.sh > /dev/null; source {0}"

bin/RegisterTritonDialects.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ void registerTestMembarPass();
7676
void registerTestAMDGPUMembarPass();
7777
void registerTestTritonAMDGPURangeAnalysis();
7878
void registerTestLoopPeelingPass();
79+
void registerTestRegisterPressurePass();
7980
namespace proton {
8081
void registerTestScopeIdAllocationPass();
8182
} // namespace proton
@@ -103,6 +104,7 @@ inline void registerTritonDialects(mlir::DialectRegistry &registry) {
103104
mlir::test::registerTestLoopPeelingPass();
104105
mlir::test::registerTestAMDGPUMembarPass();
105106
mlir::test::registerTestTritonAMDGPURangeAnalysis();
107+
mlir::test::registerTestRegisterPressurePass();
106108
mlir::triton::registerConvertTritonToTritonGPUPass();
107109
mlir::triton::intel::registerTritonIntelDescriptorVersioning();
108110
mlir::triton::intel::registerTritonIntelFuseReshape();

include/triton/Analysis/Allocation.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "llvm/ADT/SetVector.h"
1010

1111
#include <limits>
12+
#include <optional>
1213

1314
namespace mlir {
1415

@@ -24,6 +25,12 @@ unsigned defaultAllocationAnalysisScratchSizeFn(Operation *op);
2425
/// Returns whether an operation uses scratch memory across CTAs.
2526
bool hasCrossCTAScratch(Operation *op);
2627

28+
/// For atomic-result scratch, returns the CTA bits broadcast from
29+
/// each group leader. Physical scratch owners have these bits clear.
30+
/// Scalar results are broadcast from CTA0 across all CTAs.
31+
/// Callers check whether scratch has been allocated.
32+
std::optional<uint16_t> getAtomicScratchBroadcastMask(Operation *op);
33+
2734
unsigned getNumScratchElemsSwizzledCvt(const LinearLayout &srcLayout,
2835
const LinearLayout &dstLayout,
2936
int bitwidth, int numBanks = 32,

include/triton/Analysis/BufferRegion.h

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define TRITON_ANALYSIS_BUFFER_REGION_H
33

44
#include <cstdint>
5+
#include <memory>
56
#include <optional>
67
#include <set>
78
#include <tuple>
@@ -19,6 +20,11 @@
1920
#include "llvm/ADT/SparseBitVector.h"
2021
#include "llvm/ADT/UniqueVector.h"
2122

23+
namespace mlir {
24+
class Allocation;
25+
class ModuleAllocation;
26+
} // namespace mlir
27+
2228
namespace mlir::triton::gpu {
2329
enum class SharedKind : uint32_t;
2430
}
@@ -121,11 +127,8 @@ struct BufferRegionView {
121127
uint32_t affineCTAOffset = 0;
122128
/// Deterministically interned identity of the owning allocation frame.
123129
uint32_t allocationFrame = 0;
124-
125-
bool intersects(const BufferRegionView &other) const {
126-
return allocationFrame == other.allocationFrame &&
127-
region.intersects(other.region);
128-
}
130+
/// Descriptor allocation supplying these views; null for implicit scratch.
131+
Operation *allocation = nullptr;
129132

130133
bool contains(const BufferRegionView &other) const {
131134
return allocationFrame == other.allocationFrame &&
@@ -138,7 +141,8 @@ struct BufferRegionView {
138141
private:
139142
auto key() const {
140143
return std::tie(allocationFrame, region, storageBase, affineOffset,
141-
affinePartitionOffset, affineCTAOffset, partitionBases);
144+
affinePartitionOffset, affineCTAOffset, partitionBases,
145+
allocation);
142146
}
143147

144148
public:
@@ -151,9 +155,6 @@ struct BufferRegionView {
151155
}
152156
};
153157

154-
/// An exact access view, or no view when the physical region is unknown.
155-
using BufferRegionAccess = std::optional<BufferRegionView>;
156-
157158
//===----------------------------------------------------------------------===//
158159
// Buffer state planning
159160
//===----------------------------------------------------------------------===//
@@ -223,6 +224,20 @@ struct RegionInfo {
223224
}
224225
};
225226

227+
/// Complete MAY-views of a descriptor, shared by all of its memory effects.
228+
/// Runtime indices may select several physical views across loop iterations.
229+
/// Addresses, rather than runtime descriptor keys, define the geometry; the
230+
/// memory space distinguishes shared bytes from TMEM's 32-bit storage words.
231+
struct BufferRegionFootprint {
232+
Attribute memorySpace;
233+
RegionInfo regionInfo;
234+
};
235+
236+
/// Prove disjointness only if every candidate pair is disjoint. Missing views
237+
/// and unnormalized allocation frames may overlap, never denote empty storage.
238+
bool mayOverlap(const BufferRegionFootprint *lhs,
239+
const BufferRegionFootprint *rhs);
240+
226241
enum class RW { Read, Write };
227242

228243
struct MemoryAccess {
@@ -250,6 +265,7 @@ bool hasSharedAccess(Operation *op,
250265
//
251266
// Produces a RegionInfo lattice for each MemDesc/ptr-like SSA value,
252267
// and also collects a global list of all discovered BufferRegions.
268+
// Requires completed allocation analyses or their materialized offsets.
253269
//
254270
class BufferRegionAnalysis : public dataflow::SparseForwardDataFlowAnalysis<
255271
dataflow::Lattice<RegionInfo>> {
@@ -258,23 +274,37 @@ class BufferRegionAnalysis : public dataflow::SparseForwardDataFlowAnalysis<
258274
using Base =
259275
dataflow::SparseForwardDataFlowAnalysis<dataflow::Lattice<RegionInfo>>;
260276
using Base::getLatticeElement;
261-
using Base::SparseForwardDataFlowAnalysis;
277+
enum class Mode { AllMemory, TensorMemoryOnly };
278+
279+
explicit BufferRegionAnalysis(DataFlowSolver &solver,
280+
Mode mode = Mode::AllMemory,
281+
ModuleAllocation *allocation = nullptr)
282+
: Base(solver), mode(mode), moduleAllocation(allocation) {}
262283

263284
enum RegionType { SHARED_MEMORY, TENSOR_MEMORY, BARRIER, NUM_REGION_TYPES };
264285

265286
const RegionInfo &getRegionInfo(Value value) {
266287
return getLatticeElement(value)->getValue();
267288
}
268289

269-
/// Return every exact view an access may reference. A null view represents
270-
/// an unknown region and therefore may alias any other view.
271-
llvm::SmallVector<BufferRegionAccess> getAccessRegions(Value value);
290+
/// Return an immutable footprint covering every possible view, owned by this
291+
/// analysis. Call after solver convergence. Return null for unknown geometry
292+
/// or views outside allocationFrame, when set.
293+
const BufferRegionFootprint *
294+
getFootprint(Value value, FunctionOpInterface allocationFrame = {});
295+
296+
/// Describe an operation's allocated shared scratch, including cross-CTA
297+
/// accesses.
298+
const BufferRegionFootprint *getScratchFootprint(Operation *op);
272299

273-
/// Translate a callee-local view into the caller's allocation frame.
274-
BufferRegionAccess translateToCallsite(BufferRegionAccess view,
275-
CallOpInterface call,
276-
FunctionOpInterface caller,
277-
FunctionOpInterface callee) const;
300+
/// Translate callee-local views into the caller's allocation frame, caching
301+
/// the complete footprint and preserving views already in other frames.
302+
const BufferRegionFootprint *
303+
translateToCallsite(const BufferRegionFootprint *footprint,
304+
CallOpInterface call, FunctionOpInterface callee);
305+
306+
/// Shared-memory offset of the callee frame in the caller's allocation.
307+
uint32_t getCallOffset(CallOpInterface call) const;
278308

279309
uint32_t getOperationId(Operation *operation) const {
280310
return operationInterner.idFor(operation);
@@ -313,6 +343,11 @@ class BufferRegionAnalysis : public dataflow::SparseForwardDataFlowAnalysis<
313343
LogicalResult initialize(Operation *top) override;
314344

315345
private:
346+
const Mode mode;
347+
ModuleAllocation *moduleAllocation;
348+
349+
Allocation *getAllocation(Operation *op) const;
350+
316351
BufferRegionView getAllocView(Value allocation, uint32_t storageBase,
317352
llvm::ArrayRef<uint32_t> partitionBases = {});
318353
BufferRegionView getSubView(Type type, const BufferRegionView &view,
@@ -323,7 +358,15 @@ class BufferRegionAnalysis : public dataflow::SparseForwardDataFlowAnalysis<
323358
// Global registry of all regions
324359
std::set<BufferRegion> usedBufferRegions[NUM_REGION_TYPES];
325360
bool usedUnknownBufferRegions[NUM_REGION_TYPES] = {};
326-
llvm::DenseMap<std::pair<Type, uint32_t>, AddressSet> footprintCache;
361+
llvm::DenseMap<std::pair<Type, uint32_t>,
362+
llvm::SmallVector<BufferRegion::CTAAddresses, 2>>
363+
footprintCache;
364+
llvm::DenseMap<Value, std::unique_ptr<BufferRegionFootprint>> valueFootprints;
365+
llvm::DenseMap<Operation *, std::unique_ptr<BufferRegionFootprint>>
366+
scratchFootprints;
367+
llvm::DenseMap<std::pair<const BufferRegionFootprint *, Operation *>,
368+
std::unique_ptr<BufferRegionFootprint>>
369+
callsiteFootprints;
327370
llvm::UniqueVector<Operation *> operationInterner;
328371
};
329372

0 commit comments

Comments
 (0)