mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Pass root device index to Buffer::setArgStateful
Related-To: NEO-4672 Change-Id: Ic846eac488809bd7d9534bb7378d9398acd36451 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
28aa29bcbd
commit
c96fd30e4c
@@ -626,16 +626,21 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device,
|
||||
MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0, device);
|
||||
auto pBuffer = funcCreate(nullptr, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
||||
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
||||
|
||||
if (!gfxAllocation) {
|
||||
auto multiGraphicsAllocation = MultiGraphicsAllocation(device->getRootDeviceIndex());
|
||||
std::swap(pBuffer->multiGraphicsAllocation, multiGraphicsAllocation);
|
||||
}
|
||||
pBuffer->offset = offset;
|
||||
pBuffer->executionEnvironment = device->getExecutionEnvironment();
|
||||
pBuffer->rootDeviceEnvironment = pBuffer->executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()].get();
|
||||
return pBuffer;
|
||||
}
|
||||
|
||||
uint32_t Buffer::getMocsValue(bool disableL3Cache, bool isReadOnlyArgument) const {
|
||||
uint32_t Buffer::getMocsValue(bool disableL3Cache, bool isReadOnlyArgument, uint32_t rootDeviceIndex) const {
|
||||
uint64_t bufferAddress = 0;
|
||||
size_t bufferSize = 0;
|
||||
auto graphicsAllocation = multiGraphicsAllocation.getDefaultGraphicsAllocation();
|
||||
auto graphicsAllocation = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex);
|
||||
if (graphicsAllocation) {
|
||||
bufferAddress = graphicsAllocation->getGpuAddress();
|
||||
bufferSize = graphicsAllocation->getUnderlyingBufferSize();
|
||||
@@ -657,8 +662,8 @@ uint32_t Buffer::getMocsValue(bool disableL3Cache, bool isReadOnlyArgument) cons
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t Buffer::getSurfaceSize(bool alignSizeForAuxTranslation) const {
|
||||
auto bufferAddress = getBufferAddress();
|
||||
uint32_t Buffer::getSurfaceSize(bool alignSizeForAuxTranslation, uint32_t rootDeviceIndex) const {
|
||||
auto bufferAddress = getBufferAddress(rootDeviceIndex);
|
||||
auto bufferAddressAligned = alignDown(bufferAddress, 4);
|
||||
auto bufferOffset = ptrDiff(bufferAddress, bufferAddressAligned);
|
||||
|
||||
@@ -666,9 +671,9 @@ uint32_t Buffer::getSurfaceSize(bool alignSizeForAuxTranslation) const {
|
||||
return surfaceSize;
|
||||
}
|
||||
|
||||
uint64_t Buffer::getBufferAddress() const {
|
||||
auto graphicsAllocation = multiGraphicsAllocation.getDefaultGraphicsAllocation();
|
||||
uint64_t Buffer::getBufferAddress(uint32_t rootDeviceIndex) const {
|
||||
// The graphics allocation for Host Ptr surface will be created in makeResident call and GPU address is expected to be the same as CPU address
|
||||
auto graphicsAllocation = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex);
|
||||
auto bufferAddress = (graphicsAllocation != nullptr) ? graphicsAllocation->getGpuAddress() : castToUint64(getHostPtr());
|
||||
bufferAddress += this->offset;
|
||||
return bufferAddress;
|
||||
@@ -695,7 +700,7 @@ void Buffer::setSurfaceState(const Device *device,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel) {
|
||||
auto buffer = Buffer::createBufferHwFromDevice(device, flags, flagsIntel, svmSize, svmPtr, svmPtr, gfxAlloc, offset, true, false, false);
|
||||
buffer->setArgStateful(surfaceState, false, false, false, false);
|
||||
buffer->setArgStateful(surfaceState, false, false, false, false, device->getRootDeviceIndex());
|
||||
buffer->graphicsAllocation = nullptr;
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class Buffer : public MemObj {
|
||||
bool isSubBuffer();
|
||||
bool isValidSubBufferOffset(size_t offset);
|
||||
uint64_t setArgStateless(void *memory, uint32_t patchSize, uint32_t rootDeviceIndex, bool set32BitAddressing);
|
||||
virtual void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly) = 0;
|
||||
virtual void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnly, uint32_t rootDeviceIndex) = 0;
|
||||
bool bufferRectPitchSet(const size_t *bufferOrigin,
|
||||
const size_t *region,
|
||||
size_t &bufferRowPitch,
|
||||
@@ -151,9 +151,9 @@ class Buffer : public MemObj {
|
||||
bool isReadWriteOnCpuAllowed(uint32_t rootDeviceIndex);
|
||||
bool isReadWriteOnCpuPreferred(void *ptr, size_t size, const Device &device);
|
||||
|
||||
uint32_t getMocsValue(bool disableL3Cache, bool isReadOnlyArgument) const;
|
||||
uint32_t getSurfaceSize(bool alignSizeForAuxTranslation) const;
|
||||
uint64_t getBufferAddress() const;
|
||||
uint32_t getMocsValue(bool disableL3Cache, bool isReadOnlyArgument, uint32_t rootDeviceIndex) const;
|
||||
uint32_t getSurfaceSize(bool alignSizeForAuxTranslation, uint32_t rootDeviceIndex) const;
|
||||
uint64_t getBufferAddress(uint32_t rootDeviceIndex) const;
|
||||
|
||||
bool isCompressed(uint32_t rootDeviceIndex) const;
|
||||
|
||||
@@ -204,7 +204,7 @@ class BufferHw : public Buffer {
|
||||
: Buffer(context, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, gfxAllocation,
|
||||
zeroCopy, isHostPtrSVM, isObjectRedescribed) {}
|
||||
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnlyArgument) override;
|
||||
void setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnlyArgument, uint32_t rootDeviceIndex) override;
|
||||
void appendBufferState(void *memory, Context *context, GraphicsAllocation *gfxAllocation, bool isReadOnlyArgument);
|
||||
void appendSurfaceStateExt(void *memory);
|
||||
|
||||
|
||||
@@ -32,9 +32,11 @@ union SURFACE_STATE_BUFFER_LENGTH {
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
void BufferHw<GfxFamily>::setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnlyArgument) {
|
||||
EncodeSurfaceState<GfxFamily>::encodeBuffer(memory, getBufferAddress(), getSurfaceSize(alignSizeForAuxTranslation), getMocsValue(disableL3, isReadOnlyArgument), true);
|
||||
EncodeSurfaceState<GfxFamily>::encodeExtraBufferParams(multiGraphicsAllocation.getDefaultGraphicsAllocation(), rootDeviceEnvironment->getGmmHelper(), memory, forceNonAuxMode, isReadOnlyArgument);
|
||||
void BufferHw<GfxFamily>::setArgStateful(void *memory, bool forceNonAuxMode, bool disableL3, bool alignSizeForAuxTranslation, bool isReadOnlyArgument, uint32_t rootDeviceIndex) {
|
||||
auto graphicsAllocation = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex);
|
||||
EncodeSurfaceState<GfxFamily>::encodeBuffer(memory, getBufferAddress(rootDeviceIndex), getSurfaceSize(alignSizeForAuxTranslation, rootDeviceIndex), getMocsValue(disableL3, isReadOnlyArgument, rootDeviceIndex), true);
|
||||
EncodeSurfaceState<GfxFamily>::encodeExtraBufferParams(multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex),
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper(), memory, forceNonAuxMode, isReadOnlyArgument);
|
||||
|
||||
appendBufferState(memory, context, graphicsAllocation, isReadOnlyArgument);
|
||||
appendSurfaceStateExt(memory);
|
||||
|
||||
Reference in New Issue
Block a user