SWDEV-377991 - Remove liquidflash support
Change-Id: Iba6455e5c0210c3223a06fec332404cd9f489154
[ROCm/clr commit: 53a10c9039]
Tento commit je obsažen v:
@@ -100,7 +100,6 @@ endif()
|
||||
|
||||
target_compile_definitions(rocclr PUBLIC
|
||||
LITTLEENDIAN_CPU
|
||||
WITH_LIQUID_FLASH=0
|
||||
${AMD_OPENCL_DEFS})
|
||||
|
||||
target_include_directories(rocclr PUBLIC
|
||||
|
||||
@@ -89,7 +89,6 @@ class SvmFillMemoryCommand;
|
||||
class SvmMapMemoryCommand;
|
||||
class SvmUnmapMemoryCommand;
|
||||
class SvmPrefetchAsyncCommand;
|
||||
class TransferBufferFileCommand;
|
||||
class StreamOperationCommand;
|
||||
class VirtualMapCommand;
|
||||
class ExternalSemaphoreCmd;
|
||||
@@ -164,7 +163,6 @@ enum OclExtensions {
|
||||
ClKhrMipMapImage,
|
||||
ClKhrMipMapImageWrites,
|
||||
ClKhrIlProgram,
|
||||
ClAMDLiquidFlash,
|
||||
ClAmdCopyBufferP2P,
|
||||
ClAmdAssemblyProgram,
|
||||
#if defined(_WIN32)
|
||||
@@ -210,7 +208,6 @@ static constexpr const char* OclExtensionsString[] = {"cl_khr_fp64 ",
|
||||
"cl_khr_mipmap_image ",
|
||||
"cl_khr_mipmap_image_writes ",
|
||||
"",
|
||||
"cl_amd_liquid_flash ",
|
||||
"cl_amd_copy_buffer_p2p ",
|
||||
"cl_amd_assembly_program ",
|
||||
#if defined(_WIN32)
|
||||
@@ -1241,9 +1238,6 @@ class VirtualDevice : public amd::HeapObject {
|
||||
/// Optional extensions
|
||||
virtual void submitSignal(amd::SignalCommand& cmd) = 0;
|
||||
virtual void submitMakeBuffersResident(amd::MakeBuffersResidentCommand& cmd) = 0;
|
||||
virtual void submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd) {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
virtual void submitSvmPrefetchAsync(amd::SvmPrefetchAsyncCommand& cmd) {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
@@ -328,6 +328,7 @@ amd::ProfilingCallback* WaveLimiterManager::getProfilingCallback(
|
||||
// ================================================================================================
|
||||
void WaveLimiterManager::enable(bool isSupported) {
|
||||
if (fixed_ > 0) {
|
||||
enable_ = GPU_WAVE_LIMIT_ENABLE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -498,6 +498,7 @@ const LightningProgram& LightningKernel::prog() const {
|
||||
|
||||
#if defined(USE_COMGR_LIBRARY)
|
||||
bool LightningKernel::init() {
|
||||
waveLimiter_.enable();
|
||||
return GetAttrCodePropMetadata();
|
||||
}
|
||||
|
||||
|
||||
@@ -3741,49 +3741,7 @@ bool VirtualGPU::validateSdmaOverlap(const Resource& src, const Resource& dst) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void VirtualGPU::submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd) {
|
||||
size_t copySize = cmd.size()[0];
|
||||
size_t fileOffset = cmd.fileOffset();
|
||||
Memory* mem = dev().getGpuMemory(&cmd.memory());
|
||||
uint idx = 0;
|
||||
|
||||
assert((cmd.type() == CL_COMMAND_READ_SSG_FILE_AMD) ||
|
||||
(cmd.type() == CL_COMMAND_WRITE_SSG_FILE_AMD));
|
||||
const bool writeBuffer(cmd.type() == CL_COMMAND_READ_SSG_FILE_AMD);
|
||||
|
||||
if (writeBuffer) {
|
||||
size_t dstOffset = cmd.origin()[0];
|
||||
while (copySize > 0) {
|
||||
Memory* staging = dev().getGpuMemory(&cmd.staging(idx));
|
||||
size_t dstSize = amd::TransferBufferFileCommand::StagingBufferSize;
|
||||
dstSize = std::min(dstSize, copySize);
|
||||
void* dstBuffer = staging->cpuMap(*this);
|
||||
staging->cpuUnmap(*this);
|
||||
|
||||
blitMgr().copyBuffer(*staging, *mem, 0, dstOffset, dstSize, false);
|
||||
flushDMA(staging->getGpuEvent(*this)->engineId_);
|
||||
fileOffset += dstSize;
|
||||
dstOffset += dstSize;
|
||||
copySize -= dstSize;
|
||||
}
|
||||
} else {
|
||||
size_t srcOffset = cmd.origin()[0];
|
||||
while (copySize > 0) {
|
||||
Memory* staging = dev().getGpuMemory(&cmd.staging(idx));
|
||||
size_t srcSize = amd::TransferBufferFileCommand::StagingBufferSize;
|
||||
srcSize = std::min(srcSize, copySize);
|
||||
blitMgr().copyBuffer(*mem, *staging, srcOffset, 0, srcSize, false);
|
||||
|
||||
void* srcBuffer = staging->cpuMap(*this);
|
||||
staging->cpuUnmap(*this);
|
||||
|
||||
fileOffset += srcSize;
|
||||
srcOffset += srcSize;
|
||||
copySize -= srcSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
void* VirtualGPU::getOrCreateHostcallBuffer() {
|
||||
if (hostcallBuffer_ != nullptr) {
|
||||
return hostcallBuffer_;
|
||||
|
||||
@@ -345,7 +345,6 @@ class VirtualGPU : public device::VirtualDevice {
|
||||
virtual void submitSvmFillMemory(amd::SvmFillMemoryCommand& cmd);
|
||||
virtual void submitSvmMapMemory(amd::SvmMapMemoryCommand& cmd);
|
||||
virtual void submitSvmUnmapMemory(amd::SvmUnmapMemoryCommand& cmd);
|
||||
virtual void submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd);
|
||||
virtual void submitVirtualMap(amd::VirtualMapCommand& cmd);
|
||||
virtual void submitStreamOperation(amd::StreamOperationCommand& cmd);
|
||||
void submitExternalSemaphoreCmd(amd::ExternalSemaphoreCmd& cmd);
|
||||
|
||||
@@ -3353,55 +3353,10 @@ amd::Memory* VirtualGPU::findPinnedMem(void* addr, size_t size) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
void VirtualGPU::enableSyncBlit() const { blitMgr_->enableSynchronization(); }
|
||||
|
||||
void VirtualGPU::submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd) {
|
||||
// Make sure VirtualGPU has an exclusive access to the resources
|
||||
amd::ScopedLock lock(execution());
|
||||
|
||||
size_t copySize = cmd.size()[0];
|
||||
size_t fileOffset = cmd.fileOffset();
|
||||
Memory* mem = dev().getRocMemory(&cmd.memory());
|
||||
uint idx = 0;
|
||||
|
||||
assert((cmd.type() == CL_COMMAND_READ_SSG_FILE_AMD) ||
|
||||
(cmd.type() == CL_COMMAND_WRITE_SSG_FILE_AMD));
|
||||
const bool writeBuffer(cmd.type() == CL_COMMAND_READ_SSG_FILE_AMD);
|
||||
|
||||
if (writeBuffer) {
|
||||
size_t dstOffset = cmd.origin()[0];
|
||||
while (copySize > 0) {
|
||||
Memory* staging = dev().getRocMemory(&cmd.staging(idx));
|
||||
size_t dstSize = amd::TransferBufferFileCommand::StagingBufferSize;
|
||||
dstSize = std::min(dstSize, copySize);
|
||||
void* dstBuffer = staging->cpuMap(*this);
|
||||
|
||||
staging->cpuUnmap(*this);
|
||||
|
||||
bool result = blitMgr().copyBuffer(*staging, *mem, 0, dstOffset, dstSize, false);
|
||||
fileOffset += dstSize;
|
||||
dstOffset += dstSize;
|
||||
copySize -= dstSize;
|
||||
}
|
||||
} else {
|
||||
size_t srcOffset = cmd.origin()[0];
|
||||
while (copySize > 0) {
|
||||
Memory* staging = dev().getRocMemory(&cmd.staging(idx));
|
||||
size_t srcSize = amd::TransferBufferFileCommand::StagingBufferSize;
|
||||
srcSize = std::min(srcSize, copySize);
|
||||
bool result = blitMgr().copyBuffer(*mem, *staging, srcOffset, 0, srcSize, false);
|
||||
|
||||
void* srcBuffer = staging->cpuMap(*this);
|
||||
|
||||
staging->cpuUnmap(*this);
|
||||
|
||||
fileOffset += srcSize;
|
||||
srcOffset += srcSize;
|
||||
copySize -= srcSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
void VirtualGPU::submitPerfCounter(amd::PerfCounterCommand& vcmd) {
|
||||
// Make sure VirtualGPU has an exclusive access to the resources
|
||||
amd::ScopedLock lock(execution());
|
||||
|
||||
@@ -341,8 +341,6 @@ class VirtualGPU : public device::VirtualDevice {
|
||||
virtual void submitSignal(amd::SignalCommand& cmd) {}
|
||||
virtual void submitMakeBuffersResident(amd::MakeBuffersResidentCommand& cmd) {}
|
||||
|
||||
virtual void submitTransferBufferFromFile(amd::TransferBufferFileCommand& cmd);
|
||||
|
||||
void submitThreadTraceMemObjects(amd::ThreadTraceMemObjectsCommand& cmd) {}
|
||||
void submitThreadTrace(amd::ThreadTraceCommand& vcmd) {}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele