Revert "Initial windows support (untested)"
This reverts commit a017390358
.
This commit is contained in:
parent
17b98ca9ff
commit
c94f7e98c1
1 changed files with 3 additions and 31 deletions
34
llama.cpp
34
llama.cpp
|
@ -12,15 +12,11 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
// mmap
|
// headers for POSIX mmap
|
||||||
#if defined (__unix__) || defined (__APPLE__)
|
#if defined (__unix__) || defined (__APPLE__)
|
||||||
# include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#elif defined(_WIN32)
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
# include <Windows.h>
|
|
||||||
//#include <Memoryapi.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LLAMA_USE_SCRATCH
|
#define LLAMA_USE_SCRATCH
|
||||||
|
@ -316,31 +312,8 @@ static void mmap_file(const char* fname, void * &mm_addr, size_t &mm_length) {
|
||||||
mm_addr = NULL;
|
mm_addr = NULL;
|
||||||
mm_length = 0;
|
mm_length = 0;
|
||||||
}
|
}
|
||||||
#elif defined(_WIN32)
|
|
||||||
mm_addr = NULL;
|
|
||||||
|
|
||||||
HANDLE hFile = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
||||||
if (hFile == INVALID_HANDLE_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// not really necessary
|
|
||||||
LARGE_INTEGER fileSize;
|
|
||||||
GetFileSizeEx(hFile, &fileSize);
|
|
||||||
mm_length = fileSize;
|
|
||||||
|
|
||||||
HANDLE hMapping = CreateFileMappingA(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
|
|
||||||
CloseHandle(hFile);
|
|
||||||
|
|
||||||
if (hMapping == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mm_addr = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0);
|
|
||||||
CloseHandle(hMapping);
|
|
||||||
#else
|
#else
|
||||||
mm_addr = NULL;
|
// TODO: windows support
|
||||||
mm_length = 0;
|
|
||||||
(void)(fname); // suppress warnings
|
(void)(fname); // suppress warnings
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -349,9 +322,8 @@ static void munmap_file(void * addr, size_t length) {
|
||||||
#if defined(MAP_FAILED)
|
#if defined(MAP_FAILED)
|
||||||
// POSIX
|
// POSIX
|
||||||
munmap(addr, length);
|
munmap(addr, length);
|
||||||
#elif defined(_WIN32)
|
|
||||||
UnmapViewOfFile(addr);
|
|
||||||
#else
|
#else
|
||||||
|
// TODO: windows support
|
||||||
(void)(addr); // suppress warnings
|
(void)(addr); // suppress warnings
|
||||||
(void)(length);
|
(void)(length);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue