Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spirv-in] More sign-agnostic operations #1645

Closed
afd opened this issue Jan 4, 2022 · 0 comments · Fixed by #1651
Closed

[spirv-in] More sign-agnostic operations #1645

afd opened this issue Jan 4, 2022 · 0 comments · Fixed by #1651
Labels
area: front-end Input formats for conversion kind: feature New feature or request lang: SPIR-V Binary SPIR-V input and output

Comments

@afd
Copy link

afd commented Jan 4, 2022

I did some more fuzzing with spirv-fuzz following the fixes in #1603, but it seems there are some more sign-agnostic ops that are not handled. Naga complains about these valid uses of OpBitwise{And, Or, Xor} and OpSNegate:

               OpCapability Shader
          %1 = OpExtInstImport "GLSL.std.450"
               OpMemoryModel Logical GLSL450
               OpEntryPoint Fragment %4 "main"
               OpExecutionMode %4 OriginUpperLeft
       %void = OpTypeVoid
          %3 = OpTypeFunction %void
       %uint = OpTypeInt 32 0
     %uint_1 = OpConstant %uint 1
        %int = OpTypeInt 32 1
      %int_0 = OpConstant %int 0
          %4 = OpFunction %void None %3
          %5 = OpLabel
        %583 = OpBitwiseAnd %uint %uint_1 %int_0
        %584 = OpBitwiseOr %uint %uint_1 %int_0
        %585 = OpBitwiseXor %uint %uint_1 %int_0
        %588 = OpSNegate %int %uint_1
               OpReturn
               OpFunctionEnd

Here is another example using OpSMod that gets rejected:

               OpCapability Shader
          %1 = OpExtInstImport "GLSL.std.450"
               OpMemoryModel Logical GLSL450
               OpEntryPoint Fragment %4 "main"
               OpExecutionMode %4 OriginUpperLeft
       %void = OpTypeVoid
          %3 = OpTypeFunction %void
        %int = OpTypeInt 32 1
      %int_0 = OpConstant %int 0
       %uint = OpTypeInt 32 0
    %uint_16 = OpConstant %uint 16
          %4 = OpFunction %void None %3
          %5 = OpLabel
         %98 = OpSMod %int %int_0 %uint_16
               OpReturn
               OpFunctionEnd

And an example using OpSDiv that gets rejected:

               OpCapability Shader
          %1 = OpExtInstImport "GLSL.std.450"
               OpMemoryModel Logical GLSL450
               OpEntryPoint Fragment %4 "main"
               OpExecutionMode %4 OriginUpperLeft
       %void = OpTypeVoid
          %3 = OpTypeFunction %void
       %uint = OpTypeInt 32 0
        %int = OpTypeInt 32 1
     %int_16 = OpConstant %int 16
    %uint_16 = OpConstant %uint 16
          %4 = OpFunction %void None %3
          %5 = OpLabel
         %20 = OpSDiv %int %int_16 %uint_16
               OpReturn
               OpFunctionEnd
@kvark kvark added area: front-end Input formats for conversion kind: feature New feature or request lang: SPIR-V Binary SPIR-V input and output labels Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: front-end Input formats for conversion kind: feature New feature or request lang: SPIR-V Binary SPIR-V input and output
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants