Skip to content

feat: expose configuration for GPU acceleration and index worker threads in context server #960

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

Merged
merged 4 commits into from
Apr 21, 2025

Conversation

breedloj
Copy link
Contributor

Problem

Clients may want to configure the optional GPU acceleration and index worker thread parameters of the local indexing library. VSCode and Jetbrains support these options in their user facing preference panes.

Solution

Add these options to the LSP server's supported set of configurables. By default, GPU acceleration is off and index worker threads are not explicitly set.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@breedloj breedloj requested a review from a team as a code owner April 14, 2025 21:47
Comment on lines 121 to 126
updatedConfig.projectContext?.enableLocalIndexing
? await localProjectContextController.init()
? await localProjectContextController.init({
enableGpuAcceleration: updatedConfig?.projectContext?.enableGpuAcceleration,
indexWorkerThreads: updatedConfig?.projectContext?.indexWorkerThreads,
})
: await localProjectContextController.dispose()
Copy link
Contributor

Choose a reason for hiding this comment

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

At this point should this just be an if statement? ;)

Comment on lines 121 to 126
updatedConfig.projectContext?.enableLocalIndexing
? await localProjectContextController.init()
? await localProjectContextController.init({
enableGpuAcceleration: updatedConfig?.projectContext?.enableGpuAcceleration,
indexWorkerThreads: updatedConfig?.projectContext?.indexWorkerThreads,
})
: await localProjectContextController.dispose()
Copy link
Contributor

@kmile kmile Apr 17, 2025

Choose a reason for hiding this comment

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

Can init and dispose be done multiple times per session? What happens if (for whatever reason) 2 inits or 2 disposes happen in a row?

Copy link
Contributor

Choose a reason for hiding this comment

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

Reading along, it seems like 2x dispose is pretty safe, but 2x init would result in orphaned resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made init no-op if already initialized.

@@ -112,6 +114,8 @@ export async function getAmazonQRelatedWorkspaceConfigs(
},
projectContext: {
enableLocalIndexing: newQConfig.projectContext?.enableLocalIndexing === true,
enableGpuAcceleration: newQConfig.projectContext?.enableGpuAcceleration === true,
indexWorkerThreads: newQConfig.projectContext?.indexWorkerThreads ?? -1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does -1 have a special meaning? Or would 0 threads mean the same thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be the same - I just considered -1 to be more of an effective no-op/disabled state.

@breedloj breedloj force-pushed the additionalContextOptions branch 3 times, most recently from bb3ce8a to 911e441 Compare April 18, 2025 20:17
@breedloj breedloj force-pushed the additionalContextOptions branch from 911e441 to 12ae8c7 Compare April 18, 2025 20:47
@breedloj breedloj merged commit 0ecb9dd into aws:main Apr 21, 2025
6 checks passed
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