Skip to content

Commit bf90b0b

Browse files
committed
[GSan] Model TMAReduceOp as atomic
Previously we were modelling it as a non-atomic store. This now models it as atomic, but is still not 100% right as we're doing the shadow cell update eagerly before the TMA operation has completed. git-pr-chain: gsan_model_tmareduceop_as_atomic_eab3
1 parent 6ee5472 commit bf90b0b

File tree

6 files changed

+329
-110
lines changed

6 files changed

+329
-110
lines changed

include/triton/Dialect/TritonInstrument/IR/TritonInstrumentOps.td

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,38 @@ def TTI_ExperimentalGSanTensorDescInfoOp
9999

100100
def TTI_ExperimentalGSanTensorAccessOp
101101
: TTI_Op<"experimental_gsan_tensor_access",
102-
[MemoryEffects<[MemWrite<GlobalMemory>, MemWrite<GlobalMemory>]>,
103-
TypesMatchWith<"mask type matches ptr type", "ptr", "mask",
102+
[TypesMatchWith<"mask type matches ptr type", "ptr", "mask",
104103
"getI1SameShape(getPointeeType($_self))",
105104
"($_op.getOperands().size() <= 1) || std::equal_to<>()">]> {
106105
let summary = "Instrument a tensor load/store access for GSan";
107106
let description = [{
108107
Emits runtime instrumentation for a tensor pointer access. The pointer and
109108
optional mask are consumed by the GSan runtime.
110109
}];
111-
let arguments = (ins TT_PtrLike:$ptr, Optional<TT_BoolLike>:$mask,
112-
BoolAttr:$isStore);
110+
let arguments = (ins Arg<TT_PtrLike, "", [MemWrite<GlobalMemory>, MemRead<GlobalMemory>]>:$ptr,
111+
Optional<TT_BoolLike>:$mask, BoolAttr:$isStore);
113112
let assemblyFormat = [{
114113
$ptr `,` $isStore (`,` $mask^)? attr-dict `:` type($ptr)
115114
}];
116115
}
117116

117+
def TTI_ExperimentalGSanAtomicTensorAccessOp
118+
: TTI_Op<"experimental_gsan_atomic_tensor_access",
119+
[TypesMatchWith<"mask type matches ptr type", "ptr", "mask",
120+
"getI1SameShape(getPointeeType($_self))",
121+
"($_op.getOperands().size() <= 1) || std::equal_to<>()">]> {
122+
let summary = "Instrument a tensor atomic access for GSan";
123+
let description = [{
124+
Emits runtime instrumentation for a tensor pointer access whose individual
125+
elements are atomic read-modify-write operations.
126+
}];
127+
let arguments = (ins Arg<TT_PtrLike, "", [MemWrite<GlobalMemory>, MemRead<GlobalMemory>]>:$ptr,
128+
Optional<TT_BoolLike>:$mask, TT_MemSemanticAttr:$sem, TT_MemSyncScopeAttr:$scope);
129+
let assemblyFormat = [{
130+
$sem `,` $scope `,` $ptr (`,` $mask^)? attr-dict `:` type($ptr)
131+
}];
132+
}
133+
118134
def TTI_ExperimentalGSanAtomicRMWOp : TTI_Op<"experimental_gsan_atomic_rmw", [
119135
SameOperandsAndResultShape,
120136
SameOperandsAndResultEncoding,

0 commit comments

Comments
 (0)