-
Notifications
You must be signed in to change notification settings - Fork 59
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
[BUG] Incorrect Results Using __mmask16 Mask in if_else Function with AVX-512 #2026
Comments
The output should not be: |
Two things happens :
If your mask is always half true/half false, you can use the relative conditional mask liek keep_last : |
Do you think you want to implicitly cast __mask16 to logical? I think that'd make sense but I also know that it doesn't work. What are you thinking, @jfalcou ? |
Maybe we need to make the wrapper type over the mmask type public |
I think we'd need to put up a pr and then see what can we do. I don't think I understand your comment like this. @Panhaolin2001 - you probably know this, but here is how to write what you meant today: https://godbolt.org/z/off5xv6nG UPD: I would also recommend looking into our formula generation constructor, since this seems like what you want (from your example): https://godbolt.org/z/PhjhPxohP |
I'm sorry I may not have expressed myself too well. I currently made a type |
We already have such a type. We may just need to make it public api and amend logical functions to handle it. As for why __mask dont work, it is because they are just plain intégral so the constructor used to convert them to logical think you are doing logical(some.number) which is eqv to using logical(true). |
Thank you for your response! Looking forward to you exposing it as a public API and improving the handling of logic functions. |
@DenisYaroshevskiy In fact, maybe we can just have an API that let us build logical from a bit set, using maybe a tagged constructor, and optimize it on AVX512 to not do anything and, for the other arch, to do the bit to mask conversion ? logical<wide<float>> l( as_mask{0b01101101} ); ? |
I don't like this bits constructor. I think the formula/initializer list constructor do this already. This is very length specific |
I don't know how much I understood. If you want to write a convrersion from your type to logical, provide a conversion operator
|
It has to be something like struct my {
__mmask16 m;
using eve_logical_t = eve::logical<eve::wide<float, eve::fixed<16>>>;
operator eve_logical_t () {
eve_logical_t that;
that.storage().value = m;
return that;
}
}; or else the mask is seen as an integer then turned to true/false. |
You are right, I thought what I wrote works. This is horrible. It works on any other platform. We need to at least stop it from compiling |
It is complicated cause for most compiler the __mask* stuff are typedefs to integral :/ |
we should only convert from bool and not from integrals |
Ok thus eve/include/eve/arch/cpu/logical_wide.hpp Line 126 in c29cd38
Should go and the bool one after it should.use |
Is there any plan to convert from clang builtin vector extension to
|
No plans. I looked into it. Here is how I'd do it:
|
Excuse me, I have an off-topic question. May I ask, on avx512 platform wide<float, fixed<128>> represents a vector type with 128 elements, but avx512 can only support 16 elements of float type, how does wide<float, fixed<128>> utilize avx512 registers? Splicing? |
I'm not 100% what you mean by splicing but they are represented as an array of registers. So 128 / 16 = 8 registers. We call this "aggregation". We usually don't test that many registers at once, it should work but do test your code just in case. If you can tell me more about the problem you are trying to solve, maybe I can give you a better answer. |
Here is a example: https://godbolt.org/z/nd9Kc3cqq
The text was updated successfully, but these errors were encountered: