From 9571a050d43f7da3b0170b115f0d6e9afa197d6f Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Tue, 24 Sep 2024 22:23:29 +0900 Subject: [PATCH] Update LLVM to 19 (#590) --- Cargo.lock | 32 +++++++++++++++---- .cspell.json => cspell.json | 7 ++-- macro/Cargo.toml | 6 ++-- macro/build.rs | 2 +- melior/Cargo.toml | 2 +- melior/src/dialect/llvm/type.rs | 2 +- melior/src/dialect/memref.rs | 8 ++++- ...lior__dialect__memref__tests__subview.snap | 2 +- melior/src/ir/type/type_like.rs | 15 +++++++++ melior/src/pass/linalg.rs | 23 ++++++------- tools/setup.sh | 2 +- 11 files changed, 73 insertions(+), 28 deletions(-) rename .cspell.json => cspell.json (95%) diff --git a/Cargo.lock b/Cargo.lock index 13ff46675e..16d8b2e7dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,6 +40,26 @@ dependencies = [ "which", ] +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", +] + [[package]] name = "bitflags" version = "2.5.0" @@ -419,11 +439,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mlir-sys" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1b5806a63bc959cd5c4e5db8cadd20e40045d41969d325132748db8af11b7f" +checksum = "fae0a14b0940736a243fef4a4d96d8cdf8a253272031b63c5e4b1bea207c82b0" dependencies = [ - "bindgen", + "bindgen 0.70.1", ] [[package]] @@ -609,11 +629,11 @@ dependencies = [ [[package]] name = "tblgen-alt" -version = "0.3.6" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae726d43658a13a9cd479de814be1311fea69236cd821e931a4fb9ca4d70e50" +checksum = "0ecbc9175dd38627cd01d546e7b41c9a115e5773f4c98f64e2185c81ec5f45ab" dependencies = [ - "bindgen", + "bindgen 0.69.4", "cc", "paste", "thiserror", diff --git a/.cspell.json b/cspell.json similarity index 95% rename from .cspell.json rename to cspell.json index 4537d62659..c7b365a1d2 100644 --- a/.cspell.json +++ b/cspell.json @@ -17,6 +17,7 @@ "dashmap", "dealloc", "detensorize", + "dlti", "elementwise", "femtomc", "funcs", @@ -24,9 +25,12 @@ "indoc", "insta", "interp", + "irdl", + "irdl", "jit", "libm", "linalg", + "matmul", "melior", "memref", "mlir", @@ -48,9 +52,6 @@ "tblgen", "tosa", "unranked", - "irdl", - "IRDL", - "DLTI", "vulkan" ] } diff --git a/macro/Cargo.toml b/macro/Cargo.toml index 107f45b80a..7e8650c498 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -20,10 +20,12 @@ proc-macro2 = "1" quote = "1" regex = "1.10.6" syn = { version = "2", features = ["full"] } -tblgen = { version = "0.3.6", features = ["llvm18-0"], default-features = false, package = "tblgen-alt" } +tblgen = { version = "0.4.0", features = [ + "llvm19-0", +], default-features = false, package = "tblgen-alt" } unindent = "0.2.3" [dev-dependencies] melior = { path = "../melior", features = ["ods-dialects"] } -mlir-sys = "0.2.2" +mlir-sys = "0.3.0" pretty_assertions = "1.4.1" diff --git a/macro/build.rs b/macro/build.rs index b7f8e82fb1..96d4d46e7e 100644 --- a/macro/build.rs +++ b/macro/build.rs @@ -1,6 +1,6 @@ use std::{env, error::Error, path::Path, process::Command, str}; -const LLVM_MAJOR_VERSION: usize = 18; +const LLVM_MAJOR_VERSION: usize = 19; fn main() -> Result<(), Box> { let version_variable = format!("MLIR_SYS_{}0_PREFIX", LLVM_MAJOR_VERSION); diff --git a/melior/Cargo.toml b/melior/Cargo.toml index 144f9903c8..4b2851b0b0 100644 --- a/melior/Cargo.toml +++ b/melior/Cargo.toml @@ -14,7 +14,7 @@ ods-dialects = [] [dependencies] dashmap = "6.1.0" melior-macro = { version = "0.11.6", path = "../macro" } -mlir-sys = "0.2.2" +mlir-sys = "0.3.0" once_cell = "1" [dev-dependencies] diff --git a/melior/src/dialect/llvm/type.rs b/melior/src/dialect/llvm/type.rs index 12ff1e82c1..f227a08b41 100644 --- a/melior/src/dialect/llvm/type.rs +++ b/melior/src/dialect/llvm/type.rs @@ -35,7 +35,7 @@ pub fn function<'c>( /// Creates an LLVM opaque pointer type at address space 0. #[deprecated( since = "0.11.0", - note = "please use the pointer method, all pointers are opaque in LLVM 18" + note = "please use the pointer method, all pointers are opaque in LLVM 19" )] pub fn opaque_pointer(context: &Context) -> Type { pointer(context, 0) diff --git a/melior/src/dialect/memref.rs b/melior/src/dialect/memref.rs index 70c37b3679..dac24c6510 100644 --- a/melior/src/dialect/memref.rs +++ b/melior/src/dialect/memref.rs @@ -755,7 +755,13 @@ mod tests { &[0, 0], &[4, 4], &[1, 1], - MemRefType::new(Type::index(&context), &[4, 4], None, None), + MemRefType::new( + Type::index(&context), + &[4, 4], + // TODO Construct a strided attribute using the C API without parsing. + Some(Attribute::parse(&context, "strided<[8, 1]>").unwrap()), + None, + ), location, )); }); diff --git a/melior/src/dialect/snapshots/melior__dialect__memref__tests__subview.snap b/melior/src/dialect/snapshots/melior__dialect__memref__tests__subview.snap index d06972956d..8b4a628454 100644 --- a/melior/src/dialect/snapshots/melior__dialect__memref__tests__subview.snap +++ b/melior/src/dialect/snapshots/melior__dialect__memref__tests__subview.snap @@ -5,7 +5,7 @@ expression: module.as_operation() module { func.func @foo() { %alloc = memref.alloc() : memref<8x8xindex> - %subview = memref.subview %alloc[0, 0] [4, 4] [1, 1] : memref<8x8xindex> to memref<4x4xindex> + %subview = memref.subview %alloc[0, 0] [4, 4] [1, 1] : memref<8x8xindex> to memref<4x4xindex, strided<[8, 1]>> return } } diff --git a/melior/src/ir/type/type_like.rs b/melior/src/ir/type/type_like.rs index f4e5228216..49d3c09b7f 100644 --- a/melior/src/ir/type/type_like.rs +++ b/melior/src/ir/type/type_like.rs @@ -28,6 +28,7 @@ pub trait TypeLike<'c> { } melior_macro::type_check_functions!( + // spell-checker: disable mlirTypeIsAAnyQuantizedType, mlirTypeIsABF16, mlirTypeIsACalibratedQuantizedType, @@ -35,13 +36,22 @@ pub trait TypeLike<'c> { mlirTypeIsAF16, mlirTypeIsAF32, mlirTypeIsAF64, + mlirTypeIsAFloat, + mlirTypeIsAFloat8E4M3, + mlirTypeIsAFloat8E4M3B11FNUZ, mlirTypeIsAFloat8E4M3FN, + mlirTypeIsAFloat8E4M3FNUZ, mlirTypeIsAFloat8E5M2, + mlirTypeIsAFloat8E5M2FNUZ, mlirTypeIsAFunction, + mlirTypeIsAGPUAsyncTokenType, mlirTypeIsAIndex, mlirTypeIsAInteger, + mlirTypeIsALLVMPointerType, + mlirTypeIsALLVMStructType, mlirTypeIsAMemRef, mlirTypeIsANone, + mlirTypeIsANVGPUTensorMapDescriptorType, mlirTypeIsAOpaque, mlirTypeIsAPDLAttributeType, mlirTypeIsAPDLOperationType, @@ -53,14 +63,19 @@ pub trait TypeLike<'c> { mlirTypeIsARankedTensor, mlirTypeIsAShaped, mlirTypeIsATensor, + mlirTypeIsATF32, mlirTypeIsATransformAnyOpType, + mlirTypeIsATransformAnyParamType, + mlirTypeIsATransformAnyValueType, mlirTypeIsATransformOperationType, + mlirTypeIsATransformParamType, mlirTypeIsATuple, mlirTypeIsAUniformQuantizedPerAxisType, mlirTypeIsAUniformQuantizedType, mlirTypeIsAUnrankedMemRef, mlirTypeIsAUnrankedTensor, mlirTypeIsAVector, + // spell-checker: enable ); } diff --git a/melior/src/pass/linalg.rs b/melior/src/pass/linalg.rs index 00b091d6d1..ea4273ec0b 100644 --- a/melior/src/pass/linalg.rs +++ b/melior/src/pass/linalg.rs @@ -3,16 +3,17 @@ melior_macro::passes!( "Linalg", [ - mlirCreateLinalgConvertElementwiseToLinalg, - mlirCreateLinalgLinalgBufferize, - mlirCreateLinalgLinalgDetensorize, - mlirCreateLinalgLinalgElementwiseOpFusion, - mlirCreateLinalgLinalgFoldUnitExtentDims, - mlirCreateLinalgLinalgGeneralization, - mlirCreateLinalgLinalgInlineScalarOperands, - mlirCreateLinalgLinalgLowerToAffineLoops, - mlirCreateLinalgLinalgLowerToLoops, - mlirCreateLinalgLinalgLowerToParallelLoops, - mlirCreateLinalgLinalgNamedOpConversion, + mlirCreateLinalgConvertElementwiseToLinalgPass, + mlirCreateLinalgConvertLinalgToAffineLoopsPass, + mlirCreateLinalgConvertLinalgToLoopsPass, + mlirCreateLinalgConvertLinalgToParallelLoopsPass, + mlirCreateLinalgLinalgBlockPackMatmul, + mlirCreateLinalgLinalgDetensorizePass, + mlirCreateLinalgLinalgElementwiseOpFusionPass, + mlirCreateLinalgLinalgFoldUnitExtentDimsPass, + mlirCreateLinalgLinalgGeneralizeNamedOpsPass, + mlirCreateLinalgLinalgInlineScalarOperandsPass, + mlirCreateLinalgLinalgNamedOpConversionPass, + mlirCreateLinalgLinalgSpecializeGenericOpsPass, ] ); diff --git a/tools/setup.sh b/tools/setup.sh index 14a7bf7671..cde5300182 100755 --- a/tools/setup.sh +++ b/tools/setup.sh @@ -2,7 +2,7 @@ set -e -llvm_version=18 +llvm_version=19 brew install llvm@$llvm_version