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

8-wide target for Skylake #1308

Closed
johguenther opened this issue Jan 17, 2018 · 7 comments · Fixed by #2273
Closed

8-wide target for Skylake #1308

johguenther opened this issue Jan 17, 2018 · 7 comments · Fixed by #2273
Assignees
Labels

Comments

@johguenther
Copy link
Contributor

For some workloads it is faster to use 8-wide SIMD on Skylake (due to the lower frequency when using 16-wide SIMD). Thus, are there plans to add e.g. a avx512skx-i32x8 target (which makes use of the AVX-512 VL instructions)?

@dbabokin
Copy link
Collaborator

Last time I check LLVM status, they were not ready to produce 256bit AVX512 code. It was about half a year ago. I need to check current status.

@johguenther
Copy link
Contributor Author

ISPC v1.11 introduced the avx512skx-i32x8 target, nice! Alas, we run into several issues when trying to use it for OSPRay with v1.12 and multiple targets:

  • avx512skx-i32x8,sse4 works

  • avx512skx-i32x8,avx2 results in

    llvm/llvm-8.0/llvm/lib/IR/Instructions.cpp:1210: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.

    or

    llvm/llvm-8.0/llvm/lib/IR/Instructions.cpp:379: void llvm::CallInst::init(llvm::FunctionType *, llvm::Value *, ArrayRef<llvm::Value *>, ArrayRefllvm::OperandBundleDef, const llvm::Twine &): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.

  • strangely, avx512skx-i32x16,avx2 sometimes bails out with

    ispc/src/ispc.cpp(1440): FATAL ERROR: Unhandled target in ISAToTargetString()

@dbabokin
Copy link
Collaborator

Do you have steps to reproduce these fails?

strangely, avx512skx-i32x16,avx2 sometimes bails out with

Is it failing sometimes, not always?

What you tried trunk version? It's available to download, links are on the bottom of README of ISPC repo (Windows may not work temporarily, but Linux should work).

@dbabokin
Copy link
Collaborator

@johguenther Do you observe this problem with current ispc version (v1.17.0)? Should we close this issue?

@gregjohnson
Copy link

I've also experienced a similar issue when trying to use the avx512skx-i32x8 target alongside other targets in Open VKL. In building up a minimal reproducer, it seems the problem occurs when attempting to assign function pointers. Here's a small reproducer:

test.ispc:

struct Sampler {
  varying float (*uniform computeSample_varying)(const Sampler *uniform _self);
};

varying float computeSample(const Sampler *uniform self)
{
  return 1.f;
}

export void func_call_with_ptr(void *uniform _sampler)
{
  Sampler *uniform sampler = (Sampler *uniform) _sampler;
  sampler->computeSample_varying = computeSample;
}

Failure case with multiple targets:

$ ./ispc-v1.17.0-linux/bin/ispc -o test.o --arch=x86-64 --target=sse4,avx,avx2,avx512skx-i32x8 test.ispc
Stored value type does not match pointer operand type!
  store <8 x float> (%v8_uniform_Sampler*, <8 x i1>)* @computeSample___un_3C_s_5B__c_unSampler_5D__3E_avx512skx, <8 x float> (%v8_uniform_Sampler*, <8 x i32>)** %sampler_load2, align 8
 <8 x float> (%v8_uniform_Sampler*, <8 x i32>)*in function func_call_with_ptr___un_3C_unv_3E_avx512skx
LLVM ERROR: Broken function found, compilation aborted!
/usr/local/src/ispc/src/main.cpp(396): FATAL ERROR: Unhandled signal sent to process; terminating.
***
*** Please file a bug report at https://github.com/ispc/ispc/issues
*** (Including as much information as you can about how to reproduce this error).
*** You have apparently encountered a bug in the compiler that we'd like to fix!
***
Aborted (core dumped)

These cases succeed:

  • ./ispc-v1.17.0-linux/bin/ispc -o test.o --arch=x86-64 --target=avx,avx2 test.ispc
  • ./ispc-v1.17.0-linux/bin/ispc -o test.o --arch=x86-64 --target=avx512skx-i32x8 test.ispc
  • ./ispc-v1.17.0-linux/bin/ispc -o test.o --arch=x86-64 --target=sse4,avx512skx-i32x8 test.ispc

So the issue seems to only occur when combining the avx512skx-i32x8 target with other 8-wide targets.

It would be useful if this could be fixed, as we want to be able to compile a single 8-wide ISPC library with avx, avx2, avx512skx-i32x8, and have the highest ISA be auto-selected at runtime.

@dbabokin
Copy link
Collaborator

dbabokin commented Mar 2, 2022

I can reproduce it. @gregjohnson thanks a lot for the reproducer.

@gregjohnson
Copy link

Thanks!

@dbabokin dbabokin self-assigned this Mar 4, 2022
@dbabokin dbabokin added the Bugs label Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants