SWDEV-232428 - Fix HIP printf tests on Windows

On Windows there's something fundamentally broken about redirecting IO
into a file and then restoring that said IO to it's original state. Even
though no syscalls would fail, the output would sometimes either go into
CLI or straight up nowhere.

Simply using pipes instead of a temporary file magically resolves the
above issue ¯\_(ツ)_/¯

Unfortunately the max pipe size on Linux is 1Mb, which is not enough to
store all the data printed by the kernel. This leads to a softhang in
vprintf().

Stick to using a temporary file on Linux, but switch to pipes on
Windows. Slightly refactor the CaptureStream struct to accomadate this
difference.

Change-Id: Id8e68f150df47815a4f652ee2bcd6cfb7c3e3bac


[ROCm/clr commit: 55377dfee2]
This commit is contained in:
Vladislav Sytchenko
2021-03-07 21:04:23 -05:00
förälder a38929b879
incheckning 11ad5689db
10 ändrade filer med 211 tillägg och 77 borttagningar
@@ -102,11 +102,14 @@ x
)here");
#endif
CaptureStream captured(stdout);
CaptureStream capture(stdout);
capture.Begin();
hipLaunchKernelGGL(test_kernel, dim3(1), dim3(1), 0, 0);
hipStreamSynchronize(0);
auto CapturedData = captured.getCapturedData();
std::string device_output = gulp(CapturedData);
capture.End();
std::string device_output = capture.getData();
HIPASSERT(device_output == reference);
passed();