Racer:基于符号等价性检查的GPU内核漏洞检测
Racer: Hunting GPU Kernel Bugs with Symbolic Equivalence Checking
AI总结:
该研究提出Racer(PTX级符号等价性检查引擎),通过形状约简、锁步CTA调度器等技术检测GPU内核漏洞,在2408个生产内核中发现82个真实漏洞,含76个未知漏洞。
摘要:
GPU内核对当今AI服务的性能至关重要,但相同的算子会被反复重写:针对每一代GPU、数值格式、服务场景和内核语言,每次重写都必须保留其替换的实现所计算的函数。如今,这种义务几乎完全依赖于差分测试:在随机采样的张量上运行新内核和可信参考实现,然后在容差范围内比较它们的输出。这种方法存在额外测试用例无法消除的盲点,例如,逻辑漏洞可能产生小于正确优化内核所需容差的误差。我们提出符号等价性检查,该方法在符号输入上执行内核及其参考实现,将每个输出单元转换为精确的代数表达式,然后检查配对的表达式是否对所有输入都一致。由于这些表达式是精确的,符号等价性检查可区分浮点误差和逻辑漏洞,且单次检查可覆盖整个输入空间。我们实现了Racer,一个PTX级的符号等价性检查引擎,采用三项技术使该方法适用于生产内核:(1)形状约简以控制检查成本;(2)锁步CTA调度器以处理并发;(3)带有精确数值反驳的惯用语模板以处理其他无法确定的结果。在来自41个收集目标的2408个生产内核中,Racer在23个库中发现了82个真实漏洞,其中包括76个此前未知的漏洞,且已有41个得到确认。
英文摘要:
GPU kernels are critical to the performance of today's AI services, yet the same operators are rewritten repeatedly: for each GPU generation, numeric format, serving regime, and kernel language. Every rewrite must preserve the function computed by the implementation it replaces. Today, this obligation depends almost entirely on differential testing: run the new kernel and a trusted reference on randomly sampled tensors, then compare their outputs within a tolerance. This approach has blind spots that additional test cases cannot eliminate. For example, a logical bug may produce an error smaller than the tolerance required to accommodate a correct optimized kernel. We propose symbolic equivalence checking, which executes a kernel and its reference on symbolic inputs, turning each output cell into an exact algebraic expression, and then checks whether the paired expressions agree for all inputs. Because these expressions are exact, symbolic equivalence checking distinguishes floating-point error from logical bugs, while a single check covers the entire input space. We implement Racer, a PTX-level symbolic equivalence checking engine, with three techniques that make this approach practical for production kernels: (1) Shape Reduction to control checking cost, (2) a lockstep CTA scheduler to handle concurrency, and (3) idiom templates with exact numeric refutation for otherwise inconclusive results. Across 2,408 production kernels from 41 collection targets, Racer found 82 real bugs in 23 libraries, including 76 previously unknown bugs and 41 confirmed so far.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。