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

Fix compile error of OptionalCUDAGuard and device_of #613

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

reyoung
Copy link
Contributor

@reyoung reyoung commented Nov 18, 2024

There are some compile errors in the main branch, like

/app/python/csrc_aot/single_prefill.cu(59): error: namespace "at::cuda" has no member "OptionalCUDAGuard"
    const at::cuda::OptionalCUDAGuard device_guard(device_of(device));
                    ^

/app/python/csrc_aot/single_prefill.cu(59): error: identifier "device_of" is undefined
    const at::cuda::OptionalCUDAGuard device_guard(device_of(device));

cc @yzh119

@@ -42,7 +43,7 @@ std::vector<int64_t> BatchDecodeWithPagedKVCachePlan(
size_t int_workspace_size_in_bytes =
int_workspace_buffer.size(0) * int_workspace_buffer.element_size();
auto device = float_workspace_buffer.device();
const at::cuda::OptionalCUDAGuard device_guard(device_of(device));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. device_of is in a private header of torch.

  2. It seems that OptionalCUDAGuard is not necessary since the device is not optional.

  3. Adding include file for CUDAGuard

Copy link
Collaborator

@yzh119 yzh119 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @reyoung !
btw, I'm moving most of the code before kernel launch (including device guard) from C++ to python, but let's merge this first.

@yzh119 yzh119 merged commit dd3c836 into flashinfer-ai:main Nov 18, 2024
@zhyncs zhyncs added the fix label Nov 18, 2024
@zhyncs
Copy link
Member

zhyncs commented Nov 18, 2024

Thanks for this fix! ref #611
I’ll help add build workflow these days. cc @yzh119

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.

3 participants