1

I am wondering whether is possible to simulate SIMD instruction set for specific unit test in dotnet core C# test project (MSTest).

Is it possible to somehow use Intel Intrinsics Emulator as suggested here?

Example: Run test once with Avx2.IsSupported = true, once with Avx2... = false, Ssse3... = true and once with both set to false.


[TestMethod]
public void Test_Reverse()
{
  var buffer = ...;
  var bufferCopy = ...;

  SIMDHelper.Reverse(buffer);

  AssertReversed...
}

ptp
  • 511
  • 5
  • 13
  • 1
    I'd assume you can run .NET programs under Intel's SDE; have you tried that or googled? That's exactly the sort of thing you can do with SDE for a "normal" executable. – Peter Cordes Jan 03 '20 at 20:33
  • I just found out about Intel's SDE existence. Will check it out but it's seems overcomplicated for just setting a runtime flag to false (i could run the tests on machine that supports all intrinsics presumably). – ptp Jan 03 '20 at 20:44
  • I thought that's specifically what you were asking about, since one of the answers on your linked questions gives that as the answer. You don't emulate intrinsics (at compile time), you emulate a CPU that supports more or less than what the native CPU supports. That's not even "just" hooking CPUID to report different extensions supported, it actually makes sure AVX instructions will fault, for example. So yes that needs all the complexity of dynamic recompilation to do that efficiently, and running code that is supported by the host CPU at near-native speed. – Peter Cordes Jan 03 '20 at 20:57

0 Answers0