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

Polyfill support #425

Open
kevmo314 opened this issue Feb 8, 2024 · 0 comments
Open

Polyfill support #425

kevmo314 opened this issue Feb 8, 2024 · 0 comments

Comments

@kevmo314
Copy link

kevmo314 commented Feb 8, 2024

I'm not sure if this is within scope of avo, but does there exist any polyfill-like support for converting, eg AVX512 instructions to AVX2?

For example, I am (actually) a new asm developer and I recently spent an hour trying to figure out why VMULPS.BCST(Imm(...), x y) resulted in a SIGILL before I realized that the m32bcst version is only available on AVX512F/AVX512VL.

I then thought about the compilation target and while my CPU doesn't support AVX512F, I'd like to be able to generate an AVX512F version of code that would conditionally execute for processors that do support it and fall back to the AVX2 version (VBROADCASTSS first and then VMULPS) for those that don't.

I can do this manually by conditionally generating the instructions but was wondering if there's a more pragmatic solution, similar to polyfilling, or maybe a high level directive similar to @supports? Maybe the API I'm envisioning is something like:

ctx := NewContext()
ctx.VMULPS_BCST(...)
if ctx.IsSupported(<some user-provided capabilities set>) {
  globalCtx.Add(ctx)
} else {
  // fallback implementation
}
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

1 participant