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

Disallowing zero sized tensors #129

Merged
merged 2 commits into from Jan 31, 2021

Conversation

alexander-g
Copy link
Contributor

@alexander-g alexander-g commented Jan 30, 2021

Vulkan specs disallow zero-sized buffers. I've run into segfaults accidentally trying to create some and this was mentioned in #14.
I've added an exception with an error message for easier fault finding. The exception is thrown right before buffer creation because that's where the segfault would happen, but one might consider throwing it already in the constructor.

Copy link
Member

@axsaucedo axsaucedo left a comment

Choose a reason for hiding this comment

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

Nice one, just in time, it will also make it to the 0.6.0 release tomorrow. I added a comment but other than that looks good

mgr.evalOpDefault<kp::OpTensorCreate>({ tensorA });
} catch( const std::runtime_error& err ) {
// check exception
ASSERT_STREQ("Kompute Tensor attempted to create a zero-sized buffer", err.what() );
Copy link
Member

Choose a reason for hiding this comment

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

StrEq comparison may be too brittle for test, eventually it would be interesting to explore structured errror/exception handling, but for now is there a way to just have a check for "zero sized" in the string?

Copy link
Member

Choose a reason for hiding this comment

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

May also be worth adding an extra comment in the constructor so it's explicit that it will throw an error if empty tensor

@axsaucedo axsaucedo added this to In progress in 0.6.0 via automation Jan 30, 2021
@axsaucedo axsaucedo added bug Something isn't working enhancement New feature or request labels Jan 30, 2021
Copy link
Member

@axsaucedo axsaucedo left a comment

Choose a reason for hiding this comment

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

Fantastic @alexander-g!

@axsaucedo axsaucedo merged commit 4b8c1c4 into KomputeProject:master Jan 31, 2021
0.6.0 automation moved this from In progress to Done Jan 31, 2021
@alexander-g alexander-g deleted the no_zero_size_tensors branch February 4, 2021 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
No open projects
0.6.0
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants