Skip to content

Commit 6cd4e03

Browse files
authored
arg : bring back missing ifdef (ggml-org#9411)
* arg : bring back missing ifdef * replace with llama_supports_gpu_offload
1 parent 8d300bd commit 6cd4e03

File tree

2 files changed

+13
-23
lines changed

2 files changed

+13
-23
lines changed

common/arg.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,20 +1417,18 @@ gpt_params_context gpt_params_parser_init(gpt_params & params, llama_example ex,
14171417
params.split_mode = LLAMA_SPLIT_MODE_NONE;
14181418
} else if (arg_next == "layer") {
14191419
params.split_mode = LLAMA_SPLIT_MODE_LAYER;
1420-
}
1421-
else if (arg_next == "row") {
1420+
} else if (arg_next == "row") {
14221421
#ifdef GGML_USE_SYCL
14231422
fprintf(stderr, "warning: The split mode value:[row] is not supported by llama.cpp with SYCL. It's developing.\nExit!\n");
14241423
exit(1);
14251424
#endif // GGML_USE_SYCL
14261425
params.split_mode = LLAMA_SPLIT_MODE_ROW;
1427-
}
1428-
else {
1426+
} else {
14291427
throw std::invalid_argument("invalid value");
14301428
}
1431-
#ifndef GGML_USE_CUDA_SYCL_VULKAN
1432-
fprintf(stderr, "warning: llama.cpp was compiled without CUDA/SYCL/Vulkan. Setting the split mode has no effect.\n");
1433-
#endif // GGML_USE_CUDA_SYCL_VULKAN
1429+
if (!llama_supports_gpu_offload()) {
1430+
fprintf(stderr, "warning: llama.cpp was compiled without support for GPU offload. Setting the split mode has no effect.\n");
1431+
}
14341432
}
14351433
));
14361434
add_opt(llama_arg(
@@ -1450,24 +1448,24 @@ gpt_params_context gpt_params_parser_init(gpt_params & params, llama_example ex,
14501448
}
14511449
for (size_t i = 0; i < llama_max_devices(); ++i) {
14521450
if (i < split_arg.size()) {
1453-
params.tensor_split[i] = std::stof(split_arg[i]);
1451+
params.tensor_split[i] = std::stof(split_arg[i]);
14541452
} else {
1455-
params.tensor_split[i] = 0.0f;
1453+
params.tensor_split[i] = 0.0f;
14561454
}
14571455
}
1458-
#ifndef GGML_USE_CUDA_SYCL_VULKAN
1459-
fprintf(stderr, "warning: llama.cpp was compiled without CUDA/SYCL/Vulkan. Setting a tensor split has no effect.\n");
1460-
#endif // GGML_USE_CUDA_SYCL_VULKAN
1456+
if (!llama_supports_gpu_offload()) {
1457+
fprintf(stderr, "warning: llama.cpp was compiled without support for GPU offload. Setting a tensor split has no effect.\n");
1458+
}
14611459
}
14621460
));
14631461
add_opt(llama_arg(
14641462
{"-mg", "--main-gpu"}, "INDEX",
14651463
format("the GPU to use for the model (with split-mode = none), or for intermediate results and KV (with split-mode = row) (default: %d)", params.main_gpu),
14661464
[](gpt_params & params, int value) {
14671465
params.main_gpu = value;
1468-
#ifndef GGML_USE_CUDA_SYCL_VULKAN
1469-
fprintf(stderr, "warning: llama.cpp was compiled without CUDA/SYCL/Vulkan. Setting the main GPU has no effect.\n");
1470-
#endif // GGML_USE_CUDA_SYCL_VULKAN
1466+
if (!llama_supports_gpu_offload()) {
1467+
fprintf(stderr, "warning: llama.cpp was compiled without support for GPU offload. Setting the main GPU has no effect.\n");
1468+
}
14711469
}
14721470
));
14731471
add_opt(llama_arg(

common/common.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@
5656
#pragma warning(disable: 4244 4267) // possible loss of data
5757
#endif
5858

59-
#if (defined(GGML_USE_CUDA) || defined(GGML_USE_SYCL))
60-
#define GGML_USE_CUDA_SYCL
61-
#endif
62-
63-
#if (defined(GGML_USE_CUDA) || defined(GGML_USE_SYCL)) || defined(GGML_USE_VULKAN)
64-
#define GGML_USE_CUDA_SYCL_VULKAN
65-
#endif
66-
6759
#if defined(LLAMA_USE_CURL)
6860
#ifdef __linux__
6961
#include <linux/limits.h>

0 commit comments

Comments
 (0)