Skip to content

Commit

Permalink
Update LLVM to 19 (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe committed Sep 24, 2024
1 parent a681a8c commit 9571a05
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 28 deletions.
32 changes: 26 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions .cspell.json → cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@
"dashmap",
"dealloc",
"detensorize",
"dlti",
"elementwise",
"femtomc",
"funcs",
"hasher",
"indoc",
"insta",
"interp",
"irdl",
"irdl",
"jit",
"libm",
"linalg",
"matmul",
"melior",
"memref",
"mlir",
Expand All @@ -48,9 +52,6 @@
"tblgen",
"tosa",
"unranked",
"irdl",
"IRDL",
"DLTI",
"vulkan"
]
}
6 changes: 4 additions & 2 deletions macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion macro/build.rs
Original file line number Diff line number Diff line change
@@ -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<dyn Error>> {
let version_variable = format!("MLIR_SYS_{}0_PREFIX", LLVM_MAJOR_VERSION);
Expand Down
2 changes: 1 addition & 1 deletion melior/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion melior/src/dialect/llvm/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion melior/src/dialect/memref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
15 changes: 15 additions & 0 deletions melior/src/ir/type/type_like.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,30 @@ pub trait TypeLike<'c> {
}

melior_macro::type_check_functions!(
// spell-checker: disable
mlirTypeIsAAnyQuantizedType,
mlirTypeIsABF16,
mlirTypeIsACalibratedQuantizedType,
mlirTypeIsAComplex,
mlirTypeIsAF16,
mlirTypeIsAF32,
mlirTypeIsAF64,
mlirTypeIsAFloat,
mlirTypeIsAFloat8E4M3,
mlirTypeIsAFloat8E4M3B11FNUZ,
mlirTypeIsAFloat8E4M3FN,
mlirTypeIsAFloat8E4M3FNUZ,
mlirTypeIsAFloat8E5M2,
mlirTypeIsAFloat8E5M2FNUZ,
mlirTypeIsAFunction,
mlirTypeIsAGPUAsyncTokenType,
mlirTypeIsAIndex,
mlirTypeIsAInteger,
mlirTypeIsALLVMPointerType,
mlirTypeIsALLVMStructType,
mlirTypeIsAMemRef,
mlirTypeIsANone,
mlirTypeIsANVGPUTensorMapDescriptorType,
mlirTypeIsAOpaque,
mlirTypeIsAPDLAttributeType,
mlirTypeIsAPDLOperationType,
Expand All @@ -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
);
}

Expand Down
23 changes: 12 additions & 11 deletions melior/src/pass/linalg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]
);
2 changes: 1 addition & 1 deletion tools/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

llvm_version=18
llvm_version=19

brew install llvm@$llvm_version

Expand Down

0 comments on commit 9571a05

Please sign in to comment.