mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
[1/N] Program refactor - decouple from patchokens
Change-Id: I63bbf6c31a5db9e788124f22b6105e65c16c86d4
This commit is contained in:
committed by
sys_ocldev
parent
412c88cf9b
commit
355e8d3e5a
@@ -30,6 +30,10 @@ typedef struct tagBINDING_TABLE_STATE {
|
||||
DEBUG_BREAK_IF(index >= 1);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline const uint32_t &getRawData(const uint32_t index) const {
|
||||
DEBUG_BREAK_IF(index >= 1);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
typedef enum tagSURFACESTATEPOINTER {
|
||||
SURFACESTATEPOINTER_BIT_SHIFT = 0x6,
|
||||
SURFACESTATEPOINTER_ALIGN_SIZE = 0x40,
|
||||
|
||||
@@ -30,6 +30,10 @@ typedef struct tagBINDING_TABLE_STATE {
|
||||
DEBUG_BREAK_IF(index >= 1);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline const uint32_t &getRawData(const uint32_t index) const {
|
||||
DEBUG_BREAK_IF(index >= 1);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
typedef enum tagSURFACESTATEPOINTER {
|
||||
SURFACESTATEPOINTER_BIT_SHIFT = 0x6,
|
||||
SURFACESTATEPOINTER_ALIGN_SIZE = 0x40,
|
||||
|
||||
@@ -30,6 +30,10 @@ typedef struct tagBINDING_TABLE_STATE {
|
||||
DEBUG_BREAK_IF(index >= 1);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline const uint32_t &getRawData(const uint32_t index) const {
|
||||
DEBUG_BREAK_IF(index >= 1);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
typedef enum tagSURFACESTATEPOINTER {
|
||||
SURFACESTATEPOINTER_BIT_SHIFT = 0x6,
|
||||
SURFACESTATEPOINTER_ALIGN_SIZE = 0x40,
|
||||
|
||||
@@ -30,6 +30,10 @@ typedef struct tagBINDING_TABLE_STATE {
|
||||
DEBUG_BREAK_IF(index >= 1);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
inline const uint32_t &getRawData(const uint32_t index) const {
|
||||
DEBUG_BREAK_IF(index >= 1);
|
||||
return TheStructure.RawData[index];
|
||||
}
|
||||
typedef enum tagSURFACESTATEPOINTER {
|
||||
SURFACESTATEPOINTER_BIT_SHIFT = 0x6,
|
||||
SURFACESTATEPOINTER_ALIGN_SIZE = 0x40,
|
||||
|
||||
@@ -25,7 +25,7 @@ class GmmHelper;
|
||||
class HwHelper {
|
||||
public:
|
||||
static HwHelper &get(GFXCORE_FAMILY gfxCore);
|
||||
virtual uint32_t getBindingTableStateSurfaceStatePointer(void *pBindingTable, uint32_t index) = 0;
|
||||
virtual uint32_t getBindingTableStateSurfaceStatePointer(const void *pBindingTable, uint32_t index) = 0;
|
||||
virtual size_t getBindingTableStateSize() const = 0;
|
||||
virtual uint32_t getBindingTableStateAlignement() const = 0;
|
||||
virtual size_t getInterfaceDescriptorDataSize() const = 0;
|
||||
@@ -88,10 +88,10 @@ class HwHelperHw : public HwHelper {
|
||||
|
||||
static const aub_stream::EngineType lowPriorityEngineType;
|
||||
|
||||
uint32_t getBindingTableStateSurfaceStatePointer(void *pBindingTable, uint32_t index) override {
|
||||
uint32_t getBindingTableStateSurfaceStatePointer(const void *pBindingTable, uint32_t index) override {
|
||||
using BINDING_TABLE_STATE = typename GfxFamily::BINDING_TABLE_STATE;
|
||||
|
||||
BINDING_TABLE_STATE *bindingTableState = static_cast<BINDING_TABLE_STATE *>(pBindingTable);
|
||||
const BINDING_TABLE_STATE *bindingTableState = static_cast<const BINDING_TABLE_STATE *>(pBindingTable);
|
||||
return bindingTableState[index].getRawData(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,14 +47,33 @@ inline void *addrToPtr(IntegerAddressType addr) {
|
||||
return ptrReturn;
|
||||
}
|
||||
|
||||
inline void patchWithRequiredSize(void *memoryToBePatched, uint32_t patchSize, uintptr_t patchValue) {
|
||||
if (patchSize == sizeof(uint64_t)) {
|
||||
uint64_t *curbeAddress = (uint64_t *)memoryToBePatched;
|
||||
*curbeAddress = patchValue;
|
||||
} else {
|
||||
uint32_t *curbeAddress = (uint32_t *)memoryToBePatched;
|
||||
*curbeAddress = (uint32_t)patchValue;
|
||||
struct PatchStoreOperation {
|
||||
template <typename T>
|
||||
void operator()(T *memory, T value) {
|
||||
*memory = value;
|
||||
}
|
||||
};
|
||||
|
||||
struct PatchIncrementOperation {
|
||||
template <typename T>
|
||||
void operator()(T *memory, T value) {
|
||||
*memory += value;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PatchOperationT = PatchStoreOperation>
|
||||
inline void patchWithRequiredSize(void *memoryToBePatched, uint32_t patchSize, uint64_t patchValue) {
|
||||
if (patchSize == sizeof(uint64_t)) {
|
||||
uint64_t *curbeAddress = reinterpret_cast<uint64_t *>(memoryToBePatched);
|
||||
PatchOperationT{}(curbeAddress, patchValue);
|
||||
} else {
|
||||
uint32_t *curbeAddress = reinterpret_cast<uint32_t *>(memoryToBePatched);
|
||||
PatchOperationT{}(curbeAddress, static_cast<uint32_t>(patchValue));
|
||||
}
|
||||
}
|
||||
|
||||
inline void patchIncrement(void *memoryToBePatched, uint32_t patchSize, uint64_t patchIncrementValue) {
|
||||
patchWithRequiredSize<PatchIncrementOperation>(memoryToBePatched, patchSize, patchIncrementValue);
|
||||
}
|
||||
|
||||
inline uint64_t castToUint64(void *address) {
|
||||
|
||||
@@ -1417,14 +1417,17 @@ TEST(StackVec, Clear) {
|
||||
DummyFNode nd2(&destructorCounter);
|
||||
DummyFNode nd3(&destructorCounter);
|
||||
StackVec<DummyFNode, 3> v;
|
||||
EXPECT_TRUE(v.empty());
|
||||
v.push_back(nd1);
|
||||
v.push_back(nd2);
|
||||
v.push_back(nd3);
|
||||
ASSERT_EQ(0U, destructorCounter);
|
||||
ASSERT_EQ(3U, v.size());
|
||||
EXPECT_FALSE(v.empty());
|
||||
v.clear();
|
||||
ASSERT_EQ(3U, destructorCounter);
|
||||
ASSERT_EQ(0U, v.size());
|
||||
EXPECT_TRUE(v.empty());
|
||||
|
||||
StackVec<DummyFNode, 1> v2;
|
||||
v2.push_back(nd1);
|
||||
@@ -1561,11 +1564,13 @@ TEST(ArrayRef, WrapContainers) {
|
||||
ASSERT_EQ(35, sum(carray));
|
||||
|
||||
ArrayRef<int> ar2;
|
||||
EXPECT_TRUE(ar2.empty());
|
||||
ASSERT_EQ(0U, ar2.size());
|
||||
ASSERT_EQ(nullptr, ar2.begin());
|
||||
ASSERT_EQ(nullptr, ar2.end());
|
||||
|
||||
ar2 = carray;
|
||||
EXPECT_FALSE(ar2.empty());
|
||||
ASSERT_EQ(sizeof(carray) / sizeof(carray[0]), ar2.size());
|
||||
ASSERT_EQ(35, sum(ar2));
|
||||
|
||||
|
||||
@@ -45,10 +45,24 @@ class ArrayRef {
|
||||
|
||||
ArrayRef() = default;
|
||||
|
||||
ArrayRef(const ArrayRef &src)
|
||||
: begIt(src.begIt), endIt(src.endIt) {
|
||||
}
|
||||
|
||||
ArrayRef &operator=(const ArrayRef &src) {
|
||||
this->begIt = src.begIt;
|
||||
this->endIt = src.endIt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t size() const {
|
||||
return endIt - begIt;
|
||||
}
|
||||
|
||||
bool empty() const {
|
||||
return (0U == size());
|
||||
}
|
||||
|
||||
DataType &operator[](std::size_t idx) {
|
||||
return begIt[idx];
|
||||
}
|
||||
|
||||
@@ -133,6 +133,10 @@ class StackVec {
|
||||
return onStackSize;
|
||||
}
|
||||
|
||||
bool empty() const {
|
||||
return 0U == size();
|
||||
}
|
||||
|
||||
size_t capacity() const {
|
||||
if (dynamicMem) {
|
||||
return dynamicMem->capacity();
|
||||
|
||||
Reference in New Issue
Block a user