SWDEV-377991 - Remove liquidflash support
Change-Id: Iba6455e5c0210c3223a06fec332404cd9f489154
This commit is contained in:
@@ -726,71 +726,6 @@ bool ThreadTraceMemObjectsCommand::validateMemory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TransferBufferFileCommand::releaseResources() {
|
||||
for (uint i = 0; i < NumStagingBuffers; ++i) {
|
||||
if (NULL != staging_[i]) {
|
||||
staging_[i]->release();
|
||||
}
|
||||
}
|
||||
|
||||
// Call the parent
|
||||
OneMemoryArgCommand::releaseResources();
|
||||
}
|
||||
|
||||
void TransferBufferFileCommand::submit(device::VirtualDevice& device) {
|
||||
device::Memory* mem = memory_->getDeviceMemory(queue()->device());
|
||||
if (memory_->getMemFlags() &
|
||||
(CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR | CL_MEM_USE_PERSISTENT_MEM_AMD)) {
|
||||
void* srcDstBuffer = nullptr;
|
||||
if (memory_->getMemFlags() & CL_MEM_USE_PERSISTENT_MEM_AMD) {
|
||||
// Lock protected multiple maps for persistent memory
|
||||
amd::ScopedLock lock(mem->owner()->lockMemoryOps());
|
||||
srcDstBuffer = mem->cpuMap(device);
|
||||
} else {
|
||||
srcDstBuffer = mem->cpuMap(device);
|
||||
}
|
||||
// Make HD transfer to the host accessible memory
|
||||
bool writeBuffer(type() == CL_COMMAND_READ_SSG_FILE_AMD);
|
||||
if (memory_->getMemFlags() & CL_MEM_USE_PERSISTENT_MEM_AMD) {
|
||||
// Lock protected multiple maps for persistent memory
|
||||
amd::ScopedLock lock(mem->owner()->lockMemoryOps());
|
||||
mem->cpuUnmap(device);
|
||||
} else {
|
||||
mem->cpuUnmap(device);
|
||||
}
|
||||
} else {
|
||||
device.submitTransferBufferFromFile(*this);
|
||||
}
|
||||
}
|
||||
|
||||
bool TransferBufferFileCommand::validateMemory() {
|
||||
// Check if the destination buffer has direct host access
|
||||
if (!(memory_->getMemFlags() &
|
||||
(CL_MEM_USE_HOST_PTR | CL_MEM_ALLOC_HOST_PTR | CL_MEM_USE_PERSISTENT_MEM_AMD))) {
|
||||
// Allocate staging buffers
|
||||
for (uint i = 0; i < NumStagingBuffers; ++i) {
|
||||
staging_[i] = new (memory_->getContext())
|
||||
Buffer(memory_->getContext(), StagingBufferMemType, StagingBufferSize);
|
||||
if (NULL == staging_[i] || !staging_[i]->create(nullptr)) {
|
||||
DevLogPrintfError("Staging Create failed, Staging[%d]: 0x%x", i, staging_[i]);
|
||||
return false;
|
||||
}
|
||||
device::Memory* mem = staging_[i]->getDeviceMemory(queue()->device());
|
||||
if (NULL == mem) {
|
||||
LogPrintfError("Can't allocate staging buffer - 0x%08X bytes!", staging_[i]->getSize());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
device::Memory* mem = memory_->getDeviceMemory(queue()->device());
|
||||
if (NULL == mem) {
|
||||
LogPrintfError("Can't allocate memory size - 0x%08X bytes!", memory_->getSize());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CopyMemoryP2PCommand::validateMemory() {
|
||||
amd::Device* queue_device = &queue()->device();
|
||||
|
||||
|
||||
@@ -1642,66 +1642,6 @@ class SvmUnmapMemoryCommand : public Command {
|
||||
void* svmPtr() const { return svmPtr_; }
|
||||
};
|
||||
|
||||
/*! \brief A generic transfer memory from/to file command.
|
||||
*
|
||||
* \details Currently supports buffers only. Buffers
|
||||
* are treated as 1D structures so origin_[0] and size_[0]
|
||||
* are equivalent to offset_ and count_ respectively.
|
||||
*/
|
||||
class TransferBufferFileCommand : public OneMemoryArgCommand {
|
||||
public:
|
||||
static constexpr uint NumStagingBuffers = 2;
|
||||
static constexpr size_t StagingBufferSize = 4 * Mi;
|
||||
static constexpr uint StagingBufferMemType = CL_MEM_USE_PERSISTENT_MEM_AMD;
|
||||
|
||||
protected:
|
||||
const Coord3D origin_; //!< Origin of the region to write to
|
||||
const Coord3D size_; //!< Size of the region to write to
|
||||
LiquidFlashFile* file_; //!< The file object for data read
|
||||
size_t fileOffset_; //!< Offset in the file for data read
|
||||
amd::Memory* staging_[NumStagingBuffers]; //!< Staging buffers for transfer
|
||||
|
||||
public:
|
||||
TransferBufferFileCommand(cl_command_type type, HostQueue& queue,
|
||||
const EventWaitList& eventWaitList, Memory& memory,
|
||||
const Coord3D& origin, const Coord3D& size, LiquidFlashFile* file,
|
||||
size_t fileOffset)
|
||||
: OneMemoryArgCommand(queue, type, eventWaitList, memory),
|
||||
origin_(origin),
|
||||
size_(size),
|
||||
file_(file),
|
||||
fileOffset_(fileOffset) {
|
||||
// Sanity checks
|
||||
assert(size.c[0] > 0 && "invalid");
|
||||
for (uint i = 0; i < NumStagingBuffers; ++i) {
|
||||
staging_[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void releaseResources();
|
||||
|
||||
virtual void submit(device::VirtualDevice& device);
|
||||
|
||||
//! Return the memory object to write to
|
||||
Memory& memory() const { return *memory_; }
|
||||
|
||||
//! Return the host memory to read from
|
||||
LiquidFlashFile* file() const { return file_; }
|
||||
|
||||
//! Returns file offset
|
||||
size_t fileOffset() const { return fileOffset_; }
|
||||
|
||||
//! Return the region origin
|
||||
const Coord3D& origin() const { return origin_; }
|
||||
//! Return the region size
|
||||
const Coord3D& size() const { return size_; }
|
||||
|
||||
//! Return the staging buffer for transfer
|
||||
Memory& staging(uint i) const { return *staging_[i]; }
|
||||
|
||||
bool validateMemory();
|
||||
};
|
||||
|
||||
/*! \brief A P2P copy memory command
|
||||
*
|
||||
* \details Used for buffers only. Backends are expected
|
||||
|
||||
@@ -34,14 +34,6 @@
|
||||
#include "CL/cl_dx9_media_sharing.h"
|
||||
#endif //_WIN32
|
||||
|
||||
#ifndef WITH_LIQUID_FLASH
|
||||
#if (!defined(BUILD_HSA_TARGET) && defined(WITH_HSA_DEVICE) && \
|
||||
defined(WITH_AMDGPU_PRO)) || defined(_WIN32)
|
||||
#define WITH_LIQUID_FLASH 1
|
||||
#include "lf.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace amd {
|
||||
|
||||
Context::Context(const std::vector<Device*>& devices, const Info& info)
|
||||
@@ -91,10 +83,6 @@ Context::~Context() {
|
||||
|
||||
delete[] properties_;
|
||||
delete glenv_;
|
||||
|
||||
#if WITH_LIQUID_FLASH
|
||||
lfTerminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
int Context::checkProperties(const cl_context_properties* properties, Context::Info* info) {
|
||||
@@ -315,10 +303,6 @@ int Context::create(const intptr_t* properties) {
|
||||
}
|
||||
}
|
||||
|
||||
#if WITH_LIQUID_FLASH
|
||||
lfInit();
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -663,42 +663,6 @@ class SvmBuffer : AllStatic {
|
||||
static Monitor AllocatedLock_;
|
||||
};
|
||||
|
||||
#ifndef CL_COMMAND_WRITE_SSG_FILE_AMD
|
||||
#define CL_COMMAND_WRITE_SSG_FILE_AMD 2
|
||||
#endif
|
||||
#ifndef CL_COMMAND_READ_SSG_FILE_AMD
|
||||
#define CL_COMMAND_READ_SSG_FILE_AMD 1
|
||||
#endif
|
||||
#ifndef cl_file_flags_amd
|
||||
typedef uint32_t cl_file_flags_amd;
|
||||
#endif
|
||||
//! Liquid flash extension
|
||||
class LiquidFlashFile : public RuntimeObject {
|
||||
private:
|
||||
std::wstring name_;
|
||||
cl_file_flags_amd flags_;
|
||||
void* handle_;
|
||||
uint32_t blockSize_;
|
||||
uint64_t fileSize_;
|
||||
|
||||
public:
|
||||
LiquidFlashFile(const wchar_t* name, cl_file_flags_amd flags)
|
||||
: name_(name), flags_(flags), handle_(NULL), blockSize_(0), fileSize_(0) {}
|
||||
|
||||
~LiquidFlashFile();
|
||||
|
||||
bool open();
|
||||
void close();
|
||||
|
||||
uint32_t blockSize() const { return blockSize_; };
|
||||
uint64_t fileSize() const { return fileSize_; };
|
||||
|
||||
bool transferBlock(bool read, void* dst, uint64_t bufferSize, uint64_t fileOffset,
|
||||
uint64_t bufferOffset, uint64_t size) const;
|
||||
|
||||
virtual ObjectType objectType() const { return ObjectTypeLiquidFlashFile; }
|
||||
};
|
||||
|
||||
class ArenaMemory: public Buffer {
|
||||
public:
|
||||
ArenaMemory(Context& context)
|
||||
|
||||
@@ -41,9 +41,7 @@
|
||||
#define AMD_CL_TYPES_DO(F) \
|
||||
F(cl_counter_amd, Counter) \
|
||||
F(cl_perfcounter_amd, PerfCounter) \
|
||||
F(cl_threadtrace_amd, ThreadTrace) \
|
||||
F(cl_file_amd, LiquidFlashFile)
|
||||
|
||||
F(cl_threadtrace_amd, ThreadTrace)
|
||||
|
||||
#define CL_TYPES_DO(F) \
|
||||
KHR_CL_TYPES_DO(F) \
|
||||
@@ -144,7 +142,6 @@ class RuntimeObject : public ReferenceCountedObject, public ICDDispatchedObject
|
||||
ObjectTypeQueue = 8,
|
||||
ObjectTypeSampler = 9,
|
||||
ObjectTypeThreadTrace = 10,
|
||||
ObjectTypeLiquidFlashFile = 11
|
||||
};
|
||||
|
||||
virtual ObjectType objectType() const = 0;
|
||||
|
||||
Reference in New Issue
Block a user