SLANG.D: Fast, Modular and Differentiable Shader Programming
We introduce SLANG.D, an extension to the Slang shading language that incorporates first-class automatic differentiation support. The new shading language allows us to transform a Direct3D-based path tracer to be fully differentiable with minor modifications to existing code. SLANG.D enables a share...
Main Authors: | , , , , , , , , |
---|---|
Other Authors: | |
Format: | Article |
Language: | English |
Published: |
ACM
2024
|
Online Access: | https://hdl.handle.net/1721.1/153273 |
_version_ | 1826205646765162496 |
---|---|
author | Bangaru, Sai Praveen Wu, Lifan Li, Tzu-Mao Munkberg, Jacob Bernstein, Gilbert Ragan-Kelley, Jonathan Durand, Fredo Lefohn, Aaron He, Yong |
author2 | Massachusetts Institute of Technology. Computer Science and Artificial Intelligence Laboratory |
author_facet | Massachusetts Institute of Technology. Computer Science and Artificial Intelligence Laboratory Bangaru, Sai Praveen Wu, Lifan Li, Tzu-Mao Munkberg, Jacob Bernstein, Gilbert Ragan-Kelley, Jonathan Durand, Fredo Lefohn, Aaron He, Yong |
author_sort | Bangaru, Sai Praveen |
collection | MIT |
description | We introduce SLANG.D, an extension to the Slang shading language that incorporates first-class automatic differentiation support. The new shading language allows us to transform a Direct3D-based path tracer to be fully differentiable with minor modifications to existing code. SLANG.D enables a shared ecosystem between machine learning frameworks and pre-existing graphics hardware API-based rendering systems, promoting the interchange of components and ideas across these two domains. Our contributions include a differentiable type system designed to ensure type safety and semantic clarity in codebases that blend differentiable and non-differentiable code, language primitives that automatically generate both forward and reverse gradient propagation methods, and a compiler architecture that generates efficient derivative propagation shader code for graphics pipelines. Our compiler supports differentiating code that involves arbitrary control-flow, dynamic dispatch, generics and higher-order differentiation, while providing developers flexible control of checkpointing and gradient aggregation strategies for best performance. Our system allows us to differentiate an existing real-time path tracer, Falcor, with minimal changes to its shader code. We show that the compiler-generated derivative kernels perform as efficiently as handwritten ones. In several benchmarks, the SLANG.D code achieves significant speedup when compared to prior automatic differentiation systems. |
first_indexed | 2024-09-23T13:16:41Z |
format | Article |
id | mit-1721.1/153273 |
institution | Massachusetts Institute of Technology |
language | English |
last_indexed | 2024-09-23T13:16:41Z |
publishDate | 2024 |
publisher | ACM |
record_format | dspace |
spelling | mit-1721.1/1532732024-01-04T18:41:34Z SLANG.D: Fast, Modular and Differentiable Shader Programming Bangaru, Sai Praveen Wu, Lifan Li, Tzu-Mao Munkberg, Jacob Bernstein, Gilbert Ragan-Kelley, Jonathan Durand, Fredo Lefohn, Aaron He, Yong Massachusetts Institute of Technology. Computer Science and Artificial Intelligence Laboratory We introduce SLANG.D, an extension to the Slang shading language that incorporates first-class automatic differentiation support. The new shading language allows us to transform a Direct3D-based path tracer to be fully differentiable with minor modifications to existing code. SLANG.D enables a shared ecosystem between machine learning frameworks and pre-existing graphics hardware API-based rendering systems, promoting the interchange of components and ideas across these two domains. Our contributions include a differentiable type system designed to ensure type safety and semantic clarity in codebases that blend differentiable and non-differentiable code, language primitives that automatically generate both forward and reverse gradient propagation methods, and a compiler architecture that generates efficient derivative propagation shader code for graphics pipelines. Our compiler supports differentiating code that involves arbitrary control-flow, dynamic dispatch, generics and higher-order differentiation, while providing developers flexible control of checkpointing and gradient aggregation strategies for best performance. Our system allows us to differentiate an existing real-time path tracer, Falcor, with minimal changes to its shader code. We show that the compiler-generated derivative kernels perform as efficiently as handwritten ones. In several benchmarks, the SLANG.D code achieves significant speedup when compared to prior automatic differentiation systems. 2024-01-03T20:18:05Z 2024-01-03T20:18:05Z 2023-12-04 2024-01-01T08:49:28Z Article http://purl.org/eprint/type/JournalArticle 0730-0301 https://hdl.handle.net/1721.1/153273 Bangaru, Sai Praveen, Wu, Lifan, Li, Tzu-Mao, Munkberg, Jacob, Bernstein, Gilbert et al. 2023. "SLANG.D: Fast, Modular and Differentiable Shader Programming." ACM Transactions on Graphics, 42 (6). PUBLISHER_CC en https://doi.org/10.1145/3618353 ACM Transactions on Graphics Creative Commons Attribution https://creativecommons.org/licenses/by/4.0/ The author(s) application/pdf ACM Association for Computing Machinery |
spellingShingle | Bangaru, Sai Praveen Wu, Lifan Li, Tzu-Mao Munkberg, Jacob Bernstein, Gilbert Ragan-Kelley, Jonathan Durand, Fredo Lefohn, Aaron He, Yong SLANG.D: Fast, Modular and Differentiable Shader Programming |
title | SLANG.D: Fast, Modular and Differentiable Shader Programming |
title_full | SLANG.D: Fast, Modular and Differentiable Shader Programming |
title_fullStr | SLANG.D: Fast, Modular and Differentiable Shader Programming |
title_full_unstemmed | SLANG.D: Fast, Modular and Differentiable Shader Programming |
title_short | SLANG.D: Fast, Modular and Differentiable Shader Programming |
title_sort | slang d fast modular and differentiable shader programming |
url | https://hdl.handle.net/1721.1/153273 |
work_keys_str_mv | AT bangarusaipraveen slangdfastmodularanddifferentiableshaderprogramming AT wulifan slangdfastmodularanddifferentiableshaderprogramming AT litzumao slangdfastmodularanddifferentiableshaderprogramming AT munkbergjacob slangdfastmodularanddifferentiableshaderprogramming AT bernsteingilbert slangdfastmodularanddifferentiableshaderprogramming AT ragankelleyjonathan slangdfastmodularanddifferentiableshaderprogramming AT durandfredo slangdfastmodularanddifferentiableshaderprogramming AT lefohnaaron slangdfastmodularanddifferentiableshaderprogramming AT heyong slangdfastmodularanddifferentiableshaderprogramming |