diff options
| author | aidanfnv <aidanf@nvidia.com> | 2025-08-04 17:34:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-05 00:34:13 +0000 |
| commit | ce53e9c6703708bc85b0b1a0872620a7725c5a45 (patch) | |
| tree | d313646347b80f27f5b4b5cf87191ac766509363 /docs | |
| parent | 301ffb1944a01d33d0b82c135f3c4a86e80fde2e (diff) | |
Clarify downstream and direct compilation paths in design overview doc (#8021)
* Clarify downstream and direct compilation paths in design overview doc
* Fix typo, add more examples
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/design/overview.md | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/docs/design/overview.md b/docs/design/overview.md index 24c316038..e1790bb11 100644 --- a/docs/design/overview.md +++ b/docs/design/overview.md @@ -236,7 +236,7 @@ We expect that over time it will be valuable for Slang to support a wider array ### Emission -Once we have transformed the IR code into something that should be legal for the chosen target, we emit high-level source code in either HLSL or GLSL. +Once we have transformed the IR code into something that should be legal for the chosen target, we emit code in the appropriate format for the target. This can be high-level source code (such as HLSL, GLSL, Metal, WGSL, C++, or CUDA) or binary formats (such as SPIR-V, DXIL, PTX, or MetalLib) depending on the compilation target. The emit logic is mostly just a scan over the IR code to emit a high-level declaration for each item: an IR structure type becomes a `struct` declaration, and IR function becomes a function definition, etc. @@ -249,9 +249,15 @@ A future version of the compiler might implement something more complete like th ### Downstream Compiler Execution -Once we have source code, we can invoke downstream compilers like fxc, dxc, and glslang to generate binary code (and optionally to disassemble that code for console output). +For certain targets and compilation paths, we invoke downstream compilers to generate binary code (and optionally to disassemble that code for console output). For example: +- DXIL and DXBC targets use dxc and fxc respectively +- SPIR-V, although generated directly from the Slang IR by default, can instead use glslang if the `-emit-spirv-via-glsl` option is specified for `slangc`. If that option is used, GLSL is emitted from the Slang IR to pass to glslang for SPIR-V generation +- PTX generation uses NVRTC +- MetalLib and MetalLibAssembly targets use the Metal compiler (MetalC) -The Slang compiler also supports a "pass through" mode where it skips most of the steps outlined so far and just passes text along to these downstream compilers directly. This is primarily intended as a debugging aid for developers working on Slang, since it lets you use the same command-line arguments to invoke both Slang compilation and compilation with these other compilers. +Targets that have output emitted directly from the Slang IR without the use of downstream compilers include high-level source formats like HLSL, GLSL, Metal, WGSL, C++, and CUDA source, as well as the default SPIR-V binary generation path. + +The Slang compiler also supports a "pass through" mode where it skips most of the steps outlined so far and just passes text along to downstream compilers directly. This is primarily intended as a debugging aid for developers working on Slang, since it lets you use the same command-line arguments to invoke both Slang compilation and compilation with these other compilers. Conclusion ---------- |
