[SPIR-V] `vk::ext_capability` on a `vk::SpirvType` type alias is not emitted

オープン
#9,056 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp
領域
compilers

調査の方向性

Start by tracing how DXC handles vk::ext_capability attributes on vk::SpirvType aliases and how it emits capabilities for functions and entry points. Reproduce the issue with the HLSL example and the listed SPIR-V target flags, then compare generated output for an alias and a function. Done means the alias causes OpCapability PhysicalStorageBufferAddresses to be emitted and the generated SPIR-V validates.

索引モデルが issue の本文から書いたものです。

説明

bug needs-triage spirv

Version: DXC (trunk) on godbolt
Flags: -spirv -T cs_6_8 -E main -HV 202x -fspv-target-env=vulkan1.3

[[vk::binding(0,0)]] RWStructuredBuffer<uint32_t> buf;

using UintPtr [[vk::ext_capability(/*PhysicalStorageBufferAddresses*/5347)]]
    = vk::SpirvType</*OpTypePointer*/32, 8, 8, vk::Literal<vk::integral_constant<uint32_t, /*PhysicalStorageBuffer*/5349> >, uint32_t>;

[[vk::ext_instruction(/*OpBitcast*/124)]]
UintPtr toPtr(uint32_t2 addr);

[[vk::ext_instruction(/*OpLoad*/61)]]
uint32_t load(UintPtr p, [[vk::ext_literal]] uint32_t aligned, [[vk::ext_literal]] uint32_t alignment);

struct PushData { uint32_t2 addr; };
[[vk::push_constant]] PushData pc;

[numthreads(64,1,1)]
void main(uint32_t gi : SV_GroupIndex)
{
    buf[gi] = load(toPtr(pc.addr), /*Aligned*/0x2, 4);
}

godbolt link: https://godbolt.org/z/vjW4c4s5j
Expected: OpCapability PhysicalStorageBufferAddresses (the Inline SPIR-V wiki lists type aliases of SpirvType as valid targets).
Actual: generated SPIR-V is invalid: Operand 2 of TypePointer requires one of these capabilities: PhysicalStorageBufferAddresses. Same result with a typedef. The capability is emitted only when the attribute is on a called function or the entry point.

So for now, what we can do is to emit the capabilities on functions working with it.

主要言語
C++
スター
3.7k
フォーク
926
平均マージ
3日 22時間
マージ済み PR(30日)
45

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/DirectXShaderCompiler のほかの issue

microsoft/DirectXShaderCompiler の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。