mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 21:27:04 +08:00
[perf] simplify setting constant buffer and improve performance
- no need to count parameters - remove unrecoverable which requires fetching additional fields. Related-To: NEO-5170 Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
49424eb859
commit
c77d954900
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -282,18 +282,17 @@ inline bool patchNonPointer(ArrayRef<uint8_t> buffer, CrossThreadDataOffset loca
|
||||
if (undefined<CrossThreadDataOffset> == location) {
|
||||
return false;
|
||||
}
|
||||
UNRECOVERABLE_IF(location + sizeof(DstT) > buffer.size());
|
||||
DEBUG_BREAK_IF(location + sizeof(DstT) > buffer.size());
|
||||
*reinterpret_cast<DstT *>(buffer.begin() + location) = static_cast<DstT>(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <uint32_t VecSize, typename T>
|
||||
inline uint32_t patchVecNonPointer(ArrayRef<uint8_t> buffer, const CrossThreadDataOffset (&location)[VecSize], const T (&value)[VecSize]) {
|
||||
uint32_t numPatched = 0;
|
||||
inline void patchVecNonPointer(ArrayRef<uint8_t> buffer, const CrossThreadDataOffset (&location)[VecSize], const T (&value)[VecSize]) {
|
||||
for (uint32_t i = 0; i < VecSize; ++i) {
|
||||
numPatched += patchNonPointer<T, T>(buffer, location[i], value[i]) ? 1 : 0;
|
||||
patchNonPointer<T, T>(buffer, location[i], value[i]);
|
||||
}
|
||||
return numPatched;
|
||||
return;
|
||||
}
|
||||
|
||||
inline bool patchPointer(ArrayRef<uint8_t> buffer, const ArgDescPointer &arg, uintptr_t value) {
|
||||
|
||||
Reference in New Issue
Block a user