Closed pfultz2 closed 9 months ago
I confirm reproducability of a runtime memory fault on a gfx90a system.
(I also observe this is a fairly weird convolution where the input layout's something like HWNC but we've got a KCYX convolution, so we're hitting some very rarely exercised bits of code ... but why runtime memory fault, I haven't a clue)
Note to the future, disabling collapseContiguousMerges()
(that is, the following diff
diff --git a/mlir/lib/Dialect/Rock/utility/transformMapUtils.cpp b/mlir/lib/Dialect/Rock/utility/transformMapUtils.cpp
index 9344904be788..948ddc456760 100644
--- a/mlir/lib/Dialect/Rock/utility/transformMapUtils.cpp
+++ b/mlir/lib/Dialect/Rock/utility/transformMapUtils.cpp
@@ -815,6 +815,7 @@ int64_t mlir::rock::getMaxVectorizationForDatatype(
ArrayAttr mlir::rock::collapseContiguousMerges(ArrayAttr transforms,
ArrayRef<int64_t> outputShape) {
+ return transforms;
ContiguousMergesMap contigousMerges =
findContiguousGroups(transforms, outputShape);
SmallVector<Attribute> newTransformMaps;
is a resolution. I wouldn't use it as The Solution unless debugging fails massively, but at least we've got a small set of functions to scrutinize for incorrect behavior under edge cases.
Further update (patch is cooking, pending adding a test for this case):
The general shape of the buggy scenario looks like H, W, N = Merge{256, 256, 1}(gemmN, K = gemmM; permute (HKWN) to (NKHW);
where the "hey, are we dividing things up only to multiply them back together again" code gets too optimistic about roping in unit dimensions that aren't actually in the middle of the contiguous region, leading to that first Merge being incorrectly rewritten to Merge{1, 1, 65536}
, which then launches array accesses into the stratosphere. The correct rewrite, post-patch, is going to Merge{1, 65536, 1}
, which does what we were wanting this whole time.
This is trace from the crash that includes the mlir program and tuning problem and solution keys:
DoD