Skip to content

Support SSBO POD kernel arguments with physical storage buffers - #1690

Merged
dneto0 merged 1 commit into
google:mainfrom
rjodinchr:ssbo
Oct 23, 2026
Merged

dneto0 merged 1 commit into
google:mainfrom
rjodinchr:ssbo

Conversation

@rjodinchr

Copy link
Copy Markdown
Collaborator

When -physical-storage-buffers is enabled and POD arguments fall back to kSSBO (for example due to 8-bit/16-bit UBO and push constant storage restrictions), clspv previously hit an unreachable in GetArgKindForPointerPodArgs and mapped ArgKind::Pod descriptor variables to AddressSpace::Global, which SPIRVProducerPass emits as StorageClassPhysicalStorageBuffer instead of StorageClassStorageBuffer.

Add AddressSpace::StorageBuffer for explicit SSBO descriptor variables so ArgKind::Pod variables use StorageClassStorageBuffer even when physical storage buffers are enabled, and return ArgKind::PointerUBO for kSSBO in GetArgKindForPointerPodArgs. Add a PhysicalStorageBuffers lit test covering clustered, untyped-pointer, and non-clustered SSBO POD arguments.

Comment thread lib/ArgKind.cpp Outdated
return ArgKind::PointerPushConstant;
case kSSBO:
llvm_unreachable("SSBO PODs not supported with physical pointer arguments!");
return ArgKind::PointerUBO;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This reads weirdly. I see that it's the only pointer-* kind that is not a pointer_pushconstant. But it seems strange to name it as a UBO when it's an SSBO ?

I'd like @alan-baker 's take on this.

I'm sure this is functional.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I agree it forces a double take when you read it. Might be beneficial to merge this with kUBO and have an explanatory comment.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've added a comment to make it clearer

When -physical-storage-buffers is enabled and POD arguments fall back to
kSSBO (for example due to 8-bit/16-bit UBO and push constant storage
restrictions), clspv previously hit an unreachable in
GetArgKindForPointerPodArgs and mapped ArgKind::Pod descriptor variables
to AddressSpace::Global, which SPIRVProducerPass emits as
StorageClassPhysicalStorageBuffer instead of StorageClassStorageBuffer.

Add AddressSpace::StorageBuffer for explicit SSBO descriptor variables
so ArgKind::Pod variables use StorageClassStorageBuffer even when
physical storage buffers are enabled, and return ArgKind::PointerUBO for
kSSBO in GetArgKindForPointerPodArgs. Add a PhysicalStorageBuffers lit
test covering clustered, untyped-pointer, and non-clustered SSBO POD
arguments.

Change-Id: I7a343939fa5a8cb46bf78a03d660618ecb4c52f3

@dneto0 dneto0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the update.
The comment explains the challenge to the reader's expectation, and is almost a TODO for reconsideration later on.

@dneto0
dneto0 merged commit e5fcf4b into google:main Oct 23, 2026
18 checks passed
@rjodinchr
rjodinchr deleted the ssbo branch October 23, 2026 16:59
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.

3 participants