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

[aot] Support multiple AOT runtime devices #8275

Merged
merged 4 commits into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions c_api/src/taichi_core_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ void ti_set_last_error(TiError error, const char *message) {
TiRuntime ti_create_runtime(TiArch arch, uint32_t device_index) {
TiRuntime out = TI_NULL_HANDLE;
TI_CAPI_TRY_CATCH_BEGIN();
// FIXME: (penguinliong) Support device selection.
TI_CAPI_NOT_SUPPORTED_IF_RV(device_index != 0);
TI_INFO("Taichi Runtime C-API version is: {}", TI_C_API_VERSION);
switch (arch) {
#ifdef TI_WITH_VULKAN
case TI_ARCH_VULKAN: {
taichi::lang::vulkan::set_vulkan_visible_device(
std::to_string(device_index));
VulkanRuntimeOwned *vulkan_runtime;
if (is_ci()) {
auto param = make_vulkan_runtime_creator_params();
Expand All @@ -266,29 +266,34 @@ TiRuntime ti_create_runtime(TiArch arch, uint32_t device_index) {
#endif // TI_WITH_VULKAN
#ifdef TI_WITH_OPENGL
case TI_ARCH_OPENGL: {
TI_CAPI_NOT_SUPPORTED_IF_RV(device_index != 0);
out = (TiRuntime)(static_cast<Runtime *>(new OpenglRuntime));
break;
}
#endif // TI_WITH_OPENGL
#ifdef TI_WITH_LLVM
case TI_ARCH_X64: {
TI_CAPI_NOT_SUPPORTED_IF_RV(device_index != 0);
out = (TiRuntime)(static_cast<Runtime *>(
new capi::LlvmRuntime(taichi::Arch::x64)));
break;
}
case TI_ARCH_ARM64: {
TI_CAPI_NOT_SUPPORTED_IF_RV(device_index != 0);
out = (TiRuntime)(static_cast<Runtime *>(
new capi::LlvmRuntime(taichi::Arch::arm64)));
break;
}
case TI_ARCH_CUDA: {
TI_CAPI_NOT_SUPPORTED_IF_RV(device_index != 0);
out = (TiRuntime)(static_cast<Runtime *>(
new capi::LlvmRuntime(taichi::Arch::cuda)));
break;
}
#endif // TI_WITH_LLVM
#ifdef TI_WITH_METAL
case TI_ARCH_METAL: {
TI_CAPI_NOT_SUPPORTED_IF_RV(device_index != 0);
out = (TiRuntime)(static_cast<Runtime *>(new capi::MetalRuntime()));
break;
}
Expand Down