SWDEV-351969 - TLS Optimization

- Aggregate all TLS(Thread Local Storage) variables into a single class
- This is to improve cache accesses per thread

Change-Id: Ic8361eaeae290fff00254684e309471958365eb9


[ROCm/clr commit: 8b391ef18c]
This commit is contained in:
Rakesh Roy
2022-09-26 15:59:27 +05:30
zatwierdzone przez Rakesh Roy
rodzic 2be45a82ec
commit f149b21399
9 zmienionych plików z 145 dodań i 115 usunięć
@@ -29,7 +29,6 @@
constexpr unsigned __hipFatMAGIC2 = 0x48495046; // "HIPF"
thread_local std::stack<ihipExec_t> execStack_;
PlatformState* PlatformState::platform_; // Initiaized as nullptr by default
// forward declaration of methods required for __hipRegisrterManagedVar
@@ -920,7 +919,7 @@ hipError_t PlatformState::initStatManagedVarDevicePtr(int deviceId) {
}
void PlatformState::setupArgument(const void* arg, size_t size, size_t offset) {
auto& arguments = execStack_.top().arguments_;
auto& arguments = hip::tls.exec_stack_.top().arguments_;
if (arguments.size() < offset + size) {
arguments.resize(offset + size);
@@ -931,10 +930,10 @@ void PlatformState::setupArgument(const void* arg, size_t size, size_t offset) {
void PlatformState::configureCall(dim3 gridDim, dim3 blockDim, size_t sharedMem,
hipStream_t stream) {
execStack_.push(ihipExec_t{gridDim, blockDim, sharedMem, stream});
hip::tls.exec_stack_.push(ihipExec_t{gridDim, blockDim, sharedMem, stream});
}
void PlatformState::popExec(ihipExec_t& exec) {
exec = std::move(execStack_.top());
execStack_.pop();
exec = std::move(hip::tls.exec_stack_.top());
hip::tls.exec_stack_.pop();
}