[SPIR-V] SPV_EXT_descriptor_heap crashes, or miscompiles shaders that work in emulated mode (images, buffers, ConstantBuffer, counters)
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start from the -fspv-use-descriptor-heap path in the SPIR-V emitter, where heap provenance is recorded in a side table keyed on VarDecl, and from where OpBufferPointerEXT pointers are materialized at use sites. The issue asks for a value-based representation of heap resources that survives calls, aggregates and counters, which is a design change. Done means the listed shader cases compile or are rejected with a located error, never with a null instruction or OpUndef. Start with the maintainers' design discussion before writing code.
索引モデルが issue の本文から書いたものです。
説明
Summary
With -fspv-use-descriptor-heap (SPV_EXT_descriptor_heap), a large set of shaders that compile and validate in the emulated mode (ResourceDescriptorHeap as bound runtime arrays) either fail to compile in native mode, produce invalid SPIR-V, crash the compiler, or silently generate wrong code.
The root problems
The native implementation handles the simplest case where a heap resource is fetched and used in the same place. Most shaders don't necessarily follow that constraint, and the design has no way to go further.
1. Heap provenance is a per-variable compile-time property, not a value
The emitter records "this variable was initialized from the heap" in a side table keyed on VarDecl. The table is flow-insensitive and only describes named local variables.
That is insufficient because the provenance is load-bearing at code generation. An image atomic must rebuild the access from the descriptor index, so the index has to be recoverable at the atomic site. Parameters, return values, out/inout arguments, struct fields, and array elements have no VarDecl entry, so provenance is dropped at every one of those edges. The compiler then either rejects the shader or falls back to storing an image handle to memory, which is invalid SPIR-V (VUID-06924).
At run time a heap resource is a descriptor index plus a resource kind. It has to be represented as a value that follows the resource through calls and aggregates, not as an annotation on a declaration.
2. Heap buffers exist only as a pointer at the access site
A heap buffer is materialized as an OpBufferPointerEXT pointer at the point of use. There is no representation for the buffer as something to pass, return, or place in an aggregate. ConstantBuffer by value, counter operations, and append/consume buffers are each rejected for the same reason: nothing describes a heap buffer whose lifetime extends beyond the expression that creates it.
Counters add a second gap. A heap buffer has no statically known counter variable, so counter access needs its own storage model keyed off the heap index.
3. Rejection paths are unsafe
When the emitter declines a construct, it often returns a null SpirvInstruction* or an OpUndef and continues. A null result propagates into later emitter stages and crashes (access violation, LLVM assert). An OpUndef result produces SPIR-V that validates and uses an undefined pointer or the wrong buffer, such as the caller of an out/inout buffer parameter reading an undefined pointer or the pre-call binding.
There is no invariant that a rejection must emit a located error and yield a defined value. A silent miscompile is a worse failure mode than a missing feature.
- 主要言語
- C++
- スター
- 3.7k
- フォーク
- 926
- 平均マージ
- 3日 22時間
- マージ済み PR(30日)
- 45
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/DirectXShaderCompiler のほかの issue
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/DirectXShaderCompiler#9173 ·
メンテナーはふだん 2 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
microsoft/DirectXShaderCompiler#9155 · コメント 4 件 ·
メンテナーはふだん 2 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/DirectXShaderCompiler#9135 ·
メンテナーはふだん 2 日以内に返信
-
DXC emits DW_LANG_C_plus_plus instead of DW_LANG_HLSL for HLSL対応中かも @rj123-nv が 18 日前に担当しました。 オープンbug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoft/DirectXShaderCompiler#9087 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoft/DirectXShaderCompiler#9086 ·
メンテナーはふだん 2 日以内に返信
microsoft/DirectXShaderCompiler の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
feature:config kind:docs os:windows toolchain:cmake triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
arch-based bug niri
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
noctalia-dev/noctalia#5552 ·
メンテナーはふだん 1 日以内に返信