-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update llvm-project to 60a7d33106d3cd645d3100a8a935a1e3837f885d #2898
Update llvm-project to 60a7d33106d3cd645d3100a8a935a1e3837f885d #2898
Conversation
468c39b
to
254f424
Compare
…d and stablehlo to 92203a9612dbdd6681ccd3e65bc61586c4290df1 and make sure it builds Update MLIR references MLIR changes Signed-off-by: Ferdinand Lemaire <ferdinan@xilinx.com>
254f424
to
e1b3754
Compare
For the errors, I'm seeing a bunch of the following, I'm starting to dig the problem but if someone already know where it comes from, I'll be glad to hear it! "zlow.conv2d"(%input, %kernel, %bias, %shape, %output) {kernel_shape = [5, 5], strides = [2, 2], padding_type = "SAME_PADDING", act_func = "ACT_RELU" } : (memref<2048xf16>, memref<2048xf16>, memref<2048xf16>, memref<7xi64>, memref<2048xf16>)-> () within split at /workdir/onnx-mlir/test/mlir/accelerators/nnpa/conversion/lower-all-to-llvm.mlir:407 offset :10:3: note: see current operation: "llvm.call"(%123, %124, %125, %103, %107, %109, %105) <{CConv = #llvm.cconv, TailCallKind = #llvm.tailcallkind, callee = @zdnn_init_pre_transformed_desc, fastmathFlags = #llvm.fastmath}> : (i64, i64, !llvm.ptr, i64, i64, i64, i64) -> ()`` |
So I identified the problematic change to be https://github.com/llvm/llvm-project/pull/99293/files however I have a hard time finding where it triggers in I tried looking in |
@flemairen6 I will give it a try tomorrow to ferret out the needed changes. |
@AlexandreEichenberger Have you had time to take a look at it already? |
on it now. |
Tried the simplest of the lit tests that fails module {
func.func @main_graph(%arg0: memref<3x4x5xf32>, %arg1: memref<?x4x5xf32>) -> memref<3x4x5xf32> {
return %arg0 : memref<3x4x5xf32>
}
"krnl.entry_point"() {func = @main_graph, numInputs = 2 : i32, numOutputs = 1 : i32, signature = "[ { \22type\22 : \22f32\22 , \22dims\22 : [3 , 4 , 5] , \22name\22 : \22input0\22 }\0A , { \22type\22 : \22f32\22 , \22dims\22 : [-1 , 4 , 5] , \22name\22 : \22input1\22 }\0A\0A]\00@[ { \22type\22 : \22f32\22 , \22dims\22 : [3 , 4 , 5], \22name\22 : \22output0\22 }\0A\0A]\00"} : () -> ()
} from The code has essentially nothing. LLVM adds a bunch of external calls, and that is what it is choking on
and the error printout lists the "llvm.func"() <{CConv = #llvm.cconv<ccc>, function_type = !llvm.func<void (ptr, ...)>, linkage = #llvm.linkage<external>, sym_name = "printf", visibility_ = 0 : i64}> ({
}) : () -> () which is the very first function that is listed (and thus presumably added by our pass). |
Ok, I got it narrowed down a bit more. In onnnx-mlir, we can generate static StringRef getFormat(const Type &inputType) {
StringRef format;
TypeSwitch<Type>(inputType)
.Case<Float16Type>([&](Float16Type) { format = "%g"; })
.Case<Float32Type>([&](Float32Type) { format = "%f"; })
.Case<Float64Type>([&](Float64Type) { format = "%f"; })
.Case<IntegerType>([&](IntegerType type) {
switch (type.getWidth()) {
case 1:
case 8:
case 16:
case 32:
format = type.isUnsigned() ? "%u" : "%d";
break;
case 64:
format = type.isUnsigned() ? "%llu" : "%lld";
break;
}
})
.Case<IndexType>([&](IndexType) { format = "%lld"; })
.Case<onnx_mlir::krnl::StringType>(
[&](onnx_mlir::krnl::StringType) { format = "%s"; })
.Case<LLVM::LLVMPointerType>(
[&](LLVM::LLVMPointerType) { format = "%s"; })
.Default([&](Type type) {
llvm::errs() << "type: " << type << "\n";
llvm_unreachable("Unhandled type");
});
return format;
} Now we need to provide the function type to LLVM in a |
Doing some searching in the code base, I found a way. Can you try this patch @flemairen6 ?
|
Signed-off-by: Ferdinand Lemaire <ferdinan@xilinx.com>
4784773
to
2fe7e93
Compare
Thanks a lot Alexandre, it seems to be working for the simple test. I'll apply the same kind of changes for the NNPA tests failing and it should be enough to have this PR green |
d5d5356
to
7aaf2be
Compare
Signed-off-by: Ferdinand Lemaire <ferdinan@xilinx.com>
7aaf2be
to
55bed9a
Compare
Signed-off-by: Ferdinand Lemaire <ferdinan@xilinx.com>
4388254
to
9ccad62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for catching the extra cases and fixing the lit tests. Much much appreciated. I also learned more about LLVM lowering, always good to learn a bit more.
Jenkins Linux s390x Build #15321 [push] Update llvm-project to 6... started at 09:56 |
Jenkins Linux amd64 Build #15316 [push] Update llvm-project to 6... started at 08:56 |
Jenkins Linux ppc64le Build #14346 [push] Update llvm-project to 6... started at 09:56 |
Jenkins Linux amd64 Build #15316 [push] Update llvm-project to 6... passed after 2 hr 21 min |
Jenkins Linux s390x Build #15321 [push] Update llvm-project to 6... passed after 2 hr 59 min |
Jenkins Linux ppc64le Build #14346 [push] Update llvm-project to 6... passed after 3 hr 31 min |
llvm-project : 60a7d33106d3cd645d3100a8a935a1e3837f885d
stablehlo: 92203a9612dbdd6681ccd3e65bc61586c4290df1