mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add experimental command buffer
This code is an infrastructure for special debug purpose that allow measure execution time of any hardware command. Change-Id: Id12a7979d204734a0c4a6c4700e427b65ac2397f
This commit is contained in:

committed by
sys_ocldev

parent
e34c47271b
commit
51421ec0b9
@ -36,6 +36,9 @@ set(RUNTIME_SRCS_COMMAND_STREAM
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/create_command_stream_impl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/csr_definitions.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linear_stream.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linear_stream.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.cpp
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/command_stream/experimental_command_buffer.h"
|
||||
#include "runtime/command_stream/preemption.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/gtpin/gtpin_notify.h"
|
||||
@ -203,6 +204,7 @@ void CommandStreamReceiver::cleanupResources() {
|
||||
commandStream.replaceGraphicsAllocation(nullptr);
|
||||
commandStream.replaceBuffer(nullptr, 0);
|
||||
}
|
||||
experimentalCmdBuffer.reset(nullptr);
|
||||
}
|
||||
|
||||
bool CommandStreamReceiver::waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) {
|
||||
@ -338,4 +340,8 @@ void CommandStreamReceiver::releaseIndirectHeap(IndirectHeap::Type heapType) {
|
||||
}
|
||||
}
|
||||
|
||||
void CommandStreamReceiver::setExperimentalCmdBuffer(std::unique_ptr<ExperimentalCommandBuffer> &&cmdBuffer) {
|
||||
experimentalCmdBuffer = std::move(cmdBuffer);
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
||||
|
@ -37,11 +37,12 @@
|
||||
namespace OCLRT {
|
||||
class Device;
|
||||
class EventBuilder;
|
||||
class LinearStream;
|
||||
class ExperimentalCommandBuffer;
|
||||
class GraphicsAllocation;
|
||||
class IndirectHeap;
|
||||
class LinearStream;
|
||||
class MemoryManager;
|
||||
class OSInterface;
|
||||
class GraphicsAllocation;
|
||||
|
||||
enum class DispatchMode {
|
||||
DeviceDefault = 0, //default for given device
|
||||
@ -139,6 +140,7 @@ class CommandStreamReceiver {
|
||||
void releaseIndirectHeap(IndirectHeap::Type heapType);
|
||||
|
||||
virtual enum CommandStreamReceiverType getType() = 0;
|
||||
void setExperimentalCmdBuffer(std::unique_ptr<ExperimentalCommandBuffer> &&cmdBuffer);
|
||||
|
||||
protected:
|
||||
void setDisableL3Cache(bool val) {
|
||||
@ -190,6 +192,7 @@ class CommandStreamReceiver {
|
||||
SamplerCacheFlushState samplerCacheFlushRequired = SamplerCacheFlushState::samplerCacheFlushNotRequired;
|
||||
IndirectHeap *indirectHeap[IndirectHeap::NUM_TYPES];
|
||||
std::unique_ptr<FlatBatchBufferHelper> flatBatchBufferHelper;
|
||||
std::unique_ptr<ExperimentalCommandBuffer> experimentalCmdBuffer;
|
||||
};
|
||||
|
||||
typedef CommandStreamReceiver *(*CommandStreamReceiverCreateFunc)(const HardwareInfo &hwInfoIn, bool withAubDump);
|
||||
|
@ -55,7 +55,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
int getRequiredPipeControlSize() const;
|
||||
|
||||
static void addBatchBufferEnd(LinearStream &commandStream, void **patchLocation);
|
||||
void addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress);
|
||||
void addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress, bool secondary);
|
||||
static void alignToCacheLine(LinearStream &commandStream);
|
||||
|
||||
size_t getRequiredCmdStreamSize(const DispatchFlags &dispatchFlags);
|
||||
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/experimental_command_buffer.h"
|
||||
#include "runtime/command_stream/linear_stream.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/gtpin/gtpin_notify.h"
|
||||
@ -62,10 +63,13 @@ inline void CommandStreamReceiverHw<GfxFamily>::addBatchBufferEnd(LinearStream &
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress) {
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress, bool secondary) {
|
||||
*commandBufferMemory = GfxFamily::cmdInitBatchBufferStart;
|
||||
commandBufferMemory->setBatchBufferStartAddressGraphicsaddress472(startAddress);
|
||||
commandBufferMemory->setAddressSpaceIndicator(MI_BATCH_BUFFER_START::ADDRESS_SPACE_INDICATOR_PPGTT);
|
||||
if (secondary) {
|
||||
commandBufferMemory->setSecondLevelBatchBuffer(MI_BATCH_BUFFER_START::SECOND_LEVEL_BATCH_BUFFER_SECOND_LEVEL_BATCH);
|
||||
}
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBufferHelper->registerBatchBufferStartAddress(reinterpret_cast<uint64_t>(commandBufferMemory), startAddress);
|
||||
}
|
||||
@ -328,6 +332,12 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (experimentalCmdBuffer.get() != nullptr) {
|
||||
size_t startingOffset = experimentalCmdBuffer->programExperimentalCommandBuffer<GfxFamily>();
|
||||
experimentalCmdBuffer->injectBufferStart<GfxFamily>(commandStreamCSR, startingOffset);
|
||||
}
|
||||
|
||||
// Add a PC if we have a dependency on a previous walker to avoid concurrency issues.
|
||||
if (taskLevel > this->taskLevel) {
|
||||
addPipeControl(commandStreamCSR, false);
|
||||
@ -358,6 +368,10 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
makeResident(*BuiltIns::getInstance().getSipKernel(sipType, *device).getSipAllocation());
|
||||
}
|
||||
|
||||
if (experimentalCmdBuffer.get() != nullptr) {
|
||||
experimentalCmdBuffer->makeResidentAllocations();
|
||||
}
|
||||
|
||||
// If the CSR has work in its CS, flush it before the task
|
||||
bool submitTask = commandStreamStartTask != commandStreamTask.getUsed();
|
||||
bool submitCSR = commandStreamStartCSR != commandStreamCSR.getUsed();
|
||||
@ -377,7 +391,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
chainedBatchBuffer = commandStreamTask.getGraphicsAllocation();
|
||||
// Add MI_BATCH_BUFFER_START to chain from CSR -> Task
|
||||
auto pBBS = reinterpret_cast<MI_BATCH_BUFFER_START *>(commandStreamCSR.getSpace(sizeof(MI_BATCH_BUFFER_START)));
|
||||
addBatchBufferStart(pBBS, ptrOffset(commandStreamTask.getGraphicsAllocation()->getGpuAddress(), commandStreamStartTask));
|
||||
addBatchBufferStart(pBBS, ptrOffset(commandStreamTask.getGraphicsAllocation()->getGpuAddress(), commandStreamStartTask), false);
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBufferHelper->registerCommandChunk(commandStreamTask.getGraphicsAllocation()->getGpuAddress(),
|
||||
reinterpret_cast<uint64_t>(commandStreamTask.getCpuBase()),
|
||||
@ -510,7 +524,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
flushStampUpdateHelper.insert(nextCommandBuffer->flushStamp->getStampReference());
|
||||
auto nextCommandBufferAddress = nextCommandBuffer->batchBuffer.commandBufferAllocation->getUnderlyingBuffer();
|
||||
auto offsetedCommandBuffer = (uint64_t)ptrOffset(nextCommandBufferAddress, nextCommandBuffer->batchBuffer.startOffset);
|
||||
addBatchBufferStart((MI_BATCH_BUFFER_START *)currentBBendLocation, offsetedCommandBuffer);
|
||||
addBatchBufferStart((MI_BATCH_BUFFER_START *)currentBBendLocation, offsetedCommandBuffer, false);
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
|
||||
flatBatchBufferHelper->registerCommandChunk(nextCommandBuffer->batchBuffer, sizeof(MI_BATCH_BUFFER_START));
|
||||
}
|
||||
@ -610,6 +624,9 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const Dispat
|
||||
size += sizeof(typename GfxFamily::PIPE_CONTROL);
|
||||
}
|
||||
}
|
||||
if (experimentalCmdBuffer.get() != nullptr) {
|
||||
size += experimentalCmdBuffer->getRequiredInjectionSize<GfxFamily>();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
|
100
runtime/command_stream/experimental_command_buffer.cpp
Normal file
100
runtime/command_stream/experimental_command_buffer.cpp
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/command_stream/experimental_command_buffer.h"
|
||||
#include "runtime/command_stream/linear_stream.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/memory_manager/memory_constants.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
#include <cstring>
|
||||
#include <type_traits>
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
ExperimentalCommandBuffer::ExperimentalCommandBuffer(CommandStreamReceiver *csr) : commandStreamReceiver(csr),
|
||||
currentStream(nullptr),
|
||||
timestampsOffset(0),
|
||||
experimentalAllocationOffset(0),
|
||||
defaultPrint(true) {
|
||||
timestamps = csr->getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
memset(timestamps->getUnderlyingBuffer(), 0, timestamps->getUnderlyingBufferSize());
|
||||
experimentalAllocation = csr->getMemoryManager()->allocateGraphicsMemory(MemoryConstants::pageSize);
|
||||
memset(experimentalAllocation->getUnderlyingBuffer(), 0, experimentalAllocation->getUnderlyingBufferSize());
|
||||
timerResolution = commandStreamReceiver->getMemoryManager()->device->getDeviceInfo().profilingTimerResolution;
|
||||
}
|
||||
|
||||
ExperimentalCommandBuffer::~ExperimentalCommandBuffer() {
|
||||
auto timestamp = static_cast<uint64_t *>(timestamps->getUnderlyingBuffer());
|
||||
for (uint32_t i = 0; i < timestampsOffset / (2 * sizeof(uint64_t)); i++) {
|
||||
auto stop = static_cast<uint64_t>(*(timestamp + 1) * timerResolution);
|
||||
auto start = static_cast<uint64_t>(*timestamp * timerResolution);
|
||||
auto delta = stop - start;
|
||||
printDebugString(defaultPrint, stdout, "#%u: delta %llu start %llu stop %llu\n", i, delta, start, stop);
|
||||
timestamp += 2;
|
||||
}
|
||||
MemoryManager *memManager = commandStreamReceiver->getMemoryManager();
|
||||
if (memManager) {
|
||||
memManager->freeGraphicsMemory(timestamps);
|
||||
memManager->freeGraphicsMemory(experimentalAllocation);
|
||||
|
||||
if (currentStream.get()) {
|
||||
memManager->storeAllocation(std::unique_ptr<GraphicsAllocation>(currentStream->getGraphicsAllocation()), REUSABLE_ALLOCATION);
|
||||
currentStream->replaceGraphicsAllocation(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExperimentalCommandBuffer::getCS(size_t minRequiredSize) {
|
||||
if (!currentStream) {
|
||||
currentStream.reset(new LinearStream(nullptr));
|
||||
}
|
||||
minRequiredSize += CSRequirements::minCommandQueueCommandStreamSize;
|
||||
if (currentStream->getAvailableSpace() < minRequiredSize) {
|
||||
MemoryManager *memManager = commandStreamReceiver->getMemoryManager();
|
||||
// If not, allocate a new block. allocate full pages
|
||||
minRequiredSize = alignUp(minRequiredSize, MemoryConstants::pageSize);
|
||||
|
||||
auto requiredSize = minRequiredSize + CSRequirements::csOverfetchSize;
|
||||
|
||||
GraphicsAllocation *allocation = memManager->obtainReusableAllocation(requiredSize, false).release();
|
||||
if (!allocation) {
|
||||
allocation = memManager->allocateGraphicsMemory(requiredSize);
|
||||
}
|
||||
allocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM);
|
||||
// Deallocate the old block, if not null
|
||||
auto oldAllocation = currentStream->getGraphicsAllocation();
|
||||
if (oldAllocation) {
|
||||
memManager->storeAllocation(std::unique_ptr<GraphicsAllocation>(oldAllocation), REUSABLE_ALLOCATION);
|
||||
}
|
||||
currentStream->replaceBuffer(allocation->getUnderlyingBuffer(), minRequiredSize - CSRequirements::minCommandQueueCommandStreamSize);
|
||||
currentStream->replaceGraphicsAllocation(allocation);
|
||||
}
|
||||
}
|
||||
|
||||
void ExperimentalCommandBuffer::makeResidentAllocations() {
|
||||
commandStreamReceiver->makeResident(*currentStream->getGraphicsAllocation());
|
||||
commandStreamReceiver->makeResident(*timestamps);
|
||||
commandStreamReceiver->makeResident(*experimentalAllocation);
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
81
runtime/command_stream/experimental_command_buffer.h
Normal file
81
runtime/command_stream/experimental_command_buffer.h
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
class CommandStreamReceiver;
|
||||
class GraphicsAllocation;
|
||||
class LinearStream;
|
||||
class MemoryManager;
|
||||
|
||||
class ExperimentalCommandBuffer {
|
||||
public:
|
||||
virtual ~ExperimentalCommandBuffer();
|
||||
ExperimentalCommandBuffer(CommandStreamReceiver *csr);
|
||||
|
||||
template <typename GfxFamily>
|
||||
void injectBufferStart(LinearStream &parentStream, size_t cmdBufferOffset);
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t getRequiredInjectionSize() noexcept;
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t programExperimentalCommandBuffer();
|
||||
|
||||
void makeResidentAllocations();
|
||||
|
||||
protected:
|
||||
template <typename GfxFamily>
|
||||
size_t getTotalExperimentalSize() noexcept;
|
||||
|
||||
void getCS(size_t minRequiredSize);
|
||||
|
||||
template <typename GfxFamily>
|
||||
void addTimeStampPipeControl();
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t getTimeStampPipeControlSize() noexcept;
|
||||
|
||||
template <typename GfxFamily>
|
||||
void addExperimentalCommands();
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t getExperimentalCommandsSize() noexcept;
|
||||
|
||||
CommandStreamReceiver *commandStreamReceiver;
|
||||
std::unique_ptr<LinearStream> currentStream;
|
||||
|
||||
GraphicsAllocation *timestamps;
|
||||
uint32_t timestampsOffset;
|
||||
|
||||
GraphicsAllocation *experimentalAllocation;
|
||||
uint32_t experimentalAllocationOffset;
|
||||
|
||||
bool defaultPrint;
|
||||
double timerResolution;
|
||||
};
|
||||
|
||||
} // namespace OCLRT
|
127
runtime/command_stream/experimental_command_buffer.inl
Normal file
127
runtime/command_stream/experimental_command_buffer.inl
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/command_stream_receiver_hw.h"
|
||||
#include "runtime/command_stream/experimental_command_buffer.h"
|
||||
#include "runtime/command_stream/linear_stream.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template <typename GfxFamily>
|
||||
void ExperimentalCommandBuffer::injectBufferStart(LinearStream &parentStream, size_t cmdBufferOffset) {
|
||||
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
|
||||
auto pCmd = static_cast<MI_BATCH_BUFFER_START *>(parentStream.getSpace(sizeof(MI_BATCH_BUFFER_START)));
|
||||
auto commandStreamReceiverHw = reinterpret_cast<CommandStreamReceiverHw<GfxFamily> *>(commandStreamReceiver);
|
||||
commandStreamReceiverHw->addBatchBufferStart(pCmd, currentStream->getGraphicsAllocation()->getGpuAddress() + cmdBufferOffset, true);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t ExperimentalCommandBuffer::getRequiredInjectionSize() noexcept {
|
||||
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
|
||||
return sizeof(MI_BATCH_BUFFER_START);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t ExperimentalCommandBuffer::programExperimentalCommandBuffer() {
|
||||
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
|
||||
|
||||
getCS(getTotalExperimentalSize<GfxFamily>());
|
||||
|
||||
size_t returnOffset = currentStream->getUsed();
|
||||
|
||||
//begin timestamp
|
||||
addTimeStampPipeControl<GfxFamily>();
|
||||
|
||||
addExperimentalCommands<GfxFamily>();
|
||||
|
||||
//end timestamp
|
||||
addTimeStampPipeControl<GfxFamily>();
|
||||
|
||||
//end
|
||||
auto pCmd = static_cast<MI_BATCH_BUFFER_END *>(currentStream->getSpace(sizeof(MI_BATCH_BUFFER_END)));
|
||||
*pCmd = GfxFamily::cmdInitBatchBufferEnd;
|
||||
|
||||
return returnOffset;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t ExperimentalCommandBuffer::getTotalExperimentalSize() noexcept {
|
||||
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
|
||||
|
||||
size_t size = sizeof(MI_BATCH_BUFFER_END) + getTimeStampPipeControlSize<GfxFamily>() + getExperimentalCommandsSize<GfxFamily>();
|
||||
return size;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t ExperimentalCommandBuffer::getTimeStampPipeControlSize() noexcept {
|
||||
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
||||
|
||||
//two P_C for timestamps, two prior them for WA - Enable CS Stall
|
||||
return 4 * sizeof(PIPE_CONTROL);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void ExperimentalCommandBuffer::addTimeStampPipeControl() {
|
||||
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
||||
|
||||
auto pCmd = static_cast<PIPE_CONTROL *>(currentStream->getSpace(sizeof(PIPE_CONTROL)));
|
||||
*pCmd = GfxFamily::cmdInitPipeControl;
|
||||
pCmd->setCommandStreamerStallEnable(true);
|
||||
|
||||
uint64_t timeStampAddress = timestamps->getGpuAddress() + timestampsOffset;
|
||||
|
||||
pCmd = static_cast<PIPE_CONTROL *>(currentStream->getSpace(sizeof(PIPE_CONTROL)));
|
||||
*pCmd = GfxFamily::cmdInitPipeControl;
|
||||
pCmd->setCommandStreamerStallEnable(true);
|
||||
pCmd->setPostSyncOperation(PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP);
|
||||
pCmd->setAddress(static_cast<uint32_t>(timeStampAddress & 0x0000FFFFFFFFULL));
|
||||
pCmd->setAddressHigh(static_cast<uint32_t>(timeStampAddress >> 32));
|
||||
|
||||
//moving to next chunk
|
||||
timestampsOffset += sizeof(uint64_t);
|
||||
|
||||
DEBUG_BREAK_IF(timestamps->getUnderlyingBufferSize() < timestampsOffset);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void ExperimentalCommandBuffer::addExperimentalCommands() {
|
||||
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
|
||||
|
||||
uintptr_t semaphoreAddr = reinterpret_cast<uintptr_t>(experimentalAllocation->getUnderlyingBuffer()) + experimentalAllocationOffset;
|
||||
uint32_t *semaphoreData = reinterpret_cast<uint32_t *>(semaphoreAddr);
|
||||
*semaphoreData = 1;
|
||||
uint64_t gpuAddr = experimentalAllocation->getGpuAddress() + experimentalAllocationOffset;
|
||||
|
||||
auto semaphoreCmd = reinterpret_cast<MI_SEMAPHORE_WAIT *>(currentStream->getSpace(sizeof(MI_SEMAPHORE_WAIT)));
|
||||
*semaphoreCmd = MI_SEMAPHORE_WAIT::sInit();
|
||||
semaphoreCmd->setCompareOperation(MI_SEMAPHORE_WAIT::COMPARE_OPERATION_SAD_EQUAL_SDD);
|
||||
semaphoreCmd->setSemaphoreDataDword(*semaphoreData);
|
||||
semaphoreCmd->setSemaphoreGraphicsAddress(gpuAddr);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t ExperimentalCommandBuffer::getExperimentalCommandsSize() noexcept {
|
||||
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
|
||||
return sizeof(MI_SEMAPHORE_WAIT);
|
||||
}
|
||||
|
||||
} // namespace OCLRT
|
@ -25,6 +25,7 @@
|
||||
#include "runtime/built_ins/sip.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/command_stream/device_command_stream.h"
|
||||
#include "runtime/command_stream/experimental_command_buffer.h"
|
||||
#include "runtime/command_stream/preemption.h"
|
||||
#include "runtime/compiler_interface/compiler_interface.h"
|
||||
#include "runtime/device/device.h"
|
||||
@ -199,6 +200,11 @@ bool Device::createDeviceImpl(const HardwareInfo *pHwInfo, Device &outDevice) {
|
||||
initSipKernel(sipType, *pDevice);
|
||||
}
|
||||
|
||||
if (DebugManager.flags.EnableExperimentalCommandBuffer.get() > 0) {
|
||||
commandStreamReceiver->setExperimentalCmdBuffer(
|
||||
std::unique_ptr<ExperimentalCommandBuffer>(new ExperimentalCommandBuffer(commandStreamReceiver)));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -43,14 +43,15 @@ set(RUNTIME_SRCS_GENX_H_BASE
|
||||
set(RUNTIME_SRCS_GENX_CPP_BASE
|
||||
aub_command_stream_receiver
|
||||
aub_mem_dump
|
||||
buffer
|
||||
command_queue
|
||||
device_queue
|
||||
command_stream_receiver_hw
|
||||
device_queue
|
||||
experimental_command_buffer
|
||||
flat_batch_buffer_helper_hw
|
||||
gpgpu_walker
|
||||
hw_helper
|
||||
hw_info
|
||||
buffer
|
||||
image
|
||||
kernel_commands
|
||||
preamble
|
||||
|
41
runtime/gen10/experimental_command_buffer_gen10.cpp
Normal file
41
runtime/gen10/experimental_command_buffer_gen10.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/experimental_command_buffer.h"
|
||||
#include "runtime/command_stream/experimental_command_buffer.inl"
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
|
||||
namespace OCLRT {
|
||||
typedef CNLFamily GfxFamily;
|
||||
|
||||
template void ExperimentalCommandBuffer::injectBufferStart<GfxFamily>(LinearStream &parentStream, size_t cmdBufferOffset);
|
||||
template size_t ExperimentalCommandBuffer::getRequiredInjectionSize<GfxFamily>() noexcept;
|
||||
|
||||
template size_t ExperimentalCommandBuffer::programExperimentalCommandBuffer<GfxFamily>();
|
||||
template size_t ExperimentalCommandBuffer::getTotalExperimentalSize<GfxFamily>() noexcept;
|
||||
|
||||
template void ExperimentalCommandBuffer::addTimeStampPipeControl<GfxFamily>();
|
||||
template size_t ExperimentalCommandBuffer::getTimeStampPipeControlSize<GfxFamily>() noexcept;
|
||||
|
||||
template void ExperimentalCommandBuffer::addExperimentalCommands<GfxFamily>();
|
||||
template size_t ExperimentalCommandBuffer::getExperimentalCommandsSize<GfxFamily>() noexcept;
|
||||
} // namespace OCLRT
|
@ -1586,125 +1586,6 @@ typedef struct tagMI_NOOP {
|
||||
}
|
||||
} MI_NOOP;
|
||||
STATIC_ASSERT(4 == sizeof(MI_NOOP));
|
||||
typedef struct tagMI_SEMAPHORE_WAIT {
|
||||
union tagTheStructure {
|
||||
struct tagCommon {
|
||||
uint32_t DwordLength : BITFIELD_RANGE(0, 7);
|
||||
uint32_t Reserved_8 : BITFIELD_RANGE(8, 11);
|
||||
uint32_t CompareOperation : BITFIELD_RANGE(12, 14);
|
||||
uint32_t WaitMode : BITFIELD_RANGE(15, 15);
|
||||
uint32_t RegisterPollMode : BITFIELD_RANGE(16, 16);
|
||||
uint32_t Reserved_17 : BITFIELD_RANGE(17, 21);
|
||||
uint32_t MemoryType : BITFIELD_RANGE(22, 22);
|
||||
uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28);
|
||||
uint32_t CommandType : BITFIELD_RANGE(29, 31);
|
||||
uint32_t SemaphoreDataDword;
|
||||
uint64_t Reserved_64 : BITFIELD_RANGE(0, 1);
|
||||
uint64_t SemaphoreAddress_Graphicsaddress47_2 : BITFIELD_RANGE(2, 47);
|
||||
uint64_t SemaphoreAddress_Reserved : BITFIELD_RANGE(48, 63);
|
||||
} Common;
|
||||
uint32_t RawData[4];
|
||||
} TheStructure;
|
||||
typedef enum tagDWORD_LENGTH {
|
||||
DWORD_LENGTH_EXCLUDES_DWORD_0_1 = 0x2,
|
||||
} DWORD_LENGTH;
|
||||
typedef enum tagCOMPARE_OPERATION {
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_SDD = 0x0,
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD = 0x1,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_SDD = 0x2,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_OR_EQUAL_SDD = 0x3,
|
||||
COMPARE_OPERATION_SAD_EQUAL_SDD = 0x4,
|
||||
COMPARE_OPERATION_SAD_NOT_EQUAL_SDD = 0x5,
|
||||
} COMPARE_OPERATION;
|
||||
typedef enum tagWAIT_MODE {
|
||||
WAIT_MODE_SIGNAL_MODE = 0x0,
|
||||
WAIT_MODE_POLLING_MODE = 0x1,
|
||||
} WAIT_MODE;
|
||||
typedef enum tagREGISTER_POLL_MODE {
|
||||
REGISTER_POLL_MODE_MEMORY_POLL = 0x0,
|
||||
REGISTER_POLL_MODE_REGISTER_POLL = 0x1,
|
||||
} REGISTER_POLL_MODE;
|
||||
typedef enum tagMEMORY_TYPE {
|
||||
MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS = 0x0,
|
||||
MEMORY_TYPE_GLOBAL_GRAPHICS_ADDRESS = 0x1,
|
||||
} MEMORY_TYPE;
|
||||
typedef enum tagMI_COMMAND_OPCODE {
|
||||
MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT = 0x1c,
|
||||
} MI_COMMAND_OPCODE;
|
||||
typedef enum tagCOMMAND_TYPE {
|
||||
COMMAND_TYPE_MI_COMMAND = 0x0,
|
||||
} COMMAND_TYPE;
|
||||
inline void init(void) {
|
||||
memset(&TheStructure, 0, sizeof(TheStructure));
|
||||
TheStructure.Common.DwordLength = DWORD_LENGTH_EXCLUDES_DWORD_0_1;
|
||||
TheStructure.Common.CompareOperation = COMPARE_OPERATION_SAD_GREATER_THAN_SDD;
|
||||
TheStructure.Common.WaitMode = WAIT_MODE_SIGNAL_MODE;
|
||||
TheStructure.Common.RegisterPollMode = REGISTER_POLL_MODE_REGISTER_POLL;
|
||||
TheStructure.Common.MemoryType = MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS;
|
||||
TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT;
|
||||
TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND;
|
||||
}
|
||||
static tagMI_SEMAPHORE_WAIT sInit(void) {
|
||||
MI_SEMAPHORE_WAIT state;
|
||||
state.init();
|
||||
return state;
|
||||
}
|
||||
inline uint32_t &getRawData(const uint32_t index) {
|
||||
DEBUG_BREAK_IF(index >= 4);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline void setCompareOperation(const COMPARE_OPERATION value) {
|
||||
TheStructure.Common.CompareOperation = value;
|
||||
}
|
||||
inline COMPARE_OPERATION getCompareOperation(void) const {
|
||||
return static_cast<COMPARE_OPERATION>(TheStructure.Common.CompareOperation);
|
||||
}
|
||||
inline void setWaitMode(const WAIT_MODE value) {
|
||||
TheStructure.Common.WaitMode = value;
|
||||
}
|
||||
inline WAIT_MODE getWaitMode(void) const {
|
||||
return static_cast<WAIT_MODE>(TheStructure.Common.WaitMode);
|
||||
}
|
||||
inline void setRegisterPollMode(const REGISTER_POLL_MODE value) {
|
||||
TheStructure.Common.RegisterPollMode = value;
|
||||
}
|
||||
inline REGISTER_POLL_MODE getRegisterPollMode(void) const {
|
||||
return static_cast<REGISTER_POLL_MODE>(TheStructure.Common.RegisterPollMode);
|
||||
}
|
||||
inline void setMemoryType(const MEMORY_TYPE value) {
|
||||
TheStructure.Common.MemoryType = value;
|
||||
}
|
||||
inline MEMORY_TYPE getMemoryType(void) const {
|
||||
return static_cast<MEMORY_TYPE>(TheStructure.Common.MemoryType);
|
||||
}
|
||||
inline void setSemaphoreDataDword(const uint32_t value) {
|
||||
TheStructure.Common.SemaphoreDataDword = value;
|
||||
}
|
||||
inline uint32_t getSemaphoreDataDword(void) const {
|
||||
return (TheStructure.Common.SemaphoreDataDword);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_GRAPHICSADDRESS47_2 {
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_GRAPHICSADDRESS47_2;
|
||||
inline void setSemaphoreAddressGraphicsaddress472(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Graphicsaddress47_2 = value >> SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreAddressGraphicsaddress472(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Graphicsaddress47_2 << SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_RESERVED {
|
||||
SEMAPHOREADDRESS_RESERVED_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_RESERVED_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_RESERVED;
|
||||
inline void setSemaphoreAddressReserved(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Reserved = value >> SEMAPHOREADDRESS_RESERVED_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreAddressReserved(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Reserved << SEMAPHOREADDRESS_RESERVED_BIT_SHIFT);
|
||||
}
|
||||
} MI_SEMAPHORE_WAIT;
|
||||
STATIC_ASSERT(16 == sizeof(MI_SEMAPHORE_WAIT));
|
||||
typedef struct tagMI_STORE_DATA_IMM {
|
||||
union tagTheStructure {
|
||||
struct tagCommon {
|
||||
|
@ -396,4 +396,123 @@ typedef struct tagMI_MATH_ALU_INST_INLINE {
|
||||
uint32_t Value;
|
||||
} DW0;
|
||||
} MI_MATH_ALU_INST_INLINE;
|
||||
typedef struct tagMI_SEMAPHORE_WAIT {
|
||||
union tagTheStructure {
|
||||
struct tagCommon {
|
||||
uint32_t DwordLength : BITFIELD_RANGE(0, 7);
|
||||
uint32_t Reserved_8 : BITFIELD_RANGE(8, 11);
|
||||
uint32_t CompareOperation : BITFIELD_RANGE(12, 14);
|
||||
uint32_t WaitMode : BITFIELD_RANGE(15, 15);
|
||||
uint32_t RegisterPollMode : BITFIELD_RANGE(16, 16);
|
||||
uint32_t Reserved_17 : BITFIELD_RANGE(17, 21);
|
||||
uint32_t MemoryType : BITFIELD_RANGE(22, 22);
|
||||
uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28);
|
||||
uint32_t CommandType : BITFIELD_RANGE(29, 31);
|
||||
uint32_t SemaphoreDataDword;
|
||||
uint64_t Reserved_64 : BITFIELD_RANGE(0, 1);
|
||||
uint64_t SemaphoreAddress_Graphicsaddress : BITFIELD_RANGE(2, 47);
|
||||
uint64_t SemaphoreAddress_Reserved : BITFIELD_RANGE(48, 63);
|
||||
} Common;
|
||||
uint32_t RawData[4];
|
||||
} TheStructure;
|
||||
typedef enum tagDWORD_LENGTH {
|
||||
DWORD_LENGTH_EXCLUDES_DWORD_0_1 = 0x2,
|
||||
} DWORD_LENGTH;
|
||||
typedef enum tagCOMPARE_OPERATION {
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_SDD = 0x0,
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD = 0x1,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_SDD = 0x2,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_OR_EQUAL_SDD = 0x3,
|
||||
COMPARE_OPERATION_SAD_EQUAL_SDD = 0x4,
|
||||
COMPARE_OPERATION_SAD_NOT_EQUAL_SDD = 0x5,
|
||||
} COMPARE_OPERATION;
|
||||
typedef enum tagWAIT_MODE {
|
||||
WAIT_MODE_SIGNAL_MODE = 0x0,
|
||||
WAIT_MODE_POLLING_MODE = 0x1,
|
||||
} WAIT_MODE;
|
||||
typedef enum tagREGISTER_POLL_MODE {
|
||||
REGISTER_POLL_MODE_MEMORY_POLL = 0x0,
|
||||
REGISTER_POLL_MODE_REGISTER_POLL = 0x1,
|
||||
} REGISTER_POLL_MODE;
|
||||
typedef enum tagMEMORY_TYPE {
|
||||
MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS = 0x0,
|
||||
MEMORY_TYPE_GLOBAL_GRAPHICS_ADDRESS = 0x1,
|
||||
} MEMORY_TYPE;
|
||||
typedef enum tagMI_COMMAND_OPCODE {
|
||||
MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT = 0x1c,
|
||||
} MI_COMMAND_OPCODE;
|
||||
typedef enum tagCOMMAND_TYPE {
|
||||
COMMAND_TYPE_MI_COMMAND = 0x0,
|
||||
} COMMAND_TYPE;
|
||||
inline void init(void) {
|
||||
memset(&TheStructure, 0, sizeof(TheStructure));
|
||||
TheStructure.Common.DwordLength = DWORD_LENGTH_EXCLUDES_DWORD_0_1;
|
||||
TheStructure.Common.CompareOperation = COMPARE_OPERATION_SAD_GREATER_THAN_SDD;
|
||||
TheStructure.Common.WaitMode = WAIT_MODE_SIGNAL_MODE;
|
||||
TheStructure.Common.RegisterPollMode = REGISTER_POLL_MODE_REGISTER_POLL;
|
||||
TheStructure.Common.MemoryType = MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS;
|
||||
TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT;
|
||||
TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND;
|
||||
}
|
||||
static tagMI_SEMAPHORE_WAIT sInit(void) {
|
||||
MI_SEMAPHORE_WAIT state;
|
||||
state.init();
|
||||
return state;
|
||||
}
|
||||
inline uint32_t &getRawData(const uint32_t index) {
|
||||
DEBUG_BREAK_IF(index >= 4);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline void setCompareOperation(const COMPARE_OPERATION value) {
|
||||
TheStructure.Common.CompareOperation = value;
|
||||
}
|
||||
inline COMPARE_OPERATION getCompareOperation(void) const {
|
||||
return static_cast<COMPARE_OPERATION>(TheStructure.Common.CompareOperation);
|
||||
}
|
||||
inline void setWaitMode(const WAIT_MODE value) {
|
||||
TheStructure.Common.WaitMode = value;
|
||||
}
|
||||
inline WAIT_MODE getWaitMode(void) const {
|
||||
return static_cast<WAIT_MODE>(TheStructure.Common.WaitMode);
|
||||
}
|
||||
inline void setRegisterPollMode(const REGISTER_POLL_MODE value) {
|
||||
TheStructure.Common.RegisterPollMode = value;
|
||||
}
|
||||
inline REGISTER_POLL_MODE getRegisterPollMode(void) const {
|
||||
return static_cast<REGISTER_POLL_MODE>(TheStructure.Common.RegisterPollMode);
|
||||
}
|
||||
inline void setMemoryType(const MEMORY_TYPE value) {
|
||||
TheStructure.Common.MemoryType = value;
|
||||
}
|
||||
inline MEMORY_TYPE getMemoryType(void) const {
|
||||
return static_cast<MEMORY_TYPE>(TheStructure.Common.MemoryType);
|
||||
}
|
||||
inline void setSemaphoreDataDword(const uint32_t value) {
|
||||
TheStructure.Common.SemaphoreDataDword = value;
|
||||
}
|
||||
inline uint32_t getSemaphoreDataDword(void) const {
|
||||
return (TheStructure.Common.SemaphoreDataDword);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_GRAPHICSADDRESS {
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_GRAPHICSADDRESS;
|
||||
inline void setSemaphoreGraphicsAddress(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Graphicsaddress = value >> SEMAPHOREADDRESS_GRAPHICSADDRESS_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreGraphicsAddress(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Graphicsaddress << SEMAPHOREADDRESS_GRAPHICSADDRESS_BIT_SHIFT);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_RESERVED {
|
||||
SEMAPHOREADDRESS_RESERVED_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_RESERVED_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_RESERVED;
|
||||
inline void setSemaphoreAddressReserved(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Reserved = value >> SEMAPHOREADDRESS_RESERVED_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreAddressReserved(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Reserved << SEMAPHOREADDRESS_RESERVED_BIT_SHIFT);
|
||||
}
|
||||
} MI_SEMAPHORE_WAIT;
|
||||
STATIC_ASSERT(16 == sizeof(MI_SEMAPHORE_WAIT));
|
||||
#pragma pack()
|
||||
|
41
runtime/gen8/experimental_command_buffer_gen8.cpp
Normal file
41
runtime/gen8/experimental_command_buffer_gen8.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/experimental_command_buffer.h"
|
||||
#include "runtime/command_stream/experimental_command_buffer.inl"
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
|
||||
namespace OCLRT {
|
||||
typedef BDWFamily GfxFamily;
|
||||
|
||||
template void ExperimentalCommandBuffer::injectBufferStart<GfxFamily>(LinearStream &parentStream, size_t cmdBufferOffset);
|
||||
template size_t ExperimentalCommandBuffer::getRequiredInjectionSize<GfxFamily>() noexcept;
|
||||
|
||||
template size_t ExperimentalCommandBuffer::programExperimentalCommandBuffer<GfxFamily>();
|
||||
template size_t ExperimentalCommandBuffer::getTotalExperimentalSize<GfxFamily>() noexcept;
|
||||
|
||||
template void ExperimentalCommandBuffer::addTimeStampPipeControl<GfxFamily>();
|
||||
template size_t ExperimentalCommandBuffer::getTimeStampPipeControlSize<GfxFamily>() noexcept;
|
||||
|
||||
template void ExperimentalCommandBuffer::addExperimentalCommands<GfxFamily>();
|
||||
template size_t ExperimentalCommandBuffer::getExperimentalCommandsSize<GfxFamily>() noexcept;
|
||||
} // namespace OCLRT
|
@ -1250,7 +1250,7 @@ typedef struct tagMI_BATCH_BUFFER_START {
|
||||
inline void setSecondLevelBatchBuffer(const SECOND_LEVEL_BATCH_BUFFER value) {
|
||||
TheStructure.Common._2NdLevelBatchBuffer = (_2ND_LEVEL_BATCH_BUFFER)value;
|
||||
}
|
||||
inline SECOND_LEVEL_BATCH_BUFFER setSecondLevelBatchBuffer(void) const {
|
||||
inline SECOND_LEVEL_BATCH_BUFFER getSecondLevelBatchBuffer(void) const {
|
||||
return static_cast<SECOND_LEVEL_BATCH_BUFFER>(TheStructure.Common._2NdLevelBatchBuffer);
|
||||
}
|
||||
typedef enum tagBATCHBUFFERSTARTADDRESS_GRAPHICSADDRESS47_2 {
|
||||
@ -1523,113 +1523,6 @@ typedef struct tagMI_NOOP {
|
||||
}
|
||||
} MI_NOOP;
|
||||
STATIC_ASSERT(4 == sizeof(MI_NOOP));
|
||||
typedef struct tagMI_SEMAPHORE_WAIT {
|
||||
union tagTheStructure {
|
||||
struct tagCommon {
|
||||
uint32_t DwordLength : BITFIELD_RANGE(0, 7);
|
||||
uint32_t Reserved_8 : BITFIELD_RANGE(8, 11);
|
||||
uint32_t CompareOperation : BITFIELD_RANGE(12, 14);
|
||||
uint32_t WaitMode : BITFIELD_RANGE(15, 15);
|
||||
uint32_t Reserved_16 : BITFIELD_RANGE(16, 21);
|
||||
uint32_t MemoryType : BITFIELD_RANGE(22, 22);
|
||||
uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28);
|
||||
uint32_t CommandType : BITFIELD_RANGE(29, 31);
|
||||
uint32_t SemaphoreDataDword;
|
||||
uint64_t Reserved_64 : BITFIELD_RANGE(0, 1);
|
||||
uint64_t SemaphoreAddress_Graphicsaddress47_2 : BITFIELD_RANGE(2, 47);
|
||||
uint64_t SemaphoreAddress_Reserved : BITFIELD_RANGE(48, 63);
|
||||
} Common;
|
||||
uint32_t RawData[4];
|
||||
} TheStructure;
|
||||
typedef enum tagDWORD_LENGTH {
|
||||
DWORD_LENGTH_EXCLUDES_DWORD_0_1 = 0x2,
|
||||
} DWORD_LENGTH;
|
||||
typedef enum tagCOMPARE_OPERATION {
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_SDD = 0x0,
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD = 0x1,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_SDD = 0x2,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_OR_EQUAL_SDD = 0x3,
|
||||
COMPARE_OPERATION_SAD_EQUAL_SDD = 0x4,
|
||||
COMPARE_OPERATION_SAD_NOT_EQUAL_SDD = 0x5,
|
||||
} COMPARE_OPERATION;
|
||||
typedef enum tagWAIT_MODE {
|
||||
WAIT_MODE_SIGNAL_MODE = 0x0,
|
||||
WAIT_MODE_POLLING_MODE = 0x1,
|
||||
} WAIT_MODE;
|
||||
typedef enum tagMEMORY_TYPE {
|
||||
MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS = 0x0,
|
||||
MEMORY_TYPE_GLOBAL_GRAPHICS_ADDRESS = 0x1,
|
||||
} MEMORY_TYPE;
|
||||
typedef enum tagMI_COMMAND_OPCODE {
|
||||
MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT = 0x1c,
|
||||
} MI_COMMAND_OPCODE;
|
||||
typedef enum tagCOMMAND_TYPE {
|
||||
COMMAND_TYPE_MI_COMMAND = 0x0,
|
||||
} COMMAND_TYPE;
|
||||
inline void init(void) {
|
||||
memset(&TheStructure, 0, sizeof(TheStructure));
|
||||
TheStructure.Common.DwordLength = DWORD_LENGTH_EXCLUDES_DWORD_0_1;
|
||||
TheStructure.Common.CompareOperation = COMPARE_OPERATION_SAD_GREATER_THAN_SDD;
|
||||
TheStructure.Common.WaitMode = WAIT_MODE_SIGNAL_MODE;
|
||||
TheStructure.Common.MemoryType = MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS;
|
||||
TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT;
|
||||
TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND;
|
||||
}
|
||||
static tagMI_SEMAPHORE_WAIT sInit(void) {
|
||||
MI_SEMAPHORE_WAIT state;
|
||||
state.init();
|
||||
return state;
|
||||
}
|
||||
inline uint32_t &getRawData(const uint32_t index) {
|
||||
DEBUG_BREAK_IF(index >= 4);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline void setCompareOperation(const COMPARE_OPERATION value) {
|
||||
TheStructure.Common.CompareOperation = value;
|
||||
}
|
||||
inline COMPARE_OPERATION getCompareOperation(void) const {
|
||||
return static_cast<COMPARE_OPERATION>(TheStructure.Common.CompareOperation);
|
||||
}
|
||||
inline void setWaitMode(const WAIT_MODE value) {
|
||||
TheStructure.Common.WaitMode = value;
|
||||
}
|
||||
inline WAIT_MODE getWaitMode(void) const {
|
||||
return static_cast<WAIT_MODE>(TheStructure.Common.WaitMode);
|
||||
}
|
||||
inline void setMemoryType(const MEMORY_TYPE value) {
|
||||
TheStructure.Common.MemoryType = value;
|
||||
}
|
||||
inline MEMORY_TYPE getMemoryType(void) const {
|
||||
return static_cast<MEMORY_TYPE>(TheStructure.Common.MemoryType);
|
||||
}
|
||||
inline void setSemaphoreDataDword(const uint32_t value) {
|
||||
TheStructure.Common.SemaphoreDataDword = value;
|
||||
}
|
||||
inline uint32_t getSemaphoreDataDword(void) const {
|
||||
return (TheStructure.Common.SemaphoreDataDword);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_GRAPHICSADDRESS47_2 {
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_GRAPHICSADDRESS47_2;
|
||||
inline void setSemaphoreAddressGraphicsaddress472(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Graphicsaddress47_2 = value >> SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreAddressGraphicsaddress472(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Graphicsaddress47_2 << SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_RESERVED {
|
||||
SEMAPHOREADDRESS_RESERVED_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_RESERVED_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_RESERVED;
|
||||
inline void setSemaphoreAddressReserved(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Reserved = value >> SEMAPHOREADDRESS_RESERVED_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreAddressReserved(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Reserved << SEMAPHOREADDRESS_RESERVED_BIT_SHIFT);
|
||||
}
|
||||
} MI_SEMAPHORE_WAIT;
|
||||
STATIC_ASSERT(16 == sizeof(MI_SEMAPHORE_WAIT));
|
||||
typedef struct tagMI_STORE_DATA_IMM {
|
||||
union tagTheStructure {
|
||||
struct tagCommon {
|
||||
|
@ -291,4 +291,111 @@ typedef struct tagMI_MATH_ALU_INST_INLINE {
|
||||
uint32_t Value;
|
||||
} DW0;
|
||||
} MI_MATH_ALU_INST_INLINE;
|
||||
typedef struct tagMI_SEMAPHORE_WAIT {
|
||||
union tagTheStructure {
|
||||
struct tagCommon {
|
||||
uint32_t DwordLength : BITFIELD_RANGE(0, 7);
|
||||
uint32_t Reserved_8 : BITFIELD_RANGE(8, 11);
|
||||
uint32_t CompareOperation : BITFIELD_RANGE(12, 14);
|
||||
uint32_t WaitMode : BITFIELD_RANGE(15, 15);
|
||||
uint32_t Reserved_16 : BITFIELD_RANGE(16, 21);
|
||||
uint32_t MemoryType : BITFIELD_RANGE(22, 22);
|
||||
uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28);
|
||||
uint32_t CommandType : BITFIELD_RANGE(29, 31);
|
||||
uint32_t SemaphoreDataDword;
|
||||
uint64_t Reserved_64 : BITFIELD_RANGE(0, 1);
|
||||
uint64_t SemaphoreAddress_Graphicsaddress : BITFIELD_RANGE(2, 47);
|
||||
uint64_t SemaphoreAddress_Reserved : BITFIELD_RANGE(48, 63);
|
||||
} Common;
|
||||
uint32_t RawData[4];
|
||||
} TheStructure;
|
||||
typedef enum tagDWORD_LENGTH {
|
||||
DWORD_LENGTH_EXCLUDES_DWORD_0_1 = 0x2,
|
||||
} DWORD_LENGTH;
|
||||
typedef enum tagCOMPARE_OPERATION {
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_SDD = 0x0,
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD = 0x1,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_SDD = 0x2,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_OR_EQUAL_SDD = 0x3,
|
||||
COMPARE_OPERATION_SAD_EQUAL_SDD = 0x4,
|
||||
COMPARE_OPERATION_SAD_NOT_EQUAL_SDD = 0x5,
|
||||
} COMPARE_OPERATION;
|
||||
typedef enum tagWAIT_MODE {
|
||||
WAIT_MODE_SIGNAL_MODE = 0x0,
|
||||
WAIT_MODE_POLLING_MODE = 0x1,
|
||||
} WAIT_MODE;
|
||||
typedef enum tagMEMORY_TYPE {
|
||||
MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS = 0x0,
|
||||
MEMORY_TYPE_GLOBAL_GRAPHICS_ADDRESS = 0x1,
|
||||
} MEMORY_TYPE;
|
||||
typedef enum tagMI_COMMAND_OPCODE {
|
||||
MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT = 0x1c,
|
||||
} MI_COMMAND_OPCODE;
|
||||
typedef enum tagCOMMAND_TYPE {
|
||||
COMMAND_TYPE_MI_COMMAND = 0x0,
|
||||
} COMMAND_TYPE;
|
||||
inline void init(void) {
|
||||
memset(&TheStructure, 0, sizeof(TheStructure));
|
||||
TheStructure.Common.DwordLength = DWORD_LENGTH_EXCLUDES_DWORD_0_1;
|
||||
TheStructure.Common.CompareOperation = COMPARE_OPERATION_SAD_GREATER_THAN_SDD;
|
||||
TheStructure.Common.WaitMode = WAIT_MODE_SIGNAL_MODE;
|
||||
TheStructure.Common.MemoryType = MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS;
|
||||
TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT;
|
||||
TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND;
|
||||
}
|
||||
static tagMI_SEMAPHORE_WAIT sInit(void) {
|
||||
MI_SEMAPHORE_WAIT state;
|
||||
state.init();
|
||||
return state;
|
||||
}
|
||||
inline uint32_t &getRawData(const uint32_t index) {
|
||||
DEBUG_BREAK_IF(index >= 4);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline void setCompareOperation(const COMPARE_OPERATION value) {
|
||||
TheStructure.Common.CompareOperation = value;
|
||||
}
|
||||
inline COMPARE_OPERATION getCompareOperation(void) const {
|
||||
return static_cast<COMPARE_OPERATION>(TheStructure.Common.CompareOperation);
|
||||
}
|
||||
inline void setWaitMode(const WAIT_MODE value) {
|
||||
TheStructure.Common.WaitMode = value;
|
||||
}
|
||||
inline WAIT_MODE getWaitMode(void) const {
|
||||
return static_cast<WAIT_MODE>(TheStructure.Common.WaitMode);
|
||||
}
|
||||
inline void setMemoryType(const MEMORY_TYPE value) {
|
||||
TheStructure.Common.MemoryType = value;
|
||||
}
|
||||
inline MEMORY_TYPE getMemoryType(void) const {
|
||||
return static_cast<MEMORY_TYPE>(TheStructure.Common.MemoryType);
|
||||
}
|
||||
inline void setSemaphoreDataDword(const uint32_t value) {
|
||||
TheStructure.Common.SemaphoreDataDword = value;
|
||||
}
|
||||
inline uint32_t getSemaphoreDataDword(void) const {
|
||||
return (TheStructure.Common.SemaphoreDataDword);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_GRAPHICSADDRESS {
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_GRAPHICSADDRESS;
|
||||
inline void setSemaphoreGraphicsAddress(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Graphicsaddress = value >> SEMAPHOREADDRESS_GRAPHICSADDRESS_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreGraphicsAddress(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Graphicsaddress << SEMAPHOREADDRESS_GRAPHICSADDRESS_BIT_SHIFT);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_RESERVED {
|
||||
SEMAPHOREADDRESS_RESERVED_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_RESERVED_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_RESERVED;
|
||||
inline void setSemaphoreAddressReserved(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Reserved = value >> SEMAPHOREADDRESS_RESERVED_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreAddressReserved(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Reserved << SEMAPHOREADDRESS_RESERVED_BIT_SHIFT);
|
||||
}
|
||||
} MI_SEMAPHORE_WAIT;
|
||||
STATIC_ASSERT(16 == sizeof(MI_SEMAPHORE_WAIT));
|
||||
#pragma pack()
|
||||
|
41
runtime/gen9/experimental_command_buffer_gen9.cpp
Normal file
41
runtime/gen9/experimental_command_buffer_gen9.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/experimental_command_buffer.h"
|
||||
#include "runtime/command_stream/experimental_command_buffer.inl"
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
|
||||
namespace OCLRT {
|
||||
typedef SKLFamily GfxFamily;
|
||||
|
||||
template void ExperimentalCommandBuffer::injectBufferStart<GfxFamily>(LinearStream &parentStream, size_t cmdBufferOffset);
|
||||
template size_t ExperimentalCommandBuffer::getRequiredInjectionSize<GfxFamily>() noexcept;
|
||||
|
||||
template size_t ExperimentalCommandBuffer::programExperimentalCommandBuffer<GfxFamily>();
|
||||
template size_t ExperimentalCommandBuffer::getTotalExperimentalSize<GfxFamily>() noexcept;
|
||||
|
||||
template void ExperimentalCommandBuffer::addTimeStampPipeControl<GfxFamily>();
|
||||
template size_t ExperimentalCommandBuffer::getTimeStampPipeControlSize<GfxFamily>() noexcept;
|
||||
|
||||
template void ExperimentalCommandBuffer::addExperimentalCommands<GfxFamily>();
|
||||
template size_t ExperimentalCommandBuffer::getExperimentalCommandsSize<GfxFamily>() noexcept;
|
||||
} // namespace OCLRT
|
@ -1527,113 +1527,6 @@ typedef struct tagMI_NOOP {
|
||||
}
|
||||
} MI_NOOP;
|
||||
STATIC_ASSERT(4 == sizeof(MI_NOOP));
|
||||
typedef struct tagMI_SEMAPHORE_WAIT {
|
||||
union tagTheStructure {
|
||||
struct tagCommon {
|
||||
uint32_t DwordLength : BITFIELD_RANGE(0, 7);
|
||||
uint32_t Reserved_8 : BITFIELD_RANGE(8, 11);
|
||||
uint32_t CompareOperation : BITFIELD_RANGE(12, 14);
|
||||
uint32_t WaitMode : BITFIELD_RANGE(15, 15);
|
||||
uint32_t Reserved_16 : BITFIELD_RANGE(16, 21);
|
||||
uint32_t MemoryType : BITFIELD_RANGE(22, 22);
|
||||
uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28);
|
||||
uint32_t CommandType : BITFIELD_RANGE(29, 31);
|
||||
uint32_t SemaphoreDataDword;
|
||||
uint64_t Reserved_64 : BITFIELD_RANGE(0, 1);
|
||||
uint64_t SemaphoreAddress_Graphicsaddress47_2 : BITFIELD_RANGE(2, 47);
|
||||
uint64_t SemaphoreAddress_Reserved : BITFIELD_RANGE(48, 63);
|
||||
} Common;
|
||||
uint32_t RawData[4];
|
||||
} TheStructure;
|
||||
typedef enum tagDWORD_LENGTH {
|
||||
DWORD_LENGTH_EXCLUDES_DWORD_0_1 = 0x2,
|
||||
} DWORD_LENGTH;
|
||||
typedef enum tagCOMPARE_OPERATION {
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_SDD = 0x0,
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD = 0x1,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_SDD = 0x2,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_OR_EQUAL_SDD = 0x3,
|
||||
COMPARE_OPERATION_SAD_EQUAL_SDD = 0x4,
|
||||
COMPARE_OPERATION_SAD_NOT_EQUAL_SDD = 0x5,
|
||||
} COMPARE_OPERATION;
|
||||
typedef enum tagWAIT_MODE {
|
||||
WAIT_MODE_SIGNAL_MODE = 0x0,
|
||||
WAIT_MODE_POLLING_MODE = 0x1,
|
||||
} WAIT_MODE;
|
||||
typedef enum tagMEMORY_TYPE {
|
||||
MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS = 0x0,
|
||||
MEMORY_TYPE_GLOBAL_GRAPHICS_ADDRESS = 0x1,
|
||||
} MEMORY_TYPE;
|
||||
typedef enum tagMI_COMMAND_OPCODE {
|
||||
MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT = 0x1c,
|
||||
} MI_COMMAND_OPCODE;
|
||||
typedef enum tagCOMMAND_TYPE {
|
||||
COMMAND_TYPE_MI_COMMAND = 0x0,
|
||||
} COMMAND_TYPE;
|
||||
inline void init(void) {
|
||||
memset(&TheStructure, 0, sizeof(TheStructure));
|
||||
TheStructure.Common.DwordLength = DWORD_LENGTH_EXCLUDES_DWORD_0_1;
|
||||
TheStructure.Common.CompareOperation = COMPARE_OPERATION_SAD_GREATER_THAN_SDD;
|
||||
TheStructure.Common.WaitMode = WAIT_MODE_SIGNAL_MODE;
|
||||
TheStructure.Common.MemoryType = MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS;
|
||||
TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT;
|
||||
TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND;
|
||||
}
|
||||
static tagMI_SEMAPHORE_WAIT sInit(void) {
|
||||
MI_SEMAPHORE_WAIT state;
|
||||
state.init();
|
||||
return state;
|
||||
}
|
||||
inline uint32_t &getRawData(const uint32_t index) {
|
||||
DEBUG_BREAK_IF(index >= 4);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline void setCompareOperation(const COMPARE_OPERATION value) {
|
||||
TheStructure.Common.CompareOperation = value;
|
||||
}
|
||||
inline COMPARE_OPERATION getCompareOperation(void) const {
|
||||
return static_cast<COMPARE_OPERATION>(TheStructure.Common.CompareOperation);
|
||||
}
|
||||
inline void setWaitMode(const WAIT_MODE value) {
|
||||
TheStructure.Common.WaitMode = value;
|
||||
}
|
||||
inline WAIT_MODE getWaitMode(void) const {
|
||||
return static_cast<WAIT_MODE>(TheStructure.Common.WaitMode);
|
||||
}
|
||||
inline void setMemoryType(const MEMORY_TYPE value) {
|
||||
TheStructure.Common.MemoryType = value;
|
||||
}
|
||||
inline MEMORY_TYPE getMemoryType(void) const {
|
||||
return static_cast<MEMORY_TYPE>(TheStructure.Common.MemoryType);
|
||||
}
|
||||
inline void setSemaphoreDataDword(const uint32_t value) {
|
||||
TheStructure.Common.SemaphoreDataDword = value;
|
||||
}
|
||||
inline uint32_t getSemaphoreDataDword(void) const {
|
||||
return (TheStructure.Common.SemaphoreDataDword);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_GRAPHICSADDRESS47_2 {
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_GRAPHICSADDRESS47_2;
|
||||
inline void setSemaphoreAddressGraphicsaddress472(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Graphicsaddress47_2 = value >> SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreAddressGraphicsaddress472(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Graphicsaddress47_2 << SEMAPHOREADDRESS_GRAPHICSADDRESS47_2_BIT_SHIFT);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_RESERVED {
|
||||
SEMAPHOREADDRESS_RESERVED_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_RESERVED_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_RESERVED;
|
||||
inline void setSemaphoreAddressReserved(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Reserved = value >> SEMAPHOREADDRESS_RESERVED_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreAddressReserved(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Reserved << SEMAPHOREADDRESS_RESERVED_BIT_SHIFT);
|
||||
}
|
||||
} MI_SEMAPHORE_WAIT;
|
||||
STATIC_ASSERT(16 == sizeof(MI_SEMAPHORE_WAIT));
|
||||
typedef struct tagMI_STORE_DATA_IMM {
|
||||
union tagTheStructure {
|
||||
struct tagCommon {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -381,4 +381,112 @@ typedef struct tagMI_MATH_ALU_INST_INLINE {
|
||||
uint32_t Value;
|
||||
} DW0;
|
||||
} MI_MATH_ALU_INST_INLINE;
|
||||
typedef struct tagMI_SEMAPHORE_WAIT {
|
||||
union tagTheStructure {
|
||||
struct tagCommon {
|
||||
uint32_t DwordLength : BITFIELD_RANGE(0, 7);
|
||||
uint32_t Reserved_8 : BITFIELD_RANGE(8, 11);
|
||||
uint32_t CompareOperation : BITFIELD_RANGE(12, 14);
|
||||
uint32_t WaitMode : BITFIELD_RANGE(15, 15);
|
||||
uint32_t Reserved_16 : BITFIELD_RANGE(16, 21);
|
||||
uint32_t MemoryType : BITFIELD_RANGE(22, 22);
|
||||
uint32_t MiCommandOpcode : BITFIELD_RANGE(23, 28);
|
||||
uint32_t CommandType : BITFIELD_RANGE(29, 31);
|
||||
uint32_t SemaphoreDataDword;
|
||||
uint64_t Reserved_64 : BITFIELD_RANGE(0, 1);
|
||||
uint64_t SemaphoreAddress_Graphicsaddress : BITFIELD_RANGE(2, 47);
|
||||
uint64_t SemaphoreAddress_Reserved : BITFIELD_RANGE(48, 63);
|
||||
} Common;
|
||||
uint32_t RawData[4];
|
||||
} TheStructure;
|
||||
typedef enum tagDWORD_LENGTH {
|
||||
DWORD_LENGTH_EXCLUDES_DWORD_0_1 = 0x2,
|
||||
} DWORD_LENGTH;
|
||||
typedef enum tagCOMPARE_OPERATION {
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_SDD = 0x0,
|
||||
COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD = 0x1,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_SDD = 0x2,
|
||||
COMPARE_OPERATION_SAD_LESS_THAN_OR_EQUAL_SDD = 0x3,
|
||||
COMPARE_OPERATION_SAD_EQUAL_SDD = 0x4,
|
||||
COMPARE_OPERATION_SAD_NOT_EQUAL_SDD = 0x5,
|
||||
} COMPARE_OPERATION;
|
||||
typedef enum tagWAIT_MODE {
|
||||
WAIT_MODE_SIGNAL_MODE = 0x0,
|
||||
WAIT_MODE_POLLING_MODE = 0x1,
|
||||
} WAIT_MODE;
|
||||
typedef enum tagMEMORY_TYPE {
|
||||
MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS = 0x0,
|
||||
MEMORY_TYPE_GLOBAL_GRAPHICS_ADDRESS = 0x1,
|
||||
} MEMORY_TYPE;
|
||||
typedef enum tagMI_COMMAND_OPCODE {
|
||||
MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT = 0x1c,
|
||||
} MI_COMMAND_OPCODE;
|
||||
typedef enum tagCOMMAND_TYPE {
|
||||
COMMAND_TYPE_MI_COMMAND = 0x0,
|
||||
} COMMAND_TYPE;
|
||||
inline void init(void) {
|
||||
memset(&TheStructure, 0, sizeof(TheStructure));
|
||||
TheStructure.Common.DwordLength = DWORD_LENGTH_EXCLUDES_DWORD_0_1;
|
||||
TheStructure.Common.CompareOperation = COMPARE_OPERATION_SAD_GREATER_THAN_SDD;
|
||||
TheStructure.Common.WaitMode = WAIT_MODE_SIGNAL_MODE;
|
||||
TheStructure.Common.MemoryType = MEMORY_TYPE_PER_PROCESS_GRAPHICS_ADDRESS;
|
||||
TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_SEMAPHORE_WAIT;
|
||||
TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND;
|
||||
}
|
||||
static tagMI_SEMAPHORE_WAIT sInit(void) {
|
||||
MI_SEMAPHORE_WAIT state;
|
||||
state.init();
|
||||
return state;
|
||||
}
|
||||
inline uint32_t &getRawData(const uint32_t index) {
|
||||
DEBUG_BREAK_IF(index >= 4);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline void setCompareOperation(const COMPARE_OPERATION value) {
|
||||
TheStructure.Common.CompareOperation = value;
|
||||
}
|
||||
inline COMPARE_OPERATION getCompareOperation(void) const {
|
||||
return static_cast<COMPARE_OPERATION>(TheStructure.Common.CompareOperation);
|
||||
}
|
||||
inline void setWaitMode(const WAIT_MODE value) {
|
||||
TheStructure.Common.WaitMode = value;
|
||||
}
|
||||
inline WAIT_MODE getWaitMode(void) const {
|
||||
return static_cast<WAIT_MODE>(TheStructure.Common.WaitMode);
|
||||
}
|
||||
inline void setMemoryType(const MEMORY_TYPE value) {
|
||||
TheStructure.Common.MemoryType = value;
|
||||
}
|
||||
inline MEMORY_TYPE getMemoryType(void) const {
|
||||
return static_cast<MEMORY_TYPE>(TheStructure.Common.MemoryType);
|
||||
}
|
||||
inline void setSemaphoreDataDword(const uint32_t value) {
|
||||
TheStructure.Common.SemaphoreDataDword = value;
|
||||
}
|
||||
inline uint32_t getSemaphoreDataDword(void) const {
|
||||
return (TheStructure.Common.SemaphoreDataDword);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_GRAPHICSADDRESS {
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_GRAPHICSADDRESS_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_GRAPHICSADDRESS;
|
||||
inline void setSemaphoreGraphicsAddress(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Graphicsaddress = value >> SEMAPHOREADDRESS_GRAPHICSADDRESS_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreGraphicsAddress(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Graphicsaddress << SEMAPHOREADDRESS_GRAPHICSADDRESS_BIT_SHIFT);
|
||||
}
|
||||
typedef enum tagSEMAPHOREADDRESS_RESERVED {
|
||||
SEMAPHOREADDRESS_RESERVED_BIT_SHIFT = 0x2,
|
||||
SEMAPHOREADDRESS_RESERVED_ALIGN_SIZE = 0x4,
|
||||
} SEMAPHOREADDRESS_RESERVED;
|
||||
inline void setSemaphoreAddressReserved(const uint64_t value) {
|
||||
TheStructure.Common.SemaphoreAddress_Reserved = value >> SEMAPHOREADDRESS_RESERVED_BIT_SHIFT;
|
||||
}
|
||||
inline uint64_t getSemaphoreAddressReserved(void) const {
|
||||
return (TheStructure.Common.SemaphoreAddress_Reserved << SEMAPHOREADDRESS_RESERVED_BIT_SHIFT);
|
||||
}
|
||||
} MI_SEMAPHORE_WAIT;
|
||||
STATIC_ASSERT(16 == sizeof(MI_SEMAPHORE_WAIT));
|
||||
|
||||
#pragma pack()
|
||||
|
@ -37,6 +37,7 @@ DECLARE_DEBUG_VARIABLE(bool, AddPatchInfoCommentsForAUBDump, false, "Dump commen
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, InitializeMemoryInDebug, 0x10, "Memory initialization in debug")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, SchedulerSimulationReturnInstance, 0, "prints execution model related debug information")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, SchedulerGWS, 0, "Forces gws of scheduler kernel, only multiple of 24 allowed or 0 - default selected")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableExperimentalCommandBuffer, 0, "Enables injection of experimental command buffer")
|
||||
DECLARE_DEBUG_VARIABLE(bool, EnableDebugBreak, true, "Enable DEBUG_BREAKs")
|
||||
DECLARE_DEBUG_VARIABLE(bool, FlushAllCaches, false, "pipe controls between enqueues flush all possible caches")
|
||||
DECLARE_DEBUG_VARIABLE(bool, MakeEachEnqueueBlocking, false, "equivalent of finish after each enqueue")
|
||||
|
Reference in New Issue
Block a user