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

The compiler produce invalid spirv with enabled PhysicalPointerArgsPass. #1418

Closed
wants to merge 1 commit into from

Conversation

AlexDemydenko
Copy link
Contributor

@AlexDemydenko AlexDemydenko commented Nov 10, 2024

The tool spirv-val return errors for some spirv binaries.

The test list with OpenCL-CTS:

vector_swizzle

Kernel example:
vector-swizzle.txt

@AlexDemydenko AlexDemydenko force-pushed the GFXSW-50817 branch 2 times, most recently from ae40adf to 75101bd Compare November 14, 2024 11:38
@lpavank
Copy link
Contributor

lpavank commented Nov 18, 2024

@alan-baker and @rjodinchr, do you any inputs for @AlexDemydenko on this issue/PR?

@alan-baker
Copy link
Collaborator

What kinds of errors? When I run:

clspv vector-swizzle.cl -o vector-swizzle.spv -int8=1 -physical-storage-buffers -arch=spir64

The resulting binary passes spirv-val. What command line are you using?

@rjodinchr
Copy link
Collaborator

This is at least missing a test I would say.

@AlexDemydenko
Copy link
Contributor Author

AlexDemydenko commented Nov 20, 2024

Command line from the clvk driver:

clspv -cl-std=CL3.0 -no-8bit-storage=pushconstant -no-16bit-storage=pushconstant -spv-version=1.6 -arch=spir64 -physical-storage-buffers vector-swizzle.cl

Error from spirv-val:

error: line 99: OpPtrAccessChain result type (OpTypeInt) does not match the type that results from indexing into the base <id> (OpTypeVector).
  %56 = OpPtrAccessChain %_ptr_PhysicalStorageBuffer_uint %37 %uint_4

@AlexDemydenko
Copy link
Contributor Author

ping

Copy link
Collaborator

@rjodinchr rjodinchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add another test using clspv-opt targeting the replace-pointer-bitcast pass only.
Thank you

@AlexDemydenko AlexDemydenko force-pushed the GFXSW-50817 branch 2 times, most recently from 0c0e0a6 to 9623090 Compare December 17, 2024 04:20
@lpavank
Copy link
Contributor

lpavank commented Dec 20, 2024

@rjodinchr and @alan-baker any further inputs for @AlexDemydenko here?

@rjodinchr
Copy link
Collaborator

@rjodinchr and @alan-baker any further inputs for @AlexDemydenko here?

Maybe you have missed my comment from last month: #1418 (review)
"Could you also add another test using clspv-opt targeting the replace-pointer-bitcast pass only."

@lpavank
Copy link
Contributor

lpavank commented Dec 23, 2024

@rjodinchr and @alan-baker any further inputs for @AlexDemydenko here?

Maybe you have missed my comment from last month: #1418 (review) "Could you also add another test using clspv-opt targeting the replace-pointer-bitcast pass only."

@rjodinchr believe @AlexDemydenko did answer (#1418 (comment)). Please confirm if thats what you wanted or no.
PS: Just trying to facilitate and/or get this change checked since its blocking one test on our end.

@rjodinchr
Copy link
Collaborator

@rjodinchr and @alan-baker any further inputs for @AlexDemydenko here?

Maybe you have missed my comment from last month: #1418 (review) "Could you also add another test using clspv-opt targeting the replace-pointer-bitcast pass only."

@rjodinchr believe @AlexDemydenko did answer (#1418 (comment)). Please confirm if thats what you wanted or no. PS: Just trying to facilitate and/or get this change checked since its blocking one test on our end.

At the moment, both added tests are not passing (on every bots). Please make sure they are passing using ToT.
Maybe you can also reduce the .ll test to only the necessary part so that it's easier to maintain (here is an example of a reduced test: https://github.com/google/clspv/blob/main/test/PointerCasts/opaque_implicit_gep.ll)

@@ -0,0 +1,31 @@
; RUN: clspv-opt %s -o %t.ll --passes=replace-pointer-bitcast
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That test is passing even without your fix, so it is not testing what you expect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new version physical_pointers_vector-swizzle.ll has been uploaded, which only passes with a fix.

@@ -0,0 +1,22 @@
// RUN: clspv %s -o %t.spv -cl-std=CL3.0 -no-8bit-storage=pushconstant -no-16bit-storage=pushconstant -spv-version=1.6 -arch=spir64 -physical-storage-buffers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That test is still not passing (with or without the fix)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new version physical_pointers_vector-swizzle.cl has been uploaded

@rjodinchr
Copy link
Collaborator

Please run the tests locally and make sure they fail without the fix and pass with it

The tool spirv-val return errors for some spirv binaries.
@rjodinchr
Copy link
Collaborator

I had a closer look at the PR. I don't think this is the right way to deal with that issue.
Here is what I propose: #1434

@AlexDemydenko
Copy link
Contributor Author

Yes, you propose works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants