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/hip commit: 223dddae6d]
Этот коммит содержится в:
Vladislav Sytchenko
2021-03-07 21:04:23 -05:00
родитель 8efcca49c9
Коммит 76cd47815a
10 изменённых файлов: 211 добавлений и 77 удалений
+6 -3
Просмотреть файл
@@ -63,11 +63,14 @@ int main(int argc, char **argv) {
hello
)here");
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();