Skip to content

Conversation

@IvanKobzarev
Copy link
Contributor

@IvanKobzarev IvanKobzarev commented Jul 10, 2020

Stack from ghstack:

Differential Revision: D22754940

IvanKobzarev added a commit that referenced this pull request Jul 10, 2020
ghstack-source-id: bb83f2b
Pull Request resolved: #41224
@dr-ci
Copy link

dr-ci bot commented Jul 10, 2020

💊 CI failures summary and remediations

As of commit 63782e9 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 31 times.

IvanKobzarev added a commit that referenced this pull request Jul 13, 2020
ghstack-source-id: 616bdd7
Pull Request resolved: #41224
This was referenced Jul 14, 2020
const bool hasBias = bias.has_value() && bias->defined();
const bool vulkanBias = (*bias).is_vulkan();
if (hasBias && vulkanBias) {
if (hasBias && (*bias).is_vulkan()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively you can write as

if (hasBias && bias->is_vulkan()) {
...
}

since the dereference operator is overloaded for c10::optional. Not that it really matters but just maybe a tiny bit more idiomatic.

VBuffer buffer{sizeAligned};
if (data.has_value()) {
buffer.copy_from_host_to_device((void*)*data, size);
buffer.copy_from_host_to_device((void*)*data, dataSize);
Copy link
Contributor

Choose a reason for hiding this comment

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

Any pointer type can implicity cast to void *. The cast should not be necessary.

c10::optional<const float*> data,
const uint32_t size) {
const uint32_t dataSize,
const uint32_t bufferSize) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure I understand why this function accepts bufferSize as a parameter as well when this function is the entity that ends up allocating the buffer itself a few lines below. Is it because you want to put more data inside this buffer later on and want to make sure you have enough storage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is memory alignment. For example, if we want to bind in shader vec4[4], our buffer should be 4 * 4 * 4 (float size). While we might have only 14 floats.

@facebook-github-bot
Copy link
Contributor

@IvanKobzarev merged this pull request in 91d8729.

@facebook-github-bot facebook-github-bot deleted the gh/IvanKobzarev/56/head branch August 8, 2020 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants