[英]Odd behaviour in PARSEC x264 benchmark
I am running the PARSEC x264 benchmark and it runs fine until the close down when it crashes.我正在运行 PARSEC x264 基准测试,它运行良好,直到崩溃时关闭。 Unfortunately the suite seems to be unmaintained or on low maintenance - this problem (the crash, not the specifics) was posted on the mailing list nearly a year ago but no replies.不幸的是,该套件似乎没有维护或维护不足 - 这个问题(崩溃,而不是细节)在近一年前发布在邮件列表中,但没有回复。
I have isolated the problem to part of a particular function (see below) using good old fashioned debugging by printf:我已使用 printf 的老式调试将问题隔离到特定 function(见下文)的一部分:
void x264_cqm_delete( x264_t *h )
{
int i, j;
printf("IN BAD CODE\n");
for( i = 0; i < 6; i++ )
{
for( j = 0; j < i; j++ )
if( h->quant4_mf[i] == h->quant4_mf[j] )
break;
if( j == i )
{
printf("DELETE CODE with i = %i and j = %i\n", i, j);
x264_free( h-> quant4_mf[i] );
x264_free( h->dequant4_mf[i] );
x264_free( h->unquant4_mf[i] );
}
for( j = 0; j < i; j++ )
if( h->quant4_bias[i] == h->quant4_bias[j] )
break;
if( j == i )
x264_free( h->quant4_bias[i] );
}
} }
This generates the output...这将生成 output...
IN BAD CODE
DELETE CODE with i = 0 and j = 0
DELETE CODE with i = 4 and j = 4
DELETE CODE with i = 5 and j = 4
What is going on?到底是怎么回事?
From examining the canonical code in the x264 library itself it seems clear that the code is broken and the reason I am seeing these issues is that the code is trashing the heap.通过检查 x264 库本身中的规范代码,很明显代码已损坏,我看到这些问题的原因是代码正在破坏堆。
In fact the outer loop's limit should be 4 - it should match the number used in the name of the various arrays - that is the pattern used in the x264 library itself - and the quant4_mf array has only 4 elements in the first dimension.事实上,外部循环的限制应该是 4 - 它应该与各种 arrays 名称中使用的数字匹配 - 这是 x264 库本身使用的模式 - 并且 quant4_mf 数组在第一维中只有 4 个元素。 Patching the code in this way sees the compiled binary run without issue.以这种方式修补代码可以看到编译后的二进制文件运行没有问题。
Just to make it work, you can change compiler optimization from O3 to O2: https://github.com/cirosantilli/parsec-benchmark/issues/3 Tested with Ubuntu-18.04 gcc 7.5.0为了使它工作,您可以将编译器优化从 O3 更改为 O2: https://github.com/cirosantilli/parsec-benchmark/issues/3使用 Ubuntu-18.04 测试 gcc 7.5.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.