Skip to content
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

Instruction sets #986

Closed
tdesveauxPKFX opened this issue Jan 5, 2018 · 6 comments
Closed

Instruction sets #986

tdesveauxPKFX opened this issue Jan 5, 2018 · 6 comments

Comments

@tdesveauxPKFX
Copy link
Contributor

Currently, vectorextensions can only hold one value at a time which make sense as avx include sse and avx2 include avx and so on.

But in gcc 5.4, if you want both avx2 and f16c you need -mavx2 and -mf16c and -mf16c does not include avx2.
Another example, -mbmi2 does not include -mbmi.

I am wondering what is the best way too add this in premake, a new api entry or setting vectorextensions kind to a list:string.

I personally am leaning toward a new api but wanted your input on this.

Note that visual studio manage this internally, f16c is used since visual 2012 so this option is for gcc and clang.

@samsinsane
Copy link
Member

Making vectorextensions a list:string would be fine, I'm not sure why a new API would be required, but if you have good enough reasons that should be fine, or if others have strong reasons for it to be that way.

As I have no knowledge on these, does it make sense to specify some of these options without the others? For example, avx2 without f16c or vice versa? If it doesn't, perhaps you could just additionally emit these compiler switches with -mavx2, et al?

@tdesveauxPKFX
Copy link
Contributor Author

My main reason toward creating a new api is that visual studio has a vector extension property (Enable Enhanced Instruction Set) that is covered by the vectorextensions api. VS take only one value for this property but gcc and clang can take multiple "-m" options. This is why I feel that we should keep vectorextensions as is.

I have two other smaller reasons for this.
Keep in mind that I do not have that much knowledge about these concepts so if someone feel the need to correct me, please do.
As I understand it, we can say that SSE, AVX and F16C are vector extension but not BMI so a new api is more about terminology and self documentation (something like instruction sets extensions, quite a mouthful). (One of my colleague is on the fence with F16C as it does use vector registers but it is misleading https://en.wikipedia.org/wiki/F16C#Technical_information).

Finally, I did not encounter this issue and it might never be one but if someone want to do something like

project "prj"
    ...
    vectorextensions "avx2"

    filter{ "files:src.cpp" }
        vectorextensions "sse"

With vector extension being a list:string, the gcc command line for src.cpp would be
gcc -mavx2 -msse ...
which is not what I would expect seeing the lua file.

About AVX2 and F16C, VS does use F16C everywhere but gcc let the user choose to use F16C alone or not so I feel we should follow gcc here.
Also, AVX and F16C have two different goals. It would make little sense to me to add F16C to AVX.

@samsinsane
Copy link
Member

I see what you're saying, I agree with you regarding the new API. isaextensions might be a good name instead of instructionsetextensions or instructionsetarchitectureextensions.

@tdesveauxPKFX
Copy link
Contributor Author

Good, something else took priority over this but I hope to do this before this week's end.

I might have other questions like this in the future, are github issues the correct way to do this or would you prefer I use the google developer group?

@starkos
Copy link
Member

starkos commented Jan 8, 2018

The developer group is generally pretty quite; GitHub issues are proving to be more useful.

@samsinsane
Copy link
Member

Closing this as the PR was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants