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

shader cache polishing #748

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

shader cache polishing #748

wants to merge 11 commits into from

Conversation

alichraghi
Copy link
Member

Description

Testing

TODO list:

@alichraghi alichraghi changed the title Ali shader cache shader cache polishing Oct 4, 2024
@alichraghi
Copy link
Member Author

@devshgraphicsprogramming did i miss anything?

@devshgraphicsprogramming
Copy link
Member

Did you test the hash cache works nicely on example 23 (arithmetic test) and 62 CAD ?

Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
@alichraghi alichraghi marked this pull request as draft October 5, 2024 17:17
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
@alichraghi alichraghi marked this pull request as ready for review October 6, 2024 08:42
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
Comment on lines +409 to +410
std::vector<unsigned char> compressedSpirv = {};
compressedSpirv.resize(propsSize + destLen);

Choose a reason for hiding this comment

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

why are you making a temp vector just to memcpy it later into a spirv buffer?

just make the buffer now and write into that

Copy link
Member Author

@alichraghi alichraghi Oct 9, 2024

Choose a reason for hiding this comment

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

the final size after compression is unknown and ICPUBuffer can't be resized (unless you ask me to add a resize method?)

Copy link
Member

Choose a reason for hiding this comment

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

ok didn't realize.

In that case, there's a thing called CCPUBuffer with a custom allocator that can also adopt memory

you can malloc instead of having a vector, then realloc and after realloc is complete you can create that CCustomAllocatorCPUBuffer with core::adopt_memory tag constructor overload

You just need to provide an "allocator" which will call free() on the adopted pointer

Copy link
Member Author

Choose a reason for hiding this comment

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

i'll address this in the upcoming Lib Shader Stage PR

Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
@devshgraphicsprogramming
Copy link
Member

@Erfan-Ahmadi you can merge, this will probably help you a lot with the cache size

@alichraghi alichraghi mentioned this pull request Oct 12, 2024
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.

2 participants