google / google/shaderc

Mistake: glslc should not do if-optimize for some subgroup op.

Open
#1,277 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

Hi, i found glslc may add some if-optimize for && statement.

but somtimes it make error case( Some subgroup-op require all lane in active state), eg code like this:

![image](https://user-images.githubusercontent.com/49807180/200886197-a396a0a0-be82-4ca3-a8fb-6eee733873d7.png)

compiling code is below:

![image](https://user-images.githubusercontent.com/49807180/200886692-dd20ee16-8c65-4088-b65f-c0e6e56cae7f.png)

now subgroup-op was placed in if-statement, and may no active in all quad lane, then will case some compute error.

if change the code like this:

![image](https://user-images.githubusercontent.com/49807180/200887205-c6c2685f-0023-4d8e-b5dd-27af66e9628b.png)

now all quad lane can active to compute, and the result is right:
![image](https://user-images.githubusercontent.com/49807180/200887781-6ead4d72-a4e0-4e1f-b039-f3afa06a7888.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.