Skip to content

Some portability improvements from trying to build with Visual Studio 2017 #12150

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
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
1 change: 1 addition & 0 deletions common/ngram-cache.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
#include <cstdio>
#include <fstream>
#include <thread>
#include <algorithm>

void common_ngram_cache_update(common_ngram_cache & ngram_cache, int ngram_min, int ngram_max,
std::vector<llama_token> & inp, int nnew, bool print_progress) {
1 change: 1 addition & 0 deletions common/sampling.cpp
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

#include <cmath>
#include <unordered_map>
#include <algorithm>

// the ring buffer works similarly to std::deque, but with a fixed capacity
// TODO: deduplicate with llama-impl.h
1 change: 1 addition & 0 deletions common/speculative.cpp
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
#include "sampling.h"

#include <cstring>
#include <algorithm>

#define SPEC_VOCAB_MAX_SIZE_DIFFERENCE 128
#define SPEC_VOCAB_CHECK_START_TOKEN_ID 5
1 change: 1 addition & 0 deletions examples/embedding/embedding.cpp
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
#include "llama.h"

#include <ctime>
#include <algorithm>

#if defined(_MSC_VER)
#pragma warning(disable: 4244 4267) // possible loss of data
1 change: 1 addition & 0 deletions examples/lookahead/lookahead.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>

struct ngram_data {
bool active = false;
1 change: 1 addition & 0 deletions examples/parallel/parallel.cpp
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
#include <string>
#include <vector>
#include <ctime>
#include <algorithm>

// trim whitespace from the beginning and end of a string
static std::string trim(const std::string & str) {
1 change: 1 addition & 0 deletions examples/passkey/passkey.cpp
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>

static void print_usage(int, char ** argv) {
LOG("\nexample usage:\n");
1 change: 1 addition & 0 deletions examples/quantize/quantize.cpp
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
#include <unordered_map>
#include <fstream>
#include <cmath>
#include <cctype>

struct quant_option {
std::string name;
4 changes: 2 additions & 2 deletions examples/tts/tts.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#define _USE_MATH_DEFINES // For M_PI on MSVC

#include "arg.h"
#include "common.h"
#include "sampling.h"
#include "log.h"
#include "llama.h"

#define _USE_MATH_DEFINES // For M_PI on MSVC

#include <algorithm>
#include <cmath>
#include <cstdio>
6 changes: 5 additions & 1 deletion ggml/include/ggml.h
Original file line number Diff line number Diff line change
@@ -2140,7 +2140,11 @@ extern "C" {
# define GGML_RESTRICT
# endif
#else
# define GGML_RESTRICT restrict
# if defined (_MSC_VER) && (__STDC_VERSION__ < 201112L)
# define GGML_RESTRICT __restrict
# else
# define GGML_RESTRICT restrict
# endif
#endif
typedef void (*ggml_to_float_t) (const void * GGML_RESTRICT x, float * GGML_RESTRICT y, int64_t k);
typedef void (*ggml_from_float_t)(const float * GGML_RESTRICT x, void * GGML_RESTRICT y, int64_t k);
1 change: 1 addition & 0 deletions ggml/src/ggml-backend-reg.cpp
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
#include <string>
#include <type_traits>
#include <vector>
#include <cctype>

#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
1 change: 1 addition & 0 deletions ggml/src/ggml-backend.cpp
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>

#ifdef __APPLE__
#include <sys/types.h>
Loading