Table of Contents
Fetching ...

CoolerSpace: A Language for Physically Correct and Computationally Efficient Color Programming

Ethan Chen, Jiwon Chang, Yuhao Zhu

TL;DR

CoolerSpace raises the level of abstraction of color programming by allowing programmers to focus on describing the logic of color physics, and prevents common errors in color programming without run-time overhead.

Abstract

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 CoolerSpace to facilitate physically correct and computationally efficient color programming. CoolerSpace 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 CoolerSpace. The type system in CoolerSpace 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, CoolerSpace also generates performance-optimized programs using equality saturation. CoolerSpace is implemented as a Python library and compiles to ONNX, a common intermediate representation for tensor computations. CoolerSpace not only prevents common errors in color programming, but also does so without run-time overhead: even unoptimized CoolerSpace 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.

CoolerSpace: A Language for Physically Correct and Computationally Efficient Color Programming

TL;DR

CoolerSpace raises the level of abstraction of color programming by allowing programmers to focus on describing the logic of color physics, and prevents common errors in color programming without run-time overhead.

Abstract

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 CoolerSpace to facilitate physically correct and computationally efficient color programming. CoolerSpace 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 CoolerSpace. The type system in CoolerSpace 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, CoolerSpace also generates performance-optimized programs using equality saturation. CoolerSpace is implemented as a Python library and compiles to ONNX, a common intermediate representation for tensor computations. CoolerSpace not only prevents common errors in color programming, but also does so without run-time overhead: even unoptimized CoolerSpace 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.
Paper Structure (39 sections, 9 figures, 2 tables)

This paper contains 39 sections, 9 figures, 2 tables.

Figures (9)

  • Figure 5: Subset of ONNX typing rules.
  • Figure 6: Proof of translational soundness for XYZ$+$XYZ under ColorAdd
  • Figure 7: A faulty type rule for reflection operations. The correct type rule is Rule \ref{['rule:reflect']} (Reflect).
  • Figure 8: The evaluation rule for reflection operations. The corresponding type rule is Rule \ref{['rule:reflect']} (Reflect).
  • Figure 9: Color blindness simulation. Original image courtesy of Simon Amarasingham amarasingham_red_2019.
  • ...and 4 more figures