[SPIR-V] early return with ROV will generate spirv that hung the gpu (or at least weird spirv)

Open
#9,020 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp

Research direction

Start by reproducing with the linked godbolt snippet and dumping the SPIR-V for the early-return path. Look at the block labelled %36, where an OpEndInvocationInterlockEXT and an OpBeginInvocationInterlockEXT appear just before OpBranch %30, and find where the compiler emits the interlock begin/end pairs for early returns. Done means the emitted SPIR-V no longer leaves an unmatched begin interlock before the branch, with a regression test for ROV plus early return.

Written by the indexing model from the issue text.

Description

bug needs-triage spirv

Hi everyone ! Miss me ?

Description
While using ROVs and having early return, SpirV will generate extra OpEndInvocationInterlockEXT and OpBeginInvocationInterlockEXT that hung the GPU.

Steps to Reproduce
https://godbolt.org/z/YnYqdbjre

Actual Behavior
the early return will produce an extra

         %36 = OpLabel
               OpEndInvocationInterlockEXT
               OpBeginInvocationInterlockEXT
               OpBranch %30

It seems the last OpBeginInvocationInterlockEXT is not closed and the GPU will hung.

Environment
DXC trunk on godbolt
Reproduce also on windows 11 and custom fork of 1.10.2605.24.

Dominant language
C++
Stars
3.7k
Forks
926
Avg merge
3d 22h
Merged PRs (30d)
45

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DirectXShaderCompiler

All issues in microsoft/DirectXShaderCompiler

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.