Skip to content

Commit 1419f5b

Browse files
qedawkinsclaude
andauthored
[Integrate] Integrate llvm-project@66395ad94c32 (#23785)
- Remove `opt.NoNaNsFPMath = true` from ROCMTarget.cpp (field removed upstream in #186285). - Update convert_to_rocdl.mlir test: `rocdl.workgroup.dim.{x,y}` ops removed upstream (#186235), now lowered to `__ockl_get_local_size` library calls. - Update vectorize_gather.mlir test: vector.gather lowering now uses affine.delinearize_index instead of flat index with constant zero base (upstream #184706). --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2c8bc3a commit 1419f5b

File tree

6 files changed

+19
-17
lines changed

6 files changed

+19
-17
lines changed

compiler/plugins/target/ROCM/ROCMTarget.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,6 @@ class ROCMTargetBackend final : public TargetBackend {
716716
}
717717
llvm::TargetOptions opt;
718718
opt.AllowFPOpFusion = llvm::FPOpFusion::Fast;
719-
opt.NoNaNsFPMath = true;
720719
// Be extra cautious while this is less tested, and prevent unknown
721720
// fallbacks from global isel.
722721
//

compiler/src/iree/compiler/Codegen/LLVMGPU/test/convert_to_rocdl.mlir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ builtin.module {
3131
// CHECK-SAME: %{{[a-zA-Z0-9]*}}: !llvm.ptr {llvm.align = 16 : i32, llvm.noalias, llvm.nonnull, llvm.noundef},
3232
// CHECK-SAME: %{{[a-zA-Z0-9]*}}: !llvm.ptr {llvm.align = 16 : i32, llvm.noalias, llvm.nonnull, llvm.noundef},
3333
// CHECK-SAME: %{{[a-zA-Z0-9]*}}: !llvm.ptr {llvm.align = 16 : i32, llvm.noalias, llvm.nonnull, llvm.noundef, llvm.readnone})
34-
// CHECK: rocdl.workgroup.dim.x
34+
// CHECK: llvm.call @__ockl_get_local_size({{.*}}) : (i32) -> (i64
3535
// CHECK: llvm.getelementptr inbounds|nuw %{{.*}} : (!llvm.ptr, i64) -> !llvm.ptr, f32
3636
// INDEX32: llvm.getelementptr inbounds|nuw %{{.*}} : (!llvm.ptr, i32) -> !llvm.ptr, f32
3737
// CHECK: llvm.fadd
@@ -119,8 +119,8 @@ builtin.module attributes {} {
119119
}
120120
}
121121
// CHECK-LABEL: llvm.func @interface_wg_size
122-
// CHECK: %[[WGDIMX:.+]] = rocdl.workgroup.dim.x
123-
// CHECK: %[[WGDIMY:.+]] = rocdl.workgroup.dim.y
122+
// CHECK: llvm.call @__ockl_get_local_size({{.*}}) : (i32) -> (i64
123+
// CHECK: llvm.call @__ockl_get_local_size({{.*}}) : (i32) -> (i64
124124

125125
// -----
126126

compiler/src/iree/compiler/Codegen/SPIRV/test/vectorize_gather.mlir

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,25 @@ func.func @vector_gather(%arg0: memref<16x1082x1922xi8>, %index_vec: vector<16xi
3939
// CHECK-LABEL: func.func @vector_gather
4040
// CHECK-SAME: %[[ARG0:.+]]: memref<16x1082x1922xi8>
4141
// CHECK-SAME: %[[INDEX_VEC:.+]]: vector<16xindex>
42-
// CHECK-DAG: %[[INIT:.+]] = arith.constant dense<0> : vector<16xi8>
43-
// CHECK-DAG: %[[C0:.+]] = arith.constant 0 : index
42+
// CHECK: %[[INIT:.+]] = arith.constant dense<0> : vector<16xi8>
4443

4544
// CHECK: %[[IND0:.+]] = vector.extract %[[INDEX_VEC]][0] : index from vector<16xindex>
46-
// CHECK: %[[LOAD0:.+]] = vector.load %[[ARG0]][%[[C0]], %[[C0]], %[[IND0]]] : memref<16x1082x1922xi8>, vector<1xi8>
45+
// CHECK: %[[DL0:.+]]:3 = affine.delinearize_index %[[IND0]] into (16, 1082, 1922)
46+
// CHECK: %[[LOAD0:.+]] = vector.load %[[ARG0]][%[[DL0]]#0, %[[DL0]]#1, %[[DL0]]#2] : memref<16x1082x1922xi8>, vector<1xi8>
4747
// CHECK: %[[EXTRACT0:.+]] = vector.extract %[[LOAD0]][0] : i8 from vector<1xi8>
4848
// CHECK: %[[IND1:.+]] = vector.extract %[[INDEX_VEC]][1] : index from vector<16xindex>
49-
// CHECK: %[[LOAD1:.+]] = vector.load %[[ARG0]][%[[C0]], %[[C0]], %[[IND1]]] : memref<16x1082x1922xi8>, vector<1xi8>
49+
// CHECK: %[[DL1:.+]]:3 = affine.delinearize_index %[[IND1]] into (16, 1082, 1922)
50+
// CHECK: %[[LOAD1:.+]] = vector.load %[[ARG0]][%[[DL1]]#0, %[[DL1]]#1, %[[DL1]]#2] : memref<16x1082x1922xi8>, vector<1xi8>
5051
// CHECK: %[[EXTRACT1:.+]] = vector.extract %[[LOAD1]][0] : i8 from vector<1xi8>
5152
// CHECK: %[[IND2:.+]] = vector.extract %[[INDEX_VEC]][2] : index from vector<16xindex>
52-
// CHECK: %[[LOAD2:.+]] = vector.load %[[ARG0]][%[[C0]], %[[C0]], %[[IND2]]] : memref<16x1082x1922xi8>, vector<1xi8>
53+
// CHECK: %[[DL2:.+]]:3 = affine.delinearize_index %[[IND2]] into (16, 1082, 1922)
54+
// CHECK: %[[LOAD2:.+]] = vector.load %[[ARG0]][%[[DL2]]#0, %[[DL2]]#1, %[[DL2]]#2] : memref<16x1082x1922xi8>, vector<1xi8>
5355
// CHECK: %[[EXTRACT2:.+]] = vector.extract %[[LOAD2]][0] : i8 from vector<1xi8>
5456
// CHECK: %[[IND3:.+]] = vector.extract %[[INDEX_VEC]][3] : index from vector<16xindex>
55-
// CHECK: %[[LOAD3:.+]] = vector.load %[[ARG0]][%[[C0]], %[[C0]], %[[IND3]]] : memref<16x1082x1922xi8>, vector<1xi8>
57+
// CHECK: %[[DL3:.+]]:3 = affine.delinearize_index %[[IND3]] into (16, 1082, 1922)
58+
// CHECK: %[[LOAD3:.+]] = vector.load %[[ARG0]][%[[DL3]]#0, %[[DL3]]#1, %[[DL3]]#2] : memref<16x1082x1922xi8>, vector<1xi8>
5659
// CHECK: %[[EXTRACT3:.+]] = vector.extract %[[LOAD3]][0] : i8 from vector<1xi8>
5760
// CHECK: %[[VEC:.+]] = vector.from_elements %[[EXTRACT0]], %[[EXTRACT1]], %[[EXTRACT2]], %[[EXTRACT3]] : vector<4xi8>
5861

5962
// CHECK: vector.insert_strided_slice %[[VEC]], %[[INIT]] {offsets = [0], strides = [1]} : vector<4xi8> into vector<16xi8>
60-
// CHECK-COUNT-12: vector.load %[[ARG0]][%[[C0]], %[[C0]], %{{.*}}] : memref<16x1082x1922xi8>, vector<1xi8>
63+
// CHECK-COUNT-12: vector.load %[[ARG0]][%{{.+}}#0, %{{.+}}#1, %{{.+}}#2] : memref<16x1082x1922xi8>, vector<1xi8>

compiler/src/iree/compiler/Dialect/Util/IR/UtilAttrs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ int64_t UninitializedAttr::getStorageSize() const {
706706

707707
struct SizedStorageDenseElementsAttrModel
708708
: SizedStorageAttr::ExternalModel<SizedStorageDenseElementsAttrModel,
709-
DenseIntOrFPElementsAttr> {
709+
DenseTypedElementsAttr> {
710710
int64_t getStorageSize(Attribute baseAttr) const {
711711
auto attr = cast<ElementsAttr>(baseAttr);
712712
return IREE::Util::getRoundedPhysicalStorageSize(
@@ -743,7 +743,7 @@ struct SizedStorageStringAttrModel
743743
// byte buffers.
744744
struct SerializableDenseElementsAttrModel
745745
: SerializableAttrInterface::ExternalModel<
746-
SerializableDenseElementsAttrModel, DenseIntOrFPElementsAttr> {
746+
SerializableDenseElementsAttrModel, DenseTypedElementsAttr> {
747747
LogicalResult serializeToVector(Attribute baseAttr, Location loc,
748748
llvm::endianness endian,
749749
SmallVectorImpl<char> &buffer) const {

compiler/src/iree/compiler/Dialect/VM/IR/VMOpFolders.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static Attribute constFoldUnaryOp(Attribute rawOperand,
502502
}
503503
return DenseElementsAttr::get(operand.getType(), elementResult);
504504
} else if (auto operand = dyn_cast_if_present<ElementsAttr>(rawOperand)) {
505-
return cast<DenseIntOrFPElementsAttr>(operand).mapValues(
505+
return cast<DenseTypedElementsAttr>(operand).mapValues(
506506
cast<ShapedType>(operand.getType()).getElementType(),
507507
llvm::function_ref<ElementValueT(const ElementValueT &)>(
508508
[&](const ElementValueT &value) { return calculate(value); }));
@@ -526,7 +526,7 @@ constFoldFloatUnaryOp(Attribute rawOperand,
526526
}
527527
return DenseElementsAttr::get(operand.getType(), elementResult);
528528
} else if (auto operand = dyn_cast_if_present<ElementsAttr>(rawOperand)) {
529-
return cast<DenseIntOrFPElementsAttr>(operand).mapValues(
529+
return cast<DenseTypedElementsAttr>(operand).mapValues(
530530
cast<ShapedType>(operand.getType()).getElementType(),
531531
llvm::function_ref<APInt(const APFloat &)>([&](const APFloat &value) {
532532
return calculate(value).bitcastToAPInt();
@@ -1911,7 +1911,7 @@ static Attribute constFoldUnaryCmpOp(Attribute rawOperand,
19111911
return IntegerAttr::get(boolType, calculate(operand.getValue()));
19121912
} else if (auto operand = dyn_cast_if_present<ElementsAttr>(rawOperand)) {
19131913
auto boolType = IntegerType::get(operand.getContext(), 32);
1914-
return cast<DenseIntOrFPElementsAttr>(operand).mapValues(
1914+
return cast<DenseTypedElementsAttr>(operand).mapValues(
19151915
boolType,
19161916
llvm::function_ref<APInt(const ElementValueT &)>(
19171917
[&](const ElementValueT &value) { return calculate(value); }));

third_party/llvm-project

Submodule llvm-project updated 1877 files

0 commit comments

Comments
 (0)