一句话:CoolerSpace 通过赋予物理量纲的类型系统与等式饱和优化,让颜色编程既物理正确又计算高效。
现有颜色编程库仅对矩阵运算做薄封装,程序员容易被数学上合法但物理上无意义的计算引入缺陷,正确实现既难写又难优化。CoolerSpace 提高颜色编程的抽象层次,让程序员专注于描述颜色物理的逻辑,而把正确性与效率交给语言处理。其类型系统为用户定义对象赋予物理意义和量纲,类型规则只允许符合颜色物理与感知的合法计算;在类型检查的同时,CoolerSpace 利用等式饱和(equality saturation)生成性能优化后的程序。它实现为 Python 库并编译到张量计算常用中间表示 ONNX。评估显示,CoolerSpace 不仅能防止颜色编程中的常见错误,而且没有运行时开销:未优化的程序已比现有基于 Python 的颜色编程系统快至多 5.7 倍,其优化还能再提供至多 1.4 倍的加速。
Color programmers manipulate lights, materials, and the resulting colors from light-material interactions. Existing libraries for color programming provide only a thin layer of abstraction around matrix operations. Color programs are, thus, vulnerable to bugs arising from mathematically permissible but physically meaningless matrix computations. Correct implementations are difficult to write and optimize. We introduce C ooler S pace to facilitate physically correct and computationally efficient color programming. C ooler S pace raises the level of abstraction of color programming by allowing programmers to focus on describing the logic of color physics. Correctness and efficiency are handled by C ooler S pace . The type system in C ooler S pace assigns physical meaning and dimensions to user-defined objects. The typing rules permit only legal computations informed by color physics and perception. Along with type checking, C ooler S pace also generates performance-optimized programs using equality saturation. C ooler S pace is implemented as a Python library and compiles to ONNX, a common intermediate representation for tensor computations. C ooler S pace not only prevents common errors in color programming, but also does so without run-time overhead: even unoptimized C ooler S pace programs out-perform existing Python-based color programming systems by up to 5.7 times; our optimizations provide up to an additional 1.4 times speed-up.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@article{ChenC024,
title = {CoolerSpace: A Language for Physically Correct and Computationally Efficient Color Programming},
author = {Ethan Chen and Jiwon Chang and Yuhao Zhu},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {OOPSLA2},
year = {2024},
doi = {10.1145/3689741}
}