回复:在 SSE2 CPU 上为 0.3.6 并行计算 4 个哈希
原始发布页
打开来源页面查看 1 个交叉存档
引用 impossible7 发表于 2010 年 8 月 6 日 上午 11:37:20
CRITICAL_BLOCK 是一个包含 for 循环的宏。断言失败表明在循环体内调用了 break。这个代码块中唯一的 break 语句位于第 2762 行。原始源文件的这个临界区块中没有 break 语句。我认为你必须删除第 2759-2762 行。原始 main.cpp 中没有这样的东西。
对此很抱歉。CRITICAL_BLOCK 并不完美。必须注意不要用 break 或 continue 跳出它。有一个断言会捕获 break 并发出警告。有人可以批评我使用了它,但如果不用,语法会臃肿得多,也更容易出错。
SSE2 代码在 Intel 上运行缓慢,有没有可能是某种可以绕开的特殊问题造成的?比如说,某个东西在未对齐时仍能工作但速度很慢,或者缓存发生颠簸,又或者某类指令特别慢?我不确定现在还能不能找到,但我想 Intel 以前有一种分析器,可以在逐条指令的层面进行性能分析。我猜,如果 tcatm 没有一台装有这种慢速处理器的系统来测试,就没什么希望了。不过,要是它能在大多数 CPU 上正常工作,那就太好了。
英文原文
展开英文原文
Quote from: impossible7 on August 06, 2010, 11:37:20 AM
CRITICAL_BLOCK is a macro that contains a for loop. The assertion failure indicates that break has been called inside the body of the loop. The only break statement in this block is in line 2762. In the original source file, there is no break statement in this critical block. I think you must remove lines 2759-2762. The is nothing like that in the original main.cpp.
Sorry about that. CRITICAL_BLOCK isn't perfect. You have to be careful not to break or continue out of it. There's an assert that catches and warns about break. I can be criticized for using it, but the syntax would be so much more bloated and error prone without it.
Is there a chance the SSE2 code is slow on Intel because of some quirk that could be worked around? For instance, if something works but is slow if it's not aligned, or thrashing the cache, or one type of instruction that's really slow? I'm not sure how available it is, but I think Intel used to have a profiler for profiling on a per instruction level. I guess if tcatm doesn't have a system with the slow processor to test with, there's not much hope. But it would be really nice if this was working on most CPUs.