This is an archive of the discontinued LLVM Phabricator instance.

[BPF][Test] Disable codegen test on AIX
ClosedPublic

Authored by jsji on May 4 2021, 3:19 PM.

Details

Summary

https://reviews.llvm.org/D101194 changed the default getMultiarchTriple in toolchain.
So -march=bpf on AIX will get triple of bpf-ibm-aix now,
this is unexpected and causing test failures.

BPF on AIX is not supported (yet), disable the codegen test on AIX in lit cfg.

Diff Detail

Event Timeline

jsji requested review of this revision.May 4 2021, 3:19 PM
jsji created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2021, 3:19 PM
jsji added a reviewer: phosek.

We have a lot of tests using -march=bpf[eleb], why only these two tests? Is this due to the fact llvm-objdump won't work any more? Also, we have quite some objdump-* tests,

$ ls objdump*.ll
objdump_atomics.ll    objdump_cond_op.ll  objdump_imm_hex.ll     objdump_nop.ll         objdump_trivial.ll
objdump_cond_op_2.ll  objdump_dis_all.ll  objdump_intrinsics.ll  objdump_static_var.ll  objdump_two_funcs.ll

They all have similar llc | llvm-objdump | FileCheck test commands? Do other objdump_* tests also need to change to triple?

jsji added a comment.May 5 2021, 6:47 AM

We have a lot of tests using -march=bpf[eleb], why only these two tests? Is this due to the fact llvm-objdump won't work any more? Also, we have quite some objdump-* tests,

Good question. Not due to llvm-objdump, it is due to the fact AIX does not support bpf (yet).
You should be able to see what is wrong on Linux with following triple as well.

$ llc -mtriple=bpfel-ibm-aix -filetype=obj -o - llvm-project/llvm/test/CodeGen/BPF/BTF/binary-format.ll
<unknown>:0: error: Undefined temporary symbol 

The failure are:

<unknown>:0: error: Undefined temporary symbol 
..bin/llvm-readelf: error: '<stdin>': The file was not recognized as a valid object file
FileCheck error: '<stdin>' is empty.
FileCheck command line:  .../bin/FileCheck -check-prefixes=CHECK,CHECK-EL .../lvm/test/CodeGen/BPF/BTF/binary-format.ll
jsji added a comment.EditedMay 5 2021, 6:48 AM

But yes, I believe it is better to update all testcases to use -mtriple instead of -march, to avoid trying to test unsupported triple combination. Let me know if you want to to update the patch to include all of them.

If I understand correctly, on AIX system, BPF is not supported, so if -march=bpf is specified, it will internally expand to -mtriple=bpfel-ibm-aix and the test will fail since it is not supported, if llc uses -mtriple=bpfel and then llvm understands it is not really related to AIX and it is fine, is that right?

I don't like to change all tests (-march ==> -mtriple) for unsupported platform. Other platforms e.g., macos/windows seems working fine, could you check how they did?
In the worst case, if what windows/macos did won't work for you, you could change BPF test directory lit.local.cfg file to mark config.unsupported = True in your platform, but not individual tests.

jsji added a comment.May 5 2021, 5:07 PM

If I understand correctly, on AIX system, BPF is not supported, so if -march=bpf is specified, it will internally expand to -mtriple=bpfel-ibm-aix and the test will fail since it is not supported, if llc uses -mtriple=bpfel and then llvm understands it is not really related to AIX and it is fine, is that right?

Yes, it is correct.

I don't like to change all tests (-march ==> -mtriple) for unsupported platform. Other platforms e.g., macos/windows seems working fine, could you check how they did?

Toolchain can choose whether they want to override the default handling of triple. AIX toolchain choose not to override and use the default one.

In the worst case, if what windows/macos did won't work for you, you could change BPF test directory lit.local.cfg file to mark config.unsupported = True in your platform, but not individual tests.

That is fine for us if you prefer.

Toolchain can choose whether they want to override the default handling of triple. AIX toolchain choose not to override and use the default one.

Maybe it is better to do what other platform is doing? What is the advantage of not overriding the default triple for not supported platform?

jsji added a comment.EditedMay 5 2021, 5:49 PM

Toolchain can choose whether they want to override the default handling of triple. AIX toolchain choose not to override and use the default one.

Maybe it is better to do what other platform is doing? What is the advantage of not overriding the default triple for not supported platform?

Yes, we will evaluate and consider overriding.
But the new change is breaking our internal buildbot, we would like to fix the failures first to unblock build.

jsji updated this revision to Diff 343270.May 5 2021, 7:14 PM

Disable test on AIX.

jsji retitled this revision from [BPF][Test] Use mtriple instead of march to [BPF][Test] Disable codegen test on AIX.May 5 2021, 7:19 PM
jsji edited the summary of this revision. (Show Details)

This looks better. Do you have a plan to eventually remove this fix as it really looks incompatible with other platforms?

jsji added a comment.May 5 2021, 7:34 PM

This looks better. Do you have a plan to eventually remove this fix as it really looks incompatible with other platforms?

Yes, we will.

yonghong-song accepted this revision.May 5 2021, 7:36 PM

Ok, sounds good then.

This revision is now accepted and ready to land.May 5 2021, 7:36 PM
This revision was landed with ongoing or failed builds.May 5 2021, 7:38 PM
This revision was automatically updated to reflect the committed changes.
qiucf added a subscriber: qiucf.Oct 19 2023, 12:16 AM

I believe targets don't redirect OS in triple. Because most of the CodeGen check is asm check, they just 'happen to be right'. For example, on aarch64-darwin, llc -march=aarch64 -filetype=obj BPF/BTF/binary-format.ll is ok, llc -mtriple=riscv64-unknown-linux-gnu -filetype=obj BPF/BTF/binary-format.ll is also ok. However llc -march=riscv64 -filetype=obj BPF/BTF/binary-format.ll fails, and OS is inferred as 'darwin'.

Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2023, 12:16 AM