[LLVMCPU] Append user-specific cpu-features after the supported features from a cpu name.#24473
Conversation
5ecbe99 to
dd979bf
Compare
bjacob
left a comment
There was a problem hiding this comment.
Bonus points if you can find a way to test this with target attributes in a MLIR test under compiler/plugins/target/LLVMCPU/test. Probably a problem that a good AI could solve.
dd979bf to
2ba12fa
Compare
here is the test: |
|
How could I trigger the ci test? |
| // | ||
| // RUN: iree-compile --compile-to=preprocessing --iree-hal-target-device=local --iree-hal-local-target-device-backends=llvm-cpu --iree-llvmcpu-target-triple=x86_64-linux-gnu %s \ | ||
| // RUN: --iree-llvmcpu-target-cpu=x86-64-v4 \ | ||
| // RUN: --iree-llvmcpu-target-cpu-features="-avx2,+amx-int8,+amx-bf16" \ |
There was a problem hiding this comment.
Why the -avx2 here? I would love it if negative feature flags worked, however:
- The CHECKs below show that they don't in this instance, right?
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +avx2. - This particular choice of features is rather unnatural: avx512 and AMX but no avx2. If we wanted to test a negative feature flag, I would rather start from the x86-64-v4 set and remote one of the avx512 features that is not implied by others (e.g. avx512vl, but not avx512f).
There was a problem hiding this comment.
The SubtargetFeatures.AddFeature() just append the new feature without check the duplication.
So, all user specific feature will just append after the queried features.
I just try to show that we could disable the queried features with -XXX at the end.
Is it more clear to do the deduplication(remove the match feature with "-"XXX feature str)?
For llvm, it will use the latest feature setting.
E.g. +avx2,......,-avx2 => no avx2
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +avx2, <====
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +avx512bw,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +avx512cd,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +avx512dq,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +avx512f,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +avx512vl,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +fma,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +sse,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +sse2,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +sse3,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +sse4.1,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: +sse4.2,
// CHECK-X86-64-V4-WITH-USER-FEATURES-SAME: -avx2, <===
2. This particular choice of features is rather unnatural: avx512 and AMX but no avx2. If we wanted to test a negative feature flag, I would rather start from the x86-64-v4 set and remote one of the avx512 features that is not implied by others (e.g. avx512vl, but not avx512f).
i will update the case with --iree-llvmcpu-target-cpu-features="-avx512f"
There was a problem hiding this comment.
Sorry, I had completely missed that (I didn't realize about the duplicate entries). Ignore me!
I did it for you. To do it yourself you need write permissions on the repository. https://iree.dev/developers/general/contributing/#obtaining-commit-access |
|
The failed case: futex_test |
2ba12fa to
068e445
Compare
|
Yes, the futex test failure looks unrelated. You can ignore it. |
…res from a cpu name. Before this, IREE will only use user-specific features and drop others. Signed-off-by: Jerry Shih <jerry.shih@sifive.com>
068e445 to
66db3f4
Compare
Before this, IREE will only use user-specific features and drop others.