Skip to content

Default construct QueryPool with nonzero values #3721

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

Closed
wants to merge 1 commit into from

Conversation

liuk22
Copy link
Contributor

@liuk22 liuk22 commented May 23, 2024

Summary:
We must bugfix this first to unblock either dumping querypool directly after inference or SDK development

Currently, if you try to init QueryPool during inference, it will crash at vkCreateQueryPool. Some debugging revealed in the test binary, it will crash only on VulkanComputeGraphTest but not VulkanComputeAPITest.

It is because the Context instance is initialized in two different ways and then QueryPoolConfig is then initialized in two different ways.

  1. Static singleton https://fburl.com/code/iqo8xcg2 with above nonzero max query count and the compile time flag to change the query pool. We don't use this for model inference.

  2. Explicit constructor https://fburl.com/code/m1xga4ra, invoked in VulkanBackend::Init() https://fburl.com/code/4j8y3pzu which goes through default construction of GraphConfig, default construction of QueryPoolConfig, leading to zero max query count and crash. We use this for model inference.

  3. This should be probably be unified, as it was extremely confusing to have the compile time flag work in non inference cases but not in inference case, and explicit const struct construction happens in the former vs completely default struct construction in the latter.

  4. A quick solution to unblock. QueryPoolConfig has default init values of the compile time flags.

Reviewed By: SS-JIA

Differential Revision: D57735873

Summary:
**We must bugfix this first to unblock either dumping querypool directly after inference or SDK development**

Currently, if you try to init QueryPool during inference, it will crash at `vkCreateQueryPool`. Some debugging revealed in the test binary, it will crash only on VulkanComputeGraphTest but not VulkanComputeAPITest. 

It is because the `Context` instance is initialized in two different ways and then `QueryPoolConfig` is then initialized in two different ways. 

1. Static singleton https://fburl.com/code/iqo8xcg2 with above nonzero max query count and the compile time flag to change the query pool. We don't use this for model inference. 

2. Explicit constructor https://fburl.com/code/m1xga4ra, invoked in `VulkanBackend::Init()` https://fburl.com/code/4j8y3pzu which goes through default construction of `GraphConfig`, default construction of `QueryPoolConfig`, leading to zero max query count and crash. We use this for model inference.

3. This should be probably be unified, as it was extremely confusing to have the compile time flag work in non inference cases but not in inference case, and explicit const struct construction happens in the former vs completely default struct construction in the latter. 

4. A quick solution to unblock. `QueryPoolConfig` has default init values of the compile time flags.

Reviewed By: SS-JIA

Differential Revision: D57735873
Copy link

pytorch-bot bot commented May 23, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/3721

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 579c8bf with merge base 3c43fd6 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 23, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57735873

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 1991346.

kirklandsign pushed a commit to kirklandsign/executorch that referenced this pull request May 24, 2024
Summary:
Pull Request resolved: pytorch#3721

**We must bugfix this first to unblock either dumping querypool directly after inference or SDK development**

Currently, if you try to init QueryPool during inference, it will crash at `vkCreateQueryPool`. Some debugging revealed in the test binary, it will crash only on VulkanComputeGraphTest but not VulkanComputeAPITest.

It is because the `Context` instance is initialized in two different ways and then `QueryPoolConfig` is then initialized in two different ways.

1. Static singleton https://fburl.com/code/iqo8xcg2 with above nonzero max query count and the compile time flag to change the query pool. We don't use this for model inference.

2. Explicit constructor https://fburl.com/code/m1xga4ra, invoked in `VulkanBackend::Init()` https://fburl.com/code/4j8y3pzu which goes through default construction of `GraphConfig`, default construction of `QueryPoolConfig`, leading to zero max query count and crash. We use this for model inference.

3. This should be probably be unified, as it was extremely confusing to have the compile time flag work in non inference cases but not in inference case, and explicit const struct construction happens in the former vs completely default struct construction in the latter.

4. A quick solution to unblock. `QueryPoolConfig` has default init values of the compile time flags.

Reviewed By: SS-JIA

Differential Revision: D57735873

fbshipit-source-id: e04325f34f68576db462b3003ddfffefee7fc7f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants