SWDEV-252542 - Fixing Win Compilation on SWDEV-241902.
Change-Id: If76f79002b265dccf6da4acef1ff9372d8b0a2ff
[ROCm/clr commit: 7462e39954]
Этот коммит содержится в:
коммит произвёл
Vladislav Sytchenko
родитель
c667dc6fa0
Коммит
b3e8c5cdb0
@@ -871,7 +871,8 @@ class ClBinary : public amd::HeapObject {
|
||||
|
||||
/** called only in loading image routines, never storing routines */
|
||||
bool setBinary(const char* theBinary, size_t theBinarySize, bool allocated = false,
|
||||
amd::Os::FileDesc fd = -1, size_t foffset = 0, std::string uri = std::string());
|
||||
amd::Os::FileDesc fd = amd::Os::FDescInit(), size_t foffset = 0,
|
||||
std::string uri = std::string());
|
||||
|
||||
//! setin elfIn_
|
||||
bool setElfIn();
|
||||
@@ -1049,7 +1050,7 @@ inline std::string Program::BinaryURI() const {
|
||||
|
||||
inline Program::finfo_t Program::BinaryFd() const {
|
||||
if (clBinary() == NULL) {
|
||||
return {-1, 0};
|
||||
return {amd::Os::FDescInit(), 0};
|
||||
}
|
||||
return clBinary()->Datafd();
|
||||
}
|
||||
|
||||
@@ -195,7 +195,8 @@ class Program : public amd::HeapObject {
|
||||
const ClBinary* clBinary() const { return clBinary_; }
|
||||
|
||||
bool setBinary(const char* binaryIn, size_t size, const device::Program* same_dev_prog = nullptr,
|
||||
amd::Os::FileDesc fdesc = -1, size_t foffset = 0, std::string uri = std::string());
|
||||
amd::Os::FileDesc fdesc = amd::Os::FDescInit(), size_t foffset = 0,
|
||||
std::string uri = std::string());
|
||||
|
||||
type_t type() const { return type_; }
|
||||
|
||||
@@ -283,7 +284,8 @@ class Program : public amd::HeapObject {
|
||||
virtual bool createBinary(amd::option::Options* options) = 0;
|
||||
|
||||
//! Initialize Binary (used only for clCreateProgramWithBinary()).
|
||||
bool initClBinary(const char* binaryIn, size_t size, amd::Os::FileDesc fdesc = -1,
|
||||
bool initClBinary(const char* binaryIn, size_t size,
|
||||
amd::Os::FileDesc fdesc = amd::Os::FDescInit(),
|
||||
size_t foffset = 0, std::string uri = std::string());
|
||||
|
||||
//! Initialize Binary
|
||||
@@ -299,7 +301,7 @@ class Program : public amd::HeapObject {
|
||||
|
||||
virtual bool setKernels(
|
||||
amd::option::Options* options, void* binary, size_t binSize,
|
||||
amd::Os::FileDesc fdesc = -1, size_t foffset = 0,
|
||||
amd::Os::FileDesc fdesc = amd::Os::FDescInit(), size_t foffset = 0,
|
||||
std::string uri = std::string()) { return true; }
|
||||
|
||||
//! Returns all the options to be appended while passing to the compiler library
|
||||
|
||||
@@ -196,7 +196,7 @@ class HSAILProgram : public device::Program {
|
||||
virtual const aclTargetInfo& info(const char* str = "");
|
||||
|
||||
virtual bool setKernels(amd::option::Options* options, void* binary, size_t binSize,
|
||||
amd::Os::FileDesc fdesc = -1, size_t foffset = 0,
|
||||
amd::Os::FileDesc fdesc = amd::Os::FDescInit(), size_t foffset = 0,
|
||||
std::string uri = std::string()) override;
|
||||
|
||||
//! Destroys CPU allocations in the code segment
|
||||
@@ -251,7 +251,9 @@ class LightningProgram : public HSAILProgram {
|
||||
virtual ~LightningProgram() {}
|
||||
|
||||
protected:
|
||||
virtual bool setKernels(amd::option::Options* options, void* binary, size_t binSize) override;
|
||||
virtual bool setKernels(amd::option::Options* options, void* binary, size_t binSize,
|
||||
amd::Os::FileDesc fdesc = amd::Os::FDescInit(), size_t foffset = 0,
|
||||
std::string uri = std::string()) override;
|
||||
|
||||
virtual bool createBinary(amd::option::Options* options) override;
|
||||
};
|
||||
|
||||
@@ -92,7 +92,7 @@ class HSAILProgram : public roc::Program {
|
||||
bool createBinary(amd::option::Options* options) override { return true; }
|
||||
|
||||
virtual bool setKernels(amd::option::Options* options, void* binary, size_t binSize,
|
||||
amd::Os::FileDesc fdesc = -1, size_t foffset = 0,
|
||||
amd::Os::FileDesc fdesc = amd::Os::FDescInit(), size_t foffset = 0,
|
||||
std::string uri = std::string()) override;
|
||||
|
||||
private:
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
bool saveBinaryAndSetType(type_t type, void* rawBinary, size_t size);
|
||||
|
||||
bool setKernels(amd::option::Options* options, void* binary, size_t binSize,
|
||||
amd::Os::FileDesc fdesc = -1, size_t foffset = 0,
|
||||
amd::Os::FileDesc fdesc = amd::Os::FDescInit(), size_t foffset = 0,
|
||||
std::string uri = std::string()) final;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Basetsd.h> // For KAFFINITY
|
||||
#include <windows.h>
|
||||
#endif // _WIN32
|
||||
|
||||
// Smallest supported VM page size.
|
||||
@@ -99,6 +100,14 @@ class Os : AllStatic {
|
||||
#endif
|
||||
};
|
||||
|
||||
static FileDesc FDescInit() {
|
||||
#if defined(__linux__)
|
||||
return -1;
|
||||
#else
|
||||
return INVALID_HANDLE_VALUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns unique resource indicator for a particular memory
|
||||
static bool GetURIFromMemory(const void* image, size_t image_size, std::string& uri);
|
||||
|
||||
|
||||
@@ -824,7 +824,7 @@ void Os::getAppPathAndFileName(std::string& appName, std::string& appPathAndName
|
||||
|
||||
bool Os::GetURIFromMemory(const void* image, size_t image_size, std::string& uri_) {
|
||||
// Not implemented yet for windows
|
||||
uri = std::string();
|
||||
uri_ = std::string();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -836,7 +836,7 @@ bool Os::CloseFileHandle(FileDesc fdesc) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetFileHandle(const char* fname, FileDesc* fd_ptr, size_t* sz_ptr) {
|
||||
bool Os::GetFileHandle(const char* fname, FileDesc* fd_ptr, size_t* sz_ptr) {
|
||||
if ((fd_ptr == nullptr) || (sz_ptr == nullptr)) {
|
||||
return false;
|
||||
}
|
||||
@@ -852,17 +852,21 @@ bool GetFileHandle(const char* fname, FileDesc* fd_ptr, size_t* sz_ptr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MemoryMapFileDesc(FileDesc fdesc, size_t fsize, size_t foffset, const void** mmap_ptr) {
|
||||
if (fdesc < 0) {
|
||||
bool Os::MemoryMapFileDesc(FileDesc fdesc, size_t fsize, size_t foffset, const void** mmap_ptr) {
|
||||
if (fdesc == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*mmap_ptr = INVALID_HANDLE_VALUE;
|
||||
*mmap_ptr = CreateFileMappingA(fdesc, NULL, PAGE_READONLY, 0, 0, NULL);
|
||||
if (*mmap_ptr == INVALID_HANDLE_VALUE) {
|
||||
HANDLE map_handle = INVALID_HANDLE_VALUE;
|
||||
|
||||
map_handle = CreateFileMappingA(fdesc, NULL, PAGE_READONLY, 0, 0, NULL);
|
||||
if (map_handle == INVALID_HANDLE_VALUE) {
|
||||
CloseHandle(map_handle);
|
||||
return false;
|
||||
}
|
||||
|
||||
*mmap_ptr = MapViewOfFile(map_handle, FILE_MAP_READ, 0,0,0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,8 @@ class Program : public RuntimeObject {
|
||||
//! Add a new device program with or without binary image and options.
|
||||
int32_t addDeviceProgram(Device&, const void* image = NULL, size_t len = 0,
|
||||
bool make_copy = true, amd::option::Options* options = NULL,
|
||||
const amd::Program* same_prog = nullptr, amd::Os::FileDesc fdesc = -1,
|
||||
const amd::Program* same_prog = nullptr,
|
||||
amd::Os::FileDesc fdesc = amd::Os::FDescInit(),
|
||||
size_t foffset = 0, std::string uri = std::string());
|
||||
|
||||
//! Find the section for the given device. Return NULL if not found.
|
||||
|
||||
Ссылка в новой задаче
Block a user